public TypeDescriptor getTypeDescriptorForOutputPort(String portName) { TypeDescriptor result = null; if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor) typeDescriptor) .getElements()) { if (desc.getName().equals(portName)) { result = desc; break; } } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); if (typeDescriptor.getName().equals(portName)) { result = desc; } } return result; }
.iterator(); inputIterator.hasNext();) { TypeDescriptor elementType = (TypeDescriptor) inputIterator.next(); String key = elementType.getName(); DataThing thing = (DataThing) inputMap.get(key); if (thing != null) { .getElementType(); if (!wrapped) { itemkey = elementType.getName(); } else { if (arrayElementType.getName() != null && arrayElementType.getName().length() > 0) { itemkey = arrayElementType.getName(); } else { itemkey = arrayElementType.getType();
/** * {@inheritDoc} * */ public Map<String, TypeDescriptor> getTypeDescriptorsForOutputPorts() throws UnknownOperationException, IOException { Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>(); if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor) typeDescriptor) .getElements()) { descriptors.put(desc.getName(), desc); } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); descriptors.put(typeDescriptor.getName(), desc); } return descriptors; } }
/** * {@inheritDoc} * */ public Map<String, TypeDescriptor> getTypeDescriptorsForInputPorts() throws UnknownOperationException, IOException { Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>(); if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) { descriptors.put(desc.getName(), desc); } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); descriptors.put(typeDescriptor.getName(), desc); } return descriptors; } }
/** * Returns a TypeDescriptor for the given port name. If the port cannot be found, or is not based upon a complex type, then null is returned. * @param portName * @return */ public TypeDescriptor getTypeDescriptorForInputPort(String portName) { TypeDescriptor result = null; if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) { if (desc.getName().equals(portName)) { result = desc; break; } } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); if (typeDescriptor.getName().equals(portName)) { result = desc; } } return result; }
public Map<String, TypeDescriptor> getTypeDescriptorsForOutputPorts() throws UnknownOperationException, IOException { Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>(); List<TypeDescriptor> inputDescriptors = parser .getOperationOutputParameters(configurationBean.getOperation().getOperationName()); for (TypeDescriptor descriptor : inputDescriptors) { descriptors.put(descriptor.getName(), descriptor); } return descriptors; }
public Map<String, TypeDescriptor> getTypeDescriptorsForInputPorts() throws UnknownOperationException, IOException { Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>(); List<TypeDescriptor> inputDescriptors = parser .getOperationInputParameters(configurationBean.getOperation().getOperationName()); for (TypeDescriptor descriptor : inputDescriptors) { descriptors.put(descriptor.getName(), descriptor); } return descriptors; }
public TypeDescriptor getTypeDescriptorForInputPort(String portName) throws UnknownOperationException, IOException { List<TypeDescriptor> inputDescriptors = parser .getOperationInputParameters(configurationBean.getOperation().getOperationName()); TypeDescriptor result = null; for (TypeDescriptor descriptor : inputDescriptors) { if (descriptor.getName().equals(portName)) { result = descriptor; break; } } return result; }
public TypeDescriptor getTypeDescriptorForOutputPort(String portName) throws UnknownOperationException, IOException { TypeDescriptor result = null; List<TypeDescriptor> outputDescriptors = parser .getOperationOutputParameters(configurationBean.getOperation().getOperationName()); for (TypeDescriptor descriptor : outputDescriptors) { if (descriptor.getName().equals(portName)) { result = descriptor; break; } } return result; }
private void defineFromTypeDescriptor() { if (typeDescriptor instanceof ComplexTypeDescriptor) { List elements = ((ComplexTypeDescriptor) typeDescriptor) .getElements(); outputNames = new String[elements.size()]; outputTypes = new String[elements.size()]; Class[] types = new Class[elements.size()]; TypeDescriptor.retrieveSignature(elements, outputNames, types); for (int i = 0; i < types.length; i++) { outputTypes[i] = TypeDescriptor.translateJavaType(types[i]); } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { outputNames = new String[] { typeDescriptor.getName() }; if (((ArrayTypeDescriptor) typeDescriptor).getElementType() instanceof BaseTypeDescriptor) { outputTypes = new String[] { "l('text/plain')" }; } else { outputTypes = new String[] { "l('text/xml')" }; } } }
private void configurePorts() throws UnknownOperationException, IOException { List<TypeDescriptor> inputDescriptors = parser .getOperationInputParameters(configurationBean.getOperation().getOperationName()); List<TypeDescriptor> outputDescriptors = parser .getOperationOutputParameters(configurationBean.getOperation().getOperationName()); for (TypeDescriptor descriptor : inputDescriptors) { addInput(descriptor.getName(), descriptor.getDepth(), true, null, String.class); } isWsrfService = parser.isWsrfService(); if (isWsrfService) { // Make sure the port name is unique endpointReferenceInputPortName = ENDPOINT_REFERENCE; int counter = 0; while (Tools.getActivityInputPort(this, endpointReferenceInputPortName) != null) { endpointReferenceInputPortName = ENDPOINT_REFERENCE + counter++; } addInput(endpointReferenceInputPortName, 0, true, null, String.class); } for (TypeDescriptor descriptor : outputDescriptors) { addOutput(descriptor.getName(), descriptor.getDepth()); outputDepth.put(descriptor.getName(), Integer.valueOf(descriptor .getDepth())); } // add output for attachment list addOutput("attachmentList", 1); outputDepth.put("attachmentList", Integer.valueOf(1)); }
for (Iterator it = outputs.iterator(); it.hasNext();) { TypeDescriptor desc = (TypeDescriptor) it.next(); if (desc.getName().equalsIgnoreCase( portToSplit.getName())) { typeDescriptor = desc; TypeDescriptor desc = (TypeDescriptor) iterator .next(); if (desc.getName().equals(portToSplit.getName())) { typeDescriptor = desc; if (typeDescriptor instanceof ArrayTypeDescriptor && !((ArrayTypeDescriptor)typeDescriptor).isWrapped()) {
for (Iterator it = inputs.iterator(); it.hasNext();) { TypeDescriptor desc = (TypeDescriptor) it.next(); if (desc.getName().equalsIgnoreCase(portToSplit.getName())) { typeDescriptor = desc; break; .getElements().iterator(); iterator.hasNext();) { TypeDescriptor desc = (TypeDescriptor) iterator.next(); if (desc.getName().equals(portToSplit.getName())) { typeDescriptor = desc; if (typeDescriptor instanceof ArrayTypeDescriptor
String name=descriptor.getName(); portBean.setName(name); portBean.setDepth(1);
@Test public void testBaseTypes() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl")); List<TypeDescriptor> inputs = parser .getOperationInputParameters("BIVGetRecord"); assertEquals("wrong number of inputs", 1, inputs.size()); assertTrue("should not be base type", inputs.get(0) instanceof BaseTypeDescriptor); assertEquals("wrong name", "bid", (inputs.get(0)) .getName()); assertEquals("wrong type", "int", (inputs.get(0)) .getType()); }
@Test public void testCyclicFromElement() throws Exception { String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"typename\" name=\"a\" qname=\"{namespace}typename\"><s:elements><s:complextype id=\"{namespace}typename\" /></s:elements></s:complextype></s:extensions>"; Element el = new SAXBuilder().build(new StringReader(xml)) .getRootElement(); TypeDescriptor a = XMLSplitterSerialisationHelper .extensionXMLToTypeDescriptor(el); assertTrue("wrong type", a instanceof ComplexTypeDescriptor); assertEquals("wrong name", "a", a.getName()); List<TypeDescriptor> a_elements = ((ComplexTypeDescriptor) a).getElements(); assertEquals("should be only 1 element", 1, a_elements.size()); TypeDescriptor b = a_elements.get(0); assertTrue("wrong type", b instanceof ComplexTypeDescriptor); List<TypeDescriptor> b_elements = ((ComplexTypeDescriptor) b).getElements(); assertEquals("should be only 1 element", 1, b_elements.size()); assertEquals("b should contain a reference to a", a.toString(), b_elements.get(0).toString()); }
@Test public void testGoVizNoOutputs() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("GoViz.wsdl")); List<TypeDescriptor> inputs = parser .getOperationInputParameters("destroySession"); List<TypeDescriptor> outputs = parser .getOperationOutputParameters("destroySession"); assertEquals("wrong number of inputs", 1, inputs.size()); assertEquals("wrong number of outputs", 0, outputs.size()); TypeDescriptor typeDesc = inputs.get(0); assertTrue("input should be BaseType", typeDesc instanceof BaseTypeDescriptor); assertEquals("wrong name", "sessionID", typeDesc.getName()); assertEquals("wrong type", "string", typeDesc.getType()); }
.get(0)).getName()); assertEquals("wrong type for input", "int", (inputs .get(0)).getType()); (outputs.get(0)).getName()); assertEquals("wrong type for output", "BIVComplex", (outputs.get(0)).getType()); .getElements().size()); assertEquals("wrong name for first element", "bid", (typeDesc.getElements().get(0)).getName()); assertEquals("wrong name for 2nd element", "spokeModel", (typeDesc.getElements().get(1)).getName()); assertEquals("wrong name for 3rd element", "subunit", (typeDesc.getElements().get(2)).getName()); typeDesc.getElements().size()); assertEquals("wrong name for first element", "id", (typeDesc.getElements().get(0)).getName()); assertEquals("wrong type for first element", "int", (typeDesc.getElements().get(0)).getType()); (typeDesc.getElements().get(6)).getName()); assertEquals("wrong type for last element", "int", (typeDesc.getElements().get(6)).getType());
.getElements().get(0); assertEquals("wrong name", "db", typeDesc.getName()); assertEquals("wrong type", "string", typeDesc.getType()); assertTrue("db should be optional", typeDesc.isOptional()); assertEquals("wrong name", "tool", typeDesc.getName()); assertEquals("wrong type", "string", typeDesc.getType()); assertTrue("tool should be optional", typeDesc.isOptional()); assertEquals("wrong name", "email", typeDesc.getName()); assertEquals("wrong type", "string", typeDesc.getType()); assertTrue("email should be optional", typeDesc.isOptional());