Package org.jboss.dna.graph.property

Examples of org.jboss.dna.graph.property.PropertyFactory


            }
            // There are no properties on the root ...
        } else {
            try {
                // Generate the properties for this File object ...
                PropertyFactory factory = getExecutionContext().getPropertyFactory();
                DateTimeFactory dateFactory = getExecutionContext().getValueFactories().getDateFactory();

                // Figure out the kind of node this represents ...
                SVNNodeKind kind = getNodeKind(workspaceRoot, requestedPath, accessData.getRepositoryRootUrl(), workspaceName);
                if (kind == SVNNodeKind.DIR) {
View Full Code Here


        // Make sure that the parent of the type nodes exists in the graph.
        try {
            graph.getNodeAt(parentOfTypeNodes);
        } catch (PathNotFoundException pnfe) {
            PropertyFactory propertyFactory = context.getPropertyFactory();
            graph.create(parentOfTypeNodes,
                         propertyFactory.create(JcrLexicon.PRIMARY_TYPE,
                                                DnaLexicon.NODE_TYPES.getString(context.getNamespaceRegistry()))).and();
        }

        Graph.Batch batch = graph.batch();
View Full Code Here

        // Note that this persistent registry has direct access to the system workspace.
        Name uriProperty = DnaLexicon.NAMESPACE_URI;
        PathFactory pathFactory = executionContext.getValueFactories().getPathFactory();
        Path systemPath = pathFactory.create(JcrLexicon.SYSTEM);
        Path namespacesPath = pathFactory.create(systemPath, DnaLexicon.NAMESPACES);
        PropertyFactory propertyFactory = executionContext.getPropertyFactory();
        Property namespaceType = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.NAMESPACE);

        // Now create the registry implementation ...
        this.persistentRegistry = new GraphNamespaceRegistry(systemGraph, namespacesPath, uriProperty, namespaceType);
        this.executionContext = executionContext.with(persistentRegistry);
View Full Code Here

        final String workspaceName = getCurrentWorkspaceName();
        return new CreateAt<Graph>() {
            private final List<Property> properties = new LinkedList<Property>();

            public CreateAt<Graph> and( UUID uuid ) {
                PropertyFactory factory = getContext().getPropertyFactory();
                properties.add(factory.create(DnaLexicon.UUID, uuid));
                return this;
            }

            public CreateAt<Graph> and( Property property ) {
                properties.add(property);
                return this;
            }

            public CreateAt<Graph> and( Iterable<Property> properties ) {
                for (Property property : properties) {
                    this.properties.add(property);
                }
                return this;
            }

            public CreateAt<Graph> and( String name,
                                        Object... values ) {
                ExecutionContext context = getContext();
                PropertyFactory factory = context.getPropertyFactory();
                NameFactory nameFactory = context.getValueFactories().getNameFactory();
                properties.add(factory.create(nameFactory.create(name), values));
                return this;
            }

            public CreateAt<Graph> and( Name name,
                                        Object... values ) {
                ExecutionContext context = getContext();
                PropertyFactory factory = context.getPropertyFactory();
                properties.add(factory.create(name, values));
                return this;
            }

            public CreateAt<Graph> and( Property property,
                                        Property... additionalProperties ) {
View Full Code Here

            conflictBehavior = NodeConflictBehavior.APPEND;
            return this;
        }

        public Create<T> and( UUID uuid ) {
            PropertyFactory factory = getContext().getPropertyFactory();
            properties.put(DnaLexicon.UUID, factory.create(DnaLexicon.UUID, uuid));
            return this;
        }
View Full Code Here

        }

        public Create<T> and( String name,
                              Object... values ) {
            ExecutionContext context = getContext();
            PropertyFactory factory = context.getPropertyFactory();
            NameFactory nameFactory = context.getValueFactories().getNameFactory();
            Name propertyName = nameFactory.create(name);
            properties.put(propertyName, factory.create(propertyName, values));
            return this;
        }
View Full Code Here

            return this;
        }

        public Create<T> and( Name name,
                              Object... values ) {
            PropertyFactory factory = getContext().getPropertyFactory();
            properties.put(name, factory.create(name, values));
            return this;
        }
View Full Code Here

        Map<UUID, UUID> oldToNewUuids = new HashMap<UUID, UUID>();
        MapNode copyRoot = copyNode(context, original, newWorkspace, newParent, desiredName, true, oldToNewUuids);

        // Now, adjust any references in the new subgraph to objects in the original subgraph
        // (because they were internal references, and need to be internal to the new subgraph)
        PropertyFactory propertyFactory = context.getPropertyFactory();
        UuidFactory uuidFactory = context.getValueFactories().getUuidFactory();
        ValueFactory<Reference> referenceFactory = context.getValueFactories().getReferenceFactory();
        for (Map.Entry<UUID, UUID> oldToNew : oldToNewUuids.entrySet()) {
            MapNode oldNode = this.getNode(oldToNew.getKey());
            MapNode newNode = newWorkspace.getNode(oldToNew.getValue());
            assert oldNode != null;
            assert newNode != null;
            // Iterate over the properties of the new ...
            for (Map.Entry<Name, Property> entry : newNode.getProperties().entrySet()) {
                Property property = entry.getValue();
                // Now see if any of the property values are references ...
                List<Object> newValues = new ArrayList<Object>();
                boolean foundReference = false;
                for (Iterator<?> iter = property.getValues(); iter.hasNext();) {
                    Object value = iter.next();
                    PropertyType type = PropertyType.discoverType(value);
                    if (type == PropertyType.REFERENCE) {
                        UUID oldReferencedUuid = uuidFactory.create(value);
                        UUID newReferencedUuid = oldToNewUuids.get(oldReferencedUuid);
                        if (newReferencedUuid != null) {
                            newValues.add(referenceFactory.create(newReferencedUuid));
                            foundReference = true;
                        }
                    } else {
                        newValues.add(value);
                    }
                }
                // If we found at least one reference, we have to build a new Property object ...
                if (foundReference) {
                    Property newProperty = propertyFactory.create(property.getName(), newValues);
                    entry.setValue(newProperty);
                }
            }
        }
        return copyRoot;
View Full Code Here

     * @return this map node
     */
    public MapNode setProperty( ExecutionContext context,
                                String name,
                                Object... values ) {
        PropertyFactory propertyFactory = context.getPropertyFactory();
        Name propertyName = context.getValueFactories().getNameFactory().create(name);
        return setProperty(propertyFactory.create(propertyName, values));
    }
View Full Code Here

        // Note that this persistent registry has direct access to the system workspace.
        Name uriProperty = DnaLexicon.NAMESPACE_URI;
        PathFactory pathFactory = executionContext.getValueFactories().getPathFactory();
        Path systemPath = pathFactory.create(JcrLexicon.SYSTEM);
        Path namespacesPath = pathFactory.create(systemPath, DnaLexicon.NAMESPACES);
        PropertyFactory propertyFactory = executionContext.getPropertyFactory();
        Property namespaceType = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.NAMESPACE);

        // Now create the registry implementation ...
        this.persistentRegistry = new GraphNamespaceRegistry(systemGraph, namespacesPath, uriProperty, namespaceType);
        this.executionContext = executionContext.with(persistentRegistry);
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.property.PropertyFactory

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.