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

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
              extended by org.ow2.jonas.security.internal.realm.factory.JResourceDS
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Referenceable, JResourceDSMBean, JResourceMBean, JResource

public class JResourceDS
extends AbstractJResource
implements JResourceDSMBean

This class extends the JResource class for the Datasource implementation.

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
JResourceDS()
          Constructor.
 
Method Summary
 JUser findUser(String username)
          Check if a user is found and return it
 String getAlgorithm()
          Get the default algorithm
 ArrayList getArrayListCombinedRoles(JUser user)
          Get all the roles (from the roles and from the groups) of the given user
 String getDsName()
          Get the name of the resource to use
 Reference getReference()
          Retrieves the Reference of the object.
 String getRoleTable()
          Get the name of table which have the username/role
 String getRoleTableRolenameCol()
          Get the name of the column of the role of the role table
 String getRoleTableUsernameCol()
          Get the name of the column of the username of the role table
 String getUserTable()
          Get the name of the table which have the username/password
 String getUserTablePasswordCol()
          Get the name of column of the password of the user table
 String getUserTableUsernameCol()
          Get the name of the column of the username of the user table
 boolean isValidUser(JUser user, String credentials)
          Check if the given credential is the right credential for the given user
 void removeMBeans()
          Remove all the Mbeans used by this resource
 void setAlgorithm(String algorithm)
          Set the default algorithm to use
 void setDsName(String dsName)
          Set the name of the resource to use
 void setRoleTable(String roleTable)
          Set the name of table which have the username/role
 void setRoleTableRolenameCol(String roleTableRolenameCol)
          Set the name of the column of the role of the role table
 void setRoleTableUsernameCol(String roleTableUsernameCol)
          Set the name of the column of the username of the role table
 String setUserPrincipalsQuery()
          Gets the user defined query for retrieving principals
 void setUserPrincipalsQuery(String userPrincipalsQuery)
          Set the user defined query for retrieving principals
 String setUserRolesQuery()
          Gets the user defined query for retrieving roles
 void setUserRolesQuery(String userRolesQuery)
          Set the user defined query for retrieving roles
 void setUserTable(String userTable)
          Set the name of the table which have the username/password
 void setUserTablePasswordCol(String userTablePasswordCol)
          Set the name of column of the password of the user table
 void setUserTableUsernameCol(String userTableUsernameCol)
          Set the name of the column of the username of the user table
 String toString()
          The string representation of this realm is the XML
 String toXML()
          String representation of the MemoryRealm
 
Methods inherited from class org.ow2.jonas.security.internal.realm.factory.AbstractJResource
addNotificationListener, clearCache, getLogger, getName, getSequenceNumber, getUsers, registerGroupMBean, registerRoleMBean, registerUserMBean, saveConfig, setDomainName, setJmxService, setLogger, setName, setSecurityService, setUsers, unregisterGroupMBean, unregisterRoleMBean, unregisterUserMBean
 
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, wait, wait, wait
 
Methods inherited from interface org.ow2.jonas.security.internal.realm.factory.JResourceDSMBean
clearCache
 
Methods inherited from interface org.ow2.jonas.security.internal.realm.factory.JResourceMBean
getName, saveConfig
 

Constructor Detail

JResourceDS

public JResourceDS()
            throws Exception
Constructor. Use the super constructor

Throws:
Exception - if super constructor fail
Method Detail

setDsName

public void setDsName(String dsName)
Set the name of the resource to use

Specified by:
setDsName in interface JResourceDSMBean
Parameters:
dsName - name of the resource

setUserTable

public void setUserTable(String userTable)
Set the name of the table which have the username/password

Specified by:
setUserTable in interface JResourceDSMBean
Parameters:
userTable - name of the table which have the username/password

setUserTableUsernameCol

public void setUserTableUsernameCol(String userTableUsernameCol)
Set the name of the column of the username of the user table

Specified by:
setUserTableUsernameCol in interface JResourceDSMBean
Parameters:
userTableUsernameCol - name of the column of the username of the user table

setUserTablePasswordCol

public void setUserTablePasswordCol(String userTablePasswordCol)
Set the name of column of the password of the user table

Specified by:
setUserTablePasswordCol in interface JResourceDSMBean
Parameters:
userTablePasswordCol - name of column of the password of the user table

setRoleTable

public void setRoleTable(String roleTable)
Set the name of table which have the username/role

Specified by:
setRoleTable in interface JResourceDSMBean
Parameters:
roleTable - name of table which have the username/role

setRoleTableUsernameCol

public void setRoleTableUsernameCol(String roleTableUsernameCol)
Set the name of the column of the username of the role table

Specified by:
setRoleTableUsernameCol in interface JResourceDSMBean
Parameters:
roleTableUsernameCol - name of the column of the username of the role table

setRoleTableRolenameCol

public void setRoleTableRolenameCol(String roleTableRolenameCol)
Set the name of the column of the role of the role table

Specified by:
setRoleTableRolenameCol in interface JResourceDSMBean
Parameters:
roleTableRolenameCol - name of the column of the role of the role table

setAlgorithm

public void setAlgorithm(String algorithm)
Set the default algorithm to use

Specified by:
setAlgorithm in interface JResourceDSMBean
Parameters:
algorithm - algorithm to be used

setUserPrincipalsQuery

public void setUserPrincipalsQuery(String userPrincipalsQuery)
Set the user defined query for retrieving principals

Parameters:
userPrincipalsQuery - the user defined query for retrieving principals

setUserRolesQuery

public void setUserRolesQuery(String userRolesQuery)
Set the user defined query for retrieving roles

Parameters:
userRolesQuery - the user defined query for retrieving roles

getDsName

public String getDsName()
Get the name of the resource to use

Specified by:
getDsName in interface JResourceDSMBean
Returns:
name of the resource

getUserTable

public String getUserTable()
Get the name of the table which have the username/password

Specified by:
getUserTable in interface JResourceDSMBean
Returns:
name of the table which have the username/password

getUserTableUsernameCol

public String getUserTableUsernameCol()
Get the name of the column of the username of the user table

Specified by:
getUserTableUsernameCol in interface JResourceDSMBean
Returns:
name of the column of the username of the user table

getUserTablePasswordCol

public String getUserTablePasswordCol()
Get the name of column of the password of the user table

Specified by:
getUserTablePasswordCol in interface JResourceDSMBean
Returns:
name of column of the password of the user table

getRoleTable

public String getRoleTable()
Get the name of table which have the username/role

Specified by:
getRoleTable in interface JResourceDSMBean
Returns:
name of table which have the username/role

getRoleTableUsernameCol

public String getRoleTableUsernameCol()
Get the name of the column of the username of the role table

Specified by:
getRoleTableUsernameCol in interface JResourceDSMBean
Returns:
name of the column of the username of the role table

getRoleTableRolenameCol

public String getRoleTableRolenameCol()
Get the name of the column of the role of the role table

Specified by:
getRoleTableRolenameCol in interface JResourceDSMBean
Returns:
name of the column of the role of the role table

getAlgorithm

public String getAlgorithm()
Get the default algorithm

Specified by:
getAlgorithm in interface JResourceDSMBean
Returns:
the default algorithm

setUserPrincipalsQuery

public String setUserPrincipalsQuery()
Gets the user defined query for retrieving principals

Returns:
the user defined query for retrieving principals

setUserRolesQuery

public String setUserRolesQuery()
Gets the user defined query for retrieving roles

Returns:
the user defined query for retrieving roles

findUser

public JUser findUser(String username)
               throws JResourceException
Check if a user is found and return it

Specified by:
findUser in interface JResource
Parameters:
username - the wanted user name
Returns:
the user found or null
Throws:
JResourceException - if there is a SQLException

isValidUser

public boolean isValidUser(JUser user,
                           String credentials)
Check if the given credential is the right credential for the given user

Specified by:
isValidUser in interface JResource
Parameters:
user - user to check its credentials
credentials - the given credentials
Returns:
true if the credential is valid for this user

getArrayListCombinedRoles

public ArrayList getArrayListCombinedRoles(JUser user)
                                    throws JResourceException
Get all the roles (from the roles and from the groups) of the given user

Specified by:
getArrayListCombinedRoles in interface JResource
Parameters:
user - the given user
Returns:
the array list of all the roles for a given user
Throws:
JResourceException - if it fails

toXML

public String toXML()
String representation of the MemoryRealm

Returns:
the xml representation of the MemoryRealm

toString

public String toString()
The string representation of this realm is the XML

Overrides:
toString in class Object
Returns:
XML representation

getReference

public Reference getReference()
                       throws NamingException
Retrieves the Reference of the object. The Reference contains the factory used to create this object and the optional parameters used to configure the factory.

Specified by:
getReference in interface Referenceable
Specified by:
getReference in interface JResource
Returns:
the non-null Reference of the object.
Throws:
NamingException - if a naming exception was encountered while retrieving the reference.

removeMBeans

public void removeMBeans()
                  throws JResourceException
Remove all the Mbeans used by this resource

Specified by:
removeMBeans in interface JResource
Throws:
JResourceException - if the MBeans can not be removed


Copyright © 2010 OW2 Consortium. All Rights Reserved.