kortsoft.kmx.deployer
Class KmxDaemon

java.lang.Object
  extended by kortsoft.kmx.deployer.KmxDaemon
All Implemented Interfaces:
KmxDaemonInterface, KmxDaemonMBean

public class KmxDaemon
extends java.lang.Object
implements KmxDaemonInterface, KmxDaemonMBean

KmxDameon responsability is to check modified or new components to be deployed. It must be assigned the directories to check (in the future it could check other sources) with the method setWatchDirectories(List). Takes the modified or new components and selects a Deployer taken within:

These Extra deployers must be assigned with the method addExtraDeployer(Class,FilenameFilter).

View Source

Version:
$Revision: 1.2 $
Author:
Alvaro

Constructor Summary
KmxDaemon()
           
 
Method Summary
 void addExtraDeployer(java.lang.Class<? extends Deployer> deployerType, java.io.FilenameFilter filter)
           
protected  java.util.List<java.io.File> checkDirectoryChanges(java.io.File directory, java.util.Map<java.io.File,java.lang.Long> lastLoadings)
          Check modifications in a directory.
 java.lang.ClassLoader getBaseClassLoader()
           
 java.util.List<java.io.File> getWatchDirectories()
           
protected  Deployer loadDeployer(java.io.File element)
          Loads an instance of a Deployer suitable for the specified file.
 void runDaemon()
          Executes one iteration of loading.
 void setBaseClassLoader(java.lang.ClassLoader baseClassLoader)
           
 void setWatchDirectories(java.util.List<java.io.File> watchDirectories)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KmxDaemon

public KmxDaemon()
Method Detail

checkDirectoryChanges

protected java.util.List<java.io.File> checkDirectoryChanges(java.io.File directory,
                                                             java.util.Map<java.io.File,java.lang.Long> lastLoadings)
Check modifications in a directory. New files and modified files/directories are returned as a List . It is passed a Map with the timestamp of the file/directory last load, so it can be compared with the modification timestamp.

Parameters:
directory -
lastLoadings -
Returns:

loadDeployer

protected Deployer loadDeployer(java.io.File element)
                         throws DeployerCreationException
Loads an instance of a Deployer suitable for the specified file. First seek for the deployer class in a caché if it has been loaded previously (now it is a reload). If it doesn't find the file in the caché, look for a deployer for that type of file (both in advanced Deployer and in default deployes).

Parameters:
jarFile -
Returns:
Throws:
DeployerCreationException

addExtraDeployer

public void addExtraDeployer(java.lang.Class<? extends Deployer> deployerType,
                             java.io.FilenameFilter filter)
Specified by:
addExtraDeployer in interface KmxDaemonInterface
Specified by:
addExtraDeployer in interface KmxDaemonMBean
Parameters:
name -
filter -

setWatchDirectories

public void setWatchDirectories(java.util.List<java.io.File> watchDirectories)
Specified by:
setWatchDirectories in interface KmxDaemonMBean
Parameters:
watchDirectories -

runDaemon

public void runDaemon()
Executes one iteration of loading.

Specified by:
runDaemon in interface KmxDaemonMBean

getWatchDirectories

public java.util.List<java.io.File> getWatchDirectories()
Specified by:
getWatchDirectories in interface KmxDaemonMBean
Returns:
Returns the watchDirectories.

getBaseClassLoader

public java.lang.ClassLoader getBaseClassLoader()
Specified by:
getBaseClassLoader in interface KmxDaemonMBean
Returns:
Returns the baseClassLoader.

setBaseClassLoader

public void setBaseClassLoader(java.lang.ClassLoader baseClassLoader)
Specified by:
setBaseClassLoader in interface KmxDaemonInterface
Parameters:
baseClassLoader - The baseClassLoader to set.


Copyright © 2005 Kortsoft. All Rights Reserved.