From 66405e375010e324e568fbc34bc907de43027cbd Mon Sep 17 00:00:00 2001 From: remillet Date: Mon, 5 Feb 2018 17:49:54 -0800 Subject: [PATCH] NOJIRA: Added first draft of /systeminfo endpoint. Fixed issue adding perms from a permlist to an empty role with PUT to role resource. --- .../IntegrationTests/xmlreplay/XmlReplay.java | 1 - .../resources/test-data/xmlreplay/dev-all.xml | 4 +- .../xmlreplay/security/6-account-elmo.xml | 6 +- .../createSimpleRole-30.xml | 5 + .../responses/getSimpleRole-30.res.xml | 17 + .../updateSimpleRole-30.xml | 15 + .../get1-loansin-CRUDL.res.xml | 0 .../{ => security}/security-oauth.xml | 0 .../xmlreplay/{ => security}/security.xml | 182 +++--- .../security/simple-role-template.xml | 15 + .../test-data/xmlreplay/xml-replay-master.xml | 8 +- services/JaxRsServiceProvider/pom.xml | 7 +- .../jaxrs/CSpaceResteasyBootstrap.java | 8 +- .../CollectionSpaceJaxRsApplication.java | 2 + .../src/main/resources/log4j.properties | 3 + .../WEB-INF/applicationContext-security.xml | 3 + .../src/main/resources/accounts_common.xsd | 118 +--- .../main/resources/accounts_common_list.xsd | 118 ++++ .../jaxb/src/main/resources/bindings.xml | 17 + .../storage/RoleDocumentHandler.java | 9 +- .../jaxb/src/main/resources/roles.xsd | 10 +- services/claim/service/pom.xml | 10 +- services/claim/service/profiles.xml | 4 - services/client/pom.xml | 4 - services/collectionobject/pom.xml | 9 - services/collectionobject/sample/pom.xml | 14 - .../collectionobject/sample/sample/pom.xml | 101 --- .../client/sample/Sample.java | 381 ----------- .../collectionspace-client.properties | 6 - services/common/pom.xml | 5 + .../tenants/tenant-bindings-proto-unified.xml | 11 +- .../common/security/SecurityInterceptor.java | 15 +- .../java/RemoteDocumentModelHandlerImpl.java | 2 +- services/exhibition/service/pom.xml | 5 +- services/exhibition/service/profiles.xml | 4 - services/organization/pom.xml | 20 - services/organization/sample/pom.xml | 14 - services/organization/sample/sample/pom.xml | 112 ---- .../organization/client/sample/Sample.java | 510 --------------- .../collectionspace-client.properties | 6 - .../sample/src/main/resources/log4j.xml | 38 -- services/person/pom.xml | 11 +- services/person/sample/pom.xml | 14 - services/person/sample/sample/pom.xml | 111 ---- .../services/person/client/sample/Sample.java | 593 ------------------ .../collectionspace-client.properties | 6 - .../sample/src/main/resources/log4j.xml | 38 -- services/pom.xml | 2 +- services/pottag/service/pom.xml | 7 +- services/pottag/service/profiles.xml | 4 - services/propagation/service/profiles.xml | 4 - services/sdk/pom.xml | 33 - services/sdk/sample/pom.xml | 60 -- .../services/sdk/sample/Sample.java | 229 ------- .../collectionspace-client.properties | 6 - services/systeminfo/client/pom.xml | 73 +++ .../services/systeminfo/SystemInfoClient.java | 13 + .../src/test/resources/log4j.properties | 23 + services/systeminfo/jaxb/pom.xml | 34 + .../src/main/resources/systeminfo-common.xsd | 56 ++ services/systeminfo/pom.xml | 20 + services/systeminfo/service/pom.xml | 79 +++ .../systeminfo/SystemInfoDocumentHandler.java | 130 ++++ .../systeminfo/SystemInfoResource.java | 101 +++ .../service/src/test}/resources/log4j.xml | 21 +- services/vocabulary/pom.xml | 20 - services/vocabulary/sample/pom.xml | 14 - services/vocabulary/sample/sample/pom.xml | 134 ---- .../vocabulary/client/sample/Sample.java | 469 -------------- .../collectionspace-client.properties | 6 - .../sample/src/main/resources/log4j.xml | 38 -- 71 files changed, 901 insertions(+), 3267 deletions(-) create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/createSimpleRole-30.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/responses/getSimpleRole-30.res.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/updateSimpleRole-30.xml rename services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/{res => responses}/get1-loansin-CRUDL.res.xml (100%) rename services/IntegrationTests/src/test/resources/test-data/xmlreplay/{ => security}/security-oauth.xml (100%) rename services/IntegrationTests/src/test/resources/test-data/xmlreplay/{ => security}/security.xml (82%) create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/simple-role-template.xml create mode 100644 services/account/jaxb/src/main/resources/accounts_common_list.xsd create mode 100644 services/account/jaxb/src/main/resources/bindings.xml delete mode 100644 services/claim/service/profiles.xml delete mode 100644 services/collectionobject/sample/pom.xml delete mode 100644 services/collectionobject/sample/sample/pom.xml delete mode 100644 services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java delete mode 100644 services/collectionobject/sample/sample/src/main/resources/collectionspace-client.properties delete mode 100644 services/exhibition/service/profiles.xml delete mode 100644 services/organization/sample/pom.xml delete mode 100644 services/organization/sample/sample/pom.xml delete mode 100644 services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java delete mode 100644 services/organization/sample/sample/src/main/resources/collectionspace-client.properties delete mode 100644 services/organization/sample/sample/src/main/resources/log4j.xml delete mode 100644 services/person/sample/pom.xml delete mode 100644 services/person/sample/sample/pom.xml delete mode 100644 services/person/sample/sample/src/main/java/org/collectionspace/services/person/client/sample/Sample.java delete mode 100644 services/person/sample/sample/src/main/resources/collectionspace-client.properties delete mode 100644 services/person/sample/sample/src/main/resources/log4j.xml delete mode 100644 services/pottag/service/profiles.xml delete mode 100644 services/propagation/service/profiles.xml delete mode 100644 services/sdk/pom.xml delete mode 100644 services/sdk/sample/pom.xml delete mode 100644 services/sdk/sample/src/main/java/org/collectionspace/services/sdk/sample/Sample.java delete mode 100644 services/sdk/sample/src/main/resources/collectionspace-client.properties create mode 100644 services/systeminfo/client/pom.xml create mode 100644 services/systeminfo/client/src/main/java/org/collectionspace/services/systeminfo/SystemInfoClient.java create mode 100644 services/systeminfo/client/src/test/resources/log4j.properties create mode 100644 services/systeminfo/jaxb/pom.xml create mode 100644 services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd create mode 100644 services/systeminfo/pom.xml create mode 100644 services/systeminfo/service/pom.xml create mode 100644 services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoDocumentHandler.java create mode 100644 services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoResource.java rename services/{collectionobject/sample/sample/src/main => systeminfo/service/src/test}/resources/log4j.xml (62%) delete mode 100644 services/vocabulary/sample/pom.xml delete mode 100644 services/vocabulary/sample/sample/pom.xml delete mode 100644 services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java delete mode 100644 services/vocabulary/sample/sample/src/main/resources/collectionspace-client.properties delete mode 100644 services/vocabulary/sample/sample/src/main/resources/log4j.xml diff --git a/services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplay.java b/services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplay.java index 82df0f659..f0b53143a 100644 --- a/services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplay.java +++ b/services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplay.java @@ -3,7 +3,6 @@ package org.collectionspace.services.IntegrationTests.xmlreplay; import org.apache.commons.cli.*; import org.apache.commons.io.FileUtils; -import org.apache.commons.jexl2.JexlContext; import org.apache.commons.jexl2.JexlEngine; import org.collectionspace.services.common.api.Tools; import org.dom4j.*; diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/dev-all.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/dev-all.xml index 601562f79..6ee68ae02 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/dev-all.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/dev-all.xml @@ -61,7 +61,7 @@ --> @@ -69,7 +69,7 @@ - + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/6-account-elmo.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/6-account-elmo.xml index 80180083a..57a380645 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/6-account-elmo.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/6-account-elmo.xml @@ -5,12 +5,12 @@ elmo2018@DeleteBug.accountelemo.org 1234567890 elmo2018 - - Z3JvdmVyMjAxOA== + + ZWxtbzIwMTg= 1 - ${permElmo.CSID} + ${simpleRoleId} diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/createSimpleRole-30.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/createSimpleRole-30.xml new file mode 100644 index 000000000..0a5cbf09a --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/createSimpleRole-30.xml @@ -0,0 +1,5 @@ + + + xROLE_ADDTOEMPTYROLE + Role for CreateEmptyRoleAddPerms-simpleRole-30 create test. + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/responses/getSimpleRole-30.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/responses/getSimpleRole-30.res.xml new file mode 100644 index 000000000..74f0deecb --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/responses/getSimpleRole-30.res.xml @@ -0,0 +1,17 @@ + + + xROLE_ADDTOEMPTYROLE + ROLE_1_XROLE_ADDTOEMPTYROLE + role for xROLE_ADDTOEMPTYROLE + 1 + + 1-groups-RL + groups + RL + + + 1-vocabularies-RL + vocabularies + RL + + \ No newline at end of file diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/updateSimpleRole-30.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/updateSimpleRole-30.xml new file mode 100644 index 000000000..4b3f9a656 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/CreateEmptyRoleAddPerms/updateSimpleRole-30.xml @@ -0,0 +1,15 @@ + + + xROLE_ADDTOEMPTYROLE + role for xROLE_ADDTOEMPTYROLE + + 1-vocabularies-RL + vocabularies + RL + + + 1-groups-RL + groups + RL + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/res/get1-loansin-CRUDL.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/responses/get1-loansin-CRUDL.res.xml similarity index 100% rename from services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/res/get1-loansin-CRUDL.res.xml rename to services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/responses/get1-loansin-CRUDL.res.xml diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security-oauth.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/security-oauth.xml similarity index 100% rename from services/IntegrationTests/src/test/resources/test-data/xmlreplay/security-oauth.xml rename to services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/security-oauth.xml diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/security.xml similarity index 82% rename from services/IntegrationTests/src/test/resources/test-data/xmlreplay/security.xml rename to services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/security.xml index 66014a9dd..3a7811cfe 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/security.xml @@ -13,10 +13,35 @@ dXNlcjFAbXVzZXVtMS5vcmc6dXNlcjFAbXVzZXVtMS5vcmc= YmlnYmlyZDIwMTA6YmlnYmlyZDIwMTA= ZWxtbzIwMTA6ZWxtbzIwMTA= + ZWxtbzIwMTg6ZWxtbzIwMTg= Z3JvdmVyOmdyb3ZlcjIwMTg= - - + + + + + + POST + /cspace-services/authorization/roles + security/CreateEmptyRoleAddPerms/createSimpleRole-30.xml + + + PUT + /cspace-services/authorization/roles/${simpleRole_30.CSID} + security/CreateEmptyRoleAddPerms/updateSimpleRole-30.xml + + + GET + /cspace-services/authorization/roles/${simpleRole_30.CSID}?showPerms=true + + + ${simpleRole_30.CSID} + + security/CreateEmptyRoleAddPerms/responses/getSimpleRole-30.res.xml + + + + POST @@ -35,14 +60,14 @@ POST /cspace-services/authorization/roles security/BasicRoles/createSimpleRole-2.xml - + POST /cspace-services/accounts security/BasicRoles/createSimpleAccount-2.xml - + POST @@ -76,14 +101,14 @@ security/SlipOut/slipOutVocab-2.xml - + GET /cspace-services/authorization/permissions/1-loansin-CRUDL - - security/res/get1-loansin-CRUDL.res.xml + + security/responses/get1-loansin-CRUDL.res.xml @@ -92,9 +117,8 @@ /cspace-services/authorization/permissions/1-loansin-CRUDL/permroles - - + POST /cspace-services/authorization/permissions @@ -106,18 +130,25 @@ /cspace-services/authorization/permissions/${permElmo.CSID}/permroles security/14-permissionroles-bogus.xml + + POST + /cspace-services/authorization/roles + security/simple-role-template.xml + POST /cspace-services/accounts security/6-account-elmo.xml + + ${simpleRole.CSID} + - - + POST /cspace-services/dimensions/ dimension/1.xml - + 403 DELETE dimension1 @@ -136,12 +167,12 @@ accountElmo - - - + + + - + 401,500,501 POST /cspace-services/dimensions/ @@ -180,11 +211,19 @@ /cspace-services/accounts security/5-account-bigbird.xml + + POST + /cspace-services/authorization/roles + security/simple-role-template.xml + POST /cspace-services/accounts security/6-account-elmo.xml - + + ${simpleRole.CSID} + + POST /cspace-services/accounts/${accountBigbird.CSID}/accountroles @@ -206,7 +245,7 @@ security/10-permissionroles-elmo.xml - + POST /cspace-services/dimensions/ dimension/1.xml @@ -221,7 +260,7 @@ /cspace-services/dimensions/ dimension1 - + 403 POST /cspace-services/dimensions/ @@ -233,12 +272,12 @@ /cspace-services/dimensions/${dimension1.CSID} dimension/2-put.xml - + GET /cspace-services/dimensions/ dimension1 - + 403 DELETE dimension1 @@ -247,31 +286,17 @@ DELETE dimension1 - - - - DELETE /cspace-services/authorization/permissions/${permBigbird.CSID}/permroles - DELETE /cspace-services/authorization/permissions/${permElmo.CSID}/permroles - - - Removing all permissions from Bigbird's role - 403,404 + + + 403 POST /cspace-services/dimensions/ dimension/1.xml @@ -283,7 +308,6 @@ dimension/2-put.xml - DELETE /cspace-services/accounts/${accountBigbird.CSID}/accountroles @@ -310,19 +334,14 @@ DELETE accountElmo - - - - - - - - - + + + + - + 401,403,500,501 POST /cspace-services/dimensions/ @@ -335,7 +354,7 @@ /cspace-services/authorization/permissions security/1-bigbird-permission.xml - + POST /cspace-services/authorization/roles security/3-role-test-cm.xml @@ -358,20 +377,20 @@ - - + + POST /cspace-services/dimensions/ - dimension/1.xml + dimension/1.xml PUT /cspace-services/dimensions/${dimensionBigbird_POST.CSID} - dimension/2-put.xml + dimension/2-put.xml - + GET /cspace-services/dimensions/ dimensionBigbird_POST @@ -380,29 +399,30 @@ DELETE dimensionBigbird_POST - + - + Deleting permroles from bigbird2010 DELETE /cspace-services/authorization/permissions/${permBigbird.CSID}/permroles - + - - + + Trying to POST after permroles removed from Bigbird 403,404 POST /cspace-services/dimensions/ - dimension/1.xml + dimension/1.xml - 403,404,405 + 403,404,405 + PUT /cspace-services/dimensions/${dimensionBigbird_POST_AfterPermrolesDeleted.CSID} - dimension/2-put.xml + dimension/2-put.xml 403,404 @@ -428,18 +448,18 @@ /cspace-services/authorization/permissions/${permBigbird_CRU.CSID}/permroles security/11-permissionroles-bigbird-CRU.xml - + - + POST /cspace-services/dimensions/ - dimension/1.xml + dimension/1.xml PUT /cspace-services/dimensions/${dimensionBigbird_POST_CRU.CSID} - dimension/2-put.xml + dimension/2-put.xml GET @@ -453,13 +473,13 @@ - + Deleting permroles from bigbird2010 DELETE /cspace-services/authorization/permissions/${permBigbird_CRU.CSID}/permroles - + @@ -474,18 +494,18 @@ - - + + 403,404 POST /cspace-services/dimensions/ - dimension/1.xml + dimension/1.xml 403,404,405 PUT /cspace-services/dimensions/${dimensionBigbird_POST_R.CSID} - dimension/2-put.xml + dimension/2-put.xml GET @@ -493,25 +513,25 @@ dimensionBigbird_POST_R - + 0,403,404 DELETE dimensionBigbird_POST_R - + - + Deleting permroles already deleted in test ID="deletePermrolesBigbird" 404 DELETE /cspace-services/authorization/permissions/${permBigbird.CSID}/permroles - + DELETE /cspace-services/accounts/${accountBigbird.CSID}/accountroles - + DELETE roleTestCM @@ -519,15 +539,13 @@ DELETE accountBigbird - + - - - diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/simple-role-template.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/simple-role-template.xml new file mode 100644 index 000000000..83c47dbc2 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security/simple-role-template.xml @@ -0,0 +1,15 @@ + + + ${Test.ID} + role for ${Test.ID} + + 1-vocabularies-RL + vocabularies + RL + + + 1-groups-RL + groups + RL + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml index 92e45c48f..a7eda68bd 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml @@ -16,8 +16,8 @@ YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= - - + + @@ -87,14 +87,14 @@ - + - + diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index 898791f52..7275eb60d 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -294,7 +294,12 @@ org.collectionspace.services.structureddate.service ${project.version} - + + org.collectionspace.services + org.collectionspace.services.systeminfo.service + ${project.version} + + org.collectionspace.services org.collectionspace.services.media.service ${project.version} diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java index 8147eefec..09873f6c8 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java @@ -83,6 +83,8 @@ public class CSpaceResteasyBootstrap extends ResteasyBootstrap { for (TenantBindingType tenantBindings : tenantBindingsTable.values()) { CSpaceTenant tenant = new CSpaceTenant(tenantBindings.getId(), tenantBindings.getName()); if (shouldInitializeAuthorities(tenant, reset) == true) { + logger.log(Level.INFO, String.format("Initializing vocabularies and authorities of tenant '%s'.", + tenant.getId())); for (ServiceBindingType serviceBinding : tenantBindings.getServiceBindings()) { AuthorityInstanceList element = serviceBinding.getAuthorityInstanceList(); if (element != null && element.getAuthorityInstance() != null) { @@ -181,7 +183,7 @@ public class CSpaceResteasyBootstrap extends ResteasyBootstrap { logger.log(Level.FINE, String.format("Authority of type '%s' with the short ID of '%s' existed already.", serviceName, authorityInstance.getTitleRef())); } else if (status == Response.Status.CREATED.getStatusCode()) { - logger.log(Level.INFO, String.format("Created a new authority of type '%s' with the short ID of '%s'.", + logger.log(Level.FINE, String.format("Created a new authority of type '%s' with the short ID of '%s'.", serviceName, authorityInstance.getTitleRef())); } else { logger.log(Level.WARNING, String.format("Unknown status '%d' encountered when creating or fetching authority of type '%s' with the short ID of '%s'.", @@ -233,8 +235,8 @@ public class CSpaceResteasyBootstrap extends ResteasyBootstrap { String xmlPayload = client.createAuthorityItemInstance(termShortId, termDisplayName); try { authorityResource.createAuthorityItem(resourceMap, null, authoritySpecifier, xmlPayload); - logger.log(Level.FINE, String.format("Created a new term '%s:%s' in the authority of type '%s' with the short ID of '%s'.", - termDisplayName, termShortId, serviceName, authorityInstance.getTitleRef())); + logger.log(Level.FINE, String.format("Tenant:%s:Created a new term '%s:%s' in the authority of type '%s' with the short ID of '%s'.", + tenant.getName(), termDisplayName, termShortId, serviceName, authorityInstance.getTitleRef())); } catch (CSWebApplicationException e) { response = e.getResponse(); status = response.getStatus(); diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index 5523e8a11..8409726be 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -50,6 +50,7 @@ import org.collectionspace.services.acquisition.AcquisitionResource; import org.collectionspace.services.dimension.DimensionResource; import org.collectionspace.services.servicegroup.ServiceGroupResource; import org.collectionspace.services.structureddate.StructuredDateResource; +import org.collectionspace.services.systeminfo.SystemInfoResource; import org.collectionspace.services.contact.ContactResource; import org.collectionspace.services.vocabulary.VocabularyResource; import org.collectionspace.services.organization.OrgAuthorityResource; @@ -108,6 +109,7 @@ public class CollectionSpaceJaxRsApplication extends Application singletons.add(new ServiceGroupResource()); singletons.add(new ImportsResource()); singletons.add(new StructuredDateResource()); + singletons.add(new SystemInfoResource()); addResourceToMapAndSingletons(new VocabularyResource()); addResourceToMapAndSingletons(new PersonAuthorityResource()); diff --git a/services/JaxRsServiceProvider/src/main/resources/log4j.properties b/services/JaxRsServiceProvider/src/main/resources/log4j.properties index 0db6cc9a1..0dbb72869 100644 --- a/services/JaxRsServiceProvider/src/main/resources/log4j.properties +++ b/services/JaxRsServiceProvider/src/main/resources/log4j.properties @@ -53,6 +53,9 @@ log4j.additivity.perf.collectionspace=false # CollectionSpace loggers and default levels - all loggers using the rootLogger if not otherwise specified # log4j.logger.org.collectionspace=DEBUG +log4j.logger.org.collectionspace.services.authorization.spring.SpringPermissionManager=ERROR +log4j.logger.org.collectionspace.services.listener.AbstractUpdateObjectLocationValues=INFO +log4j.logger.org.collectionspace.services.common.context.AbstractServiceContextImpl=ERROR log4j.logger.org.collectionspace.services.common.ServiceMain=INFO log4j.logger.org.collectionspace.authentication.realm.db.CSpaceDbRealm=ERROR log4j.logger.org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper=ERROR diff --git a/services/JaxRsServiceProvider/src/main/webapp/WEB-INF/applicationContext-security.xml b/services/JaxRsServiceProvider/src/main/webapp/WEB-INF/applicationContext-security.xml index 5d7733340..04621a94d 100644 --- a/services/JaxRsServiceProvider/src/main/webapp/WEB-INF/applicationContext-security.xml +++ b/services/JaxRsServiceProvider/src/main/webapp/WEB-INF/applicationContext-security.xml @@ -63,6 +63,9 @@ + + + diff --git a/services/account/jaxb/src/main/resources/accounts_common.xsd b/services/account/jaxb/src/main/resources/accounts_common.xsd index 0fab3f390..194ffacdf 100644 --- a/services/account/jaxb/src/main/resources/accounts_common.xsd +++ b/services/account/jaxb/src/main/resources/accounts_common.xsd @@ -1,33 +1,22 @@ - - - + --> @@ -186,7 +175,7 @@ - + @@ -217,66 +206,6 @@ - - - - - - - - - - - - - - - AccountsCommonList contains information about one or more - accounts. An instance of this type could be returned on - index and search operations. - - - - - - - - - - - - - - - - - - - - - - - tenant association is usually not required to be provided by the - service consumer. only in cases where a user in CollectionSpace - has access to the spaces of multiple tenants, this is used - to associate that user with more than one tenants - - - - - - - - - - - - - - - - - @@ -395,42 +324,5 @@ - - - - - - TenantsList contains information about one or more - tenants. An instance of this type could be returned on - index and search operations. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/account/jaxb/src/main/resources/accounts_common_list.xsd b/services/account/jaxb/src/main/resources/accounts_common_list.xsd new file mode 100644 index 000000000..30fdbbef4 --- /dev/null +++ b/services/account/jaxb/src/main/resources/accounts_common_list.xsd @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + AccountsCommonList contains information about one or more + accounts. An instance of this type could be returned on + index and search operations. + + + + + + + + + + + + + + + + + + + + + + + tenant association is usually not required to be provided by the + service consumer. only in cases where a user in CollectionSpace + has access to the spaces of multiple tenants, this is used + to associate that user with more than one tenants + + + + + + + + + + + + + + + + + + + + + + + TenantsList contains information about one or more + tenants. An instance of this type could be returned on + index and search operations. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/account/jaxb/src/main/resources/bindings.xml b/services/account/jaxb/src/main/resources/bindings.xml new file mode 100644 index 000000000..72e1e094b --- /dev/null +++ b/services/account/jaxb/src/main/resources/bindings.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java index 8e436a4fd..0d7ee53b8 100644 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java +++ b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java @@ -42,6 +42,7 @@ import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.BadRequestException; import org.collectionspace.services.common.document.DocumentFilter; +import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.DocumentWrapper; import org.collectionspace.services.common.document.JaxbUtils; import org.collectionspace.services.common.security.SecurityUtils; @@ -105,9 +106,13 @@ public class RoleDocumentHandler PermissionRoleSubResource subResource = new PermissionRoleSubResource(PermissionRoleSubResource.ROLE_PERMROLE_SERVICE); // - // First, delete the existing permroles + // First, delete the existing permroles (if any) // - subResource.deletePermissionRole(ctx, roleFound.getCsid(), SubjectType.PERMISSION); + try { + subResource.deletePermissionRole(ctx, roleFound.getCsid(), SubjectType.PERMISSION); + } catch (DocumentNotFoundException dnf) { + // Catch and ignore. Just means the role has no existing relationships + } // // Next, create the new permroles // diff --git a/services/authorization/jaxb/src/main/resources/roles.xsd b/services/authorization/jaxb/src/main/resources/roles.xsd index ddeffd3d3..ee8cc7caf 100644 --- a/services/authorization/jaxb/src/main/resources/roles.xsd +++ b/services/authorization/jaxb/src/main/resources/roles.xsd @@ -2,7 +2,7 @@ - - diff --git a/services/claim/service/pom.xml b/services/claim/service/pom.xml index 8c29f1c77..4cff0662f 100644 --- a/services/claim/service/pom.xml +++ b/services/claim/service/pom.xml @@ -8,7 +8,6 @@ 4.0.0 - org.collectionspace.services org.collectionspace.services.claim.service services.claim.service jar @@ -17,8 +16,7 @@ org.collectionspace.services org.collectionspace.services.common - ${project.version} - + org.collectionspace.services org.collectionspace.services.claim.jaxb @@ -38,14 +36,12 @@ junit junit - 4.1 test org.testng testng - 5.6 - + @@ -59,7 +55,6 @@ dom4j dom4j - 1.6.1 provided @@ -89,7 +84,6 @@ org.nuxeo.ecm.core nuxeo-core-api - ${nuxeo.core.version} jboss-remoting diff --git a/services/claim/service/profiles.xml b/services/claim/service/profiles.xml deleted file mode 100644 index 347b9df22..000000000 --- a/services/claim/service/profiles.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/services/client/pom.xml b/services/client/pom.xml index 0c720e4e8..b28573f48 100644 --- a/services/client/pom.xml +++ b/services/client/pom.xml @@ -72,10 +72,6 @@ - - org.jboss.resteasy - resteasy-jaxrs - org.jboss.resteasy resteasy-jaxb-provider diff --git a/services/collectionobject/pom.xml b/services/collectionobject/pom.xml index 0fe87a09f..3766f17e9 100644 --- a/services/collectionobject/pom.xml +++ b/services/collectionobject/pom.xml @@ -23,14 +23,5 @@ - - - samples - - sample - - - - diff --git a/services/collectionobject/sample/pom.xml b/services/collectionobject/sample/pom.xml deleted file mode 100644 index 1ad78737e..000000000 --- a/services/collectionobject/sample/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.collectionobject.client.samples - pom - 5.0-SNAPSHOT - collectionobject.client.samples - - - sample - - - diff --git a/services/collectionobject/sample/sample/pom.xml b/services/collectionobject/sample/sample/pom.xml deleted file mode 100644 index 487211d57..000000000 --- a/services/collectionobject/sample/sample/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.collectionobject.client.sample - jar - collectionobject.client.sample - 5.0-SNAPSHOT - - - - - org.slf4j - slf4j-api - 1.5.2 - - - org.slf4j - slf4j-log4j12 - 1.5.2 - - - - org.collectionspace.services - org.collectionspace.services.collectionobject.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.client - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.collectionobject.client - ${project.version} - - - - - - libs-releases-local - libs-releases-local - http://nightly.collectionspace.org:8081/artifactory/libs-release-local - - true - - - false - - - - libs-snapshots-local - libs-snapshots-local - http://nightly.collectionspace.org:8081/artifactory/libs-snapshot-local - - false - - - true - - - - - - collectionobject-client-sample - - - org.apache.maven.plugins - maven-assembly-plugin - - - - attached - - package - - - jar-with-dependencies - - - - org.collectionspace.services.collectionobject.client.sample.Sample - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - - diff --git a/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java b/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java deleted file mode 100644 index 88fe963c1..000000000 --- a/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java +++ /dev/null @@ -1,381 +0,0 @@ -/** - * This document is a part of the source code and related artifacts - * for CollectionSpace, an open source collections management system - * for museums and related institutions: - * - * http://www.collectionspace.org - * http://wiki.collectionspace.org - * - * Copyright © 2009 Regents of the University of California - * - * Licensed under the Educational Community License (ECL), Version 2.0. - * You may not use this file except in compliance with this License. - * - * You may obtain a copy of the ECL 2.0 License at - * https://source.collectionspace.org/collection-space/LICENSE.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.collectionspace.services.collectionobject.client.sample; - -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; - -import org.collectionspace.services.client.CollectionObjectClient; -import org.collectionspace.services.client.PayloadInputPart; -import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PoxPayloadIn; -import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.collectionobject.CollectionobjectsCommon; -import org.collectionspace.services.collectionobject.CollectionobjectsCommonList; -import org.collectionspace.services.collectionobject.ResponsibleDepartmentList; -import org.collectionspace.services.collectionobject.domain.naturalhistory.CollectionobjectsNaturalhistory; - -import org.jboss.resteasy.client.ClientResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Sample, sample client code for creating and accessing - * CollectionObject records. - * - * $LastChangedRevision: $ - * $LastChangedDate: $ - */ -public class Sample { - - private static final Logger logger = - LoggerFactory.getLogger(Sample.class); - - // Instance variables specific to this test. - private CollectionObjectClient client = new CollectionObjectClient(); - final String SERVICE_PATH_COMPONENT = "collectionobjects"; - - - // --------------------------------------------------------------- - // Create - // --------------------------------------------------------------- - - public String createCollectionObject() { - - // Create a CollectionObject record to submit to the service. - PoxPayloadOut multipart = createCollectionObjectInstance(); - - // Submit a 'create' request to the service, sending the new - // CollectionObject record to be created, and store the response. - ClientResponse res = client.create(multipart); - - // Get the status code from the response and check it against - // the expected status code. - if (res.getStatus() != Response.Status.CREATED.getStatusCode()) { - logger.error("Error creating new CollectionObject. Status code = " + - res.getStatus()); - return ""; - } else { - logger.info("CollectionObject created successfully."); - } - - // Return the new record number for the newly-created record. - return extractId(res); - - } - - // --------------------------------------------------------------- - // Read - // --------------------------------------------------------------- - - public PoxPayloadIn readCollectionObject(String resourceId) throws Exception { - - if (resourceId == null || resourceId.trim().isEmpty()) { - throw new IllegalArgumentException( - "Resource ID must not be null or empty."); - } - - // Submit the read ("get") request to the service and store the response. - // The resourceId is a unique identifier for the CollectionObject - // record we're reading. - ClientResponse res = client.read(resourceId); - - // Get the status code from the response and check it against - // the expected status code. - if (res.getStatus() != Response.Status.OK.getStatusCode()) { - logger.error("Error reading CollectionObject with" + - "resource ID " + resourceId + ". Status code = " + - res.getStatus()); - return null; - } - - // Get the entity body of the response from the service. - PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); - - return input; - - } - - private CollectionobjectsCommonList readCollectionObjectList() - throws Exception { - - // Submit the read list request to the service and store the response. - ClientResponse res = client.readList(); - - // Get the status code from the response and check it against - // the expected status code. - if (res.getStatus() != Response.Status.OK.getStatusCode()) { - logger.error("Error reading list of CollectionObjects. Status code = " + - res.getStatus()); - return null; - } - - CollectionobjectsCommonList list = res.getEntity(); - return list; - - - } - - // --------------------------------------------------------------- - // Delete - // --------------------------------------------------------------- - - private void deleteCollectionObject(String resourceId) { - - if (resourceId == null || resourceId.trim().isEmpty()) { - throw new IllegalArgumentException( - "Resource ID must not be null or empty."); - } - - ClientResponse res = client.delete(resourceId); - - // Get the status code from the response and check it against - // the expected status code. - if (res.getStatus() != Response.Status.OK.getStatusCode()) { - logger.error("Error deleting CollectionObject with" + - "resource ID " + resourceId + ". Status code = " + - res.getStatus()); - return; - } - - } - - private void deleteAllCollectionObjects() throws Exception { - - int recordsDeleted = 0; - for (String resourceId : getAllResourceIds()) { - - ClientResponse res = client.delete(resourceId); - - // Get the status code from the response and check it against - // the expected status code. - if (res.getStatus() != Response.Status.OK.getStatusCode()) { - logger.error("Error deleting CollectionObject with" + - "resource ID " + resourceId + ". Status code = " + - res.getStatus()); - } else { - recordsDeleted++; - } - } - - if (logger.isInfoEnabled()) { - logger.info("Deleted " + recordsDeleted + " CollectionObject record(s)."); - } - - } - - // --------------------------------------------------------------- - // Utility methods - // --------------------------------------------------------------- - - private PoxPayloadOut createCollectionObjectInstance() { - - // Create the Common part of a CollectionObject and add data to its fields. - - CollectionobjectsCommon collectionObject = new CollectionobjectsCommon(); - collectionObject.setObjectNumber("some object number here"); - collectionObject.getObjectNameList().getObjectNameGroup().get(0).setObjectName("some object name here"); - - - ResponsibleDepartmentList deptList = new ResponsibleDepartmentList(); - List depts = deptList.getResponsibleDepartment(); - // @TODO Use properly formatted refNames for representative departments - // in this example test record. The following are mere placeholders. - depts.add("urn:org.collectionspace.services.department:Registrar"); - depts.add("urn:org.walkerart.department:Fine Art"); - collectionObject.setAge(""); // Test using an empty String. - collectionObject.getBriefDescriptions().getBriefDescription().add("Papier mache bird mask with horns, " + - "painted red with black and yellow spots. " + - "Puerto Rico. ca. 8" high, 6" wide, projects 10" (with horns)."); - PoxPayloadOut multipart = new PoxPayloadOut(CollectionObjectClient.SERVICE_PAYLOAD_NAME); - PayloadOutputPart commonPart = multipart.addPart(collectionObject, - MediaType.APPLICATION_XML_TYPE); - commonPart.setLabel(getCommonPartName()); - - if (logger.isInfoEnabled()) { - logger.info("CollectionObject Common part to be created:"); - logger.info(objectAsXmlString(collectionObject, - CollectionobjectsCommon.class)); - } - - // Create a "domain" part of a CollectionObject and add data to its fields. - // This part might come from a community or consortia in a particular domain. - // There could potentially be multiple "domain" parts in a CollectionObject record. - - // This example adds data to fields for a hypothetical Natural History domain, - // as in the case of the test fields below ... - - CollectionobjectsNaturalhistory conh = new CollectionobjectsNaturalhistory(); - conh.setNhString("test-string"); - conh.setNhInt(999); - conh.setNhLong(9999); - - PayloadOutputPart nhPart = multipart.addPart(conh, MediaType.APPLICATION_XML_TYPE); - nhPart.setLabel(getNHPartName()); - - if (logger.isInfoEnabled()) { - logger.info("CollectionObject Natural History part to be created:"); - logger.info(objectAsXmlString(conh, - CollectionobjectsNaturalhistory.class)); - } - - // Return the multipart entity body that will be submitted in the - // 'create' request, above. - return multipart; - } - - static Object extractPart(PoxPayloadIn input, String label, Class clazz) { - Object obj = null; - - PayloadInputPart payloadInputPart = input.getPart(label); - if (payloadInputPart != null) { - obj = payloadInputPart.getBody(); - } - - return obj; - } - - public void displayCollectionObject(PoxPayloadIn input) - throws Exception { - - if (input == null) { - throw new IllegalArgumentException( - "Could not display null CollectionObject record."); - } - - // Extract each part of the record, and convert it from - // its XML representation to its associated Java object. - - // Read the Common part of the record. - CollectionobjectsCommon collectionObject = - (CollectionobjectsCommon) extractPart(input, - client.getCommonPartName(), CollectionobjectsCommon.class); - - if (logger.isInfoEnabled()) { - logger.info("CollectionObject Common part read:"); - logger.info(objectAsXmlString(collectionObject, - CollectionobjectsCommon.class)); - } - - // Read the Natural History part of the record. - CollectionobjectsNaturalhistory conh = - (CollectionobjectsNaturalhistory) extractPart(input, - getNHPartName(), CollectionobjectsNaturalhistory.class); - - if (logger.isInfoEnabled()) { - logger.info("CollectionObject Natural History part read:"); - logger.info(objectAsXmlString(conh, - CollectionobjectsNaturalhistory.class)); - } - - } - - - private String getCommonPartName() { - return client.getCommonPartName(); - } - - private String getNHPartName() { - return "collectionobjects_naturalhistory"; - } - - private List getAllResourceIds() throws Exception { - - CollectionobjectsCommonList list = readCollectionObjectList(); - List resourceIds = new ArrayList(); - List items = - list.getCollectionObjectListItem(); - - for (CollectionobjectsCommonList.CollectionObjectListItem item : items) { - resourceIds.add(item.getCsid()); - } - - return resourceIds; - } - - private String extractId(ClientResponse res) { - MultivaluedMap mvm = res.getMetadata(); - String uri = (String) ((ArrayList) mvm.get("Location")).get(0); - if(logger.isInfoEnabled()){ - logger.info("extractId:uri=" + uri); - } - String[] segments = uri.split("/"); - String id = segments[segments.length - 1]; - if(logger.isInfoEnabled()){ - logger.info("id=" + id); - } - return id; - } - - private String objectAsXmlString(Object o, Class clazz) { - StringWriter sw = new StringWriter(); - try{ - JAXBContext jc = JAXBContext.newInstance(clazz); - Marshaller m = jc.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, - Boolean.TRUE); - m.marshal(o, sw); - }catch(Exception e){ - e.printStackTrace(); - } - return sw.toString(); - } - - public static void main(String[] args) throws Exception { - - Sample sample = new Sample(); - - // Optionally first delete all existing collection object records. - boolean ENABLE_DELETE_ALL = false; - if (ENABLE_DELETE_ALL) { - logger.info("Deleting all CollectionObject records ..."); - sample.deleteAllCollectionObjects(); - } - - logger.info("Creating a new CollectionObject record ..."); - String newRecordId = sample.createCollectionObject(); - - if (newRecordId == null || newRecordId.trim().isEmpty()) { - logger.error("Could not create new record."); - return; - } - - logger.info("Reading the new CollectionObject record ..."); - PoxPayloadIn corecord = sample.readCollectionObject(newRecordId); - sample.displayCollectionObject(corecord); - - logger.info("Deleting the new CollectionObject record ..."); - sample.deleteCollectionObject(newRecordId); - - } - -} diff --git a/services/collectionobject/sample/sample/src/main/resources/collectionspace-client.properties b/services/collectionobject/sample/sample/src/main/resources/collectionspace-client.properties deleted file mode 100644 index 75c24cd41..000000000 --- a/services/collectionobject/sample/sample/src/main/resources/collectionspace-client.properties +++ /dev/null @@ -1,6 +0,0 @@ -#url of the collectionspace server -cspace.url=http://localhost:8180/cspace-services/ -cspace.ssl=false -cspace.auth=true -cspace.user=test -cspace.password=test \ No newline at end of file diff --git a/services/common/pom.xml b/services/common/pom.xml index f4220b5a9..8cd3b515f 100644 --- a/services/common/pom.xml +++ b/services/common/pom.xml @@ -38,6 +38,11 @@ org.collectionspace.services org.collectionspace.services.relation.client ${project.version} + + + org.collectionspace.services + org.collectionspace.services.systeminfo.client + ${project.version} org.collectionspace.services diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml index f8b0abef7..c5d6ff590 100644 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml +++ b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml @@ -173,11 +173,16 @@ default-domain - - org.collectionspace.services.structureddate.StructureddateDocumentHandler - + + + + + default-domain + + diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java index 7bd42c9bf..be52453bd 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java @@ -65,6 +65,7 @@ import org.collectionspace.services.common.document.JaxbUtils; import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; import org.collectionspace.services.common.security.SecurityUtils; import org.collectionspace.services.config.tenant.TenantBindingType; +import org.collectionspace.services.systeminfo.SystemInfoClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -87,6 +88,7 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn private static final String STRUCTURED_DATE_REQUEST = "structureddate"; private static final String PASSWORD_RESET = "accounts/requestpasswordreset"; private static final String PROCESS_PASSWORD_RESET = "accounts/processpasswordreset"; + private static final String SYSTEM_INFO = SystemInfoClient.SERVICE_NAME; private static final String NUXEO_ADMIN = null; // // Use this thread specific member instance to hold our login context with Nuxeo @@ -99,14 +101,17 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn private static final String ERROR_NUXEO_LOGOUT = "Attempt to logout when Nuxeo login context was null."; private static final String ERROR_UNBALANCED_LOGINS = "The number of Logins vs Logouts to the Nuxeo framework was unbalanced."; - private boolean isAnonymousRequest(HttpRequest request, ResourceMethodInvoker resourceMethodInvoker) { + private boolean isAnonymousRequest(HttpRequest request, ResourceMethodInvoker resourceMethodInvoker) { // see C:\dev\src\cspace\services\services\JaxRsServiceProvider\src\main\webapp\WEB-INF\applicationContext-security.xml boolean result = false; - String resName = SecurityUtils.getResourceName(request.getUri()); - if (resName.equalsIgnoreCase(PASSWORD_RESET) || resName.equals(PROCESS_PASSWORD_RESET)) { - return true; + String resName = SecurityUtils.getResourceName(request.getUri()).toLowerCase(); + switch (resName) { + case PASSWORD_RESET: + case PROCESS_PASSWORD_RESET: + case SYSTEM_INFO: + return true; } - + Class resourceClass = resourceMethodInvoker.getResourceClass(); try { CollectionSpaceResource resourceInstance = (CollectionSpaceResource)resourceClass.newInstance(); diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java index 52166f156..9230c25bd 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java @@ -536,7 +536,7 @@ public abstract class RemoteDocumentModelHandlerImpl if (children != null && (children.size() > 0)) { for (Property prop : children ) { String propName = prop.getName(); - logger.debug(propName); + logger.trace(propName); if (prop.isPhantom() == false) { if (prop.isScalar() == false) { setFieldsDirty(prop.getChildren(), fieldNameSet); diff --git a/services/exhibition/service/pom.xml b/services/exhibition/service/pom.xml index e305f2a3f..d57fd3683 100644 --- a/services/exhibition/service/pom.xml +++ b/services/exhibition/service/pom.xml @@ -8,7 +8,6 @@ 4.0.0 - org.collectionspace.services org.collectionspace.services.exhibition.service services.exhibition.service jar @@ -17,8 +16,7 @@ org.collectionspace.services org.collectionspace.services.common - ${project.version} - + org.collectionspace.services org.collectionspace.services.exhibition.jaxb @@ -80,7 +78,6 @@ org.nuxeo.ecm.core nuxeo-core-api - ${nuxeo.core.version} jboss-remoting diff --git a/services/exhibition/service/profiles.xml b/services/exhibition/service/profiles.xml deleted file mode 100644 index 7c9dc966e..000000000 --- a/services/exhibition/service/profiles.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/services/organization/pom.xml b/services/organization/pom.xml index 49ad6d016..97e57343d 100644 --- a/services/organization/pom.xml +++ b/services/organization/pom.xml @@ -10,17 +10,6 @@ org.collectionspace.services.organization services.organization pom - - - - jaxb @@ -29,14 +18,5 @@ client - - - samples - - sample - - - - diff --git a/services/organization/sample/pom.xml b/services/organization/sample/pom.xml deleted file mode 100644 index 24db12492..000000000 --- a/services/organization/sample/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.organization.client.samples - pom - 5.0-SNAPSHOT - organization.client.samples - - - sample - - - diff --git a/services/organization/sample/sample/pom.xml b/services/organization/sample/sample/pom.xml deleted file mode 100644 index 820af8ac9..000000000 --- a/services/organization/sample/sample/pom.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.organization.client.sample - jar - 5.0-SNAPSHOT - organization.client.sample - - - - org.collectionspace.services - org.collectionspace.services.organization.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.client - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.organization.client - ${project.version} - - - - - - libs-releases-local - libs-releases-local - http://nightly.collectionspace.org:8081/artifactory/libs-release-local - - true - - - false - - - - - libs-snapshots-local - libs-snapshots-local - http://nightly.collectionspace.org:8081/artifactory/libs-snapshot-local - - false - - - true - - - - collectionspace-releases - collectionspace-releases - http://nightly.collectionspace.org:8081/artifactory/nuxeo-public - - true - - - false - - - - nuxeo-public-snapshot - nuxeo-public-snapshot - http://nightly.collectionspace.org:8081/artifactory/nuxeo-public-snapshot - - false - - - true - - - - - - organization-client-sample - - - org.apache.maven.plugins - maven-assembly-plugin - - - - attached - - package - - - jar-with-dependencies - - - - org.collectionspace.services.organization.client.sample.Sample - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - - diff --git a/services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java b/services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java deleted file mode 100644 index 5e52df1d9..000000000 --- a/services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java +++ /dev/null @@ -1,510 +0,0 @@ -/** - * This document is a part of the source code and related artifacts - * for CollectionSpace, an open source collections management system - * for museums and related institutions: - * - * http://www.collectionspace.org - * http://wiki.collectionspace.org - * - * Copyright (c)) 2009 Regents of the University of California - * - * Licensed under the Educational Community License (ECL), Version 2.0. - * You may not use this file except in compliance with this License. - * - * You may obtain a copy of the ECL 2.0 License at - * https://source.collectionspace.org/collection-space/LICENSE.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.collectionspace.services.organization.client.sample; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - -import org.apache.log4j.BasicConfigurator; -import org.collectionspace.services.OrganizationJAXBSchema; -import org.collectionspace.services.client.OrgAuthorityClient; -import org.collectionspace.services.client.OrgAuthorityClientUtils; -import org.collectionspace.services.client.PayloadInputPart; -import org.collectionspace.services.client.PoxPayloadIn; -import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.client.test.ServiceRequestType; -import org.collectionspace.services.organization.OrgauthoritiesCommon; -import org.collectionspace.services.organization.OrgauthoritiesCommonList; -import org.collectionspace.services.organization.OrganizationsCommon; -import org.collectionspace.services.organization.OrganizationsCommonList; -import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.multipart.InputPart; -import org.jboss.resteasy.plugins.providers.multipart.OutputPart; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * OrgAuthority Sample, carries out tests against a - * deployed and running OrgAuthority Service. - * - * $LastChangedRevision: 1055 $ - * $LastChangedDate: 2009-12-09 12:25:15 -0800 (Wed, 09 Dec 2009) $ - */ -public class Sample { - private static final Logger logger = - LoggerFactory.getLogger(Sample.class); - - // Instance variables specific to this test. - private OrgAuthorityClient client = new OrgAuthorityClient(); - final String SERVICE_PATH_COMPONENT = "organizations"; - final String ITEM_SERVICE_PATH_COMPONENT = "items"; - - - // --------------------------------------------------------------- - // Create - // --------------------------------------------------------------- - protected String createOrgAuthRefName(String orgAuthorityName) { - return "urn:cspace:org.collectionspace.demo:orgauthority:name(" - +orgAuthorityName+")"; - } - - protected String createOrganizationRefName( - String orgAuthRefName, String orgName) { - return orgAuthRefName+":organization:name("+orgName+")"; - } - - - - public void createOrgAuthority(String orgAuthName, List> orgInfos ) { - - // Expected status code: 201 Created - int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE; - - logger.info("Import: Create orgAuthority: \"" + orgAuthName +"\""); - String baseOrgAuthRefName = createOrgAuthRefName(orgAuthName); - String fullOrgAuthRefName = baseOrgAuthRefName+"'"+orgAuthName+"'"; - PoxPayloadOut multipart = - OrgAuthorityClientUtils.createOrgAuthorityInstance( - orgAuthName, fullOrgAuthRefName, - client.getCommonPartName()); - ClientResponse res = client.create(multipart); - - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not create enumeration: \""+orgAuthName - +"\" "+ OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when creating enumeration: \"" - +orgAuthName +"\", Status:"+ statusCode); - } - - // Store the ID returned from this create operation - // for additional tests below. - String newOrgAuthId = OrgAuthorityClientUtils.extractId(res); - logger.info("Import: Created orgAuthority: \"" + orgAuthName +"\" ID:" - +newOrgAuthId ); - - // Add items to the orgAuthority - for(Map orgInfo : orgInfos){ - createItemInOrgAuth(newOrgAuthId, baseOrgAuthRefName, orgInfo); - } - - } - - private String createItemInOrgAuth(String vcsid, - String orgAuthorityRefName, Map orgInfo) { - // Expected status code: 201 Created - int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE; - String shortName = orgInfo.get(OrganizationJAXBSchema.SHORT_NAME); - String refName = createOrganizationRefName( - orgAuthorityRefName, shortName)+"'"+shortName+"'"; - - - logger.info("Import: Create Item: \""+shortName+ - "\" in orgAuthority: \"" + orgAuthorityRefName +"\""); - PoxPayloadOut multipart = - OrgAuthorityClientUtils.createOrganizationInstance(refName, orgInfo, client.getItemCommonPartName() ); - - ClientResponse res = client.createItem(vcsid, multipart); - - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not create Item: \""+shortName - +"\" in orgAuthority: \"" + orgAuthorityRefName - +"\" "+ OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when creating Item: \""+shortName - +"\" in orgAuthority: \"" + orgAuthorityRefName + - "\", Status:"+ statusCode); - } - - return OrgAuthorityClientUtils.extractId(res); - } - - - // --------------------------------------------------------------- - // Read - // --------------------------------------------------------------- - - private OrgauthoritiesCommonList readOrgAuthorities() { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - ClientResponse res = client.readList(); - OrgauthoritiesCommonList list = res.getEntity(); - - int statusCode = res.getStatus(); - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read list of orgAuthorities: " - + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "list of orgAuthorities, Status:"+ statusCode); - } - - return list; - } - - private List readOrgAuthorityIds(OrgauthoritiesCommonList list) { - - List ids = new ArrayList(); - List orgAuthorities = - list.getOrgauthorityListItem(); - for (OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority : orgAuthorities) { - ids.add(orgAuthority.getCsid()); - } - return ids; - } - - private OrgauthoritiesCommon readOrgAuthority(String orgAuthId) { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - OrgauthoritiesCommon orgAuthority = null; - try { - ClientResponse res = client.read(orgAuthId); - int statusCode = res.getStatus(); - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read orgAuthority" - + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "orgAuthority, Status:"+ statusCode); - } - PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); - PayloadInputPart orgAuthorityPart = input.getPart(client.getCommonPartName()); - orgAuthority = (OrgauthoritiesCommon) orgAuthorityPart.getBody(); - } catch (Exception e) { - throw new RuntimeException("Could not read orgAuthority: ", e); - } - - return orgAuthority; - } - - private OrganizationsCommonList readItemsInOrgAuth(String orgAuthId) { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - - //was: ClientResponse res = client.readItemList(orgAuthId); - //new API: readItemList(String inAuthority, String partialTerm, String keywords) - ClientResponse res = client.readItemList(orgAuthId, "", "");//TODO: .New call, most certainly wrong. Just trying to get this to compile. Laramie20100728 - - OrganizationsCommonList list = res.getEntity(); - - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read items in orgAuthority: " - + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "items in orgAuthority, Status:"+ statusCode); - } - - return list; - } - - private List readOrganizationIds(OrganizationsCommonList list) { - - List ids = new ArrayList(); - List items = - list.getOrganizationListItem(); - for (OrganizationsCommonList.OrganizationListItem item : items) { - ids.add(item.getCsid()); - } - return ids; - } - - // --------------------------------------------------------------- - // Delete - // --------------------------------------------------------------- - - private void deleteOrgAuthority(String vcsid) { - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE; - - ClientResponse res = client.delete(vcsid); - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not delete orgAuthority: " - + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when deleting " + - "orgAuthority, Status:"+ statusCode); - } - } - - private void deleteAllOrgAuthorities() { - List ids = readOrgAuthorityIds(readOrgAuthorities()); - for (String id : ids) { - deleteOrgAuthority(id); - } - } - - private void deleteOrganization(String vcsid, String itemcsid) { - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE; - - ClientResponse res = client.deleteItem(vcsid, itemcsid); - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not delete orgAuthority item: " - + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when deleting " + - "orgAuthority item, Status:"+ statusCode); - } - } - - private void deleteAllItemsForOrgAuth(String orgAuthId) { - List itemIds = readOrganizationIds(readItemsInOrgAuth(orgAuthId)); - for (String itemId : itemIds) { - deleteOrganization(orgAuthId, itemId); - } - } - - // --------------------------------------------------------------- - // Utility methods used by tests above - // --------------------------------------------------------------- - - - // Retrieve individual fields of orgAuthority records. - - private String displayAllOrgAuthorities(OrgauthoritiesCommonList list) { - StringBuffer sb = new StringBuffer(); - List orgAuthorities = - list.getOrgauthorityListItem(); - int i = 0; - for (OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority : orgAuthorities) { - sb.append("orgAuthority [" + i + "]" + "\n"); - sb.append(displayOrgAuthorityDetails(orgAuthority)); - i++; - } - return sb.toString(); - } - - private String displayOrgAuthorityDetails( - OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority) { - StringBuffer sb = new StringBuffer(); - sb.append("displayName=" + orgAuthority.getDisplayName() + "\n"); - sb.append("vocabType=" + orgAuthority.getVocabType() + "\n"); - // sb.append("csid=" + orgAuthority.getCsid() + "\n"); - sb.append("URI=" + orgAuthority.getUri() + "\n"); - return sb.toString(); - } - - // Retrieve individual fields of organization records. - - private String displayAllOrganizations(OrganizationsCommonList list) { - StringBuffer sb = new StringBuffer(); - List items = - list.getOrganizationListItem(); - int i = 0; - for (OrganizationsCommonList.OrganizationListItem item : items) { - sb.append("organization [" + i + "]" + "\n"); - sb.append(displayOrganizationDetails(item)); - i++; - } - return sb.toString(); - } - - private String displayOrganizationDetails( - OrganizationsCommonList.OrganizationListItem item) { - StringBuffer sb = new StringBuffer(); - sb.append("csid=" + item.getCsid() + "\n"); - sb.append("displayName=" + item.getDisplayName() + "\n"); - // sb.append("URI=" + item.getUri() + "\n"); - return sb.toString(); - } - -// private Object extractPart(PoxPayloadIn input, String label, -// Class clazz) throws Exception { -// Object obj = null; -// for(PayloadInputPart part : input.getParts()){ -// String partLabel = part.getHeaders().getFirst("label"); -// if(label.equalsIgnoreCase(partLabel)){ -// String partStr = part.getBodyAsString(); -// if(logger.isDebugEnabled()){ -// logger.debug("extracted part str=\n" + partStr); -// } -// obj = part.getBody(clazz, null); -// if(logger.isDebugEnabled()){ -// logger.debug("extracted part obj=\n", obj, clazz); -// } -// break; -// } -// } -// return obj; -// } - - public static void main(String[] args) { - - // Configure logging. - BasicConfigurator.configure(); - - logger.info("OrgAuthority Sample starting..."); - - Sample sample = new Sample(); - OrgauthoritiesCommonList orgAuthorities; - List orgAuthIds; - String details = ""; - - // Optionally delete all orgAuthorities and organizations. - - boolean ENABLE_DELETE_ALL = false; - if (ENABLE_DELETE_ALL) { - - logger.info("Deleting all organizations and orgAuthorities ..."); - - // For each orgAuthority ... - orgAuthorities = sample.readOrgAuthorities(); - orgAuthIds = sample.readOrgAuthorityIds(orgAuthorities); - for (String orgAuthId : orgAuthIds) { - logger.info("Deleting all organizations for orgAuthority ..."); - sample.deleteAllItemsForOrgAuth(orgAuthId); - logger.info("Deleting orgAuthority ..."); - sample.deleteOrgAuthority(orgAuthId); - } - - logger.info("Reading orgAuthorities after deletion ..."); - orgAuthorities = sample.readOrgAuthorities(); - details = sample.displayAllOrgAuthorities(orgAuthorities); - logger.info(details); - - logger.info("Reading items in each orgAuthority after deletion ..."); - orgAuthIds = sample.readOrgAuthorityIds(orgAuthorities); - for (String orgAuthId : orgAuthIds) { - OrganizationsCommonList items = sample.readItemsInOrgAuth(orgAuthId); - details = sample.displayAllOrganizations(items); - logger.info(details); - } - - } - - // Create new authorities, each populated with organizations. - Map mmiOrgMap = new HashMap(); - mmiOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "MMI"); - mmiOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Museum of the Moving Image"); - //mmiOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Megan Forbes"); - mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1984"); - mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Astoria, NY"); - Map pahmaOrgMap = new HashMap(); - pahmaOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "PAHMA"); - pahmaOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Phoebe A. Hearst Museum of Anthropology"); - pahmaOrgMap.put(OrganizationJAXBSchema.NAME_ADDITIONS, "University of California, Berkeley"); - //pahmaOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Michael Black"); - pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1901"); - pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Berkeley, CA"); - Map savoyOrgMap = new HashMap(); - savoyOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "Savoy Theatre"); - savoyOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1900"); - savoyOrgMap.put(OrganizationJAXBSchema.DISSOLUTION_DATE, "1952"); - savoyOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "New York, NY"); - List> orgMaps = - Arrays.asList(mmiOrgMap, pahmaOrgMap, savoyOrgMap ); - - sample.createOrgAuthority("Sample Org Authority", orgMaps); - - logger.info("OrgAuthority Sample complete."); - - logger.info("Reading orgAuthorities and items ..."); - // Get a list of orgAuthorities. - orgAuthorities = sample.readOrgAuthorities(); - // For each orgAuthority ... - for (OrgauthoritiesCommonList.OrgauthorityListItem - orgAuthority : orgAuthorities.getOrgauthorityListItem()) { - // Get its display name. - logger.info(orgAuthority.getDisplayName()); - // Get a list of the organizations in this orgAuthority. - OrganizationsCommonList items = - sample.readItemsInOrgAuth(orgAuthority.getCsid()); - // For each organization ... - for (OrganizationsCommonList.OrganizationListItem - item : items.getOrganizationListItem()) { - // Get its display name. - logger.info(" " + item.getDisplayName()); - } - } - - // Sample alternate methods of reading all orgAuthorities and - // organizations separately. - boolean RUN_ADDITIONAL_SAMPLES = false; - if (RUN_ADDITIONAL_SAMPLES) { - - logger.info("Reading all orgAuthorities ..."); - details = sample.displayAllOrgAuthorities(orgAuthorities); - logger.info(details); - - logger.info("Reading all organizations ..."); - orgAuthIds = sample.readOrgAuthorityIds(orgAuthorities); - for (String orgAuthId : orgAuthIds) { - OrganizationsCommonList items = sample.readItemsInOrgAuth(orgAuthId); - details = sample.displayAllOrganizations(items); - logger.info(details); - } - - } - - } - -} diff --git a/services/organization/sample/sample/src/main/resources/collectionspace-client.properties b/services/organization/sample/sample/src/main/resources/collectionspace-client.properties deleted file mode 100644 index 927081034..000000000 --- a/services/organization/sample/sample/src/main/resources/collectionspace-client.properties +++ /dev/null @@ -1,6 +0,0 @@ -#url of the collectionspace server -cspace.url=http://localhost:8180/cspace-services/ -cspace.ssl=false -cspace.auth=false -cspace.user=test -cspace.password=test \ No newline at end of file diff --git a/services/organization/sample/sample/src/main/resources/log4j.xml b/services/organization/sample/sample/src/main/resources/log4j.xml deleted file mode 100644 index af20cb489..000000000 --- a/services/organization/sample/sample/src/main/resources/log4j.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/person/pom.xml b/services/person/pom.xml index e1667ba22..530776696 100644 --- a/services/person/pom.xml +++ b/services/person/pom.xml @@ -28,15 +28,6 @@ 3rdparty client - - - - samples - - sample - - - - + diff --git a/services/person/sample/pom.xml b/services/person/sample/pom.xml deleted file mode 100644 index b7357045b..000000000 --- a/services/person/sample/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.person.client.samples - pom - 1.0 - person.client.samples - - - sample - - - diff --git a/services/person/sample/sample/pom.xml b/services/person/sample/sample/pom.xml deleted file mode 100644 index deedd7d81..000000000 --- a/services/person/sample/sample/pom.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.person.client.sample - jar - 1.0 - person.client.sample - - - - - - - - libs-releases-local - libs-releases-local - http://nightly.collectionspace.org:8081/artifactory/libs-release-local - - true - - - false - - - - - libs-snapshots-local - libs-snapshots-local - http://nightly.collectionspace.org:8081/artifactory/libs-snapshot-local - - false - - - true - - - - nuxeo-public - nuxeo-public - http://nightly.collectionspace.org:8081/artifactory/nuxeo-public - - true - - - false - - - - nuxeo-public-snapshot - nuxeo-public-snapshot - http://nightly.collectionspace.org:8081/artifactory/nuxeo-public-snapshot - - false - - - true - - - - - - person-client-sample - - - org.apache.maven.plugins - maven-assembly-plugin - - - - attached - - package - - - jar-with-dependencies - - - - org.collectionspace.services.person.client.sample.Sample - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - - diff --git a/services/person/sample/sample/src/main/java/org/collectionspace/services/person/client/sample/Sample.java b/services/person/sample/sample/src/main/java/org/collectionspace/services/person/client/sample/Sample.java deleted file mode 100644 index 10aa55db2..000000000 --- a/services/person/sample/sample/src/main/java/org/collectionspace/services/person/client/sample/Sample.java +++ /dev/null @@ -1,593 +0,0 @@ -/** - * This document is a part of the source code and related artifacts - * for CollectionSpace, an open source collections management system - * for museums and related institutions: - * - * http://www.collectionspace.org - * http://wiki.collectionspace.org - * - * Copyright (c)) 2009 Regents of the University of California - * - * Licensed under the Educational Community License (ECL), Version 2.0. - * You may not use this file except in compliance with this License. - * - * You may obtain a copy of the ECL 2.0 License at - * https://source.collectionspace.org/collection-space/LICENSE.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.collectionspace.services.person.client.sample; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - -import org.apache.log4j.BasicConfigurator; -import org.collectionspace.services.PersonJAXBSchema; -import org.collectionspace.services.client.PersonAuthorityClient; -import org.collectionspace.services.client.PersonAuthorityClientUtils; -import org.collectionspace.services.client.PoxPayloadIn; -import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.client.test.ServiceRequestType; -import org.collectionspace.services.person.PersonauthoritiesCommon; -import org.collectionspace.services.person.PersonauthoritiesCommonList; -import org.collectionspace.services.person.PersonsCommon; -import org.collectionspace.services.person.PersonsCommonList; -import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.multipart.InputPart; -import org.jboss.resteasy.plugins.providers.multipart.OutputPart; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * PersonAuthority Sample, carries out tests against a - * deployed and running PersonAuthority Service. - * - * $LastChangedRevision: 1055 $ - * $LastChangedDate: 2009-12-09 12:25:15 -0800 (Wed, 09 Dec 2009) $ - */ -public class Sample { - private static final Logger logger = - LoggerFactory.getLogger(Sample.class); - - // Instance variables specific to this test. - private PersonAuthorityClient client = new PersonAuthorityClient(); - final String SERVICE_PATH_COMPONENT = "persons"; - final String ITEM_SERVICE_PATH_COMPONENT = "items"; - - - // --------------------------------------------------------------- - // Create - // --------------------------------------------------------------- - - public void createPersonAuthority(String personAuthorityName, - List> personMaps ) { - - // Expected status code: 201 Created - int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE; - - logger.info("Import: Create personAuthority: \"" + personAuthorityName +"\""); - - - String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix. - String basePersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, displaySuffix);//TODO: Laramie20100728 temp fix was personAuthorityName, false - String fullPersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, displaySuffix); //TODO: Laramie20100728 temp fix was personAuthorityName, true - PoxPayloadOut multipart = - PersonAuthorityClientUtils.createPersonAuthorityInstance( - personAuthorityName, fullPersonRefName, client.getCommonPartName() ); - ClientResponse res = client.create(multipart); - - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not create enumeration: \""+personAuthorityName - +"\" "+ PersonAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when creating enumeration: \"" - +personAuthorityName +"\", Status:"+ statusCode); - } - - // Store the ID returned from this create operation - // for additional tests below. - String newPersonAuthId = PersonAuthorityClientUtils.extractId(res); - logger.info("Import: Created personAuthority: \"" + personAuthorityName +"\" ID:" - +newPersonAuthId ); - - // Add items to the personAuthority - for(Map personMap : personMaps){ - createItemInAuthority(newPersonAuthId, basePersonRefName, personMap); - } - - } - - private String createItemInAuthority(String vcsid, - String personAuthorityRefName, Map personMap) { - // Expected status code: 201 Created - int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE; - String foreName = personMap.get(PersonJAXBSchema.FORE_NAME); - String middleName = personMap.get(PersonJAXBSchema.MIDDLE_NAME); - String surName = personMap.get(PersonJAXBSchema.SUR_NAME); - String birthDate = personMap.get(PersonJAXBSchema.BIRTH_DATE); - String deathDate = personMap.get(PersonJAXBSchema.DEATH_DATE); - StringBuilder builtName = new StringBuilder(); - if(foreName!=null) - builtName.append(foreName); - if(middleName!=null) - builtName.append(middleName); - if(surName!=null) - builtName.append(surName); - if(birthDate!=null) - builtName.append(birthDate); - builtName.append("-"); - if(deathDate!=null) - builtName.append(deathDate); - - String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix. - - String refName = PersonAuthorityClientUtils.createPersonRefName(personAuthorityRefName, builtName.toString(), displaySuffix); //TODO was ...,true); - logger.info("Import: Create Item: \""+refName+"\" in personAuthority: \"" + personAuthorityRefName +"\""); - - if(logger.isDebugEnabled()){ - logger.debug("Import: Create Item: \""+builtName.toString() - +"\" in personAuthorityulary: \"" + personAuthorityRefName +"\""); - } - PoxPayloadOut multipart = createPersonInstance( vcsid, refName, - personMap ); - ClientResponse res = client.createItem(vcsid, multipart); - - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not create Item: \""+refName - +"\" in personAuthority: \"" + personAuthorityRefName - +"\" "+ PersonAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when creating Item: \""+refName - +"\" in personAuthority: \"" + personAuthorityRefName +"\", Status:"+ statusCode); - } - - return PersonAuthorityClientUtils.extractId(res); - } - - - // --------------------------------------------------------------- - // Read - // --------------------------------------------------------------- - - private PersonauthoritiesCommonList readPersonAuthorities() { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - ClientResponse res = client.readList(); - PersonauthoritiesCommonList list = res.getEntity(); - - int statusCode = res.getStatus(); - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read list of personAuthorities: " - + PersonAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "list of personAuthorities, Status:"+ statusCode); - } - - return list; - } - - private List readPersonAuthorityIds(PersonauthoritiesCommonList list) { - - List ids = new ArrayList(); - List personAuthorities = - list.getPersonauthorityListItem(); - for (PersonauthoritiesCommonList.PersonauthorityListItem personAuthority : personAuthorities) { - ids.add(personAuthority.getCsid()); - } - return ids; - } - - private PersonauthoritiesCommon readPersonAuthority(String personAuthId) { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - PersonauthoritiesCommon personAuthority = null; - try { - ClientResponse res = client.read(personAuthId); - int statusCode = res.getStatus(); - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read personAuthority" - + PersonAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "personAuthority, Status:"+ statusCode); - } - PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); - personAuthority = (PersonauthoritiesCommon) extractPart(input, - client.getCommonPartName(), PersonauthoritiesCommon.class); - } catch (Exception e) { - throw new RuntimeException("Could not read personAuthority: ", e); - } - - return personAuthority; - } - - private PersonsCommonList readItemsInPersonAuth(String personAuthId) { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - ClientResponse res = client.readItemList(personAuthId, "", ""); //TODO: Laramie201007289 added empty strings to satisfy api - PersonsCommonList list = res.getEntity(); - - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read items in personAuthority: " - + PersonAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "items in personAuthority, Status:"+ statusCode); - } - - return list; - } - - private List readPersonIds(PersonsCommonList list) { - - List ids = new ArrayList(); - List items = - list.getPersonListItem(); - for (PersonsCommonList.PersonListItem item : items) { - ids.add(item.getCsid()); - } - return ids; - } - - // --------------------------------------------------------------- - // Delete - // --------------------------------------------------------------- - - private void deletePersonAuthority(String vcsid) { - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE; - - ClientResponse res = client.delete(vcsid); - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not delete personAuthority: " - + PersonAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when deleting " + - "personAuthority, Status:"+ statusCode); - } - } - - private void deleteAllPersonAuthorities() { - List ids = readPersonAuthorityIds(readPersonAuthorities()); - for (String id : ids) { - deletePersonAuthority(id); - } - } - - private void deletePerson(String vcsid, String itemcsid) { - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE; - - ClientResponse res = client.deleteItem(vcsid, itemcsid); - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not delete personAuthority item: " - + PersonAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when deleting " + - "personAuthority item, Status:"+ statusCode); - } - } - - private void deleteAllItemsForPersonAuth(String personAuthId) { - List itemIds = readPersonIds(readItemsInPersonAuth(personAuthId)); - for (String itemId : itemIds) { - deletePerson(personAuthId, itemId); - } - } - - // --------------------------------------------------------------- - // Utility methods used by tests above - // --------------------------------------------------------------- - - /* - private PoxPayloadOut createPersonAuthorityInstance( - String displayName, String refName ) { - PersonauthoritiesCommon personAuthority = new PersonauthoritiesCommon(); - personAuthority.setDisplayName(displayName); - personAuthority.setRefName(refName); - personAuthority.setVocabType("PersonAuthority"); - PoxPayloadOut multipart = new PoxPayloadOut(); - OutputPart commonPart = multipart.addPart(personAuthority, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", client.getCommonPartName()); - - if(logger.isDebugEnabled()){ - logger.debug("to be created, personAuthority common ", - personAuthority, PersonauthoritiesCommon.class); - } - - return multipart; - } - */ - - private PoxPayloadOut createPersonInstance(String inAuthority, - String refName, Map personInfo ) { - PersonsCommon person = new PersonsCommon(); - person.setInAuthority(inAuthority); - person.setRefName(refName); - String value = null; - if((value = (String)personInfo.get(PersonJAXBSchema.FORE_NAME))!=null) - person.setForeName(value); - if((value = (String)personInfo.get(PersonJAXBSchema.MIDDLE_NAME))!=null) - person.setMiddleName(value); - if((value = (String)personInfo.get(PersonJAXBSchema.SUR_NAME))!=null) - person.setSurName(value); - if((value = (String)personInfo.get(PersonJAXBSchema.INITIALS))!=null) - person.setInitials(value); - if((value = (String)personInfo.get(PersonJAXBSchema.SALUTATIONS))!=null) - person.setSalutation(value); - if((value = (String)personInfo.get(PersonJAXBSchema.TITLE))!=null) - person.setTitle(value); - if((value = (String)personInfo.get(PersonJAXBSchema.NAME_ADDITIONS))!=null) - person.setNameAdditions(value); - if((value = (String)personInfo.get(PersonJAXBSchema.BIRTH_DATE))!=null) { - StructuredDateGroup birthDate = new StructuredDateGroup(); - birthDate.setDateDisplayDate(value); - person.setBirthDateGroup(birthDate); - } - if((value = (String)personInfo.get(PersonJAXBSchema.DEATH_DATE))!=null) { - StructuredDateGroup deathDate = new StructuredDateGroup(); - deathDate.setDateDisplayDate(value); - person.setDeathDateGroup(deathDate); - } - if((value = (String)personInfo.get(PersonJAXBSchema.BIRTH_PLACE))!=null) - person.setBirthPlace(value); - if((value = (String)personInfo.get(PersonJAXBSchema.DEATH_PLACE))!=null) - person.setDeathPlace(value); - - /* TODO: Laramie20100728 removed missing member calls - if((value = (String)personInfo.get(PersonJAXBSchema.GROUP))!=null) - person.setGroup(value); - if((value = (String)personInfo.get(PersonJAXBSchema.NATIONALITY))!=null) - person.setNationality(value); - if((value = (String)personInfo.get(PersonJAXBSchema.OCCUPATION))!=null) - person.setOccupation(value); - if((value = (String)personInfo.get(PersonJAXBSchema.SCHOOL_OR_STYLE))!=null) - person.setSchoolOrStyle(value); - */ - - if((value = (String)personInfo.get(PersonJAXBSchema.GENDER))!=null) - person.setGender(value); - if((value = (String)personInfo.get(PersonJAXBSchema.BIO_NOTE))!=null) - person.setBioNote(value); - if((value = (String)personInfo.get(PersonJAXBSchema.NAME_NOTE))!=null) - person.setNameNote(value); - PoxPayloadOut multipart = new PoxPayloadOut(); - OutputPart commonPart = multipart.addPart(person, - MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", client.getItemCommonPartName()); - - if(logger.isDebugEnabled()){ - logger.debug("to be created, person common"+person); - } - - return multipart; - } - - // Retrieve individual fields of personAuthority records. - - private String displayAllPersonAuthorities(PersonauthoritiesCommonList list) { - StringBuffer sb = new StringBuffer(); - List personAuthorities = - list.getPersonauthorityListItem(); - int i = 0; - for (PersonauthoritiesCommonList.PersonauthorityListItem personAuthority : personAuthorities) { - sb.append("personAuthority [" + i + "]" + "\n"); - sb.append(displayPersonAuthorityDetails(personAuthority)); - i++; - } - return sb.toString(); - } - - private String displayPersonAuthorityDetails( - PersonauthoritiesCommonList.PersonauthorityListItem personAuthority) { - StringBuffer sb = new StringBuffer(); - sb.append("displayName=" + personAuthority.getDisplayName() + "\n"); - sb.append("vocabType=" + personAuthority.getVocabType() + "\n"); - // sb.append("csid=" + personAuthority.getCsid() + "\n"); - sb.append("URI=" + personAuthority.getUri() + "\n"); - return sb.toString(); - } - - // Retrieve individual fields of person records. - - private String displayAllPersons(PersonsCommonList list) { - StringBuffer sb = new StringBuffer(); - List items = - list.getPersonListItem(); - int i = 0; - for (PersonsCommonList.PersonListItem item : items) { - sb.append("person [" + i + "]" + "\n"); - sb.append(displayPersonDetails(item)); - i++; - } - return sb.toString(); - } - - private String displayPersonDetails( - PersonsCommonList.PersonListItem item) { - StringBuffer sb = new StringBuffer(); - sb.append("csid=" + item.getCsid() + "\n"); - sb.append("displayName=" + item.getDisplayName() + "\n"); - // sb.append("URI=" + item.getUri() + "\n"); - return sb.toString(); - } - - private Object extractPart(PoxPayloadIn input, String label, - Class clazz) throws Exception { - Object obj = null; - for(InputPart part : input.getParts()){ - String partLabel = part.getHeaders().getFirst("label"); - if(label.equalsIgnoreCase(partLabel)){ - String partStr = part.getBodyAsString(); - if(logger.isDebugEnabled()){ - logger.debug("extracted part str=\n" + partStr); - } - obj = part.getBody(clazz, null); - if(logger.isDebugEnabled()){ - logger.debug("extracted part obj=\n", obj, clazz); - } - break; - } - } - return obj; - } - - public static void main(String[] args) { - - // Configure logging. - BasicConfigurator.configure(); - - logger.info("PersonAuthority Sample starting..."); - - Sample sample = new Sample(); - PersonauthoritiesCommonList personAuthorities; - List personAuthIds; - String details = ""; - - // Optionally delete all personAuthorities and persons. - - boolean ENABLE_DELETE_ALL = false; - if (ENABLE_DELETE_ALL) { - - logger.info("Deleting all persons and personAuthorities ..."); - - // For each personAuthority ... - personAuthorities = sample.readPersonAuthorities(); - personAuthIds = sample.readPersonAuthorityIds(personAuthorities); - for (String personAuthId : personAuthIds) { - logger.info("Deleting all persons for personAuthority ..."); - sample.deleteAllItemsForPersonAuth(personAuthId); - logger.info("Deleting personAuthority ..."); - sample.deletePersonAuthority(personAuthId); - } - - logger.info("Reading personAuthorities after deletion ..."); - personAuthorities = sample.readPersonAuthorities(); - details = sample.displayAllPersonAuthorities(personAuthorities); - logger.info(details); - - logger.info("Reading items in each personAuthority after deletion ..."); - personAuthIds = sample.readPersonAuthorityIds(personAuthorities); - for (String personAuthId : personAuthIds) { - PersonsCommonList items = sample.readItemsInPersonAuth(personAuthId); - details = sample.displayAllPersons(items); - logger.info(details); - } - - } - - // Create new authorities, each populated with persons. - - Map johnWayneMap = new HashMap(); - johnWayneMap.put(PersonJAXBSchema.FORE_NAME, "John"); - johnWayneMap.put(PersonJAXBSchema.SUR_NAME, "Wayne"); - johnWayneMap.put(PersonJAXBSchema.GENDER, "male"); - Map patrickSchmitzMap = new HashMap(); - patrickSchmitzMap.put(PersonJAXBSchema.FORE_NAME, "Patrick"); - patrickSchmitzMap.put(PersonJAXBSchema.SUR_NAME, "Schmitz"); - patrickSchmitzMap.put(PersonJAXBSchema.GENDER, "male"); - Map janeDoeMap = new HashMap(); - janeDoeMap.put(PersonJAXBSchema.FORE_NAME, "Jane"); - janeDoeMap.put(PersonJAXBSchema.SUR_NAME, "Doe"); - janeDoeMap.put(PersonJAXBSchema.GENDER, "female"); - List> personsMaps = - Arrays.asList(johnWayneMap, patrickSchmitzMap, janeDoeMap ); - - sample.createPersonAuthority("Sample Person Auth", personsMaps); - - logger.info("PersonAuthority Sample complete."); - - logger.info("Reading personAuthorities and items ..."); - // Get a list of personAuthorities. - personAuthorities = sample.readPersonAuthorities(); - // For each personAuthority ... - for (PersonauthoritiesCommonList.PersonauthorityListItem - personAuthority : personAuthorities.getPersonauthorityListItem()) { - // Get its display name. - logger.info(personAuthority.getDisplayName()); - // Get a list of the persons in this personAuthority. - PersonsCommonList items = - sample.readItemsInPersonAuth(personAuthority.getCsid()); - // For each person ... - for (PersonsCommonList.PersonListItem - item : items.getPersonListItem()) { - // Get its short name. - logger.info(" " + item.getDisplayName()); - } - } - - // Sample alternate methods of reading all personAuthorities and - // persons separately. - boolean RUN_ADDITIONAL_SAMPLES = false; - if (RUN_ADDITIONAL_SAMPLES) { - - logger.info("Reading all personAuthorities ..."); - details = sample.displayAllPersonAuthorities(personAuthorities); - logger.info(details); - - logger.info("Reading all persons ..."); - personAuthIds = sample.readPersonAuthorityIds(personAuthorities); - for (String personAuthId : personAuthIds) { - PersonsCommonList items = sample.readItemsInPersonAuth(personAuthId); - details = sample.displayAllPersons(items); - logger.info(details); - } - - } - - } - -} diff --git a/services/person/sample/sample/src/main/resources/collectionspace-client.properties b/services/person/sample/sample/src/main/resources/collectionspace-client.properties deleted file mode 100644 index 927081034..000000000 --- a/services/person/sample/sample/src/main/resources/collectionspace-client.properties +++ /dev/null @@ -1,6 +0,0 @@ -#url of the collectionspace server -cspace.url=http://localhost:8180/cspace-services/ -cspace.ssl=false -cspace.auth=false -cspace.user=test -cspace.password=test \ No newline at end of file diff --git a/services/person/sample/sample/src/main/resources/log4j.xml b/services/person/sample/sample/src/main/resources/log4j.xml deleted file mode 100644 index 708c1601b..000000000 --- a/services/person/sample/sample/src/main/resources/log4j.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/pom.xml b/services/pom.xml index 8e98ea690..de5fed168 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -42,6 +42,7 @@ hyperjaxb common structureddate + systeminfo authority authorization-mgt common-test @@ -87,7 +88,6 @@ index media publicitem - IntegrationTests PerformanceTests security diff --git a/services/pottag/service/pom.xml b/services/pottag/service/pom.xml index 6b72a04e1..f3b539624 100644 --- a/services/pottag/service/pom.xml +++ b/services/pottag/service/pom.xml @@ -8,7 +8,6 @@ 4.0.0 - org.collectionspace.services org.collectionspace.services.pottag.service services.pottag.service jar @@ -17,8 +16,7 @@ org.collectionspace.services org.collectionspace.services.common - ${project.version} - + org.collectionspace.services org.collectionspace.services.pottag.jaxb @@ -38,7 +36,6 @@ junit junit - 4.1 test @@ -58,7 +55,6 @@ dom4j dom4j - 1.6.1 provided @@ -88,7 +84,6 @@ org.nuxeo.ecm.core nuxeo-core-api - ${nuxeo.core.version} jboss-remoting diff --git a/services/pottag/service/profiles.xml b/services/pottag/service/profiles.xml deleted file mode 100644 index 347b9df22..000000000 --- a/services/pottag/service/profiles.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/services/propagation/service/profiles.xml b/services/propagation/service/profiles.xml deleted file mode 100644 index 347b9df22..000000000 --- a/services/propagation/service/profiles.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/services/sdk/pom.xml b/services/sdk/pom.xml deleted file mode 100644 index 4f109ce06..000000000 --- a/services/sdk/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.sdk - pom - services.sdk - 5.0-SNAPSHOT - - - - libs-releases-local - libs-releases-local - http://nightly.collectionspace.org:8081/artifactory/libs-release-local - - - libs-snapshots-local - libs-snapshots-local - http://nightly.collectionspace.org:8081/artifactory/libs-snapshot-local - - - - - - samples - - sample - - - - - - diff --git a/services/sdk/sample/pom.xml b/services/sdk/sample/pom.xml deleted file mode 100644 index 332e1a946..000000000 --- a/services/sdk/sample/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - org.collectionspace.services.client - org.collectionspace.services.client.sample - jar - client.sample - - - - org.collectionspace.services - org.collectionspace.services.collectionobject.client - - - org.slf4j - slf4j-simple - 1.5.2 - - - - - - libs-releases-local - libs-releases-local - http://nightly.collectionspace.org:8081/artifactory/libs-release-local - - true - - - false - - - - libs-snapshots-local - libs-snapshots-local - http://nightly.collectionspace.org:8081/artifactory/libs-snapshot-local - - false - - - true - - - - - - client-sample - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - - diff --git a/services/sdk/sample/src/main/java/org/collectionspace/services/sdk/sample/Sample.java b/services/sdk/sample/src/main/java/org/collectionspace/services/sdk/sample/Sample.java deleted file mode 100644 index 28b800e39..000000000 --- a/services/sdk/sample/src/main/java/org/collectionspace/services/sdk/sample/Sample.java +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Sample.java - * - * {Purpose of This Class} - * - * {Other Notes Relating to This Class (Optional)} - * - * $LastChangedBy: $ - * $LastChangedRevision: $ - * $LastChangedDate: $ - * - * This document is a part of the source code and related artifacts - * for CollectionSpace, an open source collections management system - * for museums and related institutions: - * - * http://www.collectionspace.org - * http://wiki.collectionspace.org - * - * Copyright © 2009 {Contributing Institution} - * - * Licensed under the Educational Community License (ECL), Version 2.0. - * You may not use this file except in compliance with this License. - * - * You may obtain a copy of the ECL 2.0 License at - * https://source.collectionspace.org/collection-space/LICENSE.txt - */ -package org.collectionspace.services.sdk.sample; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - -import org.collectionspace.services.collectionobject.ObjectNameGroup; -import org.collectionspace.services.collectionobject.ObjectNameList; -import org.testng.Assert; - -import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.multipart.InputPart; -import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; -import org.jboss.resteasy.plugins.providers.multipart.OutputPart; - -import org.collectionspace.services.client.CollectionObjectClient; -import org.collectionspace.services.collectionobject.CollectionobjectsCommon; -import org.collectionspace.services.collectionobject.CollectionobjectsCommonList; - -/** - * The Class Sample. - */ -public class Sample { - - /** The collection object client. */ - private static CollectionObjectClient collectionObjectClient = new CollectionObjectClient(); - - /** - * @param args - */ - public static void main(String[] args) { - - System.out.println("Base URL is: " - + collectionObjectClient.getBaseURL()); - - String csid = createCollectionObject(); - System.out.println("Created a new collection object with CSID=" + csid); - - CollectionobjectsCommon co = readCollectionObject(csid); - System.out.println("Got a collection object with CSID=" + csid); - - int status = updateCollectionObject(csid); - System.out.println("Updated the collection object with CSID=" + csid); - } - - /** - * Creates the collection object. - * - * @return the string - */ - static String createCollectionObject() { - String result = null; - - CollectionobjectsCommon co = new CollectionobjectsCommon(); - ObjectNameList onl = co.getObjectNameList(); - ObjectNameGroup ong = new ObjectNameGroup(); - ong.setObjectName("Keiko CollectionobjectsCommon"); - onl.getObjectNameGroup().add(ong); - - MultipartOutput multipart = new MultipartOutput(); - OutputPart commonPart = multipart.addPart(co, - MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", - collectionObjectClient.getCommonPartName()); - - ClientResponse response = collectionObjectClient - .create(multipart); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED - .getStatusCode()); - result = extractId(response); - - return result; - } - - /** - * Read collection object. - * - * @param csid - * the csid - * - * @return the collectionobjects common - */ - static CollectionobjectsCommon readCollectionObject(String csid) { - CollectionobjectsCommon result = null; - - ClientResponse response = collectionObjectClient - .read(csid); - Assert.assertEquals(response.getStatus(), Response.Status.OK - .getStatusCode()); - try { - MultipartInput input = (MultipartInput) response.getEntity(); - result = (CollectionobjectsCommon) extractPart(input, - collectionObjectClient.getCommonPartName(), - CollectionobjectsCommon.class); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return result; - } - - /** - * Update collection object. - */ - static int updateCollectionObject(String csid) { - ClientResponse response = collectionObjectClient - .read(csid); - Assert.assertEquals(response.getStatus(), Response.Status.OK - .getStatusCode()); - - MultipartInput input = (MultipartInput) response.getEntity(); - CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart( - input, collectionObjectClient.getCommonPartName(), - CollectionobjectsCommon.class); - Assert.assertNotNull(collectionObject); - - // Update the content of this resource. - collectionObject.setObjectNumber("updated-" - + collectionObject.getObjectNumber()); - String name = collectionObject.getObjectNameList().getObjectNameGroup().get(0).getObjectName(); - collectionObject.getObjectNameList().getObjectNameGroup().get(0).setObjectName("updated-"+ name); - - // Submit the request to the service and store the response. - MultipartOutput output = new MultipartOutput(); - OutputPart commonPart = output.addPart(collectionObject, - MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", - collectionObjectClient.getCommonPartName()); - - response = collectionObjectClient.update(csid, output); - int statusCode = response.getStatus(); - - return statusCode; - } - - // - // Utility methods that belong somewhere in the SDK and NOT the sample. - // - - /** - * Extract id. - * - * @param res - * the res - * - * @return the string - */ - static String extractId(ClientResponse res) { - String result = null; - - try { - MultivaluedMap mvm = res.getMetadata(); - String uri = (String) ((ArrayList) mvm.get("Location")).get(0); - String[] segments = uri.split("/"); - result = segments[segments.length - 1]; - } catch (Exception e) { - e.printStackTrace(); - } - - return result; - } - - /** - * Extract part. - * - * @param input - * the input - * @param label - * the label - * @param clazz - * the clazz - * - * @return the object - * - * @throws Exception - * the exception - */ - static Object extractPart(MultipartInput input, String label, Class clazz) { - Object obj = null; - - try { - for (InputPart part : input.getParts()) { - String partLabel = part.getHeaders().getFirst("label"); - if (label.equalsIgnoreCase(partLabel)) { - String partStr = part.getBodyAsString(); - obj = part.getBody(clazz, null); - break; - } - } - } catch (Exception e) { - e.printStackTrace(); - } - - return obj; - } - -} diff --git a/services/sdk/sample/src/main/resources/collectionspace-client.properties b/services/sdk/sample/src/main/resources/collectionspace-client.properties deleted file mode 100644 index 927081034..000000000 --- a/services/sdk/sample/src/main/resources/collectionspace-client.properties +++ /dev/null @@ -1,6 +0,0 @@ -#url of the collectionspace server -cspace.url=http://localhost:8180/cspace-services/ -cspace.ssl=false -cspace.auth=false -cspace.user=test -cspace.password=test \ No newline at end of file diff --git a/services/systeminfo/client/pom.xml b/services/systeminfo/client/pom.xml new file mode 100644 index 000000000..775966de5 --- /dev/null +++ b/services/systeminfo/client/pom.xml @@ -0,0 +1,73 @@ + + + + org.collectionspace.services + org.collectionspace.services.systeminfo + 5.0-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.systeminfo.client + services.systeminfo.client + + + + + org.slf4j + slf4j-api + test + + + org.slf4j + slf4j-log4j12 + test + + + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.client + ${project.version} + + + + + + org.testng + testng + + + org.jboss.resteasy + resteasy-jaxrs + + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + + commons-httpclient + commons-httpclient + + + + + collectionspace-services-systeminfo-client + + + diff --git a/services/systeminfo/client/src/main/java/org/collectionspace/services/systeminfo/SystemInfoClient.java b/services/systeminfo/client/src/main/java/org/collectionspace/services/systeminfo/SystemInfoClient.java new file mode 100644 index 000000000..99455ef5a --- /dev/null +++ b/services/systeminfo/client/src/main/java/org/collectionspace/services/systeminfo/SystemInfoClient.java @@ -0,0 +1,13 @@ +package org.collectionspace.services.systeminfo; + +/** + * Client class for Structureddate service. + * @author remillet + * + */ +public class SystemInfoClient { + public static final String SERVICE_NAME = "systeminfo"; + public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; + public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; + public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; +} diff --git a/services/systeminfo/client/src/test/resources/log4j.properties b/services/systeminfo/client/src/test/resources/log4j.properties new file mode 100644 index 000000000..148a3e865 --- /dev/null +++ b/services/systeminfo/client/src/test/resources/log4j.properties @@ -0,0 +1,23 @@ +log4j.rootLogger=debug, stdout, R + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=target/test-client.log + +log4j.appender.R.MaxFileSize=100KB +# Keep one backup file +log4j.appender.R.MaxBackupIndex=1 + +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +#packages +log4j.logger.org.collectionspace=DEBUG +log4j.logger.org.apache=INFO +log4j.logger.httpclient=INFO +log4j.logger.org.jboss.resteasy=INFO diff --git a/services/systeminfo/jaxb/pom.xml b/services/systeminfo/jaxb/pom.xml new file mode 100644 index 000000000..67b666360 --- /dev/null +++ b/services/systeminfo/jaxb/pom.xml @@ -0,0 +1,34 @@ + + + + org.collectionspace.services.systeminfo + org.collectionspace.services + 5.0-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.systeminfo.jaxb + services.systeminfo.jaxb + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + + + collectionspace-services-systeminfo-jaxb + install + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + + + diff --git a/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd b/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd new file mode 100644 index 000000000..d35336f9e --- /dev/null +++ b/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/systeminfo/pom.xml b/services/systeminfo/pom.xml new file mode 100644 index 000000000..5a310f368 --- /dev/null +++ b/services/systeminfo/pom.xml @@ -0,0 +1,20 @@ + + + + org.collectionspace.services + org.collectionspace.services.main + 5.0-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.systeminfo + services.systeminfo + pom + + + client + jaxb + service + + + diff --git a/services/systeminfo/service/pom.xml b/services/systeminfo/service/pom.xml new file mode 100644 index 000000000..d92b5b366 --- /dev/null +++ b/services/systeminfo/service/pom.xml @@ -0,0 +1,79 @@ + + + + + org.collectionspace.services + org.collectionspace.services.systeminfo + 5.0-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.systeminfo.service + services.systeminfo.service + jar + + + + org.collectionspace.services + org.collectionspace.services.common + + + org.collectionspace.services + org.collectionspace.services.systeminfo.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.systeminfo.client + ${project.version} + + + + + + junit + junit + test + + + org.testng + testng + + + + + + javax.security + jaas + 1.0.01 + provided + + + + + + org.jboss.resteasy + resteasy-jaxrs + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + + + + collectionspace-services-systeminfo-service + + + diff --git a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoDocumentHandler.java b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoDocumentHandler.java new file mode 100644 index 000000000..6e59c9d54 --- /dev/null +++ b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoDocumentHandler.java @@ -0,0 +1,130 @@ +package org.collectionspace.services.systeminfo; + +import java.util.List; + +import org.collectionspace.services.common.api.RefName.RefNameInterface; +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.document.AbstractMultipartDocumentHandlerImpl; +import org.collectionspace.services.common.document.DocumentException; +import org.collectionspace.services.common.document.DocumentFilter; +import org.collectionspace.services.common.document.DocumentWrapper; +import org.collectionspace.services.lifecycle.Lifecycle; +import org.collectionspace.services.lifecycle.TransitionDef; +import org.nuxeo.ecm.core.api.DocumentModel; + +/* + * The StructedDate service uses non of these method. It exists only because it is needed to create a proper ServiceContext instance. + */ +public class SystemInfoDocumentHandler extends AbstractMultipartDocumentHandlerImpl, SystemInfoCommon, List> { + + @Override + public Lifecycle getLifecycle() { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public Lifecycle getLifecycle(String serviceObjectName) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleWorkflowTransition(ServiceContext ctx, DocumentWrapper wrapDoc, + TransitionDef transitionDef) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleCreate(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleUpdate(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleGet(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleGetAll(DocumentWrapper> wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void extractAllParts(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void fillAllParts(DocumentWrapper wrapDoc, + org.collectionspace.services.common.document.DocumentHandler.Action action) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public SystemInfoCommon extractCommonPart(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void fillCommonPart(SystemInfoCommon obj, DocumentWrapper wrapDoc) + throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public List extractCommonPartList(DocumentWrapper> wrapDoc) + throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public List extractPagingInfo(List theCommonList, + DocumentWrapper> wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public SystemInfoCommon getCommonPart() { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void setCommonPart(SystemInfoCommon obj) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public List getCommonPartList() { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void setCommonPartList(List obj) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public String getQProperty(String prop) throws DocumentException { + throw new RuntimeException("Unimplemented method."); + } + + @Override + protected String getRefnameDisplayName(DocumentWrapper docWrapper) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + protected RefNameInterface getRefName(DocumentWrapper docWrapper, String tenantName, + String serviceName) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public DocumentFilter createDocumentFilter() { + throw new RuntimeException("Unimplemented method."); + } +} diff --git a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoResource.java b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoResource.java new file mode 100644 index 000000000..bdc83d201 --- /dev/null +++ b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoResource.java @@ -0,0 +1,101 @@ +package org.collectionspace.services.systeminfo; + +import java.nio.charset.Charset; +import java.util.Locale; +import java.util.TimeZone; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.HttpMethod; + +import org.collectionspace.services.authorization.AuthZ; +import org.collectionspace.services.authorization.CSpaceAction; +import org.collectionspace.services.authorization.CSpaceResource; +import org.collectionspace.services.authorization.URIResourceImpl; +import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl; +import org.collectionspace.services.common.CSWebApplicationException; +import org.collectionspace.services.common.UriInfoWrapper; +import org.collectionspace.services.common.context.RemoteServiceContextFactory; +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.context.ServiceContextFactory; +import org.collectionspace.services.common.security.UnauthorizedException; + +@Path(SystemInfoClient.SERVICE_PATH) +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public class SystemInfoResource extends AbstractCollectionSpaceResourceImpl { + + @Override + public Class getCommonPartClass() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getServiceName() { + return SystemInfoClient.SERVICE_NAME; + } + + @Override + protected String getVersionString() { + // TODO Auto-generated method stub + return null; + } + + // + // API Endpoints + // + + @GET + public SystemInfoCommon get(@Context UriInfo ui) { + SystemInfoCommon result = null; + + try { + result = new SystemInfoCommon(); + result.setInstanceId("_default"); + result.setDisplayName("CollectionSpace Services v5.0 - remillet"); + Version ver = new Version(); + ver.setMajor("5"); + ver.setMinor("0"); + ver.setPatch("0"); + ver.setBuild("1"); + result.setVersion(ver); + + result.setHostTimezone(TimeZone.getDefault().getID()); + result.setHostLocale(Locale.getDefault().toLanguageTag()); + result.setHostCharset(Charset.defaultCharset().name()); + // + // To get the full set of the system information, we required the user be authenticated *and* have "DELETE" privs on the "systeminfo" resource + // + try { + ServiceContext ctx = createServiceContext(getServiceName(), ui); + CSpaceResource res = new URIResourceImpl(ctx.getTenantId(), SystemInfoClient.SERVICE_NAME, HttpMethod.DELETE); + if (AuthZ.get().isAccessAllowed(res)) { + result.setNuxeoVersionString("7.10-HF17"); + result.setHost(String.format("Architecture:%s Name:%s Version:%s", + System.getProperty("os.arch"), System.getProperty("os.name"), System.getProperty("os.version"))); + result.setJavaVersionString(System.getProperty("java.version")); + result.setPostgresVersionString("9.5.7"); + } + } catch (UnauthorizedException e) { + e.printStackTrace(); + } + + } catch(Exception e) { + Response response = Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).type("text/plain").build(); + throw new CSWebApplicationException(response); + } + + return result; + } + + @Override + public ServiceContextFactory getServiceContextFactory() { + return (ServiceContextFactory) RemoteServiceContextFactory.get(); + } +} diff --git a/services/collectionobject/sample/sample/src/main/resources/log4j.xml b/services/systeminfo/service/src/test/resources/log4j.xml similarity index 62% rename from services/collectionobject/sample/sample/src/main/resources/log4j.xml rename to services/systeminfo/service/src/test/resources/log4j.xml index d2890cbe8..52121cb83 100644 --- a/services/collectionobject/sample/sample/src/main/resources/log4j.xml +++ b/services/systeminfo/service/src/test/resources/log4j.xml @@ -9,26 +9,33 @@ + + + + + + + + + + + + - - + diff --git a/services/vocabulary/pom.xml b/services/vocabulary/pom.xml index bbf2a81e0..8e294340c 100644 --- a/services/vocabulary/pom.xml +++ b/services/vocabulary/pom.xml @@ -14,17 +14,6 @@ services.vocabulary pom - - - - jaxb service @@ -32,14 +21,5 @@ client - - - samples - - sample - - - - diff --git a/services/vocabulary/sample/pom.xml b/services/vocabulary/sample/pom.xml deleted file mode 100644 index 574b8fe6c..000000000 --- a/services/vocabulary/sample/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.vocabulary.client.samples - pom - 1.0 - vocabulary.client.samples - - - sample - - - diff --git a/services/vocabulary/sample/sample/pom.xml b/services/vocabulary/sample/sample/pom.xml deleted file mode 100644 index 6bf06cde5..000000000 --- a/services/vocabulary/sample/sample/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.vocabulary.client.sample - jar - 5.0-SNAPSHOT - vocabulary.client.sample - - - - org.collectionspace.services - org.collectionspace.services.vocabulary.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.client - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.vocabulary.client - ${project.version} - - - - - - libs-releases-local - libs-releases-local - http://nightly.collectionspace.org:8081/artifactory/libs-release-local - - true - - - false - - - - libs-snapshots-local - libs-snapshots-local - http://nightly.collectionspace.org:8081/artifactory/libs-snapshot-local - - false - - - true - - - - - collectionspace-releases - collectionspace-releases - http://nightly.collectionspace.org:8081/artifactory/nuxeo-public - - true - - - false - - - - nuxeo-public-snapshot - nuxeo-public-snapshot - http://nightly.collectionspace.org:8081/artifactory/nuxeo-public-snapshot - - false - - - true - - - - - - - vocabulary-client-sample - - - org.apache.maven.plugins - maven-assembly-plugin - - - - attached - - package - - - jar-with-dependencies - - - - org.collectionspace.services.vocabulary.client.sample.Sample - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - - diff --git a/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java b/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java deleted file mode 100644 index 897604a45..000000000 --- a/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java +++ /dev/null @@ -1,469 +0,0 @@ -/** - * This document is a part of the source code and related artifacts - * for CollectionSpace, an open source collections management system - * for museums and related institutions: - * - * http://www.collectionspace.org - * http://wiki.collectionspace.org - * - * Copyright (c)) 2009 Regents of the University of California - * - * Licensed under the Educational Community License (ECL), Version 2.0. - * You may not use this file except in compliance with this License. - * - * You may obtain a copy of the ECL 2.0 License at - * https://source.collectionspace.org/collection-space/LICENSE.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.collectionspace.services.vocabulary.client.sample; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - -import org.apache.log4j.BasicConfigurator; -//import org.collectionspace.services.VocabularyItemJAXBSchema; -import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; - -import org.collectionspace.services.client.PayloadInputPart; -import org.collectionspace.services.client.PoxPayloadIn; -import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.client.VocabularyClient; -import org.collectionspace.services.client.VocabularyClientUtils; -import org.collectionspace.services.client.test.ServiceRequestType; -import org.collectionspace.services.vocabulary.VocabulariesCommon; -import org.collectionspace.services.vocabulary.VocabulariesCommonList; -import org.collectionspace.services.vocabulary.VocabularyitemsCommon; -import org.collectionspace.services.vocabulary.VocabularyitemsCommonList; -import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.multipart.InputPart; -import org.jboss.resteasy.plugins.providers.multipart.OutputPart; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * VocabularyServiceTest, carries out tests against a - * deployed and running Vocabulary Service. - * - * $LastChangedRevision$ - * $LastChangedDate$ - */ -public class Sample { - private static final Logger logger = - LoggerFactory.getLogger(Sample.class); - - // Instance variables specific to this test. - private VocabularyClient client = new VocabularyClient(); - final String SERVICE_PATH_COMPONENT = "vocabularies"; - final String ITEM_SERVICE_PATH_COMPONENT = "items"; - - - // --------------------------------------------------------------- - // Create - // --------------------------------------------------------------- - - public void createEnumeration(String vocabName, List enumValues ) { - - // Expected status code: 201 Created - int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE; - - if(logger.isDebugEnabled()){ - logger.debug("Import: Create vocabulary: \"" + vocabName +"\""); - } - - String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix. - String baseVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, displaySuffix); //TODO: Laramie20100728 temp fix was vocabName, false - String fullVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, displaySuffix); //TODO: Laramie20100728 temp fix was vocabName, true - PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance( - vocabName, fullVocabRefName, client.getCommonPartName()); - ClientResponse res = client.create(multipart); - - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not create enumeration: \""+vocabName - +"\" "+ VocabularyClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when creating enumeration: \"" - +vocabName +"\", Status:"+ statusCode); - } - - // Store the ID returned from this create operation - // for additional tests below. - String newVocabId = VocabularyClientUtils.extractId(res); - if(logger.isDebugEnabled()){ - logger.debug("Import: Created vocabulary: \"" + vocabName +"\" ID:" - +newVocabId ); - } - for(String itemName : enumValues){ - HashMap itemInfo = new HashMap(); - itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, itemName); - VocabularyClientUtils.createItemInVocabulary(newVocabId, - baseVocabRefName, itemInfo, client); - } - } - - // --------------------------------------------------------------- - // Read - // --------------------------------------------------------------- - - private VocabulariesCommonList readVocabularies() { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - ClientResponse res = client.readList(); - VocabulariesCommonList list = res.getEntity(); - - int statusCode = res.getStatus(); - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read list of vocabularies: " - + VocabularyClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "list of vocabularies, Status:"+ statusCode); - } - - return list; - } - - private List readVocabularyIds(VocabulariesCommonList list) { - - List ids = new ArrayList(); - List vocabularies = - list.getVocabularyListItem(); - for (VocabulariesCommonList.VocabularyListItem vocabulary : vocabularies) { - ids.add(vocabulary.getCsid()); - } - return ids; - } - - private VocabulariesCommon readVocabulary(String vocabId) { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - VocabulariesCommon vocabulary = null; - try { - ClientResponse res = client.read(vocabId); - int statusCode = res.getStatus(); - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read vocabulary" - + VocabularyClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "vocabulary, Status:"+ statusCode); - } - PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); - vocabulary = (VocabulariesCommon) extractPart(input, - client.getCommonPartName(), VocabulariesCommon.class); - } catch (Exception e) { - throw new RuntimeException("Could not read vocabulary: ", e); - } - - return vocabulary; - } - - private VocabularyitemsCommonList readItemsInVocab(String vocabId) { - - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; - - // Submit the request to the service and store the response. - // readItemList(String inAuthority, String partialTerm, String keywords) - ClientResponse res = client.readItemList(vocabId, "", ""); //TODO: figure out these params. I just put in empty string to make it recompile after refactoring. Laramie20100728 - VocabularyitemsCommonList list = res.getEntity(); - - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not read items in vocabulary: " - + VocabularyClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when reading " + - "items in vocabulary, Status:"+ statusCode); - } - - return list; - } - - private List readVocabularyItemIds(VocabularyitemsCommonList list) { - - List ids = new ArrayList(); - List items = - list.getVocabularyitemListItem(); - for (VocabularyitemsCommonList.VocabularyitemListItem item : items) { - ids.add(item.getCsid()); - } - return ids; - } - - // --------------------------------------------------------------- - // Delete - // --------------------------------------------------------------- - - private void deleteVocabulary(String vcsid) { - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE; - - ClientResponse res = client.delete(vcsid); - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not delete vocabulary: " - + VocabularyClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when deleting " + - "vocabulary, Status:"+ statusCode); - } - } - - private void deleteAllVocabularies() { - List ids = readVocabularyIds(readVocabularies()); - for (String id : ids) { - deleteVocabulary(id); - } - } - - private void deleteVocabularyItem(String vcsid, String itemcsid) { - // Expected status code: 200 OK - int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); - // Type of service request being tested - ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE; - - ClientResponse res = client.deleteItem(vcsid, itemcsid); - int statusCode = res.getStatus(); - - if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not delete vocabulary item: " - + VocabularyClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - } - if(statusCode != EXPECTED_STATUS_CODE) { - throw new RuntimeException("Unexpected Status when deleting " + - "vocabulary item, Status:"+ statusCode); - } - } - - private void deleteAllItemsForVocab(String vocabId) { - List itemIds = readVocabularyItemIds(readItemsInVocab(vocabId)); - for (String itemId : itemIds) { - deleteVocabularyItem(vocabId, itemId); - } - } - - // --------------------------------------------------------------- - // Utility methods used by tests above - // --------------------------------------------------------------- - - // Retrieve individual fields of vocabulary records. - - private String displayAllVocabularies(VocabulariesCommonList list) { - StringBuffer sb = new StringBuffer(); - List vocabularies = - list.getVocabularyListItem(); - int i = 0; - for (VocabulariesCommonList.VocabularyListItem vocabulary : vocabularies) { - sb.append("vocabulary [" + i + "]" + "\n"); - sb.append(displayVocabularyDetails(vocabulary)); - i++; - } - return sb.toString(); - } - - private String displayVocabularyDetails( - VocabulariesCommonList.VocabularyListItem vocabulary) { - StringBuffer sb = new StringBuffer(); - sb.append("displayName=" + vocabulary.getDisplayName() + "\n"); - sb.append("vocabType=" + vocabulary.getVocabType() + "\n"); - // sb.append("csid=" + vocabulary.getCsid() + "\n"); - sb.append("URI=" + vocabulary.getUri() + "\n"); - return sb.toString(); - } - - // Retrieve individual fields of vocabulary item records. - - private String displayAllVocabularyItems(VocabularyitemsCommonList list) { - StringBuffer sb = new StringBuffer(); - List items = - list.getVocabularyitemListItem(); - int i = 0; - for (VocabularyitemsCommonList.VocabularyitemListItem item : items) { - sb.append("vocabulary item [" + i + "]" + "\n"); - sb.append(displayVocabularyItemDetails(item)); - i++; - } - return sb.toString(); - } - - private String displayVocabularyItemDetails( - VocabularyitemsCommonList.VocabularyitemListItem item) { - StringBuffer sb = new StringBuffer(); - sb.append("csid=" + item.getCsid() + "\n"); - sb.append("displayName=" + item.getDisplayName() + "\n"); - // sb.append("URI=" + item.getUri() + "\n"); - return sb.toString(); - } - - // TODO this should be moved to a common utils class - private Object extractPart(PoxPayloadIn input, String label, - Class clazz) throws Exception { - Object obj = null; - obj = input.getPart(label); - /* - for(PayloadInputPart part : input.getParts()){ - String partLabel = part.getHeaders().getFirst("label"); - if(label.equalsIgnoreCase(partLabel)){ - String partStr = part.getBodyAsString(); - if(logger.isDebugEnabled()){ - logger.debug("extracted part str=\n" + partStr); - } - obj = part.getBody(clazz, null); - if(logger.isDebugEnabled()){ - logger.debug("extracted part obj=\n", obj, clazz); - } - break; - } - } - */ - return obj; - } - - public static void main(String[] args) { - - // Configure logging. - BasicConfigurator.configure(); - - logger.info("VocabularyBaseImport starting..."); - - Sample vbi = new Sample(); - VocabulariesCommonList vocabularies; - List vocabIds; - String details = ""; - - // Optionally delete all vocabularies and vocabulary items. - - boolean ENABLE_DELETE_ALL = false; - if (ENABLE_DELETE_ALL) { - - logger.info("Deleting all vocabulary items and vocabularies ..."); - - // For each vocabulary ... - vocabularies = vbi.readVocabularies(); - vocabIds = vbi.readVocabularyIds(vocabularies); - for (String vocabId : vocabIds) { - logger.info("Deleting all vocabulary items for vocabulary ..."); - vbi.deleteAllItemsForVocab(vocabId); - logger.info("Deleting vocabulary ..."); - vbi.deleteVocabulary(vocabId); - } - - logger.info("Reading vocabularies after deletion ..."); - vocabularies = vbi.readVocabularies(); - details = vbi.displayAllVocabularies(vocabularies); - logger.info(details); - - logger.info("Reading items in each vocabulary after deletion ..."); - vocabIds = vbi.readVocabularyIds(vocabularies); - for (String vocabId : vocabIds) { - VocabularyitemsCommonList items = vbi.readItemsInVocab(vocabId); - details = vbi.displayAllVocabularyItems(items); - logger.info(details); - } - - } - - // Create new vocabularies, each populated with vocabulary items. - - final String acquisitionMethodsVocabName = "Acquisition Methods"; - final String entryMethodsVocabName = "Entry Methods"; - final String entryReasonsVocabName = "Entry Reasons"; - final String responsibleDeptsVocabName = "Responsible Departments"; - - List acquisitionMethodsEnumValues = - Arrays.asList("Gift","Purchase","Exchange","Transfer","Treasure"); - List entryMethodsEnumValues = - Arrays.asList("In person","Post","Found on doorstep"); - List entryReasonsEnumValues = - Arrays.asList("Enquiry","Commission","Loan"); - List respDeptNamesEnumValues = - Arrays.asList("Antiquities","Architecture and Design","Decorative Arts", - "Ethnography","Herpetology","Media and Performance Art", - "Paintings and Sculpture","Paleobotany","Photographs", - "Prints and Drawings"); - - vbi.createEnumeration(acquisitionMethodsVocabName, acquisitionMethodsEnumValues); - vbi.createEnumeration(entryMethodsVocabName, entryMethodsEnumValues); - vbi.createEnumeration(entryReasonsVocabName, entryReasonsEnumValues); - vbi.createEnumeration(responsibleDeptsVocabName, respDeptNamesEnumValues); - - logger.info("VocabularyBaseImport complete."); - - logger.info("Reading vocabularies and items ..."); - // Get a list of vocabularies. - vocabularies = vbi.readVocabularies(); - // For each vocabulary ... - for (VocabulariesCommonList.VocabularyListItem - vocabulary : vocabularies.getVocabularyListItem()) { - // Get its display name. - logger.info(vocabulary.getDisplayName()); - // Get a list of the vocabulary items in this vocabulary. - VocabularyitemsCommonList items = - vbi.readItemsInVocab(vocabulary.getCsid()); - // For each vocabulary item ... - for (VocabularyitemsCommonList.VocabularyitemListItem - item : items.getVocabularyitemListItem()) { - // Get its display name. - logger.info(" " + item.getDisplayName()); - } - } - - // Sample alternate methods of reading all vocabularies and - // vocabulary items separately. - boolean RUN_ADDITIONAL_SAMPLES = false; - if (RUN_ADDITIONAL_SAMPLES) { - - logger.info("Reading all vocabularies ..."); - details = vbi.displayAllVocabularies(vocabularies); - logger.info(details); - - logger.info("Reading all vocabulary items ..."); - vocabIds = vbi.readVocabularyIds(vocabularies); - for (String vocabId : vocabIds) { - VocabularyitemsCommonList items = vbi.readItemsInVocab(vocabId); - details = vbi.displayAllVocabularyItems(items); - logger.info(details); - } - - } - - } - -} diff --git a/services/vocabulary/sample/sample/src/main/resources/collectionspace-client.properties b/services/vocabulary/sample/sample/src/main/resources/collectionspace-client.properties deleted file mode 100644 index 927081034..000000000 --- a/services/vocabulary/sample/sample/src/main/resources/collectionspace-client.properties +++ /dev/null @@ -1,6 +0,0 @@ -#url of the collectionspace server -cspace.url=http://localhost:8180/cspace-services/ -cspace.ssl=false -cspace.auth=false -cspace.user=test -cspace.password=test \ No newline at end of file diff --git a/services/vocabulary/sample/sample/src/main/resources/log4j.xml b/services/vocabulary/sample/sample/src/main/resources/log4j.xml deleted file mode 100644 index e5241bc9f..000000000 --- a/services/vocabulary/sample/sample/src/main/resources/log4j.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.47.3