org.norther.tammi.root.db
Class DefaultRepositoryClient

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.root.db.DefaultRepositoryClient
All Implemented Interfaces:
Serializable, Cloneable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, RepositoryClient
Direct Known Subclasses:
DefaultMultiRepositoryClient

public class DefaultRepositoryClient
extends Adaptee
implements Cloneable, RepositoryClient

A default implementation of RepositoryClient.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
protected static String[] AUTHENTICATED_SIGNATURE
          The authenticated signature.
protected static String DEFAULT_PERSISTER
          The default persister implementation.
protected static String[] KEY_SIGNATURE
          The key signature.
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultRepositoryClient()
          Constructs a new repository client.
 
Method Summary
 Persister acquirePersister()
          Acquires a persister through the default connection.
 Persister acquirePersister(Principal principal)
          Acquires an authenticated persister through the default connection.
 Persister acquirePersister(String user, String pswd)
          Acquires an authenticated persister through the default connection.
 String getAuthenticatedPasswordKey()
          Gets the authenticated password key.
 String getAuthenticatedUsernameKey()
          Gets the authenticated username key.
 String getAuthenticationConnectionKey()
          Gets the authentication connection key.
protected  org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection()
          Gets the default connection.
protected  org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection(boolean cloned)
          Gets the optionally cloned default connection.
protected  org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection(String alias)
          Gets a connection for the specified alias.
 String getConnectionKey()
          Gets the default connection key of the repository this client uses.
 String getConnectionUsername()
          Gets the user's login name for the default connection.
protected  Persister getPersister(org.norther.tammi.root.db.DefaultRepositoryClient.Connection con, String alias, String username, String password, Principal principal)
          Gets a persister through the specified connection.
 String getPersisterClassName()
          Gets the class name of the persister implemention for the default connection.
 boolean isConnectionAuthenticated()
          Checks whether authentication is configured for the default connection.
 void setAuthenticationConnection(String alias, String userKey, String pswdKey)
          Sets authentication connection.
protected  void setConnection(org.norther.tammi.root.db.DefaultRepositoryClient.Connection c)
          Sets the default connection.
 void setConnectionAuthenticated(boolean authenticated)
          Sets whether authentication is configured for the default connection.
 void setConnectionKey(String key)
          Sets the default connection key of the repository this client uses.
 void setConnectionPassword(String password)
          Sets the user's credentials for the default connection.
 void setConnectionUsername(String username)
          Sets the user's login name for the default connection.
 void setPersisterClassName(String className)
          Sets the class name of the persister implementation for the default connection.
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_SIGNATURE

protected static final String[] KEY_SIGNATURE
The key signature.


AUTHENTICATED_SIGNATURE

protected static final String[] AUTHENTICATED_SIGNATURE
The authenticated signature.


DEFAULT_PERSISTER

protected static final String DEFAULT_PERSISTER
The default persister implementation.

Constructor Detail

DefaultRepositoryClient

public DefaultRepositoryClient()
Constructs a new repository client.

Method Detail

getConnectionKey

public String getConnectionKey()
Description copied from interface: RepositoryClient
Gets the default connection key of the repository this client uses.

Specified by:
getConnectionKey in interface RepositoryClient
Returns:
the connection key.

setConnectionKey

public void setConnectionKey(String key)
Description copied from interface: RepositoryClient
Sets the default connection key of the repository this client uses.

Specified by:
setConnectionKey in interface RepositoryClient
Parameters:
key - the connection key.

getPersisterClassName

public String getPersisterClassName()
Description copied from interface: RepositoryClient
Gets the class name of the persister implemention for the default connection.

Specified by:
getPersisterClassName in interface RepositoryClient
Returns:
the persister class name.

setPersisterClassName

public void setPersisterClassName(String className)
Description copied from interface: RepositoryClient
Sets the class name of the persister implementation for the default connection.

Specified by:
setPersisterClassName in interface RepositoryClient
Parameters:
className - the persister class name.

getConnectionUsername

public String getConnectionUsername()
Description copied from interface: RepositoryClient
Gets the user's login name for the default connection.

Specified by:
getConnectionUsername in interface RepositoryClient
Returns:
the user's repository connection login name.

setConnectionUsername

public void setConnectionUsername(String username)
Description copied from interface: RepositoryClient
Sets the user's login name for the default connection.

Specified by:
setConnectionUsername in interface RepositoryClient
Parameters:
username - the user's repository connection login name.

setConnectionPassword

public void setConnectionPassword(String password)
Description copied from interface: RepositoryClient
Sets the user's credentials for the default connection.

Specified by:
setConnectionPassword in interface RepositoryClient
Parameters:
password - the user's repository connection credentials.

isConnectionAuthenticated

public boolean isConnectionAuthenticated()
Description copied from interface: RepositoryClient
Checks whether authentication is configured for the default connection. If username and password are not configured separately, the values passed to the client are used for the connection.

Specified by:
isConnectionAuthenticated in interface RepositoryClient
Returns:
true for an authenticated connection, false otherwise.

setConnectionAuthenticated

public void setConnectionAuthenticated(boolean authenticated)
Description copied from interface: RepositoryClient
Sets whether authentication is configured for the default connection. If username and password are not configured separately, the values passed to the client are used for the connection.

Specified by:
setConnectionAuthenticated in interface RepositoryClient
Parameters:
authenticated - true for an authenticated connection, false otherwise.

getAuthenticationConnectionKey

public String getAuthenticationConnectionKey()
Description copied from interface: RepositoryClient
Gets the authentication connection key.

Specified by:
getAuthenticationConnectionKey in interface RepositoryClient
Returns:
the authentication connection key or null.

getAuthenticatedUsernameKey

public String getAuthenticatedUsernameKey()
Description copied from interface: RepositoryClient
Gets the authenticated username key.

Specified by:
getAuthenticatedUsernameKey in interface RepositoryClient
Returns:
the authenticated username key or null.

getAuthenticatedPasswordKey

public String getAuthenticatedPasswordKey()
Description copied from interface: RepositoryClient
Gets the authenticated password key.

Specified by:
getAuthenticatedPasswordKey in interface RepositoryClient
Returns:
the authenticated password key or null.

setAuthenticationConnection

public void setAuthenticationConnection(String alias,
                                        String userKey,
                                        String pswdKey)
Description copied from interface: RepositoryClient
Sets authentication connection.

Specified by:
setAuthenticationConnection in interface RepositoryClient
Parameters:
alias - the authentication key.
userKey - the username key.
pswdKey - the password key.

acquirePersister

public Persister acquirePersister()
                           throws ConstructionException
Description copied from interface: RepositoryClient
Acquires a persister through the default connection. If the connection is defined to be an authenticated one, the username and password specified for the connection are applied to authentication.

Specified by:
acquirePersister in interface RepositoryClient
Returns:
the default persister.
Throws:
ConstructionException - if construction fails.

acquirePersister

public Persister acquirePersister(String user,
                                  String pswd)
                           throws ConstructionException
Description copied from interface: RepositoryClient
Acquires an authenticated persister through the default connection. If the connection is not defined to be an authenticated one or a connection specific identity is defined, the username and password are ignored.

Specified by:
acquirePersister in interface RepositoryClient
Parameters:
user - the username of the connection.
pswd - the password of the connection.
Returns:
the authenticated persister.
Throws:
ConstructionException - if construction fails.

acquirePersister

public Persister acquirePersister(Principal principal)
                           throws ConstructionException
Description copied from interface: RepositoryClient
Acquires an authenticated persister through the default connection. If the connection is not defined to be an authenticated one or a connection specific identity is defined, the principal is ignored.

Specified by:
acquirePersister in interface RepositoryClient
Parameters:
principal - an authenticated principal.
Returns:
the authenticated persister.
Throws:
ConstructionException - if construction fails.

getPersister

protected Persister getPersister(org.norther.tammi.root.db.DefaultRepositoryClient.Connection con,
                                 String alias,
                                 String username,
                                 String password,
                                 Principal principal)
                          throws ConstructionException
Gets a persister through the specified connection.

Parameters:
con - the connection to use.
alias - an alternate connection alias.
username - an optional username.
password - an optional password.
principal - an optional principal.
Returns:
the specified persister.
Throws:
ReflectionException - if instantiation fails.
ConstructionException - if construction fails.

getConnection

protected org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection()
Gets the default connection.

Returns:
the default connection.

getConnection

protected org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection(boolean cloned)
Gets the optionally cloned default connection.

Parameters:
cloned - true for a cloned connection, false otherwise.
Returns:
the optionally cloned default connection.

setConnection

protected void setConnection(org.norther.tammi.root.db.DefaultRepositoryClient.Connection c)
Sets the default connection.

Parameters:
c - the connection.

getConnection

protected org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection(String alias)
Gets a connection for the specified alias.

Parameters:
alias - the alias to use.
Returns:
the specified connection.


Copyright © 2004 The Norther Organization. All rights reserved.