Java Code Examples for javax.wsdl.extensions.UnknownExtensibilityElement#setRequired()

The following examples show how to use javax.wsdl.extensions.UnknownExtensibilityElement#setRequired() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceModelPolicyUpdater.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void addPolicy(PolicyAttachment pa) {
    // TODO - do I need to defensively copy this?
    Element policyEl = pa.getElement();

    UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
    uee.setRequired(true);
    uee.setElementType(DOMUtils.getElementQName(policyEl));
    uee.setElement(policyEl);

    if (ei.getService().getDescription() == null) {
        DescriptionInfo description = new DescriptionInfo();
        description.setName(ei.getService().getName());
        if (!StringUtils.isEmpty(ei.getAddress())) {
            description.setBaseURI(ei.getAddress() + "?wsdl");
        }

        ei.getService().setDescription(description);
    }
    ei.getService().getDescription().addExtensor(uee);
}
 
Example 2
Source File: ServiceModelPolicyUpdater.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addPolicyRef(Extensible ext, Policy p) {
    Document doc = DOMUtils.getEmptyDocument();
    Element el = doc.createElementNS(p.getNamespace(), Constants.ELEM_POLICY_REF);
    el.setPrefix(Constants.ATTR_WSP);
    el.setAttribute(Constants.ATTR_URI, "#" + p.getId());

    UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
    uee.setElementType(new QName(p.getNamespace(), Constants.ELEM_POLICY_REF));
    uee.setElement(el);
    uee.setRequired(true);

    ext.addExtensor(uee);
}
 
Example 3
Source File: PolicyAnnotationListener.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addPolicy(AbstractPropertiesHolder place,
                       ServiceInfo service,
                       Policy p,
                       Class<?> cls,
                       String defName) {
    Element el = addPolicy(service, p, cls, defName);
    if (el != null && !isExistsPolicyReference(place.getExtensors().get(), getPolicyRefURI(el))) {
        UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
        uee.setElement(el);
        uee.setRequired(true);
        uee.setElementType(DOMUtils.getElementQName(el));
        place.addExtensor(uee);
    }
}
 
Example 4
Source File: PolicyAnnotationListener.java    From cxf with Apache License 2.0 4 votes vote down vote up
private Element addPolicy(ServiceInfo service, Policy p, Class<?> cls, String defName) {
    String uri = p.uri();
    String ns = Constants.URI_POLICY_NS;

    if (p.includeInWSDL()) {
        Element element = loadPolicy(uri, defName);
        if (element == null) {
            return null;
        }

        // might have been updated on load policy
        uri = getPolicyId(element);
        ns = element.getNamespaceURI();

        if (service.getDescription() == null && cls != null) {
            service.setDescription(new DescriptionInfo());
            URL u = cls.getResource("/");
            if (u != null) {
                service.getDescription().setBaseURI(u.toString());
            }
        }

        // if not already added to service add it, otherwise ignore
        // and just create the policy reference.
        if (!isExistsPolicy(service.getDescription().getExtensors().get(), uri)) {
            UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
            uee.setElement(element);
            uee.setRequired(true);
            uee.setElementType(DOMUtils.getElementQName(element));
            service.getDescription().addExtensor(uee);
        }

        uri = "#" + uri;
    }

    Document doc = DOMUtils.getEmptyDocument();
    Element el = doc.createElementNS(ns, "wsp:" + Constants.ELEM_POLICY_REF);
    Attr att = doc.createAttributeNS(null, "URI");
    att.setValue(uri);
    el.setAttributeNodeNS(att);
    return el;
}