]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3451: Added a "delta" binding to the Hearst museum binding for a "natural_hist...
authorRichard Millet <richard.millet@berkeley.edu>
Wed, 18 May 2011 05:01:58 +0000 (05:01 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Wed, 18 May 2011 05:01:58 +0000 (05:01 +0000)
services/authorization-mgt/import/pom.xml
services/authorization-mgt/import/src/main/java/org/collectionspace/ImportAuthz.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java
services/common/src/main/cspace/config/services/tenants/XMLMerge-ReferenceDoc.pdf [new file with mode: 0644]
services/common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bindings.delta.xml
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml

index 4c63ff9577722c5fb817f08517ad28ec0189ee9c..ccbc9679c36caf5daedaa2ae520ac31e01f731c3 100644 (file)
@@ -13,6 +13,7 @@
     <artifactId>org.collectionspace.services.authorization-mgt.import</artifactId>\r
     <name>services.authorization-mgt.import</name>\r
     <properties>\r
+        <generate_only>false</generate_only>\r
         <spring.version>3.0.0.RELEASE</spring.version>\r
         <spring.security.version>3.0.2.RELEASE</spring.security.version>\r
     </properties>\r
                 <configuration>\r
                     <mainClass>org.collectionspace.ImportAuthz</mainClass>\r
                     <arguments>\r
+                        <argument>-g</argument>\r
+                        <argument>${generate_only}</argument>\r
                         <argument>-u</argument>\r
                         <argument>SPRING_ADMIN</argument>\r
                         <argument>-p</argument>\r
index 3d53943ca4b5c404fc386a0cd704d099d66038e8..72bf143569971605d8110dff08d4c87e28e09145 100644 (file)
@@ -41,6 +41,7 @@ import org.collectionspace.services.authorization.driver.AuthorizationSeedDriver
  */
 public class ImportAuthz {
 
+       final private static String OPTIONS_GENERATE_ONLY = "generate only";
     final private static String OPTIONS_USERNAME = "username";
     final private static String OPTIONS_PASSWORD = "password";
     final private static String OPTIONS_TENANT_BINDING = "tenant binding file";
@@ -50,6 +51,13 @@ public class ImportAuthz {
 
     final private static String MSG_SEPARATOR = "--";
 
+    final private static boolean generateOnly(String param) {
+       boolean result = false;
+       if (param != null) {
+               result = Boolean.parseBoolean(param);
+       }
+       return result;
+    }
     public static void main(String[] args) {
 
         Options options = createOptions();
@@ -62,6 +70,7 @@ public class ImportAuthz {
                 printUsage();
                 System.exit(1);
             }
+            String generate_only = line.getOptionValue("g");
             String user = line.getOptionValue("u");
             String password = line.getOptionValue("p");
             String tenantBinding = line.getOptionValue("b");
@@ -73,7 +82,15 @@ public class ImportAuthz {
             AuthorizationSeedDriver driver = new AuthorizationSeedDriver(
                     user, password, tenantBinding, exportDir);
             driver.generate();
-            driver.seed();
+            //
+            // If the "-g" option was set, then we will NOT seed the AuthZ tables.  Instead, we'll
+            // just merge the prototypical tenant bindings and generate the permissions XML output
+            //
+            if (generateOnly(generate_only) == false) {
+               driver.seed();
+            } {
+               System.out.println("WARNING: '-g' was set to 'true' so AuthZ tables were not seeded.");
+            }
         } catch (ParseException exp) {
             // oops, something went wrong
             System.err.println("Parsing failed.  Reason: " + exp.getMessage());
@@ -101,6 +118,7 @@ public class ImportAuthz {
 
     private static Options createOptions() {
         Options options = new Options();
+        options.addOption("g", true, OPTIONS_GENERATE_ONLY);
         options.addOption("u", true, OPTIONS_USERNAME);
         options.addOption("p", true, OPTIONS_PASSWORD);
         options.addOption("b", true, OPTIONS_TENANT_BINDING);
@@ -113,6 +131,7 @@ public class ImportAuthz {
         StringBuilder sb = new StringBuilder();
         sb.append("\nUsage : java -cp <classpath> " + ImportAuthz.class.getName() + " <options>");
         sb.append("\nOptions :");
+        sb.append("\n   -g  <" + OPTIONS_GENERATE_ONLY + "> generate only, do not seed AuthZ values in the security tables");        
         sb.append("\n   -u  <" + OPTIONS_USERNAME + "> cspace username");
         sb.append("\n   -p  <" + OPTIONS_PASSWORD + "> password");
         sb.append("\n   -b  <" + OPTIONS_TENANT_BINDING + "> tenant binding file (fully qualified path)");
index 037820678704a0ebccd50f9c16a6e9d8f9678b42..3d1ddc0f4dcadc048b6678240d348bf2881727c5 100644 (file)
@@ -633,6 +633,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         Assert.assertNotNull(dimensionsGroups.get(0));
         Assert.assertNotNull(dimensionsGroups.get(0).getMeasuredPart());
 
+        /* No longer part of the "default" domain service tests for the CollectionObject record.
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": Reading Natural History part ...");
         }
@@ -641,6 +642,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         // can add specific field-level checks as warranted.
         Object conh = extractPartValue(testName, res, getNHPartName());
         Assert.assertNotNull(conh);
+        */
     }
 
     // Failure outcomes
diff --git a/services/common/src/main/cspace/config/services/tenants/XMLMerge-ReferenceDoc.pdf b/services/common/src/main/cspace/config/services/tenants/XMLMerge-ReferenceDoc.pdf
new file mode 100644 (file)
index 0000000..f587b59
Binary files /dev/null and b/services/common/src/main/cspace/config/services/tenants/XMLMerge-ReferenceDoc.pdf differ
index 6e49aff2c6632b093a5b304637625d2515011ff9..0bb7dd538e961ac83f09bc06c4476e0856c8c57a 100644 (file)
@@ -4,7 +4,19 @@
        xmlns:tenant='http://collectionspace.org/services/common/tenant'>
                 
   <tenant:tenantBinding id="2" name="hearstmuseum.berkeley.edu" displayName="Phoebe A. Hearst Museum of Anthropology" version="0.1">
+
     <tenant:repositoryDomain name="default-domain" storageName="hearst-domain" repositoryClient="nuxeo-java" />
+       
+       <tenant:serviceBindings merge:matcher="id" id="CollectionObjects">
+               <service:object xmlns:service="http://collectionspace.org/services/common/service" >
+                       <service:part id="3" merge:matcher="skip" merge:action="insert" control_group="Managed" versionable="true" auditable="false" label="collectionobjects_naturalhistory" updated="" order="3">
+                         <service:content contentType="application/xml">
+                               <service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject/domain/naturalhistory" schemaLocation="http://collectionspace.org/services/collectionobject/domain/naturalhistory http://collectionspace.org/services/collectionobject/domain/collectionobjects_naturalhistory.xsd" />
+                         </service:content>
+                       </service:part>
+               </service:object>
+       </tenant:serviceBindings>
+       
   </tenant:tenantBinding>
                       
 </tenant:TenantBindingConfig>
index 60f83a20a2884c78fdb4d53c2f3bfc241810f3d8..37597ff15755d8470e706b51902a54b81044ce85 100644 (file)
@@ -28,7 +28,7 @@
         <types:value>en</types:value>
       </types:item>
       <!-- <types:item><types:key>localeLanguage</types:key><types:value>da</types:value></types:item> -->
-    </tenant:properties>
+    </tenant:properties>               
     <!-- begin idgenerators service meta-data -->
     <tenant:serviceBindings name="idgenerators" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /idgenerators/*/ids
             </service:uriPath> -->
-    </tenant:serviceBindings>
+    </tenant:serviceBindings>  
     <!-- end id service meta-data -->
     <!-- begin collectionobject service meta-data -->
-    <tenant:serviceBindings name="CollectionObjects" type="object" version="0.1">
+    <tenant:serviceBindings id="CollectionObjects" name="CollectionObjects" type="object" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/collectionobjects/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
             <service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject" schemaLocation="http://collectionspace.org/services/collectionobject http://services.collectionspace.org/collectionobject/collectionobjects_common.xsd" />
           </service:content>
         </service:part>
-        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionobjects_naturalhistory" updated="" order="2">
-          <service:content contentType="application/xml">
-            <service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject/domain/naturalhistory" schemaLocation="http://collectionspace.org/services/collectionobject/domain/naturalhistory http://collectionspace.org/services/collectionobject/domain/collectionobjects_naturalhistory.xsd" />
-          </service:content>
-        </service:part>
-        <service:part id="3" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="3">
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
           <service:content contentType="application/xml">
             <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
           </service:content>