Example usage for org.dom4j QName getNamespace

List of usage examples for org.dom4j QName getNamespace

Introduction

In this page you can find the example usage for org.dom4j QName getNamespace.

Prototype

public Namespace getNamespace() 

Source Link

Document

DOCUMENT ME!

Usage

From source file:com.zimbra.soap.DocumentDispatcher.java

License:Open Source License

public void registerHandler(QName qname, DocumentHandler handler) {
    if (handler instanceof AdminDocumentHandler) {
        if (!(includeList == null) && !includeList.isEmpty() && !includeList
                .contains(String.format("%s::%s", qname.getNamespaceURI(), qname.getQualifiedName()))) {
            ZimbraLog.soap.debug("skipping %s::%s", qname.getNamespaceURI(), qname.getQualifiedName());
            return;
        }//  w  w  w  .  j  a  v  a  2  s . co m
        ZimbraLog.soap.debug("Registering %s::%s", qname.getNamespaceURI(), qname.getQualifiedName());
    }

    handlers.put(qname, handler);
    QName respQName = responses.get(qname);
    if (respQName == null) {
        String reqName = qname.getName();
        String respName;
        if (reqName.endsWith(REQUEST_SUFFIX)) {
            respName = reqName.substring(0, reqName.length() - REQUEST_SUFFIX.length()) + RESPONSE_SUFFIX;
        } else {
            respName = reqName + RESPONSE_SUFFIX;
        }
        respQName = new QName(respName, qname.getNamespace());
        responses.put(qname, respQName);
    }
    handler.setResponseQName(respQName);
}

From source file:org.openzal.zal.soap.InternalDocumentService.java

License:Open Source License

@Override
public void registerHandlers(DocumentDispatcher dispatcher) {
    mHandlerMapPublisher.receivedHandlerMap(dispatcher.getHandlers());

    Map<QName, ? extends SoapHandler> services = mSoapService.getServices();
    for (Map.Entry<QName, ? extends SoapHandler> entry : services.entrySet()) {
        QName qName = entry.getKey();
        org.dom4j.QName zimbraQName = new org.dom4j.QName(qName.getName(), Namespace.get(qName.getNamespace()));

        dispatcher.registerHandler(zimbraQName, wrapHandler(entry.getValue()));
    }//from  w  w w .  j av a 2 s.co m
}

From source file:org.openzal.zal.soap.InternalOverrideDocumentServiceImpl.java

License:Open Source License

@Override
public void registerHandlers(DocumentDispatcher dispatcher) {
    // these are latest original handlers, they may be already overriden
    Map<org.dom4j.QName, DocumentHandler> oringinalHandlers = dispatcher.getHandlers();
    mHandlerMapPublisher.receivedHandlerMap(oringinalHandlers);

    Map<QName, OverridenSoapHandler> services = mSoapService.getServices();
    for (Map.Entry<QName, OverridenSoapHandler> entry : services.entrySet()) {
        QName qName = entry.getKey();
        org.dom4j.QName zimbraQName = new org.dom4j.QName(qName.getName(), Namespace.get(qName.getNamespace()));

        DocumentHandler originalDocumentHandler = null;
        if (mOriginalHandlers.containsKey(zimbraQName)) {
            originalDocumentHandler = mOriginalHandlers.get(zimbraQName);
            entry.getValue().setOriginalHandler(unWrapHandler(originalDocumentHandler));
        }/*from w  ww .j  ava2s.  co m*/

        if (originalDocumentHandler != null) {
            dispatcher.registerHandler(zimbraQName, wrapHandler(entry.getValue(), originalDocumentHandler));
        } else {
            ZimbraLog.extensions.warn("Unable to proxy SOAP Request: " + zimbraQName.toString());
        }
    }
}

From source file:org.openzal.zal.soap.InternalRestoreDocumentService.java

License:Open Source License

@Override
public void registerHandlers(@NotNull DocumentDispatcher dispatcher) {
    Map<QName, ? extends SoapHandler> services = mSoapService.getServices();
    for (QName qName : services.keySet()) {
        org.dom4j.QName zimbraQName = new org.dom4j.QName(qName.getName(), Namespace.get(qName.getNamespace()));

        dispatcher.unRegisterHandler(zimbraQName);

        if (mOriginalHandlersMap.containsKey(zimbraQName)) {
            dispatcher.registerHandler(zimbraQName, mOriginalHandlersMap.get(zimbraQName));
        }/*www .  ja v a2s .  com*/
    }
}

From source file:org.openzal.zal.soap.InternalUnregisterDocumentService.java

License:Open Source License

@Override
public void registerHandlers(@NotNull DocumentDispatcher dispatcher) {
    Map<QName, ? extends SoapHandler> services = mSoapService.getServices();
    for (QName qName : services.keySet()) {
        org.dom4j.QName zimbraQName = new org.dom4j.QName(qName.getName(), Namespace.get(qName.getNamespace()));

        dispatcher.unRegisterHandler(zimbraQName);
    }//w  w  w .  j  ava  2 s  .com
}

From source file:org.orbeon.oxf.xforms.itemset.Itemset.java

License:Open Source License

public static String getAttributeName(QName key) {
    final String attributeName;
    if (key.getNamespace().equals(Namespace.NO_NAMESPACE)) {
        attributeName = key.getName();//from   w  w  w .  j  av a2 s .  c o m
    } else if (key.getNamespace().equals(XFormsConstants.XXFORMS_NAMESPACE)) {
        attributeName = "xxforms-" + key.getName();
    } else {
        // Other namespaces are not allowed in the first place
        throw new IllegalStateException("Invalid attribute on item: " + key.getName());
    }
    return attributeName;
}

From source file:org.orbeon.oxf.xforms.processor.handlers.xhtml.XFormsBaseHandlerXHTML.java

License:Open Source License

protected static void appendAppearances(ElementAnalysis elementAnalysis, StringBuilder sb) {
    for (final QName appearance : XFormsControl.appearances(elementAnalysis)) {
        if (sb.length() > 0)
            sb.append(' ');
        sb.append("xforms-");
        sb.append(elementAnalysis.element().getName());
        sb.append("-appearance-");
        // Allow xxforms:* and *
        if (XFormsConstants.XXFORMS_NAMESPACE_URI.equals(appearance.getNamespace().getURI()))
            sb.append("xxforms-");
        else if (!"".equals(appearance.getNamespace().getURI()))
            throw new ValidationException(
                    "Invalid appearance namespace URI: " + appearance.getNamespace().getURI(),
                    elementAnalysis.locationData());
        sb.append(appearance.getName());
    }/*w w w. j  a v a  2  s.  com*/
}