Package org.modeshape.jcr.value

Examples of org.modeshape.jcr.value.Name


        assertThat(name.hashCode(), is(other.hashCode()));
    }

    @Test
    public void shouldConsiderNamesEqualIfTheyHaveTheSameNamespaceUriAndLocalPart() {
        Name other = new BasicName(name.getNamespaceUri(), name.getLocalName());
        assertThat(name.equals(other), is(true));
        assertThat(name.compareTo(other), is(0));
    }
View Full Code Here


     * @param tokens the tokens containing the node type definition; never null
     * @throws ParsingException if there is a problem parsing the content
     */
    protected void parseNodeTypeDefinition( TokenStream tokens ) {
        // Parse the name, and create the path and a property for the name ...
        Name name = parseNodeTypeName(tokens);
        JcrNodeTypeTemplate nodeType = new JcrNodeTypeTemplate(context);
        try {
            nodeType.setName(string(name));
        } catch (ConstraintViolationException e) {
            assert false : "Names should always be syntactically valid";
View Full Code Here

     * @return the node type name
     * @throws ParsingException if there is a problem parsing the content
     */
    protected Name parseNodeTypeName( TokenStream tokens ) {
        tokens.consume('[');
        Name name = parseName(tokens);
        tokens.consume(']');
        return name;
    }
View Full Code Here

     * @throws ConstraintViolationException not expected
     */
    protected void parsePropertyDefinition( TokenStream tokens,
                                            JcrNodeTypeTemplate nodeType ) throws ConstraintViolationException {
        tokens.consume('-');
        Name name = parseName(tokens);
        JcrPropertyDefinitionTemplate propDefn = new JcrPropertyDefinitionTemplate(context);
        propDefn.setName(string(name));

        // Parse the (optional) required type ...
        parsePropertyType(tokens, propDefn, PropertyType.STRING.getName());
View Full Code Here

     * @throws ConstraintViolationException not expected
     */
    protected void parseChildNodeDefinition( TokenStream tokens,
                                             JcrNodeTypeTemplate nodeType ) throws ConstraintViolationException {
        tokens.consume('+');
        Name name = parseName(tokens);

        JcrNodeDefinitionTemplate childDefn = new JcrNodeDefinitionTemplate(context);
        childDefn.setName(string(name));

        parseRequiredPrimaryTypes(tokens, childDefn);
View Full Code Here

     */
    protected void parseDefaultType( TokenStream tokens,
                                     JcrNodeDefinitionTemplate childDefn ) throws ConstraintViolationException {
        if (tokens.canConsume('=')) {
            if (!tokens.canConsume('?')) {
                Name defaultType = parseName(tokens);
                childDefn.setDefaultPrimaryTypeName(string(defaultType));
            }
        }
    }
View Full Code Here

                // Look at property added and removed events.
                if (change instanceof PropertyAdded) {
                    PropertyAdded added = (PropertyAdded)change;
                    Path nodePath = added.getPathToNode();
                    String strPath = stringFactory.create(nodePath);
                    Name propName = added.getProperty().getName();
                    // Check if the property is sequencable ...
                    for (SequencingConfiguration config : configs) {
                        Matcher matcher = config.matches(strPath, propName);
                        if (!matcher.matches()) {
                            if (TRACE) {
                                LOGGER.trace("Added property '{1}:{0}' in repository '{2}' did not match sequencer '{3}' and path expression '{4}'",
                                             added.getPath(), workspaceName, repository.name(), config.getSequencer().getName(),
                                             config.getPathExpression());
                            }
                            continue;
                        }
                        if (TRACE) {
                            LOGGER.trace("Submitting added property '{1}:{0}' in repository '{2}' for sequencing using '{3}' and path expression '{4}'",
                                         added.getPath(), workspaceName, repository.name(), config.getSequencer().getName(),
                                         config.getPathExpression());
                        }
                        // The property should be sequenced ...
                        submitWork(config, matcher, workspaceName, stringFactory.create(propName), changeSet.getUserId());
                    }
                } else if (change instanceof PropertyChanged) {
                    PropertyChanged changed = (PropertyChanged)change;
                    Path nodePath = changed.getPathToNode();
                    String strPath = stringFactory.create(nodePath);
                    Name propName = changed.getNewProperty().getName();
                    // Check if the property is sequencable ...
                    for (SequencingConfiguration config : configs) {
                        Matcher matcher = config.matches(strPath, propName);
                        if (!matcher.matches()) {
                            if (TRACE) {
View Full Code Here

        boolean absolute = path.startsWith("/");
        path = path.replaceAll("^/+", "").replaceAll("/+$", ""); // remove leading and trailing slashes
        String[] segmentStrings = path.split("/");
        List<Path.Segment> segments = new ArrayList<Path.Segment>(segmentStrings.length);
        for (String segmentString : segmentStrings) {
            Name name = new BasicName("", segmentString);
            Path.Segment segment = new BasicPathSegment(name);
            segments.add(segment);
        }
        return new BasicPath(segments, absolute);
    }
View Full Code Here

        }
        return new BasicPath(segments, absolute);
    }

    protected Path.Segment segment( String segment ) {
        Name name = new BasicName("", segment);
        return new BasicPathSegment(name);
    }
View Full Code Here

        assert docPath != null;
        Path path = pathFrom(docPath);
        if (path.size() == 3 && path.getSegment(1).getName().getLocalName().equals("generate")) {
            List<DocInfo> newDocs = new ArrayList<DocInfo>();
            ConnectorChangeSet changes = newConnectorChangedSet();
            Name topName = path.getSegment(0).getName();
            Name name = path.getSegment(2).getName();

            // Find the parent ...
            String generatedOutPath = "/" + topName.getLocalName() + "/generated-out";
            String generatedOutId = getDocumentId(generatedOutPath);
            Document generatedOutDoc = getDocumentById(generatedOutId);
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.value.Name

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.