Package org.jboss.dna.graph.properties

Examples of org.jboss.dna.graph.properties.Path


                List<Path> topLevelPaths = projection.getTopLevelPathsInRepository(pathFactory);
                switch (topLevelPaths.size()) {
                    case 0:
                        break;
                    case 1: {
                        Path topLevelPath = topLevelPaths.iterator().next();
                        if (path.isAncestorOf(topLevelPath)) {
                            assert topLevelPath.size() > path.size();
                            Path.Segment child = topLevelPath.getSegment(path.size());
                            contribution = Contribution.createPlaceholder(source, path, expirationTime, child);
                        }
                        break;
                    }
                    default: {
                        // We assume that the top-level paths do not overlap ...
                        List<Path.Segment> children = new ArrayList<Path.Segment>(topLevelPaths.size());
                        for (Path topLevelPath : topLevelPaths) {
                            if (path.isAncestorOf(topLevelPath)) {
                                assert topLevelPath.size() > path.size();
                                Path.Segment child = topLevelPath.getSegment(path.size());
                                children.add(child);
                            }
                        }
                        if (children.size() > 0) {
                            contribution = Contribution.createPlaceholder(source, path, expirationTime, children);
                        }
                    }
                }
                if (contribution == null) contribution = Contribution.create(source, expirationTime);
                contributions.add(contribution);
            } else {
                // There is at least one (real) contribution ...

                // Get the contributions ...
                final int numPaths = pathsInSource.size();
                if (numPaths == 1) {
                    Path pathInSource = pathsInSource.iterator().next();
                    BasicGetNodeCommand fromSource = new BasicGetNodeCommand(pathInSource);
                    sourceConnection.execute(getExecutionContext(), fromSource);
                    if (!fromSource.hasError()) {
                        Collection<Property> properties = fromSource.getProperties();
                        List<Segment> children = fromSource.getChildren();
View Full Code Here


    }

    protected void updateCache( FederatedNode mergedNode ) throws RepositorySourceException {
        final ExecutionContext context = getExecutionContext();
        final RepositoryConnection cacheConnection = getConnectionToCache();
        final Path path = mergedNode.getPath();

        NodeConflictBehavior conflictBehavior = NodeConflictBehavior.UPDATE;
        Collection<Property> properties = new ArrayList<Property>(mergedNode.getPropertiesByName().size() + 1);
        properties.add(new BasicSingleValueProperty(this.uuidPropertyName, mergedNode.getUuid()));
        BasicCreateNodeCommand newNode = new BasicCreateNodeCommand(path, properties, conflictBehavior);
View Full Code Here

     * @see javax.jcr.Session#getItem(java.lang.String)
     */
    public Item getItem( String absolutePath ) throws RepositoryException {
        CheckArg.isNotEmpty(absolutePath, "absolutePath");
        // Return root node if path is "/"
        Path path = executionContext.getValueFactories().getPathFactory().create(absolutePath);
        if (path.isRoot()) {
            return getRootNode();
        }
        // Since we don't know whether path refers to a node or property, get the parent contents, which must refer to a node
        Path parentPath = path.getParent();
        BasicGetNodeCommand getNodeCommand = new BasicGetNodeCommand(parentPath);
        execute(getNodeCommand);
        // First search for a child with the last name in the path
        Segment lastSeg = path.getLastSegment();
        Name name = lastSeg.getName();
View Full Code Here

                return node;
            }
        }
        // If not create a new one & populate it
        JcrNode node;
        Path parentPath = path.getParent();
        if (parentPath.isRoot()) node = new JcrNode(this, ((JcrRootNode)getRootNode()).getInternalUuid(), path.getLastSegment());
        else node = new JcrNode(this, ((JcrNode)getNode(parentPath)).getInternalUuid(), path.getLastSegment());
        populateNode(node, command);
        return node;
    }
View Full Code Here

        SimpleTypeMetadataSequencer.sequenceConstructorSimpleTypeName(simpleTypeFieldMetadata,
                                                                      methodSimpleTypeFormalParamRootPath,
                                                                      output,
                                                                      nameFactory,
                                                                      pathFactory);
        Path methodSimpleTypeParamChildNode = SimpleTypeMetadataSequencer.createSimpleTypeParamPath(pathFactory,
                                                                                                    methodSimpleTypeFormalParamRootPath);
        for (Variable variable : simpleTypeFieldMetadata.getVariables()) {
            VariableSequencer.sequenceTheVariable(output, nameFactory, variable, methodSimpleTypeParamChildNode);
        }
    }
View Full Code Here

                                                          String rootPath,
                                                          SequencerOutput output,
                                                          NameFactory nameFactory,
                                                          PathFactory pathFactory ) {

        Path constructorSimpleTypeParamChildNode = pathFactory.create(rootPath);
        output.setProperty(constructorSimpleTypeParamChildNode,
                           nameFactory.create(JAVA_SIMPLE_TYPE_NAME),
                           simpleTypeFieldMetadata.getType());

    }
View Full Code Here

                                                 SimpleTypeFieldMetadata simpleTypeFieldMetadata,
                                                 String methodRootPath ) {
        String methodReturnSimpleTypePath = JavaMetadataUtil.createPath(methodRootPath + SLASH + JAVA_RETURN_TYPE + SLASH
                                                                        + JAVA_SIMPLE_TYPE_CHILD_NODE);

        Path methodReturnPrimitiveTypeChildNode = pathFactory.create(methodReturnSimpleTypePath);
        output.setProperty(methodReturnPrimitiveTypeChildNode,
                           nameFactory.create(JAVA_SIMPLE_TYPE_NAME),
                           simpleTypeFieldMetadata.getType());
    }
View Full Code Here

                                                  NameFactory nameFactory,
                                                  PathFactory pathFactory,
                                                  ArrayTypeFieldMetadata arrayTypeFieldMetadata,
                                                  String methodParamRootPath ) {
        String methodFormalParamRootPath = ArrayTypeFieldMetadataSequencer.createRootPath(methodParamRootPath);
        Path methodParamChildNode = pathFactory.create(methodFormalParamRootPath);
        output.setProperty(methodParamChildNode, nameFactory.create(JAVA_ARRAY_TYPE_NAME), arrayTypeFieldMetadata.getType());
        Path ArrayTypeVariableChildNode = pathFactory.create(JavaMetadataUtil.createPath(methodFormalParamRootPath + SLASH
                                                                                         + JAVA_ARRAY_TYPE_VARIABLE + SLASH
                                                                                         + JAVA_VARIABLE));
        for (Variable variable : arrayTypeFieldMetadata.getVariables()) {
            VariableSequencer.sequenceTheVariable(output, nameFactory, variable, ArrayTypeVariableChildNode);
        }
View Full Code Here

                                                SequencerOutput output,
                                                String path,
                                                int index ) {

        // type
        Path arryTypeChildNode = pathFactory.create(path);
        output.setProperty(arryTypeChildNode, nameFactory.create(JAVA_ARRAY_TYPE_NAME), arrayTypeFieldMetadata.getType());
        // modifiers
        List<ModifierMetadata> modifiers = arrayTypeFieldMetadata.getModifiers();
        int arrayModifierIndex = 1;
        for (ModifierMetadata modifierMetadata : modifiers) {
            String modifierPath = JavaMetadataUtil.createPathWithIndex(path + SLASH + JAVA_ARRAY_TYPE_MODIFIER_CHILD_NODE + SLASH
                                                                       + JAVA_MODIFIER_DECLARATION_CHILD_NODE, arrayModifierIndex);
            Path modifierChildNode = pathFactory.create(modifierPath);
            output.setProperty(modifierChildNode, nameFactory.create(JAVA_MODIFIER_NAME), modifierMetadata.getName());
            arrayModifierIndex++;
        }
        // variables
        List<Variable> variables = arrayTypeFieldMetadata.getVariables();
        int arrayVariableIndex = 1;
        for (Variable variable : variables) {
            String variablePath = JavaMetadataUtil.createPathWithIndex(path + SLASH + JAVA_ARRAY_TYPE_VARIABLE + SLASH
                                                                       + JAVA_VARIABLE, arrayVariableIndex);
            Path primitiveChildNode = pathFactory.create(variablePath);
            VariableSequencer.sequenceTheVariable(output, nameFactory, variable, primitiveChildNode);
            arrayVariableIndex++;
        }
    }
View Full Code Here

                                        String rootPath ) {
        String methodPrimitiveParamVariablePath = JavaMetadataUtil.createPath(rootPath
                                                                          + SLASH
                                                                          + JAVA_PRIMITIVE_TYPE_VARIABLE
                                                                          + SLASH + JAVA_VARIABLE);
        Path methodParamChildNode = pathFactory.create(methodPrimitiveParamVariablePath);
        return methodParamChildNode;
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.properties.Path

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.