org.norther.tammi.root.rt
Class VariableRoot

java.lang.Object
  extended by org.norther.tammi.core.base.Referable
      extended by org.norther.tammi.core.relation.Relation
          extended by org.norther.tammi.core.rt.VariableTree
              extended by org.norther.tammi.root.rt.VariableRoot
All Implemented Interfaces:
Serializable, EventListener, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, NotificationListener, Relation, RelationSupportMBean, Identifiable, MBeanDelegate, NamePattern, ReferableMBean, Startable, RelationMBean, VariableTreeMBean, RepositoryClient, VariableRootMBean

public class VariableRoot
extends VariableTree
implements VariableRootMBean

A default implementation of VariableRootMBean.

Author:
Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.norther.tammi.core.rt.VariableTree
VariableTree.VariableTreeType
 
Field Summary
 
Fields inherited from class org.norther.tammi.core.rt.VariableTree
VARIABLE_TREE_NOTIF_DESCRIPTION, VARIABLE_TREE_NOTIFICATONS, VARIABLE_TREE_TYPE
 
Fields inherited from class org.norther.tammi.core.relation.Relation
RELATION_NOTIF_DESCRIPTION, RELATION_NOTIFICATIONS, roleUpdate
 
Fields inherited from class org.norther.tammi.core.base.Referable
ID_LENGTH, REFERABLE_ATTRIBUTES, REFERABLE_NOTIF_DESCRIPTION, REFERABLE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.rt.VariableTreeMBean
BEAN_TREE_RELATION, ROLE_BASE, ROLE_BRANCH, ROLE_LEAF
 
Fields inherited from interface org.norther.tammi.core.base.ReferableMBean
DEFAULT_ID, ID, MBEAN, MBEAN_DESCRIPTION, TYPE
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
VariableRoot()
          Constructs a new root.
VariableRoot(RoleList roles)
          Constructs a new repository with initial roles.
 
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.
 void clearSubBranches()
          Clears the tree by removing leaves from the root itself and both branches and leaves from its branches.
 String dump(String path)
          Dumps the contents of this tree to a dump file.
 String getAuthenticatedPasswordKey()
          Gets the authenticated password key.
 String getAuthenticatedUsernameKey()
          Gets the authenticated username key.
 String getAuthenticationConnectionKey()
          Gets the authentication connection key.
 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.
 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.
 boolean isStarted()
          Checks whether the root is started.
 void load(String path)
          Loads the contents of a dump file to this tree.
 void postRegister(Boolean done)
          Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.
 void preDeregister()
          Allows the MBean to perform any operations it needs before being de-registered by the MBean server.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Allows the MBean to perform any operations it needs before being registered in the MBean server.
 void setAuthenticationConnection(String alias, String userKey, String pswdKey)
          Sets authentication 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.
 void setRelationServiceManagementFlag(Boolean theFlg)
          Activates/deactivates the listener.
 void start()
          Starts the root and loads the current record file.
 void stop()
          Stops the root.
 
Methods inherited from class org.norther.tammi.core.rt.VariableTree
addBranchName, addBranchNames, addLeafName, addLeafNames, clearBranchNames, clearLeafNames, containsBranchName, containsLeafName, getBase, getBaseName, getBranch, getBranches, getBranchNames, getLeaf, getLeafNames, getLeaves, getNotificationInfo, getVariableTreeType, handleNotification, hasListeners, isUnregisterRemovedActors, notifyVariableTree, removeBranchName, removeBranchNames, removeLeafName, removeLeafNames, sendNotification, setBaseName, setRoleWithStatus, setUnregisterRemovedActors, unregisterRemovedActors
 
Methods inherited from class org.norther.tammi.core.relation.Relation
addActorName, addActorName, addActorNames, addToService, clearRole, getActor, getActor, getActor, getActorName, getActorName, getAllRoles, getReferencedMBeans, getRelationId, getRelationService, getRelationServiceName, getRelationTypeName, getRole, getRoleActors, getRoleCardinality, getRoleDirect, getRoles, getRoleWithStatus, handleMBeanUnregistration, isActorInDirectRole, isInRelationService, isNamedActorInRole, postDeregister, removeActorName, removeActorName, removeActorNames, removeFromService, retrieveAllRoles, retrieveRole, roleCollection, setActorName, setActorName, setRelationId, setRelationTypeName, setRole, setRoleDirect, setRoles
 
Methods inherited from class org.norther.tammi.core.base.Referable
addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNamePattern, getObjectName, getQueryPattern, getRegistrationTime, getSequenceNumber, getUniqueName, isUnregistered, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, setCanonicalName, setMBeanServer, setNamePattern, setObjectName, setQueryPattern, unregister, unregistered
 
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.core.rt.VariableTreeMBean
addBranchName, addBranchNames, addLeafName, addLeafNames, clearBranchNames, clearLeafNames, containsBranchName, containsLeafName, getBase, getBaseName, getBranch, getBranches, getBranchNames, getLeaf, getLeafNames, getLeaves, isUnregisterRemovedActors, notifyVariableTree, removeBranchName, removeBranchNames, removeLeafName, removeLeafNames, setBaseName, setUnregisterRemovedActors
 
Methods inherited from interface org.norther.tammi.core.relation.RelationMBean
addActorName, addActorName, addActorNames, addToService, clearRole, getActor, getActor, getActor, getActorName, getActorName, getRelationService, getRoleActors, isNamedActorInRole, removeActorName, removeActorName, removeActorNames, removeFromService, retrieveRole, setActorName, setActorName
 
Methods inherited from interface javax.management.relation.RelationSupportMBean
isInRelationService
 
Methods inherited from interface javax.management.relation.Relation
getAllRoles, getReferencedMBeans, getRelationId, getRelationServiceName, getRelationTypeName, getRole, getRoleCardinality, getRoles, handleMBeanUnregistration, retrieveAllRoles, setRole, setRoles
 
Methods inherited from interface org.norther.tammi.core.base.ReferableMBean
getMBean
 

Constructor Detail

VariableRoot

public VariableRoot()
Constructs a new root.


VariableRoot

public VariableRoot(RoleList roles)
Constructs a new repository with initial roles.

Parameters:
roles - an optional list of initial roles.
Method Detail

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Description copied from class: Referable
Allows the MBean to perform any operations it needs before being registered in the MBean server. The referable MBean provides a default name, if the name of the MBean is not specified. It also sends a registration notification for any client MBeans. If any exception is raised, the MBean will not be registered in the MBean server. Any subclasses must redirect their preRegister method to super MBean.

Specified by:
preRegister in interface MBeanRegistration
Overrides:
preRegister in class Relation
Parameters:
server - the MBean server in which the MBean will be registered.
name - the object name of the MBean (may be null).
Returns:
the name of the registered MBean.
Throws:
Exception - for errors.

postRegister

public void postRegister(Boolean done)
Description copied from class: Referable
Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

Specified by:
postRegister in interface MBeanRegistration
Overrides:
postRegister in class VariableTree
Parameters:
done - indicates whether or not the MBean has been registered.

preDeregister

public void preDeregister()
                   throws Exception
Description copied from class: Referable
Allows the MBean to perform any operations it needs before being de-registered by the MBean server. The configurable MBean sends an unregistration notifitation for any referencing MBeans.

Specified by:
preDeregister in interface MBeanRegistration
Overrides:
preDeregister in class Relation
Throws:
Exception - on errors.

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.

clearSubBranches

public void clearSubBranches()
Description copied from interface: VariableRootMBean
Clears the tree by removing leaves from the root itself and both branches and leaves from its branches. Its own branches are not removed as they are considered crucial for business logic.

Note that the record file is also cleared.

Specified by:
clearSubBranches in interface VariableRootMBean

load

public void load(String path)
          throws LogException
Description copied from interface: VariableRootMBean
Loads the contents of a dump file to this tree. Loaded objects are merged to existing ones.

Specified by:
load in interface VariableRootMBean
Parameters:
path - the pathname of the file.
Throws:
LogException - on errors.

dump

public String dump(String path)
            throws LogException
Description copied from interface: VariableRootMBean
Dumps the contents of this tree to a dump file. The file must be a new one.

Specified by:
dump in interface VariableRootMBean
Parameters:
path - the pathname of the file.
Returns:
the full pathname of the dump file.
Throws:
LogException - on errors.

setRelationServiceManagementFlag

public void setRelationServiceManagementFlag(Boolean theFlg)
Activates/deactivates the listener.

Specified by:
setRelationServiceManagementFlag in interface RelationSupportMBean
Overrides:
setRelationServiceManagementFlag in class VariableTree
Parameters:
theFlg - the flag.

isStarted

public boolean isStarted()
Checks whether the root is started.

Specified by:
isStarted in interface Startable
Returns:
true if ready to accept notifications, otherwise false.

start

public void start()
           throws LogException
Starts the root and loads the current record file.

Specified by:
start in interface Startable
Throws:
LogException - if start fails.

stop

public void stop()
Stops the root.

Specified by:
stop in interface Startable


Copyright © 2004 The Norther Organization. All rights reserved.