|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.loco.Loco
The org.locomotive.loco.Loco is the primary entry point for the Org.Locomotive. Application Server. The server is launched by invoking the java interpreter on this class, which contains the main (String args[]) method.
A series of srguments may be specified as command line options. These include:
Constructor Summary | |
Loco()
a basic wrapper for the constructor |
Method Summary | |
static boolean |
createDBConnectionPool(LocoConfig lc)
creates the main Locomotive Database connection pool. |
static void |
disposeDBConnection(java.sql.Connection c)
throws away a Connection that has been corrupted, for example, by a SQLException, so that it will be deleted from the DBConnection Pool. |
static java.lang.String |
evaluateTemplate(java.lang.String rel_path,
java.util.Hashtable env)
Evalute a template. |
static int |
getActiveThreadCount()
Returns the number of active RequestManager Threads. |
static boolean |
getAutoSessionHandling()
returns the current value of the auto_session_handling flag. |
static LocoConfig |
getConfig()
returns the LocoConfig of the server |
static int |
getCurrentRequestID()
gets the current value of the request id. |
static java.sql.Connection |
getDBConnection()
Gets a Connection from the Request Manager's DBConnection Pool. |
static Log |
getEventLog()
gets the reference to the main server log of the Loco |
static DBCache |
getGlobalDBCache()
Get the global DBCache for Loco. |
static java.util.Properties |
getHandlerProperties(Handler h)
This will return the Properties object associated with a Handler, if there is any. |
static int |
getMaxThreadPoolSize()
Returns the number of active RequestManager Threads. |
static int |
getOpenDBConnectionCount()
used by the Server Handler for status |
static Log |
getServerLog()
gets the reference to the main server log of the Loco |
java.lang.String |
getServerRoot()
Get the server root. |
static java.util.Date |
getStartupDate()
returns the startup date of the Loco |
static int |
getThreadPoolSize()
Returns the number of active RequestManager Threads. |
static java.lang.String |
getVersionString()
returns the Version Number of the server |
static void |
log(int lev,
java.lang.String s)
log to the Loco server log |
static void |
logEvent(int level,
HandlerData hd,
java.lang.String major,
java.lang.String minor,
java.lang.String data)
log to the Loco event log - simplified version |
static void |
logEvent(int level,
int rid,
Session sess,
User u,
java.lang.String major,
java.lang.String minor,
java.lang.String data)
log to the Loco event log |
static void |
main(java.lang.String[] argv)
This method is called by the JVM at server startup. |
static void |
putBackDBConnection(java.sql.Connection c)
Returns a Connection object back to the RequestManager DBConnection Pool. |
static void |
redirect(java.lang.String request_uri,
HandlerData hd)
Redirects a given request to a new handler for completion. |
protected static boolean |
reloadDBConnectionPool()
Wipes all the current database connections from the DBConnectionPool and reloads it with new ones. |
protected static void |
reloadHandler(java.lang.String handler)
Marks the Handler class specified by the string for reloading, which means that upon the next request for that handler, the handler's properties file will be reloaded and the handler's init() method will be called. |
protected static boolean |
reloadHandlerRoutingTable()
Reloads the hrt.conf file, then reinitializes all the handlers and reloads each of their properties files. |
static void |
reloadServlet(java.lang.String Servlet)
Marks the Servlet class specified by the string for reloading, which means that upon the next request for that Servlet, the Servlet's properties file will be reloaded and the Servlet's init() method will be called. |
static boolean |
reloadServletRoutingTable()
Reloads the hrt.conf file, then reinitializes all the Servlets and reloads each of their properties files. |
static void |
sendErrorMsg(java.lang.String error_msg,
HandlerData hd)
Displays and error page with Standard insertions, plus a the error string for the class. |
static void |
setAutoSessionHandling(boolean on)
toggle auto session handling If true, which is the default, the RequestManager will automatically sense expired sessions. |
static void |
setConnectionPool(DBConnectionPool connectionPool)
Set the connection pool to use for this loco. |
static void |
setEventLog(Log eventLog)
set the event log for this loco. |
static void |
setServerLog(Log serverLog)
Set the log for this loco. |
void |
setServerRoot(java.lang.String serverRoot)
Set the server root. |
static void |
setStopAccepting()
for shutting down the Loco. |
static void |
setThreadPoolManager(ThreadPoolManager tpm)
Set the thread pool manager for this loco. |
static void |
startWebServers(java.lang.String server_list)
Start up any/all web servers from the space-separated list of instance names passed to this method. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Loco()
Method Detail |
public static void main(java.lang.String[] argv)
public static void log(int lev, java.lang.String s)
lev
- the log levels
- a string to be loggedpublic static void logEvent(int level, HandlerData hd, java.lang.String major, java.lang.String minor, java.lang.String data)
level
- - the log levelhd
- - a HandlerData object as passed into a handlermajor
- - the major event region or code sectionminor
- - the minor event codedata
- - event specific datapublic static void logEvent(int level, int rid, Session sess, User u, java.lang.String major, java.lang.String minor, java.lang.String data)
level
- - the log levelrid
- - the response id (used mostly for debugging)sess
- - the current sessionu
- - the Usermajor
- - the major event region or code sectionminor
- - the minor event codedata
- - event specific datapublic static void startWebServers(java.lang.String server_list)
server_list
- a space-separated list of web server instance names
to start. The instance names can be anything, but
there must be an aptly-named config file for each.public static java.lang.String evaluateTemplate(java.lang.String rel_path, java.util.Hashtable env)
rel_path
- the relative path to the template fileenv
- the evaluation environment hashorg.locomotive.server.CachedPageLoader
public static Log getServerLog()
public static void setServerLog(Log serverLog)
public static Log getEventLog()
public static void setEventLog(Log eventLog)
public static void redirect(java.lang.String request_uri, HandlerData hd)
The handler_uri is parsed to create a new hd.url_tokens,
which is then used to determine how the new request will be handled.
It should appear as if the first handler was never called,
with a few exceptions:
Any changes to variables in hd made by the first handler
will remain, and the value of 'hd.url' (called hd.handler_uri
in versions beyond 3.6) is left unmodified by the redirect.
In future versions, it too may
be reset to the value passed in via the redirect call.
If it is important for the second handler to know something about the first, we recommend passing a flag or data via the cgi_envars or subs hashes in hd.
handler_uri
- the hander_uri specifying any parameters and
the handler name to redirect to. A null or empty string
will result in the DefaultHandler. Typically of the forms: "/handler/pathtoken/other?querytoken1+querytoken2" or
"handler?querytoken1+querytoken2" or
"handler"
with zero or more path tokens and or zero or more query tokens, depending on how the url structure has been designed.
hd
- the HandlerData instance passed into the first Handler, or
a newly constructed one if necessary.public static int getActiveThreadCount()
public static int getThreadPoolSize()
public static int getMaxThreadPoolSize()
public static void setThreadPoolManager(ThreadPoolManager tpm)
public static java.util.Date getStartupDate()
public static int getCurrentRequestID()
public static java.sql.Connection getDBConnection()
public static void putBackDBConnection(java.sql.Connection c)
public static void disposeDBConnection(java.sql.Connection c)
public static int getOpenDBConnectionCount()
public static boolean createDBConnectionPool(LocoConfig lc)
protected static boolean reloadDBConnectionPool()
This isn't currently as safe as it should be, as it wipes the current connections without checking to see if it creates new ones. So, calling this could potentially result in a loco hang, if new connections can't be created. Watch out! Note, however, that this isn't as serious as it seems, because inability to create a new connection is often a symptom of problems that affect general database communication, and so the inability to reload would probably only happen when the loco isn't able to talk to the database at all.
public static void setConnectionPool(DBConnectionPool connectionPool)
connectionPool
- The connection pool.public static void setAutoSessionHandling(boolean on)
on
- new value of auto session handling flagpublic static boolean getAutoSessionHandling()
setAutoSessionHandling
protected static void reloadHandler(java.lang.String handler)
token
- the token that refers to the Handler class in the
hrt.conf fileprotected static boolean reloadHandlerRoutingTable()
public static java.util.Properties getHandlerProperties(Handler h)
Each Properties object associated with a Handler will have at least one variable in it-
PROPERTIES_PATHwhich is the absolute path to the file the Properties were loaded from. This will allow Handlers to manipulate and re-store their Properties.
Handler
,
HandlerData.handler_config
public static void reloadServlet(java.lang.String Servlet)
token
- the token that refers to the Servlet class in the
hrt.conf filepublic static boolean reloadServletRoutingTable()
public static void setStopAccepting()
public static LocoConfig getConfig()
public static DBCache getGlobalDBCache()
public static java.lang.String getVersionString()
public static void sendErrorMsg(java.lang.String error_msg, HandlerData hd)
error_msg
- The mesage to display. If left blank or null,
then the following will message will be displayed: Your request could not be processed due to an
internal handler error.
hd
- the handlerData object whose request we should send the
response through.public java.lang.String getServerRoot()
public void setServerRoot(java.lang.String serverRoot)
serverRoot
- The server root for this locomotive.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |