|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.extend.server.deployment.support.DeploymentDirectoryModule
public class DeploymentDirectoryModule
This module scans given URL for changes and then deploys/undeploys/redeploys modules added/removed/changed to it.
It uses KernelScheduler
for intervals for scanning.
Field Summary | |
---|---|
protected LinkedHashSet<Module> |
dependOnThis
List of modules that depend on this |
protected HashMap<File,Long> |
files
Map of files' last changed time from supplied directory |
protected URL |
location
Original location url |
protected DeploymentManager |
manager
Deployment manager everything is executed from |
protected ModuleId |
moduleId
Module name |
protected File |
path
Path |
protected SimpleScheduler |
scheduler
Scheduler to check changes in this directory |
protected int |
state
Module state |
Fields inherited from interface org.abstracthorizon.extend.server.deployment.Module |
---|
CREATED, DEFINED, STARTED, UNDEFINED, WAITING_ON_CREATE, WAITING_ON_CREATE_TO_START, WAITING_ON_START |
Constructor Summary | |
---|---|
DeploymentDirectoryModule()
Empty constructor |
Method Summary | |
---|---|
void |
create()
Does nothing |
void |
deploy(File file)
Deploys file loading module through main deployer DeploymentManager . |
void |
destroy()
Trys to undeploy files that were watched over |
boolean |
equals(Object o)
Compares two modules and returns true if names are the same |
ClassLoader |
getClassLoader()
Returns null . |
Set<Module> |
getDependOnThis()
Returns set of modules that depend on this. |
Set<Module> |
getDependsOn()
Returns an empty set. |
DeploymentManager |
getDeploymentManager()
Returns main deployer ( DeploymentManager ); |
ModuleId |
getModuleId()
Returns module's id |
URL |
getOriginalLocation()
Returns original location url. |
SimpleScheduler |
getScheduler()
Returns scheduler ( SimpleScheduler ) |
protected SimpleScheduler |
getSchedulerInternal()
This method is used internally for scheduler to be obtained. |
int |
getState()
Returns module's state |
String |
getStateAsString()
Returns module's state as a string |
URL |
getWorkingLocation()
Returns working location url. |
void |
redeploy(File file)
Re-deploys file finding module through main deployer DeploymentManager . |
protected void |
rescan()
Scans given directory for changes. |
void |
run()
Calls rescan() . |
void |
setDeploymentManager(DeploymentManager manager)
Sets main deployer ( DeploymentManager ); |
void |
setLocation(File file)
Sets location as a file |
void |
setLocation(URL location)
Sets location. |
void |
setModuleId(ModuleId moduleId)
Sets module's id |
void |
setScheduler(SimpleScheduler scheduler)
Sets scheduler ( SimpleScheduler ). |
void |
setState(int state)
Sets module's state |
void |
start()
Start scheduler over this directory |
void |
stop()
Stops scheduler |
void |
undeploy(File file)
Undeploys file finding module through main deployer DeploymentManager . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ModuleId moduleId
protected File path
protected URL location
protected int state
protected LinkedHashSet<Module> dependOnThis
protected SimpleScheduler scheduler
protected HashMap<File,Long> files
protected DeploymentManager manager
Constructor Detail |
---|
public DeploymentDirectoryModule()
Method Detail |
---|
public ClassLoader getClassLoader()
null
.
getClassLoader
in interface Module
null
public Set<Module> getDependOnThis()
getDependOnThis
in interface Module
public Set<Module> getDependsOn()
getDependsOn
in interface Module
public URL getOriginalLocation()
getOriginalLocation
in interface Module
public URL getWorkingLocation()
getWorkingLocation
in interface Module
public void setLocation(URL location)
location
- location
RuntimeException
- if url is not of file protocol and file part is not ending with "/"public void setLocation(File file)
file
- directory
RuntimeException
- if file is not a directorypublic ModuleId getModuleId()
getModuleId
in interface Module
public void setModuleId(ModuleId moduleId)
moduelId
- module's idpublic void create()
create
in interface Module
public void start()
start
in interface Module
public void stop()
stop
in interface Module
public void destroy()
destroy
in interface Module
public void run()
rescan()
.
run
in interface Runnable
protected void rescan()
DeploymentManager
. If file already existed and
last changed time is changed it is going to be redeployed.
public void deploy(File file)
DeploymentManager
.
file
- file to be deployedpublic void redeploy(File file)
DeploymentManager
.
file
- file to be redeployedpublic void undeploy(File file)
DeploymentManager
.
file
- file to be undeployedpublic void setState(int state)
setState
in interface Module
state
- module's statepublic int getState()
getState
in interface Module
public String getStateAsString()
public void setScheduler(SimpleScheduler scheduler)
SimpleScheduler
).
scheduler
- schedulerpublic SimpleScheduler getScheduler()
SimpleScheduler
)
protected SimpleScheduler getSchedulerInternal()
KernelScheduler
is
going to be used.
public DeploymentManager getDeploymentManager()
DeploymentManager
);
DeploymentManager
);public void setDeploymentManager(DeploymentManager manager)
DeploymentManager
);
manager
- main deployer (DeploymentManager
);public boolean equals(Object o)
true
if names are the same
equals
in class Object
o
- other object
true
if names are the same
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |