import org.jboss.resteasy.core.Dispatcher;\r
import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;\r
import org.collectionspace.services.common.ResourceMap;\r
-import org.collectionspace.services.common.ServiceMain;\r
\r
public class CSpaceResteasyBootstrap extends ResteasyBootstrap {\r
\r
- public void contextInitialized(ServletContextEvent event) { \r
- //\r
- // This call to super instantiates and initializes our JAX-RS application class.\r
- // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.\r
- //\r
- System.out.println("[INFO] Starting up the CollectionSpace Services' JAX-RS application.");\r
- super.contextInitialized(event);\r
- CollectionSpaceJaxRsApplication app = \r
- (CollectionSpaceJaxRsApplication)deployment.getApplication();\r
- Dispatcher disp = deployment.getDispatcher();\r
- disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());\r
- System.out.println("[INFO] CollectionSpace Services' JAX-RS application started.");\r
+ public void contextInitialized(ServletContextEvent event) {\r
+ try {\r
+ //\r
+ // This call to super instantiates and initializes our JAX-RS application class.\r
+ // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.\r
+ //\r
+ System.out.println("[INFO] Starting up the CollectionSpace Services' JAX-RS application.");\r
+ super.contextInitialized(event);\r
+ CollectionSpaceJaxRsApplication app = \r
+ (CollectionSpaceJaxRsApplication)deployment.getApplication();\r
+ Dispatcher disp = deployment.getDispatcher();\r
+ disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());\r
+ System.out.println("[INFO] CollectionSpace Services' JAX-RS application started.");\r
+ } catch (Throwable e) {\r
+ e.printStackTrace();\r
+ }\r
}\r
\r
@Override\r
//
ServletContext servletContext = event.getServletContext();
ServiceMain svcMain = ServiceMain.getInstance(servletContext);
+
+ {
+ System.out.print("About to retrieveAllWorkspaceIds - Pausing 4:5 seconds for you to attached the debugger");
+ long startTime, currentTime;
+ currentTime = startTime = System.currentTimeMillis();
+ long stopTime = startTime + 5 * 1000; //5 seconds
+ do {
+ if (currentTime % 1000 == 0) {
+ System.out.print(".");
+ }
+ currentTime = System.currentTimeMillis();
+ } while (currentTime < stopTime);
+
+ System.out.println();
+ System.out.println("Resuming cspace services initialization.");
+ }
+
svcMain.retrieveAllWorkspaceIds();
+ {
+ System.out.print("About to firePostInitHandlers - Pausing 5:5 seconds for you to attached the debugger");
+ long startTime, currentTime;
+ currentTime = startTime = System.currentTimeMillis();
+ long stopTime = startTime + 5 * 1000; //5 seconds
+ do {
+ if (currentTime % 1000 == 0) {
+ System.out.print(".");
+ }
+ currentTime = System.currentTimeMillis();
+ } while (currentTime < stopTime);
+
+ System.out.println();
+ System.out.println("Resuming cspace services initialization.");
+ }
+
//
// 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();
+ {
+ System.out.print("Finished to firePostInitHandlers - Pausing 6:5 seconds for you to attached the debugger");
+ long startTime, currentTime;
+ currentTime = startTime = System.currentTimeMillis();
+ long stopTime = startTime + 5 * 1000; //5 seconds
+ do {
+ if (currentTime % 1000 == 0) {
+ System.out.print(".");
+ }
+ currentTime = System.currentTimeMillis();
+ } while (currentTime < stopTime);
+
+ System.out.println();
+ System.out.println("Resuming cspace services initialization.");
+ }
+
} catch (Exception e) {
e.printStackTrace();
//fail here
@Override
public void contextDestroyed(ServletContextEvent event) {
- ServiceMain.getInstance().release();
+ //ServiceMain.getInstance().release();
}
}
try {\r
//assume the worse\r
initFailed = true;\r
+ \r
+ {\r
+ System.out.print("About to init ServiceMain - Pausing 3:5 seconds for you to attached the debugger");\r
+ long startTime, currentTime;\r
+ currentTime = startTime = System.currentTimeMillis();\r
+ long stopTime = startTime + 5 * 1000; //5 seconds\r
+ do {\r
+ if (currentTime % 1000 == 0) {\r
+ System.out.print(".");\r
+ }\r
+ currentTime = System.currentTimeMillis();\r
+ } while (currentTime < stopTime);\r
+ \r
+ System.out.println();\r
+ System.out.println("Resuming cspace services initialization.");\r
+ }\r
+ \r
temp.initialize();\r
//celebrate success\r
initFailed = false;\r
}\r
\r
private void initialize() throws Exception {\r
- if (logger.isTraceEnabled() == true) {\r
- System.out.print("Pausing 5 seconds for you to attached the debugger");\r
- long startTime, currentTime;\r
- currentTime = startTime = System.currentTimeMillis();\r
- long stopTime = startTime + 5 * 1000; //5 seconds\r
- do {\r
- if (currentTime % 1000 == 0) {\r
- System.out.print(".");\r
- }\r
- currentTime = System.currentTimeMillis();\r
- } while (currentTime < stopTime);\r
- \r
- System.out.println();\r
- System.out.println("Resuming cspace services initialization.");\r
- }\r
\r
setDataSources();\r
setServerRootDir();\r
//\r
try {\r
AuthorizationCommon.createDefaultPermissions(tenantBindingConfigReader);\r
+ \r
+ if (logger.isDebugEnabled() == true) {\r
+ System.out.print("Pausing 1:5 seconds for you to attached the debugger");\r
+ long startTime, currentTime;\r
+ currentTime = startTime = System.currentTimeMillis();\r
+ long stopTime = startTime + 5 * 1000; //5 seconds\r
+ do {\r
+ if (currentTime % 1000 == 0) {\r
+ System.out.print(".");\r
+ }\r
+ currentTime = System.currentTimeMillis();\r
+ } while (currentTime < stopTime);\r
+ \r
+ System.out.println();\r
+ System.out.println("Resuming cspace services initialization.");\r
+ }\r
+\r
AuthorizationCommon.createDefaultAccounts(tenantBindingConfigReader);\r
+ \r
} catch(Exception e) {\r
logger.error("Default accounts setup failed with exception(s): " + e.getLocalizedMessage());\r
}\r
+ \r
+ if (logger.isDebugEnabled() == true) {\r
+ System.out.print("Pausing 2:5 seconds for you to attached the debugger");\r
+ long startTime, currentTime;\r
+ currentTime = startTime = System.currentTimeMillis();\r
+ long stopTime = startTime + 5 * 1000; //5 seconds\r
+ do {\r
+ if (currentTime % 1000 == 0) {\r
+ System.out.print(".");\r
+ }\r
+ currentTime = System.currentTimeMillis();\r
+ } while (currentTime < stopTime);\r
+ \r
+ System.out.println();\r
+ System.out.println("Resuming cspace services initialization.");\r
+ }\r
+ \r
//\r
// Start up and initialize our embedded Nuxeo server instance\r
//\r
Profiler profiler = new Profiler(AuthorizationCommon.class, 1);\r
profiler.start("createDefaultPermissions started:" + readonlyPerm.getCsid());\r
persist(em, readonlyPerm, readonlyRole, true);\r
- profiler.stop("createDefaultPermissions finished:" + readonlyPerm.getCsid());\r
+ profiler.stop();\r
logger.debug("Finished full perm generation for "\r
+ ":" + tenantBinding.getId()\r
+ ":" + serviceBinding.getName()\r