Package org.red5.server.api

Examples of org.red5.server.api.IContext


    public void runTest() throws Throwable {
      Red5.setConnectionLocal(conn);

      IClient client = conn.getClient();
      IScope scope = (WebScope) conn.getScope();
      IContext context = (Context) scope.getContext();

      IClientRegistry reg = context.getClientRegistry();

      IServiceCapableConnection serviceCapCon = null;

      //start standard process
      assertTrue(conn.connect(scope));
View Full Code Here


        bs.setPublishedName(name);
        // set stream parameters if they exist
        if (params != null) {
          bs.setParameters(params);
        }
        IContext context = conn.getScope().getContext();
        IProviderService providerService = (IProviderService) context.getBean(IProviderService.BEAN_NAME);
        // TODO handle registration failure
        if (providerService.registerBroadcastStream(conn.getScope(), name, bs)) {
          bsScope = getBroadcastScope(conn.getScope(), name);
          bsScope.setClientBroadcastStream(bs);
          if (conn instanceof BaseConnection) {
View Full Code Here

        log.error("Packet should not be null");
        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 scope               Scope
   */
  public FilePersistence(IScope scope) {
    super(scope);
    setPath(path);
    IContext ctx = scope.getContext();
    if (ctx.hasBean(ISchedulingService.BEAN_NAME)) {
      schedulingService = (ISchedulingService) ctx.getBean(ISchedulingService.BEAN_NAME);
    } else {
      //try the parent
      schedulingService = (ISchedulingService) scope.getParent().getContext().getBean(ISchedulingService.BEAN_NAME);
    }
    // add the job
View Full Code Here

      }
      // Get previously registered handler for service
      Object soHandler = getServiceHandler(serviceName);
      if (soHandler == null && hasParent()) {
        // No custom handler, check for service defined in the scope's context
        IContext context = getParent().getContext();
        String serviceId = null;
        try {
          // The bean must have a name of
          // "<SharedObjectName>.<DottedServiceName>.soservice"
          serviceId = so.getName() + '.' + serviceName + ".soservice";
          if (context.hasBean(serviceId)) {
            soHandler = context.getBean(serviceId);
          }
        } catch (Exception err) {
          log.debug("No such bean: {}", serviceId);
        }
      }
View Full Code Here

   *            Class of service
   * @return        Service object
   */
  protected static Object getScopeService(IScope scope, String name, Class<?> defaultClass) {
    if (scope != null) {
      final IContext context = scope.getContext();
      ApplicationContext appCtx = context.getApplicationContext();
      Object result;
      if (!appCtx.containsBean(name)) {
        if (defaultClass == null) {
          return null;
        }
View Full Code Here

  public void start() {
    //ensure the play engine exists
    if (engine == null) {
      IScope scope = getScope();
      if (scope != null) {
        IContext ctx = scope.getContext();
        if (ctx.hasBean(ISchedulingService.BEAN_NAME)) {
          schedulingService = (ISchedulingService) ctx.getBean(ISchedulingService.BEAN_NAME);
        } else {
          //try the parent
          schedulingService = (ISchedulingService) scope.getParent().getContext().getBean(ISchedulingService.BEAN_NAME);
        }
        IConsumerService consumerService = null;
        if (ctx.hasBean(IConsumerService.KEY)) {
          consumerService = (IConsumerService) ctx.getBean(IConsumerService.KEY);
        } else {
          //try the parent
          consumerService = (IConsumerService) scope.getParent().getContext().getBean(IConsumerService.KEY);
        }
        IProviderService providerService = null;
        if (ctx.hasBean(IProviderService.BEAN_NAME)) {
          providerService = (IProviderService) ctx.getBean(IProviderService.BEAN_NAME);
        } else {
          //try the parent
          providerService = (IProviderService) scope.getParent().getContext().getBean(IProviderService.BEAN_NAME);
        }
View Full Code Here

    // /default/junit/room1
    assertFalse(appScope.createChildScope("room1")); // room1 is defined in context xml file, this should fail
    IScope room1 = appScope.getScope("room1");
    log.debug("Room 1: {}", room1);
    assertTrue(room1.getDepth() == 2);
    IContext rmCtx1 = room1.getContext();
    log.debug("Context 1: {}", rmCtx1);
    //Room 2
    // /default/junit/room1/room2
    if (room1.getScope("room2") == null) {
      assertTrue(room1.createChildScope("room2"));
    }
    IScope room2 = room1.getScope("room2");
    log.debug("Room 2: {}", room2);
    assertNotNull(room2);
    assertTrue(room2.getDepth() == 3);
    IContext rmCtx2 = room2.getContext();
    log.debug("Context 2: {}", rmCtx2);
    //Room 3
    // /default/junit/room1/room2/room3
    if (room2.getScope("room3") == null) {
      assertTrue(room2.createChildScope("room3"));
    }
    IScope room3 = room2.getScope("room3");
    log.debug("Room 3: {}", room3);
    assertNotNull(room3);
    assertTrue(room3.getDepth() == 4);
    IContext rmCtx3 = room3.getContext();
    log.debug("Context 3: {}", rmCtx3);
    //Room 4 attaches at Room 1 (per bug example)
    // /default/junit/room1/room4
    if (room1.getScope("room4") == null) {
      assertTrue(room1.createChildScope("room4"));
    }
    IScope room4 = room1.getScope("room4");
    log.debug("Room 4: {}", room4);
    assertNotNull(room4);
    assertTrue(room4.getDepth() == 3);
    IContext rmCtx4 = room4.getContext();
    log.debug("Context 4: {}", rmCtx4);
    //Room 5
    // /default/junit/room1/room4/room5
    if (room4.getScope("room5") == null) {
      assertTrue(room4.createChildScope("room5"));
    }
    IScope room5 = room4.getScope("room5");
    log.debug("Room 5: {}", room5);
    assertNotNull(room5);
    assertTrue(room5.getDepth() == 4);
    IContext rmCtx5 = room5.getContext();
    log.debug("Context 5: {}", rmCtx5);
  }
View Full Code Here

  @Test
  public void context() {
    log.debug("-----------------------------------------------------------------context");
    IScope testRoom = context.resolveScope(roomPath);
    IContext context = testRoom.getContext();
    assertTrue("context should not be null", context != null);
    log.debug("{}", testRoom.getContext().getResource(""));
    log.debug("{}", testRoom.getResource(""));
    log.debug("{}", testRoom.getParent().getResource(""));
  }
View Full Code Here

            // 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());
    }
  }
View Full Code Here

TOP

Related Classes of org.red5.server.api.IContext

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.