|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.iges.anagram.Server
The top-level module of the Anagram framework. All other modules share a reference to a single Server instance.
The Server class performs four basic functions. It obtains Anagram properties from the enviroment, creates the modules that will make up the server, initiates the configuration process, and provides each module with access to the others.
Anagram properties are mostly intended to be set by the developer, not the user, and are guaranteed not to change during the life of the server (unlike configuration settings from the configuration file). They include basic things such as the name of the Anagram implementation, and its support home page.
The modules that will make up the Anagram implementation are created by the Server module at startup. Dynamic module creation may be supported in the future, but for now, the module structure of the server does not change over the lifetime of the Server.
In contrast, the server's configuration can change multiple times during the life of the server. Configuration is performed once when the server is created, but may also be triggered again by an administrative request. This allows the server's settings and data holdings to be updated without restarting the servlet or its container.
Configuration consists of parsing the XML configuration file specified by the Anagram property "anagram.config", and passing the appropriate portions of it to the configure() methods of the various modules.
Finally, each module can access other modules using its reference to the Server. Since modules remain constant for the lifetime of the server, it is safe for a module to save the references it obtains from the server.
Field Summary | |
protected Catalog |
catalog
|
protected java.io.File |
configFile
|
protected java.lang.String |
implClass
|
protected java.lang.String |
implHome
|
protected java.lang.String |
implLongName
|
protected java.lang.String |
implName
|
protected java.lang.String |
implVersion
|
protected long |
lastConfigTime
|
protected Log |
log
|
protected Mapper |
mapper
|
protected int |
outputLevel
|
protected PrivilegeMgr |
privilegeMgr
|
protected java.lang.String |
serverHome
|
protected java.lang.String |
serverName
|
protected AnagramServlet |
servlet
|
protected java.lang.String |
siteHome
|
protected long |
startTime
|
protected Store |
store
|
protected ExclusiveLock |
synch
|
protected Tool |
tool
|
Constructor Summary | |
Server(AnagramServlet servlet,
ServletConfig servletConfig)
Creates a new instance of the Anagram framework connected to the servlet specified . |
Method Summary | |
protected void |
configModule(Module module,
Setting setting)
|
void |
configure(Setting setting)
This method should not be called from outside Server. |
protected void |
createModules()
Creates the components of the server |
void |
destroy()
Shuts down the server |
protected void |
fail(java.lang.String msg,
java.lang.Throwable t)
|
Catalog |
getCatalog()
Returns a handle to the data object catalog |
java.lang.String |
getHome()
Returns the home directory of the server installation. |
java.lang.String |
getImplHomePage()
Returns a URL where more information can be obtained about this Anagram implementation, so that it can be included in web pages and user messages. |
java.lang.String |
getImplName()
Returns the descriptive name of this Anagram implementation, so that it can be included in web pages and user messages. |
java.lang.String |
getImplVersion()
Returns the version number for this Anagram implementation, so that it can be included in web pages and user messages. |
long |
getLastConfigTime()
Returns the last time that the server's configuration changed, or else the time that the server was created. |
Log |
getLog()
Returns a handle to the logger |
Mapper |
getMapper()
Returns a handle to the service mapper |
java.lang.String |
getModuleID()
The module ID of the server is determined by the Anagram property "anagram.impl". |
java.lang.String |
getModuleName()
Because the server is the top-level module, its module name is identical to its module ID. |
PrivilegeMgr |
getPrivilegeMgr()
Returns a handle to the privilege manager |
protected java.lang.String |
getProperty(ServletConfig config,
java.lang.String name,
java.lang.String defaultValue)
|
java.lang.String |
getServerName()
Returns the descriptive name of this server instance. |
AnagramServlet |
getServlet()
Returns a handle to the servlet |
java.lang.String |
getSiteHomePage(java.lang.String defaultHome)
Returns the home page for this server instance. |
Store |
getStore()
Returns a handle to the temporary storage interface |
ExclusiveLock |
getSynch()
Used to synchronize operations on the entire server. |
Tool |
getTool()
Returns a handle to the data tool |
void |
init(Server server,
Module parent)
Does nothing for Server |
protected Setting |
loadConfig()
|
protected void |
log(int level,
java.lang.String msg)
|
void |
reconfigure()
Checks the configuration file, and if it has been modified, parses it and reconfigures the entire server to the new settings. |
protected void |
startLog(Setting setting)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ExclusiveLock synch
protected int outputLevel
protected java.lang.String implClass
protected java.lang.String implName
protected java.lang.String implLongName
protected java.lang.String implVersion
protected java.lang.String implHome
protected java.lang.String serverName
protected java.lang.String siteHome
protected java.lang.String serverHome
protected java.io.File configFile
protected long lastConfigTime
protected long startTime
protected Tool tool
protected Mapper mapper
protected Log log
protected Store store
protected Catalog catalog
protected PrivilegeMgr privilegeMgr
protected AnagramServlet servlet
Constructor Detail |
public Server(AnagramServlet servlet, ServletConfig servletConfig) throws ServletException
Method Detail |
public ExclusiveLock getSynch()
public java.lang.String getModuleID()
getModuleID
in interface Module
public java.lang.String getModuleName()
getModuleName
in interface Module
public java.lang.String getServerName()
public java.lang.String getSiteHomePage(java.lang.String defaultHome)
public java.lang.String getHome()
FileResolver
public java.lang.String getImplName()
public java.lang.String getImplVersion()
public java.lang.String getImplHomePage()
protected void fail(java.lang.String msg, java.lang.Throwable t) throws ServletException
ServletException
public void init(Server server, Module parent)
init
in interface Module
public void reconfigure() throws ModuleException
ModuleException
public void configure(Setting setting) throws ConfigException
configure
in interface Module
ConfigException
- If the module is unable to operate using
the settings provided. This will halt the server's operation, and
thus should only be thrown if there is no reasonable default
that can be used in place of a missing or invalid setting.public long getLastConfigTime()
public Mapper getMapper()
public AnagramServlet getServlet()
public Tool getTool()
public Log getLog()
public Store getStore()
public Catalog getCatalog()
public PrivilegeMgr getPrivilegeMgr()
public void destroy()
protected java.lang.String getProperty(ServletConfig config, java.lang.String name, java.lang.String defaultValue)
protected Setting loadConfig() throws ConfigException
ConfigException
protected void startLog(Setting setting) throws ConfigException
ConfigException
protected void createModules() throws ConfigException
ConfigException
protected void configModule(Module module, Setting setting) throws ConfigException
ConfigException
protected void log(int level, java.lang.String msg)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |