EAF 7.4 Implementation

org.enhydra.server
Class EnhydraServer

java.lang.Object
  extended by org.enhydra.server.EnhydraServer

public class EnhydraServer
extends java.lang.Object

Description: Class EnhydraServer use singleton pattern to provide all necessary data about registered (started) Enhydra applications. All application register itself on startup and unregister when shutdown. Admin application use this class to display applications info. Admin application should get instance of this class first, then calls public methods. Example:

EnhydraServer enhydraServer = EnhydraServer.getInstance();

SessionsInfo sessInfo = enhydraServer.getSessionsInfo();

String activeSessions = sessInfo.getActiveSessions();

...

Copyright: Copyright (c) 2002

Company: www.together.at

Version:
1.0
Author:
Damir Milovic, damir@uns.ns.ac.yu
See Also:
SessionsInfo

Field Summary
static java.lang.String APP_CLASS
           
protected static java.lang.String APP_CONNECTIONS
           
protected static java.lang.String APP_CONTEXTPATH
           
protected static java.lang.String APP_DESCRIPTION
           
protected static java.lang.String APP_NAME
           
protected static java.lang.String APP_RUNNING
           
protected static java.lang.String APP_URLPATH
          attributes in tag in EnhydraServer.xml configuration file.
static java.lang.String APPLICATION
           
static java.lang.String APPS_DIR
          Public static variables
static java.lang.String AUTO_RELOAD
           
static java.lang.String CLASS_NAME
           
static java.lang.String CLASS_PATH
           
static java.lang.String CONF_FILE
           
static java.lang.String CONF_FILE_CLASS
           
static java.lang.String CONNECTION
           
static java.lang.String DEFAULT_CONF_FILE
           
static java.lang.String DEFAULT_CONF_FILE_CLASS
           
static java.lang.String DEFAULT_LOG_CLASS
           
static java.lang.String DESCRIPTION
           
static java.lang.String DOC_ROOT
           
static java.lang.String ENABLED
           
static java.lang.String INIT_ARGS
           
static java.lang.String LOG_CLASS
           
static java.lang.String PRESENTATION_PREFIX
           
static java.lang.String RUNNING
           
static java.lang.String SERVER
           
static java.lang.String SERVLET
           
static java.lang.String SESSION_MANAGER
           
static java.lang.String SESSION_MANAGER_KEY
           
static java.lang.String URL
           
 
Method Summary
 boolean addApplication(java.lang.String appName, java.lang.String contextPath, java.lang.String urlFilePath, java.lang.String description)
          Adds new application to Enhydra server
 boolean addConnection(java.lang.String type, java.lang.String port)
          Add (create) connection to application server.
 boolean addConnection(java.lang.String type, java.lang.String port, java.lang.String password, java.lang.String pathToKeyStoreFile)
          Add (create) connection to application server.
 boolean disableConnection(java.lang.String appName, java.lang.String portNumber)
          Disable connection to the application on port number.
 boolean enableConnection(java.lang.String appName, java.lang.String portNumber)
          Enable connection to the application on port number.
 com.lutris.util.Config getAppConfig(java.lang.String appName)
          This method should be call for editing application config file.
 AppInfo getAppInfo(java.lang.String appName)
           
 org.enhydra.server.ApplicationServer getApplicationServer()
           
 java.lang.String[] getAppNames()
           
 java.lang.String getAppsDir()
          Get path to default Applications context root path.
 EnhydraServerXML getConfig()
           
 DatabaseEdit getDatabaseEdit(java.lang.String appName)
          Gets instasnce of DatabaseEdit class which is used in edditing of database parameters in configuration file of the application.
 DatabaseInfo getDatabaseInfo(java.lang.String appName)
           
 java.lang.String[] getEnabledConnections(java.lang.String appName)
          Method used by EnhydraPortFilter, provides list of enabled ports for given application name.
static EnhydraServer getInstance()
          Enhydra applications (HttpPresentationServlet) call this method to obtain EnhydraServer instance.
 PresentationInfo getPresentationInfo(java.lang.String appName)
           
 SessionEdit getSessionEdit(java.lang.String appName)
           
 SessionsInfo getSessionsInfo(java.lang.String appName)
           
 boolean isStarted()
          AdminGui should call this method to check is EnhydraServer started
 void register(javax.servlet.Servlet servlet)
          Enhydra Application (HttpPresentationServlet) register itself on startup.
 boolean removeApplication(java.lang.String appName)
          Remove application from Enhydra Server.
 boolean removeConnection(java.lang.String port)
           
 boolean saveState()
          Save state of EnhydraServer into xml config file
 void setApplicationServer(org.enhydra.server.ApplicationServer appServ)
          Implementation of ApplicationServer interface are responsible to set reference on himself.
static void setAppsfDir(java.lang.String dir)
          Set path to default Applications context root path.
 void shutdown()
          Shutdown EnhydraServer, including all applications and connections.
 boolean startApplication(java.lang.String appName)
          Start application.
 void startup()
          This method is responsible starting applications defined in EnhydraServer.conf file.
 boolean stopApplication(java.lang.String appName)
          Shutdown application.
 void stopApplicationServer()
          Shutdown application server
 void unRegister(javax.servlet.Servlet servlet)
          Enhydra Application unregister itself when stop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPS_DIR

public static final java.lang.String APPS_DIR
Public static variables

See Also:
Constant Field Values

SERVER

public static final java.lang.String SERVER
See Also:
Constant Field Values

APPLICATION

public static final java.lang.String APPLICATION
See Also:
Constant Field Values

CONF_FILE

public static final java.lang.String CONF_FILE
See Also:
Constant Field Values

DEFAULT_CONF_FILE

public static final java.lang.String DEFAULT_CONF_FILE
See Also:
Constant Field Values

CONF_FILE_CLASS

public static final java.lang.String CONF_FILE_CLASS
See Also:
Constant Field Values

DEFAULT_CONF_FILE_CLASS

public static final java.lang.String DEFAULT_CONF_FILE_CLASS
See Also:
Constant Field Values

LOG_CLASS

public static final java.lang.String LOG_CLASS
See Also:
Constant Field Values

DEFAULT_LOG_CLASS

public static final java.lang.String DEFAULT_LOG_CLASS
See Also:
Constant Field Values

SERVLET

public static final java.lang.String SERVLET
See Also:
Constant Field Values

CLASS_NAME

public static final java.lang.String CLASS_NAME
See Also:
Constant Field Values

DOC_ROOT

public static final java.lang.String DOC_ROOT
See Also:
Constant Field Values

DESCRIPTION

public static final java.lang.String DESCRIPTION
See Also:
Constant Field Values

RUNNING

public static final java.lang.String RUNNING
See Also:
Constant Field Values

CLASS_PATH

public static final java.lang.String CLASS_PATH
See Also:
Constant Field Values

INIT_ARGS

public static final java.lang.String INIT_ARGS
See Also:
Constant Field Values

URL

public static final java.lang.String URL
See Also:
Constant Field Values

CONNECTION

public static final java.lang.String CONNECTION
See Also:
Constant Field Values

ENABLED

public static final java.lang.String ENABLED
See Also:
Constant Field Values

APP_CLASS

public static final java.lang.String APP_CLASS
See Also:
Constant Field Values

PRESENTATION_PREFIX

public static final java.lang.String PRESENTATION_PREFIX
See Also:
Constant Field Values

AUTO_RELOAD

public static final java.lang.String AUTO_RELOAD
See Also:
Constant Field Values

SESSION_MANAGER

public static final java.lang.String SESSION_MANAGER
See Also:
Constant Field Values

SESSION_MANAGER_KEY

public static final java.lang.String SESSION_MANAGER_KEY
See Also:
Constant Field Values

APP_URLPATH

protected static final java.lang.String APP_URLPATH
attributes in tag in EnhydraServer.xml configuration file.

See Also:
Constant Field Values

APP_CONTEXTPATH

protected static final java.lang.String APP_CONTEXTPATH
See Also:
Constant Field Values

APP_NAME

protected static final java.lang.String APP_NAME
See Also:
Constant Field Values

APP_DESCRIPTION

protected static final java.lang.String APP_DESCRIPTION
See Also:
Constant Field Values

APP_RUNNING

protected static final java.lang.String APP_RUNNING
See Also:
Constant Field Values

APP_CONNECTIONS

protected static final java.lang.String APP_CONNECTIONS
See Also:
Constant Field Values
Method Detail

getInstance

public static EnhydraServer getInstance()
Enhydra applications (HttpPresentationServlet) call this method to obtain EnhydraServer instance.

Returns:
One and only instance (singleton pattern) of this class.

startup

public void startup()
This method is responsible starting applications defined in EnhydraServer.conf file. ApplicationServer call this method when all necessary application server initialization are done and ApplicationServer reference is setted.


register

public void register(javax.servlet.Servlet servlet)
Enhydra Application (HttpPresentationServlet) register itself on startup.

Parameters:
servlet - only HttpPresentationServlet is currently supported.

unRegister

public void unRegister(javax.servlet.Servlet servlet)
Enhydra Application unregister itself when stop.

Parameters:
servlet - usualy HttpPresentationServlet.

setAppsfDir

public static void setAppsfDir(java.lang.String dir)
Set path to default Applications context root path. Application context url can be relative against this path.

Parameters:
dir - absolute path to directory, where are application context reside.

getAppsDir

public java.lang.String getAppsDir()
Get path to default Applications context root path.

Returns:
absolute path to directory, where are application context reside.

getAppInfo

public AppInfo getAppInfo(java.lang.String appName)
Parameters:
appName - application name.
Returns:
AppInfo contains all necessary application data.
See Also:
AppInfo

getPresentationInfo

public PresentationInfo getPresentationInfo(java.lang.String appName)
Parameters:
appName - - application name
Returns:
PresentationInfo - JavaBean with getter methods
See Also:
PresentationInfo

getSessionsInfo

public SessionsInfo getSessionsInfo(java.lang.String appName)
Parameters:
appName - - application name
Returns:
SessionInfo - JavaBean with getter methods
See Also:
SessionsInfo

getSessionEdit

public SessionEdit getSessionEdit(java.lang.String appName)
Parameters:
appName - applicatin name
Returns:
SessionEdit class for editing SessionManager parameters in conf file.
See Also:
SessionEdit

getDatabaseInfo

public DatabaseInfo getDatabaseInfo(java.lang.String appName)
Parameters:
appName - - application name.
Returns:
DatabaseInfo - JavaBean with getter methods.
See Also:
SessionsInfo

getDatabaseEdit

public DatabaseEdit getDatabaseEdit(java.lang.String appName)
Gets instasnce of DatabaseEdit class which is used in edditing of database parameters in configuration file of the application.

Parameters:
appName - the applicatin name.
Returns:
instasnce of DatabaseEdit class.

getApplicationServer

public org.enhydra.server.ApplicationServer getApplicationServer()
Returns:
instance of class that implements ApplicationServer

setApplicationServer

public void setApplicationServer(org.enhydra.server.ApplicationServer appServ)
Implementation of ApplicationServer interface are responsible to set reference on himself.

Parameters:
appServ - Implementation of ApplicationServer.

saveState

public boolean saveState()
Save state of EnhydraServer into xml config file

Returns:
TRUE if OK, else FALSE.

startApplication

public boolean startApplication(java.lang.String appName)
Start application.

Parameters:
appName - application name.
Returns:
OK if application successfuly started, else FALSE.

stopApplication

public boolean stopApplication(java.lang.String appName)
Shutdown application.

Parameters:
appName - application name.
Returns:
OK if application successfuly stopped, else FALSE.

stopApplicationServer

public void stopApplicationServer()
Shutdown application server


shutdown

public void shutdown()
Shutdown EnhydraServer, including all applications and connections.


addConnection

public boolean addConnection(java.lang.String type,
                             java.lang.String port)
Add (create) connection to application server. Admin Presentation should first check available types, before call this method.

Parameters:
type - Connection type ("http","ajp",..) depends on Application Server.
port - Port nubber.
Returns:
TRUE if connection added successfuly.

addConnection

public boolean addConnection(java.lang.String type,
                             java.lang.String port,
                             java.lang.String password,
                             java.lang.String pathToKeyStoreFile)
Add (create) connection to application server.

Parameters:
type - Connection type ("http","ajp","https"..) depends on Application Server.
port - Port nubber.
password - for "https" required.
pathToKeyStoreFile - absolute path to KeyStore file for "https" required.
Returns:

removeConnection

public boolean removeConnection(java.lang.String port)

enableConnection

public boolean enableConnection(java.lang.String appName,
                                java.lang.String portNumber)
Enable connection to the application on port number.

Parameters:
appName - application name.
portNumber - port number of corresponding connection.
Returns:
TRUE if connection successfuly enabled, else FALSE.

disableConnection

public boolean disableConnection(java.lang.String appName,
                                 java.lang.String portNumber)
Disable connection to the application on port number.

Parameters:
appName - application name.
portNumber - port number of corresponding connection.
Returns:
TRUE if connection successfuly disabled, else FALSE.

getEnabledConnections

public java.lang.String[] getEnabledConnections(java.lang.String appName)
Method used by EnhydraPortFilter, provides list of enabled ports for given application name.

Parameters:
appName - Application name.
Returns:
Array of enabled port numbers .

getAppConfig

public com.lutris.util.Config getAppConfig(java.lang.String appName)
This method should be call for editing application config file.

Parameters:
appName - application name
Returns:
application Config object.
See Also:
Config

getAppNames

public java.lang.String[] getAppNames()
Returns:
names of all available applications

getConfig

public EnhydraServerXML getConfig()

addApplication

public boolean addApplication(java.lang.String appName,
                              java.lang.String contextPath,
                              java.lang.String urlFilePath,
                              java.lang.String description)
Adds new application to Enhydra server

Parameters:
appName - application name.
contextPath - context path ( e.g. '/myapp')
urlPath - url path file (application root directory or path to war file). If path is relative it is resolved against %ENHYDRA_HOME/apps directory.
description - application description not required.
Returns:
true if application added successfuly, else false.

removeApplication

public boolean removeApplication(java.lang.String appName)
Remove application from Enhydra Server.

Parameters:
appName - application name.
Returns:
true if application removing was successful.

isStarted

public boolean isStarted()
AdminGui should call this method to check is EnhydraServer started

Returns:
true if EnhydraServer started

EAF 7.4 Implementation