Example usage for javax.xml.namespace QName QName

List of usage examples for javax.xml.namespace QName QName

Introduction

In this page you can find the example usage for javax.xml.namespace QName QName.

Prototype

public QName(final String namespaceURI, final String localPart) 

Source Link

Document

QName constructor specifying the Namespace URI and local part.

If the Namespace URI is null, it is set to javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI .

Usage

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.resolver.AttributeResolverBeanDefinitionParser.java

/** {@inheritDoc} */
public BeanDefinition parse(Element config, ParserContext context) {
    Map<QName, List<Element>> configChildren = XMLHelper.getChildElements(config);
    List<Element> children;

    children = configChildren.get(new QName(AttributeResolverNamespaceHandler.NAMESPACE, "PrincipalConnector"));
    SpringConfigurationUtils.parseCustomElements(children, context);

    children = configChildren.get(new QName(AttributeResolverNamespaceHandler.NAMESPACE, "DataConnector"));
    SpringConfigurationUtils.parseCustomElements(children, context);

    children = configChildren/*  w  w w.  j ava 2 s  .c om*/
            .get(new QName(AttributeResolverNamespaceHandler.NAMESPACE, "AttributeDefinition"));
    SpringConfigurationUtils.parseCustomElements(children, context);

    return null;
}

From source file:edu.internet2.middleware.shibboleth.common.config.relyingparty.saml.AbstractSAMLProfileConfigurationBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    builder.setLazyInit(true);/*from w ww .j a va2  s. c o  m*/
    Map<QName, List<Element>> children = XMLHelper.getChildElements(element);

    List<Element> audienceElems = children
            .get(new QName(SAMLRelyingPartyNamespaceHandler.NAMESPACE, "Audience"));
    if (audienceElems != null && audienceElems.size() > 0) {
        LazyList<String> audiences = new LazyList<String>();
        for (Element audienceElem : audienceElems) {
            audiences.add(DatatypeHelper.safeTrimOrNullString(audienceElem.getTextContent()));
        }
        builder.addPropertyValue("audiences", audiences);
    }

    String secCredRef = DatatypeHelper
            .safeTrimOrNullString(element.getAttributeNS(null, "signingCredentialRef"));
    if (secCredRef != null) {
        builder.addDependsOn(secCredRef);
        builder.addPropertyReference("signingCredential", secCredRef);
    }

    long lifetime = 300000L;
    if (element.hasAttributeNS(null, "assertionLifetime")) {
        lifetime = SpringConfigurationUtils.parseDurationToMillis(
                "'assertionLifetime' on profile configuration of type " + XMLHelper.getXSIType(element),
                element.getAttributeNS(null, "assertionLifetime"), 0);
    }
    builder.addPropertyValue("assertionLifetime", lifetime);

    String artifactType = DatatypeHelper
            .safeTrimOrNullString(element.getAttributeNS(null, "outboundArtifactType"));
    if (artifactType != null) {
        byte[] artifactTypeBytes = DatatypeHelper.intToByteArray(Integer.parseInt(artifactType));
        byte[] trimmedArtifactTypeBytes = { artifactTypeBytes[2], artifactTypeBytes[3] };
        builder.addPropertyValue("outboundArtifactType", trimmedArtifactTypeBytes);
    }

    CryptoOperationRequirementLevel signRequests = CryptoOperationRequirementLevel.conditional;
    if (element.hasAttributeNS(null, "signRequests")) {
        signRequests = CryptoOperationRequirementLevel.valueOf(element.getAttributeNS(null, "signRequests"));
    }
    builder.addPropertyValue("signRequests", signRequests);

    CryptoOperationRequirementLevel signResponses = getSignResponsesDefault();
    if (element.hasAttributeNS(null, "signResponses")) {
        signResponses = CryptoOperationRequirementLevel.valueOf(element.getAttributeNS(null, "signResponses"));
    }
    builder.addPropertyValue("signResponses", signResponses);

    CryptoOperationRequirementLevel signAssertions = getSignAssertionsDefault();
    if (element.hasAttributeNS(null, "signAssertions")) {
        signAssertions = CryptoOperationRequirementLevel
                .valueOf(element.getAttributeNS(null, "signAssertions"));
    }
    builder.addPropertyValue("signAssertions", signAssertions);

    String secPolRef = DatatypeHelper.safeTrimOrNullString(element.getAttributeNS(null, "securityPolicyRef"));
    if (secPolRef != null) {
        builder.addDependsOn(secPolRef);
        builder.addPropertyReference("profileSecurityPolicy", secPolRef);
    }
}

From source file:jp.go.nict.langrid.bpel.entity.PartnerLink.java

/**
 * //w  w  w .ja  v a  2  s .c  om
 * 
 */
public PartnerLink(NamespaceContext context, Node partnerLinkNode) {
    NamedNodeMap attrs = partnerLinkNode.getAttributes();
    setName(getAttr(attrs, "name"));
    setMyRole(getAttr(attrs, "myRole"));
    setPartnerRole(getAttr(attrs, "partnerRole"));
    String[] plts = getAttr(attrs, "partnerLinkType").split(":", 2);
    if (plts.length == 2) {
        String uri = context.getNamespaceURI(plts[0]);
        if (uri == null) {
            uri = plts[0];
            logger.warning(
                    "failed to resolve namespace prefix \"" + plts[0] + "\" for element \"" + plts[1] + "\"");
        }
        setPartnerLinkType(new QName(uri, plts[1]));
    } else {
        setPartnerLinkType(new QName(plts[0]));
    }
}

From source file:com.ning.billing.recurly.model.jackson.RecurlyObjectsSerializer.java

@Override
public void serialize(final T values, final JsonGenerator jgen, final SerializerProvider provider)
        throws IOException {
    if (values.isEmpty()) {
        jgen.writeStartArray();//from   w ww .ja v  a 2  s  . c  o m
        jgen.writeEndArray();
        return;
    }

    final ToXmlGenerator xmlgen = (ToXmlGenerator) jgen;
    // Nested RecurlyObjects
    final boolean shouldSkipWritingFieldName = xmlgen.getOutputContext()
            .writeFieldName(elementName) == JsonWriteContext.STATUS_EXPECT_VALUE;
    boolean firstValue = true;
    for (final U value : values) {
        if (!shouldSkipWritingFieldName && firstValue) {
            xmlgen.setNextName(new QName(null, elementName));
        } else if (!shouldSkipWritingFieldName) {
            xmlgen.writeFieldName(elementName);
        }
        firstValue = false;

        xmlgen.writeObject(value);
    }
}

From source file:com.openlopd.agpd.nota.ws.NotaWebservice.java

public String registrarXml(FileDataBase xmlFile) throws Exception {
    String endpoint = "https://www.aespd.es:443/agenciapd/axis/SolicitudService?wsdl";

    if (logger.isInfoEnabled()) {
        logger.info("Iniciando notificacin en el entorno de {}.", entorno);
    }/*  w w w.  j a v a  2 s .  co m*/

    Service service = new Service();
    Call call = (Call) service.createCall();

    call.setTargetEndpointAddress(new java.net.URL(endpoint));

    if (entorno.equals(Entornos.exp.name())) {
        // Operacin para el sistema en produccin.
        call.setOperationName(new QName("http://soapinterop.org/", "registrarXml"));
    } else {
        // Operacin para el sistema en pruebas.
        call.setOperationName(new QName("http://soapinterop.org/", "probarXml"));
    }

    // Codificacin y envo del fichero.
    String codecFile = Base64.encode(xmlFile.getFile());
    String ret = (String) call.invoke(new Object[] { codecFile });
    // TODO: Hay que verificar que la firma de esto es correcta.
    return StringEscapeUtils.unescapeHtml4(new String(Base64.decode(ret), "ISO-8859-1"));
    //return new String(Base64.decode(ret), "ISO-8859-1");
}

From source file:org.osgpfoundation.osgp.webdemoapp.infra.platform.IdentificationClientInterceptor.java

@Override
public boolean handleRequest(final MessageContext msgContext) throws WebServiceClientException {
    final SoapMessage message = (SoapMessage) msgContext.getRequest();
    final SoapHeader header = message.getSoapHeader();

    final QName orgIdHeaderHeaderQName = new QName(this.namespace, this.orgIdHeaderName);
    final SoapHeaderElement orgElement = header.addHeaderElement(orgIdHeaderHeaderQName);
    orgElement.setText(this.orgId);

    final QName appNameHeaderQName = new QName(this.namespace, this.appNameHeaderName);
    final SoapHeaderElement appElement = header.addHeaderElement(appNameHeaderQName);
    appElement.setText(this.appName);

    final QName userNameHeaderQName = new QName(this.namespace, this.userNameHeaderName);
    final SoapHeaderElement userElement = header.addHeaderElement(userNameHeaderQName);
    userElement.setText(this.userName);

    return true;/* w w w  .  ja  v a 2 s .co  m*/
}

From source file:org.javelin.sws.ext.bind.internal.model.AnalyzeSimpleTypesTest.java

@Before
public void before() throws Exception {
    this.output = new StringWriter();
    this.eventFactory = XMLEventFactory.newFactory();
    this.writer = XMLOutputFactory.newFactory().createXMLEventWriter(this.output);
    this.writer.add(this.eventFactory.createStartElement(new QName("", "v"), null, null));
}

From source file:org.javelin.sws.ext.bind.SweJaxbContextFactoryTest.java

@Test
public void emptySetOfClassesForJaxbRi() throws Exception {
    JAXBContext ctx = JAXBContext.newInstance();
    System.out.println(ctx.toString());
    ctx.createMarshaller().marshal(/*from w w  w.  j av  a  2  s .co m*/
            new JAXBElement<String>(new QName("urn:test", "str"), String.class, "content"), System.out);
}

From source file:com.evolveum.midpoint.util.QNameUtil.java

public static QName getNodeQName(Node node) {
    return new QName(node.getNamespaceURI(), node.getLocalName());
}

From source file:be.e_contract.mycarenet.consent.ConsentClient.java

public ConsentClient(String location) {
    ConsentService service = ConsentServiceFactory.newInstance();

    this.port = service.getConsentPort();

    QName portQName = new QName("urn:be:fgov:ehealth:consent:protocol:v1", "ConsentPort");
    this.dispatch = service.createDispatch(portQName, Source.class, Service.Mode.PAYLOAD);

    this.wsSecuritySOAPHandler = new WSSecuritySOAPHandler();

    configureBindingProvider(this.dispatch, location);
    configureBindingProvider((BindingProvider) this.port, location);
}