mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fix AR-431, AR-432.
Modified the Repository bootstrap mechanism so it's performed after all other initialisation and the order of bootstrap is explicit. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2414 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
<import resource="classpath:alfresco/index-recovery-context.xml" />
|
<import resource="classpath:alfresco/index-recovery-context.xml" />
|
||||||
<import resource="classpath:alfresco/authority-services-context.xml" />
|
<import resource="classpath:alfresco/authority-services-context.xml" />
|
||||||
<import resource="classpath:alfresco/authentication-services-context.xml" />
|
<import resource="classpath:alfresco/authentication-services-context.xml" />
|
||||||
|
<import resource="classpath:alfresco/bootstrap-context.xml" />
|
||||||
<import resource="classpath*:alfresco/patch/*-context.xml" />
|
<import resource="classpath*:alfresco/patch/*-context.xml" />
|
||||||
|
|
||||||
<!-- import of general extensions and bean overrides -->
|
<!-- import of general extensions and bean overrides -->
|
||||||
|
147
config/alfresco/bootstrap-context.xml
Normal file
147
config/alfresco/bootstrap-context.xml
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Repository Boostrap Sequence.
|
||||||
|
|
||||||
|
This file specifies the initialisation (and order of initialisation) to perform during Repository startup.
|
||||||
|
|
||||||
|
The pattern for adding new initialisation to the bootstrap sequence is as follows:
|
||||||
|
|
||||||
|
1) Develop a bean that implements the Spring interface ApplicationListener
|
||||||
|
2) Place the initialisation logic in the method onApplicationEvent(ApplicationEvent event)...
|
||||||
|
|
||||||
|
public void onApplicationEvent(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
if (event instanceof ContextRefreshedEvent)
|
||||||
|
{
|
||||||
|
// initialisation logic here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
3) Add the bean definition to this file - Note: the beans are initialised in the order they are specified.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<!-- Bootstrap Files -->
|
||||||
|
|
||||||
|
<bean id="userBootstrap" parent="userStoreImporter">
|
||||||
|
<property name="bootstrapViews">
|
||||||
|
<list>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/alfrescoUserStore.xml</prop>
|
||||||
|
</props>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="systemBootstrap" parent="systemStoreImporter">
|
||||||
|
<property name="bootstrapViews">
|
||||||
|
<list>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/descriptor.xml</prop>
|
||||||
|
</props>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="spacesBootstrap" parent="spacesStoreImporter">
|
||||||
|
<property name="bootstrapViews">
|
||||||
|
<list>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/categories.xml</prop>
|
||||||
|
</props>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/spaces.xml</prop>
|
||||||
|
<prop key="messages">alfresco/messages/bootstrap-spaces</prop>
|
||||||
|
</props>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/system.xml</prop>
|
||||||
|
</props>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/${spaces.company_home.childname}/${spaces.guest_home.childname}</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/tutorial.xml</prop>
|
||||||
|
<prop key="messages">alfresco/messages/bootstrap-tutorial</prop>
|
||||||
|
</props>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}</prop>
|
||||||
|
<prop key="location">alfresco/templates/software_engineering_project.xml</prop>
|
||||||
|
<prop key="messages">alfresco/messages/bootstrap-templates</prop>
|
||||||
|
</props>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}</prop>
|
||||||
|
<prop key="location">alfresco/templates/content_template_examples.xml</prop>
|
||||||
|
</props>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Descriptor Service -->
|
||||||
|
|
||||||
|
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl">
|
||||||
|
<property name="descriptor">
|
||||||
|
<value>classpath:alfresco/version.properties</value>
|
||||||
|
</property>
|
||||||
|
<property name="systemBootstrap">
|
||||||
|
<ref bean="systemBootstrap"/>
|
||||||
|
</property>
|
||||||
|
<property name="transactionService">
|
||||||
|
<ref bean="transactionComponent"/>
|
||||||
|
</property>
|
||||||
|
<property name="namespaceService">
|
||||||
|
<ref bean="namespaceService"/>
|
||||||
|
</property>
|
||||||
|
<property name="nodeService">
|
||||||
|
<ref bean="nodeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="searchService">
|
||||||
|
<ref bean="searchService"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- This component ensures that patches get applied on startup -->
|
||||||
|
|
||||||
|
<bean id="patchExecuter" class="org.alfresco.repo.admin.patch.PatchExecuter">
|
||||||
|
<property name="patchService">
|
||||||
|
<ref bean="PatchService" />
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- CIFS Server -->
|
||||||
|
|
||||||
|
<bean id="fileServerConfiguration" class="org.alfresco.filesys.server.config.ServerConfiguration" parent="fileServerConfigurationBase">
|
||||||
|
<property name="configService">
|
||||||
|
<ref bean="fileServersConfigService"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="cifsServer" class="org.alfresco.filesys.CIFSServer" destroy-method="stopServer">
|
||||||
|
<constructor-arg>
|
||||||
|
<ref local="fileServerConfiguration"/>
|
||||||
|
</constructor-arg>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- FTP Server -->
|
||||||
|
|
||||||
|
<bean id="ftpServer" class="org.alfresco.filesys.FTPServer" destroy-method="stopServer">
|
||||||
|
<constructor-arg>
|
||||||
|
<ref local="fileServerConfiguration"/>
|
||||||
|
</constructor-arg>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Startup Message -->
|
||||||
|
|
||||||
|
<bean id="startupLog" class="org.alfresco.repo.descriptor.DescriptorStartupLog">
|
||||||
|
<property name="descriptorService">
|
||||||
|
<ref local="descriptorComponent"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
@@ -3,7 +3,7 @@
|
|||||||
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
||||||
|
|
||||||
<!-- NOTE: all replaced properties referenced from repository.properties file must also be
|
<!-- NOTE: all replaced properties referenced from repository.properties file must also be
|
||||||
mapped in the application-context.xml importerBootstrap/configuration section -->
|
mapped in the bootstrap-context.xml spacesBootstrap/configuration section -->
|
||||||
<cm:folder view:childName="${spaces.company_home.childname}">
|
<cm:folder view:childName="${spaces.company_home.childname}">
|
||||||
<view:acl view:inherit="false">
|
<view:acl view:inherit="false">
|
||||||
<view:ace view:access="ALLOWED">
|
<view:ace view:access="ALLOWED">
|
||||||
|
@@ -4,29 +4,6 @@
|
|||||||
<!-- Core and miscellaneous bean definitions -->
|
<!-- Core and miscellaneous bean definitions -->
|
||||||
<beans>
|
<beans>
|
||||||
|
|
||||||
<!-- Descriptor Service -->
|
|
||||||
|
|
||||||
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl" init-method="init">
|
|
||||||
<property name="descriptor">
|
|
||||||
<value>classpath:alfresco/version.properties</value>
|
|
||||||
</property>
|
|
||||||
<property name="systemBootstrap">
|
|
||||||
<ref local="systemBootstrap"/>
|
|
||||||
</property>
|
|
||||||
<property name="transactionService">
|
|
||||||
<ref bean="transactionComponent"/>
|
|
||||||
</property>
|
|
||||||
<property name="namespaceService">
|
|
||||||
<ref bean="namespaceService"/>
|
|
||||||
</property>
|
|
||||||
<property name="nodeService">
|
|
||||||
<ref bean="nodeService"/>
|
|
||||||
</property>
|
|
||||||
<property name="searchService">
|
|
||||||
<ref bean="searchService"/>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- PERSISTENCE -->
|
<!-- PERSISTENCE -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
@@ -642,7 +619,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="importerComponent" class="org.alfresco.repo.importer.ImporterComponent" depends-on="nodeIndexer, auditableAspect">
|
<bean id="importerComponent" class="org.alfresco.repo.importer.ImporterComponent">
|
||||||
<!-- For now, hard-wire the view parser -->
|
<!-- For now, hard-wire the view parser -->
|
||||||
<property name="namespaceService">
|
<property name="namespaceService">
|
||||||
<ref bean="NamespaceService" />
|
<ref bean="NamespaceService" />
|
||||||
@@ -679,7 +656,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="storeImporter" class="org.alfresco.repo.importer.ImporterBootstrap" abstract="true" init-method="bootstrap">
|
<bean id="storeImporter" class="org.alfresco.repo.importer.ImporterBootstrap" abstract="true">
|
||||||
<property name="transactionService">
|
<property name="transactionService">
|
||||||
<ref bean="transactionComponent"/>
|
<ref bean="transactionComponent"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -757,65 +734,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Bootstrap Files -->
|
|
||||||
|
|
||||||
<bean id="userBootstrap" parent="userStoreImporter">
|
|
||||||
<property name="bootstrapViews">
|
|
||||||
<list>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/alfrescoUserStore.xml</prop>
|
|
||||||
</props>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="systemBootstrap" parent="systemStoreImporter" depends-on="userBootstrap">
|
|
||||||
<property name="bootstrapViews">
|
|
||||||
<list>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/descriptor.xml</prop>
|
|
||||||
</props>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="importerBootstrap" parent="spacesStoreImporter" depends-on="systemBootstrap, versionBootstrap">
|
|
||||||
<property name="bootstrapViews">
|
|
||||||
<list>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/categories.xml</prop>
|
|
||||||
</props>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/spaces.xml</prop>
|
|
||||||
<prop key="messages">alfresco/messages/bootstrap-spaces</prop>
|
|
||||||
</props>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/system.xml</prop>
|
|
||||||
</props>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/${spaces.company_home.childname}/${spaces.guest_home.childname}</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/tutorial.xml</prop>
|
|
||||||
<prop key="messages">alfresco/messages/bootstrap-tutorial</prop>
|
|
||||||
</props>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}</prop>
|
|
||||||
<prop key="location">alfresco/templates/software_engineering_project.xml</prop>
|
|
||||||
<prop key="messages">alfresco/messages/bootstrap-templates</prop>
|
|
||||||
</props>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}</prop>
|
|
||||||
<prop key="location">alfresco/templates/content_template_examples.xml</prop>
|
|
||||||
</props>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Exporters -->
|
<!-- Exporters -->
|
||||||
<bean id="exporterComponent" class="org.alfresco.repo.exporter.ExporterComponent">
|
<bean id="exporterComponent" class="org.alfresco.repo.exporter.ExporterComponent">
|
||||||
<property name="namespaceService">
|
<property name="namespaceService">
|
||||||
|
@@ -33,6 +33,10 @@
|
|||||||
<filesystem name="Alfresco">
|
<filesystem name="Alfresco">
|
||||||
<store>workspace://SpacesStore</store>
|
<store>workspace://SpacesStore</store>
|
||||||
<rootPath>/app:company_home</rootPath>
|
<rootPath>/app:company_home</rootPath>
|
||||||
|
<urlFile>
|
||||||
|
<filename>__AlfrescoClient.url</filename>
|
||||||
|
<webpath>http://localhost:8080/alfresco/</webpath>
|
||||||
|
</urlFile>
|
||||||
<!--
|
<!--
|
||||||
<accessControl default="Write">
|
<accessControl default="Write">
|
||||||
<user name="admin" access="Write"/>
|
<user name="admin" access="Write"/>
|
||||||
@@ -67,4 +71,5 @@
|
|||||||
-->
|
-->
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
|
|
||||||
</alfresco-config>
|
</alfresco-config>
|
||||||
|
@@ -20,9 +20,7 @@
|
|||||||
<!-- File Server Configuration -->
|
<!-- File Server Configuration -->
|
||||||
<bean id="fileServerConfigurationBase"
|
<bean id="fileServerConfigurationBase"
|
||||||
abstract="true"
|
abstract="true"
|
||||||
init-method="init"
|
destroy-method="closeConfiguration">
|
||||||
destroy-method="closeConfiguration"
|
|
||||||
depends-on="importerBootstrap">
|
|
||||||
<property name="authenticationManager">
|
<property name="authenticationManager">
|
||||||
<ref bean="authenticationManager"/>
|
<ref bean="authenticationManager"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -46,28 +44,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="fileServerConfiguration"
|
|
||||||
class="org.alfresco.filesys.server.config.ServerConfiguration"
|
|
||||||
parent="fileServerConfigurationBase" >
|
|
||||||
<property name="configService">
|
|
||||||
<ref bean="fileServersConfigService"/>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- CIFS Server -->
|
|
||||||
<bean id="cifsServer" class="org.alfresco.filesys.CIFSServer" init-method="startServer" destroy-method="stopServer" depends-on="importerBootstrap">
|
|
||||||
<constructor-arg>
|
|
||||||
<ref bean="fileServerConfiguration"/>
|
|
||||||
</constructor-arg>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- FTP Server -->
|
|
||||||
<bean id="ftpServer" class="org.alfresco.filesys.FTPServer" init-method="startServer" destroy-method="stopServer" depends-on="importerBootstrap">
|
|
||||||
<constructor-arg>
|
|
||||||
<ref bean="fileServerConfiguration"/>
|
|
||||||
</constructor-arg>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- Filesystem Interface -->
|
<!-- Filesystem Interface -->
|
||||||
<bean id="contentDiskDriver" class="org.alfresco.filesys.smb.server.repo.ContentDiskDriver" >
|
<bean id="contentDiskDriver" class="org.alfresco.filesys.smb.server.repo.ContentDiskDriver" >
|
||||||
<constructor-arg>
|
<constructor-arg>
|
||||||
|
@@ -80,7 +80,7 @@
|
|||||||
<bean id="patch.savedSearches.Base" abstract="true" parent="basePatch" >
|
<bean id="patch.savedSearches.Base" abstract="true" parent="basePatch" >
|
||||||
<!-- helper beans for execution -->
|
<!-- helper beans for execution -->
|
||||||
<property name="importerBootstrap">
|
<property name="importerBootstrap">
|
||||||
<ref bean="importerBootstrap" />
|
<ref bean="spacesBootstrap" />
|
||||||
</property>
|
</property>
|
||||||
<property name="namespaceService">
|
<property name="namespaceService">
|
||||||
<ref bean="namespaceService" />
|
<ref bean="namespaceService" />
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
<ref bean="permissionService"/>
|
<ref bean="permissionService"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="importerBootstrap">
|
<property name="importerBootstrap">
|
||||||
<ref bean="importerBootstrap" />
|
<ref bean="spacesBootstrap" />
|
||||||
</property>
|
</property>
|
||||||
<property name="namespaceService">
|
<property name="namespaceService">
|
||||||
<ref bean="namespaceService" />
|
<ref bean="namespaceService" />
|
||||||
@@ -185,15 +185,4 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- This component ensures that patches get applied on startup -->
|
|
||||||
<!-- The order is important here. All the self-registering patches must be defined before this bean -->
|
|
||||||
<bean id="patchExecuter"
|
|
||||||
class="org.alfresco.repo.admin.patch.PatchExecuter"
|
|
||||||
depends-on="importerBootstrap"
|
|
||||||
init-method="applyOutstandingPatches">
|
|
||||||
<property name="patchService">
|
|
||||||
<ref bean="PatchService" />
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -29,6 +29,9 @@ import org.alfresco.filesys.smb.server.SMBServer;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,7 +41,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||||||
*
|
*
|
||||||
* @author GKSpencer
|
* @author GKSpencer
|
||||||
*/
|
*/
|
||||||
public class CIFSServer
|
public class CIFSServer implements ApplicationListener
|
||||||
{
|
{
|
||||||
private static final Log logger = LogFactory.getLog("org.alfresco.smb.server");
|
private static final Log logger = LogFactory.getLog("org.alfresco.smb.server");
|
||||||
|
|
||||||
@@ -78,6 +81,29 @@ public class CIFSServer
|
|||||||
return (filesysConfig != null && filesysConfig.isSMBServerEnabled());
|
return (filesysConfig != null && filesysConfig.isSMBServerEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
|
public void onApplicationEvent(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
if (event instanceof ContextRefreshedEvent)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
startServer();
|
||||||
|
}
|
||||||
|
catch (SocketException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Failed to start CIFS server", e);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Failed to start CIFS server", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the CIFS server components
|
* Start the CIFS server components
|
||||||
*
|
*
|
||||||
@@ -237,4 +263,6 @@ public class CIFSServer
|
|||||||
}
|
}
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,9 @@ import org.alfresco.filesys.server.config.ServerConfiguration;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +39,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||||||
*
|
*
|
||||||
* @author GKSpencer
|
* @author GKSpencer
|
||||||
*/
|
*/
|
||||||
public class FTPServer
|
public class FTPServer implements ApplicationListener
|
||||||
{
|
{
|
||||||
private static final Log logger = LogFactory.getLog("org.alfresco.ftp.server");
|
private static final Log logger = LogFactory.getLog("org.alfresco.ftp.server");
|
||||||
|
|
||||||
@@ -76,6 +79,29 @@ public class FTPServer
|
|||||||
return (filesysConfig != null && filesysConfig.isFTPServerEnabled());
|
return (filesysConfig != null && filesysConfig.isFTPServerEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
|
public void onApplicationEvent(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
if (event instanceof ContextRefreshedEvent)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
startServer();
|
||||||
|
}
|
||||||
|
catch (SocketException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Failed to start FTP server", e);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Failed to start FTP server", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the FTP server components
|
* Start the FTP server components
|
||||||
*
|
*
|
||||||
|
@@ -20,6 +20,7 @@ import java.io.IOException;
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.net.SocketException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
@@ -78,6 +79,9 @@ import org.alfresco.service.cmr.security.PersonService;
|
|||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -85,7 +89,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
*
|
*
|
||||||
* @author Gary K. Spencer
|
* @author Gary K. Spencer
|
||||||
*/
|
*/
|
||||||
public class ServerConfiguration
|
public class ServerConfiguration implements ApplicationListener
|
||||||
{
|
{
|
||||||
// Debug logging
|
// Debug logging
|
||||||
|
|
||||||
@@ -407,6 +411,18 @@ public class ServerConfiguration
|
|||||||
return initialised;
|
return initialised;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
|
public void onApplicationEvent(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
if (event instanceof ContextRefreshedEvent)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the configuration using the configuration service
|
* Initialize the configuration using the configuration service
|
||||||
*/
|
*/
|
||||||
|
@@ -23,6 +23,9 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.i18n.I18NUtil;
|
import org.alfresco.i18n.I18NUtil;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component is responsible for ensuring that patches are applied
|
* This component is responsible for ensuring that patches are applied
|
||||||
@@ -30,7 +33,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
public class PatchExecuter
|
public class PatchExecuter implements ApplicationListener
|
||||||
{
|
{
|
||||||
private static final String MSG_CHECKING = "patch.executer.checking";
|
private static final String MSG_CHECKING = "patch.executer.checking";
|
||||||
private static final String MSG_NO_PATCHES_REQUIRED = "patch.executer.no_patches_required";
|
private static final String MSG_NO_PATCHES_REQUIRED = "patch.executer.no_patches_required";
|
||||||
@@ -97,4 +100,17 @@ public class PatchExecuter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
|
public void onApplicationEvent(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
if (event instanceof ContextRefreshedEvent)
|
||||||
|
{
|
||||||
|
applyOutstandingPatches();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -35,8 +35,7 @@ import org.alfresco.service.descriptor.DescriptorService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.apache.commons.logging.Log;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
@@ -48,7 +47,7 @@ import org.springframework.core.io.Resource;
|
|||||||
*
|
*
|
||||||
* @author David Caruana
|
* @author David Caruana
|
||||||
*/
|
*/
|
||||||
public class DescriptorServiceImpl implements DescriptorService, ApplicationListener
|
public class DescriptorServiceImpl implements DescriptorService, ApplicationListener, InitializingBean
|
||||||
{
|
{
|
||||||
private Properties serverProperties;
|
private Properties serverProperties;
|
||||||
|
|
||||||
@@ -62,9 +61,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
private Descriptor repoDescriptor;
|
private Descriptor repoDescriptor;
|
||||||
|
|
||||||
|
|
||||||
// Logger
|
|
||||||
private static final Log logger = LogFactory.getLog(DescriptorService.class);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the server descriptor from a resource file
|
* Sets the server descriptor from a resource file
|
||||||
@@ -135,22 +131,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
return repoDescriptor;
|
return repoDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialise Descriptors
|
|
||||||
*/
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
// initialise descriptors
|
|
||||||
serverDescriptor = createServerDescriptor();
|
|
||||||
repoDescriptor = TransactionUtil.executeInUserTransaction(transactionService, new TransactionUtil.TransactionWork<Descriptor>()
|
|
||||||
{
|
|
||||||
public Descriptor doWork()
|
|
||||||
{
|
|
||||||
return createRepositoryDescriptor();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
@@ -158,44 +138,27 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
{
|
{
|
||||||
if (event instanceof ContextRefreshedEvent)
|
if (event instanceof ContextRefreshedEvent)
|
||||||
{
|
{
|
||||||
if (serverDescriptor != null)
|
// initialise the repository descriptor
|
||||||
|
// note: this requires that the repository schema has already been initialised
|
||||||
|
repoDescriptor = TransactionUtil.executeInUserTransaction(transactionService, new TransactionUtil.TransactionWork<Descriptor>()
|
||||||
{
|
{
|
||||||
// log output of VM stats
|
public Descriptor doWork()
|
||||||
Map properties = System.getProperties();
|
|
||||||
String version = (properties.get("java.runtime.version") == null) ? "unknown" : (String)properties.get("java.runtime.version");
|
|
||||||
long maxHeap = Runtime.getRuntime().maxMemory();
|
|
||||||
float maxHeapMB = maxHeap / 1024l;
|
|
||||||
maxHeapMB = maxHeapMB / 1024l;
|
|
||||||
if (logger.isInfoEnabled())
|
|
||||||
{
|
{
|
||||||
logger.info(String.format("Alfresco JVM - v%s; maximum heap size %.3fMB", version, maxHeapMB));
|
return createRepositoryDescriptor();
|
||||||
}
|
}
|
||||||
if (logger.isWarnEnabled())
|
});
|
||||||
{
|
|
||||||
if (version.startsWith("1.2") || version.startsWith("1.3") || version.startsWith("1.4"))
|
|
||||||
{
|
|
||||||
logger.warn(String.format("Alfresco JVM - WARNING - v1.5 is required; currently using v%s", version));
|
|
||||||
}
|
|
||||||
if (maxHeapMB < 500)
|
|
||||||
{
|
|
||||||
logger.warn(String.format("Alfresco JVM - WARNING - maximum heap size %.3fMB is less than recommended 512MB", maxHeapMB));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// log output of version initialised
|
|
||||||
if (logger.isInfoEnabled())
|
|
||||||
{
|
|
||||||
String serverEdition = serverDescriptor.getEdition();
|
|
||||||
String serverVersion = serverDescriptor.getVersion();
|
|
||||||
String repoVersion = repoDescriptor.getVersion();
|
|
||||||
int schemaVersion = repoDescriptor.getSchema();
|
|
||||||
logger.info(String.format("Alfresco started (%s) - v%s; repository v%s; schema %d",
|
|
||||||
serverEdition, serverVersion, repoVersion, schemaVersion));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise Descriptors
|
||||||
|
*/
|
||||||
|
public void afterPropertiesSet() throws Exception
|
||||||
|
{
|
||||||
|
// initialise server descriptor
|
||||||
|
serverDescriptor = createServerDescriptor();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create server descriptor
|
* Create server descriptor
|
||||||
*
|
*
|
||||||
@@ -257,7 +220,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
*/
|
*/
|
||||||
public String getVersionMajor()
|
public String getVersionMajor()
|
||||||
{
|
{
|
||||||
return "unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -265,7 +228,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
*/
|
*/
|
||||||
public String getVersionMinor()
|
public String getVersionMinor()
|
||||||
{
|
{
|
||||||
return "unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -273,7 +236,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
*/
|
*/
|
||||||
public String getVersionRevision()
|
public String getVersionRevision()
|
||||||
{
|
{
|
||||||
return "unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -281,7 +244,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
*/
|
*/
|
||||||
public String getVersionLabel()
|
public String getVersionLabel()
|
||||||
{
|
{
|
||||||
return "unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -289,7 +252,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
*/
|
*/
|
||||||
public String getVersion()
|
public String getVersion()
|
||||||
{
|
{
|
||||||
return "unknown (pre 1.0.0 RC2)";
|
return "Unknown (pre 1.0.0 RC2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -297,7 +260,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
*/
|
*/
|
||||||
public String getEdition()
|
public String getEdition()
|
||||||
{
|
{
|
||||||
return "unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/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.alfresco.repo.descriptor;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.service.descriptor.Descriptor;
|
||||||
|
import org.alfresco.service.descriptor.DescriptorService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide a Repository Startup Log
|
||||||
|
*
|
||||||
|
* @author davidc
|
||||||
|
*/
|
||||||
|
public class DescriptorStartupLog implements ApplicationListener
|
||||||
|
{
|
||||||
|
// Logger
|
||||||
|
private static final Log logger = LogFactory.getLog(DescriptorService.class);
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
private DescriptorService descriptorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param descriptorService Descriptor Service
|
||||||
|
*/
|
||||||
|
public void setDescriptorService(DescriptorService descriptorService)
|
||||||
|
{
|
||||||
|
this.descriptorService = descriptorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
public void onApplicationEvent(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
if (event instanceof ContextRefreshedEvent)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// log output of VM stats
|
||||||
|
//
|
||||||
|
Map properties = System.getProperties();
|
||||||
|
String version = (properties.get("java.runtime.version") == null) ? "unknown" : (String)properties.get("java.runtime.version");
|
||||||
|
long maxHeap = Runtime.getRuntime().maxMemory();
|
||||||
|
float maxHeapMB = maxHeap / 1024l;
|
||||||
|
maxHeapMB = maxHeapMB / 1024l;
|
||||||
|
if (logger.isInfoEnabled())
|
||||||
|
{
|
||||||
|
logger.info(String.format("Alfresco JVM - v%s; maximum heap size %.3fMB", version, maxHeapMB));
|
||||||
|
}
|
||||||
|
if (logger.isWarnEnabled())
|
||||||
|
{
|
||||||
|
if (version.startsWith("1.2") || version.startsWith("1.3") || version.startsWith("1.4"))
|
||||||
|
{
|
||||||
|
logger.warn(String.format("Alfresco JVM - WARNING - v1.5 is required; currently using v%s", version));
|
||||||
|
}
|
||||||
|
if (maxHeapMB < 500)
|
||||||
|
{
|
||||||
|
logger.warn(String.format("Alfresco JVM - WARNING - maximum heap size %.3fMB is less than recommended 512MB", maxHeapMB));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log Repository Descriptors
|
||||||
|
if (logger.isInfoEnabled())
|
||||||
|
{
|
||||||
|
Descriptor serverDescriptor = descriptorService.getServerDescriptor();
|
||||||
|
Descriptor repoDescriptor = descriptorService.getRepositoryDescriptor();
|
||||||
|
String serverEdition = serverDescriptor.getEdition();
|
||||||
|
String serverVersion = serverDescriptor.getVersion();
|
||||||
|
String repoVersion = repoDescriptor.getVersion();
|
||||||
|
int schemaVersion = repoDescriptor.getSchema();
|
||||||
|
logger.info(String.format("Alfresco started (%s) - v%s; repository v%s; schema %d",
|
||||||
|
serverEdition, serverVersion, repoVersion, schemaVersion));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -23,6 +23,7 @@ import java.io.Reader;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
@@ -47,6 +48,9 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
import org.apache.commons.logging.impl.Log4JLogger;
|
import org.apache.commons.logging.impl.Log4JLogger;
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,7 +58,7 @@ import org.springframework.core.io.ClassPathResource;
|
|||||||
*
|
*
|
||||||
* @author David Caruana
|
* @author David Caruana
|
||||||
*/
|
*/
|
||||||
public class ImporterBootstrap
|
public class ImporterBootstrap implements ApplicationListener
|
||||||
{
|
{
|
||||||
// View Properties (used in setBootstrapViews)
|
// View Properties (used in setBootstrapViews)
|
||||||
public static final String VIEW_PATH_PROPERTY = "path";
|
public static final String VIEW_PATH_PROPERTY = "path";
|
||||||
@@ -522,4 +526,16 @@ public class ImporterBootstrap
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
|
public void onApplicationEvent(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
if (event instanceof ContextRefreshedEvent)
|
||||||
|
{
|
||||||
|
bootstrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user