com.tensegrity.palojava.http.handlers
Class HttpElementHandler

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

public class HttpElementHandler
extends HttpHandler

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

Version:
$Id$
Author:
ArndHouben

Constructor Summary
HttpElementHandler(HttpClient client)
          Creates a new HttpElementHandler instance.
 
Method Summary
 boolean create(java.lang.String dbName, java.lang.String dimName, java.lang.String name, java.lang.String type, java.lang.String childNames, java.lang.String weights)
          Creates a new element and adds it to the specified dimension
 boolean delete(java.lang.String dbName, java.lang.String dimName, java.lang.String elName)
          Deletes the specified element from its dimension
 ConsolidationInfo[] getConsolidationInfos(java.lang.String dbName, java.lang.String dimName, java.lang.String elName)
          Returns the ConsolidationInfos associated with the specified element
 java.lang.String[] getInfos(java.lang.String dbName, java.lang.String dimName, java.lang.String elName)
          Returns information about the element.
 boolean moveElement(java.lang.String dbName, java.lang.String dimName, java.lang.String elName, java.lang.String pos)
          Moves the specified element to the given position within its dimension
 boolean rename(java.lang.String dbName, java.lang.String dimName, java.lang.String elName, java.lang.String newName)
          Renames the specified element
 boolean replace(java.lang.String dbName, java.lang.String dimName, java.lang.String elName, java.lang.String type, java.lang.String childNames, java.lang.String weights)
          Replaces the specified element, i.e. the specified element is updated with the given values.
 
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

HttpElementHandler

public HttpElementHandler(HttpClient client)
Creates a new HttpElementHandler 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(java.lang.String dbName,
                                         java.lang.String dimName,
                                         java.lang.String elName)
                                  throws java.io.IOException
Returns information about the element. The information at index n is: at 0 the element id at 1 the element name at 2 the element position within its dimension at 3 the element level at 4 the element indent at 5 the element depth at 6 the element type (1=NUMERIC, 2=STRING, 4=CONSOLIDATED) at 7 the number of parents at 8 a comma separate list of parent identifiers at 9 the number of children at 10 a comma separate list of children identifiers at 11 a comma separate list of children weight

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

create

public final boolean create(java.lang.String dbName,
                            java.lang.String dimName,
                            java.lang.String name,
                            java.lang.String type,
                            java.lang.String childNames,
                            java.lang.String weights)
                     throws java.io.IOException
Creates a new element and adds it to the specified dimension

Parameters:
dbName - a valid database name
dimName - a valid dimension name
name - the element name
type - the element type
childNames - a comma separated list of children names
weights - a comma separated list of weights associated with the children
Returns:
true if creation was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

delete

public final boolean delete(java.lang.String dbName,
                            java.lang.String dimName,
                            java.lang.String elName)
                     throws java.io.IOException
Deletes the specified element from its dimension

Parameters:
dbName - a valid database name
dimName - a valid dimension name
elName - the name of the element to delete
Returns:
true if deletion was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

replace

public final boolean replace(java.lang.String dbName,
                             java.lang.String dimName,
                             java.lang.String elName,
                             java.lang.String type,
                             java.lang.String childNames,
                             java.lang.String weights)
                      throws java.io.IOException
Replaces the specified element, i.e. the specified element is updated with the given values. If no such element exists one is created

Parameters:
dbName - a valid database name
dimName - a valid dimension name
elName - the element name
type - the element type
childNames - a comma separated list of children names
weights - a comma separated list of weights associated with the children
Returns:
true if replacement was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

rename

public final boolean rename(java.lang.String dbName,
                            java.lang.String dimName,
                            java.lang.String elName,
                            java.lang.String newName)
                     throws java.io.IOException
Renames the specified element

Parameters:
dbName - a valid database name
dimName - a valid dimension name
elName - the old element name
newName - the new element name
Returns:
true if renaming was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

moveElement

public final boolean moveElement(java.lang.String dbName,
                                 java.lang.String dimName,
                                 java.lang.String elName,
                                 java.lang.String pos)
                          throws java.io.IOException
Moves the specified element to the given position within its dimension

Parameters:
dbName - a valid database name
dimName - a valid dimension name
elName - the element name
pos - the position index
Returns:
true if moving was successful, false otherwise
Throws:
java.io.IOException - if an I/O exception occurs

getConsolidationInfos

public final ConsolidationInfo[] getConsolidationInfos(java.lang.String dbName,
                                                       java.lang.String dimName,
                                                       java.lang.String elName)
                                                throws java.io.IOException
Returns the ConsolidationInfos associated with the specified element

Parameters:
dbName - a valid database name
dimName - a valid dimension name
elName - a valid element name
Returns:
an ConsolidationInfo array
Throws:
java.io.IOException - if an I/O exception occurs