use of com.ibm.lsid.server.LSIDServerException in project cdmlib by cybertaxonomy.
the class MetadataControllerTest method testGetMetadataWithUnknownLSID.
@Test(expected = LSIDServerException.class)
public void testGetMetadataWithUnknownLSID() throws Exception {
LSIDServerException lse = new LSIDServerException(LSIDException.UNKNOWN_LSID, "Unknown LSID");
EasyMock.expect(metadataService.getMetadata(LSIDMatchers.eqLSID(lsid))).andThrow(lse);
EasyMock.replay(metadataService);
metadataController.getMetadata(lsid, "application/xml+rdf");
}
use of com.ibm.lsid.server.LSIDServerException 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.server.LSIDServerException 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