Package org.jboss.dna.graph.property

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


        assert topNode.equals(startingLocation);
        Map<Name, Property> properties = readSubgraph.getPropertiesFor(topNode);
        if (properties == null) return;
        if (startingLocation.getPath().isRoot()) {
            // The properties of the root node generally don't include the primary type, but we need to add it here ...
            Property rootPrimaryType = context.getPropertyFactory().create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.ROOT);
            properties.put(JcrLexicon.PRIMARY_TYPE, rootPrimaryType);
        }
        UpdatePropertiesRequest request = new UpdatePropertiesRequest(topNode, workspaceName, properties, true);
        request.setActualLocationOfNode(topNode);
        process(request);
View Full Code Here


        Set<Name> propertyNames = nodeInfo.getPropertyNames();
        for (Name propertyName : propertyNames) {
            PropertyInfo<JcrPropertyPayload> info = nodeInfo.getProperty(propertyName);
            assertThat(info.getName(), is(propertyName));
            assertThat(info.getProperty().getName(), is(propertyName));
            Property actual = dnaNode.getProperty(propertyName);
            if (actual != null) {
                assertThat(info.getProperty().size(), is(actual.size()));
                assertThat(info.getProperty().getValuesAsArray(), is(actual.getValuesAsArray()));
            } else {
                if (propertyName.equals(JcrLexicon.UUID)) {
                    // check for a DNA UUID property ...
                    actual = dnaNode.getProperty(DnaLexicon.UUID);
                    if (actual != null) {
                        assertThat(info.getProperty().size(), is(actual.size()));
                        assertThat(info.getProperty().getValuesAsArray(), is(actual.getValuesAsArray()));
                    } else {
                        fail("missing property \"" + propertyName + "\" on " + dnaNode);
                    }
                } else if (propertyName.equals(JcrLexicon.PRIMARY_TYPE)) {
                    // This is okay
View Full Code Here

        boolean multiple = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.MULTIPLE)));
        boolean autoCreated = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.AUTO_CREATED)));
        boolean isProtected = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.PROTECTED)));

        Value[] defaultValues;
        Property defaultValuesProperty = properties.get(JcrLexicon.DEFAULT_VALUES);
        if (defaultValuesProperty != null) {
            List<Value> values = new ArrayList<Value>();

            for (Object value : defaultValuesProperty) {
                values.add(new JcrValue(this.context.getValueFactories(), (SessionCache)null, requiredType, value));
            }
            defaultValues = values.toArray(new Value[values.size()]);
        } else {
            defaultValues = new Value[0];
        }

        String[] valueConstraints;
        Property constraintsProperty = properties.get(JcrLexicon.VALUE_CONSTRAINTS);
        if (constraintsProperty != null) {
            List<String> constraints = new ArrayList<String>();

            for (Object value : constraintsProperty) {
                constraints.add((String)value);
View Full Code Here

        boolean allowsSns = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.SAME_NAME_SIBLINGS)));
        boolean autoCreated = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.AUTO_CREATED)));
        boolean isProtected = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.PROTECTED)));

        Name[] requiredTypes;
        Property requiredTypeNamesProperty = properties.get(JcrLexicon.REQUIRED_PRIMARY_TYPES);
        if (requiredTypeNamesProperty != null) {
            List<Name> names = new ArrayList<Name>(requiredTypeNamesProperty.size());
            for (Object value : requiredTypeNamesProperty) {
                names.add(nameFactory.create(value));
            }

            requiredTypes = names.toArray(new Name[names.size()]);
View Full Code Here

     */
    private List<JcrNodeType> supertypesFor( Node nodeType,
                                             List<JcrNodeType> pendingTypes ) throws RepositoryException {
        assert nodeType != null;

        Property supertypesProperty = nodeType.getProperty(JcrLexicon.SUPERTYPES);

        // If no supertypes are provided, assume nt:base as a supertype
        if (supertypesProperty == null || supertypesProperty.size() == 0) {
            Property isMixinProperty = nodeType.getProperty(JcrLexicon.IS_MIXIN);
            boolean isMixin = isMixinProperty != null && Boolean.valueOf(isMixinProperty.getFirstValue().toString());
            JcrNodeType supertype = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes);
            // We register nt:base at startup now instead of just injecting it
            if (supertype == null || isMixin) {
                return Collections.emptyList();
            }
View Full Code Here

     * {@inheritDoc}
     *
     * @see javax.jcr.Property#getLengths()
     */
    public long[] getLengths() throws RepositoryException {
        Property dnaProperty = propertyInfo().getProperty();
        long[] lengths = new long[dnaProperty.size()];
        Iterator<?> iter = dnaProperty.iterator();
        for (int ndx = 0; iter.hasNext(); ndx++) {
            lengths[ndx] = createValue(iter.next()).getLength();
        }
        return lengths;
    }
View Full Code Here

     * </p>
     *
     * @see javax.jcr.Property#getValues()
     */
    public Value[] getValues() throws RepositoryException {
        Property dnaProperty = propertyInfo().getProperty();
        Value[] values = new JcrValue[dnaProperty.size()];
        Iterator<?> iter = dnaProperty.iterator();
        for (int ndx = 0; iter.hasNext(); ndx++) {
            values[ndx] = createValue(iter.next());
        }
        return values;
    }
View Full Code Here

        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

    protected void initializeSystemContent( Graph systemGraph ) {
        // Make sure the "/jcr:system" node exists ...
        ExecutionContext context = systemGraph.getContext();
        PathFactory pathFactory = context.getValueFactories().getPathFactory();
        Path systemPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM);
        Property systemPrimaryType = context.getPropertyFactory().create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.SYSTEM);
        systemGraph.create(systemPath, systemPrimaryType).ifAbsent().and();

        // Right now, the other nodes will be created as needed
    }
View Full Code Here

        Node optionsNode = subgraph.getNode(DnaLexicon.OPTIONS);
        if (optionsNode != null) {
            for (Location optionLocation : optionsNode.getChildren()) {
                Node optionNode = configuration.getNodeAt(optionLocation);
                Path.Segment segment = optionLocation.getPath().getLastSegment();
                Property valueProperty = optionNode.getProperty(DnaLexicon.VALUE);
                if (valueProperty == null) continue;
                Option option = Option.findOption(segment.getName().getLocalName());
                if (option == null) continue;
                options.put(option, valueProperty.getFirstValue().toString());
            }
        }

        // Read the namespaces ...
        ExecutionContext context = getExecutionContext();
        Node namespacesNode = subgraph.getNode(DnaLexicon.NAMESPACES);
        if (namespacesNode != null) {
            GraphNamespaceRegistry registry = new GraphNamespaceRegistry(configuration, namespacesNode.getLocation().getPath(),
                                                                         DnaLexicon.NAMESPACE_URI);
            context = context.with(registry);
        }

        // Get the name of the source ...
        Property property = subgraph.getRoot().getProperty(DnaLexicon.SOURCE_NAME);
        if (property == null || property.isEmpty()) {
            String readableName = readable(DnaLexicon.SOURCE_NAME);
            String readablePath = readable(subgraph.getLocation());
            String msg = JcrI18n.propertyNotFoundOnNode.text(readableName, readablePath, configuration.getCurrentWorkspaceName());
            throw new RepositoryException(msg);
        }
        String sourceName = context.getValueFactories().getStringFactory().create(property.getFirstValue());

        // Create the repository ...
        JcrRepository repository = new JcrRepository(context, connectionFactory, sourceName, descriptors, options);

        // Register all the the node types ...
View Full Code Here

TOP

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

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.