org.tentackle.db
Class IdSourceConfigurator

java.lang.Object
  extended by org.tentackle.db.IdSourceConfigurator

public class IdSourceConfigurator
extends Object

Configurator for an IdSource.

The configurator binds an IdSource to the application by means of an IdSourceConnector. An IdSource is uniquely identified by a namespace, a name and an optional realm.

There are three types of connectors:

  1. Local connectors: for local ID sources, usually stored in a database. The format of the descriptor is:
        pool:{IdSourceConnector}:{space}:{name}[:realm]
     
        Example:
        pool:de.krake.poolkeeper.dbms.IdPool:plsbl:einlagNr
        
  2. Remote connectors: for connecting to remote ID sources, usually provided by an application server. The format of the descriptor is:
        rmi:{IdSourceConnector}:{url}:{space}:{name}[:realm]
     
        Example:
        rmi://gonzo.krake.local:28000/PoolKeeper:scout:auftragNr:HAMBURG
        
  3. The default ID source ObjectId is described as:
        default|objectid
        
For an extensive implementation of this concept please see the PoolKeeper project.

Author:
harald

Field Summary
static int SOURCE_DEFAULT
          default mode, use ObjectId (if in db) or same as Db (if in DbObject)
static int SOURCE_POOL
          local mode, i.e.
static int SOURCE_RMI
          rmi mode, i.e.
static int SOURCE_UNKNOWN
          unknown, i.e.
 
Constructor Summary
IdSourceConfigurator()
          Creates a default configurator for ObjectId.
IdSourceConfigurator(String descriptor)
          Constructs a configurator from a descriptor.
 
Method Summary
 IdSource connect(Db db)
          Connect to the ID-Source.
 String getIdSourceConnector()
          Gets the loaded IdSourceConnector.
 String getIdSourceName()
          Gets the name of the id source.
 String getIdSourceRealm()
          Gets the realm of the id source.
 String getIdSourceSpace()
          Gets the namespace of the id source.
 int getIdSourceType()
          Gets the type of the id source.
 String getIdSourceUrl()
          Gets the url if connector is remote.
 void parse(String descriptor)
          Parse a connection descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_UNKNOWN

public static final int SOURCE_UNKNOWN
unknown, i.e. not configured

See Also:
Constant Field Values

SOURCE_DEFAULT

public static final int SOURCE_DEFAULT
default mode, use ObjectId (if in db) or same as Db (if in DbObject)

See Also:
Constant Field Values

SOURCE_RMI

public static final int SOURCE_RMI
rmi mode, i.e. remote source

See Also:
Constant Field Values

SOURCE_POOL

public static final int SOURCE_POOL
local mode, i.e. direct access to pool

See Also:
Constant Field Values
Constructor Detail

IdSourceConfigurator

public IdSourceConfigurator(String descriptor)
                     throws ApplicationException
Constructs a configurator from a descriptor.

Parameters:
descriptor - the connection descriptor
Throws:
ApplicationException - if parsing the descriptor failed

IdSourceConfigurator

public IdSourceConfigurator()
Creates a default configurator for ObjectId.

Method Detail

parse

public void parse(String descriptor)
           throws ApplicationException
Parse a connection descriptor.

Parameters:
descriptor - the connection descriptor
Throws:
ApplicationException - if descriptor malformed

connect

public IdSource connect(Db db)
                 throws ApplicationException
Connect to the ID-Source.

Parameters:
db - the db connection
Returns:
the connected IdSource
Throws:
ApplicationException - if connection failed

getIdSourceConnector

public String getIdSourceConnector()
Gets the loaded IdSourceConnector.

Returns:
the connector.

getIdSourceUrl

public String getIdSourceUrl()
Gets the url if connector is remote.

Returns:
the url, null if local

getIdSourceSpace

public String getIdSourceSpace()
Gets the namespace of the id source.

Returns:
the space

getIdSourceName

public String getIdSourceName()
Gets the name of the id source.

Returns:
Value of property idSourceName.

getIdSourceRealm

public String getIdSourceRealm()
Gets the realm of the id source.

Returns:
the realm

getIdSourceType

public int getIdSourceType()
Gets the type of the id source. One of SOURCE_...

Returns:
the type


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de