use of org.collectionspace.chain.csp.persistence.services.connection.ServicesConnection in project application by collectionspace.
the class ServicesStorageGenerator method real_init.
private void real_init(CSPManager cspManager, Spec spec, boolean forXsdGeneration) throws CSPDependencyException {
try {
ServicesConnection conn = new ServicesConnection(base_url, ims_url);
for (Record r : spec.getAllRecords()) {
if (r.isType("blob") || r.isType("report") || r.isType("batch"))
addChild(r.getID(), new BlobStorage(spec.getRecord(r.getID()), conn));
else if (r.isType("userdata"))
addChild(r.getID(), new UserStorage(spec.getRecord(r.getID()), conn));
else if (r.isType("record") || r.isType("searchall"))
addChild(r.getID(), new RecordStorage(spec.getRecord(r.getID()), conn));
else if (r.isType("authority"))
addChild(r.getID(), new ConfiguredVocabStorage(spec.getRecord(r.getID()), conn));
else if (r.isType("authorizationdata"))
addChild(r.getID(), new AuthorizationStorage(spec.getRecord(r.getID()), conn));
}
addChild("direct", new DirectRedirector(spec));
addChild("id", new ServicesIDGenerator(conn, spec));
addChild("relations", new ServicesRelationStorage(conn, spec));
//
if (forXsdGeneration == false) {
initializeAuthorities(cspManager, spec);
}
} catch (Exception e) {
e.printStackTrace();
// XXX wrong type
throw new CSPDependencyException("Could not set target", e);
}
}
use of org.collectionspace.chain.csp.persistence.services.connection.ServicesConnection in project application by collectionspace.
the class ServicesBaseClass method setup.
protected void setup() throws ConnectionException {
Spec spec = null;
String ims_base = "";
try {
base = getBaseUrl();
ims_base = getIMSBaseUrl();
spec = getDefaultSpec();
} catch (CSPDependencyException e) {
assertNotNull("Base service url invalid in config file", base);
}
// XXX still yuck but centralised now
log.info("ServicesBaseClass setting up connection using base URL:" + base);
conn = new ServicesConnection(base, ims_base);
creds = new ServicesRequestCredentials();
creds.setCredential(ServicesStorageGenerator.CRED_USERID, spec.getAdminData().getAuthUser());
creds.setCredential(ServicesStorageGenerator.CRED_PASSWORD, spec.getAdminData().getAuthPass());
ReturnedDocument out = conn.getXMLDocument(RequestMethod.GET, "accounts/0/accountperms", null, creds, cache);
Assume.assumeTrue(out.getStatus() == 200);
}
Aggregations