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;
}
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());
}
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();
}
Aggregations