Search in sources :

Example 1 with LSIDAuthorityPort

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

the class LsidWsdlWrapperImpl method setAuthorityLocation.

public void setAuthorityLocation(LSIDAuthorityPort authorityPort) throws LSIDException {
    String serviceName = authorityPort.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 = authorityPort.getName();
    if (portName != null) {
        Port port = service.getPort(portName);
        if (port != null) {
            definition.removeBinding(port.getBinding().getQName());
            service.getPorts().remove(portName);
        }
        lsidAuthorityPorts.remove(getPortKey(authorityPort));
    }
    String protocol = authorityPort.getProtocol();
    // we have to create a new port and possibly a binding
    // make sure we have the namespaces set in the defintion
    configureAuthorityServiceDef(protocol);
    PortType authorityPortType = definition.getPortType(new QName(OMG_LSID_PORT_TYPES_WSDL_NS_URI, AUTHORITY_PORT_TYPE));
    Binding binding = null;
    if (protocol.equals(SOAP))
        binding = definition.getBinding(AUTHORITY_SOAP_BINDING);
    else if (protocol.equals(HTTP))
        binding = definition.getBinding(AUTHORITY_HTTP_BINDING);
    if (binding == null)
        throw new LSIDException("Unsuported protocol for authority port: " + protocol);
    Port authport = createPort(binding, authorityPort);
    service.addPort(authport);
    lsidAuthorityPorts.put(getPortKey(authorityPort), authorityPort);
    // 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) LSIDException(com.ibm.lsid.LSIDException) 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 LSIDAuthorityPort

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

the class LsidWsdlWrapperImpl method getAuthorityPortForProtocol.

/**
 * Get an arbitray authority port for the given protocol
 * @param String the protocol
 * @return LSIDAuthorityPort, the authority port if one exists, null otherwise.
 */
public LSIDAuthorityPort getAuthorityPortForProtocol(String protocol) {
    Enumeration<String> portNames = lsidAuthorityPorts.keys();
    while (portNames.hasMoreElements()) {
        LSIDAuthorityPort lap = lsidAuthorityPorts.get(portNames.nextElement());
        String prot = lap.getProtocol();
        if (prot == null)
            continue;
        if (prot.equals(protocol))
            return lap;
    }
    return null;
}
Also used : LSIDAuthorityPort(com.ibm.lsid.wsdl.LSIDAuthorityPort)

Example 3 with LSIDAuthorityPort

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

the class LsidWsdlWrapperImpl method getAuthorityPortNamesForProtocol.

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

Example 4 with LSIDAuthorityPort

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

the class LsidWsdlWrapperImpl method getAuthorityPort.

/**
 * Get an arbitrary authority port if one exists.
 * @return LSIDAuthorityPort an authority port if one exits, null otherwise. Uses protocol preference order: HTTP, SOAP
 */
public LSIDAuthorityPort getAuthorityPort() {
    LSIDAuthorityPort port = getAuthorityPortForProtocol(HTTP);
    if (port != null)
        return port;
    port = getAuthorityPortForProtocol(SOAP);
    if (port != null)
        return port;
    if (!lsidAuthorityPorts.keys().hasMoreElements())
        return null;
    return lsidAuthorityPorts.get(lsidAuthorityPorts.keys().nextElement());
}
Also used : LSIDAuthorityPort(com.ibm.lsid.wsdl.LSIDAuthorityPort)

Aggregations

LSIDAuthorityPort (com.ibm.lsid.wsdl.LSIDAuthorityPort)4 LSIDException (com.ibm.lsid.LSIDException)1 DefaultLSIDPort (com.ibm.lsid.wsdl.DefaultLSIDPort)1 LSIDDataPort (com.ibm.lsid.wsdl.LSIDDataPort)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