com.lightdev.app.trec.server
Class Server

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.lightdev.app.trec.server.Server
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Server
extends javax.servlet.http.HttpServlet

An application server in the context of the Light Development Transparent Remote Computing (TREC) platform.

A Server is the topmost server side object of the TREC platform. When deployed to a Java EE compatible application server and called for the first time, the default implementation automatically creates an Apache Derby database which it uses as encapsulated SAM user data store.

Please note that the database driver for Derby is not included in the TREC distribution. It can be obtained free of charge at http://db.apache.org/derby/ and is best placed in the common/lib directory of the Java EE application server that is to host the TREC platform.

Version:
2, 30.12.2005
Author:
Ulrich Hilger, Light Development, http://www.lightdev.com, info@lightdev.com, published under the terms and conditions of the BSD License, for details see file license.txt in the distribution package of this software
See Also:
SAMXmlRpcServer, Serialized Form

Field Summary
static String AGENTS_FILE_NAME
           
static int STORE_TYPE_EMBEDDED
           
static int STORE_TYPE_ROOT
           
static int STORE_TYPE_SHARED_JDBC
           
static String TREC_PROPERTIES_FILE_NAME
           
static String TREC_PROPERTY_SAM_CONNECT_STRING
           
static String TREC_PROPERTY_SAM_DB_DRIVER
           
static String TREC_PROPERTY_SAM_TYPE
           
static int UDSS_CONNECT_STR
           
static int UDSS_DRIVER
           
static int UDSS_TYPE
           
 
Constructor Summary
Server()
          constructor
 
Method Summary
 void destroy()
          called when Servlet goes out of service
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          handle a HTTP GET request
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          handle a HTTP POST request
 String getBaseDir()
          get the base directory of this server.
 SAMXmlRpcServer getSAMXmlRpcServer()
          get the XML-RPC server used by this TREC server
 Vector getUserDataStoreSettings()
          get the data store settings made for this server
 void init()
          called when Servlet goes into service
 void setEnvironment()
          set the environment for authentication and authorization of this TREC server.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AGENTS_FILE_NAME

public static final String AGENTS_FILE_NAME
See Also:
Constant Field Values

TREC_PROPERTIES_FILE_NAME

public static final String TREC_PROPERTIES_FILE_NAME
See Also:
Constant Field Values

TREC_PROPERTY_SAM_TYPE

public static final String TREC_PROPERTY_SAM_TYPE
See Also:
Constant Field Values

TREC_PROPERTY_SAM_CONNECT_STRING

public static final String TREC_PROPERTY_SAM_CONNECT_STRING
See Also:
Constant Field Values

TREC_PROPERTY_SAM_DB_DRIVER

public static final String TREC_PROPERTY_SAM_DB_DRIVER
See Also:
Constant Field Values

STORE_TYPE_ROOT

public static final int STORE_TYPE_ROOT
See Also:
Constant Field Values

STORE_TYPE_EMBEDDED

public static final int STORE_TYPE_EMBEDDED
See Also:
Constant Field Values

STORE_TYPE_SHARED_JDBC

public static final int STORE_TYPE_SHARED_JDBC
See Also:
Constant Field Values

UDSS_TYPE

public static final int UDSS_TYPE
See Also:
Constant Field Values

UDSS_DRIVER

public static final int UDSS_DRIVER
See Also:
Constant Field Values

UDSS_CONNECT_STR

public static final int UDSS_CONNECT_STR
See Also:
Constant Field Values
Constructor Detail

Server

public Server()
constructor

Method Detail

init

public void init()
called when Servlet goes into service

Overrides:
init in class javax.servlet.GenericServlet

setEnvironment

public void setEnvironment()
set the environment for authentication and authorization of this TREC server.

A TREC server uses the Light Development Simple Access Model (SAM) to implement authentication and authorization. How the SAM environment is implemented can differ depending on settings an administrator makes using the TREC Manager application.

The initial setting is a SAM environment that does not have a backing data store that could be changed. The initial user data store implements only a root user with all possible roles. This user can be used to log in initially and to set the SAM environment that a user/administrator likes.

Currently two SAM implementations are possible:

In both cases TREC will create a SAM database automatically if one does not exist already. For a shared JDBC database the connect string set by the administrator needs to include a database user that has appropriate rights to create the SAM tables.

Throws:
IOException

getUserDataStoreSettings

public Vector getUserDataStoreSettings()
                                throws IOException
get the data store settings made for this server

Returns:
a Vector having the settings in te order storeType, driverName, connectString (a Vector is used so that not an own transport object is required)
Throws:
IOException

destroy

public void destroy()
called when Servlet goes out of service

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

getBaseDir

public String getBaseDir()
get the base directory of this server. When the Server object is deployed as a Java EE web application as with file 'trec.war' contained in the TREC distribution package, this method returns the absolute path to the WEB-INF directory.

Returns:
the server base directory

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     IOException
handle a HTTP GET request

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - the request
response - the response
Throws:
javax.servlet.ServletException
IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      IOException
handle a HTTP POST request

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - the request
response - the response
Throws:
javax.servlet.ServletException
IOException

getSAMXmlRpcServer

public SAMXmlRpcServer getSAMXmlRpcServer()
get the XML-RPC server used by this TREC server

Returns:
the XML-RPC server