Package org.apache.jackrabbit.name

Examples of org.apache.jackrabbit.name.QName


            throws SAXException {
        // process buffered character data
        processCharacters();

        try {
            QName nodeName = new QName(namespaceURI, localName);
            // decode node name
            nodeName = ISO9075.decode(nodeName);

            // properties
            NodeId id = null;
            QName nodeTypeName = null;
            QName[] mixinTypes = null;

            ArrayList props = new ArrayList(atts.getLength());
            for (int i = 0; i < atts.getLength(); i++) {
                if (atts.getURI(i).equals(QName.NS_XMLNS_URI)) {
                    // skip namespace declarations reported as attributes
                    // see http://issues.apache.org/jira/browse/JCR-620#action_12448164
                    continue;
                }
                QName propName = new QName(atts.getURI(i), atts.getLocalName(i));
                // decode property name
                propName = ISO9075.decode(propName);

                // value(s)
                String attrValue = atts.getValue(i);
                TextValue[] propValues;

                // always assume single-valued property for the time being
                // until a way of properly serializing/detecting multi-valued
                // properties on re-import is found (see JCR-325);
                // see also DocViewSAXEventGenerator#leavingProperties(Node, int)
                // todo proper multi-value serialization support
                propValues = new TextValue[1];
                propValues[0] = new StringValue(attrValue, nsContext);

                if (propName.equals(QName.JCR_PRIMARYTYPE)) {
                    // jcr:primaryType
                    if (attrValue.length() > 0) {
                        try {
                            nodeTypeName = NameFormat.parse(attrValue, nsContext);
                        } catch (NameException ne) {
                            throw new SAXException("illegal jcr:primaryType value: "
                                    + attrValue, ne);
                        }
                    }
                } else if (propName.equals(QName.JCR_MIXINTYPES)) {
                    // jcr:mixinTypes
                    mixinTypes = parseNames(attrValue);
                } else if (propName.equals(QName.JCR_UUID)) {
                    // jcr:uuid
                    if (attrValue.length() > 0) {
                        id = NodeId.valueOf(attrValue);
                    }
                } else {
View Full Code Here


                // properties
                writer.write("\t<" + PROPERTIES_ELEMENT + ">\n");
                iter = state.getPropertyNames().iterator();
                while (iter.hasNext()) {
                    QName propName = (QName) iter.next();
                    writer.write("\t\t<" + PROPERTY_ELEMENT + " "
                            + NAME_ATTRIBUTE + "=\"" + Text.encodeIllegalXMLCharacters(propName.toString()) + "\">\n");
                    // @todo serialize type, definition id and values
                    writer.write("\t\t</" + PROPERTY_ELEMENT + ">\n");
                }
                writer.write("\t</" + PROPERTIES_ELEMENT + ">\n");
View Full Code Here

            nameMap = new HashMap();
            // important: fields must be read in same order as they are
            // written in writeObject(ObjectOutputStream)
            short count = in.readShort();   // count
            for (int i = 0; i < count; i++) {
                QName name = QName.valueOf(in.readUTF());    // name
                String s = in.readUTF();   // id
                add(name, NodeId.valueOf(s));
            }
        }
View Full Code Here

            case PropertyType.LONG:
            case PropertyType.DOUBLE:
                return value.toString().length();

            case PropertyType.NAME:
                QName name = (QName) value.internalValue();
                try {
                    return NameFormat.format(name, session.getNamespaceResolver()).length();
                } catch (NoPrefixDeclaredException npde) {
                    // should never happen...
                    String msg = safeGetJCRPath()
View Full Code Here

        InternalValue[] internalValues = null;
        // convert to internal values of correct type
        if (names != null) {
            internalValues = new InternalValue[names.length];
            for (int i = 0; i < names.length; i++) {
                QName name = names[i];
                InternalValue internalValue = null;
                if (name != null) {
                    if (reqType != PropertyType.NAME) {
                        // type conversion required
                        Value targetValue = ValueHelper.convert(
View Full Code Here

     */
    public String getName() throws RepositoryException {
        // check state of this instance
        sanityCheck();

        QName name = ((PropertyId) id).getName();
        try {
            return NameFormat.format(name, session.getNamespaceResolver());
        } catch (NoPrefixDeclaredException npde) {
            // should never get here...
            String msg = "internal error: encountered unregistered namespace " + name.getNamespaceURI();
            log.debug(msg);
            throw new RepositoryException(msg, npde);
        }
    }
View Full Code Here

            Property conflicting = parent.getProperty(nodeName);
            if (conflicting.isNew()) {
                // assume this property has been imported as well;
                // rename conflicting property
                // @todo use better reversible escaping scheme to create unique name
                QName newName = new QName(nodeName.getNamespaceURI(), nodeName.getLocalName() + "_");
                if (parent.hasProperty(newName)) {
                    newName = new QName(newName.getNamespaceURI(), newName.getLocalName() + "_");
                }

                if (conflicting.getDefinition().isMultiple()) {
                    parent.setProperty(newName, conflicting.getValues());
                } else {
View Full Code Here

        // process node

        NodeImpl node = null;
        NodeId id = nodeInfo.getId();
        QName nodeName = nodeInfo.getName();
        QName ntName = nodeInfo.getNodeTypeName();
        QName[] mixins = nodeInfo.getMixinNames();

        if (parent == null) {
            // parent node was skipped, skip this child node also
            parents.push(null); // push null onto stack for skipped node
View Full Code Here

        }
        NodeState nodeState = (NodeState) state;
        Iterator iter = nodeState.getPropertyNames().iterator();

        while (iter.hasNext()) {
            QName propName = (QName) iter.next();
            // check read access
            if (session.getAccessManager().isGranted(new PropertyId(parentId, propName), AccessManager.READ)) {
                return true;
            }
        }
View Full Code Here

        NodeState nodeState = (NodeState) state;
        ArrayList childIds = new ArrayList();
        Iterator iter = nodeState.getPropertyNames().iterator();

        while (iter.hasNext()) {
            QName propName = (QName) iter.next();
            PropertyId id = new PropertyId(parentId, propName);
            // check read access
            if (session.getAccessManager().isGranted(id, AccessManager.READ)) {
                childIds.add(id);
            }
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.