org.hackystat.dailyprojectdata.server
Class Server

java.lang.Object
  extended by org.restlet.Uniform
      extended by org.restlet.Restlet
          extended by org.restlet.Application
              extended by org.hackystat.dailyprojectdata.server.Server

public class Server
extends org.restlet.Application

Sets up the HTTP Server process and dispatching to the associated resources.

Author:
Philip Johnson

Constructor Summary
Server()
           
 
Method Summary
 org.restlet.Restlet createRoot()
          Dispatch to the specific DailyProjectData resource based upon the URI.
 FrontSideCache getFrontSideCache()
          Returns the front side cache for this server.
 java.lang.String getHostName()
          Returns the host name associated with this server.
 java.util.logging.Logger getLogger()
          Returns the logger for this service.
 ServerProperties getServerProperties()
          Returns the ServerProperties instance associated with this server.
static java.lang.String getVersion()
          Returns the version associated with this Package, if available from the jar file manifest.
static void main(java.lang.String[] args)
          Starts up the web service.
static Server newInstance()
          Creates a new instance of a DailyProjectData HTTP server, listening on the supplied port.
static Server newInstance(ServerProperties properties)
          Creates a new instance of a DailyProjectData HTTP server, listening on the supplied port.
static Server newTestInstance()
          Creates a new instance of a DailyProjectData HTTP server suitable for unit testing.
 
Methods inherited from class org.restlet.Application
getAuthor, getConnectorService, getConverterService, getCurrent, getDecoderService, getDescription, getMetadataService, getName, getOwner, getRangeService, getRoot, getStatusService, getTaskService, getTunnelService, handle, setAuthor, setConnectorService, setConverterService, setCurrent, setDecoderService, setDescription, setMetadataService, setName, setOwner, setRangeService, setRoot, setStatusService, setTaskService, setTunnelService, start, stop
 
Methods inherited from class org.restlet.Restlet
getApplication, getContext, init, isStarted, isStopped, setContext
 
Methods inherited from class org.restlet.Uniform
delete, delete, get, get, handle, head, head, options, options, post, post, put, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Server

public Server()
Method Detail

newInstance

public static Server newInstance()
                          throws java.lang.Exception
Creates a new instance of a DailyProjectData HTTP server, listening on the supplied port.

Returns:
The Server instance created.
Throws:
java.lang.Exception - If problems occur starting up this server.

newTestInstance

public static Server newTestInstance()
                              throws java.lang.Exception
Creates a new instance of a DailyProjectData HTTP server suitable for unit testing. DPD properties are initialized from the User's dailyprojectdata.properties file, then set to their "testing" versions.

Returns:
The Server instance created.
Throws:
java.lang.Exception - If problems occur starting up this server.

newInstance

public static Server newInstance(ServerProperties properties)
                          throws java.lang.Exception
Creates a new instance of a DailyProjectData HTTP server, listening on the supplied port.

Parameters:
properties - The ServerProperties instance used to initialize this server.
Returns:
The Server instance created.
Throws:
java.lang.Exception - If problems occur starting up this server.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Starts up the web service. Control-c to exit.

Parameters:
args - Ignored.
Throws:
java.lang.Exception - if problems occur.

createRoot

public org.restlet.Restlet createRoot()
Dispatch to the specific DailyProjectData resource based upon the URI. We will authenticate all requests.

Overrides:
createRoot in class org.restlet.Application
Returns:
The router Restlet.

getVersion

public static java.lang.String getVersion()
Returns the version associated with this Package, if available from the jar file manifest. If not being run from a jar file, then returns "Development".

Returns:
The version.

getHostName

public java.lang.String getHostName()
Returns the host name associated with this server. Example: "http://localhost:9877/dailyprojectdata"

Returns:
The host name.

getServerProperties

public ServerProperties getServerProperties()
Returns the ServerProperties instance associated with this server.

Returns:
The server properties.

getLogger

public java.util.logging.Logger getLogger()
Returns the logger for this service.

Overrides:
getLogger in class org.restlet.Restlet
Returns:
The logger.

getFrontSideCache

public FrontSideCache getFrontSideCache()
Returns the front side cache for this server.

Returns:
The FrontSideCache.