log.debug("location is: " + location);
if (sdr.getLocation().contains("?nested=")) {
Workspace workspace = new Workspace();
workspace.setTitle("Nested service document workspace");
Collection collection = new Collection();
collection.setTitle("Nested collection: " + sdr.getLocation().substring(sdr.getLocation().indexOf('?') + 1));
collection.setLocation(location + "/deposit/nested");
collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
collection.addAccepts("application/zip");
collection.addAccepts("application/xml");
collection.setAbstract("A nested collection that users can deposit into");
collection.setTreatment("This is a dummy server");
collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
workspace.addCollection(collection);
service.addWorkspace(workspace);
} else {
Workspace workspace = new Workspace();
workspace.setTitle("Anonymous submitters workspace");
Collection collection = new Collection();
collection.setTitle("Anonymous submitters collection");
collection.setLocation(location + "/deposit/anon");
collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
collection.addAccepts("application/zip");
collection.addAccepts("application/xml");
collection.setAbstract("A collection that anonymous users can deposit into");
collection.setTreatment("This is a dummy server");
collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
collection.setService(location + "/client/servicedocument?nested=anon");
workspace.addCollection(collection);
collection = new Collection();
collection.setTitle("Anonymous submitters other collection");
collection.setLocation(location + "/deposit/anonymous");
collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
collection.addAccepts("application/zip");
collection.addAccepts("application/xml");
collection.setAbstract("Another collection that anonymous users can deposit into");
collection.setTreatment("This is a dummy server");
collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
workspace.addCollection(collection);
service.addWorkspace(workspace);
if (sdr.getUsername() != null) {
workspace = new Workspace();
workspace.setTitle("Authenticated workspace for " + username);
collection = new Collection();
collection.setTitle("Authenticated collection for " + username);
collection.setLocation(location + "/deposit/" + username);
collection.addAccepts("application/zip");
collection.addAccepts("application/xml");
collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.8f);
collection.setAbstract("A collection that " + username + " can deposit into");
collection.setTreatment("This is a dummy server");
collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
collection.setService(location + "/client/servicedocument?nested=authenticated");
workspace.addCollection(collection);
collection = new Collection();
collection.setTitle("Second authenticated collection for " + username);
collection.setLocation(location + "/deposit/" + username + "-2");
collection.addAccepts("application/zip");
collection.addAccepts("application/xml");
collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.123f);
collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
collection.setAbstract("A collection that " + username + " can deposit into");
collection.setTreatment("This is a dummy server");
collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
workspace.addCollection(collection);
}
service.addWorkspace(workspace);
}
String onBehalfOf = sdr.getOnBehalfOf();
if ((onBehalfOf != null) && (!onBehalfOf.equals(""))) {
Workspace workspace = new Workspace();
workspace.setTitle("Personal workspace for " + onBehalfOf);
Collection collection = new Collection();
collection.setTitle("Personal collection for " + onBehalfOf);
collection.setLocation(location + "/deposit?user=" + onBehalfOf);
collection.addAccepts("application/zip");
collection.addAccepts("application/xml");
collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.8f);
collection.setAbstract("An abstract goes in here");
collection.setCollectionPolicy("A collection policy");
collection.setMediation(true);
collection.setTreatment("treatment in here too");
workspace.addCollection(collection);
service.addWorkspace(workspace);
}
return document;