Package org.red5.server.api

Examples of org.red5.server.api.IClientRegistry


    public void onStreamEvent( Notify notify ) {

        //logger.debug( "onStreamEvent " + notify );

        ObjectMap map = (ObjectMap) notify.getCall().getArguments()[ 0 ];
        String code = (String) map.get( "code" );

        if ( StatusCodes.NS_PUBLISH_START.equals( code ) ) {
            //logger.debug( "onStreamEvent Publish start" );
            startPublish = true;
        }
View Full Code Here


    ScreenShare.instance.vScreenIconDown.addMouseListener(heightMouseListener);
    ScreenShare.instance.vScreenIconDown.addMouseMotionListener(heightMouseListener);
    ScreenShare.instance.t.add(ScreenShare.instance.vScreenIconDown);


    ScreenShare.instance.virtualScreen = new BlankArea(new Color(255,255,255,100));
    ScreenShare.instance.virtualScreen.setOpaque(true);
    ScreenShare.instance.virtualScreen.setHorizontalAlignment(SwingConstants.LEFT);
    ScreenShare.instance.virtualScreen.setVerticalAlignment(SwingConstants.TOP);
    ScreenShare.instance.virtualScreen.setText(VirtualScreenBean.screenWidthMax+":"+VirtualScreenBean.screenHeightMax);
    ScreenShare.instance.virtualScreen.setBounds(30, 170, VirtualScreenBean.vScreenWidth, VirtualScreenBean.vScreenHeight);
View Full Code Here

    ScreenShareRTMPT.instance.vScreenIconDown.addMouseListener(heightMouseListener);
    ScreenShareRTMPT.instance.vScreenIconDown.addMouseMotionListener(heightMouseListener);
    ScreenShareRTMPT.instance.t.add(ScreenShareRTMPT.instance.vScreenIconDown);


    ScreenShareRTMPT.instance.virtualScreen = new BlankArea(new Color(255,255,255,100));
    ScreenShareRTMPT.instance.virtualScreen.setOpaque(true);
    ScreenShareRTMPT.instance.virtualScreen.setHorizontalAlignment(SwingConstants.LEFT);
    ScreenShareRTMPT.instance.virtualScreen.setVerticalAlignment(SwingConstants.TOP);
    ScreenShareRTMPT.instance.virtualScreen.setText(VirtualScreenBean.screenWidthMax+":"+VirtualScreenBean.screenHeightMax);
    ScreenShareRTMPT.instance.virtualScreen.setBounds(30, 170, VirtualScreenBean.vScreenWidth, VirtualScreenBean.vScreenHeight);
View Full Code Here

                        stopButton.setBounds(290, 34, 200, 32);
                        stopButton.setEnabled(false);
                        t.add(stopButton);

                        //add the small screen thumb to the JFrame
                        new VirtualScreen();
                       
                        //*****
                        //Text Recording
                        textAreaHeaderRecording = new JLabel();
                       
View Full Code Here

      stopButton.setBounds(290, 34, 200, 32);
      stopButton.setEnabled(false);
      t.add(stopButton);

      //add the small screen thumb to the JFrame
      new VirtualScreen();
     
      //*****
      //Text Recording
      textAreaHeaderRecording = new JLabel();
     
View Full Code Here

    log.debug("-----------------------------------------------------------------testBug631");

    final String message = "This is a test";

    //create our sender conn and set local
    IClientRegistry dummyReg = (IClientRegistry) applicationContext.getBean("global.clientRegistry");

    final IScope scp = (WebScope) applicationContext.getBean("web.scope"); //conn.getScope();
    final IContext ctx = (Context) applicationContext.getBean("web.context"); //scope.getContext();

    final IConnection recipient = new SvcCapableTestConnection("localhost", "/junit", "1");//host, path, session id
    IClient rClient = dummyReg.newClient(new Object[] { "recipient" });
    ((TestConnection) recipient).setClient(rClient);
    ((TestConnection) recipient).setScope((Scope) scp);
    ((DummyClient) rClient).registerConnection(recipient);

    final IConnection sender = new SvcCapableTestConnection("localhost", "/junit", "2");//host, path, session id
    IClient sClient = dummyReg.newClient(new Object[] { "sender" });
    ((TestConnection) sender).setClient(sClient);
    ((TestConnection) sender).setScope((Scope) scp);
    ((DummyClient) sClient).registerConnection(sender);

    Thread r = new Thread(new Runnable() {
      public void run() {
        Red5.setConnectionLocal(recipient);
        IConnection conn = Red5.getConnectionLocal();
        assertTrue(scp.connect(conn));
        try {
          Thread.sleep(120L);
        } catch (InterruptedException e) {
        }
        log.debug("Check s/c -\n s1: {} s2: {}\n c1: {} c2: {}", new Object[] { scp, conn.getScope(), ctx, conn.getScope().getContext() });
      }
    });
    Thread s = new Thread(new Runnable() {
      public void run() {
        Red5.setConnectionLocal(sender);
        IConnection conn = Red5.getConnectionLocal();
        assertTrue(scp.connect(conn));
        try {
          Thread.sleep(10L);
        } catch (InterruptedException e) {
        }
        Object[] sendobj = new Object[] { conn.getClient().getId(), message };
        // get the recipient
        IClientRegistry reg = ctx.getClientRegistry();
        IConnection rcon = reg.lookupClient("recipient").getConnections(scp).iterator().next();
        ((IServiceCapableConnection) rcon).invoke("privMessage", sendobj);
        try {
          Thread.sleep(100L);
        } catch (InterruptedException e) {
        }
        log.debug("Check s/c -\n s1: {} s2: {}\n c1: {} c2: {}", new Object[] { scp, conn.getScope(), ctx, conn.getScope().getContext() });
      }
    });
    r.start();
    s.start();
   
    r.join();
    s.join();
   
    IClientRegistry reg = ctx.getClientRegistry();
    log.debug("Client registry: {}", reg.getClass().getName());
    if (reg.hasClient("recipient")) {
      IClient recip = reg.lookupClient("recipient");
      Set<IConnection> rcons = recip.getConnections(scp);
      log.debug("Recipient has {} connections", rcons.size());
    } else {
      fail("Recipient not found");
    }
View Full Code Here

  }

  private IConnection createConnection(int id) {
    //create our sender conn and set local
    IClientRegistry dummyReg = (IClientRegistry) applicationContext.getBean("global.clientRegistry");

    IScope scp = (WebScope) applicationContext.getBean("web.scope");
    //IContext ctx = (Context) applicationContext.getBean("web.context");

    IConnection conn = new SvcCapableTestConnection("localhost", "/junit", id + "");//host, path, session id
    IClient rClient = dummyReg.newClient(new Object[] { "client-" + id });
    ((TestConnection) conn).setClient(rClient);
    ((TestConnection) conn).setScope((Scope) scp);
    ((DummyClient) rClient).registerConnection(conn);

    return conn;
View Full Code Here

      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));

      //go through the client list and send at least one message to everyone
      for (String worker : workerList) {
        //dont send to ourself
        if (name.equals(worker)) {
          log.debug("Dont send to self");
          continue;
        }
        if (reg.hasClient(worker)) {
          IClient recip = reg.lookupClient(worker);
          Set<IConnection> rcons = recip.getConnections(scope);
          //log.debug("Recipient has {} connections", rcons.size());
          Object[] sendobj = new Object[] { client.getId(), "This is a message from " + name };
          for (IConnection rcon : rcons) {
            if (rcon instanceof IServiceCapableConnection) {
              serviceCapCon = (IServiceCapableConnection) rcon;
              serviceCapCon.invoke("privMessage", sendobj);
              break;
            } else {
              log.info("Connection is not service capable");
            }
          }
        } else {
          log.warn("Client not registered {}", worker);
        }
      }

      //number of connections
      int connectionCount = workerList.size();

      //now send N messages to random recipients
      for (int i = 0; i < 4000; i++) {
        String worker = workerList.get(rnd.nextInt(connectionCount));
        //dont send to ourself
        if (name.equals(worker)) {
          //log.debug("Dont send to self");
          continue;
        }
        if (reg.hasClient(worker)) {
          IClient recip = reg.lookupClient(worker);
          Set<IConnection> rcons = recip.getConnections(scope);
          //log.debug("Recipient has {} connections", rcons.size());
          Object[] sendobj = new Object[] { client.getId(), "This is a message from " + name };
          for (IConnection rcon : rcons) {
            if (rcon instanceof IServiceCapableConnection) {
View Full Code Here

  }

  @Test
  public void client() {
    log.debug("-----------------------------------------------------------------client");
    IClientRegistry reg = context.getClientRegistry();
    IClient client = reg.newClient(null);
    assertTrue("client should not be null", client != null);
  }
View Full Code Here

    TestConnection conn = new TestConnection(host, "/", null);
    // add the connection to thread local
    Red5.setConnectionLocal(conn);
    // resolve root
    IScope scope = context.resolveScope("/");
    IClientRegistry reg = context.getClientRegistry();
    IClient client = reg.newClient(null);
    assertNotNull(client);
    conn.initialize(client);
    if (conn.connect(scope)) {
      assertTrue("should have a scope", conn.getScope() != null);
      conn.close();
View Full Code Here

TOP

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

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.