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