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, JResource
Direct Known Subclasses:
JResourceDS, JResourceLDAP, JResourceMemory

public abstract class AbstractJResource
extends ReconfigEmitter
implements Serializable, Referenceable, JResourceMBean, 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()
          Clear the cache.
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,JUser> getUsers()
          Return users.
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)
          Set the domain name
 void setJmxService(JmxService jmx)
          Set the jmx service reference
static void setLogger(org.objectweb.util.monolog.api.Logger logger)
           
 void setName(String name)
          Set the name of this resource.
 void setSecurityService(SecurityService sec)
          Set the security service reference
 void setUsers(Hashtable<String,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)
Description copied from interface: JResource
Set the domain name

Specified by:
setDomainName in interface JResource
Parameters:
domain - the domain name

setJmxService

public void setJmxService(JmxService jmx)
Description copied from interface: JResource
Set the jmx service reference

Specified by:
setJmxService in interface JResource
Parameters:
jmx - the jmx service reference

setSecurityService

public void setSecurityService(SecurityService sec)
Description copied from interface: JResource
Set the security service reference

Specified by:
setSecurityService in interface JResource
Parameters:
sec - security service reference

setName

public void setName(String name)
Description copied from interface: JResource
Set the name of this resource.

Specified by:
setName in interface 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 JResource
Returns:
the resource (realm) name

getUsers

public Hashtable<String,JUser> getUsers()
Description copied from interface: JResource
Return users.

Specified by:
getUsers in interface 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,JUser> users)
Specified by:
setUsers in interface JResource
Parameters:
users - the users table

clearCache

public void clearCache()
Description copied from interface: JResource
Clear the cache.

Specified by:
clearCache in interface 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 © 2010 OW2 Consortium. All Rights Reserved.