List of usage examples for javax.xml.namespace QName getNamespaceURI
public String getNamespaceURI()
Get the Namespace URI of this QName
.
From source file:org.apache.rahas.impl.util.CommonUtil.java
/** * Builds the requested XMLObject./*from w w w .j a v a 2s . co m*/ * * @param objectQName name of the XMLObject * @return the build XMLObject * @throws org.apache.rahas.TrustException If unable to find the appropriate builder. */ public static XMLObject buildXMLObject(QName objectQName) throws TrustException { XMLObjectBuilder builder = Configuration.getBuilderFactory().getBuilder(objectQName); if (builder == null) { log.debug("Unable to find OpenSAML builder for object " + objectQName); throw new TrustException("builderNotFound", new Object[] { objectQName }); } return builder.buildObject(objectQName.getNamespaceURI(), objectQName.getLocalPart(), objectQName.getPrefix()); }
From source file:org.apache.sandesha2.SandeshaModule.java
public void engageNotify(AxisDescription axisDescription) throws AxisFault { if (log.isDebugEnabled()) log.debug("Entry: SandeshaModule::engageNotify, " + axisDescription); AxisDescription parent = axisDescription.getParent(); SandeshaPolicyBean parentPropertyBean = null; if (parent != null) parentPropertyBean = SandeshaUtil.getPropertyBean(parent); SandeshaPolicyBean axisDescPropertyBean = PropertyManager.loadPropertiesFromAxisDescription(axisDescription, parentPropertyBean);//www . ja va 2s . com if (axisDescPropertyBean != null) { Parameter parameter = new Parameter(); parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN); parameter.setValue(axisDescPropertyBean); axisDescription.addParameter(parameter); } // When we engage Sandesha for a Service, we check to see if there are // any OUT_IN MEPs on it's operations. If there are then we record that, // so that we know we should send an Offer for WSRM 1.0 Sequences. // We check the operation names, as the RM operations are added in as // well, and and we only want to consider the user's operations. if (axisDescription instanceof AxisService) { AxisService service = (AxisService) axisDescription; Iterator<AxisOperation> ops = service.getOperations(); while (ops.hasNext()) { AxisOperation op = (AxisOperation) ops.next(); if (log.isDebugEnabled()) log.debug("Examining operation " + op.getName() + ", mep " + op.getMessageExchangePattern()); String name = null; QName qName = op.getName(); if (qName != null) name = qName.getLocalPart(); //Check to see if the operation is a sandesha defined one or an axis2 defined one if ((name != null) && (name.startsWith(Sandesha2Constants.SANDESHA_OP_PREFIX) || qName .getNamespaceURI().equals(org.apache.axis2.namespace.Constants.AXIS2_NAMESPACE_URI))) continue; // If we get to here then we must have one of the user's operations, so // check the MEP. if (op.getAxisSpecificMEPConstant() == WSDLConstants.MEP_CONSTANT_OUT_IN) { Parameter p = new Parameter(Sandesha2Constants.SERVICE_CONTAINS_OUT_IN_MEPS, Boolean.TRUE); service.addParameter(p); break; } } } else if (axisDescription instanceof AxisOperation) { AxisOperation op = (AxisOperation) axisDescription; if (log.isDebugEnabled()) log.debug("Examining operation " + op.getName() + ", mep " + op.getAxisSpecificMEPConstant()); String name = null; QName qName = op.getName(); if (qName != null) name = qName.getLocalPart(); //Check to see if the operation is a sandesha defined one or an axis2 defined one if (name != null && (!name.startsWith(Sandesha2Constants.SANDESHA_OP_PREFIX)) && (!qName .getNamespaceURI().equals(org.apache.axis2.namespace.Constants.AXIS2_NAMESPACE_URI))) { // If we get to here then we must have one of the user's operations, so // check the MEP. if (op.getAxisSpecificMEPConstant() == WSDLConstants.MEP_CONSTANT_OUT_IN) { Parameter p = new Parameter(Sandesha2Constants.SERVICE_CONTAINS_OUT_IN_MEPS, Boolean.TRUE); op.getParent().addParameter(p); } } } if (log.isDebugEnabled()) log.debug("Exit: SandeshaModule::engageNotify"); }
From source file:org.apache.synapse.commons.json.JsonReaderDelegate.java
public QName getName() { QName qName = super.getName(); String localName = qName.getLocalPart(); QName newName = qName;/* w w w . j a va2s. co m*/ if (localName == null || "".equals(localName)) { return qName; } boolean checked = false; if (Character.isDigit(localName.charAt(0))) { localName = Constants.PRECEDING_DIGIT + localName; if (buildValidNCNames) { localName = toValidNCName(localName); checked = true; } newName = new QName(qName.getNamespaceURI(), localName, qName.getPrefix()); } if (localName.charAt(0) == Constants.C_DOLLOR) { localName = Constants.PRECEDING_DOLLOR + localName.substring(1); if (buildValidNCNames) { localName = toValidNCName(localName); checked = true; } newName = new QName(qName.getNamespaceURI(), localName, qName.getPrefix()); } if (!checked && buildValidNCNames) { String newNameP = toValidNCName(localName); if (!localName.equals(newNameP)) { newName = new QName(qName.getNamespaceURI(), newNameP, qName.getPrefix()); } } if (logger.isDebugEnabled()) { logger.debug("#getName. old=" + localName + ", new=" + newName.getLocalPart()); } return newName; }
From source file:org.apache.synapse.commons.json.XmlReaderDelegate.java
public QName getName() { QName qName = super.getName(); String localName = qName.getLocalPart(); QName newName = qName;//from w ww. java 2 s.co m if (localName == null || "".equals(localName)) { return qName; } boolean checked = false; String subStr; if (localName.charAt(0) == Constants.C_USOCRE) { if (localName.startsWith(Constants.PRECEDING_DIGIT)) { subStr = localName.substring(Constants.PRECEDING_DIGIT.length(), localName.length()); if (processNCNames) { localName = toOrigJsonKey(subStr); checked = true; } else { localName = subStr; } newName = new QName(qName.getNamespaceURI(), localName, qName.getPrefix()); } else if (localName.startsWith(Constants.PRECEDING_DOLLOR)) { subStr = localName.substring(Constants.PRECEDING_DOLLOR.length(), localName.length()); if (processNCNames) { localName = (char) Constants.C_DOLLOR + toOrigJsonKey(subStr); checked = true; } else { localName = (char) Constants.C_DOLLOR + subStr; } newName = new QName(qName.getNamespaceURI(), localName, qName.getPrefix()); } } if (!checked && processNCNames) { String newNameP = toOrigJsonKey(localName); if (!localName.equals(newNameP)) { newName = new QName(qName.getNamespaceURI(), newNameP, qName.getPrefix()); } } if (logger.isDebugEnabled()) { logger.debug("#getName. old=" + localName + ", new=" + newName.getLocalPart()); } return newName; }
From source file:org.apache.synapse.config.xml.HeaderMediatorSerializer.java
public OMElement serializeMediator(OMElement parent, Mediator m) { if (!(m instanceof HeaderMediator)) { handleException("Unsupported mediator passed in for serialization : " + m.getType()); }// w w w. j av a 2 s . com HeaderMediator mediator = (HeaderMediator) m; OMElement header = fac.createOMElement("header", synNS); finalizeSerialization(header, mediator); QName qName = mediator.getQName(); if (qName != null) { if (qName.getNamespaceURI() != null) { header.addAttribute(fac.createOMAttribute("name", nullNS, (qName.getPrefix() != null && !"".equals(qName.getPrefix()) ? qName.getPrefix() + ":" : "") + qName.getLocalPart())); header.declareNamespace(qName.getNamespaceURI(), qName.getPrefix()); } else { header.addAttribute(fac.createOMAttribute("name", nullNS, qName.getLocalPart())); } } if (mediator.getAction() == HeaderMediator.ACTION_REMOVE) { header.addAttribute(fac.createOMAttribute("action", nullNS, "remove")); } else { if (mediator.getValue() != null) { header.addAttribute(fac.createOMAttribute("value", nullNS, mediator.getValue())); } else if (mediator.getExpression() != null) { header.addAttribute( fac.createOMAttribute("expression", nullNS, mediator.getExpression().toString())); super.serializeNamespaces(header, mediator.getExpression()); } else { handleException("Value or expression required for a set header mediator"); } } if (parent != null) { parent.addChild(header); } return header; }
From source file:org.apache.synapse.mediators.experimental.MockFactoryMediator.java
private boolean checkAndReplaceEnvelop(OMElement resultElement, MessageContext synCtx) { OMElement firstChild = resultElement.getFirstElement(); QName resultQName = firstChild.getQName(); if (resultQName.getLocalPart().equals("Envelope") && (resultQName.getNamespaceURI().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) || resultQName.getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))) { SOAPEnvelope soapEnvelope = AXIOMUtils.getSOAPEnvFromOM(resultElement.getFirstElement()); if (soapEnvelope != null) { try { synCtx.setEnvelope(soapEnvelope); } catch (AxisFault axisFault) { handleException("Unable to attach SOAPEnvelope", axisFault, synCtx); }// ww w. java 2s .c o m } } else { return false; } return true; }
From source file:org.apache.tuscany.sca.implementation.bpel.ode.BPELODEDeployFile.java
/** * Creates the deploy.xml data and writes it to a supplied PrintStream * @param stream/*from w w w .j av a 2 s .co m*/ */ public void constructDeployXML(PrintStream stream) { // <deploy + namespace... stream.println(DEPLOY_ELEMENT_START); // namespace of the BPEL process QName process = implementation.getProcess(); String processNamespace = process.getNamespaceURI(); stream.println(PROCESS_NAMESPACE_DECL + "\"" + processNamespace + "\""); // namespace for the service name elements stream.println(SERVICE_NAMESPACE + ">"); // <process> element stream.println(PROCESS_ELEMENT_START + process.getLocalPart() + PROCESS_ELEMENT_END); // <active/> element stream.println(ACTIVE_ELEMENT); ComponentType componentType = implementation.getComponentType(); List<Service> theServices = componentType.getServices(); // Loop over the <provide/> elements - one per service for (Service service : theServices) { String serviceName = service.getName(); // Provide element... stream.println(PROVIDE_ELEMENT_START + serviceName + PROVIDE_ELEMENT_END); // Child service element... stream.println( SERVICE_ELEMENT_START + serviceName + SERVICE_ELEMENT_PORT + serviceName + SERVICE_ELEMENT_END); stream.println(PROVIDE_ENDELEMENT); } // end for // Loop over the <invoke/> elements - one per reference List<Reference> theReferences = componentType.getReferences(); for (Reference reference : theReferences) { String referenceName = reference.getName(); stream.println(INVOKE_ELEMENT_START + referenceName + INVOKE_ELEMENT_END); // Child service element... stream.println(SERVICE_ELEMENT_START + referenceName + SERVICE_ELEMENT_PORT + referenceName + SERVICE_ELEMENT_END); stream.println(INVOKE_ENDELEMENT); } // end for // </process> element stream.println(PROCESS_ENDELEMENT); // </deploy> stream.println(DEPLOY_ENDELEMENT); }
From source file:org.apache.tuscany.sca.implementation.bpel.ode.ODEBindingContext.java
/** * Helper method to retrieve the BPEL process name from a processID (where processID have version concatenated to it) * @param pid//from w w w . j a v a2s. co m * @return QName the BPEL process name */ private static QName getProcessName(QName pid) { String processName = pid.getLocalPart().substring(0, pid.getLocalPart().lastIndexOf("-")); return new QName(pid.getNamespaceURI(), processName); }
From source file:org.apache.tuscany.sca.implementation.bpel.ode.TuscanyProcessConfImpl.java
/** * Return the BPEL Process ID - which is the Process QName appended "-versionnumber" *///ww w .j a va2 s . c o m public QName getProcessId() { //System.out.println("getProcessId called"); QName processType = getType(); QName processID = new QName(processType.getNamespaceURI(), processType.getLocalPart() + "-" + getVersion()); return processID; }
From source file:org.apache.vxquery.xmlquery.translator.XMLQueryTranslator.java
@SuppressWarnings("unchecked") private void parsePrologPass1(PrologNode prologNode) throws SystemException { if (prologNode != null) { List<ASTNode> decls = prologNode.getDecls(); for (ASTNode d : decls) { switch (d.getTag()) { case DEFAULT_ELEMENT_NAMESPACE_DECLARATION: { DefaultElementNamespaceDeclNode node = (DefaultElementNamespaceDeclNode) d; moduleCtx.setDefaultElementNamespaceUri(node.getUri()); break; }/*from ww w . j av a2 s.co m*/ case DEFAULT_FUNCTION_NAMESPACE_DECLARATION: { DefaultFunctionNamespaceDeclNode node = (DefaultFunctionNamespaceDeclNode) d; moduleCtx.setDefaultFunctionNamespaceUri(node.getUri()); break; } case BOUNDARY_SPACE_DECLARATION: { BoundarySpaceDeclNode node = (BoundarySpaceDeclNode) d; moduleCtx.setBoundarySpaceProperty(node.getMode()); break; } case DEFAULT_COLLATION_DECLARATION: { DefaultCollationDeclNode node = (DefaultCollationDeclNode) d; moduleCtx.setDefaultCollation(node.getCollation()); break; } case BASE_URI_DECLARATION: { BaseUriDeclNode node = (BaseUriDeclNode) d; moduleCtx.setBaseUri(node.getUri()); break; } case CONSTRUCTION_DECLARATION: { ConstructionDeclNode node = (ConstructionDeclNode) d; moduleCtx.setConstructionModeProperty(node.getMode()); break; } case ORDERING_MODE_DECLARATION: { OrderingModeDeclNode node = (OrderingModeDeclNode) d; moduleCtx.setOrderingModeProperty(node.getMode()); break; } case EMPTY_ORDER_DECLARATION: { EmptyOrderDeclNode node = (EmptyOrderDeclNode) d; moduleCtx.setEmptyOrderProperty(node.getMode()); break; } case COPY_NAMESPACES_DECLARATION: { CopyNamespacesDeclNode node = (CopyNamespacesDeclNode) d; moduleCtx.setCopyNamespacesModeProperty(node.getMode()); break; } case NAMESPACE_DECLARATION: { NamespaceDeclNode node = (NamespaceDeclNode) d; moduleCtx.registerNamespaceUri(node.getPrefix(), unquote(node.getUri())); break; } case SCHEMA_IMPORT: { SchemaImportNode node = (SchemaImportNode) d; if (node.isDefaultElementNamespace()) { moduleCtx.setDefaultElementNamespaceUri(node.getTargetNS()); } if (node.getPrefix() != null) { moduleCtx.registerNamespaceUri(node.getPrefix(), unquote(node.getTargetNS())); } moduleCtx.registerSchemaImport(node.getTargetNS(), node.getLocations()); break; } case MODULE_IMPORT: { ModuleImportNode node = (ModuleImportNode) d; if (node.getPrefix() != null) { moduleCtx.registerNamespaceUri(node.getPrefix(), unquote(node.getTargetNS())); } moduleCtx.registerModuleImport(node.getTargetNS(), node.getLocations()); break; } case VARIABLE_DECLARATION: { VarDeclNode node = (VarDeclNode) d; QName name = createQName(node.getName()); SequenceType type = SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR); if (node.getType() != null) { type = createSequenceType(node.getType()); } LogicalVariable lVar = newLogicalVariable(); XQueryVariable var = new XQueryVariable(name, type, lVar); moduleCtx.registerVariable(var); break; } case FUNCTION_DECLARATION: { FunctionDeclNode node = (FunctionDeclNode) d; boolean external = node.getBody() == null; QName name = createQName(node.getName(), moduleCtx.getDefaultFunctionNamespaceUri()); String uri = name.getNamespaceURI(); if (XQueryConstants.FN_NSURI.equals(uri) || XQueryConstants.XS_NSURI.equals(uri) || XQueryConstants.XSI_NSURI.equals(uri) || XQueryConstants.XML_NSURI.equals(uri)) { throw new SystemException(ErrorCode.XQST0045, node.getSourceLocation()); } SequenceType rType = SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR); if (node.getReturnType() != null) { rType = createSequenceType(node.getReturnType()); } Pair<QName, SequenceType> paramTypes[] = new Pair[node.getParameters().size()]; for (int i = 0; i < paramTypes.length; ++i) { ParamNode pNode = node.getParameters().get(i); QName pName = createQName(pNode.getName()); SequenceType pType = SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR); if (pNode.getType() != null) { pType = createSequenceType(pNode.getType()); } paramTypes[i] = Pair.<QName, SequenceType>of(pName, pType); } Signature sign = new Signature(rType, paramTypes); Function f = external ? new ExternalFunction(name, sign) : new UserDefinedXQueryFunction(name, sign, null); moduleCtx.registerFunction(f); break; } case OPTION_DECLARATION: { OptionDeclNode node = (OptionDeclNode) d; QName name = createQName(node.getName()); moduleCtx.setOption(name, node.getValue()); break; } default: throw new IllegalStateException("Unknown node: " + d.getTag()); } } } }