Search in sources :

Example 1 with LSIDPort

use of com.ibm.lsid.wsdl.LSIDPort in project cdmlib by cybertaxonomy.

the class LsidWsdlWrapperImpl method getExtensionPortNamesByClass.

/**
 * Get all the names of extension ports for a given LSIDPort implementation
 * @param Class a specific implementation of LSIDPort for which we would like all the ports
 * @return Enumeration an enum of strings, each string can be used as a key for <code>getExtensionPort()</code>
 */
public Enumeration<String> getExtensionPortNamesByClass(Class portClass) {
    Enumeration<String> keys = wsdlExtensionPorts.keys();
    Vector<String> ret = new Vector<String>();
    while (keys.hasMoreElements()) {
        String key = keys.nextElement();
        LSIDPort port = wsdlExtensionPorts.get(key);
        if (port.getClass().equals(portClass))
            ret.add(key);
    }
    return ret.elements();
}
Also used : LSIDPort(com.ibm.lsid.wsdl.LSIDPort) DefaultLSIDPort(com.ibm.lsid.wsdl.DefaultLSIDPort) Vector(java.util.Vector)

Example 2 with LSIDPort

use of com.ibm.lsid.wsdl.LSIDPort in project cdmlib by cybertaxonomy.

the class LsidWsdlWrapperImpl method extractPorts.

/**
 * Extract the port info for data and meta data
 */
private void extractPorts() throws LSIDException {
    Map services = definition.getServices();
    Object[] serviceKeys = services.keySet().toArray();
    for (int j = 0; j < serviceKeys.length; j++) {
        Service service = (Service) services.get(serviceKeys[j]);
        Map ports = service.getPorts();
        Object[] portKeys = ports.keySet().toArray();
        // go through the ports, meta data and data
        for (int i = 0; i < portKeys.length; i++) {
            Port port = (Port) ports.get(portKeys[i]);
            Binding binding = port.getBinding();
            PortType portType = binding.getPortType();
            QName qname = portType.getQName();
            if (qname.getLocalPart().equals(METADATA_PORT_TYPE) && qname.getNamespaceURI().equals(OMG_LSID_PORT_TYPES_WSDL_NS_URI)) {
                if (!binding.getQName().equals(METADATA_SOAP_BINDING) && !binding.getQName().equals(METADATA_HTTP_BINDING) && !binding.getQName().equals(METADATA_FTP_BINDING) && !binding.getQName().equals(METADATA_FILE_BINDING))
                    throw new LSIDException(LSIDException.UNKNOWN_METHOD, "Unrecognized metadata binding: " + binding.getQName());
                LsidStandardPortImpl portImpl = extractPort(service, port, qname);
                lsidMetadataPorts.put(portImpl.getKey(), portImpl);
            } else if (qname.getLocalPart().equals(DATA_PORT_TYPE) && qname.getNamespaceURI().equals(OMG_LSID_PORT_TYPES_WSDL_NS_URI)) {
                if (!binding.getQName().equals(DATA_SOAP_BINDING) && !binding.getQName().equals(DATA_HTTP_BINDING) && !binding.getQName().equals(DATA_FTP_BINDING) && !binding.getQName().equals(DATA_FILE_BINDING))
                    throw new LSIDException(LSIDException.UNKNOWN_METHOD, "Unrecognized data binding: " + binding.getQName());
                LsidStandardPortImpl portImpl = extractPort(service, port, qname);
                lsidDataPorts.put(portImpl.getKey(), portImpl);
            } else if (qname.getLocalPart().equals(AUTHORITY_PORT_TYPE) && qname.getNamespaceURI().equals(OMG_LSID_PORT_TYPES_WSDL_NS_URI)) {
                if (!binding.getQName().equals(AUTHORITY_SOAP_BINDING) && !binding.getQName().equals(AUTHORITY_HTTP_BINDING))
                    throw new LSIDException(LSIDException.UNKNOWN_METHOD, "Unrecognized authority binding: " + binding.getQName());
                LsidStandardPortImpl portImpl = extractPort(service, port, qname);
                lsidAuthorityPorts.put(portImpl.getKey(), portImpl);
            } else {
                LSIDPortFactory lpf = LSIDResolver.getConfig().getLSIDPortFactory(portType);
                LSIDPort newPort = null;
                if (lpf == null) {
                    newPort = new DefaultLSIDPort(service.getQName().getLocalPart(), port.getName(), port);
                } else {
                    // might have to use whole qname, not sure for now
                    newPort = lpf.createPort(service.getQName().getLocalPart(), port);
                }
                wsdlExtensionPorts.put(getPortKey(newPort), newPort);
            }
        }
    }
}
Also used : FTPBinding(com.ibm.wsdl.extensions.ftp.FTPBinding) Binding(javax.wsdl.Binding) FileBinding(com.ibm.wsdl.extensions.file.FileBinding) DefaultLSIDPort(com.ibm.lsid.wsdl.DefaultLSIDPort) QName(javax.xml.namespace.QName) LSIDPort(com.ibm.lsid.wsdl.LSIDPort) LSIDDataPort(com.ibm.lsid.wsdl.LSIDDataPort) DefaultLSIDPort(com.ibm.lsid.wsdl.DefaultLSIDPort) LSIDStandardPort(com.ibm.lsid.wsdl.LSIDStandardPort) Port(javax.wsdl.Port) LSIDMetadataPort(com.ibm.lsid.wsdl.LSIDMetadataPort) LSIDAuthorityPort(com.ibm.lsid.wsdl.LSIDAuthorityPort) Service(javax.wsdl.Service) LSIDPortFactory(com.ibm.lsid.wsdl.LSIDPortFactory) LSIDException(com.ibm.lsid.LSIDException) LSIDPort(com.ibm.lsid.wsdl.LSIDPort) DefaultLSIDPort(com.ibm.lsid.wsdl.DefaultLSIDPort) Map(java.util.Map) PortType(javax.wsdl.PortType)

Aggregations

DefaultLSIDPort (com.ibm.lsid.wsdl.DefaultLSIDPort)2 LSIDPort (com.ibm.lsid.wsdl.LSIDPort)2 LSIDException (com.ibm.lsid.LSIDException)1 LSIDAuthorityPort (com.ibm.lsid.wsdl.LSIDAuthorityPort)1 LSIDDataPort (com.ibm.lsid.wsdl.LSIDDataPort)1 LSIDMetadataPort (com.ibm.lsid.wsdl.LSIDMetadataPort)1 LSIDPortFactory (com.ibm.lsid.wsdl.LSIDPortFactory)1 LSIDStandardPort (com.ibm.lsid.wsdl.LSIDStandardPort)1 FileBinding (com.ibm.wsdl.extensions.file.FileBinding)1 FTPBinding (com.ibm.wsdl.extensions.ftp.FTPBinding)1 Map (java.util.Map)1 Vector (java.util.Vector)1 Binding (javax.wsdl.Binding)1 Port (javax.wsdl.Port)1 PortType (javax.wsdl.PortType)1 Service (javax.wsdl.Service)1 QName (javax.xml.namespace.QName)1