|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Connection
Connection
Instances of this class represent a session/connection with a PALO server. Each session is independent from all other sessions.
Invoke reload()
on a connection to rehash all of its internal datastructes.
Connection
instances have an equals/hashcode behavior that is identity based.
(This means Object.hashCode()
and
Object.equals(java.lang.Object)
are both not overridden).
Instances of this class can only be obtained by means of the
ConnectionFactory
class.
Here is an example code snippet for retrieving a single datum from
a PALO connection. First a connection is created by means of the
ConnectionFactory
. Then this connection is used
to get a Database
instance by its name.
Next a Cube
is selected by name and
a single datum is retrieved in the two possible ways.
Connection connection = ConnectionFactory.getInstance().newConnection( "localhost", "1234", "user", "pass"); // retrieve Database instance. Database db = connection.getDatabaseByName("Demo"); // retrieve Cube instance. Cube cube = db.getCubeByName("Sales"); // get single datum from Cube. Object v0 = cube.getData(new String[] { "Desktop L", "Germany", "Jan", "2003", "Budget", "Units" }); // alternatively use the Element Objects to retrieve the same datum // in another fashion. Object v1 = cube.getData(new Element[] { cube.getDimensionAt(0).getElementByName("Desktop L"), cube.getDimensionAt(1).getElementByName("Germany"), cube.getDimensionAt(2).getElementByName("Jan"), cube.getDimensionAt(3).getElementByName("2003"), cube.getDimensionAt(4).getElementByName("Budget"), cube.getDimensionAt(5).getElementByName("Units"), }); connection.disconnect();
All operations of the PALO-API in this package potentially
throw the exception PaloAPIException
or other runtime exceptions.
Click here for a class-diagram of the api's core entities.
PaloAPIException
Field Summary | |
---|---|
static int |
DEFAULT_TIMEOUT
the default timeout for connection is 30 seconds |
static int |
TYPE_HTTP
connection type http |
static int |
TYPE_LEGACY
connection type legacy |
static int |
TYPE_WSS
connection type wss |
static int |
TYPE_XMLA
connection 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. |
void |
disconnect()
Disconnects from the PALO server. |
java.lang.String[] |
getAllPropertyIds()
Returns all ids of properties that can be set for this connection. |
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 Function s 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. |
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 |
storeFavoriteViews(FavoriteViewTreeNode favoriteViews)
Stores the favorite views for this connection. |
Methods inherited from interface org.palo.api.Writable |
---|
canBeModified, canCreateChildren |
Field Detail |
---|
static final int TYPE_LEGACY
static final int TYPE_HTTP
static final int TYPE_XMLA
static final int TYPE_WSS
static final int DEFAULT_TIMEOUT
Method Detail |
---|
java.lang.String getServer()
java.lang.String getService()
java.lang.String getUsername()
java.lang.String getPassword()
null
or the empty string if
configured to prevent password-retrieval
null
.void reload()
void ping()
boolean isConnected()
true
if a connection to a PALO server is
established, false
otherwisevoid disconnect()
Connection
instance
instead.
int getDatabaseCount()
Database getDatabaseAt(int index)
null
is returned.
index
- the index
null
.Database[] getDatabases()
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.
Database
instances available
for this connection.Database[] getSystemDatabases()
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.
Database
instances available
for this connection.Database getDatabaseByName(java.lang.String name)
null
if no such database exists.
name
- the database name to look-up.
null
if no such database exists.Database getDatabaseById(java.lang.String id)
null
if no such database exists.
id
- identifier of the database to look-up.
null
if no such database exists.Database addDatabase(java.lang.String name)
Connection
. This operation fails
if a database with the same name exists already.
name
- the name of the new Database
.
Database
.void removeDatabase(Database database)
Connection
.
database
- the Database
to
remove from this Connection
.boolean save()
true
if saving was successful, false
otherwisevoid addConnectionListener(ConnectionListener connectionListener)
ConnectionListener
to this
connection.
Note that connection-listeners are limited and do not
proactively report changes made on the palo server.
connectionListener
- the ConnectionListener
to add.void removeConnectionListener(ConnectionListener connectionListener)
ConnectionListener
from this
connection.
Note that connection-listeners are limited and do not
proactively report changes made on the palo server.
connectionListener
- the ConnectionListener
to remove.boolean isLegacy()
int getType()
java.lang.String getFunctions()
Function
s which are defined for this
connection.
boolean login(java.lang.String username, java.lang.String password)
username
- password
-
FavoriteViewTreeNode loadFavoriteViews()
void storeFavoriteViews(FavoriteViewTreeNode favoriteViews)
favoriteViews
- the root of a favorite views tree.java.lang.String[] getAllPropertyIds()
Property2 getProperty(java.lang.String id)
id
- the id of the property to read.
void addProperty(Property2 property)
property
- the property to add.void removeProperty(java.lang.String id)
id
- the id of the property which is to be cleared.ConnectionContext getContext()
ConnectionContext
which allows to retrieve further
information about current connection
ConnectionContext
of current connection.java.lang.Object getData(java.lang.String id)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |