Package org.apache.jackrabbit.name

Examples of org.apache.jackrabbit.name.QName


    /**
     * {@inheritDoc}
     */
    public boolean hasNodeType(String name) throws RepositoryException {
        try {
            QName qname = NameFormat.parse(name, nsResolver);
            return getNodeTypeRegistry().isRegistered(qname);
        } catch (NameException e) {
           throw new RepositoryException();
        }     
    }
View Full Code Here


                public Object visit(ASTLiteral node, Object data) {
                    value[0] = node;
                    return data;
                }
            }, data);
            QName identifier = tmp[0];

            if (identifier.equals(QName.JCR_PATH)) {
                if (tmp[1] != null) {
                    // simply ignore, this is a join of a mixin node type
                } else {
                    createPathQuery(value[0].getValue(), parent.getType());
                }
View Full Code Here

                        name = null;
                    } else {
                        index = 1;
                    }
                }
                QName qName = null;
                if (name != null) {
                    try {
                        qName = NameFormat.parse(name, resolver);
                    } catch (IllegalNameException e) {
                        throw new IllegalArgumentException("Illegal name: " + name);
View Full Code Here

            throw new ConstraintViolationException("null value does not satisfy the constraint '"
                    + definition + "'");
        }
        switch (value.getType()) {
            case PropertyType.NAME:
                QName n = (QName) value.internalValue();
                if (!name.equals(n)) {
                    throw new ConstraintViolationException(n
                            + " does not satisfy the constraint '"
                            + definition + "'");
                }
View Full Code Here

                                    EffectiveNodeTypeCache entCache,
                                    Map ntdCache)
            throws NodeTypeConflictException, NoSuchNodeTypeException {
        // create empty effective node type instance
        EffectiveNodeType ent = new EffectiveNodeType();
        QName ntName = ntd.getName();

        // prepare new instance
        ent.mergedNodeTypes.add(ntName);
        ent.allNodeTypes.add(ntName);

        // map of all item definitions (maps id to definition)
        // used to effectively detect ambiguous child definitions where
        // ambiguity is defined in terms of definition identity
        HashMap itemDefIds = new HashMap();

        NodeDef[] cnda = ntd.getChildNodeDefs();
        for (int i = 0; i < cnda.length; i++) {
            // check if child node definition would be ambiguous within
            // this node type definition
            if (itemDefIds.containsKey(cnda[i].getId())) {
                // conflict
                String msg;
                if (cnda[i].definesResidual()) {
                    msg = ntName + " contains ambiguous residual child node definitions";
                } else {
                    msg = ntName + " contains ambiguous definitions for child node named "
                            + cnda[i].getName();
                }
                log.debug(msg);
                throw new NodeTypeConflictException(msg);
            } else {
                itemDefIds.put(cnda[i].getId(), cnda[i]);
            }
            if (cnda[i].definesResidual()) {
                // residual node definition
                ent.unnamedItemDefs.add(cnda[i]);
            } else {
                // named node definition
                QName name = cnda[i].getName();
                List defs = (List) ent.namedItemDefs.get(name);
                if (defs == null) {
                    defs = new ArrayList();
                    ent.namedItemDefs.put(name, defs);
                }
                if (defs.size() > 0) {
                    /**
                     * there already exists at least one definition with that
                     * name; make sure none of them is auto-create
                     */
                    for (int j = 0; j < defs.size(); j++) {
                        ItemDef def = (ItemDef) defs.get(j);
                        if (cnda[i].isAutoCreated() || def.isAutoCreated()) {
                            // conflict
                            String msg = "There are more than one 'auto-create' item definitions for '"
                                    + name + "' in node type '" + ntName + "'";
                            log.debug(msg);
                            throw new NodeTypeConflictException(msg);
                        }
                    }
                }
                defs.add(cnda[i]);
            }
        }
        PropDef[] pda = ntd.getPropertyDefs();
        for (int i = 0; i < pda.length; i++) {
            // check if property definition would be ambiguous within
            // this node type definition
            if (itemDefIds.containsKey(pda[i].getId())) {
                // conflict
                String msg;
                if (pda[i].definesResidual()) {
                    msg = ntName + " contains ambiguous residual property definitions";
                } else {
                    msg = ntName + " contains ambiguous definitions for property named "
                            + pda[i].getName();
                }
                log.debug(msg);
                throw new NodeTypeConflictException(msg);
            } else {
                itemDefIds.put(pda[i].getId(), pda[i]);
            }
            if (pda[i].definesResidual()) {
                // residual property definition
                ent.unnamedItemDefs.add(pda[i]);
            } else {
                // named property definition
                QName name = pda[i].getName();
                List defs = (List) ent.namedItemDefs.get(name);
                if (defs == null) {
                    defs = new ArrayList();
                    ent.namedItemDefs.put(name, defs);
                }
View Full Code Here

            ItemDef def = defs[i];
            if (includesNodeType(def.getDeclaringNodeType())) {
                // ignore redundant definitions
                continue;
            }
            QName name = def.getName();
            List existingDefs = (List) namedItemDefs.get(name);
            if (existingDefs != null) {
                if (existingDefs.size() > 0) {
                    // there already exists at least one definition with that name
                    for (int j = 0; j < existingDefs.size(); j++) {
View Full Code Here

            // node types have been collected by now
            String comma = "";
            int ntCount = 0;
            for (Iterator it = nodeTypes.iterator(); it.hasNext(); ntCount++) {
                QName nt = (QName) it.next();
                sb.append(comma).append(" ");
                appendName(nt, resolver, sb);
                comma = ",";
            }
View Full Code Here

            // unknown uri<->prefix mappings
        }

        Set props = node.getPropertyNames();
        for (Iterator it = props.iterator(); it.hasNext();) {
            QName propName = (QName) it.next();
            PropertyId id = new PropertyId(node.getNodeId(), propName);
            try {
                PropertyState propState = (PropertyState) stateProvider.getItemState(id);
                InternalValue[] values = propState.getValues();
                for (int i = 0; i < values.length; i++) {
View Full Code Here

     * @param doc           The document to which to add the field
     * @param fieldName     The name of the field to add
     * @param internalValue The value for the field to add to the document.
     */
    protected void addNameValue(Document doc, String fieldName, Object internalValue) {
        QName qualiName = (QName) internalValue;
        String normValue = internalValue.toString();
        try {
            normValue = mappings.getPrefix(qualiName.getNamespaceURI())
                    + ":" + qualiName.getLocalName();
        } catch (NamespaceException e) {
            // will never happen
        }
        doc.add(new Field(FieldNames.PROPERTIES,
                FieldNames.createNamedValue(fieldName, normValue),
View Full Code Here

     * @param resolver the <code>NamespaceResolver</code> of the local session.
     * @return the translated property name
     */
    public String translatePropertyName(String name, NamespaceResolver resolver)
            throws IllegalNameException, UnknownPrefixException {
        QName qName = NameFormat.parse(name, resolver);
        try {
            return NameFormat.format(qName, this);
        } catch (NoPrefixDeclaredException e) {
            // should never happen actually, because we create yet unknown
            // uri mappings on the fly.
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.name.QName

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.