List of usage examples for javax.xml.namespace QName equals
public final boolean equals(Object objectToTest)
Test this QName
for equality with another Object
.
If the Object
to be tested is not a QName
or is null
, then this method returns false
.
Two QName
s are considered equal if and only if both the Namespace URI and local part are equal.
From source file:org.jbpm.bpel.endpointref.SoapEndpointReference.java
protected Port selectPort(Service service) { QName serviceName = getServiceName(); if (service == null) throw new BpelException("service not found: service=" + serviceName); QName portTypeName = getPortTypeName(); String portName = getPortName(); Port port;/*from w ww . j a v a 2 s . co m*/ if (portName != null) { // the reference designates a specific port, go for it port = service.getPort(portName); if (port == null) { throw new BpelException("port not found: service=" + serviceName + ", port=" + portName); } Binding binding = port.getBinding(); if (!portTypeName.equals(binding.getPortType().getQName())) { throw new BpelException("port does not implement the required port type: " + "service=" + serviceName + ", port=" + portName + ", portType=" + portTypeName); } // does this port use a soap binding? if (!isSoapBinding(binding)) { throw new BpelException("non-soap ports not supported: " + "service=" + serviceName + ", port=" + portName + ", portType=" + portTypeName); } } else { port = null; String address = getAddress(); // iterate the available ports for (Iterator i = service.getPorts().values().iterator(); i.hasNext();) { Port aPort = (Port) i.next(); Binding binding = aPort.getBinding(); // does this port implement the required port type and is bound to soap? if (binding.getPortType().getQName().equals(portTypeName) && isSoapBinding(binding)) { // does the port's address match the referenced address? if (address != null && address.equals(getSoapAddress(aPort))) { // exact match, use the port and stop the search port = aPort; break; } else if (port == null) { // non-exact match, use the port if no other candidate exists port = aPort; } } } if (port == null) { throw new BpelException("no port implements the required port type" + " and is bound to soap: service=" + serviceName + ", portType=" + portTypeName); } } return port; }
From source file:org.jbpm.bpel.integration.exe.PartnerLinkInstance.java
public void setPartnerReference(EndpointReference partnerReference) { QName portTypeName = definition.getPartnerRole().getPortType().getQName(); QName portTypeRef = partnerReference.getPortTypeName(); // if there is no port type reference if (portTypeRef == null) { // take it from the partner link definition partnerReference.setPortTypeName(portTypeName); }/* w w w .ja v a 2 s. co m*/ // otherwise verify it matches the partner link definition else if (!portTypeRef.equals(portTypeName)) { throw new BpelException("port type mismatch: expected=" + portTypeName + ", found=" + portTypeRef); } this.partnerReference = partnerReference; }
From source file:org.jbpm.bpel.integration.jms.IntegrationControl.java
public PartnerLinkEntry getPartnerLinkEntry(QName portTypeName, QName serviceName, String portName) { PartnerLinkEntry selectedEntry = null; for (int i = 0, n = partnerLinkEntries.size(); i < n; i++) { PartnerLinkEntry entry = (PartnerLinkEntry) partnerLinkEntries.get(i); EndpointReference myReference = entry.getMyReference(); if (myReference == null) continue; // this entry corresponds to a partner link without myRole QName myPortTypeName = myReference.getPortTypeName(); if (!portTypeName.equals(myPortTypeName)) continue; QName myServiceName = myReference.getServiceName(); if (myServiceName != null && !serviceName.equals(myServiceName)) continue; String myPortName = myReference.getPortName(); if (myPortName != null && !portName.equals(myPortName)) continue; if (selectedEntry != null) { throw new BpelException("multiple partner link entries match the given arguments: service=" + serviceName + ", port=" + portName); }/*from w w w .j a v a2 s.c om*/ selectedEntry = entry; } return selectedEntry; }
From source file:org.jbpm.bpel.tools.WebServicesDescriptorTool.java
static Element findSeiMapping(Port port, Element jaxrpcMappingElem) { Binding binding = port.getBinding(); QName bindingName = binding.getQName(); QName portTypeName = binding.getPortType().getQName(); for (Iterator i = XmlUtil.getElements(jaxrpcMappingElem, NS_J2EE, ELEM_SERVICE_ENDPOINT_INTERFACE_MAPPING); i.hasNext();) { Element seiMappingElem = (Element) i.next(); // binding Element wsdlBindingElem = XmlUtil.getElement(seiMappingElem, NS_J2EE, ELEM_WSDL_BINDING); if (!bindingName.equals(XmlUtil.getQNameValue(wsdlBindingElem))) continue; // port type Element wsdlPortTypeElem = XmlUtil.getElement(seiMappingElem, NS_J2EE, ELEM_WSDL_PORT_TYPE); if (portTypeName.equals(XmlUtil.getQNameValue(wsdlPortTypeElem))) return seiMappingElem; }/*from w ww .j a v a2 s .c o m*/ return null; }
From source file:org.kalypso.gml.GMLSAXFactory.java
private void processValueType(final IValuePropertyType pt, final Object propertyValue, final QName prefixedQName) throws SAXException { final IMarshallingTypeHandler th = pt.getTypeHandler(); if (th instanceof ISimpleMarshallingTypeHandler<?>) { final String xmlString = printSimpleValue(pt, (ISimpleMarshallingTypeHandler<Object>) th, propertyValue);//from ww w.ja v a 2 s . co m if (xmlString != null) { // FIXME: this is the right place to write CDATA stuff, but of course now it is a wild hack // to look for a specific value. This must of course be decided in a more general way. // Maybe we register extensions for specific qnames? // TODO: also, it should be only done for String, i.e. in the XsdBaseTypeHandlerString final boolean doCData = prefixedQName.equals(new QName(NS.OM, "result")); final LexicalHandler lexicalHandler = doCData ? (LexicalHandler) m_reader.getProperty("http://xml.org/sax/properties/lexical-handler") : null; if (doCData) lexicalHandler.startCDATA(); m_reader.getContentHandler().characters(xmlString.toCharArray(), 0, xmlString.length()); if (doCData) lexicalHandler.endCDATA(); } return; } if (propertyValue != null) { try { th.marshal(propertyValue, m_reader, null, m_gmlVersion); } catch (final Exception e) { // Catch any exception here: we should always continue to write data in order to minimise data loss here // TODO: we need an error handler! Else the user does not get any information about errors // TODO Distinguish between normal exceptions and SaxParseException final ErrorHandler errorHandler = m_reader.getErrorHandler(); if (errorHandler == null) KalypsoDeegreePlugin.getDefault().getLog().log(StatusUtilities.statusFromThrowable(e)); else errorHandler .error(new SAXParseException("Failed to write property: " + pt.getQName(), null, e)); } } }
From source file:org.kalypso.gml.processes.internal.gml.GmlPropertyTester.java
private boolean checkEquals(final QName expectedQName, final QName qname) { if (expectedQName == null || qname == null) return false; /* Shortcut if equal */ if (qname.equals(expectedQName)) return true; /* If we have a feature type, additionally test for substitution */ final GMLSchema schema = findSchema(qname); if (schema == null) return false; final IFeatureType featureType = schema.getFeatureType(qname); if (featureType == null) return false; return GMLSchemaUtilities.substitutes(featureType, expectedQName); }
From source file:org.kalypso.ogc.gml.om.table.handlers.DefaultComponentUiHandlerProvider.java
private IComponentUiHandler handlerForComponent(final int index, final IComponent component, final int columnWidthPercent) { // Some default value final boolean editable = true; final boolean resizeable = true; final boolean moveable = true; final String columnLabel = ComponentUtilities.getComponentLabel(component); // FIXME: use component desrcription instead final String columnTooltip = columnLabel; final int columnWidth = 100; final IRestriction[] restrictions = component.getRestrictions(); if (ComponentUtilities.restrictionContainsEnumeration(restrictions)) { final Map<Object, IAnnotation> items = RestrictionUtilities.getEnumerationItems(restrictions); return new ComponentUiEnumerationHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.NONE, columnWidth, columnWidthPercent, StringUtils.EMPTY, StringUtils.EMPTY, items);//from ww w. j a va2 s .c om } final QName valueTypeName = component.getValueTypeName(); if (valueTypeName.equals(XmlTypes.XS_DATETIME)) return new ComponentUiDateHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.NONE, columnWidth, columnWidthPercent, "%1$tm %1$te,%1$tY", StringUtils.EMPTY, null); //$NON-NLS-1$ if (valueTypeName.equals(XmlTypes.XS_DOUBLE)) { final String format = ComponentUtilities.getDecimalFormat(component); return new ComponentUiDoubleHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.RIGHT, columnWidth, columnWidthPercent, format, StringUtils.EMPTY, null); } if (valueTypeName.equals(XmlTypes.XS_DECIMAL)) { final String format = ComponentUtilities.getDecimalFormat(component); return new ComponentUiDecimalHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.RIGHT, columnWidth, columnWidthPercent, format, StringUtils.EMPTY, null); } if (valueTypeName.equals(XmlTypes.XS_INTEGER)) return new ComponentUiIntegerHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.RIGHT, columnWidth, columnWidthPercent, "%d", StringUtils.EMPTY, null); //$NON-NLS-1$ if (valueTypeName.equals(XmlTypes.XS_STRING)) return new ComponentUiStringHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.LEFT, columnWidth, columnWidthPercent, "%s", StringUtils.EMPTY, null); //$NON-NLS-1$ return null; }
From source file:org.kalypso.ogc.gml.om.table.handlers.DefaultComponentUiHandlerProvider2.java
private IComponentUiHandler handlerForComponent(final int index, final IComponent component, final int columnWidth) { // Some default value final boolean editable = true; final boolean resizeable = true; final boolean moveable = true; final String columnLabel = ComponentUtilities.getComponentLabel(component); final String description = component.getDescription(); final String columnTooltip = StringUtils.isBlank(description) ? columnLabel : description; final IRestriction[] restrictions = component.getRestrictions(); if (ComponentUtilities.restrictionContainsEnumeration(restrictions)) { final Map<Object, IAnnotation> items = RestrictionUtilities.getEnumerationItems(restrictions); return new ComponentUiEnumerationHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.NONE, columnWidth, -1, StringUtils.EMPTY, StringUtils.EMPTY, items); }// w w w .j av a 2 s . c o m final QName valueTypeName = component.getValueTypeName(); if (valueTypeName.equals(XmlTypes.XS_DATETIME)) return new ComponentUiDateHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.NONE, columnWidth, -1, "%1$tm %1$te,%1$tY", StringUtils.EMPTY, null); //$NON-NLS-1$ if (valueTypeName.equals(XmlTypes.XS_DOUBLE)) { final String format = ComponentUtilities.getDecimalFormat(component); return new ComponentUiDoubleHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.RIGHT, columnWidth, -1, format, StringUtils.EMPTY, null); } if (valueTypeName.equals(XmlTypes.XS_DECIMAL)) { final String format = ComponentUtilities.getDecimalFormat(component); return new ComponentUiDecimalHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.RIGHT, columnWidth, -1, format, StringUtils.EMPTY, null); } if (valueTypeName.equals(XmlTypes.XS_INTEGER)) return new ComponentUiIntegerHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.RIGHT, columnWidth, -1, "%d", StringUtils.EMPTY, null); //$NON-NLS-1$ if (valueTypeName.equals(XmlTypes.XS_STRING)) return new ComponentUiStringHandler(index, editable, resizeable, moveable, columnLabel, columnTooltip, SWT.LEFT, columnWidth, -1, "%s", StringUtils.EMPTY, null); //$NON-NLS-1$ return null; }
From source file:org.kalypso.service.wps.utils.ogc.ProcessDescriptionMediator.java
/** * Returns the output description for a single output *///from ww w. j a v a2 s.c om private OutputDescriptionType getOutputDescription(final DataType data) { switch (getVersion()) { case V040: final net.opengeospatial.ows.CodeType outputCode = WPS040ObjectFactoryUtilities.buildCodeType("", //$NON-NLS-1$ data.getId()); final String outputTitle = data.getId(); final String outputAbstrakt = data.getDescription(); final ITypeRegistry<IMarshallingTypeHandler> typeRegistry = MarshallingTypeRegistrySingleton .getTypeRegistry(); final QName type = data.getType(); final IMarshallingTypeHandler handler = typeRegistry.getTypeHandlerForTypeName(type); final Object outputFormChoice; if (!type.equals(WPSUtilities.QNAME_ANY_URI) && handler instanceof ISimpleMarshallingTypeHandler) { /* Literal. */ final DomainMetadataType buildDomainMetadataType = WPS040ObjectFactoryUtilities .buildDomainMetadataType(type.getLocalPart(), null); outputFormChoice = WPS040ObjectFactoryUtilities.buildLiteralOutputType(buildDomainMetadataType, null); } else { /* Reference. */ final net.opengeospatial.wps.ComplexDataType complexData = WPS040ObjectFactoryUtilities .buildComplexDataType("", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ final List<net.opengeospatial.wps.ComplexDataType> complexDatas = new LinkedList<>(); complexDatas.add(complexData); outputFormChoice = WPS040ObjectFactoryUtilities.buildSupportedComplexDataType(complexDatas, null, null, null); } return WPS040ObjectFactoryUtilities.buildOutputDescriptionType(outputCode, outputTitle, outputAbstrakt, outputFormChoice); case V100: throw new UnsupportedOperationException(); } return null; }
From source file:org.kalypso.simulation.core.refactoring.local.LocalSimulationDataProvider.java
@Override public Object getInputForID(final String id) throws SimulationException { final String path = m_inputs.get(id); if (path == null) throw new NoSuchElementException(Messages .getString("org.kalypso.simulation.core.refactoring.local.LocalSimulationDataProvider.0") + id); //$NON-NLS-1$ final DataType inputType = m_modelspec == null ? null : m_modelspec.getInput(id); // default to xs:anyURI if no type is given final QName type = inputType == null ? QNAME_ANY_URI : inputType.getType(); // URI types are treated as URLs, if (type.equals(QNAME_ANY_URI)) { try {/*from w ww . ja v a2s .c o m*/ final URI relativeURI; final URI baseURL = getBaseURL().toURI(); if (path.startsWith("platform:/resource//")) //$NON-NLS-1$ { relativeURI = baseURL.resolve(URIUtil.encodePath(path.substring(20))); } else { relativeURI = baseURL.resolve(URIUtil.encodePath(path)); } // try to silently convert the URI to a URL try { final URL url = relativeURI.toURL(); return url; } catch (final MalformedURLException e) { // gobble } return relativeURI; } catch (final IOException e) { throw new SimulationException(Messages.getString( "org.kalypso.simulation.core.refactoring.local.LocalSimulationDataProvider.1"), e); //$NON-NLS-1$ } catch (final URISyntaxException e) { throw new SimulationException(Messages.getString( "org.kalypso.simulation.core.refactoring.local.LocalSimulationDataProvider.2"), e); //$NON-NLS-1$ } } else { final ITypeRegistry<IMarshallingTypeHandler> typeRegistry = MarshallingTypeRegistrySingleton .getTypeRegistry(); final IMarshallingTypeHandler handler = typeRegistry.getTypeHandlerForTypeName(type); if (handler != null) { try { return handler.parseType(path); } catch (final ParseException e) { throw new SimulationException(Messages.getString( "org.kalypso.simulation.core.refactoring.local.LocalSimulationDataProvider.4", path, //$NON-NLS-1$ type), e); } } } throw new SimulationException( Messages.getString("org.kalypso.simulation.core.refactoring.local.LocalSimulationDataProvider.3") //$NON-NLS-1$ + type, null); }