|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tensegrity.palojava.http.HttpClient
public class HttpClient
This class encapsulates the http based communication between the palo api and the palo server. Therefore different (so called) http handlers are used to perform the desired actions. So internally every action is delegated to a certain registered http handler.
Constructor Summary | |
---|---|
HttpClient(ConnectionHttp paloConn)
Creates a new HttpClient instance and connects to the
palo server specified by the given ConnectionHttp instance. |
Method Summary | |
---|---|
boolean |
addCube(java.lang.String dbName,
java.lang.String name,
java.lang.String dimNames)
Creates and adds the specified cube to the given database |
java.lang.String |
addDatabase(java.lang.String dbName)
Creates a new database with the given name and adds it to the server |
boolean |
addDimension(java.lang.String dbName,
java.lang.String dimName)
Creates and adds the specified dimension to the given database |
boolean |
addElement(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 and adds the specified element to the given dimension |
boolean |
clearDimension(java.lang.String dbName,
java.lang.String dimName)
Clears the specified dimension, i.e. all its elements are removed and all associated cubes are cleared as well. |
boolean |
deleteDatabase(java.lang.String dbName)
Removes the given database and its dimensions and cubes from the palo server |
void |
disconnect()
Disconnects this client from the palo server |
void |
ensureConnection()
Checks if the session id is still valid. |
ConsolidationInfo[] |
getConsolidationInfos(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName)
Returns the ConsolidationInfo s associated with the
specified element |
HttpCubeHandler |
getCubeHandler()
Returns the cube handler which is responsible for the part of the http communication which deals with cubes |
java.lang.String[] |
getCubeInfos(java.lang.String dbName,
java.lang.String cubeName)
Returns information about the specified cube. |
java.lang.String[] |
getCubes(java.lang.String dbName)
Returns the names of the cubes which are saved within the given database |
java.lang.String[] |
getCubesFromDimension(java.lang.String dbName,
java.lang.String dimName)
Returns the names of the cubes which are associated to the given dimension |
java.lang.Object |
getData(java.lang.String dbName,
java.lang.String cubeName,
int coordsCount,
java.lang.String[] coords)
Receives the value at the given cube cell. |
java.lang.Object[] |
getDataArea(java.lang.String dbName,
java.lang.String cubeName,
java.lang.String[][] elNames)
A convenient method to receive the values of multiple cube cells. |
HttpDatabaseHandler |
getDatabaseHandler()
Returns the database handler which is responsible for the part of the http communication which deals with databases |
java.lang.String[] |
getDatabaseInfos(java.lang.String dbName)
Returns information about the specified database. |
java.lang.String[] |
getDatabases()
Returns an array of database names which are stored in the server so far |
DimElementInfo[] |
getDimElementInfos(java.lang.String dbName,
java.lang.String dimName)
Returns the DimElementInfo s associated with the specified
dimension |
java.lang.String[] |
getDimensionInfos(java.lang.String dbName,
java.lang.String dimName)
Returns information about the specified dimension. |
java.lang.String[] |
getDimensions(java.lang.String dbName)
Returns the names of the dimensions which are saved within the given database |
java.lang.String[] |
getDimensionsFromCube(java.lang.String dbName,
java.lang.String cubeName)
Returns the names of the dimensions which build up the specified cube |
HttpDimensionHandler |
getDimHandler()
Returns the dimension handler which is responsible for the part of the http communication which deals with dimensions |
int |
getElementChildCount(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName)
Returns the number of children the specified element has |
int |
getElementCount(java.lang.String dbName,
java.lang.String dimName)
Returns the number of elements the specified dimension has |
HttpElementHandler |
getElementHandler()
Returns the element handler which is responsible for the part of the http communication which deals with elements |
int |
getElementIndent(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName)
Returns the indent of the specified element within the given dimension |
int |
getElementIndex(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName)
Returns the position of the specified element within the given dimension |
java.lang.String[] |
getElementInfos(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName)
Returns information about the specified element. |
int |
getElementLevel(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName)
Returns the level of the specified element within the given dimension |
int |
getElementParentCount(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName)
Returns the number of parents the specified element has |
java.lang.String[] |
getElements(java.lang.String dbName,
java.lang.String dimName)
Returns the names of the elements which made up the specified dimension |
int |
getElementTopLevel(java.lang.String dbID,
java.lang.String dimID)
Deprecated. will be removed, please do not use anymore |
java.lang.String |
getExpireTime()
Returns the time in seconds at when the session id is invalid |
java.lang.String[] |
getServerInfos()
Returns information about the palo server. |
java.lang.String |
getSID()
Returns the session id |
boolean |
isChild(java.lang.String dbID,
java.lang.String dimID,
java.lang.String elID,
java.lang.String childID)
Deprecated. will be removed, please do not use anymore |
boolean |
loadCube(java.lang.String dbName,
java.lang.String cubeName)
Loads the specified cube into memory |
boolean |
loadDatabase(java.lang.String dbName)
Loads the given database |
void |
login(java.lang.String user,
java.lang.String passw)
Login the given user with the given password. |
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 |
ping()
Performs a ping to the palo server. |
void |
registerHandlers()
Registers all known http handlers which carry out the communication |
boolean |
reloadServer()
Reloads the complete server data |
boolean |
removeCube(java.lang.String dbName,
java.lang.String cubeName)
Removes the specified cube from the given database |
boolean |
removeDimension(java.lang.String dbName,
java.lang.String dimName)
Removes the specified dimension and its elements from the given database |
boolean |
removeElement(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName)
Removes the specified element from its dimension |
boolean |
renameDimension(java.lang.String dbName,
java.lang.String dimName,
java.lang.String newName)
Renames the specified dimension |
boolean |
renameElement(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName,
java.lang.String newName)
Renames the specified element |
boolean |
saveCube(java.lang.String dbName,
java.lang.String cubeName)
Saves the specified cube |
boolean |
saveDatabase(java.lang.String dbName)
Saves the database |
boolean |
saveServer()
Saves the current server state. |
java.lang.String |
send(java.lang.String request)
Sends the given request string to the server. |
boolean |
setData(java.lang.String dbName,
java.lang.String cubeName,
java.lang.String path,
java.lang.Object value,
int splashMode)
Sets the value of the specified cube cell. |
void |
setDataBulk(java.lang.String dbName,
java.lang.String cubeName,
java.lang.String[][] coordinates,
java.lang.Object[] values,
int splashMode)
Sets the values of multiple cells at one time. |
void |
setDataNumeric(java.lang.String dbName,
java.lang.String cubeName,
int nCoordinates,
java.lang.String[] coordinates,
double value)
Sets the double value of the given cube cell. |
void |
setDataNumeric(java.lang.String dbName,
java.lang.String cubeName,
int nCoordinates,
java.lang.String[] coordinates,
double value,
int splashMode)
Sets the double value of the given cube cell. |
void |
setDataString(java.lang.String dbName,
java.lang.String cubeName,
int nCoordinates,
java.lang.String[] coordinates,
java.lang.String value)
Sets the String value of the given cube cell. |
boolean |
unloadCube(java.lang.String dbName,
java.lang.String cubeName)
Unoads the specified cube from memory |
boolean |
unloadDatabase(java.lang.String dbName)
Unloads the given database from memory (it does not delete it from server) |
boolean |
updateElement(java.lang.String dbName,
java.lang.String dimName,
java.lang.String elName,
java.lang.String type,
java.lang.String childNames,
java.lang.String weights)
Updates the specified element. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpClient(ConnectionHttp paloConn) throws java.net.UnknownHostException, java.io.IOException
HttpClient
instance and connects to the
palo server specified by the given ConnectionHttp
instance.
paloConn
- a ConnectionHttp
object containing
information about palo server
java.net.UnknownHostException
- if the IP address of the host could not be
determined
java.io.IOException
- if an I/O exception occurs on establishing the
connectionMethod Detail |
---|
public final void registerHandlers()
public final HttpDatabaseHandler getDatabaseHandler()
HttpDatabaseHandler
public final HttpDimensionHandler getDimHandler()
HttpDimensionHandler
public final HttpCubeHandler getCubeHandler()
HttpCubeHandler
public final HttpElementHandler getElementHandler()
HttpElementHandler
public final void login(java.lang.String user, java.lang.String passw) throws java.io.IOException
user
- the login namepassw
- the md5 encrypted password
java.io.IOException
public final java.lang.String getSID()
public final java.lang.String getExpireTime()
public final boolean ping()
public final void disconnect() throws java.io.IOException
java.io.IOException
- if an I/O exception occurspublic final java.lang.String send(java.lang.String request) throws java.io.IOException
request
- a request
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getDatabases() throws java.io.IOException
java.io.IOException
- if an I/O exception occurspublic final boolean reloadServer() throws java.io.IOException
java.io.IOException
- if an I/O exception occurspublic final boolean saveServer() throws java.io.IOException
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getServerInfos() throws java.io.IOException
String
array containing palo server information
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getDatabaseInfos(java.lang.String dbName) throws java.io.IOException
dbName
- a database name
String
array containing the database information
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getDimensionInfos(java.lang.String dbName, java.lang.String dimName) throws java.io.IOException
dbName
- the name of a database which contains the dimensiondimName
- a dimension name
String
array containing the dimension information
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getCubeInfos(java.lang.String dbName, java.lang.String cubeName) throws java.io.IOException
dbName
- the name of a database which contains the cubecubeName
- a cube name
String
array containing the cube information
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getElementInfos(java.lang.String dbName, java.lang.String dimName, java.lang.String elName) throws java.io.IOException
dbName
- the name of a database which contains the dimensiondimName
- the name of a dimension which contains the elementelName
- the element name
String
array containing the element information
java.io.IOException
- if an I/O exception occurspublic final boolean saveDatabase(java.lang.String dbName) throws java.io.IOException
dbName
- the name of the database
java.io.IOException
- if an I/O exception occurspublic final java.lang.String addDatabase(java.lang.String dbName) throws java.io.IOException
dbName
- the name of the database
java.io.IOException
- if an I/O exception occurspublic final boolean loadDatabase(java.lang.String dbName) throws java.io.IOException
dbName
- the name of the database
java.io.IOException
- if an I/O exception occurspublic final boolean unloadDatabase(java.lang.String dbName) throws java.io.IOException
dbName
- the name of the database
java.io.IOException
- if an I/O exception occurspublic final boolean deleteDatabase(java.lang.String dbName) throws java.io.IOException
dbName
- the name of the database
java.io.IOException
- if an I/O exception occurspublic final boolean addDimension(java.lang.String dbName, java.lang.String dimName) throws java.io.IOException
dbName
- the name of the databasedimName
- the name of the dimension
java.io.IOException
- if an I/O exception occurspublic final boolean removeDimension(java.lang.String dbName, java.lang.String dimName) throws java.io.IOException
dbName
- the name of the databasedimName
- the name of the dimension
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getDimensions(java.lang.String dbName) throws java.io.IOException
dbName
- a valid database name
String
array containing all known dimension names
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getDimensionsFromCube(java.lang.String dbName, java.lang.String cubeName) throws java.io.IOException
dbName
- a valid database namecubeName
- the name of the cube
String
array containing the dimension names
java.io.IOException
- if an I/O exception occurspublic final boolean renameDimension(java.lang.String dbName, java.lang.String dimName, java.lang.String newName) throws java.io.IOException
dbName
- a valid database namedimName
- the old dimension namenewName
- the new dimension name
java.io.IOException
- if an I/O exception occurspublic final boolean clearDimension(java.lang.String dbName, java.lang.String dimName) throws java.io.IOException
dbName
- a valid database namedimName
- the dimension name
java.io.IOException
- if an I/O exception occurspublic final boolean addCube(java.lang.String dbName, java.lang.String name, java.lang.String dimNames) throws java.io.IOException
dbName
- a valid database namename
- the cube namedimNames
- the comma separated names of the dimensions which build
up the cube
java.io.IOException
- if an I/O exception occurspublic final boolean removeCube(java.lang.String dbName, java.lang.String cubeName) throws java.io.IOException
dbName
- a valid database namecubeName
- the cube name
java.io.IOException
- if an I/O exception occurspublic final boolean saveCube(java.lang.String dbName, java.lang.String cubeName) throws java.io.IOException
dbName
- a valid database namecubeName
- the cube name
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getCubes(java.lang.String dbName) throws java.io.IOException
dbName
- a valid database name
String
array containing the names of all known
cubes
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getCubesFromDimension(java.lang.String dbName, java.lang.String dimName) throws java.io.IOException
dbName
- a valid database namedimName
- the dimension name
String
array containing the names of all known
cubes associated with the dimension
java.io.IOException
- if an I/O exception occurspublic final boolean loadCube(java.lang.String dbName, java.lang.String cubeName) throws java.io.IOException
dbName
- a valid database namecubeName
- the cube name
java.io.IOException
- if an I/O exception occurspublic final boolean unloadCube(java.lang.String dbName, java.lang.String cubeName) throws java.io.IOException
dbName
- a valid database namecubeName
- the cube name
java.io.IOException
- if an I/O exception occurspublic final java.lang.String[] getElements(java.lang.String dbName, java.lang.String dimName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension name
String
array containing the names of the elements
within the dimension
java.io.IOException
- if an I/O exception occurspublic final boolean addElement(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
dbName
- a valid database namedimName
- a valid dimension namename
- the element nametype
- the element typechildNames
- a comma separated list of children namesweights
- a comma separated list of weights associated with the
children
java.io.IOException
- if an I/O exception occurspublic final boolean removeElement(java.lang.String dbName, java.lang.String dimName, java.lang.String elName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension nameelName
- the element name
java.io.IOException
- if an I/O exception occurspublic final boolean updateElement(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
dbName
- a valid database namedimName
- a valid dimension nameelName
- the element nametype
- the element typechildNames
- a comma separated list of children namesweights
- a comma separated list of weights associated with the
children
java.io.IOException
- if an I/O exception occurspublic final boolean renameElement(java.lang.String dbName, java.lang.String dimName, java.lang.String elName, java.lang.String newName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension nameelName
- the old element namenewName
- the new element name
java.io.IOException
- if an I/O exception occurspublic final int getElementChildCount(java.lang.String dbName, java.lang.String dimName, java.lang.String elName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension nameelName
- a valid element name
java.io.IOException
- if an I/O exception occurspublic final int getElementParentCount(java.lang.String dbName, java.lang.String dimName, java.lang.String elName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension nameelName
- a valid element name
java.io.IOException
- if an I/O exception occurspublic final int getElementCount(java.lang.String dbName, java.lang.String dimName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension name
java.io.IOException
- if an I/O exception occurspublic final int getElementIndex(java.lang.String dbName, java.lang.String dimName, java.lang.String elName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension nameelName
- a valid element name
java.io.IOException
- if an I/O exception occurspublic final int getElementLevel(java.lang.String dbName, java.lang.String dimName, java.lang.String elName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension nameelName
- a valid element name
java.io.IOException
- if an I/O exception occurspublic final int getElementIndent(java.lang.String dbName, java.lang.String dimName, java.lang.String elName) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension nameelName
- a valid element name
java.io.IOException
- if an I/O exception occurspublic final boolean moveElement(java.lang.String dbName, java.lang.String dimName, java.lang.String elName, java.lang.String pos) throws java.io.IOException
dbName
- a valid database namedimName
- a valid dimension nameelName
- a valid element namepos
- the new element position
java.io.IOException
- if an I/O exception occurspublic final int getElementTopLevel(java.lang.String dbID, java.lang.String dimID)
dbID
- dimID
-
public final boolean isChild(java.lang.String dbID, java.lang.String dimID, java.lang.String elID, java.lang.String childID)
dbID
- dimID
- elID
- childID
-
public final java.lang.Object getData(java.lang.String dbName, java.lang.String cubeName, int coordsCount, java.lang.String[] coords) throws java.io.IOException
dbName
- a valid database namecubeName
- a valid cube namecoordsCount
- the number of coordinatescoords
- the coordinates which determines the cube cell
java.io.IOException
- if an I/O exception occurspublic final java.lang.Object[] getDataArea(java.lang.String dbName, java.lang.String cubeName, java.lang.String[][] elNames) throws java.io.IOException
dbName
- a valid database namecubeName
- a valid cube nameelNames
- the element names which specify the cube cells
java.io.IOException
- if an I/O exception occurspublic final void setDataString(java.lang.String dbName, java.lang.String cubeName, int nCoordinates, java.lang.String[] coordinates, java.lang.String value) throws java.io.IOException
String
value of the given cube cell. The
coordinates are simply the element names which has to be specified in
the same order as their dimensions are.
dbName
- a valid database namecubeName
- a valid cube namenCoordinates
- the number of coordinatescoordinates
- the coordinates which determines the cube cellvalue
- the new cell String
value
java.io.IOException
- if an I/O exception occurspublic final void setDataNumeric(java.lang.String dbName, java.lang.String cubeName, int nCoordinates, java.lang.String[] coordinates, double value) throws java.io.IOException
double
value of the given cube cell. The
coordinates are simply the element names which has to be specified in
the same order as their dimensions are.
dbName
- a valid database namecubeName
- a valid cube namenCoordinates
- the number of coordinatescoordinates
- the coordinates which determines the cube cellvalue
- the new cell double
value
java.io.IOException
- if an I/O exception occurspublic final void setDataNumeric(java.lang.String dbName, java.lang.String cubeName, int nCoordinates, java.lang.String[] coordinates, double value, int splashMode) throws java.io.IOException
double
value of the given cube cell.
The splashMode paramater is only important for consolidated cells and
determines how the value is spread among the consolidated elements.
Please use the defined class constants for valid values. Although more
modes are currently defined only three are supported, namely:
SPLASH_MODE_DEFAULT, SPLASH_MODE_BASE_SET and SPLASH_MODE_BASE_ADD
dbName
- a valid database namecubeName
- a valid cube namenCoordinates
- the number of coordinatescoordinates
- the coordinates which determines the cube cellvalue
- the new cell double
valuesplashMode
- the splash mode, please refer to IConnection
java.io.IOException
- if an I/O exception occurspublic final void setDataBulk(java.lang.String dbName, java.lang.String cubeName, java.lang.String[][] coordinates, java.lang.Object[] values, int splashMode) throws java.io.IOException
dbName
- a valid database namecubeName
- a valid cube namecoordinates
- the cell coordinates, please see
setDataString(String, String, int, String[], String)
values
- the new cell valuessplashMode
- the splash mode, please refer to
IConnection
java.io.IOException
- if an I/O exception occurspublic final boolean setData(java.lang.String dbName, java.lang.String cubeName, java.lang.String path, java.lang.Object value, int splashMode) throws java.io.IOException
dbName
- a valid database namecubeName
- a valid cube namepath
- a comma separated list of element namesvalue
- the new cell valuesplashMode
- the splash mode, please refer to
IConnection
java.io.IOException
- if an I/O exception occurspublic final DimElementInfo[] getDimElementInfos(java.lang.String dbName, java.lang.String dimName) throws java.io.IOException
DimElementInfo
s associated with the specified
dimension
dbName
- a valid database namedimName
- a valid dimension name
DimElementInfo
array
java.io.IOException
- if an I/O exception occurspublic final ConsolidationInfo[] getConsolidationInfos(java.lang.String dbName, java.lang.String dimName, java.lang.String elName) throws java.io.IOException
ConsolidationInfo
s associated with the
specified element
dbName
- a valid database namedimName
- a valid dimension nameelName
- a valid element name
ConsolidationInfo
array
java.io.IOException
- if an I/O exception occurspublic final void ensureConnection() throws java.io.IOException
java.io.IOException
java.security.NoSuchAlgorithmException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |