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:
Serializable, 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(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
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 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

Parameters:
dsName - name of the resource

setUserTable

public void setUserTable(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(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(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(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(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(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(String algorithm)
Set the default algorithm to use

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

Returns:
name of the resource

getUserTable

public 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 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 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 String getRoleTable()
Get the name of table which have the username/role

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

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

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

getAlgorithm

public String getAlgorithm()
Get the default algorithm

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

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

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

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.

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

Throws:
JResourceException - if the MBeans can not be removed


Copyright © 2013 OW2 Consortium. All Rights Reserved.