diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml
index dab733172c..b83027017c 100644
--- a/config/alfresco/core-services-context.xml
+++ b/config/alfresco/core-services-context.xml
@@ -4,29 +4,6 @@
-
-
-
-
- classpath:alfresco/version.properties
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -642,7 +619,7 @@
-
+
@@ -679,7 +656,7 @@
-
+
@@ -757,65 +734,6 @@
-
-
-
-
-
-
- /
- alfresco/bootstrap/alfrescoUserStore.xml
-
-
-
-
-
-
-
-
-
- /
- alfresco/bootstrap/descriptor.xml
-
-
-
-
-
-
-
-
-
- /
- alfresco/bootstrap/categories.xml
-
-
- /
- alfresco/bootstrap/spaces.xml
- alfresco/messages/bootstrap-spaces
-
-
- /
- alfresco/bootstrap/system.xml
-
-
- /${spaces.company_home.childname}/${spaces.guest_home.childname}
- alfresco/bootstrap/tutorial.xml
- alfresco/messages/bootstrap-tutorial
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}
- alfresco/templates/software_engineering_project.xml
- alfresco/messages/bootstrap-templates
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}
- alfresco/templates/content_template_examples.xml
-
-
-
-
-
-
diff --git a/config/alfresco/file-servers.xml b/config/alfresco/file-servers.xml
index 3942612b34..05407d5b30 100644
--- a/config/alfresco/file-servers.xml
+++ b/config/alfresco/file-servers.xml
@@ -33,6 +33,10 @@
workspace://SpacesStore
/app:company_home
+
+ __AlfrescoClient.url
+ http://localhost:8080/alfresco/
+
+
diff --git a/config/alfresco/network-protocol-context.xml b/config/alfresco/network-protocol-context.xml
index a7cef3df85..b91d11f9c6 100644
--- a/config/alfresco/network-protocol-context.xml
+++ b/config/alfresco/network-protocol-context.xml
@@ -20,9 +20,7 @@
+ destroy-method="closeConfiguration">
@@ -46,28 +44,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index c288a48f6a..f062e1b16a 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -80,7 +80,7 @@
-
+
@@ -164,7 +164,7 @@
-
+
@@ -185,15 +185,4 @@
-
-
-
-
-
-
-
-
diff --git a/source/java/org/alfresco/filesys/CIFSServer.java b/source/java/org/alfresco/filesys/CIFSServer.java
index 59adab7779..cb926ee491 100644
--- a/source/java/org/alfresco/filesys/CIFSServer.java
+++ b/source/java/org/alfresco/filesys/CIFSServer.java
@@ -29,6 +29,9 @@ import org.alfresco.filesys.smb.server.SMBServer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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;
/**
@@ -38,7 +41,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*
* @author GKSpencer
*/
-public class CIFSServer
+public class CIFSServer implements ApplicationListener
{
private static final Log logger = LogFactory.getLog("org.alfresco.smb.server");
@@ -78,6 +81,29 @@ public class CIFSServer
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
*
@@ -237,4 +263,6 @@ public class CIFSServer
}
System.exit(1);
}
+
+
}
diff --git a/source/java/org/alfresco/filesys/FTPServer.java b/source/java/org/alfresco/filesys/FTPServer.java
index 094ebc4eb9..f77cb0b67d 100644
--- a/source/java/org/alfresco/filesys/FTPServer.java
+++ b/source/java/org/alfresco/filesys/FTPServer.java
@@ -27,6 +27,9 @@ import org.alfresco.filesys.server.config.ServerConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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;
/**
@@ -36,7 +39,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*
* @author GKSpencer
*/
-public class FTPServer
+public class FTPServer implements ApplicationListener
{
private static final Log logger = LogFactory.getLog("org.alfresco.ftp.server");
@@ -76,6 +79,29 @@ public class FTPServer
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
*
diff --git a/source/java/org/alfresco/filesys/server/config/ServerConfiguration.java b/source/java/org/alfresco/filesys/server/config/ServerConfiguration.java
index ece663ce50..af587535e6 100644
--- a/source/java/org/alfresco/filesys/server/config/ServerConfiguration.java
+++ b/source/java/org/alfresco/filesys/server/config/ServerConfiguration.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
+import java.net.SocketException;
import java.net.UnknownHostException;
import java.security.Provider;
import java.security.Security;
@@ -78,6 +79,9 @@ import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.transaction.TransactionService;
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;
/**
*
@@ -85,7 +89,7 @@ import org.apache.commons.logging.LogFactory;
*
* @author Gary K. Spencer
*/
-public class ServerConfiguration
+public class ServerConfiguration implements ApplicationListener
{
// Debug logging
@@ -407,6 +411,18 @@ public class ServerConfiguration
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
*/
diff --git a/source/java/org/alfresco/repo/admin/patch/PatchExecuter.java b/source/java/org/alfresco/repo/admin/patch/PatchExecuter.java
index acc12aab55..12247e4b77 100644
--- a/source/java/org/alfresco/repo/admin/patch/PatchExecuter.java
+++ b/source/java/org/alfresco/repo/admin/patch/PatchExecuter.java
@@ -23,6 +23,9 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.i18n.I18NUtil;
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;
/**
* This component is responsible for ensuring that patches are applied
@@ -30,7 +33,7 @@ import org.apache.commons.logging.LogFactory;
*
* @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_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();
+ }
+ }
+
}
diff --git a/source/java/org/alfresco/repo/descriptor/DescriptorServiceImpl.java b/source/java/org/alfresco/repo/descriptor/DescriptorServiceImpl.java
index 6886239220..65ea325cca 100644
--- a/source/java/org/alfresco/repo/descriptor/DescriptorServiceImpl.java
+++ b/source/java/org/alfresco/repo/descriptor/DescriptorServiceImpl.java
@@ -35,8 +35,7 @@ import org.alfresco.service.descriptor.DescriptorService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
@@ -48,7 +47,7 @@ import org.springframework.core.io.Resource;
*
* @author David Caruana
*/
-public class DescriptorServiceImpl implements DescriptorService, ApplicationListener
+public class DescriptorServiceImpl implements DescriptorService, ApplicationListener, InitializingBean
{
private Properties serverProperties;
@@ -62,9 +61,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
private Descriptor repoDescriptor;
- // Logger
- private static final Log logger = LogFactory.getLog(DescriptorService.class);
-
/**
* Sets the server descriptor from a resource file
@@ -135,22 +131,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
return repoDescriptor;
}
- /**
- * Initialise Descriptors
- */
- public void init()
- {
- // initialise descriptors
- serverDescriptor = createServerDescriptor();
- repoDescriptor = TransactionUtil.executeInUserTransaction(transactionService, new TransactionUtil.TransactionWork()
- {
- public Descriptor doWork()
- {
- return createRepositoryDescriptor();
- }
- });
- }
-
/**
* @param event
*/
@@ -158,44 +138,27 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
{
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()
{
- // 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())
+ public Descriptor doWork()
{
- 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
*
@@ -257,7 +220,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
public String getVersionMajor()
{
- return "unknown";
+ return "Unknown";
}
/* (non-Javadoc)
@@ -265,7 +228,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
public String getVersionMinor()
{
- return "unknown";
+ return "Unknown";
}
/* (non-Javadoc)
@@ -273,7 +236,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
public String getVersionRevision()
{
- return "unknown";
+ return "Unknown";
}
/* (non-Javadoc)
@@ -281,7 +244,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
public String getVersionLabel()
{
- return "unknown";
+ return "Unknown";
}
/* (non-Javadoc)
@@ -289,7 +252,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
public String getVersion()
{
- return "unknown (pre 1.0.0 RC2)";
+ return "Unknown (pre 1.0.0 RC2)";
}
/* (non-Javadoc)
@@ -297,7 +260,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
public String getEdition()
{
- return "unknown";
+ return "Unknown";
}
/*
diff --git a/source/java/org/alfresco/repo/descriptor/DescriptorStartupLog.java b/source/java/org/alfresco/repo/descriptor/DescriptorStartupLog.java
new file mode 100644
index 0000000000..afd64b3fc9
--- /dev/null
+++ b/source/java/org/alfresco/repo/descriptor/DescriptorStartupLog.java
@@ -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));
+ }
+ }
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/importer/ImporterBootstrap.java b/source/java/org/alfresco/repo/importer/ImporterBootstrap.java
index 8e2d8b53e6..17a9c5645c 100644
--- a/source/java/org/alfresco/repo/importer/ImporterBootstrap.java
+++ b/source/java/org/alfresco/repo/importer/ImporterBootstrap.java
@@ -23,6 +23,7 @@ import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
@@ -47,6 +48,9 @@ import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.impl.Log4JLogger;
import org.apache.log4j.Level;
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;
/**
@@ -54,7 +58,7 @@ import org.springframework.core.io.ClassPathResource;
*
* @author David Caruana
*/
-public class ImporterBootstrap
+public class ImporterBootstrap implements ApplicationListener
{
// View Properties (used in setBootstrapViews)
public static final String VIEW_PATH_PROPERTY = "path";
@@ -521,5 +525,17 @@ public class ImporterBootstrap
return true;
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
+ */
+ public void onApplicationEvent(ApplicationEvent event)
+ {
+ if (event instanceof ContextRefreshedEvent)
+ {
+ bootstrap();
+ }
+ }
}