Search in sources :

Example 1 with LSIDMetadataPort

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

the class LsidWsdlWrapperImpl method getMetadataPortForProtocol.

/**
 * Get an arbitray metadata port for the given protocol
 * @param String the protocol
 * @return LSIDMetadataPort, the metadata port if one exists, null otherwise.
 */
public LSIDMetadataPort getMetadataPortForProtocol(String protocol) {
    Enumeration portNames = lsidMetadataPorts.keys();
    while (portNames.hasMoreElements()) {
        LSIDMetadataPort lmdp = lsidMetadataPorts.get(portNames.nextElement());
        String prot = lmdp.getProtocol();
        if (prot == null)
            continue;
        if (prot.equals(protocol))
            return lmdp;
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) LSIDMetadataPort(com.ibm.lsid.wsdl.LSIDMetadataPort)

Example 2 with LSIDMetadataPort

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

the class LsidWsdlWrapperImpl method getMetadataPort.

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

Example 3 with LSIDMetadataPort

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

the class LsidWsdlWrapperImpl method getMetadataPortNamesForService.

/**
 * Get the keys of all the metadata ports in the given service
 * @param String the service
 * @return LSIDMetadataPort the port
 */
public Enumeration<String> getMetadataPortNamesForService(String servicename) {
    Service service = definition.getService(new QName(definition.getTargetNamespace(), servicename));
    Map ports = service.getPorts();
    Vector<String> keys = new Vector<String>();
    Iterator it = ports.keySet().iterator();
    while (it.hasNext()) {
        String portname = (String) it.next();
        Port port = (Port) ports.get(portname);
        if (port.getBinding().getPortType().getQName().getLocalPart().equals(METADATA_PORT_TYPE))
            keys.add(servicename + ":" + portname);
    }
    return keys.elements();
}
Also used : 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) Iterator(java.util.Iterator) Service(javax.wsdl.Service) Map(java.util.Map) Vector(java.util.Vector)

Example 4 with LSIDMetadataPort

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

the class LsidWsdlWrapperImpl method setMetadataLocation.

public void setMetadataLocation(LSIDMetadataPort metadataPort) throws LSIDException {
    String serviceName = metadataPort.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 = metadataPort.getName();
    if (portName != null) {
        Port port = service.getPort(portName);
        if (port != null) {
            definition.removeBinding(port.getBinding().getQName());
            service.getPorts().remove(portName);
        }
        lsidMetadataPorts.remove(getPortKey(metadataPort));
    }
    String protocol = metadataPort.getProtocol();
    // we have to create a new port and possibly a binding
    // make sure we have the namespaces set in the defintion
    configureDataServiceDef(metadataPort.getProtocol());
    PortType metadataPortType = definition.getPortType(new QName(OMG_LSID_PORT_TYPES_WSDL_NS_URI, METADATA_PORT_TYPE));
    Binding binding = null;
    if (protocol.equals(SOAP))
        binding = definition.getBinding(METADATA_SOAP_BINDING);
    else if (protocol.equals(HTTP)) {
        if (metadataPort.getPath().equals(LSIDMetadataPort.PATH_TYPE_URL_ENCODED))
            binding = definition.getBinding(METADATA_HTTP_BINDING);
        else
            binding = definition.getBinding(METADATA_HTTP_BINDING_DIRECT);
    } else if (protocol.equals(FTP))
        binding = definition.getBinding(METADATA_FTP_BINDING);
    else if (protocol.equals(FILE))
        binding = definition.getBinding(METADATA_FILE_BINDING);
    Port port = createPort(binding, metadataPort);
    service.addPort(port);
    lsidMetadataPorts.put(getPortKey(metadataPort), metadataPort);
    // 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 5 with LSIDMetadataPort

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

the class LsidWsdlWrapperImpl method getMetadataPortNamesForProtocol.

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

Aggregations

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