org.palo.api
Class ConnectionFactory

java.lang.Object
  extended by org.palo.api.ConnectionFactory
Direct Known Subclasses:
ConnectionFactoryImpl

public abstract class ConnectionFactory
extends java.lang.Object

ConnectionFactory

An instance of ConnectionFactory is obtained with the getInstance() method. Subsequently a connection to a PALO server can be created by invoking the newConnection(String, String, String, String) method.

Example:

        Connection c = ConnectionFactory.getInstance().newConnection(
            "localhost",
            "1234",
            "user",
            "pass");

         // use the connection here
         c.disconnect();
 

Version:
$Id: ConnectionFactory.html,v 1.30 2009/07/09 11:01:46 ArndHouben Exp $
See Also:
PaloAPIException

Constructor Summary
ConnectionFactory()
           
 
Method Summary
abstract  ConnectionConfiguration getConfiguration(java.lang.String host, java.lang.String service)
          Creates a new ConnectionConfiguration instance.
abstract  ConnectionConfiguration getConfiguration(java.lang.String host, java.lang.String service, java.lang.String user, java.lang.String password)
          Creates a new ConnectionConfiguration instance with the specified settings for host, service, user and password.
static ConnectionFactory getInstance()
           
abstract  Connection newConnection(ConnectionConfiguration cfg)
          Creates a new Connection using the connection settings from the given ConnectionConfiguration
abstract  Connection newConnection(java.lang.String server, java.lang.String service, java.lang.String user, java.lang.String pass)
          Deprecated. please use {@link #newConnection(ConnectionConfiguration)
abstract  Connection newConnection(java.lang.String server, java.lang.String service, java.lang.String user, java.lang.String pass, boolean doLoadOnDemand, int type)
          Deprecated. please use {@link #newConnection(ConnectionConfiguration)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionFactory

public ConnectionFactory()
Method Detail

getInstance

public static ConnectionFactory getInstance()

newConnection

public abstract Connection newConnection(java.lang.String server,
                                         java.lang.String service,
                                         java.lang.String user,
                                         java.lang.String pass)
Deprecated. please use {@link #newConnection(ConnectionConfiguration)

Creates a new Connection which is connected to the specified palo-server. The default connection is of type HTTP and no load on demand is activated. To define the connection type and to use load on demand please call newConnection(String, String, String, String, boolean, int)

Parameters:
server - the server to connect to.
service - the service to use (corresponds to port numbers given as a string)
user - the username to use for authentication
pass - the password to use for authentication
Returns:
the palo-server connection upon success
Throws:
PaloAPIException - thrown if connecting failed.

newConnection

public abstract Connection newConnection(java.lang.String server,
                                         java.lang.String service,
                                         java.lang.String user,
                                         java.lang.String pass,
                                         boolean doLoadOnDemand,
                                         int type)
Deprecated. please use {@link #newConnection(ConnectionConfiguration)

Creates a new Connection which is connected to the specified palo-server using specified type (legacy of HTTP). Load on demand can be used. In this case the API tries to load only the information which is currently required.

Parameters:
server - the server to connect to.
service - the service to use (corresponds to port numbers given as a string)
user - the username to use for authentication
pass - the password to use for authentication
doLoadOnDemand - activate load on demand
type - palo server type to be used. Please use one of the defined constants Connection.TYPE_LEGACY or Connection.TYPE_HTTP
Returns:
the palo-server connection upon success
Throws:
PaloAPIException - thrown if connecting failed.

getConfiguration

public abstract ConnectionConfiguration getConfiguration(java.lang.String host,
                                                         java.lang.String service)
Creates a new ConnectionConfiguration instance. Only the name of the palo server host and its service are set. All other fields have their default values.

Parameters:
host - host which runs the palo server
service - the service which handles palo requests
Returns:
new ConnectionConfiguration instance

getConfiguration

public abstract ConnectionConfiguration getConfiguration(java.lang.String host,
                                                         java.lang.String service,
                                                         java.lang.String user,
                                                         java.lang.String password)
Creates a new ConnectionConfiguration instance with the specified settings for host, service, user and password.

Parameters:
host - host which runs the palo server
service - the service which handles palo requests
user - the login name
password - the login password
Returns:
ConnectionConfiguration instance

newConnection

public abstract Connection newConnection(ConnectionConfiguration cfg)
Creates a new Connection using the connection settings from the given ConnectionConfiguration

Parameters:
cfg - ConnectionConfiguration containg connection settings
Returns:
the palo-server connection upon success