Search in sources :

Example 1 with StorageGenerator

use of org.collectionspace.csp.api.persistence.StorageGenerator in project application by collectionspace.

the class ServicesBaseClass method makeServicesStorage.

protected Storage makeServicesStorage() throws CSPDependencyException {
    CSPManager cspm = getServiceManager();
    ConfigRoot root = cspm.getConfigRoot();
    Spec spec = (Spec) root.getRoot(Spec.SPEC_ROOT);
    assertNotNull(spec);
    // XXX this is spec specific testing that will break when we rename the object in the UI
    Record r_obj = spec.getRecord("collection-object");
    assertNotNull(r_obj);
    assertEquals("collection-object", r_obj.getID());
    assertEquals("cataloging", r_obj.getWebURL());
    StorageGenerator gen = cspm.getStorage("service");
    CSPRequestCredentials creds = gen.createCredentials();
    creds.setCredential(ServicesStorageGenerator.CRED_USERID, spec.getAdminData().getAuthUser());
    creds.setCredential(ServicesStorageGenerator.CRED_PASSWORD, spec.getAdminData().getAuthPass());
    return gen.getStorage(creds, new RequestCache());
}
Also used : ConfigRoot(org.collectionspace.chain.csp.config.ConfigRoot) CSPManager(org.collectionspace.csp.api.container.CSPManager) CSPRequestCache(org.collectionspace.csp.api.core.CSPRequestCache) RequestCache(org.collectionspace.csp.helper.core.RequestCache) Record(org.collectionspace.chain.csp.schema.Record) CSPRequestCredentials(org.collectionspace.csp.api.core.CSPRequestCredentials) Spec(org.collectionspace.chain.csp.schema.Spec) StorageGenerator(org.collectionspace.csp.api.persistence.StorageGenerator)

Aggregations

ConfigRoot (org.collectionspace.chain.csp.config.ConfigRoot)1 Record (org.collectionspace.chain.csp.schema.Record)1 Spec (org.collectionspace.chain.csp.schema.Spec)1 CSPManager (org.collectionspace.csp.api.container.CSPManager)1 CSPRequestCache (org.collectionspace.csp.api.core.CSPRequestCache)1 CSPRequestCredentials (org.collectionspace.csp.api.core.CSPRequestCredentials)1 StorageGenerator (org.collectionspace.csp.api.persistence.StorageGenerator)1 RequestCache (org.collectionspace.csp.helper.core.RequestCache)1