Package org.red5.server.api.so

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


      // so name
      String name = message.getName();
      // whether or not the incoming so is persistent
      boolean persistent = message.isPersistent();
      // shared object service
      ISharedObjectService sharedObjectService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, SharedObjectService.class, false);
      if (!sharedObjectService.hasSharedObject(scope, name)) {
        log.debug("Shared object service doesnt have requested object, creation will be attempted");
        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)) {
              log.debug("Shared object create failed, creation is not allowed");
              sendSOCreationFailed(conn, message);
              return;
            }
          }
        }
        if (!sharedObjectService.createSharedObject(scope, name, persistent)) {
          log.debug("Shared object create failed");
          sendSOCreationFailed(conn, message);
          return;
        }
      }
      ISharedObject so = sharedObjectService.getSharedObject(scope, name);
      if (so != null) {
        if (so.isPersistent() == persistent) {
          log.debug("Dispatch persistent shared object");
          so.dispatchEvent(message);
        } else {
View Full Code Here


  public void setGlobalScope(IScope scope) {
    globalScope = scope;
  }

  public ISharedObject getScopeStatisticsSO(IScope scope) {
    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    return soService.getSharedObject(scope, SCOPE_STATS_SO_NAME, false);
  }
View Full Code Here

    Set<String> result = scope.getScopeNames();
    return result;
  }

  public ISharedObject getSharedObjectStatisticsSO(IScope scope) {
    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    return soService.getSharedObject(scope, SO_STATS_SO_NAME, false);
  }
View Full Code Here

    return soService.getSharedObject(scope, SO_STATS_SO_NAME, false);
  }

  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

    so.setAttribute(path, scope.getAttributes());
  }

  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

  @SuppressWarnings("deprecation")
  @Test
  public void sharedObjectService() {
    IScope scope = context.resolveScope(path_app);
    ISharedObjectService service = new SharedObjectService();
    assertTrue("should be empty", !service.hasSharedObject(scope, "blah"));
    assertTrue("create so", service.createSharedObject(scope, name, false));
    assertTrue("so exists?", service.hasSharedObject(scope, name));
    ISharedObject so = service.getSharedObject(scope, name);
    assertTrue("so not null", so != null);
    assertTrue("name same", so.getName().equals(name));
    //assertTrue("persistent",!so.isPersistent());
    so.addEventListener(this);
    so.setAttribute("this", "that");
View Full Code Here

   * @param scope
   *       the scope to return the shared object for
   * @return the shared object to use
   */
  private ISharedObject getSharedObject(IScope scope) {
    ISharedObjectService service = (ISharedObjectService) ScopeUtils
        .getScopeService(scope,
            ISharedObjectService.class,
            false);
    return service.getSharedObject(scope, name, persistent);
  }
View Full Code Here

   * @param path  Path of scope to return shared objects for
   * @return    A mapping containing the shared object name -> (persistent, data)
   */
  public Map<String, Object> getSharedObjects(String path) {
    IScope scope = getScope(path);
    ISharedObjectService service = (ISharedObjectService) ScopeUtils
        .getScopeService(scope,
            ISharedObjectService.class, false);
    if (service == null) {
      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.
View Full Code Here

  public void setGlobalScope(IScope scope) {
    globalScope = scope;
  }
 
  public ISharedObject getScopeStatisticsSO(IScope scope) {
    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    return soService.getSharedObject(scope, SCOPE_STATS_SO_NAME, false);
  }
View Full Code Here

    return result;
  }

  public ISharedObject getSharedObjectStatisticsSO(IScope scope) {
    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    return soService.getSharedObject(scope, SO_STATS_SO_NAME, false);
  }
View Full Code Here

TOP

Related Classes of org.red5.server.api.so.ISharedObjectService

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.