Ejemplo n.º 1
0
 /**
  * Add child scope to this scope
  *
  * @param scope Child scope
  * @return
  *     <pre>
  * true
  * </pre>
  *     on success (if scope has handler and it accepts child scope addition),
  *     <pre>
  * false
  * </pre>
  *     otherwise
  */
 public boolean addChildScope(IBasicScope scope) {
   log.debug("Add child: {}", scope);
   boolean added = false;
   if (scope.isValid()) {
     try {
       if (!children.containsKey(scope)) {
         log.debug("Adding child scope: {} to {}", scope, this);
         added = children.add(scope);
       } else {
         log.warn("Child scope already exists");
       }
     } catch (Exception e) {
       log.warn("Exception on add subscope", e);
     }
   } else {
     log.warn("Invalid scope rejected: {}", scope);
   }
   if (added && scope.getStore() == null) {
     // if child scope has no persistence store, use same class as parent
     try {
       if (scope instanceof Scope) {
         ((Scope) scope).setPersistenceClass(persistenceClass);
       }
     } catch (Exception error) {
       log.error("Could not set persistence class", error);
     }
   }
   return added;
 }