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

java.lang.Object
  extended by org.ow2.jonas.lib.management.javaee.ManagedObject
      extended by org.ow2.jonas.security.internal.realm.factory.AbstractJResource
          extended by org.ow2.jonas.security.internal.realm.factory.JResourceDS
All Implemented Interfaces:
java.io.Serializable, javax.naming.Referenceable, JResource

public class JResourceDS
extends AbstractJResource

This class extends the JResource class for the Datasource implementation.

Author:
Florent Benoit
See Also:
Serialized Form

Constructor Summary
JResourceDS()
          Constructor.
 
Method Summary
 JUser findUser(java.lang.String username)
          Check if a user is found and return it
 java.lang.String getAlgorithm()
          Get the default algorithm
 java.util.ArrayList getArrayListCombinedRoles(JUser user)
          Get all the roles (from the roles and from the groups) of the given user
 java.lang.String getDsName()
          Get the name of the resource to use
 javax.naming.Reference getReference()
          Retrieves the Reference of the object.
 java.lang.String getRoleTable()
          Get the name of table which have the username/role
 java.lang.String getRoleTableRolenameCol()
          Get the name of the column of the role of the role table
 java.lang.String getRoleTableUsernameCol()
          Get the name of the column of the username of the role table
 java.lang.String getUserTable()
          Get the name of the table which have the username/password
 java.lang.String getUserTablePasswordCol()
          Get the name of column of the password of the user table
 java.lang.String getUserTableUsernameCol()
          Get the name of the column of the username of the user table
 boolean isValidUser(JUser user, java.lang.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(java.lang.String algorithm)
          Set the default algorithm to use
 void setDsName(java.lang.String dsName)
          Set the name of the resource to use
 void setRoleTable(java.lang.String roleTable)
          Set the name of table which have the username/role
 void setRoleTableRolenameCol(java.lang.String roleTableRolenameCol)
          Set the name of the column of the role of the role table
 void setRoleTableUsernameCol(java.lang.String roleTableUsernameCol)
          Set the name of the column of the username of the role table
 java.lang.String setUserPrincipalsQuery()
          Gets the user defined query for retrieving principals
 void setUserPrincipalsQuery(java.lang.String userPrincipalsQuery)
          Set the user defined query for retrieving principals
 java.lang.String setUserRolesQuery()
          Gets the user defined query for retrieving roles
 void setUserRolesQuery(java.lang.String userRolesQuery)
          Set the user defined query for retrieving roles
 void setUserTable(java.lang.String userTable)
          Set the name of the table which have the username/password
 void setUserTablePasswordCol(java.lang.String userTablePasswordCol)
          Set the name of column of the password of the user table
 void setUserTableUsernameCol(java.lang.String userTableUsernameCol)
          Set the name of the column of the username of the user table
 java.lang.String toString()
          The string representation of this realm is the XML
 java.lang.String toXML()
          String representation of the MemoryRealm
 
Methods inherited from class org.ow2.jonas.security.internal.realm.factory.AbstractJResource
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.management.javaee.ManagedObject
getModelMBean, sendNotification, sendReconfigNotification, sendSaveNotification, setModelMBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JResourceDS

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

Throws:
java.lang.Exception - if super constructor fail
Method Detail

setDsName

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

Parameters:
dsName - name of the resource

setUserTable

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

Parameters:
userTable - name of the table which have the username/password

setUserTableUsernameCol

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

Parameters:
userTableUsernameCol - name of the column of the username of the user table

setUserTablePasswordCol

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

Parameters:
userTablePasswordCol - name of column of the password of the user table

setRoleTable

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

Parameters:
roleTable - name of table which have the username/role

setRoleTableUsernameCol

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

Parameters:
roleTableUsernameCol - name of the column of the username of the role table

setRoleTableRolenameCol

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

Parameters:
roleTableRolenameCol - name of the column of the role of the role table

setAlgorithm

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

Parameters:
algorithm - algorithm to be used

setUserPrincipalsQuery

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

Parameters:
userPrincipalsQuery - the user defined query for retrieving principals

setUserRolesQuery

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

Parameters:
userRolesQuery - the user defined query for retrieving roles

getDsName

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

Returns:
name of the resource

getUserTable

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

Returns:
name of the table which have the username/password

getUserTableUsernameCol

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

Returns:
name of the column of the username of the user table

getUserTablePasswordCol

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

Returns:
name of column of the password of the user table

getRoleTable

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

Returns:
name of table which have the username/role

getRoleTableUsernameCol

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

Returns:
name of the column of the username of the role table

getRoleTableRolenameCol

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

Returns:
name of the column of the role of the role table

getAlgorithm

public java.lang.String getAlgorithm()
Get the default algorithm

Returns:
the default algorithm

setUserPrincipalsQuery

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

Returns:
the user defined query for retrieving principals

setUserRolesQuery

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

Returns:
the user defined query for retrieving roles

findUser

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

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,
                           java.lang.String credentials)
Check if the given credential is the right credential for the given user

Parameters:
user - user to check its credentials
credentials - the given credentials
Returns:
true if the credential is valid for this user

getArrayListCombinedRoles

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

Parameters:
user - the given user
Returns:
the array list of all the roles for a given user
Throws:
JResourceException - if it fails

toXML

public java.lang.String toXML()
String representation of the MemoryRealm

Returns:
the xml representation of the MemoryRealm

toString

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

Overrides:
toString in class java.lang.Object
Returns:
XML representation

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.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.

Returns:
the non-null Reference of the object.
Throws:
javax.naming.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

Throws:
JResourceException - if the MBeans can not be removed


Copyright © 2010 OW2 Consortium. All Rights Reserved.