Package org.red5.server.api

Examples of org.red5.server.api.IContext


  public void startNewObjectSyncProcess(String object_id, boolean isStarting){
    try {
     
      log.debug("startNewObjectSyncprocess: "+object_id);
     
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
      Long room_id = currentClient.getRoom_id();
     
      WhiteboardSyncLockObject wSyncLockObject = new WhiteboardSyncLockObject();
      wSyncLockObject.setAddtime(new Date());
      wSyncLockObject.setPublicSID(currentClient.getPublicSID());
      wSyncLockObject.setStarttime(new Date());
     
      Map<String,WhiteboardSyncLockObject> syncListImage = this.whiteBoardObjectListManager.getWhiteBoardObjectSyncListByRoomAndObjectId(room_id,object_id);
      syncListImage.put(currentClient.getPublicSID(), wSyncLockObject);
      this.whiteBoardObjectListManager.setWhiteBoardImagesSyncListByRoomAndObjectId(room_id, object_id, syncListImage);
     
      //Do only send the Token to show the Loading Splash for the initial-Request that starts the loading
      if (isStarting) {
        Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
        for (Set<IConnection> conset : conCollection) {
          for (IConnection conn : conset) {
            if (conn != null) {
              if (conn instanceof IServiceCapableConnection) {
                RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
View Full Code Here


  public int sendCompletedObjectSyncEvent(String object_id) {
    try {
     
      log.debug("sendCompletedObjectSyncEvent: "+object_id);
     
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
      Long room_id = currentClient.getRoom_id();
     
      Map<String,WhiteboardSyncLockObject> syncListImage = this.whiteBoardObjectListManager.getWhiteBoardObjectSyncListByRoomAndObjectId(room_id,object_id);

      log.debug("sendCompletedObjectSyncEvent syncListImage: "+syncListImage);
     
      WhiteboardSyncLockObject wSyncLockObject = syncListImage.get(currentClient.getPublicSID());
     
      if (wSyncLockObject == null) {
        log.error("WhiteboardSyncLockObject not found for this Client "+currentClient.getPublicSID());
        log.error("WhiteboardSyncLockObject not found for this syncListImage "+syncListImage);
        return -2;
       
      } else {
       
        log.debug("sendCompletedImagesSyncEvent remove: "+currentClient.getPublicSID());
       
        syncListImage.remove(currentClient.getPublicSID());
        this.whiteBoardObjectListManager.setWhiteBoardImagesSyncListByRoomAndObjectId(room_id, object_id, syncListImage);
       
        int numberOfInitial = this.whiteBoardObjectListManager.getWhiteBoardObjectSyncListByRoomid(room_id).size();
       
        log.debug("sendCompletedImagesSyncEvent numberOfInitial: "+numberOfInitial);
       
        if (numberOfInitial==0){
          int returnVal = 0;
          Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
          for (Set<IConnection> conset : conCollection) {
            for (IConnection conn : conset) {
              if (conn != null) {
                if (conn instanceof IServiceCapableConnection) {
                  RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
View Full Code Here

  public String createPoll(String pollQuestion,int pollTypeId){
    String returnValue="";
    try {
      log.debug("createPoll: "+pollQuestion);
     
      IConnection currentcon = Red5.getConnectionLocal();

     
      HashMap<String,RoomClient> ClientList = this.clientListManager.getClientList();
      RoomClient rc = ClientList.get(currentcon.getClient().getId());
     
      Long uniqueRoomPollName = rc.getRoom_id();
     
      log.debug("rc: "+rc.getStreamid()+" "+rc.getUsername()+" "+rc.getIsMod());
     
View Full Code Here

  }
 
  public int vote(int pollvalue,int pollTypeId){
    int returnVal=0;
    try {
      IConnection current = Red5.getConnectionLocal();
      RoomClient rc = this.clientListManager.getClientByStreamId(current.getClient().getId());
     
      if (rc==null){
        log.error("RoomClient IS NULL for ClientID: "+current.getClient().getId());
        return -1;
      }
      //get Poll
      RoomPoll roomP = pollList.get(rc.getRoom_id());
     
View Full Code Here

    return false;
  }
 
  public RoomPoll getVotes(){
    try {
      IConnection current = Red5.getConnectionLocal();
      RoomClient rc =this.clientListManager.getClientByStreamId(current.getClient().getId());
     
      //get Poll
      return pollList.get(rc.getRoom_id())
    } catch (Exception err) {
      log.error("[getVotes]",err);
View Full Code Here

    return null;
  }
 
  public RoomPoll getPoll(){
    try {
      IConnection current = Red5.getConnectionLocal();
      RoomClient rc = this.clientListManager.getClientByStreamId(current.getClient().getId());
     
      //get Poll
      return pollList.get(rc.getRoom_id());
    } catch (Exception err) {
      log.error("[getPoll]",err);
View Full Code Here

        return UUID.randomUUID().toString();
    }

    public boolean storeVideo(String stream_id) {
        log.info("Storing video stream: " + stream_id);
        IContext context = new Red5().getContext();
        Resource flv = context.getResource("streams/" + stream_id + ".flv");
        try {
            AWSCredentials credentials = new AWSCredentials(s3AccessKey, s3SecretKey);
            S3Service s3 = new RestS3Service(credentials);
            S3Bucket bucket = s3.getBucket("xubu");
            File file = flv.getFile();
View Full Code Here

    if (publishedName == null) {
      throw new IllegalStateException("A published name is needed to start");
    }
    try {
      IScope scope = getScope();
      IContext context = scope.getContext();
      providerService = (IProviderService) context.getBean(IProviderService.BEAN_NAME);
      // publish this server-side stream
      providerService.registerBroadcastStream(scope, publishedName, this);
      scheduler = (ISchedulingService) context.getBean(ISchedulingService.BEAN_NAME);
    } catch (NullPointerException npe) {
      log.warn("Context beans were not available; this is ok during unit testing", npe);
    }
    setState(StreamState.STOPPED);
    currentItemIndex = -1;
View Full Code Here

    //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());
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);
        }
        engine = new PlayEngine.Builder(this, schedulingService, consumerService, providerService).build();
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.