tsgrp / OpenContent

TSG's Web Services for ECM Repositories
8 stars 4 forks source link

core-bean-config.xml and core-oc-context.xml Combined #7

Open benallenallen opened 10 years ago

benallenallen commented 10 years ago

Should only have the beans in these files defined in one place...

Currently core-bean-config.xml is used for dctm to init everything, whereas alfresco gets the show started in core-oc-context.xml. This more than likely could be done right away by having the core-oc-context.xml import core-bean-config.xml for the heavy lifting, but cannot be done until core-bean-config.xml stops using spring 3.1 for its xsi:schemaLocation. Once this is done, the core-oc-context.xml will only have two things:

<bean id="OCContext" class="com.tsgrp.opencontent.core.spring.CoreContext"></bean>
<import resource="classpath:core-bean-config.xml"/>

In a related issue to how everything is started, there seems to be misunderstanding on how the Alfresco subsystem and the normal OpenContent Spring WAR start up.

Standalone DCTM

When a standalone OpenContent WAR is started up, NOTHING will happen with the spring beans UNTIL a REST endpoint is hit. At the point that an endpoint is hit (Authentication for instance), the following happens:

RESTAuthentication.java#newSessionSimple

 AuthenticationResult result = CoreContext.getAuthentication().newSessionSimple( username, password, docbase );

Since this is the first call to CoreContext, the constructor runs:

CoreContext.java

static {
        initContext();
}
...
private static void initContext() {
    try {
            ApplicationContext applicationContext = new ClassPathXmlApplicationContext("core-bean-config.xml");

            context = applicationContext;
    } 
    catch (Throwable t) {
            System.out.println("Error initializing CoreContext..." + t.getMessage());
            t.printStackTrace();
    }        
}

Notice how this will work perfectly for Documentum since we are expecting everything to be wired up at this point.

Alfresco Embedded Subsystem OpenContent

Now notice how Alfresco kicks everything off. When the Alfresco Subsystem starts, it loads all files that have *-context.xml in it IMMEDIATELY as the alfresco is started

core-oc-context.xml:

<bean id="OCContext" class="com.tsgrp.opencontent.core.spring.CoreContext"></bean>

CoreContext.java

static {
        initContext();
}
...
private static void initContext() {
    try {
            ApplicationContext applicationContext = new ClassPathXmlApplicationContext("core-bean-config.xml");

            context = applicationContext;
    } 
    catch (Throwable t) {
            System.out.println("Error initializing CoreContext..." + t.getMessage());
            t.printStackTrace();
    }        
}

From the logs of the Alfresco starting, it would seem that something is being loaded more than once:

10:57:20,229 INFO  [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] Starting 'OpenContent' subsystem, ID: [OpenContent, default]
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [activiti-defaults.properties]: class path resource [activiti-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [activiti-db.properties]: class path resource [activiti-db.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [dctm-defaults.properties]: class path resource [dctm-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [filesystem-defaults.properties]: class path resource [filesystem-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [ldap-defaults.properties]: class path resource [ldap-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [sharepoint-defaults.properties]: class path resource [sharepoint-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [solr-defaults.properties]: class path resource [solr-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-defaults.properties]: class path resource [transformation-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [wizard-defaults.properties]: class path resource [wizard-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-icepdf-defaults.properties]: class path resource [transformation-icepdf-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-imagemagick-defaults.properties]: class path resource [transformation-imagemagick-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-livecycle-defaults.properties]: class path resource [transformation-livecycle-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [wizard-dctm-defaults.properties]: class path resource [wizard-dctm-defaults.properties] cannot be opened because it does not exist
10:57:20,963 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [project-placeholders.properties]: class path resource [project-placeholders.properties] cannot be opened because it does not exist
10:57:21,620 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [activiti-defaults.properties]: class path resource [activiti-defaults.properties] cannot be opened because it does not exist
10:57:21,620 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [activiti-db.properties]: class path resource [activiti-db.properties] cannot be opened because it does not exist
10:57:21,620 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [dctm-defaults.properties]: class path resource [dctm-defaults.properties] cannot be opened because it does not exist
10:57:21,620 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [filesystem-defaults.properties]: class path resource [filesystem-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [ldap-defaults.properties]: class path resource [ldap-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [sharepoint-defaults.properties]: class path resource [sharepoint-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [solr-defaults.properties]: class path resource [solr-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-defaults.properties]: class path resource [transformation-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [wizard-defaults.properties]: class path resource [wizard-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-icepdf-defaults.properties]: class path resource [transformation-icepdf-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-imagemagick-defaults.properties]: class path resource [transformation-imagemagick-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-livecycle-defaults.properties]: class path resource [transformation-livecycle-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [wizard-dctm-defaults.properties]: class path resource [wizard-dctm-defaults.properties] cannot be opened because it does not exist
10:57:21,635 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [project-placeholders.properties]: class path resource [project-placeholders.properties] cannot be opened because it does not exist
10:57:22,495 DEBUG [com.tsgrp.opencontent.core.config.CoreConfig] Verifying Core configurations...
... other stuff
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [activiti-defaults.properties]: class path resource [activiti-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [activiti-db.properties]: class path resource [activiti-db.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [dctm-defaults.properties]: class path resource [dctm-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [filesystem-defaults.properties]: class path resource [filesystem-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [ldap-defaults.properties]: class path resource [ldap-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [sharepoint-defaults.properties]: class path resource [sharepoint-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [solr-defaults.properties]: class path resource [solr-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-defaults.properties]: class path resource [transformation-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [wizard-defaults.properties]: class path resource [wizard-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-icepdf-defaults.properties]: class path resource [transformation-icepdf-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-imagemagick-defaults.properties]: class path resource [transformation-imagemagick-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [transformation-livecycle-defaults.properties]: class path resource [transformation-livecycle-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [wizard-dctm-defaults.properties]: class path resource [wizard-dctm-defaults.properties] cannot be opened because it does not exist
10:57:49,479 WARN  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Could not load properties from class path resource [project-placeholders.properties]: class path resource [project-placeholders.properties] cannot be opened because it does not exist