org.apache.xbean.server.deployer
Class FileDeployer

java.lang.Object
  extended by org.apache.xbean.server.deployer.FileDeployer
All Implemented Interfaces:
Runnable, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class FileDeployer
extends Object
implements Runnable, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

A service which auto-deploys services within a recursive file system.


Constructor Summary
FileDeployer()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  ClassLoader createChildClassLoader(String name, File dir, ClassLoader parentClassLoader)
           
protected  void createServiceForFile(String name, File file, ClassLoader classLoader, org.springframework.context.ApplicationContext parentContext)
           
 File getBaseDir()
          Gets the base directory from which configuration locations are resolved.
 List getBeanFactoryPostProcessors()
          Gets the BeanFactoryPostProcessors to apply to the configuration.
protected  String getChildName(String parentName, File file)
           
 ClassLoader getClassLoader()
           
protected  String[] getFileNameOrder(Properties properties)
          Extracts the file names from the properties file for the order in which things should be deployed
 String[] getJarDirectoryNames()
           
 List getXmlPreprocessors()
          Gets the SpringXmlPreprocessors applied to the configuration.
protected  boolean isClassLoaderDirectory(File file)
           
 boolean isShowIgnoredFiles()
           
protected  boolean isSpringConfigFile(File file)
           
 boolean isVerbose()
           
protected  void processDirectory(String parentName, ClassLoader classLoader, org.springframework.context.ApplicationContext parentContext, File directory)
           
 void run()
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setBaseDir(File baseDir)
          Sets the base directory from which configuration locations are resolved.
 void setBeanFactoryPostProcessors(List beanFactoryPostProcessors)
          Sets the BeanFactoryPostProcessors to apply to the configuration.
 void setClassLoader(ClassLoader classLoader)
           
 void setJarDirectoryNames(String[] jarDirectoryNames)
          Sets the names of the directories to be treated as folders of jars or class loader files.
 void setKernel(org.apache.xbean.kernel.Kernel kernel)
          Sets the kernel in which configurations are loaded.
 void setShowIgnoredFiles(boolean showIgnoredFiles)
          Sets whether or not ignored files should be logged as they are encountered.
 void setVerbose(boolean verbose)
          Allows verbose logging to show what classpaths are being created
 void setXmlPreprocessors(List xmlPreprocessors)
          Sets the SpringXmlPreprocessors applied to the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDeployer

public FileDeployer()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

run

public void run()
Specified by:
run in interface Runnable

getClassLoader

public ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader classLoader)

setKernel

public void setKernel(org.apache.xbean.kernel.Kernel kernel)
Sets the kernel in which configurations are loaded.

Parameters:
kernel - the kernel in which configurations are loaded

getBaseDir

public File getBaseDir()
Gets the base directory from which configuration locations are resolved.

Returns:
the base directory from which configuration locations are resolved

setBaseDir

public void setBaseDir(File baseDir)
Sets the base directory from which configuration locations are resolved.

Parameters:
baseDir - the base directory from which configuration locations are resolved

getXmlPreprocessors

public List getXmlPreprocessors()
Gets the SpringXmlPreprocessors applied to the configuration.

Returns:
the SpringXmlPreprocessors applied to the configuration

setXmlPreprocessors

public void setXmlPreprocessors(List xmlPreprocessors)
Sets the SpringXmlPreprocessors applied to the configuration.

Parameters:
xmlPreprocessors - the SpringXmlPreprocessors applied to the configuration

getBeanFactoryPostProcessors

public List getBeanFactoryPostProcessors()
Gets the BeanFactoryPostProcessors to apply to the configuration.

Returns:
the BeanFactoryPostProcessors to apply to the configuration

setBeanFactoryPostProcessors

public void setBeanFactoryPostProcessors(List beanFactoryPostProcessors)
Sets the BeanFactoryPostProcessors to apply to the configuration.

Parameters:
beanFactoryPostProcessors - the BeanFactoryPostProcessors to apply to the configuration

isVerbose

public boolean isVerbose()

setVerbose

public void setVerbose(boolean verbose)
Allows verbose logging to show what classpaths are being created


isShowIgnoredFiles

public boolean isShowIgnoredFiles()

setShowIgnoredFiles

public void setShowIgnoredFiles(boolean showIgnoredFiles)
Sets whether or not ignored files should be logged as they are encountered. This can sometimes be useful to catch typeos.


getJarDirectoryNames

public String[] getJarDirectoryNames()

setJarDirectoryNames

public void setJarDirectoryNames(String[] jarDirectoryNames)
Sets the names of the directories to be treated as folders of jars or class loader files. Defaults to "lib", "classes". If you wish to disable the use of lib and classes as being special folders containing jars or config files then just set this property to null or an empty array.


processDirectory

protected void processDirectory(String parentName,
                                ClassLoader classLoader,
                                org.springframework.context.ApplicationContext parentContext,
                                File directory)
                         throws org.apache.xbean.kernel.ServiceAlreadyExistsException,
                                org.apache.xbean.kernel.ServiceRegistrationException,
                                org.springframework.beans.BeansException,
                                IOException
Throws:
org.apache.xbean.kernel.ServiceAlreadyExistsException
org.apache.xbean.kernel.ServiceRegistrationException
org.springframework.beans.BeansException
IOException

createChildClassLoader

protected ClassLoader createChildClassLoader(String name,
                                             File dir,
                                             ClassLoader parentClassLoader)
                                      throws MalformedURLException
Throws:
MalformedURLException

createServiceForFile

protected void createServiceForFile(String name,
                                    File file,
                                    ClassLoader classLoader,
                                    org.springframework.context.ApplicationContext parentContext)
                             throws org.apache.xbean.kernel.ServiceAlreadyExistsException,
                                    org.apache.xbean.kernel.ServiceRegistrationException,
                                    org.springframework.beans.BeansException,
                                    IOException
Throws:
org.apache.xbean.kernel.ServiceAlreadyExistsException
org.apache.xbean.kernel.ServiceRegistrationException
org.springframework.beans.BeansException
IOException

isClassLoaderDirectory

protected boolean isClassLoaderDirectory(File file)

isSpringConfigFile

protected boolean isSpringConfigFile(File file)

getFileNameOrder

protected String[] getFileNameOrder(Properties properties)
Extracts the file names from the properties file for the order in which things should be deployed


getChildName

protected String getChildName(String parentName,
                              File file)


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.