Extend is composed of a server core and a set of modules.
The server core (Server ) is started by a bootstrap loader that sets a minimal class loader needed for running of the server. The server core then sets up further class loader with all supplied jars from a lib directory and creates an application context from configuration xml file (which is Spring Framework 's application context file). After that, it registers self with that application context as an singleton bean with the name "Server".
The server then starts deployment of a given URL. If not URL is supplied for server to run from a default location (directory named "server" is used instead). The deployment is done by obtaining "DeploymentManager" bean of DeploymentManager type and "DeploymentDirectoryModuleLoader" of DeploymentDirectoryModuleLoader type. The later is then used for the given URL to be deployed with.
The server is organised around Module s. Each module describes an unit that exists within a server's boundaries. The modules are organised in a hierarcy of dependancies.
Modules have well defined life cycle:
createmethod is succesfully called.
startmethod is called.
Modules are delivered to the system (loaded) by
When an URL is supplied to the server as a source of a module, all defined module loaders are checked in turn
(in the order they are defined in the system) to load that URL. If the module returns
on call of
method, delegation of loading of that module is passed to that module loader. A concrete class of
loaded module is actually defined by the module loader.
There is one type of modules defined in the core part of the server: Service Archives. Those are modules that are defined in jar archives or directories with ".sar" extensions. For each service archive an application context is created and bean definitions loaded from a file named "service.xml". All jar files in the root of the archive as well as archive itself are used to form a classpath.
The application context has access to all application contexts of the modules this module depends on. Same stands to the class loaders.
The service archive extends definition of an XML files adding "<service>" tag bean definition. A presence of that tag denotes that bean is not ordinary bean but a service bean. The service beans can be created, started, stopped and destroyed along with the service module. For each bean these method names can be defined using sub-tags: "<create-method>", "<start-method>", "<stop-method>" and "<destroy-method>". By omitting any of these sub-tags the service archive will use default values "create", "start", "stop" and "destroy". Making tags with empty value (like "<destroy-method />") will signal to the service not to call the method. If no argument method doesn't exist then it just wont be called.
With this granularity of methods each service has four states in its lifecycle:
createmethod is called. It is managed by the spring application server.
startmethod is called. That is, too, managed by the spring application server.
Here is directory structure spring application server operates from:
bin bootstrap.jar - bootstrap jar file lib libraries needed for the server to work server default config server.xml - the server's application context lib libraries needed for services - they are going to be visible from all modules deploy directory that contains deployable modules (.sar archives or directories, .war, etc...)
It is possible for different server directory to be used instead of the default. It is done by supplying argument -c <name of subdirectory> while starting bootstrap.jar. That directory is the directory the rest of the code is going to be executed from.
Also, path of the server directory can be specified as an argument -server followed by URL while starting bootstrap.jar.