com.tensegrity.palojava.http.handlers
Class HttpServerHandler

java.lang.Object
  extended by com.tensegrity.palojava.http.handlers.HttpHandler
      extended by com.tensegrity.palojava.http.handlers.HttpServerHandler

public class HttpServerHandler
extends HttpHandler

This HttpHandler is used for the server part of the http communication. It provides methods for managing a palo server.

Version:
$Id$
Author:
ArndHouben

Constructor Summary
HttpServerHandler(HttpClient client)
          Creates a new HttpServerHandler instance.
 
Method Summary
 java.lang.String[] getDatabases(java.util.Map name2Id)
          Returns the names of the database which are currently stored within the palo server
 java.lang.String[] getInfos()
          Returns information about the palo server.
 java.lang.String[] login(java.lang.String user, java.lang.String passwd)
          Requires the login name and an md5 encrypted password.
 boolean reload()
          Reloads the server data from disk into memory
 boolean save()
          Save all data.
 
Methods inherited from class com.tensegrity.palojava.http.handlers.HttpHandler
setSID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServerHandler

public HttpServerHandler(HttpClient client)
Creates a new HttpServerHandler instance. Requires a HttpClient for delegating all requests to the connected palo server.

Parameters:
client - the connection to the palo server
Method Detail

getInfos

public final java.lang.String[] getInfos()
                                  throws java.io.IOException
Returns information about the palo server. The information at index n is: at 0 the major version of the server at 1 the minor version of the server at 2 the bugfix level of the server at 3 the build number of the server

Returns:
an String array containing information about the palo server
Throws:
java.io.IOException - if an I/O exception occurs

getDatabases

public final java.lang.String[] getDatabases(java.util.Map name2Id)
                                      throws java.io.IOException
Returns the names of the database which are currently stored within the palo server

Returns:
an String array containing database names
Throws:
java.io.IOException - if an I/O exception occurs

reload

public final boolean reload()
                     throws java.io.IOException
Reloads the server data from disk into memory

Returns:
true if reloading was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

save

public final boolean save()
                   throws java.io.IOException
Save all data. NOTE: this will overwritte all stored data!!!

Returns:
true if saving was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

login

public final java.lang.String[] login(java.lang.String user,
                                      java.lang.String passwd)
                               throws java.io.IOException
Requires the login name and an md5 encrypted password.

Parameters:
user - the user login
passwd - must be md5 encrypted
Returns:
the session id as first entry and the expire time in seconds since 1970-01-01 00:00:00 GMT at last one
Throws:
java.io.IOException - if an I/O exception occurs