Exemplo n.º 1
0
  @Override
  public List<JcrNode> childNodes(String path) throws RemoteException {
    List<JcrNode> children = null;
    if (path == null || path.trim().length() == 0) {
      return Collections.emptyList();
    }
    try {
      Node node = (Node) session().getItem(path);
      NodeIterator it = node.getNodes();
      children = new ArrayList<JcrNode>((int) it.getSize());

      while (it.hasNext()) {
        Node n = it.nextNode();
        JcrNode childNode = new JcrNode(n.getName(), n.getPath(), n.getPrimaryNodeType().getName());
        childNode.setProperties(getProperties(n));
        childNode.setAcessControlList(getAccessList(session().getAccessControlManager(), node));
        childNode.setMixins(mixins(n));
        childNode.setPropertyDefs(propertyDefs(n));
        children.add(childNode);
      }

    } catch (PathNotFoundException e) {
      log.log(Level.FINER, e.getLocalizedMessage());
    } catch (RepositoryException e) {
      log.log(Level.SEVERE, "Unexpected error", e);
      throw new RemoteException(e.getMessage());
    }

    return children;
  }
Exemplo n.º 2
0
  @Override
  public JcrNode getRootNode() throws RemoteException {
    try {
      // take root node
      Node root = session().getRootNode();

      // convert into value object
      JcrNode node = new JcrNode("root", root.getPath(), root.getPrimaryNodeType().getName());
      node.setProperties(getProperties(root));
      node.setAcessControlList(getAccessList(session().getAccessControlManager(), root));

      return node;
    } catch (RepositoryException e) {
      throw new RemoteException(e.getMessage());
    }
  }