Package org.red5.server.api.scope

Examples of org.red5.server.api.scope.IScope


   */
  public static void setConnectionLocal(IConnection connection) {
    log.debug("Set connection: {} with thread: {}", (connection != null ? connection.getSessionId() : null), Thread.currentThread().getName());
    if (connection != null) {
      connThreadLocal.set(new WeakReference<IConnection>(connection));
      IScope scope = connection.getScope();
      if (scope != null) {
        Thread.currentThread().setContextClassLoader(scope.getClassLoader());
      }
    } else {
      // use null to clear the value
      connThreadLocal.remove();
    }
View Full Code Here


  /** {@inheritDoc} */
  public void play(String name, int start, int length, boolean flushPlaylist) {
    log.debug("Play called - name: {} start: {} length: {} flush playlist: {}", new Object[] { name, start, length, flushPlaylist });
    IConnection conn = Red5.getConnectionLocal();
    if (conn instanceof IStreamCapableConnection) {
      IScope scope = conn.getScope();
      IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
      int streamId = conn.getStreamId();
      if (StringUtils.isEmpty(name)) {
        sendNSFailed(streamConn, StatusCodes.NS_FAILED, "The stream name may not be empty.", name, streamId);
        return;
View Full Code Here

      // grab the streams name
      name = name.substring(0, name.indexOf("?"));
    }
    IConnection conn = Red5.getConnectionLocal();
    if (conn instanceof IStreamCapableConnection) {
      IScope scope = conn.getScope();
      IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
      int streamId = conn.getStreamId();
      if (StringUtils.isEmpty(name)) {
        sendNSFailed(streamConn, StatusCodes.NS_FAILED, "The stream name may not be empty.", name, streamId);
        return;
View Full Code Here

    //
    // -2: live then recorded, -1: live, >=0: recorded
    int type = (int) (item.getStart() / 1000);
    log.debug("Type {}", type);
    // see if it's a published stream
    IScope thisScope = subscriberStream.getScope();
    final String itemName = item.getName();
    //check for input and type
    IProviderService.INPUT_TYPE sourceType = providerService.lookupProviderInput(thisScope, itemName, type);

    boolean isPublishedStream = sourceType == IProviderService.INPUT_TYPE.LIVE;
View Full Code Here

   *
   * @param itemName name of the item to play
   */
  private final void connectToProvider(String itemName) {
    log.debug("Attempting connection to {}", itemName);
    IScope thisScope = subscriberStream.getScope();
    msgIn = providerService.getLiveProviderInput(thisScope, itemName, true);
    if (msgIn != null) {
      log.debug("Provider: {}", msgIn);
      if (msgIn.subscribe(this, null)) {
        log.debug("Subscribed to {} provider", itemName);
View Full Code Here

      if (clients.add(client) && addEventListener(conn)) {
        log.debug("Added client");
        // increment conn stats
        connectionStats.increment();
        // get connected scope
        IScope connScope = conn.getScope();
        log.trace("Connection scope: {}", connScope);
        if (this.equals(connScope)) {
          final IServer server = getServer();
          if (server instanceof Server) {
            ((Server) server).notifyConnected(conn);
View Full Code Here

   *
   * @return the server instance
   */
  public IServer getServer() {
    if (hasParent()) {
      final IScope parent = getParent();
      if (parent instanceof Scope) {
        return ((Scope) parent).getServer();
      } else if (parent instanceof IGlobalScope) {
        return ((IGlobalScope) parent).getServer();
      }
View Full Code Here

   *
   * @param cd composite data
   * @return Scope class instance
   */
  public static Scope from(CompositeData cd) {
    IScope parent = null;
    ScopeType type = ScopeType.UNDEFINED;
    String name = null;
    boolean persistent = false;
    if (cd.containsKey("parent")) {
      parent = (IScope) cd.get("parent");
View Full Code Here

        return;
      }
      // Provide a valid IConnection in the Red5 object
      final IGlobalScope global = getGlobalScope(req);
      final IContext context = global.getContext();
      final IScope scope = context.resolveScope(global, packet.getScopePath());
      conn = new RemotingConnection(req, scope, packet);
      // Make sure the connection object isn't garbage collected
      req.setAttribute(CONNECTION, conn);
      // set thread local reference
      Red5.setConnectionLocal(conn);
View Full Code Here

   * @param path Path to resolve
   * @return  Resolved scope
   */
  public static IScope resolveScope(IScope from, String path) {
    log.debug("resolveScope from: {} path: {}", from.getName(), path);
    IScope current = from;
    if (path.startsWith(SLASH)) {
      current = ScopeUtils.findRoot(current);
      path = path.substring(1, path.length());
    }
    if (path.endsWith(SLASH)) {
      path = path.substring(0, path.length() - 1);
    }
    log.trace("Current: {}", current);
    String[] parts = path.split(SLASH);
    if (log.isTraceEnabled()) {
      log.trace("Parts: {}", Arrays.toString(parts));
    }
    for (String part : parts) {
      log.trace("Part: {}", part);
      if (part.equals(".")) {
        continue;
      }
      if (part.equals("..")) {
        if (!current.hasParent()) {
          return null;
        }
        current = current.getParent();
        continue;
      }
      if (!current.hasChildScope(part)) {
        return null;
      }
      current = current.getScope(part);
      log.trace("Current: {}", current);
    }
    return current;
  }
View Full Code Here

TOP

Related Classes of org.red5.server.api.scope.IScope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.