]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
NOJIRA account service in testing phase. added jaxb-jpa for default security identify...
authorSanjay Dalal <sanjay.dalal@berkeley.edu>
Sat, 21 Nov 2009 00:32:42 +0000 (00:32 +0000)
committerSanjay Dalal <sanjay.dalal@berkeley.edu>
Sat, 21 Nov 2009 00:32:42 +0000 (00:32 +0000)
A    services/authentication/jaxb
A    services/authentication/jaxb/src
A    services/authentication/jaxb/src/test
A    services/authentication/jaxb/src/test/java
A    services/authentication/jaxb/src/test/java/org
A    services/authentication/jaxb/src/test/java/org/collectionspace
A    services/authentication/jaxb/src/test/java/org/collectionspace/services
A    services/authentication/jaxb/src/test/java/org/collectionspace/services/authentication
A    services/authentication/jaxb/src/test/java/org/collectionspace/services/authentication/test
A    services/authentication/jaxb/src/test/java/org/collectionspace/services/authentication/test/DefaultIdentityProviderTest.java
A    services/authentication/jaxb/src/test/resources
A    services/authentication/jaxb/src/test/resources/META-INF
A    services/authentication/jaxb/src/test/resources/META-INF/persistence.xml
A    services/authentication/jaxb/src/test/resources/log4j.properties
A    services/authentication/jaxb/src/test/resources/hibernate.cfg.xml
A    services/authentication/jaxb/src/main
A    services/authentication/jaxb/src/main/java
A    services/authentication/jaxb/src/main/java/org
A    services/authentication/jaxb/src/main/java/org/collectionspace
A    services/authentication/jaxb/src/main/java/org/collectionspace/services
A    services/authentication/jaxb/src/main/resources
A    services/authentication/jaxb/src/main/resources/authentication_identity_provider.xsd
A    services/authentication/jaxb/src/main/resources/META-INF
A    services/authentication/jaxb/src/main/resources/META-INF/persistence.xml
A    services/authentication/jaxb/pom.xml
M    services/authentication/pom.xml
M    services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
M    services/JaxRsServiceProvider/src/main/webapp/WEB-INF/jboss-web.xml
M    services/JaxRsServiceProvider/src/main/webapp/WEB-INF/web.xml
M    services/JaxRsServiceProvider/pom.xml
M    services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClient.java
M    services/common/src/main/java/org/collectionspace/services/common/config/TenantBindingConfigReader.java
M    services/common/src/main/java/org/collectionspace/services/common/document/AbstractMultipartDocumentHandler.java
M    services/common/src/main/config/tenant-bindings.xml
M    services/pom.xml
A    services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java
M    services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountHandlerFactory.java
M    services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java
M    services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java
M    services/account/service/pom.xml
M    services/account/jaxb/src/main/resources/META-INF/persistence.xml
M    services/account/jaxb/src/main/resources/accounts_common.xsd
M    services/account/jaxb/src/main/resources/db/mysql/account.sql
M    services/account/jaxb/pom.xml
_M   services/account/client
A    services/account/client/src/test/java/org/collectionspace/services/client/test/AccountServiceTest.java
A    services/account/client/src/test/java/org/collectionspace/services/client/AccountClient.java
A    services/account/client/src/test/java/org/collectionspace/services/client/AccountProxy.java

29 files changed:
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/JaxRsServiceProvider/src/main/webapp/WEB-INF/jboss-web.xml
services/JaxRsServiceProvider/src/main/webapp/WEB-INF/web.xml
services/account/client/src/test/java/org/collectionspace/services/client/AccountClient.java [new file with mode: 0644]
services/account/client/src/test/java/org/collectionspace/services/client/AccountProxy.java [new file with mode: 0644]
services/account/client/src/test/java/org/collectionspace/services/client/test/AccountServiceTest.java [new file with mode: 0644]
services/account/jaxb/pom.xml
services/account/jaxb/src/main/resources/META-INF/persistence.xml
services/account/jaxb/src/main/resources/accounts_common.xsd
services/account/jaxb/src/main/resources/db/mysql/account.sql
services/account/service/pom.xml
services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountHandlerFactory.java
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java [new file with mode: 0644]
services/authentication/jaxb/pom.xml [new file with mode: 0644]
services/authentication/jaxb/src/main/resources/META-INF/persistence.xml [new file with mode: 0644]
services/authentication/jaxb/src/main/resources/authentication_identity_provider.xsd [new file with mode: 0644]
services/authentication/jaxb/src/test/java/org/collectionspace/services/authentication/test/DefaultIdentityProviderTest.java [new file with mode: 0644]
services/authentication/jaxb/src/test/resources/META-INF/persistence.xml [new file with mode: 0644]
services/authentication/jaxb/src/test/resources/hibernate.cfg.xml [new file with mode: 0644]
services/authentication/jaxb/src/test/resources/log4j.properties [new file with mode: 0644]
services/authentication/pom.xml
services/common/src/main/config/tenant-bindings.xml
services/common/src/main/java/org/collectionspace/services/common/config/TenantBindingConfigReader.java
services/common/src/main/java/org/collectionspace/services/common/document/AbstractMultipartDocumentHandler.java
services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClient.java
services/pom.xml

index db4a04768bb4fe0745eb1e231729a78b45b3b456..c57d1261a50094418ad1a6b0b2f329000499390d 100644 (file)
             <artifactId>org.collectionspace.services.common</artifactId>\r
             <version>1.0</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.account.service</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.collectionobject.service</artifactId>\r
index a801ccb0ecefdd0b900e79e360d2bf330d8e9e29..3b1d095ae6be2e1f50aadf5271bbef930d85ca3f 100644 (file)
@@ -1,5 +1,6 @@
 package org.collectionspace.services.jaxrs;
 
+import org.collectionspace.services.account.AccountResource;
 import org.collectionspace.services.collectionobject.CollectionObjectResource;
 import org.collectionspace.services.id.IDResource;
 import org.collectionspace.services.intake.IntakeResource;
@@ -22,6 +23,7 @@ public class CollectionSpaceJaxRsApplication extends Application {
     private Set<Class<?>> empty = new HashSet<Class<?>>();
 
     public CollectionSpaceJaxRsApplication() {
+        singletons.add(new AccountResource());
         singletons.add(new CollectionObjectResource());
         singletons.add(new IDResource());
         singletons.add(new IntakeResource());
index 33a2262182f718600c02d1540e26ad14b9cef530..10a4024eb789d4adda9a8e6a46ea66bf3215d4fa 100644 (file)
@@ -1,6 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <jboss-web>\r
   <!-- All secure web resources will use this security domain -->\r
-  <security-domain>java:/jaas/cspace</security-domain>\r
-  <context-root>/cspace-services</context-root>\r
+    <security-domain>java:/jaas/cspace</security-domain>\r
+    <context-root>/cspace-services</context-root>\r
+    <resource-ref>\r
+        <description>DB Connection</description>\r
+        <res-ref-name>jdbc/cspaceds</res-ref-name>\r
+        <res-type>javax.sql.DataSource</res-type>\r
+        <jndi-name>java:/cspaceds</jndi-name>\r
+        <res-auth>Container</res-auth>\r
+    </resource-ref>\r
 </jboss-web>\r
index 6d52948b73677c25a88411811d7f713450ecc0f9..62d9b25b989d07ca6fdf771dd69ca24302ca24e8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
 <!--
     Document   : web.xml
     Created on : May 19, 2009, 1:31 PM
@@ -7,7 +8,6 @@
     Description:
         service layer web application
 -->
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
 <web-app>
     <display-name>CollectionSpace Services</display-name>
 
         <realm-name>CollectionSpace realm</realm-name>
     </login-config>
  END AUTH -->
+    <resource-ref>
+        <description>DB Connection</description>
+        <res-ref-name>jdbc/cspaceds</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+    </resource-ref>
 </web-app>
diff --git a/services/account/client/src/test/java/org/collectionspace/services/client/AccountClient.java b/services/account/client/src/test/java/org/collectionspace/services/client/AccountClient.java
new file mode 100644 (file)
index 0000000..dd06c37
--- /dev/null
@@ -0,0 +1,128 @@
+/**    
+ * AccountClient.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 (C) 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.client;
+
+import javax.ws.rs.core.Response;
+
+
+import org.collectionspace.services.account.AccountsCommon;
+import org.collectionspace.services.account.AccountsCommonList;
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * A AccountClient.
+
+ * @version $Revision:$
+ */
+public class AccountClient extends BaseServiceClient {
+
+    /**
+     *
+     */
+    private AccountProxy accountProxy;
+    
+       /* (non-Javadoc)
+        * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
+        */
+       public String getServicePathComponent() {
+               return "accounts";
+       }
+
+    /**
+     *
+     * Default constructor for AccountClient class.
+     *
+     */
+    public AccountClient() {
+        ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+        RegisterBuiltin.register(factory);
+        setProxy();
+    }
+
+    /**
+     * allow to reset proxy as per security needs
+     */
+    public void setProxy() {
+        if(useAuth()){
+            accountProxy = ProxyFactory.create(AccountProxy.class,
+                    getBaseURL(), getHttpClient());
+        }else{
+            accountProxy = ProxyFactory.create(AccountProxy.class,
+                    getBaseURL());
+        }
+    }
+
+    /**
+     * @return
+     * @see org.collectionspace.hello.client.AccountProxy#readList()
+     */
+    public ClientResponse<AccountsCommonList> readList() {
+        return accountProxy.readList();
+
+    }
+
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.hello.client.AccountProxy#getAccount(java.lang.String)
+     */
+    public ClientResponse<AccountsCommon> read(String csid) {
+        return accountProxy.read(csid);
+    }
+
+    /**
+     * @param account
+     * @return
+     * @see org.collectionspace.hello.client.AccountProxy#create(org.collectionspace.services.account.AccountsCommon)
+     */
+    public ClientResponse<Response> create(AccountsCommon multipart) {
+        return accountProxy.create(multipart);
+    }
+
+    /**
+     * @param csid
+     * @param account
+     * @return
+     * @see org.collectionspace.hello.client.AccountProxy#updateAccount(java.lang.Long, org.collectionspace.services.account.AccountsCommon)
+     */
+    public ClientResponse<AccountsCommon> update(String csid, AccountsCommon multipart) {
+        return accountProxy.update(csid, multipart);
+    }
+
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.hello.client.AccountProxy#deleteAccount(java.lang.Long)
+     */
+    public ClientResponse<Response> delete(String csid) {
+        return accountProxy.delete(csid);
+    }
+}
diff --git a/services/account/client/src/test/java/org/collectionspace/services/client/AccountProxy.java b/services/account/client/src/test/java/org/collectionspace/services/client/AccountProxy.java
new file mode 100644 (file)
index 0000000..d3a98ad
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * AccountProxy.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 (C) 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.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+
+import org.collectionspace.services.account.AccountsCommon;
+import org.collectionspace.services.account.AccountsCommonList;
+import org.jboss.resteasy.client.ClientResponse;
+
+
+
+/**
+ * @version $Revision:$
+ */
+@Path("/accounts/")
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface AccountProxy {
+
+    @GET
+    @Produces({"application/xml"})
+    ClientResponse<AccountsCommonList> readList();
+
+    //(C)reate
+    @POST
+    ClientResponse<Response> create(AccountsCommon multipart);
+
+    //(R)ead
+    @GET
+    @Path("/{csid}")
+    ClientResponse<AccountsCommon> read(@PathParam("csid") String csid);
+
+    //(U)pdate
+    @PUT
+    @Path("/{csid}")
+    ClientResponse<AccountsCommon> update(@PathParam("csid") String csid, AccountsCommon multipart);
+
+    //(D)elete
+    @DELETE
+    @Path("/{csid}")
+    ClientResponse<Response> delete(@PathParam("csid") String csid);
+}
diff --git a/services/account/client/src/test/java/org/collectionspace/services/client/test/AccountServiceTest.java b/services/account/client/src/test/java/org/collectionspace/services/client/test/AccountServiceTest.java
new file mode 100644 (file)
index 0000000..881d934
--- /dev/null
@@ -0,0 +1,430 @@
+/**
+ * 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.client.test;
+
+import java.util.List;
+import javax.ws.rs.core.Response;
+
+import org.apache.commons.codec.binary.Base64;
+import org.collectionspace.services.client.AccountClient;
+import org.collectionspace.services.account.AccountsCommon;
+import org.collectionspace.services.account.AccountsCommonList;
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * AccountServiceTest, carries out tests against a
+ * deployed and running Account Service.
+ * 
+ * $LastChangedRevision: 917 $
+ * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
+ */
+public class AccountServiceTest extends AbstractServiceTest {
+
+    private final Logger logger =
+            LoggerFactory.getLogger(AccountServiceTest.class);
+    // Instance variables specific to this test.
+    private AccountClient client = new AccountClient();
+    private String knownResourceId = null;
+
+    /*
+     * This method is called only by the parent class, AbstractServiceTest
+     */
+    @Override
+    protected String getServicePathComponent() {
+        return client.getServicePathComponent();
+    }
+
+    // ---------------------------------------------------------------
+    // CRUD tests : CREATE tests
+    // ---------------------------------------------------------------
+    // Success outcomes
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class)
+    public void create(String testName) throws Exception {
+
+        // Perform setup, such as initializing the type of service request
+        // (e.g. CREATE, DELETE), its valid and expected status codes, and
+        // its associated HTTP method name (e.g. POST, DELETE).
+        setupCreate(testName);
+
+        // Submit the request to the service and store the response.
+        AccountsCommon account =
+                createAccountInstance("sanjay", "hello");
+        ClientResponse<Response> res = client.create(account);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        //
+        // Specifically:
+        // Does it fall within the set of valid status codes?
+        // Does it exactly match the expected status code?
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+        // Store the ID returned from this create operation
+        // for additional tests below.
+        knownResourceId = extractId(res);
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": knownResourceId=" + knownResourceId);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.ServiceTest#createList()
+     */
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class,
+    dependsOnMethods = {"create"})
+    public void createList(String testName) throws Exception {
+        for (int i = 0; i < 3; i++) {
+            create(testName);
+        }
+    }
+
+    // Failure outcomes
+    // Placeholders until the three tests below can be uncommented.
+    // See Issue CSPACE-401.
+    @Override
+    public void createWithEmptyEntityBody(String testName) throws Exception {
+    }
+
+    @Override
+    public void createWithMalformedXml(String testName) throws Exception {
+    }
+
+    @Override
+    public void createWithWrongXmlSchema(String testName) throws Exception {
+    }
+
+    // ---------------------------------------------------------------
+    // CRUD tests : READ tests
+    // ---------------------------------------------------------------
+    // Success outcomes
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class,
+    dependsOnMethods = {"create"})
+    public void read(String testName) throws Exception {
+
+        // Perform setup.
+        setupRead(testName);
+
+        // Submit the request to the service and store the response.
+        ClientResponse<AccountsCommon> res = client.read(knownResourceId);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+        AccountsCommon output = (AccountsCommon) res.getEntity();
+        Assert.assertNotNull(output);
+    }
+
+    // Failure outcomes
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class,
+    dependsOnMethods = {"read"})
+    public void readNonExistent(String testName) throws Exception {
+
+        // Perform setup.
+        setupReadNonExistent(testName);
+
+        // Submit the request to the service and store the response.
+        ClientResponse<AccountsCommon> res = client.read(NON_EXISTENT_ID);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+    }
+
+    // ---------------------------------------------------------------
+    // CRUD tests : READ_LIST tests
+    // ---------------------------------------------------------------
+    // Success outcomes
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class,
+    dependsOnMethods = {"createList", "read"})
+    public void readList(String testName) throws Exception {
+
+        // Perform setup.
+        setupReadList(testName);
+
+        // Submit the request to the service and store the response.
+        ClientResponse<AccountsCommonList> res = client.readList();
+        AccountsCommonList list = res.getEntity();
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+        // Optionally output additional data about list members for debugging.
+        boolean iterateThroughList = false;
+        if (iterateThroughList && logger.isDebugEnabled()) {
+            List<AccountsCommonList.AccountListItem> items =
+                    list.getAccountListItem();
+            int i = 0;
+
+            for (AccountsCommonList.AccountListItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] csid=" +
+                        item.getCsid());
+                logger.debug(testName + ": list-item[" + i + "] anchorName=" +
+                        item.getAnchorName());
+                logger.debug(testName + ": list-item[" + i + "] URI=" +
+                        item.getUri());
+                i++;
+
+            }
+        }
+    }
+
+    // Failure outcomes
+    // None at present.
+    // ---------------------------------------------------------------
+    // CRUD tests : UPDATE tests
+    // ---------------------------------------------------------------
+    // Success outcomes
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class,
+    dependsOnMethods = {"read"})
+    public void update(String testName) throws Exception {
+
+        // Perform setup.
+        setupUpdate(testName);
+
+        ClientResponse<AccountsCommon> res =
+                client.read(knownResourceId);
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("got object to update with ID: " + knownResourceId);
+        }
+        MultipartInput input = (MultipartInput) res.getEntity();
+        AccountsCommon toUpdateAccount =
+                (AccountsCommon) extractPart(input,
+                client.getCommonPartName(), AccountsCommon.class);
+        Assert.assertNotNull(toUpdateAccount);
+
+        // Update the content of this resource.
+        toUpdateAccount.setEmail("updated-" + toUpdateAccount.getEmail());
+        toUpdateAccount.setPhone("updated-" + toUpdateAccount.getPhone());
+        if (logger.isDebugEnabled()) {
+            logger.debug("updated object");
+            logger.debug(objectAsXmlString(toUpdateAccount,
+                    AccountsCommon.class));
+        }
+
+        // Submit the request to the service and store the response.
+        res = client.update(knownResourceId, toUpdateAccount);
+        int statusCode = res.getStatus();
+        // Check the status code of the response: does it match the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+
+        AccountsCommon updatedAccount = (AccountsCommon)res.getEntity();
+        Assert.assertNotNull(updatedAccount);
+
+        Assert.assertEquals(updatedAccount.getEmail(),
+                toUpdateAccount.getPhone(),
+                "Data in updated object did not match submitted data.");
+
+    }
+
+    // Failure outcomes
+    // Placeholders until the three tests below can be uncommented.
+    // See Issue CSPACE-401.
+    @Override
+    public void updateWithEmptyEntityBody(String testName) throws Exception {
+    }
+
+    @Override
+    public void updateWithMalformedXml(String testName) throws Exception {
+    }
+
+    @Override
+    public void updateWithWrongXmlSchema(String testName) throws Exception {
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class,
+    dependsOnMethods = {"update", "testSubmitRequest"})
+    public void updateNonExistent(String testName) throws Exception {
+
+        // Perform setup.
+        setupUpdateNonExistent(testName);
+
+        // Submit the request to the service and store the response.
+        //
+        // Note: The ID used in this 'create' call may be arbitrary.
+        // The only relevant ID may be the one used in updateAccount(), below.
+        AccountsCommon account =
+                createAccountInstance("dalal", "junk");
+        ClientResponse<AccountsCommon> res =
+                client.update(NON_EXISTENT_ID, account);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+    }
+
+    // ---------------------------------------------------------------
+    // CRUD tests : DELETE tests
+    // ---------------------------------------------------------------
+    // Success outcomes
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class,
+    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+    public void delete(String testName) throws Exception {
+
+        // Perform setup.
+        setupDelete(testName);
+
+        // Submit the request to the service and store the response.
+        ClientResponse<Response> res = client.delete(knownResourceId);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+    }
+
+    // Failure outcomes
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTest.class,
+    dependsOnMethods = {"delete"})
+    public void deleteNonExistent(String testName) throws Exception {
+
+        // Perform setup.
+        setupDeleteNonExistent(testName);
+
+        // Submit the request to the service and store the response.
+        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+    }
+
+    // ---------------------------------------------------------------
+    // Utility tests : tests of code used in tests above
+    // ---------------------------------------------------------------
+    /**
+     * Tests the code for manually submitting data that is used by several
+     * of the methods above.
+     */
+    @Test(dependsOnMethods = {"create", "read"})
+    public void testSubmitRequest() throws Exception {
+
+        // Expected status code: 200 OK
+        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
+
+        // Submit the request to the service and store the response.
+        String method = ServiceRequestType.READ.httpMethodName();
+        String url = getResourceURL(knownResourceId);
+        int statusCode = submitRequest(method, url);
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug("testSubmitRequest: url=" + url +
+                    " status=" + statusCode);
+        }
+        Assert.assertEquals(statusCode, EXPECTED_STATUS);
+
+    }
+
+    // ---------------------------------------------------------------
+    // Utility methods used by tests above
+    // ---------------------------------------------------------------
+    private AccountsCommon createAccountInstance(String anchorName,
+            String passwd) {
+
+        AccountsCommon account = new AccountsCommon();
+        account.setAnchorName(anchorName);
+        account.setUserName(anchorName);
+        byte[] b64passwd = Base64.encodeBase64(passwd.getBytes());
+        account.setPassword(b64passwd);
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("to be created, account common");
+            logger.debug(objectAsXmlString(account,
+                    AccountsCommon.class));
+        }
+        return account;
+
+    }
+
+}
index f4e8dff2e3bcb9bae63548924988e756089bb19a..77362573494e9d35324205f7215a03f04d8b9e91 100644 (file)
                         <executions>
                             <execution>
                             
-                                <phase>process-test-classes</phase>
+                                <phase>process-test-resources</phase>
                                 <goals>
                                     <goal>hbm2ddl</goal>
                                 </goals>
index 70e1e5dd3e84cbc4e612278b84b981e8469c066f..74090142f6a9e1e56c1b7b80fb4a33f2ca595fc4 100644 (file)
@@ -2,7 +2,8 @@
 <persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
 http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <persistence-unit name="org.collectionspace.services.account">
-        <non-jta-data-source>java:/CSpaceDS</non-jta-data-source>
+        <provider>org.hibernate.ejb.HibernatePersistence</provider>
+        <jta-data-source>cspaceds</jta-data-source>
         <class>org.collectionspace.services.account.AccountsCommon</class>
         <class>org.collectionspace.services.account.AccountsCommonList</class>
         <class>org.collectionspace.services.account.AccountsCommonList$AccountListItem</class>
index c93750bac91dd2ac4fd4bd19d2ec3125ff4aeba0..8d40271382e5a67d9fffa25f72a99cc4d27ffc0d 100644 (file)
                 <xs:element name="email" type="xs:string" minOccurs="1" maxOccurs="1" />
                 <xs:element name="phone" type="xs:string"/>
 
+                <!-- optional username for default identity provider -->
+                <xs:element name="userName" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <!-- optional base64 encoded password for default identity provider -->
+                <xs:element name="password" type="xs:base64Binary" minOccurs="0" maxOccurs="1" />
             </xs:sequence>
             <xs:attribute name="csid" type="xs:string">
                 <xs:annotation>
index 4e9d9e6f90bf7fc7bd4d71853eaaa1492a237a1c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,8 +0,0 @@
-alter table ACCOUNTLISTITEM drop foreign key FKBD8755BE37E86A94;
-drop table if exists ACCOUNTLISTITEM;
-drop table if exists ACCOUNTSCOMMON;
-drop table if exists ACCOUNTSCOMMONLIST;
-create table ACCOUNTLISTITEM (HJID bigint not null auto_increment, ANCHORNAME varchar(255), CSID varchar(255), EMAIL varchar(255), FIRSTNAME varchar(255), LASTNAME varchar(255), MI varchar(255), URI varchar(255), ACCOUNTLISTITEM_ACCOUNTSCOMM_0 bigint, primary key (HJID));
-create table ACCOUNTSCOMMON (CSID varchar(255) not null, ANCHORNAME varchar(255), EMAIL varchar(255), FIRSTNAME varchar(255), LASTNAME varchar(255), MI varchar(255), PHONE varchar(255), primary key (CSID));
-create table ACCOUNTSCOMMONLIST (HJID bigint not null auto_increment, primary key (HJID));
-alter table ACCOUNTLISTITEM add index FKBD8755BE37E86A94 (ACCOUNTLISTITEM_ACCOUNTSCOMM_0), add constraint FKBD8755BE37E86A94 foreign key (ACCOUNTLISTITEM_ACCOUNTSCOMM_0) references ACCOUNTSCOMMONLIST (HJID);
index 38c3fa08abd45535ea81963c3b4990cb75d908ea..85138a9adf4db8b2b381d00acc6b0ae890c73ce5 100644 (file)
             <artifactId>org.collectionspace.services.common</artifactId>\r
             <version>1.0</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.account.jaxb</artifactId>\r
index 014022c69b9f04183d5a71abb140e3eab060c7c5..933f1b606549b7bfaaac89e77d114380e2b067b8 100644 (file)
@@ -37,12 +37,16 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
 
+import org.collectionspace.services.account.storage.AccountHandlerFactory;
+import org.collectionspace.services.account.storage.AccountStorageClient;
 import org.collectionspace.services.common.AbstractCollectionSpaceResource;
+import org.collectionspace.services.common.context.MultipartServiceContext;
 import org.collectionspace.services.common.context.RemoteServiceContextImpl;
 import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentHandler;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.collectionspace.services.common.storage.StorageClient;
 import org.jboss.resteasy.util.HttpResponseCodes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,6 +59,7 @@ public class AccountResource
 
     final private String serviceName = "accounts";
     final Logger logger = LoggerFactory.getLogger(AccountResource.class);
+    final StorageClient storageClient = new AccountStorageClient();
 
     @Override
     public String getServiceName() {
@@ -64,19 +69,31 @@ public class AccountResource
     private <T> ServiceContext createServiceContext(T obj) {
         ServiceContext ctx = new RemoteServiceContextImpl<T, T>(getServiceName());
         ctx.setInput(obj);
+        ctx.setDocumentType("org.collectionspace.services.account"); //persistence unit
         return ctx;
     }
 
+    @Override
+    public StorageClient getStorageClient(ServiceContext ctx) {
+        //FIXME use ctx to identify storage client
+        return storageClient;
+    }
+
     @Override
     public DocumentHandler createDocumentHandler(ServiceContext ctx) throws Exception {
-        throw new IllegalStateException();
+        DocumentHandler docHandler = AccountHandlerFactory.getInstance().getHandler(
+                ctx.getRepositoryClientType().toString());
+        docHandler.setServiceContext(ctx);
+        docHandler.setCommonPart(ctx.getInput());
+        return docHandler;
     }
 
     @POST
     public Response createAccount(AccountsCommon input) {
         try {
             ServiceContext ctx = createServiceContext(input);
-            String csid = "";
+            DocumentHandler handler = createDocumentHandler(ctx);
+            String csid = getStorageClient(ctx).create(ctx, handler);
             UriBuilder path = UriBuilder.fromResource(AccountResource.class);
             path.path("" + csid);
             Response response = Response.created(path.build()).build();
@@ -107,8 +124,9 @@ public class AccountResource
         }
         AccountsCommon result = null;
         try {
-            ServiceContext ctx = createServiceContext((AccountsCommon)null);
-
+            ServiceContext ctx = createServiceContext((AccountsCommon) null);
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getStorageClient(ctx).get(ctx, csid, handler);
             result = (AccountsCommon) ctx.getOutput();
         } catch (DocumentNotFoundException dnfe) {
             if (logger.isDebugEnabled()) {
@@ -141,8 +159,11 @@ public class AccountResource
     public AccountsCommonList getAccountList(@Context UriInfo ui) {
         AccountsCommonList accountList = new AccountsCommonList();
         try {
-            ServiceContext ctx = createServiceContext((AccountsCommonList)null);
-
+            ServiceContext ctx = createServiceContext((AccountsCommonList) null);
+            DocumentHandler handler = createDocumentHandler(ctx);
+            DocumentFilter myFilter = new DocumentFilter();
+            handler.setDocumentFilter(myFilter);
+            getStorageClient(ctx).getFiltered(ctx, handler);
             accountList = null;
         } catch (Exception e) {
             if (logger.isDebugEnabled()) {
@@ -173,8 +194,9 @@ public class AccountResource
         AccountsCommon result = null;
         try {
             ServiceContext ctx = createServiceContext(theUpdate);
-
-            result = (AccountsCommon)ctx.getOutput();
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getStorageClient(ctx).update(ctx, csid, handler);
+            result = (AccountsCommon) ctx.getOutput();
         } catch (DocumentNotFoundException dnfe) {
             if (logger.isDebugEnabled()) {
                 logger.debug("caugth exception in updateAccount", dnfe);
@@ -206,8 +228,8 @@ public class AccountResource
             throw new WebApplicationException(response);
         }
         try {
-            ServiceContext ctx = createServiceContext((AccountsCommon)null);
-
+            ServiceContext ctx = createServiceContext((AccountsCommon) null);
+            getStorageClient(ctx).delete(ctx, csid);
             return Response.status(HttpResponseCodes.SC_OK).build();
         } catch (DocumentNotFoundException dnfe) {
             if (logger.isDebugEnabled()) {
index cc554b9eb36884c60981781f21bc756811b8d593..5e4a677f5d409ecfb65e34c294e7e0462f6bad32 100644 (file)
@@ -29,7 +29,6 @@ import org.collectionspace.services.account.AccountsCommonList;
 import org.collectionspace.services.common.document.AbstractDocumentHandler;
 import org.collectionspace.services.common.document.DocumentWrapper;
 
-
 /**
  *
  * @author 
@@ -37,6 +36,9 @@ import org.collectionspace.services.common.document.DocumentWrapper;
 public class AccountDocumentHandler
         extends AbstractDocumentHandler<AccountsCommon, AccountsCommonList, AccountsCommon, AccountsCommonList> {
 
+    private AccountsCommon account;
+    private AccountsCommonList accountList;
+
     @Override
     public void handleCreate(DocumentWrapper<AccountsCommon> wrapDoc) throws Exception {
         String id = UUID.randomUUID().toString();
@@ -50,45 +52,50 @@ public class AccountDocumentHandler
 
     @Override
     public void handleGet(DocumentWrapper<AccountsCommon> wrapDoc) throws Exception {
+        setCommonPart(wrapDoc.getWrappedObject());
     }
 
     @Override
-    public void handleGetAll(DocumentWrapper< AccountsCommonList> wrapDoc) throws Exception {
+    public void handleGetAll(DocumentWrapper<AccountsCommonList> wrapDoc) throws Exception {
+        setCommonPartList(wrapDoc.getWrappedObject());
     }
 
     @Override
     public AccountsCommon extractCommonPart(DocumentWrapper<AccountsCommon> wrapDoc)
             throws Exception {
-        return null;
+        throw new UnsupportedOperationException("operation not relevant for AccountDocumentHandler");
     }
 
     @Override
     public void fillCommonPart(AccountsCommon obj, DocumentWrapper<AccountsCommon> wrapDoc)
             throws Exception {
+        throw new UnsupportedOperationException("operation not relevant for AccountDocumentHandler");
     }
 
     @Override
     public AccountsCommonList extractCommonPartList(DocumentWrapper<AccountsCommonList> wrapDoc)
             throws Exception {
-        return null;
+        return wrapDoc.getWrappedObject();
     }
 
     @Override
     public AccountsCommon getCommonPart() {
-        return null;
+        return account;
     }
 
     @Override
-    public void setCommonPart(AccountsCommon obj) {
+    public void setCommonPart(AccountsCommon account) {
+        this.account = account;
     }
 
     @Override
     public AccountsCommonList getCommonPartList() {
-        return null;
+        return accountList;
     }
 
     @Override
-    public void setCommonPartList(AccountsCommonList obj) {
+    public void setCommonPartList(AccountsCommonList accountList) {
+        this.accountList = accountList;
     }
 
     @Override
index c90280fad90a7d58594828d8f08b12d554294a0b..4e76ed0844f05d68392fcc43ec77ca74a000b0cf 100644 (file)
@@ -47,9 +47,6 @@ public class AccountHandlerFactory implements DocumentHandlerFactory {
 
     @Override
     public DocumentHandler getHandler(String clientType) {
-        if(ClientType.JAVA.toString().equals(clientType)){
-            return new AccountDocumentHandler();
-        } 
-        throw new IllegalArgumentException("Not supported client=" + clientType);
+        return new AccountDocumentHandler();
     }
 }
diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java
new file mode 100644 (file)
index 0000000..cfbe193
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ *  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 University of California at Berkeley
+
+ *  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.account.storage;
+
+import org.collectionspace.services.common.storage.jpa.JpaStorageClient;
+
+/**
+ * AccountStorageClient deals with both Account and Default Identity Provider's
+ * state in persistent storage
+ * @author 
+ */
+public class AccountStorageClient extends JpaStorageClient
+{
+
+}
diff --git a/services/authentication/jaxb/pom.xml b/services/authentication/jaxb/pom.xml
new file mode 100644 (file)
index 0000000..5510cb6
--- /dev/null
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <artifactId>org.collectionspace.services.authentication</artifactId>
+        <groupId>org.collectionspace.services</groupId>
+        <version>1.0</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>
+    <version>1.0</version>
+    <name>services.authentication.jaxb</name>
+    <properties>
+        <sql.file>authentication.sql</sql.file>
+        <sql.dir>src/main/resources/db/mysql</sql.dir>
+    </properties>
+    <dependencies>
+                <!-- keep slf4j dependencies on the top -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jvnet.jaxb2-commons</groupId>
+            <artifactId>property-listener-injector</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jvnet.jaxb2_commons</groupId>
+            <artifactId>runtime</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.persistence</groupId>
+            <artifactId>persistence-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>5.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.client</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>collectionspace-services-authentication-jaxb</finalName>
+        <defaultGoal>install</defaultGoal>
+        <plugins>
+            <plugin>
+                <!-- maven-hyperjaxb3-plugin generates jaxb + jpa bindings -->
+                <groupId>org.jvnet.hyperjaxb3</groupId>
+                <artifactId>maven-hyperjaxb3-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <extension>true</extension>
+                    <jdk5>true</jdk5>
+                    <ejb3>false</ejb3>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+    
+</project>
+
diff --git a/services/authentication/jaxb/src/main/resources/META-INF/persistence.xml b/services/authentication/jaxb/src/main/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..6a124e8
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
+  <persistence-unit name="org.collectionspace.services.authentication">
+    <non-jta-data-source>java:comp/env/jdbc/CspaceDS</non-jta-data-source>
+    <class>org.collectionspace.services.authentication.User</class>
+    <class>org.collectionspace.services.authentication.Role</class>
+    <class>org.collectionspace.services.authentication.UserRole</class>
+    <properties>
+      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
+      <property name="hibernate.max_fetch_depth" value="3"/>
+      <!--property name="hibernate.hbm2ddl.auto" value="create-drop"/-->
+    </properties>
+  </persistence-unit>
+</persistence>
diff --git a/services/authentication/jaxb/src/main/resources/authentication_identity_provider.xsd b/services/authentication/jaxb/src/main/resources/authentication_identity_provider.xsd
new file mode 100644 (file)
index 0000000..899c067
--- /dev/null
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    CollectionSpace identity provider schema (XSD)
+    
+    Entity  :
+    Used for: 
+    
+    $LastChangedRevision: 916 $
+    $LastChangedDate: 2009-11-05 16:59:20 -0800 (Thu, 05 Nov 2009) $
+-->
+
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+  xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations"
+  xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
+  xmlns:ns="http://collectionspace.org/servics/authentication"
+  xmlns="http://collectionspace.org/services/authentication"
+  targetNamespace="http://collectionspace.org/services/authentication"
+  version="0.1"
+  jaxb:extensionBindingPrefixes="hj orm"
+>
+
+<!--
+    Avoid XmlRootElement nightmare:
+    See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+
+    <xs:element name="user">
+        <xs:complexType>
+            <xs:annotation>
+                <xs:appinfo>
+                    <hj:entity>
+                        <orm:table name="users"/>
+                    </hj:entity>
+                </xs:appinfo>
+            </xs:annotation>
+            <xs:sequence>
+                <xs:element name="username" type="xs:string" minOccurs="1" maxOccurs="1">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <hj:id>
+                                <orm:column name="username"  length="128" nullable="false"/>
+                            </hj:id>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element name="passwd" type="xs:string" minOccurs="1" maxOccurs="1">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <hj:basic>
+                                <orm:column name="passwd" length="128" nullable="false"/>
+                            </hj:basic>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="role">
+        <xs:complexType>
+            <xs:annotation>
+                <xs:appinfo>
+                    <hj:entity>
+                        <orm:table name="roles"/>
+                    </hj:entity>
+                </xs:appinfo>
+            </xs:annotation>
+            <xs:sequence>
+                <xs:element name="rolename" type="xs:string" minOccurs="1" maxOccurs="1">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <hj:id>
+                                <orm:column name="rolename"  length="128" nullable="false"/>
+                            </hj:id>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element name="rolegroup" type="xs:string" minOccurs="1" maxOccurs="1">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <hj:basic>
+                                <orm:column name="rolegroup" length="128" nullable="false"/>
+                            </hj:basic>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="user_role">
+        <xs:complexType>
+            <xs:annotation>
+                <xs:appinfo>
+                    <hj:entity>
+                        <orm:table name="users_roles"/>
+                    </hj:entity>
+                </xs:appinfo>
+            </xs:annotation>
+            <xs:sequence>
+                <xs:element name="username" type="xs:string" minOccurs="1" maxOccurs="1">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <hj:basic>
+                                <orm:column name="username" length="128" nullable="false"/>
+                            </hj:basic>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element name="rolename" type="xs:string" minOccurs="1" maxOccurs="1">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <hj:basic>
+                                <orm:column name="rolename" length="128" nullable="false"/>
+                            </hj:basic>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
+
diff --git a/services/authentication/jaxb/src/test/java/org/collectionspace/services/authentication/test/DefaultIdentityProviderTest.java b/services/authentication/jaxb/src/test/java/org/collectionspace/services/authentication/test/DefaultIdentityProviderTest.java
new file mode 100644 (file)
index 0000000..2e5cb37
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.collectionspace.services.authentication.test;
+
+import java.lang.reflect.Method;
+import java.util.UUID;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import javax.persistence.Query;
+import org.collectionspace.services.authentication.User;
+import org.collectionspace.services.authentication.Role;
+import org.collectionspace.services.authentication.UserRole;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+
+/**
+ *
+ * @author 
+ */
+public class DefaultIdentityProviderTest {
+
+    private final Logger logger = LoggerFactory.getLogger(DefaultIdentityProviderTest.class);
+    private EntityManagerFactory emf;
+    private EntityManager em;
+    private String id;
+
+    @BeforeMethod
+    public void init() {
+
+        emf = Persistence.createEntityManagerFactory("org.collectionspace.services.authentication");
+
+        em = emf.createEntityManager();
+//        if (logger.isDebugEnabled()) {
+//            logger.debug("created entity manager");
+//        }
+    }
+
+    @AfterMethod
+    public void cleanup() {
+        if (em != null) {
+            em.close();
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test(dataProvider = "testName", dataProviderClass = DefaultIdentityProviderTest.class)
+    public void create(String testName) throws Exception {
+        User user = new User();
+        user.setUsername("sanjay");
+        user.setPasswd("uiouio");
+        em.getTransaction().begin();
+        em.persist(user);
+        // Commit the transaction
+        em.getTransaction().commit();
+        if (logger.isDebugEnabled()) {
+            logger.debug("created user " +
+                    " username=" + user.getUsername() +
+                    " password=" + user.getPasswd());
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test(dataProvider = "testName", dataProviderClass = DefaultIdentityProviderTest.class,
+    dependsOnMethods = {"create"})
+    public void read(String testName) throws Exception {
+        User user = findUser("sanjay");
+        Assert.assertNotNull(user);
+        if (logger.isDebugEnabled()) {
+            logger.debug("read user " +
+                    " username=" + user.getUsername());
+        }
+    }
+
+    private User findUser(String userName) throws Exception {
+        Query q = em.createQuery("select a from org.collectionspace.services.authentication.User a where a.username = :username");
+        q.setParameter("username", userName);
+        return (User) q.getSingleResult();
+
+    }
+
+//    @SuppressWarnings("unchecked")
+//    @Test(dataProvider = "testName", dataProviderClass = DefaultIdentityProviderTest.class,
+//    dependsOnMethods = {"read"})
+//    public void update(String testName) throws Exception {
+//        Query q = em.createQuery("update org.collectionspace.services.authentication.User set email= :email where csid=:csid");
+//        q.setParameter("email", "sanjay@berkeley.edu");
+//        q.setParameter("csid", id);
+//        em.getTransaction().begin();
+//        int no = q.executeUpdate();
+//        // Commit the transaction
+//        em.getTransaction().commit();
+//        Assert.assertEquals(no, 1);
+//        Users account = findAccount("sanjay");
+//        if (logger.isDebugEnabled()) {
+//            logger.debug("updated account " +
+//                    " first name=" + account.getFirstName() +
+//                    " email=" + account.getEmail());
+//        }
+//    }
+    @SuppressWarnings("unchecked")
+    @Test(dataProvider = "testName", dataProviderClass = DefaultIdentityProviderTest.class,
+    dependsOnMethods = {"read"}) //FIXME change to update
+    public void delete(String testName) throws Exception {
+        Query q = em.createQuery("delete from org.collectionspace.services.authentication.User where username=:username");
+        q.setParameter("username", "sanjay");
+        // Begin transaction
+        em.getTransaction().begin();
+        int no = q.executeUpdate();
+        ;
+        if (logger.isDebugEnabled()) {
+            logger.debug("deleting user " +
+                    " username=" + "sanjay");
+        }
+        // Commit the transaction
+        em.getTransaction().commit();
+        Assert.assertEquals(no, 1);
+        if (logger.isDebugEnabled()) {
+            logger.debug("deleted user " +
+                    " username=" + "sanjay");
+        }
+    }
+
+    /**
+     * Returns the name of the currently running test.
+     *
+     * Note: although the return type is listed as Object[][],
+     * this method instead returns a String.
+     *
+     * @param   m  The currently running test method.
+     *
+     * @return  The name of the currently running test method.
+     */
+    @DataProvider(name = "testName")
+    public static Object[][] testName(Method m) {
+        return new Object[][]{
+                    new Object[]{m.getName()}
+                };
+    }
+}
diff --git a/services/authentication/jaxb/src/test/resources/META-INF/persistence.xml b/services/authentication/jaxb/src/test/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..a2eeadb
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
+http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <persistence-unit name="org.collectionspace.services.authentication">
+    <class>org.collectionspace.services.authentication.User</class>
+    <class>org.collectionspace.services.authentication.Role</class>
+    <class>org.collectionspace.services.authentication.UserRole</class>
+        <properties>
+            <property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>
+
+            <!--property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
+            <property name="hibernate.max_fetch_depth" value="3"/>
+            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
+            <property name="hibernate.connection.username" value="test"/>
+            <property name="hibernate.connection.password" value="test"/>
+            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/cspace"/-->
+        </properties>
+    </persistence-unit>
+</persistence>
diff --git a/services/authentication/jaxb/src/test/resources/hibernate.cfg.xml b/services/authentication/jaxb/src/test/resources/hibernate.cfg.xml
new file mode 100644 (file)
index 0000000..c7c6009
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : hibernate.cfg.xml.xml
+    Created on : November 12, 2009, 12:02 PM
+    Author     : sanjaydalal
+    Description:
+        Purpose of the document follows.
+-->
+<!DOCTYPE hibernate-configuration PUBLIC
+          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+    <session-factory>
+        <property name="connection.url">jdbc:mysql://localhost:3306/cspace</property>
+        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
+        <property name="connection.username">test</property>
+        <property name="connection.password">test</property>
+        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
+        <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
+        <property name="current_session_context_class">thread</property>
+        <property name="hibernate.show_sql">true</property>
+    </session-factory>
+</hibernate-configuration>
diff --git a/services/authentication/jaxb/src/test/resources/log4j.properties b/services/authentication/jaxb/src/test/resources/log4j.properties
new file mode 100644 (file)
index 0000000..3aa34b3
--- /dev/null
@@ -0,0 +1,25 @@
+log4j.rootLogger=debug, stdout, R\r
+\r
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender\r
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\r
+\r
+# Pattern to output the caller's file name and line number.\r
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+log4j.appender.R=org.apache.log4j.RollingFileAppender\r
+log4j.appender.R.File=target/test-client.log\r
+\r
+log4j.appender.R.MaxFileSize=100KB\r
+# Keep one backup file\r
+log4j.appender.R.MaxBackupIndex=1\r
+\r
+log4j.appender.R.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+#packages\r
+log4j.logger.org.collectionspace=DEBUG\r
+log4j.logger.org.apache=INFO\r
+log4j.logger.httpclient=INFO\r
+log4j.logger.org.jboss.resteasy=INFO\r
+log4j.logger.org.jvnet.hyperjaxb3=DEBUG\r
+log4j.logger.org.hibernate=WARN
\ No newline at end of file
index e0f5348a3807db94ee6a26eb18ef1ccf0168530f..8d131d494ee92c77fad8d957e958698f349d9c90 100644 (file)
@@ -16,6 +16,7 @@
     </properties>\r
 \r
     <modules>\r
+        <module>jaxb</module>\r
         <module>service</module>\r
         <module>client</module>\r
     </modules>\r
index e452193c72c65ef1ab270d714c24381f2000c5d7..70cf8caa90a17fd8f9becf8424149cb7a6335cbe 100644 (file)
             </service:object>
         </tenant:serviceBindings>
         <!-- end relation service meta-data -->
+        <!-- begin account service meta-data -->
+        <tenant:serviceBindings name="Accounts" version="0.1">
+            <service:object id="1" name="Acccount" version="0.1"
+            xmlns:service='http://collectionspace.org/services/common/service'>
+                <service:part id="0" control_group="Managed"
+                            versionable="true" auditable="false"
+                            label="accounts_system" updated="" order="0">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent
+                        namespaceURI="http://collectionspace.org/services/common/system"
+                        schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd">
+                        </service:xmlContent>
+                    </service:content>
+                </service:part>
+                <service:part id="1" control_group="Managed"
+                            versionable="true" auditable="false"
+                            label="accounts_common" updated="" order="1">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent
+                        namespaceURI="http://collectionspace.org/services/account"
+                        schemaLocation="http://collectionspace.org/services/account http://services.collectionspace.org/relation/accounts_common.xsd">
+                        </service:xmlContent>
+                    </service:content>
+                </service:part>
+            </service:object>
+        </tenant:serviceBindings>
+        <!-- end account service meta-data -->
     </tenant:tenantBinding>
     <!-- end movinimages.us tenant meta-data -->
 </tenant:TenantBindingConfig>
index cd4e052b1825a418a6c4082bbb6d67f77303cde2..7e01ae27b63b49d26efe434785792b07c204db3b 100644 (file)
@@ -70,16 +70,16 @@ public class TenantBindingConfigReader
     public void read() throws Exception {
         String configFileName = getAbsoluteFileName(CONFIG_FILE_NAME);
         File configFile = new File(configFileName);
-        if(!configFile.exists()){
+        if (!configFile.exists()) {
             String msg = "Could not find configuration file " + configFileName;
             logger.error(msg);
             throw new RuntimeException(msg);
         }
         tenantBindingConfig = (TenantBindingConfig) parse(configFile, TenantBindingConfig.class);
-        for(TenantBindingType tenantBinding : tenantBindingConfig.getTenantBinding()){
+        for (TenantBindingType tenantBinding : tenantBindingConfig.getTenantBinding()) {
             tenantBindings.put(tenantBinding.getId(), tenantBinding);
             readServiceBindings(tenantBinding);
-            if(logger.isDebugEnabled()){
+            if (logger.isDebugEnabled()) {
                 logger.debug("read() added tenant id=" + tenantBinding.getId() +
                         " name=" + tenantBinding.getName());
             }
@@ -87,11 +87,11 @@ public class TenantBindingConfigReader
     }
 
     private void readServiceBindings(TenantBindingType tenantBinding) throws Exception {
-        for(ServiceBindingType serviceBinding : tenantBinding.getServiceBindings()){
+        for (ServiceBindingType serviceBinding : tenantBinding.getServiceBindings()) {
             String key = getTenantQualifiedServiceName(tenantBinding.getId(),
                     serviceBinding.getName());
             serviceBindings.put(key, serviceBinding);
-            if(logger.isDebugEnabled()){
+            if (logger.isDebugEnabled()) {
                 logger.debug("readServiceBindings() added service " +
                         " name=" + key +
                         " workspace=" + serviceBinding.getName());
@@ -105,7 +105,7 @@ public class TenantBindingConfigReader
      * @throws Exception
      */
     public void retrieveAllWorkspaceIds() throws Exception {
-        for(TenantBindingType tenantBinding : tenantBindings.values()){
+        for (TenantBindingType tenantBinding : tenantBindings.values()) {
             retrieveWorkspaceIds(tenantBinding);
         }
     }
@@ -121,36 +121,44 @@ public class TenantBindingConfigReader
         ServiceMain svcMain = ServiceMain.getInstance();
         RepositoryClientConfigType rclientConfig = svcMain.getServicesConfigReader().getConfiguration().getRepositoryClient();
         ClientType clientType = svcMain.getClientType();
-        if(clientType.equals(ClientType.JAVA) &&
-                rclientConfig.getName().equalsIgnoreCase("nuxeo-java")){
+        if (clientType.equals(ClientType.JAVA) &&
+                rclientConfig.getName().equalsIgnoreCase("nuxeo-java")) {
             //FIXME only one repository client is recognized
             workspaceIds = svcMain.getNuxeoConnector().retrieveWorkspaceIds(
                     tenantBinding.getRepositoryDomain());
         }
         //verify if workspace exists for each service in the tenant binding
-        for(ServiceBindingType serviceBinding : tenantBinding.getServiceBindings()){
+        for (ServiceBindingType serviceBinding : tenantBinding.getServiceBindings()) {
             String serviceName = serviceBinding.getName();
+            if (serviceBinding.getRepositoryClient() == null) {
+                //no repository needed for this service...skip
+                if (logger.isDebugEnabled()) {
+                    logger.debug("no repository configured for service " + serviceName +
+                            " skipping...");
+                }
+                continue;
+            }
             RepositoryClient repositoryClient = getRepositoryClient(
                     serviceBinding.getRepositoryClient());
             String workspaceId = null;
             //workspace name is service name by convention
             String workspace = serviceBinding.getName().toLowerCase();
-            if(clientType.equals(ClientType.JAVA)){
+            if (clientType.equals(ClientType.JAVA)) {
                 workspaceId = workspaceIds.get(workspace);
-                if(workspaceId == null){
+                if (workspaceId == null) {
                     logger.warn("failed to retrieve workspace id for " + workspace +
                             " trying to create a new workspace...");
                     workspaceId = repositoryClient.createWorkspace(
                             tenantBinding.getRepositoryDomain(),
                             serviceBinding.getName());
-                    if(workspaceId == null){
+                    if (workspaceId == null) {
                         logger.warn("failed to create workspace for " + workspace);
                         continue;
                     }
                 }
-            }else{
+            } else {
                 workspaceId = serviceBinding.getRepositoryWorkspaceId();
-                if(workspaceId == null || "".equals(workspaceId)){
+                if (workspaceId == null || "".equals(workspaceId)) {
                     logger.error("could not find workspace id for " + workspace);
                     //FIXME: should we throw an exception here?
                     continue;
@@ -158,7 +166,7 @@ public class TenantBindingConfigReader
             }
             String tenantService = getTenantQualifiedServiceName(tenantBinding.getId(), serviceName);
             serviceWorkspaces.put(tenantService, workspaceId);
-            if(logger.isDebugEnabled()){
+            if (logger.isDebugEnabled()) {
                 logger.debug("retrieved workspace id=" + workspaceId +
                         " service=" + serviceName +
                         " workspace=" + workspace);
index fef1b5df3db3e508197dfe86adf3abae19004596..db763c958d2acc098270d9065fa4ca26cc9d2ccc 100644 (file)
  */
 package org.collectionspace.services.common.document;
 
-import java.util.HashMap;
-import java.util.Map;
 
-import java.util.StringTokenizer;
-import org.collectionspace.services.common.context.ServiceContext;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 32a326728cd5b002fa96d21639ddc7717a87447d..b5e6cb244cd08b91c629182c701357ff852466d0 100644 (file)
@@ -37,9 +37,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * JpaStorageClient is used to perform CRUD operations on documents in Nuxeo
- * repository using Remote Java APIs. It uses @see DocumentHandler as IOHandler
- * with the client.
+ * JpaStorageClient is used to perform CRUD operations on SQL storage using JPA.
+ * It uses @see DocumentHandler as IOHandler with the client.
+ * All the operations in this client are carried out under their own transactions.
+ * A call to any method would start and commit/rollback a transaction.
  *
  * $LastChangedRevision: $ $LastChangedDate: $
  */
index fe51aa74d58aee7c89956b3419cd309e639b82a1..9f0c53a19340b253b195f646e2aa1806756badcc 100644 (file)
@@ -16,6 +16,7 @@
         <!-- add modules below in the order based on dependencies -->
         <module>common</module>
         <module>authentication</module>
+        <!--module>account</module-->
         <module>relation</module>
         <!--module>query</module-->
         <module>acquisition</module>
@@ -27,7 +28,6 @@
         <module>client</module>
         <module>sdk</module>
         <module>IntegrationTests</module>
-    <!--module>account</module-->
     </modules>
 
     <repositories> </repositories>
             </dependency>
         </dependencies>
     </dependencyManagement>
-</project>
\ No newline at end of file
+</project>