You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/08/10 16:51:14 UTC
svn commit: r430404 -
/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java
Author: gnodet
Date: Thu Aug 10 07:51:13 2006
New Revision: 430404
URL: http://svn.apache.org/viewvc?rev=430404&view=rev
Log:
Allow xbean deployers to override the XmlPreProcessors and BeanFactoryPostProcessors to use
Modified:
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java
Modified: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java?rev=430404&r1=430403&r2=430404&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java (original)
+++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java Thu Aug 10 07:51:13 2006
@@ -71,24 +71,13 @@
su.setRootPath(serviceUnitRootPath);
// Load configuration
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- FileSystemRepository repository = new FileSystemRepository(new File(serviceUnitRootPath));
- ClassLoaderXmlPreprocessor classLoaderXmlPreprocessor = new ClassLoaderXmlPreprocessor(repository);
- List xmlPreprocessors = Collections.singletonList(classLoaderXmlPreprocessor);
+
SpringLoader springLoader = new SpringLoader();
springLoader.setKernel(kernel);
springLoader.setBaseDir(new File(serviceUnitRootPath));
- springLoader.setXmlPreprocessors(xmlPreprocessors);
+ springLoader.setXmlPreprocessors(getXmlPreProcessors(serviceUnitRootPath));
+ springLoader.setBeanFactoryPostProcessors(getBeanFactoryPostProcessors(serviceUnitRootPath));
- PropertyPlaceholderConfigurer propertyPlaceholder = new PropertyPlaceholderConfigurer();
- FileSystemResource propertiesFile = new FileSystemResource(
- new File(serviceUnitRootPath) + "/" + getXBeanFile()
- + ".properties");
- if (propertiesFile.getFile().exists()) {
- propertyPlaceholder.setLocation(propertiesFile);
- springLoader.setBeanFactoryPostProcessors(Collections
- .singletonList(propertyPlaceholder));
- }
-
ServiceName configurationName = springLoader.load(getXBeanFile());
kernel.startService(configurationName);
su.setConfiguration(configurationName);
@@ -132,5 +121,23 @@
protected boolean validate(Endpoint endpoint) throws DeploymentException {
return true;
}
-
+
+ protected List getXmlPreProcessors(String serviceUnitRootPath) {
+ FileSystemRepository repository = new FileSystemRepository(new File(serviceUnitRootPath));
+ ClassLoaderXmlPreprocessor classLoaderXmlPreprocessor = new ClassLoaderXmlPreprocessor(repository);
+ return Collections.singletonList(classLoaderXmlPreprocessor);
+ }
+
+ protected List getBeanFactoryPostProcessors(String serviceUnitRootPath) {
+ PropertyPlaceholderConfigurer propertyPlaceholder = new PropertyPlaceholderConfigurer();
+ FileSystemResource propertiesFile = new FileSystemResource(
+ new File(serviceUnitRootPath) + "/" + getXBeanFile()
+ + ".properties");
+ if (propertiesFile.getFile().exists()) {
+ propertyPlaceholder.setLocation(propertiesFile);
+ return Collections.singletonList(propertyPlaceholder);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
}