本文整理汇总了Java中org.red5.server.api.scope.IScopeHandler类的典型用法代码示例。如果您正苦于以下问题:Java IScopeHandler类的具体用法?Java IScopeHandler怎么用?Java IScopeHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IScopeHandler类属于org.red5.server.api.scope包,在下文中一共展示了IScopeHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invokeCall
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Remoting call invocation handler.
*
* @param conn
* RTMP connection
* @param call
* Service call
*/
protected void invokeCall(RTMPConnection conn, IServiceCall call) {
final IScope scope = conn.getScope();
if (scope != null) {
if (scope.hasHandler()) {
final IScopeHandler handler = scope.getHandler();
log.debug("Scope: {} handler: {}", scope, handler);
if (!handler.serviceCall(conn, call)) {
// XXX: What to do here? Return an error?
log.warn("Scope: {} handler failed on service call", scope.getName(), new Exception("Service call failed"));
return;
}
}
final IContext context = scope.getContext();
log.debug("Context: {}", context);
context.getServiceInvoker().invoke(call, scope);
} else {
log.warn("Scope was null for invoke: {} connection state: {}", call.getServiceMethodName(), conn.getStateCode());
}
}
示例2: resolveService
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/** {@inheritDoc} */
public Object resolveService(IScope scope, String serviceName) {
IScopeHandler handler = scope.getHandler();
if (handler instanceof IServiceHandlerProvider) {
// TODO: deprecate this?
Object result = ((IServiceHandlerProvider) handler).getServiceHandler(serviceName);
if (result != null) {
return result;
}
}
if (handler instanceof IServiceHandlerProviderAware) {
IServiceHandlerProvider shp = ((IServiceHandlerProviderAware) handler).getServiceHandlerProvider();
if (shp != null) {
return shp.getServiceHandler(serviceName);
}
}
return null;
}
示例3: resolveService
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/** {@inheritDoc} */
public Object resolveService(IScope scope, String serviceName) {
IScopeHandler handler = scope.getHandler();
if (handler instanceof IServiceHandlerProvider) {
// TODO: deprecate this?
Object result = ((IServiceHandlerProvider) handler)
.getServiceHandler(serviceName);
if (result != null) {
return result;
}
}
if (handler instanceof IServiceHandlerProviderAware) {
IServiceHandlerProvider shp = ((IServiceHandlerProviderAware) handler)
.getServiceHandlerProvider();
if (shp != null) {
return shp.getServiceHandler(serviceName);
}
}
return null;
}
示例4: getStreamAwareHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Return stream aware scope handler or null if scope is null.
*
* @return IStreamAwareScopeHandler implementation
*/
protected IStreamAwareScopeHandler getStreamAwareHandler() {
if (scope != null) {
IScopeHandler handler = scope.getHandler();
if (handler instanceof IStreamAwareScopeHandler) {
return (IStreamAwareScopeHandler) handler;
}
}
return null;
}
示例5: getHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Return scope handler or parent's scope handler if this scope doesn't have one.
*
* @return Scope handler (or parent's one)
*/
public IScopeHandler getHandler() {
log.trace("getHandler from {}", name);
if (handler != null) {
return handler;
} else if (hasParent()) {
return getParent().getHandler();
} else {
return null;
}
}
示例6: setHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Setter for scope event handler
*
* @param handler
* Event handler
*/
public void setHandler(IScopeHandler handler) {
log.debug("setHandler: {} on {}", handler, name);
this.handler = handler;
if (handler instanceof IScopeAware) {
((IScopeAware) handler).setScope(this);
}
}
示例7: remove
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
@Override
public Boolean remove(Object scope) {
log.debug("Remove child scope: {}", scope);
//log.trace("remove - Hold counts - read: {} write: {} queued: {}", internalLock.getReadHoldCount(), internalLock.getWriteHoldCount(), internalLock.hasQueuedThreads());
if (hasHandler()) {
IScopeHandler hdlr = getHandler();
log.debug("Removing child scope: {}", (((IBasicScope) scope).getName()));
hdlr.removeChildScope((IBasicScope) scope);
if (scope instanceof Scope) {
// cast it
Scope scp = (Scope) scope;
// stop the scope
scp.stop();
}
} else {
log.debug("No handler found for {}", this);
}
boolean removed = false;
try {
if (containsKey(scope)) {
// remove the entry, ensure removed value is equal to the given object
removed = super.remove(scope).equals(Boolean.TRUE);
if (removed) {
subscopeStats.decrement();
} else {
log.debug("Subscope was not removed");
}
} else {
log.debug("Subscope was not removed, it was not found");
}
} catch (Exception e) {
log.warn("Exception on remove", e);
}
return removed;
}
示例8: lookupScopeHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Look up scope handler for context path
*
* @param contextPath
* Context path
* @return Scope handler
* @throws ScopeHandlerNotFoundException
* If there's no handler for given context path
*/
public IScopeHandler lookupScopeHandler(String contextPath) {
// Get target scope handler name
String scopeHandlerName = getMappingStrategy().mapScopeHandlerName(contextPath);
// Get bean from bean factory
Object bean = applicationContext.getBean(scopeHandlerName);
if (bean != null && bean instanceof IScopeHandler) {
return (IScopeHandler) bean;
} else {
throw new ScopeHandlerNotFoundException(scopeHandlerName);
}
}
示例9: getStreamAwareHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Return stream aware scope handler or null if scope is null
* @return IStreamAwareScopeHandler implementation
*/
protected IStreamAwareScopeHandler getStreamAwareHandler() {
if (scope != null) {
IScopeHandler handler = scope.getHandler();
if (handler instanceof IStreamAwareScopeHandler) {
return (IStreamAwareScopeHandler) handler;
}
}
return null;
}
示例10: lookupScopeHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Look up scope handler for context path
*
* @param contextPath Context path
* @return Scope handler
* @throws ScopeHandlerNotFoundException If there's no handler for given context path
*/
public IScopeHandler lookupScopeHandler(String contextPath) {
// Get target scope handler name
String scopeHandlerName = getMappingStrategy().mapScopeHandlerName(contextPath);
// Get bean from bean factory
Object bean = applicationContext.getBean(scopeHandlerName);
if (bean != null && bean instanceof IScopeHandler) {
return (IScopeHandler) bean;
} else {
throw new ScopeHandlerNotFoundException(scopeHandlerName);
}
}
示例11: getHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Return scope handler or parent's scope handler if this scope doesn't have
* one
*
* @return Scope handler (or parent's one)
*/
public IScopeHandler getHandler() {
if (handler != null) {
return handler;
} else if (hasParent()) {
return getParent().getHandler();
} else {
return null;
}
}
示例12: setHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Setter for scope event handler
*
* @param handler Event handler
*/
public void setHandler(IScopeHandler handler) {
log.debug("Set handler: {}", handler);
this.handler = handler;
if (handler instanceof IScopeAware) {
((IScopeAware) handler).setScope(this);
}
}
示例13: invokeCall
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Remoting call invocation handler.
*
* @param conn RTMP connection
* @param call Service call
*/
protected void invokeCall(RTMPConnection conn, IServiceCall call) {
final IScope scope = conn.getScope();
if (scope.hasHandler()) {
final IScopeHandler handler = scope.getHandler();
log.debug("Scope: {} handler: {}", scope, handler);
if (!handler.serviceCall(conn, call)) {
// XXX: What to do here? Return an error?
return;
}
}
final IContext context = scope.getContext();
log.debug("Context: {}", context);
context.getServiceInvoker().invoke(call, scope);
}
示例14: add
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
public boolean add(IBasicScope scope) {
//log.trace("add - Hold counts - read: {} write: {} queued: {}", internalLock.getReadHoldCount(), internalLock.getWriteHoldCount(), internalLock.hasQueuedThreads());
boolean added = false;
// check #1
if (!containsKey(scope)) {
log.debug("Adding child scope: {} to {}", (((IBasicScope) scope).getName()), this);
if (hasHandler()) {
// get the handler for the scope to which we are adding this new scope
IScopeHandler hdlr = getHandler();
// add the scope to the handler
if (!hdlr.addChildScope(scope)) {
log.warn("Failed to add child scope: {} to {}", scope, this);
return false;
}
} else {
log.debug("No handler found for {}", this);
}
try {
// check #2 for entry
if (!containsKey(scope)) {
// add the entry
// expected return from put is null; indicating this scope didn't already exist
added = (super.put(scope, Boolean.TRUE) == null);
if (added) {
subscopeStats.increment();
} else {
log.debug("Subscope was not added");
}
} else {
log.debug("Subscope already exists");
}
} catch (Exception e) {
log.warn("Exception on add", e);
}
if (added && scope instanceof Scope) {
// cast it
Scope scp = (Scope) scope;
// start the scope
if (scp.start()) {
log.debug("Child scope started");
} else {
log.debug("Failed to start child scope: {} in {}", scope, this);
}
}
}
return added;
}
示例15: lookupScopeHandler
import org.red5.server.api.scope.IScopeHandler; //导入依赖的package包/类
/**
* Returns scope handler (object that handle all actions related to the scope) by path. See {@link IScopeHandler} for details.
*
* @param path
* Path of scope handler
* @return Scope handler
*/
IScopeHandler lookupScopeHandler(String path);