Package org.red5.server.api.scope

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


   * Return global scope
   *
   * @return Global scope
   */
  public IGlobalScope getGlobalScope() {
    IGlobalScope gs = scopeResolver.getGlobalScope();
    logger.trace("Global scope: {}", gs);
    return gs;
  }
View Full Code Here


      path = path.substring(1);
    } else {
      log.debug("Path length: {} Servlet name length: {}", path.length(), getServletName().length());
      path = path.substring(0, path.length() - getServletName().length() - 1);
    }
    IGlobalScope global = server.lookupGlobal(req.getServerName(), path);
    if (global == null) {
      global = server.lookupGlobal(req.getLocalName(), path);
      if (global == null) {
        global = server.lookupGlobal(req.getLocalAddr(), path);
      }
View Full Code Here

      if (packet == null) {
        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
View Full Code Here

        params.put("path", path);
        // connection setup
        conn.setup(host, path, params);
        try {
          // Lookup server scope when connected using host and application name
          IGlobalScope global = server.lookupGlobal(host, path);
          log.trace("Global lookup result: {}", global);
          if (global != null) {
            final IContext context = global.getContext();
            IScope scope = null;
            try {
              // TODO optimize this to use Scope instead of Context
              scope = context.resolveScope(global, path);
              // if global scope connection is not allowed, reject
View Full Code Here

  @Test
  public void testGlobalLookupsForVirtualHostsWithSameIP() {
    final Server server = new Server();

    IGlobalScope g0 = new DummyGlobalScope("default");
    IGlobalScope g1 = new DummyGlobalScope("default.vhost1");
    IGlobalScope g2 = new DummyGlobalScope("default.vhost2");
   
    //local server
    server.registerGlobal(g0);
   
    server.addMapping("localhost", "", "default");
    server.addMapping("localhost", "oflaDemo", "default");

    //virtual host 1
   
    server.registerGlobal(g1);

    server.addMapping("", "", "default.vhost1");
    server.addMapping("localhost", "oflaDemo", "default.vhost1");
    server.addMapping("localhost:8088", "", "default.vhost1");
    server.addMapping("127.0.0.1", "oflaDemo", "default.vhost1");
    //
    server.addMapping("vhost1.localdomain", "", "default.vhost1");
    server.addMapping("vhost1.localdomain", "oflaDemo", "default.vhost1");
   
    //virtual host 2
   
    server.registerGlobal(g2);

    server.addMapping("", "", "default.vhost2");
    server.addMapping("localhost", "oflaDemo", "default.vhost2");
    server.addMapping("localhost:8088", "", "default.vhost2");
    server.addMapping("127.0.0.1", "oflaDemo", "default.vhost2");
    //
    server.addMapping("vhost2.localdomain", "", "default.vhost2");
    server.addMapping("vhost2.localdomain", "oflaDemo", "default.vhost2");

    //assertions
   
    Assert.assertTrue(server.lookupGlobal("vhost2.localdomain", "blah") != null);
    Assert.assertTrue(server.lookupGlobal("vhost2.localdomain", "oflaDemo") != null);
   
    IGlobalScope tmp = server.lookupGlobal("vhost2.localdomain", "oflaDemo");
    log.debug("Global 2: {}", tmp);
    Assert.assertTrue(tmp.getName().equals("default.vhost2"));
   
    tmp = server.lookupGlobal("vhost1.localdomain", "oflaDemo");
    log.debug("Global 1: {}", tmp);
    Assert.assertTrue(tmp.getName().equals("default.vhost1"));

  }
View Full Code Here

    int threads = 10;
   
    final Server server = new Server();

    IGlobalScope g0 = new DummyGlobalScope("default");
   
    //local server
    server.registerGlobal(g0);
   
    server.addMapping("localhost", "", "default");
    server.addMapping("localhost", "oflaDemo", "default");
   
    TestRunnable[] trs = new TestRunnable[threads];
    for (int t = 0; t < threads; t++) {
      trs[t] = new HostAddWorker(server, t);
    }

    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);

    //kickstarts the MTTR & fires off threads
    long start = System.nanoTime();
    mttr.runTestRunnables();
    log.info("Runtime: {} ns", (System.nanoTime() - start));

    for (TestRunnable r : trs) {
      String name = ((HostAddWorker) r).getName();
      Assert.assertTrue(server.lookupGlobal(name + ".localdomain", "nonexistentscope") != null);
      IGlobalScope tmp = server.lookupGlobal(name + ".localdomain", "oflaDemo");
      Assert.assertTrue(tmp.getName().equals("default." + name));
    }   
  }
View Full Code Here

      this.server = server;
      this.name = "vhost" + index;
    }

    public void runTest() throws Throwable {
      IGlobalScope gs = new DummyGlobalScope("default." + name);

      server.registerGlobal(gs);
     
      for (int i = 0; i < 6; i++) {
        server.addMapping("", "", "default." + name);
View Full Code Here

    // ------------------------------------------------------------------------

    private void createPlayStream( IPendingServiceCallback callback ) {

        logger.debug( "create play stream" );
        IPendingServiceCallback wrapper = new CreatePlayStreamCallBack( callback );
        invoke( "createStream", null, wrapper );
    }
View Full Code Here

      if (stream.getStreamListeners() != null) {
       
        for (Iterator<IStreamListener> iter = stream.getStreamListeners().iterator();iter.hasNext();) {
         
          IStreamListener iStreamListener = iter.next();
         
          ListenerAdapter listenerAdapter = (ListenerAdapter) iStreamListener;
         
          log.debug("Stream Closing ?? "+listenerAdapter.getFlvRecordingMetaDataId()+ " " +flvRecordingMetaDataId);
         
View Full Code Here

            if ( !( event instanceof IRTMPEvent ) ) {
                logger.debug( "skipping non rtmp event: " + event );
                return;
            }

            IRTMPEvent rtmpEvent = (IRTMPEvent) event;

            if ( logger.isDebugEnabled() ) {
                // logger.debug("rtmp event: " + rtmpEvent.getHeader() + ", " +
                // rtmpEvent.getClass().getSimpleName());
            }

            if ( !( rtmpEvent instanceof IStreamData ) ) {
                logger.debug( "skipping non stream data" );
                return;
            }

            if ( rtmpEvent.getHeader().getSize() == 0 ) {
                logger.debug( "skipping event where size == 0" );
                return;
            }

            if ( rtmpEvent instanceof VideoData ) {
View Full Code Here

TOP

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

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.