Search in sources :

Example 1 with LSIDDataPort

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

the class LsidWsdlWrapperImpl method setDataLocation.

public void setDataLocation(LSIDDataPort dataPort) throws LSIDException {
    String serviceName = dataPort.getServiceName();
    if (serviceName == null)
        serviceName = SERVICE_NAME;
    Map services = definition.getServices();
    QName key = new QName(definition.getTargetNamespace(), serviceName);
    Service service = (Service) services.get(key);
    if (service == null) {
        service = definition.createService();
        service.setQName(key);
        definition.addService(service);
    }
    // remove data port if it already exists.
    String portName = dataPort.getName();
    if (portName != null) {
        Port port = service.getPort(portName);
        if (port != null) {
            definition.removeBinding(port.getBinding().getQName());
            service.getPorts().remove(portName);
        }
        lsidDataPorts.remove(getPortKey(dataPort));
    }
    String protocol = dataPort.getProtocol();
    // we have to create a new port and possibly a binding
    // make sure we have the namespaces set in the defintion
    configureDataServiceDef(dataPort.getProtocol());
    PortType dataPortType = definition.getPortType(new QName(OMG_LSID_PORT_TYPES_WSDL_NS_URI, DATA_PORT_TYPE));
    Binding binding = null;
    if (protocol.equals(SOAP))
        binding = definition.getBinding(DATA_SOAP_BINDING);
    else if (protocol.equals(HTTP)) {
        if (dataPort.getPath().equals(LSIDDataPort.PATH_TYPE_URL_ENCODED))
            binding = definition.getBinding(DATA_HTTP_BINDING);
        else
            binding = definition.getBinding(DATA_HTTP_BINDING_DIRECT);
    } else if (protocol.equals(FTP))
        binding = definition.getBinding(DATA_FTP_BINDING);
    else if (protocol.equals(FILE))
        binding = definition.getBinding(DATA_FILE_BINDING);
    Port port = createPort(binding, dataPort);
    service.addPort(port);
    lsidDataPorts.put(getPortKey(dataPort), dataPort);
    // indicate that the WSDL has changed, so the string rep is no longer valid...
    wsdl = null;
}
Also used : FTPBinding(com.ibm.wsdl.extensions.ftp.FTPBinding) Binding(javax.wsdl.Binding) FileBinding(com.ibm.wsdl.extensions.file.FileBinding) 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) Map(java.util.Map) PortType(javax.wsdl.PortType)

Example 2 with LSIDDataPort

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

the class LsidWsdlWrapperImpl method getDataPort.

/**
 * Get an arbitrary data port if one exists.
 * @return LSIDDataPort a data port if one exits, null otherwise. Uses protocol preference order: HTTP, FTP, ANY
 */
public LSIDDataPort getDataPort() {
    LSIDDataPort port = getDataPortForProtocol(HTTP);
    if (port != null)
        return port;
    port = getDataPortForProtocol(FTP);
    if (port != null)
        return port;
    if (!lsidDataPorts.keys().hasMoreElements())
        return null;
    return lsidDataPorts.get(lsidDataPorts.keys().nextElement());
}
Also used : LSIDDataPort(com.ibm.lsid.wsdl.LSIDDataPort)

Example 3 with LSIDDataPort

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

the class LsidWsdlWrapperImpl method getDataPortNamesForProtocol.

/**
 * Get the keys of all the ports for the given protocol
 * @param String the protocol
 * @return Enumeration an Enumeration of Strings of the form "serviceName:portName"
 */
public Enumeration<String> getDataPortNamesForProtocol(String protocol) {
    Vector<String> result = new Vector<String>();
    Enumeration portNames = lsidDataPorts.keys();
    while (portNames.hasMoreElements()) {
        String portName = (String) portNames.nextElement();
        LSIDDataPort ldp = lsidDataPorts.get(portName);
        if (ldp.getProtocol().equals(protocol))
            result.add(portName);
    }
    return result.elements();
}
Also used : LSIDDataPort(com.ibm.lsid.wsdl.LSIDDataPort) Enumeration(java.util.Enumeration) Vector(java.util.Vector)

Aggregations

LSIDDataPort (com.ibm.lsid.wsdl.LSIDDataPort)3 DefaultLSIDPort (com.ibm.lsid.wsdl.DefaultLSIDPort)1 LSIDAuthorityPort (com.ibm.lsid.wsdl.LSIDAuthorityPort)1 LSIDMetadataPort (com.ibm.lsid.wsdl.LSIDMetadataPort)1 LSIDPort (com.ibm.lsid.wsdl.LSIDPort)1 LSIDStandardPort (com.ibm.lsid.wsdl.LSIDStandardPort)1 FileBinding (com.ibm.wsdl.extensions.file.FileBinding)1 FTPBinding (com.ibm.wsdl.extensions.ftp.FTPBinding)1 Enumeration (java.util.Enumeration)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