org.palo.api.impl
Class ConnectionImpl

java.lang.Object
  extended by org.palo.api.impl.ConnectionImpl
All Implemented Interfaces:
com.tensegrity.palojava.events.ServerListener, Connection, Writable

public class ConnectionImpl
extends java.lang.Object
implements Connection, com.tensegrity.palojava.events.ServerListener

TODO DOCUMENT ME

Version:
$Id: ConnectionImpl.html,v 1.3 2009/07/09 11:01:46 ArndHouben Exp $

Field Summary
 
Fields inherited from interface org.palo.api.Connection
DEFAULT_TIMEOUT, TYPE_HTTP, TYPE_LEGACY, TYPE_WSS, TYPE_XMLA
 
Method Summary
 void addConnectionListener(ConnectionListener connectionListener)
          This method adds a ConnectionListener to this connection.
 Database addDatabase(java.lang.String name)
          Adds a new database with the given name to this Connection.
 void addProperty(Property2 property)
          Adds the given property to the list of properties for this connection.
 boolean canBeModified()
          Returns true if this object can be modified (renamed, deleted, ...), false otherwise.
 boolean canCreateChildren()
          Returns true if this object can create child objects, false otherwise.
 void disconnect()
          Disconnects from the PALO server.
 boolean equals(java.lang.Object other)
           
 java.lang.String[] getAllPropertyIds()
          Returns all ids of properties that can be set for this connection.
 com.tensegrity.palojava.DbConnection getConnectionInternal()
           
 ConnectionContext getContext()
          Returns the ConnectionContext which allows to retrieve further information about current connection
 java.lang.Object getData(java.lang.String id)
           API INTERNAL
 Database getDatabaseAt(int index)
          Returns the database stored at the given index.
 Database getDatabaseById(java.lang.String id)
          Returns the database stored under the given id or null if no such database exists.
 Database getDatabaseByName(java.lang.String name)
          Returns the database stored under the given name or null if no such database exists.
 int getDatabaseCount()
          Returns the number of databases.
 Database[] getDatabases()
          Returns an array of Database instances available for this connection.
 java.lang.String getFunctions()
          Returns all available Functions which are defined for this connection.
 java.lang.String getPassword()
          Returns the password used to login.
 Property2 getProperty(java.lang.String id)
          Returns the property identified by the given id.
 java.lang.String getServer()
          Returns the server name.
 java.lang.String getService()
          Returns the service name.
 Database[] getSystemDatabases()
          Returns an array of system Database instances available for this connection.
 int getType()
          Returns the connection type for this connection.
 java.lang.String getUsername()
          Returns the username.
 int hashCode()
           
 boolean isConnected()
          Checks if this connection is still connected to a PALO server.
 boolean isLegacy()
          Checks if connection uses the legacy palo server or not.
 FavoriteViewTreeNode loadFavoriteViews()
          Loads all favorite views stored with this connection and returns the root of the favorite view tree representing those views or null, if no favorite views were stored in this connection.
 boolean login(java.lang.String username, java.lang.String password)
          Logs into this connection with the specified user name and password.
 void ping()
          Tries to ping the palo server.
 void reload()
          Reloads all internal objects of the connection.
 void removeConnectionListener(ConnectionListener connectionListener)
          This method removes a ConnectionListener from this connection.
 void removeDatabase(Database database)
          Removes a database from this Connection.
 void removeProperty(java.lang.String id)
          Removes the given property from the list of properties for this connection.
 boolean save()
          Tells the Palo-Server to save everything on the server-side.
 void serverStructureChanged(com.tensegrity.palojava.events.ServerEvent event)
           
 void storeFavoriteViews(FavoriteViewTreeNode favoriteViews)
          Stores the favorite views for this connection.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

login

public final boolean login(java.lang.String username,
                           java.lang.String password)
Description copied from interface: Connection
Logs into this connection with the specified user name and password. If the connection could not be established, false is returned. If the connection can successfully be established, true is returned.

Specified by:
login in interface Connection
Returns:
true if the connection could be established, false otherwise.

addDatabase

public final Database addDatabase(java.lang.String name)
Description copied from interface: Connection
Adds a new database with the given name to this Connection. This operation fails if a database with the same name exists already.

Specified by:
addDatabase in interface Connection
Parameters:
name - the name of the new Database.
Returns:
the created Database.

disconnect

public final void disconnect()
Description copied from interface: Connection
Disconnects from the PALO server. Afterwards the connection is not functional anymore and should not be used. Reconnecting is not supported. Create a new Connection instance instead.

Specified by:
disconnect in interface Connection

getDatabaseAt

public final Database getDatabaseAt(int index)
Description copied from interface: Connection
Returns the database stored at the given index. If the index does not correspond to a legal position in the internally managed array of databases of this instance, then null is returned.

Specified by:
getDatabaseAt in interface Connection
Parameters:
index - the index
Returns:
the database stored at the given index or null.

getDatabaseByName

public final Database getDatabaseByName(java.lang.String name)
Description copied from interface: Connection
Returns the database stored under the given name or null if no such database exists.

Specified by:
getDatabaseByName in interface Connection
Parameters:
name - the database name to look-up.
Returns:
the database stored under the given name or null if no such database exists.

getDatabaseById

public final Database getDatabaseById(java.lang.String id)
Description copied from interface: Connection
Returns the database stored under the given id or null if no such database exists.

Specified by:
getDatabaseById in interface Connection
Parameters:
id - identifier of the database to look-up.
Returns:
the database stored under the given name or null if no such database exists.

getDatabaseCount

public final int getDatabaseCount()
Description copied from interface: Connection
Returns the number of databases.

Specified by:
getDatabaseCount in interface Connection
Returns:
the number of databases.

getDatabases

public final Database[] getDatabases()
Description copied from interface: Connection
Returns an array of Database instances available for this connection.

The returned array is a copy of the internal datastructure. Changing the returned array does not change this instance.

Specified by:
getDatabases in interface Connection
Returns:
an array of Database instances available for this connection.

getPassword

public final java.lang.String getPassword()
Description copied from interface: Connection
Returns the password used to login. Implementations may choose to return null or the empty string if configured to prevent password-retrieval

Specified by:
getPassword in interface Connection
Returns:
the login password, the empty string or null.

getServer

public final java.lang.String getServer()
Description copied from interface: Connection
Returns the server name.

Specified by:
getServer in interface Connection
Returns:
the server name.

getService

public final java.lang.String getService()
Description copied from interface: Connection
Returns the service name.

Specified by:
getService in interface Connection
Returns:
the service name.

getSystemDatabases

public final Database[] getSystemDatabases()
Description copied from interface: Connection
Returns an array of system Database instances available for this connection.

The returned array is a copy of the internal datastructure. Changing the returned array does not change this instance.

Specified by:
getSystemDatabases in interface Connection
Returns:
an array of system Database instances available for this connection.

getUsername

public final java.lang.String getUsername()
Description copied from interface: Connection
Returns the username.

Specified by:
getUsername in interface Connection
Returns:
the username.

isLegacy

public final boolean isLegacy()
Description copied from interface: Connection
Checks if connection uses the legacy palo server or not.

Specified by:
isLegacy in interface Connection
Returns:
true if the connection is bind to the legacy palo server, false otherwise

getType

public final int getType()
Description copied from interface: Connection
Returns the connection type for this connection. The return value will be one of the TYPE_xxx constants defined in this interface.

Specified by:
getType in interface Connection
Returns:
the connection type

isConnected

public final boolean isConnected()
Description copied from interface: Connection
Checks if this connection is still connected to a PALO server.

Specified by:
isConnected in interface Connection
Returns:
true if a connection to a PALO server is established, false otherwise

ping

public final void ping()
Description copied from interface: Connection
Tries to ping the palo server. Upon success the method returns silenty.

Specified by:
ping in interface Connection

reload

public final void reload()
Description copied from interface: Connection
Reloads all internal objects of the connection. Invoking this method can take some time. Afterwards the database, dimension, cube, element and consolidation objects that can be retrieved from this instance are identical to earlier results if the objects represent the same palo domain objects. This behavior is achieved by caching objects throughout the life-time of the connection.

Specified by:
reload in interface Connection

removeDatabase

public final void removeDatabase(Database database)
Description copied from interface: Connection
Removes a database from this Connection.

Specified by:
removeDatabase in interface Connection
Parameters:
database - the Database to remove from this Connection.

save

public final boolean save()
Description copied from interface: Connection
Tells the Palo-Server to save everything on the server-side. Effects are up to the palo-server.

Specified by:
save in interface Connection
Returns:
true if saving was successful, false otherwise

loadFavoriteViews

public final FavoriteViewTreeNode loadFavoriteViews()
Description copied from interface: Connection
Loads all favorite views stored with this connection and returns the root of the favorite view tree representing those views or null, if no favorite views were stored in this connection. Note that this method will throw a PaloAPIException if the user does not have sufficient rights to store favorite views (and thus cannot have any favorite views to load).

Specified by:
loadFavoriteViews in interface Connection
Returns:
the root of the favorite views tree attached to this connection or null if no favorite views were saved.

storeFavoriteViews

public final void storeFavoriteViews(FavoriteViewTreeNode favoriteViews)
Description copied from interface: Connection
Stores the favorite views for this connection. Any old favorite views that have been stored in this connection will be overwritten. Note that this method will throw a PaloAPIException if the user does not have sufficient rights to store favorite views.

Specified by:
storeFavoriteViews in interface Connection
Parameters:
favoriteViews - the root of a favorite views tree.

serverStructureChanged

public final void serverStructureChanged(com.tensegrity.palojava.events.ServerEvent event)
Specified by:
serverStructureChanged in interface com.tensegrity.palojava.events.ServerListener

addConnectionListener

public final void addConnectionListener(ConnectionListener connectionListener)
Description copied from interface: Connection
This method adds a ConnectionListener to this connection. Note that connection-listeners are limited and do not proactively report changes made on the palo server.

Specified by:
addConnectionListener in interface Connection
Parameters:
connectionListener - the ConnectionListener to add.

removeConnectionListener

public final void removeConnectionListener(ConnectionListener connectionListener)
Description copied from interface: Connection
This method removes a ConnectionListener from this connection. Note that connection-listeners are limited and do not proactively report changes made on the palo server.

Specified by:
removeConnectionListener in interface Connection
Parameters:
connectionListener - the ConnectionListener to remove.

getFunctions

public final java.lang.String getFunctions()
Description copied from interface: Connection
Returns all available Functions which are defined for this connection.

Specified by:
getFunctions in interface Connection
Returns:
all functions

equals

public final boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

getContext

public final ConnectionContext getContext()
Description copied from interface: Connection
Returns the ConnectionContext which allows to retrieve further information about current connection

Specified by:
getContext in interface Connection
Returns:
the ConnectionContext of current connection.

getData

public final java.lang.Object getData(java.lang.String id)
Description copied from interface: Connection
API INTERNAL

Specified by:
getData in interface Connection

getConnectionInternal

public final com.tensegrity.palojava.DbConnection getConnectionInternal()

getAllPropertyIds

public java.lang.String[] getAllPropertyIds()
Description copied from interface: Connection
Returns all ids of properties that can be set for this connection. If no properties are known to this connection, an empty array is returned.

Specified by:
getAllPropertyIds in interface Connection
Returns:
all property ids that are understood by this connection.

getProperty

public Property2 getProperty(java.lang.String id)
Description copied from interface: Connection
Returns the property identified by the given id. All valid ids can be requested by a call to getAllPropertyIds.

Specified by:
getProperty in interface Connection
Parameters:
id - the id of the property to read.
Returns:
the property for the given id.

addProperty

public void addProperty(Property2 property)
Description copied from interface: Connection
Adds the given property to the list of properties for this connection.

Specified by:
addProperty in interface Connection
Parameters:
property - the property to add.

removeProperty

public void removeProperty(java.lang.String id)
Description copied from interface: Connection
Removes the given property from the list of properties for this connection. If the specified id was not set, the call is ignored.

Specified by:
removeProperty in interface Connection
Parameters:
id - the id of the property which is to be cleared.

canBeModified

public boolean canBeModified()
Description copied from interface: Writable
Returns true if this object can be modified (renamed, deleted, ...), false otherwise.

Specified by:
canBeModified in interface Writable
Returns:
true if this object can be modified, false otherwise.

canCreateChildren

public boolean canCreateChildren()
Description copied from interface: Writable
Returns true if this object can create child objects, false otherwise.

Specified by:
canCreateChildren in interface Writable
Returns:
true if this object can create child objects, false otherwise.