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, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, RepositoryClient
Direct Known Subclasses:
DefaultMultiRepositoryClient, DefaultRepositoryFilter

public class DefaultRepositoryClient
extends Adaptee
implements RepositoryClient

A default implementation of RepositoryClient.

Version:
$Id: DefaultRepositoryClient.java,v 1.15 2009/09/28 17:56:49 cvsimp Exp $
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
 
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 alias)
          Acquires a persister through the aliased connection.
 Persister acquirePersister(String alias, Principal principal)
          Acquires an authenticated persister through the aliased connection.
 Persister acquirePersister(String user, String pswd)
          Acquires an authenticated persister through the default connection.
 Persister acquirePersister(String alias, String user, String pswd)
          Acquires an authenticated persister through the aliased connection.
 DBCriteria<Variable> createPermissionCriteria(String className, Object oid, Object uid, Object[] gids, boolean others, Permission permission, Persister persister)
          Creates the specified permission criteria for a meta element query.
 DBCriteria<? extends Variable> createUserPermissionCriteria(Identity id, String className, String username, String groupName, Permission permission, Persister persister)
          Creates the specified user permission criteria for a variable record query from a meta container.
 DBCriteria<? extends Variable> createUserPermissionCriteria(String className, Permission permission, Persister persister)
          Creates the specified user permission criteria for a meta element query.
 DBCriteria<? extends Variable> createUserPermissionCriteria(String className, String username, String groupName, Permission permission, Persister persister)
          Creates the specified user permission criteria for a variable record query.
 String getAuthenticatedPasswordKey()
          Gets the authenticated password key.
 String getAuthenticatedUsernameKey()
          Gets the authenticated username key.
 String getAuthenticationConnectionAlias()
          Gets the authentication connection alias.
 RepositoryConnection getConnection()
          Gets the default connection.
 RepositoryConnection getConnection(String alias)
          Gets a connection for the specified alias.
 String getConnectionAlias()
          Gets the default connection alias of the repository this client uses.
 String getConnectionUsername()
          Gets the user's login name for the default connection.
protected  RepositoryConnection getInternalConnection(boolean cloned)
          Gets the optionally cloned internal connection.
 String getPersisterClassName()
          Gets the class name of the persister implemention for the default connection.
protected  MBeanReference<? extends RepositoryClient> getRepositoryClientMBean()
          Gets the reference to this repository client.
 boolean isConnectionAuthenticated()
          Checks whether authentication is configured for the default connection.
 void setAuthenticationConnection(String auth, String userKey, String pswdKey)
          Sets the authentication connection.
 void setConnectionAlias(String key)
          Sets the default connection alias of the repository this client uses.
 void setConnectionAuthenticated(boolean authenticated)
          Sets whether authentication is configured for the default connection.
 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.
protected  void setInternalConnection(RepositoryConnection c)
          Sets the internal 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

getConnectionAlias

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

Specified by:
getConnectionAlias in interface RepositoryClient
Returns:
the connection alias.

setConnectionAlias

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

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

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.

getAuthenticationConnectionAlias

public String getAuthenticationConnectionAlias()
Description copied from interface: RepositoryClient
Gets the authentication connection alias.

Specified by:
getAuthenticationConnectionAlias in interface RepositoryClient
Returns:
the authentication connection alias 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 auth,
                                        String userKey,
                                        String pswdKey)
Description copied from interface: RepositoryClient
Sets the authentication connection.

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

getConnection

public RepositoryConnection getConnection()
Description copied from interface: RepositoryClient
Gets the default connection.

Specified by:
getConnection in interface RepositoryClient
Returns:
the default connection.

getConnection

public RepositoryConnection getConnection(String alias)
Description copied from interface: RepositoryClient
Gets a connection for the specified alias.

Specified by:
getConnection in interface RepositoryClient
Parameters:
alias - the alias to use.
Returns:
the specified connection.

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.

acquirePersister

public Persister acquirePersister(String alias)
                           throws ConstructionException
Description copied from interface: RepositoryClient
Acquires a persister through the aliased 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
Parameters:
alias - the alias to use.
Returns:
the default persister.
Throws:
ConstructionException - if construction fails.

acquirePersister

public Persister acquirePersister(String alias,
                                  String user,
                                  String pswd)
                           throws ConstructionException
Description copied from interface: RepositoryClient
Acquires an authenticated persister through the aliased 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:
alias - the alias to use.
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 alias,
                                  Principal principal)
                           throws ConstructionException
Description copied from interface: RepositoryClient
Acquires an authenticated persister through the aliased 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:
alias - the alias to use.
principal - an authenticated principal.
Returns:
the authenticated persister.
Throws:
ConstructionException - if construction fails.

createPermissionCriteria

public DBCriteria<Variable> createPermissionCriteria(String className,
                                                     Object oid,
                                                     Object uid,
                                                     Object[] gids,
                                                     boolean others,
                                                     Permission permission,
                                                     Persister persister)
Description copied from interface: RepositoryClient
Creates the specified permission criteria for a meta element query.

Specified by:
createPermissionCriteria in interface RepositoryClient
Parameters:
className - the variable class name.
oid - the owner id.
uid - the user id.
gids - the group ids.
others - the others option.
permission - the reuqested permission.
persister - the persister.
Returns:
the created criteria.

createUserPermissionCriteria

public DBCriteria<? extends Variable> createUserPermissionCriteria(String className,
                                                                   Permission permission,
                                                                   Persister persister)
                                                            throws AttributeNotFoundException,
                                                                   PersistenceException
Description copied from interface: RepositoryClient
Creates the specified user permission criteria for a meta element query.

Specified by:
createUserPermissionCriteria in interface RepositoryClient
Parameters:
className - the element class name.
permission - the permission.
persister - the persister.
Returns:
the search criteria.
Throws:
AttributeNotFoundException - for missing attributes.
PersistenceException - for persister errors.

createUserPermissionCriteria

public DBCriteria<? extends Variable> createUserPermissionCriteria(String className,
                                                                   String username,
                                                                   String groupName,
                                                                   Permission permission,
                                                                   Persister persister)
                                                            throws AttributeNotFoundException,
                                                                   AccessDeniedException,
                                                                   PersistenceException
Description copied from interface: RepositoryClient
Creates the specified user permission criteria for a variable record query.

Specified by:
createUserPermissionCriteria in interface RepositoryClient
Parameters:
className - the variable class name.
username - an optional owner of variable content.
groupName - an optional group of owners of variable content.
permission - the requested permission.
persister - the persister.
Returns:
the created criteria.
Throws:
AttributeNotFoundException - for missing attributes.
AccessDeniedException - for missing rights.
PersistenceException - for persister errors.

createUserPermissionCriteria

public DBCriteria<? extends Variable> createUserPermissionCriteria(Identity id,
                                                                   String className,
                                                                   String username,
                                                                   String groupName,
                                                                   Permission permission,
                                                                   Persister persister)
                                                            throws AttributeNotFoundException,
                                                                   AccessDeniedException,
                                                                   PersistenceException
Description copied from interface: RepositoryClient
Creates the specified user permission criteria for a variable record query from a meta container.

Specified by:
createUserPermissionCriteria in interface RepositoryClient
Parameters:
id - the container identity.
className - the variable class name.
username - an optional owner of variable content.
groupName - an optional group of owners of variable content.
permission - the requested permission.
persister - the persister.
Returns:
the created criteria.
Throws:
AttributeNotFoundException - for missing attributes.
AccessDeniedException - for missing rights.
PersistenceException - for persister errors.

getInternalConnection

protected RepositoryConnection getInternalConnection(boolean cloned)
Gets the optionally cloned internal connection.

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

setInternalConnection

protected void setInternalConnection(RepositoryConnection c)
Sets the internal connection.

Parameters:
c - the connection.

getRepositoryClientMBean

protected MBeanReference<? extends RepositoryClient> getRepositoryClientMBean()
Gets the reference to this repository client.

Returns:
the MBean reference.


Copyright © 2004 The Norther Organization. All rights reserved.