*/
package org.collectionspace.services.common;
-import org.collectionspace.services.common.log.CollectionSpaceLog4jRepositorySelector;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
-import org.apache.log4j.LogManager;
/**
* CollectionSpaceServiceContextListener is a ServletContextListener that helps initialize
@Override
public void contextInitialized(ServletContextEvent event) {
try {
- //create logging repository select to stop jboss from jamming
- //our log on top of theirs
-// LogManager.setRepositorySelector(new CollectionSpaceLog4jRepositorySelector(),
-// null);
-
//
// Initialize/start the Nuxeo EP server instance and create/retrieve the service workspaces
//
ServiceMain svcMain = ServiceMain.getInstance(servletContext);
svcMain.retrieveAllWorkspaceIds();
+ //
+ // Invoke all post-initialization handlers, passing in a DataSource instance of the Nuxeo db.
+ // Typically, these handlers modify column types and add indexes to the Nuxeo db schema.
+ //
+ svcMain.firePostInitHandlers();
+
} catch (Exception e) {
e.printStackTrace();
//fail here
import java.util.UUID;\r
\r
import javax.naming.NamingException;\r
-import javax.security.auth.login.LoginException;\r
import javax.servlet.ServletContext;\r
import javax.sql.DataSource;\r
\r
import org.collectionspace.services.common.tenant.TenantBindingType;\r
import org.collectionspace.services.common.types.PropertyItemType;\r
import org.collectionspace.services.common.types.PropertyType;\r
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;\r
-//import org.collectionspace.services.nuxeo.client.java.NuxeoConnector;\r
-//import org.collectionspace.services.nuxeo.client.java.NxConnect;\r
import org.collectionspace.services.nuxeo.client.java.NuxeoConnectorEmbedded;\r
import org.collectionspace.services.nuxeo.client.java.TenantRepository;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
-\r
/**\r
* Main class for Services layer. It reads configuration and performs service\r
* level initialization. It is a singleton.\r
throw new RuntimeException("Unknown CollectionSpace services client type: " + getClientType());\r
}\r
\r
- try {\r
- //\r
- // 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(JDBCTools.getDataSource(JDBCTools.NUXEO_REPOSITORY_NAME));\r
- } catch(Exception e) {\r
- logger.error("ServiceMain.initialize firePostInitHandlers failed on exception: " + e.getLocalizedMessage());\r
- }\r
}\r
\r
/**\r
return TENANT_READER_ACCT_PREFIX+tenantName;\r
}\r
\r
- private void firePostInitHandlers(DataSource dataSource) throws Exception {\r
+ public void firePostInitHandlers() throws Exception {\r
+ DataSource dataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_REPOSITORY_NAME);\r
Hashtable<String, TenantBindingType> tenantBindingTypeMap = tenantBindingConfigReader.getTenantBindings();\r
//Loop through all tenants in tenant-bindings.xml\r
for (TenantBindingType tbt: tenantBindingTypeMap.values()){\r
}\r
}\r
\r
-\r
- public Object instantiate(String clazz, Class castTo) throws Exception {\r
+ /*\r
+ * A generic mechanism for instantiating a instance/object from a class name.\r
+ */\r
+ public Object instantiate(String clazz, Class<?> castTo) throws Exception {\r
ClassLoader tccl = Thread.currentThread().getContextClassLoader();\r
clazz = clazz.trim();\r
Class<?> c = tccl.loadClass(clazz);\r