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