Ejemplo n.º 1
0
 /**
  * Returns the effective (i.e. merged and resolved) node type representation of this node's
  * primary and mixin node types.
  *
  * @return the effective node type
  * @throws RepositoryException
  */
 protected EffectiveNodeType getEffectiveNodeType(NodeState parent) throws RepositoryException {
   try {
     NodeTypeRegistry ntReg = getNodeTypeRegistry();
     return ntReg.getEffectiveNodeType(parent.getNodeTypeName(), parent.getMixinTypeNames());
   } catch (NodeTypeConflictException ntce) {
     String msg =
         "internal error: failed to build effective node type for node " + parent.getNodeId();
     throw new RepositoryException(msg, ntce);
   }
 }
Ejemplo n.º 2
0
  /**
   * Checks if this provider has the property state of the given id.
   *
   * @param id
   * @return <code>true</code> if it has the property state
   */
  protected boolean internalHasPropertyState(PropertyId id) {

    try {
      // get parent state
      NodeState parent = (NodeState) getItemState(id.getParentId());

      // handle some default prop states
      if (parent instanceof VirtualNodeState) {
        return parent.hasPropertyName(id.getName());
      }
    } catch (ItemStateException e) {
      // ignore
    }
    return false;
  }
Ejemplo n.º 3
0
 /**
  * adds the node state to the cache
  *
  * @param state
  * @return The same state.
  */
 protected NodeState cache(NodeState state) {
   if (state != null) {
     nodes.put(state.getNodeId(), state);
     log.debug("item added to cache. size=" + nodes.size());
   }
   return state;
 }
Ejemplo n.º 4
0
 /**
  * Recursively discards all the properties and nodes in the subtree rooted at the given node
  * state.
  *
  * @param state root of the subtree to be discarded
  */
 private void discardTree(NodeState state) {
   for (Name name : state.getPropertyNames()) {
     try {
       getItemState(new PropertyId(state.getNodeId(), name)).discard();
     } catch (ItemStateException e) {
       log.warn("Unable to discard virtual property " + name, e);
     }
   }
   for (ChildNodeEntry entry : state.getChildNodeEntries()) {
     try {
       discardTree((NodeState) getItemState(entry.getId()));
     } catch (ItemStateException e) {
       log.warn("Unable to discard virtual node " + entry.getId(), e);
     }
   }
   state.discard();
 }