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.dataConnector.StoredIDDataConnectorBeanDefinitionParser.java

/**
 * Processes the connection management configuration.
 * //  w w  w.  ja v a  2  s. c om
 * @param pluginId ID of this data connector
 * @param pluginConfig configuration element for this data connector
 * @param pluginConfigChildren configuration elements for this connector
 * @param pluginBuilder bean definition builder
 * @param parserContext current configuration parsing context
 */
protected void processConnectionManagement(String pluginId, Element pluginConfig,
        Map<QName, List<Element>> pluginConfigChildren, BeanDefinitionBuilder pluginBuilder,
        ParserContext parserContext) {
    DataSource datasource;

    List<Element> cmc = pluginConfigChildren
            .get(new QName(DataConnectorNamespaceHandler.NAMESPACE, "ContainerManagedConnection"));
    if (cmc != null && cmc.get(0) != null) {
        datasource = buildContainerManagedConnection(pluginId, cmc.get(0));
    } else {
        datasource = buildApplicationManagedConnection(pluginId,
                pluginConfigChildren
                        .get(new QName(DataConnectorNamespaceHandler.NAMESPACE, "ApplicationManagedConnection"))
                        .get(0));
    }

    pluginBuilder.addPropertyValue("datasource", datasource);
}

From source file:org.apache.servicemix.http.ConsumerEndpointTest.java

public void testHttpInOnly() throws Exception {
    HttpComponent http = new HttpComponent();
    HttpConsumerEndpoint ep = new HttpConsumerEndpoint();
    ep.setService(new QName("urn:test", "svc"));
    ep.setEndpoint("ep");
    ep.setTargetService(new QName("urn:test", "recv"));
    ep.setLocationURI("http://localhost:8192/ep1/");
    ep.setDefaultMep(MessageExchangeSupport.IN_ONLY);
    http.setEndpoints(new HttpEndpointType[] { ep });
    container.activateComponent(http, "http");

    ReceiverComponent recv = new ReceiverComponent();
    recv.setService(new QName("urn:test", "recv"));
    container.activateComponent(recv, "recv");

    container.start();/*from   w ww.  j  a  v a  2s.  com*/

    PostMethod post = new PostMethod("http://localhost:8192/ep1/");
    post.setRequestEntity(new StringRequestEntity("<hello>world</hello>"));
    new HttpClient().executeMethod(post);
    String res = post.getResponseBodyAsString();
    log.info(res);
    assertEquals("", res);
    if (post.getStatusCode() != 202) {
        throw new InvalidStatusResponseException(post.getStatusCode());
    }

    recv.getMessageList().assertMessagesReceived(1);
}

From source file:org.fcrepo.serialization.JcrXmlSerializer.java

private void validateJCRXML(final File file) throws InvalidSerializationFormatException, IOException {
    int depth = 0;
    try (final FileInputStream fis = new FileInputStream(file)) {
        final XMLEventReader reader = XMLInputFactory.newFactory().createXMLEventReader(fis);
        while (reader.hasNext()) {
            final XMLEvent event = reader.nextEvent();
            if (event.isStartElement()) {
                depth++;/*from www  .  j  av a2 s.c om*/
                final StartElement startElement = event.asStartElement();
                final Attribute nameAttribute = startElement
                        .getAttributeByName(new QName("http://www.jcp.org/jcr/sv/1.0", "name"));
                if (depth == 1 && nameAttribute != null && "jcr:content".equals(nameAttribute.getValue())) {
                    throw new InvalidSerializationFormatException(
                            "Cannot import JCR/XML starting with content node.");
                }
                if (depth == 1 && nameAttribute != null && "jcr:frozenNode".equals(nameAttribute.getValue())) {
                    throw new InvalidSerializationFormatException("Cannot import historic versions.");
                }
                final QName name = startElement.getName();
                if (!(name.getNamespaceURI().equals("http://www.jcp.org/jcr/sv/1.0")
                        && (name.getLocalPart().equals("node") || name.getLocalPart().equals("property")
                                || name.getLocalPart().equals("value")))) {
                    throw new InvalidSerializationFormatException(
                            "Unrecognized element \"" + name.toString() + "\", in import XML.");
                }
            } else {
                if (event.isEndElement()) {
                    depth--;
                }
            }
        }
        reader.close();
    } catch (XMLStreamException e) {
        throw new InvalidSerializationFormatException(
                "Unable to parse XML" + (e.getMessage() != null ? " (" + e.getMessage() + ")." : "."));
    }
}

From source file:com.evolveum.midpoint.repo.sql.query.definition.ClassDefinitionParser.java

private QName createQName(JaxbName name) {
    return new QName(name.namespace(), name.localPart());
}

From source file:in.gov.uidai.core.aua.client.AuthClient.java

private String generateSignedAuthXML(Auth auth) throws JAXBException, Exception {
    StringWriter authXML = new StringWriter();

    JAXBElement authElement = new JAXBElement(
            new QName("http://www.uidai.gov.in/auth/uid-auth-request/1.0", "Auth"), Auth.class, auth);

    JAXBContext.newInstance(Auth.class).createMarshaller().marshal(authElement, authXML);
    boolean includeKeyInfo = true;

    if (System.getenv().get("SKIP_DIGITAL_SIGNATURE") != null) {
        return authXML.toString();
    } else {/*from   w w w .  j a v  a  2  s  .c  om*/
        return this.digitalSignator.signXML(authXML.toString(), includeKeyInfo);
    }
}

From source file:edu.internet2.middleware.shibboleth.common.config.security.AbstractPKIXValidationInformationBeanDefinitionParser.java

/**
 * Parses the CRLs from the validation info configuration.
 * /*from   w  ww . j a  va  2  s .  c  o  m*/
 * @param configChildren children of the validation info element
 * @param builder validation info build
 */
protected void parseCRLs(Map<QName, List<Element>> configChildren, BeanDefinitionBuilder builder) {
    List<Element> crlElems = configChildren.get(new QName(SecurityNamespaceHandler.NAMESPACE, "CRL"));
    if (crlElems == null || crlElems.isEmpty()) {
        return;
    }

    log.debug("Parsing PKIX validation info CRLs");
    ArrayList<X509CRL> crls = new ArrayList<X509CRL>();
    byte[] encodedCRL;
    Collection<X509CRL> decodedCRLs;
    for (Element crlElem : crlElems) {
        encodedCRL = getEncodedCRL(DatatypeHelper.safeTrimOrNullString(crlElem.getTextContent()));
        if (encodedCRL == null) {
            continue;
        }

        try {
            decodedCRLs = X509Util.decodeCRLs(encodedCRL);
            crls.addAll(decodedCRLs);
        } catch (CRLException e) {
            throw new FatalBeanException("Unable to create PKIX validation info, unable to parse CRLs", e);
        }
    }

    builder.addPropertyValue("crls", crls);
}

From source file:de.fhg.fokus.odp.categoriesgrid.CategoriesGrid.java

/**
 * Search.//from   ww w . ja  va 2  s .  c o m
 * 
 * @param response
 *            the response
 * @param request
 *            the request
 */
@ActionMapping(params = "action=categorySearch")
public void search(ActionResponse response, ActionRequest request) {
    String categoryName = request.getParameter("categoryName");

    Query query = new Query();
    Calendar cal = Calendar.getInstance();
    query.getCategories().add(categoryName + ":#:" + cal.getTimeInMillis());
    response.setEvent(new QName("http://fokus.fraunhofer.de/odplatform", "querydatasets"), query);

    ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    String location = td.getPortalURL();
    Layout layout = td.getLayout();

    try {
        if (layout.isPublicLayout()) {
            location += td.getPathFriendlyURLPublic();
        }

        location += layout.hasScopeGroup() ? layout.getScopeGroup().getFriendlyURL()
                : layout.getGroup().getFriendlyURL();
        location += "/suchen";
        response.sendRedirect(location);
    } catch (PortalException e) {
        LOG.error(e.getMessage());
    } catch (SystemException e) {
        LOG.error(e.getMessage());
    } catch (IOException e) {
        LOG.error(e.getMessage());
    }
}

From source file:org.overlord.sramp.governance.shell.commands.Pkg2SrampCommand.java

/**
 * @see org.overlord.sramp.shell.api.shell.ShellCommand#execute()
 *///from  w w  w . j  a  v a2  s. c  o m
@Override
public boolean execute() throws Exception {
    QName clientVarName = new QName("s-ramp", "client"); //$NON-NLS-1$ //$NON-NLS-2$
    SrampAtomApiClient client = (SrampAtomApiClient) getContext().getVariable(clientVarName);
    if (client == null) {
        print("No S-RAMP repository connection is currently open."); //$NON-NLS-1$
        return false;
    }

    String brmsPackageName = optionalArgument(0, "SRAMPPackage"); //$NON-NLS-1$
    String tag = optionalArgument(1, "LATEST"); //$NON-NLS-1$
    String brmsBaseUrl = optionalArgument(2, "http://localhost:8080/drools-guvnor"); //$NON-NLS-1$
    String brmsUserId = optionalArgument(3, "admin"); //$NON-NLS-1$
    String brmsPassword = optionalArgument(4, "admin"); //$NON-NLS-1$

    print("Copying BRMS package to S-RAMP using: "); //$NON-NLS-1$
    print("   brmsPackageName..: %1$s", brmsPackageName); //$NON-NLS-1$
    print("   tag .............: %1$s", tag); //$NON-NLS-1$
    print("   brmsBaseUrl......: %1$s", brmsBaseUrl); //$NON-NLS-1$
    print("   brmsUserId.......: %1$s", brmsUserId); //$NON-NLS-1$
    print("   brmsPassword.....: %1$s", brmsPassword); //$NON-NLS-1$

    String brmsURLStr = brmsBaseUrl + "/rest/packages/"; //$NON-NLS-1$
    boolean brmsExists = urlExists(brmsURLStr, brmsUserId, brmsPassword);
    if (!brmsExists) {
        print("Can't find BRMS endpoint: " + brmsURLStr); //$NON-NLS-1$
        return false;
    }

    try {
        uploadBrmsPackage(brmsBaseUrl, brmsPackageName, tag, brmsUserId, brmsPassword, client);
    } catch (Exception e) {
        print("FAILED to copy the BRMS package."); //$NON-NLS-1$
        print("\t" + e.getMessage()); //$NON-NLS-1$
        return false;
    }
    print("**********************************************************************"); //$NON-NLS-1$
    return true;
}

From source file:com.evolveum.midpoint.prism.ComplexTypeDefinitionImpl.java

public PrismPropertyDefinitionImpl createPropertyDefinition(String localName, QName typeName) {
    QName name = new QName(getSchemaNamespace(), localName);
    return createPropertyDefinition(name, typeName);
}

From source file:com.emental.mindraider.ui.dialogs.AddLinkToConceptJDialog.java

/**
 * Create a triplet./*from w  w w  .  j av  a2s .co m*/
 */
protected void createTriplet() {
    if (StringUtils.isEmpty(predicateNs.getText())) {
        predicateNs.setText(MindRaiderConstants.MR_RDF_NS);
    }

    if (StringUtils.isEmpty(predicateLocalName.getText())) {
        predicateLocalName.setText(MindRaiderConstants.MR_RDF_PREDICATE);
    }

    if (StringUtils.isEmpty(objectNs.getText())) {
        objectNs.setText(MindRaiderConstants.MR_RDF_NS);
    }

    if (StringUtils.isEmpty(findConceptButton.getText())) {
        JOptionPane.showMessageDialog(MindRaider.mainJFrame, "You must specify object name.",
                "Statement Creation Error", JOptionPane.ERROR_MESSAGE);
        return;
    }

    MindRaider.spidersGraph.createStatement(new QName(predicateNs.getText(), predicateLocalName.getText()),
            new QName(null, objectNs.getText()), false);
    AddLinkToConceptJDialog.this.dispose();
}