]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-4526: Updated client props to use port 8081 instead of 8180. Added code to...
authorRichard Millet <richard.millet@berkeley.edu>
Fri, 11 Nov 2011 01:10:45 +0000 (01:10 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Fri, 11 Nov 2011 01:10:45 +0000 (01:10 +0000)
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java
services/authority/pom.xml
services/client/src/main/resources/collectionspace-client.properties
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java
services/common/src/main/java/org/collectionspace/services/common/storage/JDBCTools.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java
services/id/service/src/main/java/org/collectionspace/services/id/IDServiceJdbcImpl.java
services/pom.xml
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationValidatorHandler.java
services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java

index c7fcf779079feb75ef3fad02caed4edf463a4cba..9a1d87478a263dd0c0bf4f3bf25d1f0f5ca94856 100644 (file)
@@ -13,10 +13,10 @@ public class CSpaceResteasyBootstrap extends ResteasyBootstrap {
 //     private static final String \r
        public void  contextInitialized(ServletContextEvent event) {\r
        if (true) {\r
-               System.out.print("Pausing 1 seconds in RESTEasy bootstrap for you to attached the debugger");\r
+               System.out.print("Pausing 10 seconds in RESTEasy bootstrap for you to attached the debugger");\r
                long startTime, currentTime;\r
                currentTime = startTime = System.currentTimeMillis();\r
-               long stopTime = startTime + 1 * 1000; //5 seconds\r
+               long stopTime = startTime + 10 * 1000; //5 seconds\r
                do {\r
                        if (currentTime % 1000 == 0) {\r
                                System.out.print(".");\r
index eb504088bafc37b4d9c0b97c20c05bdfe70a3ce2..a76f642f8cec986d99b3391aec191f2a0d4676de 100644 (file)
@@ -5,7 +5,7 @@
     <parent>\r
         <groupId>org.collectionspace.services</groupId>\r
         <artifactId>org.collectionspace.services.main</artifactId>\r
-        <version>1.12-SNAPSHOT</version>\r
+        <version>1.14-SNAPSHOT</version>\r
     </parent>\r
 \r
     <modelVersion>4.0.0</modelVersion>\r
     <name>services.authority</name>\r
     <packaging>pom</packaging>\r
 \r
-    <modules>\r
+    <dependencies>\r
+        <!-- CollectionSpace dependencies\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.common-api</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.jaxb</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.client</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.common</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>\r
+            <version>${project.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.authentication.service</artifactId>\r
+            <version>${project.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.authorization.jaxb</artifactId>\r
+            <version>${project.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.authorization.service</artifactId>\r
+            <version>${project.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.relation.service</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.relation.client</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
+                -->\r
+\r
+\r
+        <!-- Utilities -->\r
+\r
+               <!--\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-api</artifactId>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-log4j12</artifactId>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+               -->\r
+        <dependency>\r
+            <groupId>log4j</groupId>\r
+            <artifactId>log4j</artifactId>\r
+            <version>1.2.14</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.commons</groupId>\r
+            <artifactId>commons-jexl</artifactId>\r
+            <version>2.0.1</version>\r
+        </dependency>\r
+        <dependency>\r
+                       <groupId>commons-codec</groupId>\r
+                       <artifactId>commons-codec</artifactId>\r
+                       <version>1.4</version>\r
+        </dependency>\r
+\r
+        <!-- javax -->\r
+        <dependency>\r
+            <groupId>javax.servlet</groupId>\r
+            <artifactId>servlet-api</artifactId>\r
+            <version>2.5</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>javax.security</groupId>\r
+            <artifactId>jaas</artifactId>\r
+            <version>1.0.01</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.security</groupId>\r
+            <artifactId>jacc</artifactId>\r
+            <version>1.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <!--\r
+            <dependency>\r
+            <groupId>dom4j</groupId>\r
+            <artifactId>dom4j</artifactId>\r
+            <version>1.6.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        -->\r
+        <dependency>\r
+            <groupId>mysql</groupId>\r
+            <artifactId>mysql-connector-java</artifactId>\r
+        </dependency>\r
+                               <dependency>\r
+                                               <groupId>postgresql</groupId>\r
+                                               <artifactId>postgresql</artifactId>\r
+                               </dependency>\r
+         <dependency>\r
+            <groupId>javax.persistence</groupId>\r
+            <artifactId>persistence-api</artifactId>\r
+        </dependency>\r
+\r
+        <!-- jboss -->\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>jaxrs-api</artifactId>\r
+        </dependency>        \r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxrs</artifactId>\r
+            <exclusions>\r
+                <exclusion>\r
+                    <groupId>tjws</groupId>\r
+                    <artifactId>webserver</artifactId>\r
+                </exclusion>\r
+            </exclusions>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxb-provider</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-multipart-provider</artifactId>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.hibernate</groupId>\r
+            <artifactId>hibernate-entitymanager</artifactId>\r
+        </dependency>\r
+        <!-- jboss -->\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jbosssx</artifactId>\r
+            <version>4.2.3.GA</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-remoting</artifactId>\r
+            <version>2.2.2.SP8</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <!-- nuxeo -->\r
+<!-- \r
+           <dependency>\r
+             <groupId>org.nuxeo.ecm.platform</groupId>\r
+             <artifactId>nuxeo-platform-mimetype-api</artifactId>\r
+             <version>${nuxeo.platform.version}</version>\r
+           </dependency>        \r
+           <dependency>\r
+             <groupId>org.nuxeo.ecm.platform</groupId>\r
+             <artifactId>nuxeo-platform-imaging-api</artifactId>\r
+             <version>${nuxeo.platform.version}</version>\r
+           </dependency>\r
+           <dependency>\r
+             <groupId>org.nuxeo.ecm.platform</groupId>\r
+             <artifactId>nuxeo-platform-filemanager-api</artifactId>\r
+                 <version>${nuxeo.platform.version}</version>        \r
+           </dependency>\r
+-->        \r
+               <!--\r
+        <dependency>\r
+            <groupId>org.nuxeo.common</groupId>\r
+            <artifactId>nuxeo-common</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.runtime</groupId>\r
+            <artifactId>nuxeo-runtime</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-api</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-client</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-query</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-schema</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-io</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-io</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.runtime</groupId>\r
+            <artifactId>nuxeo-runtime-osgi</artifactId>\r
+            <version>${nuxeo.core.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.osgi</groupId>\r
+            <artifactId>org.osgi.core</artifactId>\r
+            <version>4.1.0</version>\r
+        </dependency>\r
+               -->\r
+    </dependencies>\r
+    \r
+       <modules>\r
         <module>jaxb</module>\r
         <module>service</module>\r
     </modules>\r
-</project>\r
+       \r
+       </project>\r
 \r
index 332c6865458c7cb46b01c4320bb39a38749c9eeb..eefe496f6a7c8dbb9d133c71907b2a08a9717208 100644 (file)
@@ -1,5 +1,5 @@
 #url of the collectionspace server\r
-cspace.url=http://localhost:8180/cspace-services/\r
+cspace.url=http://localhost:8081/cspace-services/\r
 #cspace.url=http://nightly.collectionspace.org:8180/cspace-services/\r
 \r
 #cspace.url=http://localhost:8200/cspace-services/\r
index 2a11dd8cfbee4959968ad3e4857a877ec40d288e..761be0b62a8ca1dc49919e18d7c0637171aab3a4 100644 (file)
@@ -66,9 +66,6 @@ public class ServiceMain {
     private static final String DEFAULT_READER_PASSWORD = "reader";\r
     private static final String SERVER_HOME_PROPERTY = "catalina.home";\r
     \r
-    private static DataSource cspaceDataSource = null;\r
-    private static DataSource nuxeoDataSource = null;\r
-    \r
     private ServiceMain() {\r
        //empty\r
     }\r
@@ -159,7 +156,7 @@ public class ServiceMain {
                // Invoke all post-initialization handlers, passing in a DataSource instance of the Nuxeo db.\r
                // Typically, these handlers modify column types and add indexes to the Nuxeo db schema.\r
                //\r
-            firePostInitHandlers(ServiceMain.nuxeoDataSource);\r
+            firePostInitHandlers(JDBCTools.getDataSource(JDBCTools.NUXEO_REPOSITORY_NAME));\r
         } catch(Exception e) {\r
             logger.error("ServiceMain.initialize firePostInitHandlers failed on exception: " + e.getLocalizedMessage());\r
         }\r
@@ -638,7 +635,7 @@ public class ServiceMain {
         return null;\r
     }\r
 \r
-    private Connection getConnection() throws LoginException, SQLException {\r
+    private Connection getConnection() throws NamingException, SQLException {\r
         return JDBCTools.getConnection(JDBCTools.CSPACE_REPOSITORY_NAME);\r
     }\r
 \r
@@ -679,8 +676,16 @@ public class ServiceMain {
      * static members.\r
      */\r
     private void setDataSources() throws NamingException {\r
-       ServiceMain.cspaceDataSource = JDBCTools.getDataSource(JDBCTools.CSPACE_REPOSITORY_NAME);\r
-       ServiceMain.nuxeoDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_REPOSITORY_NAME);\r
+       //\r
+       // As a side-effect of calling JDBCTools.getDataSource(...), the DataSource instance will be\r
+       // cached in a static hash map of the JDBCTools class.  This will speed up lookups as well as protect our\r
+       // code from JNDI lookup problems -for example, if the JNDI context gets stepped on or corrupted.\r
+       //\r
+       DataSource cspaceDataSource = JDBCTools.getDataSource(JDBCTools.CSPACE_REPOSITORY_NAME);\r
+       DataSource nuxeoDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_REPOSITORY_NAME);\r
+       //\r
+       // Set our AuthN's datasource to be the cspaceDataSource\r
+       //\r
        AuthN.setDataSource(cspaceDataSource);\r
     }\r
     \r
index 01b4e252285502c45858751246bbf657afbb89ec..bf9e5310c99074971a11a35b6f7e683860d5bba3 100755 (executable)
@@ -32,6 +32,7 @@ import java.sql.Connection;
 import java.sql.ResultSet;\r
 import java.sql.SQLException;\r
 import java.sql.Statement;\r
+import java.util.HashMap;\r
 \r
 /**\r
  * User: laramie\r
@@ -39,48 +40,62 @@ import java.sql.Statement;
  * $LastChangedDate:  $\r
  */\r
 public class JDBCTools {\r
+       public static HashMap<String, DataSource> cachedDataSources = new HashMap<String, DataSource>();\r
     public static String CSPACE_REPOSITORY_NAME = "CspaceDS";\r
     public static String NUXEO_REPOSITORY_NAME = "NuxeoDS";\r
-    public static String DEFAULT_REPOSITORY_NAME = NUXEO_REPOSITORY_NAME;\r
+    //\r
+    // Private constants\r
+    //\r
+    private static String DEFAULT_REPOSITORY_NAME = NUXEO_REPOSITORY_NAME;\r
     private static String DBProductName = null;\r
     private static DatabaseProductType DBProductType = DatabaseProductType.UNRECOGNIZED;\r
 \r
     //todo: make sure this will get instantiated in the right order\r
     final static Logger logger = LoggerFactory.getLogger(JDBCTools.class);\r
-    \r
+        \r
     public static DataSource getDataSource(String repositoryName) throws NamingException {\r
        DataSource result = null;\r
-       InitialContext ctx = new InitialContext();\r
-       Context envCtx = null;\r
        \r
-        if (logger.isDebugEnabled() == true) {\r
-               logger.debug("Looking up datasource in JNDI with name: " + repositoryName);\r
-        }\r
-               \r
-       try {\r
-               envCtx = (Context) ctx.lookup("java:comp/env");\r
-               DataSource ds = (DataSource) envCtx.lookup("jdbc/" + repositoryName);\r
-               if (ds == null) {\r
-                   throw new IllegalArgumentException("datasource not found: " + repositoryName);\r
-               } else {\r
-                       result = ds;\r
+       //\r
+       // First, see if we already have this DataSource instance cached\r
+       //\r
+       result = cachedDataSources.get(repositoryName);\r
+       if (result == null) {           \r
+               InitialContext ctx = new InitialContext();\r
+               Context envCtx = null;\r
+\r
+               if (logger.isDebugEnabled() == true) {\r
+                       logger.debug("Looking up DataSource instance in JNDI with name: " + repositoryName);\r
                }\r
-       } finally {\r
-            if (ctx != null) {\r
-                try {\r
-                    ctx.close();\r
-                } catch (Exception e) {\r
-                       logger.error("Error getting DataSource for: " + repositoryName, e);\r
-                }\r
-            }\r
-            if (envCtx != null) {\r
-                try {\r
-                       envCtx.close();\r
-                } catch (Exception e) {\r
-                       logger.error("Error getting DataSource for: " + repositoryName, e);\r
-                }\r
-            }\r
+                       \r
+               try {\r
+                       envCtx = (Context) ctx.lookup("java:comp/env");\r
+                       DataSource ds = (DataSource) envCtx.lookup("jdbc/" + repositoryName);\r
+                       if (ds == null) {\r
+                           throw new IllegalArgumentException("DataSource instance not found: " + repositoryName);\r
+                       } else {\r
+                               result = ds;\r
+                               // now cache this DataSource instance for future references\r
+                               cachedDataSources.put(repositoryName, result);\r
+                       }\r
+               } finally {\r
+                   if (ctx != null) {\r
+                       try {\r
+                           ctx.close();\r
+                       } catch (Exception e) {\r
+                               logger.error("Error getting DataSource for: " + repositoryName, e);\r
+                       }\r
+                   }\r
+                   if (envCtx != null) {\r
+                       try {\r
+                               envCtx.close();\r
+                       } catch (Exception e) {\r
+                               logger.error("Error getting DataSource for: " + repositoryName, e);\r
+                       }\r
+                   }\r
+               }\r
        }\r
+       \r
        return result;\r
     }\r
     \r
@@ -93,30 +108,23 @@ public class JDBCTools {
        return result;\r
     }\r
 \r
-    public static Connection getConnection(String repositoryName) throws LoginException, SQLException {\r
+    public static Connection getConnection(String repositoryName) throws NamingException, SQLException {\r
        Connection result = null;\r
        \r
        if (Tools.isEmpty(repositoryName)) {\r
             repositoryName = getDefaultRepositoryName();\r
+            if (logger.isWarnEnabled() == true) {\r
+               logger.warn("getConnection() method was called with an empty or null repository name.  Using " + repositoryName + " instead.");\r
+            }\r
         }\r
         \r
-        Connection conn = null;\r
-        try {\r
-            DataSource ds = getDataSource(repositoryName);\r
-            conn = ds.getConnection();\r
-            result = conn;\r
-        } catch (NamingException ex) {\r
-            LoginException le = new LoginException("Error looking up DataSource from: " + repositoryName);\r
-            le.initCause(ex);\r
-            throw le;\r
-        } catch (SQLException e) {\r
-            throw e;\r
-        }\r
+        DataSource ds = getDataSource(repositoryName);\r
+        Connection conn = getConnection(ds);\r
+        result = conn;\r
         \r
         return result;\r
     }\r
 \r
-\r
     /* THIS IS BROKEN - If you close the statement, it closes the ResultSet!!!\r
     public static ResultSet executeQuery(String repoName, String sql) throws Exception {\r
         Connection conn = null;\r
@@ -242,7 +250,7 @@ public class JDBCTools {
         return DBProductType;\r
     }\r
 \r
-    public static String getDefaultRepositoryName() {\r
+    private static String getDefaultRepositoryName() {\r
         return DEFAULT_REPOSITORY_NAME;\r
     }\r
 \r
index 5339dcbe517a57ddc90d9115f236b8120fda7573..85b2bf1146af1031a79ffcabe26c9a4d69341214 100644 (file)
@@ -609,7 +609,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
         DocumentFilter filter = handler.getDocumentFilter();
         String oldOrderBy = filter.getOrderByClause();
         if (isClauseEmpty(oldOrderBy) == true){
-            filter.setOrderByClause(DocumentFilter.ORDER_BY_LAST_UPDATED);  //per http://issues.collectionspace.org/browse/CSPACE-705
+            filter.setOrderByClause(DocumentFilter.ORDER_BY_LAST_UPDATED);  //per http://issues.collectionspace.org/browse/CSPACE-705 (Doesn't this conflict with what happens with the QueryContext instance that we create below?)
         }
         QueryContext queryContext = new QueryContext(ctx, handler);
         RepositoryInstance repoSession = null;
index 99a8d1b5e5689cbcb182ab4072c7b23fd320ad26..69a06e73cf240c6fc5538c17b262b7cd79c3cf94 100644 (file)
@@ -71,6 +71,8 @@ import java.sql.PreparedStatement;
 import java.sql.Statement;
 import java.util.LinkedHashMap;
 import java.util.Map;
+
+import javax.naming.NamingException;
 import javax.security.auth.login.LoginException;
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
@@ -219,7 +221,7 @@ public class IDServiceJdbcImpl implements IDService {
      * @throws  DocumentNotFoundException if the requested ID generator could not be found.
      */
     public void updateLastID(String csid, String lastId)
-            throws IllegalStateException, DocumentNotFoundException, LoginException, SQLException {
+            throws IllegalStateException, DocumentNotFoundException, NamingException, SQLException {
 
         logger.debug("> in updateLastID");
 
@@ -298,6 +300,7 @@ public class IDServiceJdbcImpl implements IDService {
                     conn.close();
                 }
             } catch (SQLException e) {
+               logger.error("Error closing JDBC connection: ", e);
                 // Do nothing here
             }
         }
@@ -935,14 +938,14 @@ public class IDServiceJdbcImpl implements IDService {
      * @throws  LoginException
      * @throws  SQLException if a storage-related error occurred.
      */
-    public Connection getJdbcConnection() throws LoginException, SQLException {
+    public Connection getJdbcConnection() throws NamingException, SQLException {
 
         logger.debug("> in getJdbcConnection");
         
         Connection conn = null;
         try {
             conn = JDBCTools.getConnection(JDBCTools.NUXEO_REPOSITORY_NAME);
-        } catch (LoginException e) {
+        } catch (NamingException e) {
             throw e;
         } catch (SQLException e) {
             throw e;
index c7c4c1b444045613bfebb99b195108500ef7303f..5508476d1b839473120b68bddb164ea59befb73b 100644 (file)
@@ -30,7 +30,9 @@
         <module>common-api</module>
         <module>authentication</module>
         <module>authorization</module>
+        <!-- 
         <module>blob</module>
+         -->
         <module>client</module>
         <module>jaxb</module>
         <module>hyperjaxb</module>
@@ -52,7 +54,9 @@
         <module>intake</module>
         <module>loanin</module>
         <module>loanout</module>
+        <!-- 
         <module>media</module>
+         -->
         <module>objectexit</module>
         <module>batch</module>
         <module>imports</module>
index af72ae538620564f6ef248338638a0276562ecac..048da5ab694719b91a62bf9e9317d43848396944 100644 (file)
@@ -10,14 +10,11 @@ import org.collectionspace.services.common.api.RefName.AuthorityItem;
 import org.collectionspace.services.common.api.Tools;\r
 import org.collectionspace.services.relation.RelationsCommon;\r
 \r
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;\r
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;\r
-\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 //import org.testng.Assert;\r
 \r
-public class RelationValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn, PoxPayloadOut> {\r
+public class RelationValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn, PoxPayloadOut>         {\r
 \r
     /** The logger. */\r
     private final Logger logger = LoggerFactory.getLogger(RelationValidatorHandler.class);\r
@@ -25,74 +22,74 @@ public class RelationValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn,
      */\r
     private static final String VALIDATION_ERROR = "The relation record payload was invalid. See log file for more details.";\r
     private static final String SUBJECT_EQUALS_OBJECT_ERROR = "The subject ID and object ID cannot be the same.";\r
-\r
+    \r
     @Override\r
     protected Class<?> getCommonPartClass() {\r
-        return RelationsCommon.class;\r
+       return RelationsCommon.class;\r
     }\r
-\r
+    \r
     @Override\r
     protected void handleCreate()\r
-            throws InvalidDocumentException {\r
-        try {\r
-            RelationsCommon relationsCommon = (RelationsCommon) getCommonPart();\r
-            assert (relationsCommon != null);\r
-            if (logger.isTraceEnabled() == true) {\r
-                logger.trace(relationsCommon.toString());\r
-            }\r
-\r
+               throws InvalidDocumentException{\r
+       try {\r
+               RelationsCommon relationsCommon = (RelationsCommon)getCommonPart();\r
+               CS_ASSERT(relationsCommon != null);\r
+               if (logger.isTraceEnabled() == true) {\r
+                       logger.trace(relationsCommon.toString());\r
+               }\r
+               \r
             String subjectCsid = getSubjectCsid(relationsCommon);\r
             String objectCsid = getObjectCsid(relationsCommon);\r
-\r
+               \r
             // If no CSID for a subject or object is included in the create payload,\r
             // a refName must be provided for that subject or object as an alternate identifier.\r
-            assert (hasCsid(subjectCsid) || hasSubjectRefname(relationsCommon));\r
-            assert (hasCsid(objectCsid) || hasObjectRefname(relationsCommon));\r
-\r
+            CS_ASSERT(hasCsid(subjectCsid) || hasSubjectRefname(relationsCommon));\r
+            CS_ASSERT(hasCsid(objectCsid) || hasObjectRefname(relationsCommon));\r
+               \r
             // The Subject identifier and Object ID must not be identical:\r
             // that is, a resource cannot be related to itself.\r
             if (hasCsid(subjectCsid) && hasCsid(objectCsid)) {\r
-                assert (subjectCsid.trim().equalsIgnoreCase(objectCsid.trim()) == false) :\r
-                        SUBJECT_EQUALS_OBJECT_ERROR;\r
+               CS_ASSERT (subjectCsid.trim().equalsIgnoreCase(objectCsid.trim()) == false,\r
+                        SUBJECT_EQUALS_OBJECT_ERROR);\r
             }\r
 \r
             // A relationship type must be provided.\r
-            assert (relationsCommon.getRelationshipType() != null);\r
-\r
-        } catch (AssertionError e) {\r
-            if (logger.isErrorEnabled() == true) {\r
-                logger.error(e.getMessage(), e);\r
-            }\r
-            throw new InvalidDocumentException(VALIDATION_ERROR, e);\r
-        }\r
+            CS_ASSERT(relationsCommon.getRelationshipType() != null);\r
+\r
+       } catch (AssertionError e) {\r
+               if (logger.isErrorEnabled() == true) {\r
+                       logger.error(e.getMessage(), e);\r
+               }\r
+               throw new InvalidDocumentException(VALIDATION_ERROR, e);\r
+       }\r
     }\r
 \r
-    @Override\r
-    protected void handleGet() {\r
-        // TODO Auto-generated method stub\r
-    }\r
+       @Override\r
+       protected void handleGet() {\r
+               // TODO Auto-generated method stub\r
+       }\r
 \r
-    @Override\r
-    protected void handleGetAll() {\r
-        // TODO Auto-generated method stub\r
-    }\r
+       @Override\r
+       protected void handleGetAll() {\r
+               // TODO Auto-generated method stub\r
+       }\r
 \r
-    @Override\r
-    protected void handleUpdate() {\r
-        // TODO Auto-generated method stub\r
-    }\r
+       @Override\r
+       protected void handleUpdate() {\r
+               // TODO Auto-generated method stub\r
+       }\r
 \r
-    @Override\r
-    protected void handleDelete() {\r
-        // TODO Auto-generated method stub\r
+       @Override\r
+       protected void handleDelete() {\r
+               // TODO Auto-generated method stub\r
     }\r
-\r
+               \r
     private String getSubjectCsid(RelationsCommon relationsCommon) {\r
         String subjectCsid = relationsCommon.getSubjectCsid();\r
         // FIXME: Remove this entire 'if' statement when legacy fields are removed from the Relation record:\r
         if (Tools.isBlank(subjectCsid)) {\r
             subjectCsid = relationsCommon.getDocumentId1();\r
-        }\r
+       }\r
         return subjectCsid;\r
     }\r
 \r
@@ -101,7 +98,7 @@ public class RelationValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn,
         // FIXME: Remove this entire 'if' statement when legacy fields are removed from the Relation record:\r
         if (Tools.isBlank(objectCsid)) {\r
             objectCsid = relationsCommon.getDocumentId2();\r
-        }\r
+}\r
         return objectCsid;\r
     }\r
 \r
index 13546b23c1be459de761a1953c716fac51cb8c22..baa9137461926277ce219bef1c6047d7ddb65e94 100644 (file)
@@ -52,6 +52,7 @@ import org.collectionspace.services.common.invocable.InvocationResults;
 import org.collectionspace.services.common.invocable.Invocable.InvocationError;
 import org.collectionspace.services.common.query.QueryManager;
 import org.collectionspace.services.common.security.UnauthorizedException;
+import org.collectionspace.services.common.storage.JDBCTools;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.slf4j.Logger;
@@ -84,7 +85,7 @@ import java.util.List;
 @Produces("application/xml")
 //@Produces("application/xml;charset=UTF-8")
 public class ReportResource extends ResourceBase {
-    private static String REPOSITORY_NAME = "NuxeoDS";
+    private static String REPOSITORY_NAME = JDBCTools.NUXEO_REPOSITORY_NAME;
     private static String REPORTS_FOLDER = "reports";
     private static String CSID_LIST_SEPARATOR = ",";
     final Logger logger = LoggerFactory.getLogger(ReportResource.class);
@@ -336,29 +337,9 @@ public class ReportResource extends ResourceBase {
         }
     }
 
-    private Connection getConnection() throws LoginException, SQLException {
-        InitialContext ctx = null;
-        Connection conn = null;
-        try {
-            ctx = new InitialContext();
-            DataSource ds = (DataSource) ctx.lookup(REPOSITORY_NAME);
-            if (ds == null) {
-                throw new IllegalArgumentException("datasource not found: " + REPOSITORY_NAME);
-            }
-            conn = ds.getConnection();
-            return conn;
-        } catch (NamingException ex) {
-            LoginException le = new LoginException("Error looking up DataSource from: " + REPOSITORY_NAME);
-            le.initCause(ex);
-            throw le;
-        } finally {
-            if (ctx != null) {
-                try {
-                    ctx.close();
-                } catch (Exception e) {
-                }
-            }
-        }
+    private Connection getConnection() throws NamingException, SQLException {
+       return JDBCTools.getConnection(REPOSITORY_NAME);
     }
 
+
 }