org.ow2.jonas.security.internal.realm.factory
Class AbstractJResource

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.ow2.jonas.lib.reconfig.ReconfigEmitter
          extended by org.ow2.jonas.security.internal.realm.factory.AbstractJResource
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Referenceable, JResourceMBean, org.ow2.jonas.security.realm.factory.JResource
Direct Known Subclasses:
JResourceDS, JResourceLDAP, JResourceMemory

public abstract class AbstractJResource
extends org.ow2.jonas.lib.reconfig.ReconfigEmitter
implements Serializable, Referenceable, JResourceMBean, org.ow2.jonas.security.realm.factory.JResource

This class implements JOnAS realm factory objects. It is build from an xml file by the security service of JOnAS.

Author:
Florent Benoit
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
AbstractJResource()
          Constructor.
 
Method Summary
 void addNotificationListener(NotificationListener arg0, NotificationFilter arg1, Object arg2)
          Allows for listener objects to receive notifications emitted by this resource.
 void clearCache()
           
static org.objectweb.util.monolog.api.Logger getLogger()
           
 String getName()
          Get the name of this resource.
protected  long getSequenceNumber()
          Return a sequence number and increase this number.
 Hashtable<String,org.ow2.jonas.security.realm.principal.JUser> getUsers()
           
protected  void registerGroupMBean(Group group)
          Create and register an MBean for the group.
protected  void registerRoleMBean(Role role)
          Create and register an MBean for this role.
protected  void registerUserMBean(User user)
          Create and register an MBean for the user.
 void saveConfig()
          Save the resource configuration.
 void setDomainName(String domain)
           
 void setJmxService(org.ow2.jonas.jmx.JmxService jmx)
           
static void setLogger(org.objectweb.util.monolog.api.Logger logger)
           
 void setName(String name)
           
 void setSecurityService(org.ow2.jonas.security.SecurityService sec)
           
 void setUsers(Hashtable<String,org.ow2.jonas.security.realm.principal.JUser> users)
           
protected  void unregisterGroupMBean(String resourceName, String groupName)
          Unregister MBean associated to a group.
protected  void unregisterRoleMBean(String resourceName, String roleName)
           
protected  void unregisterUserMBean(String resourceName, String userName)
          Unregister MBean associated to a user.
 
Methods inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.naming.Referenceable
getReference
 
Methods inherited from interface org.ow2.jonas.security.realm.factory.JResource
findUser, getArrayListCombinedRoles, getReference, isValidUser, removeMBeans
 

Constructor Detail

AbstractJResource

public AbstractJResource()
                  throws Exception
Constructor.

Throws:
Exception - if a service can't be retrieved
Method Detail

setDomainName

public void setDomainName(String domain)

setJmxService

public void setJmxService(org.ow2.jonas.jmx.JmxService jmx)

setSecurityService

public void setSecurityService(org.ow2.jonas.security.SecurityService sec)

setName

public void setName(String name)
Specified by:
setName in interface org.ow2.jonas.security.realm.factory.JResource
Parameters:
name - the resource (realm) name

getName

public String getName()
Description copied from interface: JResourceMBean
Get the name of this resource.

Specified by:
getName in interface JResourceMBean
Specified by:
getName in interface org.ow2.jonas.security.realm.factory.JResource
Returns:
the resource (realm) name

getUsers

public Hashtable<String,org.ow2.jonas.security.realm.principal.JUser> getUsers()
Specified by:
getUsers in interface org.ow2.jonas.security.realm.factory.JResource
Returns:
the users table

getSequenceNumber

protected long getSequenceNumber()
Return a sequence number and increase this number.

Returns:
a sequence number

saveConfig

public void saveConfig()
Save the resource configuration.

Specified by:
saveConfig in interface JResourceMBean

getLogger

public static org.objectweb.util.monolog.api.Logger getLogger()
Returns:
Returns the logger.

setLogger

public static void setLogger(org.objectweb.util.monolog.api.Logger logger)
Parameters:
logger - The logger to set.

setUsers

public void setUsers(Hashtable<String,org.ow2.jonas.security.realm.principal.JUser> users)
Specified by:
setUsers in interface org.ow2.jonas.security.realm.factory.JResource
Parameters:
users - the users table

clearCache

public void clearCache()
Specified by:
clearCache in interface org.ow2.jonas.security.realm.factory.JResource

addNotificationListener

public void addNotificationListener(NotificationListener arg0,
                                    NotificationFilter arg1,
                                    Object arg2)
Allows for listener objects to receive notifications emitted by this resource.

Specified by:
addNotificationListener in interface NotificationBroadcaster
Overrides:
addNotificationListener in class NotificationBroadcasterSupport
Parameters:
arg0 - listener object
arg1 - notification filter
arg2 - handback object

registerUserMBean

protected void registerUserMBean(User user)
                          throws MalformedObjectNameException
Create and register an MBean for the user.

Parameters:
user - the user to be managed
Throws:
MalformedObjectNameException - if we could not construct ObjectName for the user

unregisterUserMBean

protected void unregisterUserMBean(String resourceName,
                                   String userName)
                            throws MalformedObjectNameException
Unregister MBean associated to a user.

Parameters:
resourceName -
userName -
Throws:
MalformedObjectNameException - if MBean is not unregistered

registerGroupMBean

protected void registerGroupMBean(Group group)
                           throws MalformedObjectNameException
Create and register an MBean for the group.

Parameters:
group - the group to be managed
Throws:
MalformedObjectNameException - if MBean is not created

unregisterGroupMBean

protected void unregisterGroupMBean(String resourceName,
                                    String groupName)
                             throws MalformedObjectNameException
Unregister MBean associated to a group.

Parameters:
resourceName -
groupName -
Throws:
MalformedObjectNameException - could not construct ObjectName for the user

registerRoleMBean

protected void registerRoleMBean(Role role)
                          throws MalformedObjectNameException
Create and register an MBean for this role.

Parameters:
role - the role to be managed
Throws:
MalformedObjectNameException - not construct ObjectName for this role

unregisterRoleMBean

protected void unregisterRoleMBean(String resourceName,
                                   String roleName)
                            throws MalformedObjectNameException
Parameters:
resourceName -
roleName -
Throws:
MalformedObjectNameException - could not construct ObjectName for this role


Copyright © 2008 OW2 Consortium. All Rights Reserved.