|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.io.DefaultResourceLoader org.springframework.context.support.AbstractApplicationContext org.springframework.context.support.AbstractRefreshableApplicationContext org.springframework.context.support.AbstractXmlApplicationContext org.abstracthorizon.extend.support.spring.deployment.AbstractApplicationContextModule
public abstract class AbstractApplicationContextModule
This class is base class for spring application context modules. That means module represents a kind of application context in spring terms loaded from module's location.
Nested Class Summary | |
---|---|
class |
AbstractApplicationContextModule.DeployersDefaultListableBeanFactory
Class that tries to load beans from current context or any context this context depends on. |
Field Summary | |
---|---|
protected LinkedHashSet<Module> |
dependOnThis
List of modules that depend on this module |
protected LinkedHashSet<Module> |
dependsOn
List of modules this module depends on |
protected DeploymentManager |
deploymentManager
Deployment manager |
protected ClassLoader |
internalClassLoader
Internal class loader |
protected ModuleId |
moduleId
Module id |
protected URL |
originalLocation
Original location this archive was unpacked from |
protected ModuleClassLoader |
overallClassLoader
Application context's class loader |
protected URL |
serviceFile
Application context xml file |
protected int |
state
Module's state |
protected URL |
workingLocation
Module's location |
Fields inherited from class org.springframework.context.support.AbstractApplicationContext |
---|
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, MESSAGE_SOURCE_BEAN_NAME |
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 |
Fields inherited from interface org.springframework.beans.factory.BeanFactory |
---|
FACTORY_BEAN_PREFIX |
Fields inherited from interface org.springframework.beans.factory.BeanFactory |
---|
FACTORY_BEAN_PREFIX |
Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver |
---|
CLASSPATH_ALL_URL_PREFIX |
Fields inherited from interface org.springframework.core.io.ResourceLoader |
---|
CLASSPATH_URL_PREFIX |
Constructor Summary | |
---|---|
AbstractApplicationContextModule(ModuleId moduleId)
Constructor that creates overall class loader (context's class loader). |
Method Summary | |
---|---|
void |
create()
This method invokes createInternal() method. |
DefaultListableBeanFactory |
createBeanFactory()
Creates AbstractApplicationContextModule.DeployersDefaultListableBeanFactory instead of
original. |
protected void |
createClassLoaders()
Called when location is set for class loader to be created. |
protected abstract void |
createInternal()
This method is to be implemented by extension. |
protected URL |
createServiceFile()
Creates service file URL |
void |
destroy()
This method calls stopInternal() and then calls Module.stop() of all dependent modules. |
protected abstract void |
destroyInternal()
This method is to be implemented by extension. |
boolean |
equals(Object o)
Compares two modules and returns true if names are the same |
ClassLoader |
getClassLoader()
Return's module's class loader (top most internalClassLoader ). |
protected String[] |
getConfigLocations()
This method returns config location for this AbstractXmlApplicationContext
instance. |
protected String |
getContextFileName()
This is template method for name of application context xml file. |
Set<Module> |
getDependOnThis()
Returns set of modules that depend on this module. |
Set<Module> |
getDependsOn()
Returns set of modules this module depends on. |
DeploymentManager |
getDeploymentManager()
Returns deployment manager |
ModuleId |
getModuleId()
Returns module's id |
URL |
getOriginalLocation()
Returns original location this archive was unpacked from. |
Resource |
getResource(String location)
Returns resource for given location |
URL |
getServiceFile()
Returns service file url |
int |
getState()
Returns module's state |
String |
getStateAsString()
Returns module's state as a string |
URL |
getWorkingLocation()
Returns the location. |
protected void |
initBeanDefinitionReader(XmlBeanDefinitionReader xmlbeandefinitionreader)
Sets up parser for this application context. |
protected boolean |
processDependencies(List<Dependency> dependencies)
This method is called by parser to process dependencies it collected before rest of bean information is processed by the parser. |
void |
setDeploymentManager(DeploymentManager deploymentManager)
Sets deployment manager |
void |
setLocation(URL location)
Sets the location. |
void |
setModuleId(ModuleId moduleId)
Sets module's name |
void |
setOriginalLocation(URL originalLocation)
Sets original location |
void |
setState(int state)
Sets module's state |
void |
start()
This method calls startInternal() and then calls Module.start() of all dependent modules. |
protected abstract void |
startInternal()
This method is to be implemented by extension. |
void |
stop()
This method calls stopInternal() and then calls Module.stop() of all dependent modules. |
protected abstract void |
stopInternal()
This method is to be implemented by extension. |
String |
toString()
Returns module's name followed by colon and string representation of AbstractXmlApplicationContext object. |
Methods inherited from class org.springframework.context.support.AbstractXmlApplicationContext |
---|
getConfigResources, loadBeanDefinitions, loadBeanDefinitions |
Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext |
---|
closeBeanFactory, customizeBeanFactory, getBeanFactory, refreshBeanFactory |
Methods inherited from class org.springframework.core.io.DefaultResourceLoader |
---|
getResourceByPath, setClassLoader |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ModuleId moduleId
protected LinkedHashSet<Module> dependsOn
protected LinkedHashSet<Module> dependOnThis
protected ClassLoader internalClassLoader
protected ModuleClassLoader overallClassLoader
protected URL originalLocation
protected URL workingLocation
protected URL serviceFile
protected int state
protected DeploymentManager deploymentManager
Constructor Detail |
---|
public AbstractApplicationContextModule(ModuleId moduleId)
Method Detail |
---|
public void setDeploymentManager(DeploymentManager deploymentManager)
deploymentManager
- deployment managerpublic DeploymentManager getDeploymentManager()
protected String[] getConfigLocations()
AbstractXmlApplicationContext
instance. It uses serviceFile
for it converted to a string.
getConfigLocations
in class AbstractXmlApplicationContext
serviceFile
converted to a string.public void create()
createInternal()
method. After that it
loads modules context from serviceFile
and invokes
Module.create()
method on all dependent modules.
create
in interface Module
public void start()
startInternal()
and then calls Module.start()
of all dependent modules.
start
in interface Module
start
in interface Lifecycle
start
in class AbstractApplicationContext
public void stop()
stopInternal()
and then calls Module.stop()
of all dependent modules.
If module's state is Module.WAITING_ON_START
then only state of module is updated (to Module.CREATED
.
stop
in interface Module
stop
in interface Lifecycle
stop
in class AbstractApplicationContext
public void destroy()
stopInternal()
and then calls Module.stop()
of all dependent modules.
At last it closes this application context releasing resources.
If module's state is Module.WAITING_ON_CREATE
then only state of module is updated (to Module.DEFINED
.
destroy
in interface Module
destroy
in interface DisposableBean
destroy
in class AbstractApplicationContext
protected abstract void createInternal()
create()
method is called
protected abstract void startInternal()
start()
method is called
protected abstract void stopInternal()
stop()
method is called
protected abstract void destroyInternal()
destroy()
method is called
protected void initBeanDefinitionReader(XmlBeanDefinitionReader xmlbeandefinitionreader)
ApplicationContextModuleXmlParser
without validation
with internalClassLoader
.
initBeanDefinitionReader
in class AbstractXmlApplicationContext
protected boolean processDependencies(List<Dependency> dependencies)
dependencies
- list of dependencies (as Strings).
true
if all dependencies are resolved positively (modules are already defined). If
any of modules is missing false
is going to be returned.public URL getOriginalLocation()
getWorkingLocation()
if archive is an directory.
getOriginalLocation
in interface Module
public void setOriginalLocation(URL originalLocation)
originalLocation
- original locationpublic URL getWorkingLocation()
getWorkingLocation
in interface Module
public void setLocation(URL location)
location
- the location to set.
RuntimeException
- in case of IOExceptionprotected URL createServiceFile() throws IOException
IOException
public URL getServiceFile()
protected String getContextFileName()
protected void createClassLoaders()
public ClassLoader getClassLoader()
internalClassLoader
).
getClassLoader
in interface Module
getClassLoader
in interface ResourceLoader
getClassLoader
in class DefaultResourceLoader
public Set<Module> getDependsOn()
getDependsOn
in interface Module
public Set<Module> getDependOnThis()
getDependOnThis
in interface Module
public void setModuleId(ModuleId moduleId)
moduleId
- module's idpublic ModuleId getModuleId()
getModuleId
in interface Module
public String toString()
AbstractXmlApplicationContext
object.
toString
in class AbstractApplicationContext
public DefaultListableBeanFactory createBeanFactory()
AbstractApplicationContextModule.DeployersDefaultListableBeanFactory
instead of
original.
createBeanFactory
in class AbstractRefreshableApplicationContext
AbstractApplicationContextModule.DeployersDefaultListableBeanFactory
public int getState()
getState
in interface Module
public void setState(int state)
setState
in interface Module
state
- module's statepublic String getStateAsString()
public Resource getResource(String location)
getResource
in interface ResourceLoader
getResource
in class DefaultResourceLoader
location
- location
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 |