com.tensegrity.palojava.http.handlers
Class HttpDatabaseHandler

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

public class HttpDatabaseHandler
extends HttpHandler

This HttpHandler is used for dealing with requests concerning palo Databases.

Version:
$Id$
Author:
ArndHouben

Constructor Summary
HttpDatabaseHandler(HttpClient client)
          Creates a new HttpDatabaseHandler instance.
 
Method Summary
 java.lang.String createDatabase(java.lang.String name)
          Creates a new Database on the Palo Server and returns the id of it
 boolean deleteDatabase(java.lang.String name)
          Deletes the specified database
 void fillCubeCache(java.util.Map cache, java.lang.String dbName)
          Internal method to fill up the cube name-identifier mapper of the given database
 void fillDimensionCache(java.util.Map cache, java.lang.String dbName)
          Internal method to fill up the dimension name-identifier mapper of the given database
 java.lang.String[] getCubes(java.lang.String dbName)
          Returns the names of the cubes the specified database contains
 java.lang.String[] getDimensions(java.lang.String dbName)
          Returns the names of the dimensions the specified database contains
 java.lang.String[] getInfos(java.lang.String name)
          Returns information about the specified database.
 java.util.Map getMap()
          Returns the database name-identifier mapper
 boolean loadDatabase(java.lang.String name)
          Loads the specified database
 boolean save(java.lang.String name)
          Saves the specified database
 boolean unloadDatabase(java.lang.String name)
          Unloads the specified database
 
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

HttpDatabaseHandler

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

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

getMap

public final java.util.Map getMap()
Returns the database name-identifier mapper

Returns:
the name-identifier map or null if no such exists

getInfos

public final java.lang.String[] getInfos(java.lang.String name)
                                  throws java.io.IOException
Returns information about the specified database. The information at index n is: at 0 the database id at 1 the database name at 2 the number of dimensions in the database at 3 the number of cubes in the database at 4 the database status (0=unloaded, 1=loaded and 2=changed) at 5 the database type (0=normal, 1=system) at 6 the database token

Parameters:
name - a valid database name
Returns:
an String array containing information about the database
Throws:
java.io.IOException - if an I/O exception occurs

save

public final boolean save(java.lang.String name)
                   throws java.io.IOException
Saves the specified database

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

getDimensions

public final java.lang.String[] getDimensions(java.lang.String dbName)
                                       throws java.io.IOException
Returns the names of the dimensions the specified database contains

Parameters:
dbName - a valid database name
Returns:
an String array containing the dimension names
Throws:
java.io.IOException - if an I/O exception occurs

getCubes

public final java.lang.String[] getCubes(java.lang.String dbName)
                                  throws java.io.IOException
Returns the names of the cubes the specified database contains

Parameters:
dbName - a valid database name
Returns:
an String array containing the cube names
Throws:
java.io.IOException - if an I/O exception occurs

loadDatabase

public final boolean loadDatabase(java.lang.String name)
                           throws java.io.IOException
Loads the specified database

Parameters:
name - the name of the database
Returns:
true if loading was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

unloadDatabase

public final boolean unloadDatabase(java.lang.String name)
                             throws java.io.IOException
Unloads the specified database

Parameters:
name - the name of the database
Returns:
true if unloading was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

createDatabase

public final java.lang.String createDatabase(java.lang.String name)
                                      throws java.io.IOException
Creates a new Database on the Palo Server and returns the id of it

Parameters:
name - the name of the new database
Returns:
the id of the newly created database
Throws:
java.io.IOException - if an I/O exception occurs

deleteDatabase

public final boolean deleteDatabase(java.lang.String name)
                             throws java.io.IOException
Deletes the specified database

Parameters:
name - the name of the database
Returns:
true if deleting was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

fillDimensionCache

public final void fillDimensionCache(java.util.Map cache,
                                     java.lang.String dbName)
                              throws java.io.IOException
Internal method to fill up the dimension name-identifier mapper of the given database

Parameters:
cache - an element name-identifier map
dbName - a valid database name
Throws:
java.io.IOException - if an I/O exception occurs

fillCubeCache

public final void fillCubeCache(java.util.Map cache,
                                java.lang.String dbName)
                         throws java.io.IOException
Internal method to fill up the cube name-identifier mapper of the given database

Parameters:
cache - an element name-identifier map
dbName - a valid database name
Throws:
java.io.IOException - if an I/O exception occurs