Examples of ISharedObject


Examples of org.red5.server.api.so.ISharedObject

    // get our room
    IScope room1 = ScopeUtils.resolveScope(appScope, "/junit/room1");
    // create the SO
    app.createSharedObject(room1, soName, true);
    // get the SO
    ISharedObject sharedObject = app.getSharedObject(room1, soName, true);
    assertTrue(sharedObject != null);
    log.debug("testPersistentCreation-end");
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

    try {
      Thread.sleep(500);
    } catch (Exception e) {
    }
    // set something on the so
    ISharedObject so = app.getSharedObject(appScope, "statusSO");
    so.setAttribute("testing", true);
    // go to sleep
    try {
      Thread.sleep(1000);
    } catch (Exception e) {
    }
    log.debug("Attribute names: {}", so.getAttributeNames());
    // [status, testing]
    assertTrue(so.getAttributeNames().size() == 2);
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

   * @param uid
   *       the unique id of the user that connected
   */
  @SuppressWarnings("unchecked")
  public void addClient(IScope scope, String username, String uid) {
    ISharedObject so = getSharedObject(scope);
    so.setAttribute(uid, username);
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

   *       unique id of the user that disconnected
   * @return the username of the disconnected user
   */
  @SuppressWarnings("unchecked")
  public String removeClient(IScope scope, String uid) {
    ISharedObject so = getSharedObject(scope);
    if (!so.hasAttribute(uid)) {
      // SharedObject is empty. This happes when the last client
      // disconnects.
      return null;
    }

    String username = so.getStringAttribute(uid);
    so.removeAttribute(uid);
    return username;
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

      return new Hashtable<String, Object>();
    }

    Map<String, Object> result = new Hashtable<String, Object>();
    for (String name : service.getSharedObjectNames(scope)) {
      ISharedObject so = service.getSharedObject(scope, name);
      try {
        result.put(name, new Object[] { so.isPersistentObject(),
            getXMLRPCValue(so.getData()) });
      } catch (RuntimeException err) {
        // Could not convert attribute for XML-RPC serialization.
        result.put(name, "--- Error while serializing \""
            + so.getData().toString() + "\" ---");
      }
    }
    return result;
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

  public Set<ISharedObjectStatistics> getSharedObjects(String path) {
    IScope scope = getScope(path);
    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    Set<ISharedObjectStatistics> result = new HashSet<ISharedObjectStatistics>();
    for (String name: soService.getSharedObjectNames(scope)) {
      ISharedObject so = soService.getSharedObject(scope, name);
      result.add(so.getStatistics());
    }
    return result;
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

  }

  public void updateScopeStatistics(String path)
      throws ScopeNotFoundException {
    IScope scope = getScope(path);
    ISharedObject so = getScopeStatisticsSO(Red5.getConnectionLocal().getScope());
    so.setAttribute(path, scope.getAttributes());
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

  public void updateSharedObjectStatistics(String path, String name)
      throws ScopeNotFoundException, SharedObjectException {
    IScope scope = getScope(path);
    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    ISharedObject sourceSO = soService.getSharedObject(scope, name);
    if (sourceSO == null)
      throw new SharedObjectException();
   
    ISharedObject so = getSharedObjectStatisticsSO(Red5.getConnectionLocal().getScope());
    so.setAttribute(path+'|'+name, sourceSO.getData());
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

  /** {@inheritDoc} */
  @Override
  protected void onSharedObject(RTMPConnection conn, Channel channel,
      Header source, SharedObjectMessage object) {
    final ISharedObject so;
    final String name = object.getName();
    final boolean persistent = object.isPersistent();
    final IScope scope = conn.getScope();
    if (scope == null) {
      // The scope already has been deleted.
      sendSOCreationFailed(conn, name, persistent);
      return;
    }

    ISharedObjectService sharedObjectService = (ISharedObjectService) getScopeService(
        scope, ISharedObjectService.class, SharedObjectService.class,
        false);
    if (!sharedObjectService.hasSharedObject(scope, name)) {
      ISharedObjectSecurityService security = (ISharedObjectSecurityService) ScopeUtils
          .getScopeService(scope, ISharedObjectSecurityService.class);
      if (security != null) {
        // Check handlers to see if creation is allowed
        for (ISharedObjectSecurity handler : security
            .getSharedObjectSecurity()) {
          if (!handler.isCreationAllowed(scope, name, persistent)) {
            sendSOCreationFailed(conn, name, persistent);
            return;
          }
        }
      }

      if (!sharedObjectService
          .createSharedObject(scope, name, persistent)) {
        sendSOCreationFailed(conn, name, persistent);
        return;
      }
    }
    so = sharedObjectService.getSharedObject(scope, name);
    if (so.isPersistentObject() != persistent) {
      SharedObjectMessage msg = new SharedObjectMessage(name, 0,
          persistent);
      msg.addEvent(new SharedObjectEvent(
          ISharedObjectEvent.Type.CLIENT_STATUS, "error",
          SO_PERSISTENCE_MISMATCH));
      conn.getChannel((byte) 3).write(msg);
    }
    so.dispatchEvent(object);
  }
View Full Code Here

Examples of org.red5.server.api.so.ISharedObject

    System.out.println("*********** Request to send [" + msg.getMessageName() + "] using shared object.");
   
    IScope meetingScope = getScope(msg.getMeetingID());
    if (meetingScope != null) {
      if (meetingScope.hasChildScope(ScopeType.SHARED_OBJECT, msg.getSharedObjectName())) {
        ISharedObject so = getSharedObject(meetingScope, msg.getSharedObjectName());
        if (so != null) {
          System.out.println("*********** Sending [" + msg.getMessageName() + "] using shared object.");
          so.sendMessage(msg.getMessageName(), msg.getMessage());
        } else {
          System.out.println("**** Cannot get SO for [" + msg.getSharedObjectName() + "]");
        }
      } else {
        System.out.println("**** No SO scope for [" + msg.getSharedObjectName() + "]");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.