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:argendata.api.DatasetAPIService.java

@GET
@Path("/by/publisher/{p}.rdf")
@Produces("application/xml")
public String getDatasetsByPublisherRDFXML(@PathParam(value = "p") String publisher) {

    try {/* www. j a v a 2  s.  c  o  m*/
        publisher = URLDecoder.decode(publisher, "UTF-8");
        validate(publisher);
        publisher = Parsing.withoutSpecialCharacters(publisher);
    } catch (Exception e1) {
        throw new NotFoundException("Recurso no encontrado");
    }

    QName qName = new QName(properties.getNamespace(), "Organization:" + publisher);

    String rdfxml;
    try {
        rdfxml = repositoryGateway.getDatasetRDFByPublisher(qName);
    } catch (Exception e) {
        throw new NotFoundException("Recurso no encontrado");
    }

    return rdfxml;
}

From source file:in.gov.uidai.auth.aua.httpclient.OtpClient.java

private String generateSignedOtpXML(Otp otp) throws JAXBException, Exception {
    StringWriter otpXML = new StringWriter();

    JAXBElement<Otp> element = new JAXBElement<Otp>(
            new QName("http://www.uidai.gov.in/authentication/otp/1.0", "Otp"), Otp.class, otp);

    JAXBContext.newInstance(Otp.class).createMarshaller().marshal(element, otpXML);
    boolean includeKeyInfo = true;

    if (System.getenv().get("SKIP_DIGITAL_SIGNATURE") != null) {
        return otpXML.toString();
    } else {/*w ww .j  av a 2 s .com*/
        return this.digitalSignator.signXML(otpXML.toString(), includeKeyInfo);
    }
}

From source file:org.wso2.carbon.bpmn.extensions.rest.RESTInvoker.java

/**
 * This method parse the following configuration in the activiti.xml
 * <bean id="restClientConfiguration">
 *      <property name="maxTotalConnections" value="200"/>
 *      <property name="maxConnectionsPerRoute" value="200"/>
 * </bean>//from   w w w .j  a v a2 s .  c o  m
 */
private void parseConfiguration() {
    String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath();
    String activitiConfigPath = carbonConfigDirPath + File.separator
            + BPMNConstants.ACTIVITI_CONFIGURATION_FILE_NAME;
    File configFile = new File(activitiConfigPath);

    try {
        String configContent = FileUtils.readFileToString(configFile);
        OMElement configElement = AXIOMUtil.stringToOM(configContent);
        Iterator beans = configElement
                .getChildrenWithName(new QName("http://www.springframework.org/schema/beans", "bean"));

        while (beans.hasNext()) {
            OMElement bean = (OMElement) beans.next();
            String beanId = bean.getAttributeValue(new QName(null, "id"));
            if (beanId.equals(RESTConstants.REST_CLIENT_CONFIG_ELEMENT)) {
                Iterator beanProps = bean.getChildrenWithName(
                        new QName("http://www.springframework.org/schema/beans", "property"));

                while (beanProps.hasNext()) {
                    OMElement beanProp = (OMElement) beanProps.next();
                    String beanName = beanProp.getAttributeValue(new QName(null, "name"));
                    if (RESTConstants.REST_CLIENT_MAX_TOTAL_CONNECTIONS.equals(beanName)) {
                        String value = beanProp.getAttributeValue(new QName(null, "value"));
                        if (value != null && !value.trim().equals("")) {
                            maxTotalConnections = Integer.parseInt(value);
                        }
                        if (log.isDebugEnabled()) {
                            log.debug("Max total http connections " + maxTotalConnections);
                        }
                    } else if (RESTConstants.REST_CLIENT_MAX_CONNECTIONS_PER_ROUTE.equals(beanName)) {
                        String value = beanProp.getAttributeValue(new QName(null, "value"));
                        if (value != null && !value.trim().equals("")) {
                            maxTotalConnectionsPerRoute = Integer.parseInt(value);
                        }
                        if (log.isDebugEnabled()) {
                            log.debug("Max total client connections per route " + maxTotalConnectionsPerRoute);
                        }
                    } else if (RESTConstants.REST_CLEINT_CONNECTION_TIMEOUT.equals(beanName)) {
                        String value = beanProp.getAttributeValue(new QName(null, "value"));
                        if (value != null && !value.trim().equals("")) {
                            connectionTimeout = Integer.parseInt(value);
                        }
                    } else if (RESTConstants.REST_CLEINT_SOCKET_TIMEOUT.equals(beanName)) {
                        String value = beanProp.getAttributeValue(new QName(null, "value"));
                        if (value != null && !value.trim().equals("")) {
                            socketTimeout = Integer.parseInt(value);
                        }
                    }
                }
            }
        }
    } catch (IOException | XMLStreamException e) {
        log.error("Error in processing http connection settings, using default settings", e);
    }

}

From source file:be.e_contract.mycarenet.ehbox.EHealthBoxPublicationClient.java

/**
 * Main constructor./*from   w  w  w  .  j a  v  a 2 s  . co  m*/
 * 
 * @param location
 *            the URL of the eHealth Publication version 3.0 web service.
 */
public EHealthBoxPublicationClient(String location) {
    EhBoxPublicationService publicationService = EhBoxPublicationServiceFactory.newInstance();
    /*
     * Nasty way to disable MTOM for Apache CXF.
     */
    this.ehBoxPublicationPort = publicationService
            .getEhBoxPublicationPort(new MTOMFeature(false, 1024 * 1024 * 1024));

    QName publicationPortQName = new QName("urn:be:fgov:ehealth:ehbox:publication:protocol:v3",
            "ehBoxPublicationPort");
    this.publicationDispatch = publicationService.createDispatch(publicationPortQName, Source.class,
            Service.Mode.PAYLOAD);

    this.wsSecuritySOAPHandler = new WSSecuritySOAPHandler();
    this.payloadLogicalHandler = new PayloadLogicalHandler();
    configureBindingProvider((BindingProvider) this.ehBoxPublicationPort, location);
    configureBindingProvider(this.publicationDispatch, location);
}

From source file:org.brekka.phalanx.webservices.SoapExceptionResolver.java

private void resolveDetail(final MessageContext messageContext, final Throwable ex, final SoapFault soapFault) {
    SoapMessage request = (SoapMessage) messageContext.getRequest();
    DOMSource payloadSource = (DOMSource) request.getPayloadSource();
    Node node = payloadSource.getNode();
    String localName = node.getLocalName();
    String namespace = node.getNamespaceURI();
    String faultName = StringUtils.removeEnd(localName, "Request") + "Fault";
    QName faultQName = new QName(namespace, faultName);

    SchemaType schemaType = XmlBeans.getContextTypeLoader().findDocumentType(faultQName);
    if (schemaType != null) {
        try {//from   w  w w  .ja  va2  s  .c  o m
            XmlObject faultDocument = prepareFaultDetail(messageContext, faultName, schemaType, ex);
            if (faultDocument != null) {
                // Add detailed
                StringWriter writer = new StringWriter();
                faultDocument.save(writer, SAVE_OPTIONS);
                Transformer transformer = transformerFactory.newTransformer();

                SoapFaultDetail faultDetail = soapFault.addFaultDetail();
                Result result = faultDetail.getResult();
                transformer.transform(new StreamSource(new StringReader(writer.toString())), result);
            }
        } catch (Exception e) {
            if (log.isWarnEnabled()) {
                log.warn(format("Failed to create custom fault message of type '%s'", schemaType), e);
            }
        }
    }
}

From source file:com.evolveum.midpoint.jaspersoft.studio.integration.MidPointRemoteQueryExecutor.java

private Object createRemoteParamValue(String paramName, Object v) {
    //      QName elementName =  new QName(NS_REPORT, paramName);
    JAXBElement<Object> e = toJaxbElement(new QName(NS_REPORT, "any"), Object.class, v);
    return e;//from  w w w .  j  a v a  2 s .  co m

}

From source file:argendata.service.impl.AppServiceImpl.java

@Override
public void approvedAppDelete(App obj) throws IndexStoreException {
    this.solrDao.delete(obj);

    this.relationalAppDao.delete(this.relationalAppDao.getRelationalApp("Semanticapp:" + obj.getNameId()));

    QName QN = new QName(properties.getNamespace(), "Semanticapp:" + obj.getNameId());
    Semanticapp mySemanticApp = this.semanticAppDao.getById(QN);

    this.semanticAppDao.delete(mySemanticApp);

}

From source file:net.gfipm.shibboleth.config.GfipmBAEDataConnectorBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(String pluginId, Element pluginConfig, Map<QName, List<Element>> pluginConfigChildren,
        BeanDefinitionBuilder pluginBuilder, ParserContext parserContext) {
    super.doParse(pluginId, pluginConfig, pluginConfigChildren, pluginBuilder, parserContext);

    List<BAEAttributeNameMap> attributes = parseAttributes(pluginConfigChildren.get(ATTRIBUTE_ELEMENT_NAME));
    log.debug("Setting the following attributes for plugin {}: {}", pluginId, attributes);
    pluginBuilder.addPropertyValue("baeAttributes", attributes);

    String baeURL = pluginConfig.getAttributeNS(null, "baeURL");
    String baeEntityId = pluginConfig.getAttributeNS(null, "baeEntityId");
    String myEntityId = pluginConfig.getAttributeNS(null, "myEntityId");
    String subjectId = pluginConfig.getAttributeNS(null, "subjectId");

    pluginBuilder.addPropertyValue("baeURL", baeURL);
    pluginBuilder.addPropertyValue("baeEntityId", baeEntityId);
    pluginBuilder.addPropertyValue("myEntityId", myEntityId);
    pluginBuilder.addPropertyValue("subjectId", subjectId);

    int searchTimeLimit = 5000;
    if (pluginConfig.hasAttributeNS(null, "searchTimeLimit")) {
        searchTimeLimit = Integer.parseInt(pluginConfig.getAttributeNS(null, "searchTimeLimit"));
    }/* w ww. j  a  v a2 s  .  c  o  m*/
    log.debug("Data connector {} search timeout: {}ms", pluginId, searchTimeLimit);
    pluginBuilder.addPropertyValue("searchTimeLimit", searchTimeLimit);

    RuntimeBeanReference trustCredential = processCredential(
            pluginConfigChildren.get(new QName(GFIPMNamespaceHandler.NAMESPACE, "TrustCredential")),
            parserContext);
    log.debug("Data connector {} using provided trust material", pluginId);
    pluginBuilder.addPropertyValue("trustCredential", trustCredential);

    RuntimeBeanReference myCredential = processCredential(
            pluginConfigChildren.get(new QName(GFIPMNamespaceHandler.NAMESPACE, "AuthenticationCredential")),
            parserContext);
    log.debug("Data connector {} using provided client authentication material", pluginId);
    pluginBuilder.addPropertyValue("myCredential", myCredential);
}

From source file:org.bimserver.client.soap.SoapChannel.java

@Override
public void newToken(String token) {
    if (useSoapHeaderSessions) {
        for (PublicInterface p : getServiceInterfaces().values()) {
            List<Header> headers = new ArrayList<Header>();
            try {
                Token tokenObject = new Token(token);
                Header sessionHeader = new Header(new QName("uri:org.bimserver.shared", "token"), tokenObject,
                        new JAXBDataBinding(Token.class));
                headers.add(sessionHeader);
            } catch (JAXBException e) {
                LOGGER.error("", e);
            }/* ww  w . jav a  2 s .  c  o m*/
            ((BindingProvider) p).getRequestContext().put(Header.HEADER_LIST, headers);
        }
    }
}

From source file:org.deegree.securityproxy.wfs.responsefilter.capabilities.WfsCapabilitiesModificationManagerCreator.java

private AttributeModificationRule createPostRule() {
    LinkedList<ElementPathStep> path = createBasePath();
    path.add(new ElementPathStep(new QName("http://www.opengis.net/ows", "Post")));
    return new AttributeModificationRule(postDcpUrl, path);
}