Examples of NamespaceHelper


Examples of org.apache.jackrabbit.commons.NamespaceHelper

            } else {
                throw new UnsupportedRepositoryOperationException(
                        "Unsupported content type: " + contentType);
            }

            new NamespaceHelper(session).registerNamespaces(namespaceMap);

            if (reregisterExisting) {
                // split the node types into new and already registered node types.
                // this way we can register new node types together with already
                // registered node types which make circular dependencies possible
View Full Code Here

Examples of org.apache.jackrabbit.commons.NamespaceHelper

            } else {
                throw new UnsupportedRepositoryOperationException(
                        "Unsupported content type: " + contentType);
            }

            new NamespaceHelper(session).registerNamespaces(namespaceMap);

            if (reregisterExisting) {
                // split the node types into new and already registered node types.
                // this way we can register new node types together with already
                // registered node types which make circular dependencies possible
View Full Code Here

Examples of org.apache.jackrabbit.commons.NamespaceHelper

    private String getJcrName(DavPropertyName propName, Session session) throws RepositoryException {
        // remove any encoding necessary for xml compliance
        String pName = ISO9075.decode(propName.getName());
        Namespace propNamespace = propName.getNamespace();
        if (!Namespace.EMPTY_NAMESPACE.equals(propNamespace)) {
            NamespaceHelper helper = new NamespaceHelper(session);
            String prefix = helper.registerNamespace(
                    propNamespace.getPrefix(), propNamespace.getURI());
            pName = prefix + ":" + pName;
        }
        return pName;
    }
View Full Code Here

Examples of org.apache.jackrabbit.commons.NamespaceHelper

            } else {
                throw new UnsupportedRepositoryOperationException(
                        "Unsupported content type: " + contentType);
            }

            new NamespaceHelper(context.getSessionImpl()).registerNamespaces(namespaceMap);

            if (reregisterExisting) {
                NodeTypeRegistry registry = context.getNodeTypeRegistry();
                // split the node types into new and already registered node types.
                // this way we can register new node types together with already
View Full Code Here

Examples of org.apache.jackrabbit.commons.NamespaceHelper

     */
    @Override
    public void startPrefixMapping(String prefix, String uri)
            throws SAXException {
        try {
            new NamespaceHelper(sessionContext.getSession()).registerNamespace(
                    prefix, uri);
            if (targetHandler != null) {
                targetHandler.startPrefixMapping(prefix, uri);
            } else {
                tempPrefixMap.put(prefix, uri);
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * @throws DocumentException when something went wrong.
     */
    protected void load() throws DocumentException {
        if (!isLoaded) {
            log.debug("Loading: ", new DocumentException());
            NamespaceHelper helper;
            try {
                helper = getNamespaceHelper();

                Element collectionElement = helper.getDocument().getDocumentElement();
                Element[] documentElements =
                    helper.getChildren(collectionElement, ELEMENT_DOCUMENT);

                for (int i = 0; i < documentElements.length; i++) {
                    Element documentElement = documentElements[i];
                    Document document = loadDocument(documentElement);
                    documentsList.add(document);
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * @throws DocumentException when something went wrong.
     */
    public void save() throws DocumentException {
        try {
           
            NamespaceHelper helper = getNamespaceHelper();
            Element collectionElement = helper.getDocument().getDocumentElement();
            if (collectionElement.getAttributeNS(null, ATTRIBUTE_ID) == null | collectionElement.getAttribute(ATTRIBUTE_ID).equals("")) {
                collectionElement.setAttributeNS(null, ATTRIBUTE_ID, this.getId());
            }                  
            Element[] existingDocumentElements = helper.getChildren(collectionElement, ELEMENT_DOCUMENT);
            for (int i = 0; i < existingDocumentElements.length; i++) {
                collectionElement.removeChild(existingDocumentElements[i]);
            }
           
            collectionElement.normalize();
           
            NodeList emptyTextNodes = XPathAPI.selectNodeList(collectionElement, "text()");
            for (int i = 0; i < emptyTextNodes.getLength(); i++) {
                Node node = emptyTextNodes.item(i);
                collectionElement.removeChild(node);
            }

            Document[] documents = getDocuments();
            for (int i = 0; i < documents.length; i++) {
                Element documentElement = createDocumentElement(documents[i], helper);
                collectionElement.appendChild(documentElement);
            }
            DocumentHelper.writeDocument(helper.getDocument(), getFile());
           
        } catch (DocumentException e) {
            throw e;
        } catch (Exception e) {
            throw new DocumentException(e);
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * @throws IOException when something went wrong.
     */
    protected NamespaceHelper getNamespaceHelper()
        throws DocumentException, ParserConfigurationException, SAXException, IOException {

        NamespaceHelper helper;

        if (exists()) {
            File file = getFile();
            org.w3c.dom.Document document = DocumentHelper.readDocument(file);
            helper = new NamespaceHelper(Collection.NAMESPACE, Collection.DEFAULT_PREFIX, document);
        } else {
            helper =
                new NamespaceHelper(
                    Collection.NAMESPACE,
                    Collection.DEFAULT_PREFIX,
                    ELEMENT_COLLECTION);
        }
        return helper;
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

            throw new IllegalArgumentException();
        }

        String triggerType = element.getAttribute(TRIGGER_TYPE);

        NamespaceHelper helper = SchedulerStore.getNamespaceHelper();

        // SimpleTrigger
        if (triggerType.equals(ONCE)) {
            Element[] parameterElements = helper.getChildren(element, "parameter");
            GregorianCalendar date = new GregorianCalendar();

            for (int i = 0; i < parameterElements.length; i++) {
                String name = parameterElements[i].getAttribute("name");
                String value = parameterElements[i].getAttribute("value");

                if (name.equals(YEAR)) {
                    date.set(Calendar.YEAR, Integer.parseInt(value));
                }

                if (name.equals(MONTH)) {
                    date.set(Calendar.MONTH, Integer.parseInt(value) - 1);
                }

                if (name.equals(DAY)) {
                    date.set(Calendar.DAY_OF_MONTH, Integer.parseInt(value));
                }

                if (name.equals(HOUR)) {
                    date.set(Calendar.HOUR_OF_DAY, Integer.parseInt(value));
                }

                if (name.equals(MINUTE)) {
                    date.set(Calendar.MINUTE, Integer.parseInt(value));
                }

                if (name.equals(HOUR)) {
                    date.set(Calendar.HOUR_OF_DAY, Integer.parseInt(value));
                }
            }

            return createSimpleTrigger(jobName, jobGroup, date.getTime());
        }

        // CronTrigger
        if (triggerType.equals(REPEATED)) {
            Element[] parameterElements = helper.getChildren(element, "parameter");
            String name = parameterElements[0].getAttribute("name");
            String value = parameterElements[0].getAttribute("value");
            String cron_expression;

            if (name.equals(CRON_EXPRESSION)) {
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * @param parent The parent of the task wrapper element.
     * @param helper The namespace helper of the document.
     */
    public void restore(NamespaceHelper helper, Element parent) {
        org.w3c.dom.Document document = helper.getDocument();
        NamespaceHelper taskHelper =
            new NamespaceHelper(Task.NAMESPACE, Task.DEFAULT_PREFIX, document);
        Element taskElement = taskHelper.getFirstChild(parent, ELEMENT_TASK);
        Element[] parameterElements = taskHelper.getChildren(taskElement, ELEMENT_PARAMETER);
        for (int i = 0; i < parameterElements.length; i++) {
            String key = parameterElements[i].getAttribute(ATTRIBUTE_NAME);
            String value = parameterElements[i].getAttribute(ATTRIBUTE_VALUE);
            getParameterObject().put(key, value);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.