org.norther.tammi.root.db
Class DefaultMultiRepositoryClient

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

public class DefaultMultiRepositoryClient
extends DefaultRepositoryClient
implements MultiRepositoryClient

A default implementation of MultiRepositoryClient.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.root.db.DefaultRepositoryClient
AUTHENTICATED_SIGNATURE, DEFAULT_PERSISTER, 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
DefaultMultiRepositoryClient()
          Constructs a new repository client.
 
Method Summary
 Persister acquirePersister(String key)
          Acquires a persister through the specified connection.
 Persister acquirePersister(String key, Principal principal)
          Acquires an authenticated persister through the specified connection.
 Persister acquirePersister(String key, String user, String pswd)
          Acquires an authenticated persister through the specified connection.
 void clearConnections()
          Clears all connections.
 Set connectionKeySet()
          Returns a read-only set of available connection aliases.
 boolean containsConnection(String key)
          Checks the specified connection.
 String getAuthenticatedPasswordKey(String key)
          Gets the authenticated password key of the specified connection.
 String getAuthenticatedUsernameKey(String key)
          Gets the authenticated username key of the specified connection.
 String getAuthenticationConnectionKey(String key)
          Gets the authentication connection key of the specified connection.
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 key)
          Gets the specified connection.
protected  org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection(String key, boolean cloned)
          Gets the specified and optionally cloned connection.
 String getConnectionAlias(String key)
          Gets the alias of the specified connection.
 String getConnectionKey()
          Gets the default connection key of the repository this client uses.
 String getConnectionUsername(String key)
          Gets the user's login name of the specified connection.
 String getPersisterClassName(String key)
          Gets the class name of the persister implementation of the specified connection.
 String getResourceKey()
          Gets the resource connection key of the repository this client uses.
 boolean isConnectionAuthenticated(String key)
          Checks whether authentication is configured for the specified connection.
 void removeConnection(String key)
          Removes the specified connection.
 void setAuthenticationConnection(String key, String alias, String userKey, String pswdKey)
          Sets authentication connection of the specified connection.
protected  void setConnection(org.norther.tammi.root.db.DefaultRepositoryClient.Connection c)
          Sets the default connection.
protected  void setConnection(String key, org.norther.tammi.root.db.DefaultRepositoryClient.Connection c)
          Sets the specified connection.
 void setConnectionAlias(String key, String alias)
          Sets the alias of the specified connection.
 void setConnectionAuthenticated(String key, boolean authenticated)
          Sets whether authentication is configured for the specified connection.
 void setConnectionKey(String key)
          Sets the default connection key of the repository this client uses.
 void setConnectionPassword(String key, String password)
          Sets the user's credentials of the specified connection.
 void setConnectionUsername(String key, String username)
          Sets the user's login name of the specified connection.
 void setPersisterClassName(String key, String className)
          Sets the class name of the persister implementation of the specified connection.
 void setResourceKey(String key)
          Sets the resource connection key of the repository this client uses.
 
Methods inherited from class org.norther.tammi.root.db.DefaultRepositoryClient
acquirePersister, acquirePersister, acquirePersister, getAuthenticatedPasswordKey, getAuthenticatedUsernameKey, getAuthenticationConnectionKey, getConnectionUsername, getPersister, getPersisterClassName, isConnectionAuthenticated, setAuthenticationConnection, setConnectionAuthenticated, setConnectionPassword, setConnectionUsername, setPersisterClassName
 
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
 
Methods inherited from interface org.norther.tammi.root.db.RepositoryClient
acquirePersister, acquirePersister, acquirePersister, getAuthenticatedPasswordKey, getAuthenticatedUsernameKey, getAuthenticationConnectionKey, getConnectionUsername, getPersisterClassName, isConnectionAuthenticated, setAuthenticationConnection, setConnectionAuthenticated, setConnectionPassword, setConnectionUsername, setPersisterClassName
 

Constructor Detail

DefaultMultiRepositoryClient

public DefaultMultiRepositoryClient()
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
Overrides:
getConnectionKey in class DefaultRepositoryClient
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
Overrides:
setConnectionKey in class DefaultRepositoryClient
Parameters:
key - the connection key.

getResourceKey

public String getResourceKey()
Description copied from interface: MultiRepositoryClient
Gets the resource connection key of the repository this client uses.

Specified by:
getResourceKey in interface MultiRepositoryClient
Returns:
the resource key.

setResourceKey

public void setResourceKey(String key)
Description copied from interface: MultiRepositoryClient
Sets the resource connection key of the repository this client uses.

Specified by:
setResourceKey in interface MultiRepositoryClient
Parameters:
key - the resource key.

getConnectionAlias

public String getConnectionAlias(String key)
Description copied from interface: MultiRepositoryClient
Gets the alias of the specified connection. The key is applied if not specified.

Specified by:
getConnectionAlias in interface MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
the connection alias.

setConnectionAlias

public void setConnectionAlias(String key,
                               String alias)
Description copied from interface: MultiRepositoryClient
Sets the alias of the specified connection. The key is applied if not specified.

Specified by:
setConnectionAlias in interface MultiRepositoryClient
Parameters:
key - the connection key.
alias - the connection alias.

getPersisterClassName

public String getPersisterClassName(String key)
Description copied from interface: MultiRepositoryClient
Gets the class name of the persister implementation of the specified connection.

Specified by:
getPersisterClassName in interface MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
the class name.

setPersisterClassName

public void setPersisterClassName(String key,
                                  String className)
Description copied from interface: MultiRepositoryClient
Sets the class name of the persister implementation of the specified connection.

Specified by:
setPersisterClassName in interface MultiRepositoryClient
Parameters:
key - the connection key.
className - the class name.

getConnectionUsername

public String getConnectionUsername(String key)
Description copied from interface: MultiRepositoryClient
Gets the user's login name of the specified connection.

Specified by:
getConnectionUsername in interface MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
the user's repository connection login name.

setConnectionUsername

public void setConnectionUsername(String key,
                                  String username)
Description copied from interface: MultiRepositoryClient
Sets the user's login name of the specified connection.

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

setConnectionPassword

public void setConnectionPassword(String key,
                                  String password)
Description copied from interface: MultiRepositoryClient
Sets the user's credentials of the specified connection.

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

isConnectionAuthenticated

public boolean isConnectionAuthenticated(String key)
Description copied from interface: MultiRepositoryClient
Checks whether authentication is configured for the specified 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 MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
the class name.

setConnectionAuthenticated

public void setConnectionAuthenticated(String key,
                                       boolean authenticated)
Description copied from interface: MultiRepositoryClient
Sets whether authentication is configured for the specified 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 MultiRepositoryClient
Parameters:
key - the connection key.
authenticated - true if the connection is to be authenticated.

getAuthenticationConnectionKey

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

Specified by:
getAuthenticationConnectionKey in interface MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
the authentication connection key or null.

getAuthenticatedUsernameKey

public String getAuthenticatedUsernameKey(String key)
Description copied from interface: MultiRepositoryClient
Gets the authenticated username key of the specified connection.

Specified by:
getAuthenticatedUsernameKey in interface MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
the authenticated username key or null.

getAuthenticatedPasswordKey

public String getAuthenticatedPasswordKey(String key)
Description copied from interface: MultiRepositoryClient
Gets the authenticated password key of the specified connection.

Specified by:
getAuthenticatedPasswordKey in interface MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
the authenticated password key or null.

setAuthenticationConnection

public void setAuthenticationConnection(String key,
                                        String alias,
                                        String userKey,
                                        String pswdKey)
Description copied from interface: MultiRepositoryClient
Sets authentication connection of the specified connection.

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

containsConnection

public boolean containsConnection(String key)
Description copied from interface: MultiRepositoryClient
Checks the specified connection.

Specified by:
containsConnection in interface MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
true if available, false otherwise.

removeConnection

public void removeConnection(String key)
Description copied from interface: MultiRepositoryClient
Removes the specified connection.

Specified by:
removeConnection in interface MultiRepositoryClient
Parameters:
key - the connection key.

clearConnections

public void clearConnections()
Description copied from interface: MultiRepositoryClient
Clears all connections.

Specified by:
clearConnections in interface MultiRepositoryClient

connectionKeySet

public Set connectionKeySet()
Description copied from interface: MultiRepositoryClient
Returns a read-only set of available connection aliases.

Specified by:
connectionKeySet in interface MultiRepositoryClient
Returns:
a set of connections aliases.

acquirePersister

public Persister acquirePersister(String key)
                           throws ConstructionException
Description copied from interface: MultiRepositoryClient
Acquires a persister through the specified 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 MultiRepositoryClient
Parameters:
key - the connection key.
Returns:
the default persister.
Throws:
ConstructionException - if construction fails.

acquirePersister

public Persister acquirePersister(String key,
                                  String user,
                                  String pswd)
                           throws ConstructionException
Description copied from interface: MultiRepositoryClient
Acquires an authenticated persister through the specified 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 MultiRepositoryClient
Parameters:
key - the connection key.
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(String key,
                                  Principal principal)
                           throws ConstructionException
Description copied from interface: MultiRepositoryClient
Acquires an authenticated persister through the specified 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 MultiRepositoryClient
Parameters:
key - the connection key.
principal - an authenticated principal.
Returns:
the authenticated persister.
Throws:
ConstructionException - if construction fails.

getConnection

protected org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection()
Description copied from class: DefaultRepositoryClient
Gets the default connection.

Overrides:
getConnection in class DefaultRepositoryClient
Returns:
the default connection.

getConnection

protected org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection(boolean cloned)
Description copied from class: DefaultRepositoryClient
Gets the optionally cloned default connection.

Overrides:
getConnection in class DefaultRepositoryClient
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)
Description copied from class: DefaultRepositoryClient
Sets the default connection.

Overrides:
setConnection in class DefaultRepositoryClient
Parameters:
c - the connection.

getConnection

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

Overrides:
getConnection in class DefaultRepositoryClient
Parameters:
key - the connection key.
Returns:
the specified connection or null.

getConnection

protected org.norther.tammi.root.db.DefaultRepositoryClient.Connection getConnection(String key,
                                                                                     boolean cloned)
Gets the specified and optionally cloned connection.

Parameters:
key - the connection key.
cloned - true for a cloned connection, false otherwise.
Returns:
the optionally cloned connection or null.

setConnection

protected void setConnection(String key,
                             org.norther.tammi.root.db.DefaultRepositoryClient.Connection c)
Sets the specified connection.

Parameters:
key - the connection key.
c - the connection.


Copyright © 2004 The Norther Organization. All rights reserved.