Search in sources :

Example 6 with LSIDServerException

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");
}
Also used : LSIDServerException(com.ibm.lsid.server.LSIDServerException) Test(org.junit.Test)

Example 7 with LSIDServerException

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");
    }
}
Also used : LSID(eu.etaxonomy.cdm.model.common.LSID) LSIDException(com.ibm.lsid.LSIDException) WSDLException(javax.wsdl.WSDLException) LSIDWSDLWrapper(eu.etaxonomy.cdm.api.service.lsid.LSIDWSDLWrapper) LSIDServerException(com.ibm.lsid.server.LSIDServerException) HTTPLocation(com.ibm.lsid.wsdl.HTTPLocation) ExpiringResponse(com.ibm.lsid.ExpiringResponse)

Example 8 with LSIDServerException

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());
    }
}
Also used : LSIDException(com.ibm.lsid.LSIDException) ByteArrayInputStream(java.io.ByteArrayInputStream) LSIDServerException(com.ibm.lsid.server.LSIDServerException) IIdentifiableEntity(eu.etaxonomy.cdm.model.common.IIdentifiableEntity)

Aggregations

LSIDServerException (com.ibm.lsid.server.LSIDServerException)8 Test (org.junit.Test)5 LSIDException (com.ibm.lsid.LSIDException)2 IIdentifiableEntity (eu.etaxonomy.cdm.model.common.IIdentifiableEntity)2 ExpiringResponse (com.ibm.lsid.ExpiringResponse)1 HTTPLocation (com.ibm.lsid.wsdl.HTTPLocation)1 LSIDWSDLWrapper (eu.etaxonomy.cdm.api.service.lsid.LSIDWSDLWrapper)1 LSID (eu.etaxonomy.cdm.model.common.LSID)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 StringTokenizer (java.util.StringTokenizer)1 Vector (java.util.Vector)1 WSDLException (javax.wsdl.WSDLException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1