use of com.ibm.lsid.LSIDException in project cdmlib by cybertaxonomy.
the class LsidWsdlWrapperImpl method extractPorts.
/**
* Extract the port info for data and meta data
*/
private void extractPorts() throws LSIDException {
Map services = definition.getServices();
Object[] serviceKeys = services.keySet().toArray();
for (int j = 0; j < serviceKeys.length; j++) {
Service service = (Service) services.get(serviceKeys[j]);
Map ports = service.getPorts();
Object[] portKeys = ports.keySet().toArray();
// go through the ports, meta data and data
for (int i = 0; i < portKeys.length; i++) {
Port port = (Port) ports.get(portKeys[i]);
Binding binding = port.getBinding();
PortType portType = binding.getPortType();
QName qname = portType.getQName();
if (qname.getLocalPart().equals(METADATA_PORT_TYPE) && qname.getNamespaceURI().equals(OMG_LSID_PORT_TYPES_WSDL_NS_URI)) {
if (!binding.getQName().equals(METADATA_SOAP_BINDING) && !binding.getQName().equals(METADATA_HTTP_BINDING) && !binding.getQName().equals(METADATA_FTP_BINDING) && !binding.getQName().equals(METADATA_FILE_BINDING))
throw new LSIDException(LSIDException.UNKNOWN_METHOD, "Unrecognized metadata binding: " + binding.getQName());
LsidStandardPortImpl portImpl = extractPort(service, port, qname);
lsidMetadataPorts.put(portImpl.getKey(), portImpl);
} else if (qname.getLocalPart().equals(DATA_PORT_TYPE) && qname.getNamespaceURI().equals(OMG_LSID_PORT_TYPES_WSDL_NS_URI)) {
if (!binding.getQName().equals(DATA_SOAP_BINDING) && !binding.getQName().equals(DATA_HTTP_BINDING) && !binding.getQName().equals(DATA_FTP_BINDING) && !binding.getQName().equals(DATA_FILE_BINDING))
throw new LSIDException(LSIDException.UNKNOWN_METHOD, "Unrecognized data binding: " + binding.getQName());
LsidStandardPortImpl portImpl = extractPort(service, port, qname);
lsidDataPorts.put(portImpl.getKey(), portImpl);
} else if (qname.getLocalPart().equals(AUTHORITY_PORT_TYPE) && qname.getNamespaceURI().equals(OMG_LSID_PORT_TYPES_WSDL_NS_URI)) {
if (!binding.getQName().equals(AUTHORITY_SOAP_BINDING) && !binding.getQName().equals(AUTHORITY_HTTP_BINDING))
throw new LSIDException(LSIDException.UNKNOWN_METHOD, "Unrecognized authority binding: " + binding.getQName());
LsidStandardPortImpl portImpl = extractPort(service, port, qname);
lsidAuthorityPorts.put(portImpl.getKey(), portImpl);
} else {
LSIDPortFactory lpf = LSIDResolver.getConfig().getLSIDPortFactory(portType);
LSIDPort newPort = null;
if (lpf == null) {
newPort = new DefaultLSIDPort(service.getQName().getLocalPart(), port.getName(), port);
} else {
// might have to use whole qname, not sure for now
newPort = lpf.createPort(service.getQName().getLocalPart(), port);
}
wsdlExtensionPorts.put(getPortKey(newPort), newPort);
}
}
}
}
use of com.ibm.lsid.LSIDException in project cdmlib by cybertaxonomy.
the class LsidAuthorityServiceImpl method getAuthorityWSDL.
@Override
public ExpiringResponse getAuthorityWSDL() throws LSIDServerException {
LSID lsid = null;
LSIDWSDLWrapper wsdl = lsidWSDLWrapperFactory.getLSIDWSDLWrapper(lsid);
try {
wsdl.setAuthorityLocation(new HTTPLocation("AuthorityServiceHTTP", "HTTPPort", lsidDomain, lsidPort, null));
// lsidWSDLWrapperFactory.setAuthorityLocation(new SOAPLocation("AuthorityServiceSOAP", "SOAPPort", "http://" + lsidDomain + ":" + lsidPort + "/authority/soap/"), wsdl);
return new ExpiringResponse(wsdl.getWSDLSource(), getExpiration());
} catch (LSIDException e) {
throw new LSIDServerException(e, e.getErrorCode(), "LSIDAuthorityServiceImpl Error in getAuthorityWSDL");
} catch (WSDLException e) {
throw new LSIDServerException(e, LSIDServerException.INTERNAL_PROCESSING_ERROR, "LSIDAuthorityServiceImpl Error in getAuthorityWSDL");
}
}
use of com.ibm.lsid.LSIDException in project cdmlib by cybertaxonomy.
the class LsidDataServiceImpl method getDataByRange.
public InputStream getDataByRange(LSID lsid, Integer start, Integer length) throws LSIDServerException {
IIdentifiableDao<?> identfiableDAO = lsidRegistry.lookupDAO(lsid);
if (identfiableDAO == null) {
// we do not have a mapping for lsids with this authority or namespace
throw new LSIDServerException(LSIDException.UNKNOWN_LSID, "Unknown LSID");
}
try {
IIdentifiableEntity i = identfiableDAO.find(lsid);
if (i == null) {
// we have a mapping for lsids with this authority and namespace, but no lsid stored
throw new LSIDServerException(LSIDException.UNKNOWN_LSID, "Unknown LSID");
}
if (i.getData() != null) {
byte[] subset = new byte[length];
System.arraycopy(i.getData(), start, subset, 0, length);
return new ByteArrayInputStream(subset);
} else {
return null;
}
} catch (LSIDException e) {
throw new LSIDServerException(e, e.getErrorCode(), e.getMessage());
}
}
Aggregations