com.ibm.dse.applsrv.aa
Class SecurityService

java.lang.Object
  |
  +--com.ibm.dse.applsrv.aa.SecurityObject
        |
        +--com.ibm.dse.applsrv.aa.SecurityService

public class SecurityService
extends SecurityObject
implements java.io.Serializable

This class represents a security service.

See Also:
Serialized Form

Fields inherited from class com.ibm.dse.applsrv.aa.SecurityObject
fs
 
Constructor Summary
protected SecurityService(java.lang.String nameOfService)
          Create a new instance of a Service with the specified name.
 
Method Summary
protected  void _save()
          A hack to force inheritence of a static method.
 void addRight(java.lang.String right)
          Add a right to this service.
 void addRights(java.lang.String[] namesOfRights)
          Add rights to this service.
 boolean allow(SecurityUser user)
          Check user accessibility of this service.
 boolean allow(java.lang.String userName)
          Check user accessibility of this service.
static void controller(SecurityController ctrl)
          Set the security controller.
 boolean delete()
          Delete this service.
protected static boolean delete(java.lang.String service)
          Delete the named service.
 boolean deleteRight(java.lang.String right)
          Delete a right from this service.
 void deleteRights(java.lang.String[] namesOfRights)
          Delete the rights from this service.
protected static boolean disablePersist()
          Disable persistence for services.
protected static java.util.Enumeration enumerationOverServices()
          Return an enumeration over the services.
protected static void forceSave()
          Force a save of the current state of the services to the database.
protected static SecurityService get(java.lang.String nameOfService, boolean create)
          Return the service with the specified name.
 Dictionary getAttributes()
          Return a dictionary containing all of the attributes of this service.
protected static SecurityPersistence getDB()
          Return the persistence controller for this class.
protected static java.lang.String getPathName()
          Return the pathname of this database of services.
protected static boolean getPersist()
          Return the persistence state for services.
 Array getRights()
          Return a copy of the rights associated with this service.
 java.lang.String[] getRightsAsArray()
          Return a copy of the rights associated with this service.
 java.lang.String[] getRightsAsArrayOrNull()
          Return a copy of the rights associated with this service.
protected static java.lang.String[] getServiceIds()
          Return the list of names of the services.
 boolean hasRight(java.lang.String right)
          Return true if this service has the specified right.
 boolean isReferencingRight(java.lang.String right)
          Return true if the specified right is being referenced.
protected static void load()
          Load the current state of the services from the database.
protected static Dictionary loadr()
          Load and return the current state of the services from the database.
protected static int numberOfServices()
          Return the number of services that are currently defined.
protected static void reset()
          Reset the services.
 void resetAttributes()
          Reset all attributes of this service with the exception of the service's name.
 void resetRights()
          Reset the rights for this service.
protected static void save()
          Save the current state of the services to the database.
protected static Dictionary services()
          Return a copy of the dictionary of services.
protected static void setDB(SecurityPersistence securityPersistence)
          Set the persistence controller for this class.
protected static void setFileName(java.lang.String fileName)
          Set the filename of this database.
protected static void setPersist(boolean persistence)
          Enable or disable persistence for services.
 void setRights(Array rights)
          Set the rights for this service.
 void setRights(Array rights, boolean save)
          Set the rights for this service.
 void setRights(java.lang.String[] rights)
          Set the rights for this service.
protected static void shutdown()
          Shutdown the security component.
 java.lang.String toString()
          Returns a string representation of this object.
 void verify()
          Verify this service.
protected static void verifyAll()
          Verify the consistancy of this database.
 
Methods inherited from class com.ibm.dse.applsrv.aa.SecurityObject
getData, getData, getDataOrNull, getName, home, prefix, putData, putData, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecurityService

protected SecurityService(java.lang.String nameOfService)
                   throws DSESecurityException
Create a new instance of a Service with the specified name.
Parameters:
nameOfService - String - the name of this service.
Throws:
DSESecurityException - - error in the request.
Method Detail

_save

protected void _save()
              throws DSESecurityException
A hack to force inheritence of a static method.
Overrides:
_save in class SecurityObject
Throws:
DSESecurityException - - abstract method.

addRight

public void addRight(java.lang.String right)
              throws DSESecurityException
Add a right to this service.
Parameters:
right - String - the name of the right.
Throws:
DSESecurityException - - error in the request.

addRights

public void addRights(java.lang.String[] namesOfRights)
               throws DSESecurityException
Add rights to this service.
Parameters:
namesOfRights - String[] - the names of the rights.
Throws:
DSESecurityException - - error in the request.

allow

public boolean allow(SecurityUser user)
Check user accessibility of this service.
Parameters:
user - SecurityUser - the user.
Returns:
boolean - true if user has all of the rights to access this service else false.

allow

public boolean allow(java.lang.String userName)
Check user accessibility of this service.
Parameters:
userName - String - the name of the user.
Returns:
boolean - true if user has all of the rights to access this service else false.

controller

public static void controller(SecurityController ctrl)
Set the security controller.
Parameters:
ctrl - SecurityController - the security controller.

delete

public boolean delete()
               throws DSESecurityException
Delete this service.
Returns:
boolean - true if the delete succeeded else false.
Throws:
DSESecurityException - - database error.

delete

protected static boolean delete(java.lang.String service)
                         throws DSESecurityException
Delete the named service.
Parameters:
service - String - the name of the service to delete.
Returns:
boolean - true if the delete succeeded else false.
Throws:
DSESecurityException - - database error.

deleteRight

public boolean deleteRight(java.lang.String right)
                    throws DSESecurityException
Delete a right from this service.
Parameters:
right - String - the name of the right.
Returns:
boolean - true if the delete succeeded else false.
Throws:
DSESecurityException - - database error.

deleteRights

public void deleteRights(java.lang.String[] namesOfRights)
                  throws DSESecurityException
Delete the rights from this service.
Parameters:
namesOfRights - String[] - the names of the rights.
Throws:
DSESecurityException - - error in the request.

disablePersist

protected static boolean disablePersist()
Disable persistence for services.
Returns:
boolean - true if services were persisting else false.

enumerationOverServices

protected static java.util.Enumeration enumerationOverServices()
Return an enumeration over the services.
Returns:
Enumeration - the enumeration over the services.

forceSave

protected static void forceSave()
                         throws DSESecurityException
Force a save of the current state of the services to the database.
Throws:
DSESecurityException - - database error.

get

protected static SecurityService get(java.lang.String nameOfService,
                                     boolean create)
                              throws DSESecurityException
Return the service with the specified name. If the service doesn't exist & the create option is false then return null else create & return a new service with the specified name.
Parameters:
nameOfService - String - the name of the service.
create - boolean - if the service does not exist then if true then create it else just return null.
Returns:
SecurityService - the service.
Throws:
DSESecurityException - - error in the request.

getAttributes

public Dictionary getAttributes()
                         throws DSESecurityException
Return a dictionary containing all of the attributes of this service.
Returns:
Dictionary - a dictionary containing all of the attributes of this service.
Throws:
DSESecurityException - - database error.

getDB

protected static SecurityPersistence getDB()
Return the persistence controller for this class.
Returns:
SecurityPersistence - the persistence controller.

getPathName

protected static java.lang.String getPathName()
Return the pathname of this database of services.
Returns:
String - the pathname of this database or null if its not configured.

getPersist

protected static boolean getPersist()
Return the persistence state for services.
Returns:
boolean - true if services are persisting else false.

getRights

public Array getRights()
Return a copy of the rights associated with this service.
Returns:
Array - a copy of the list of rights.

getRightsAsArray

public java.lang.String[] getRightsAsArray()
Return a copy of the rights associated with this service.
Returns:
String[] - a copy of the list of rights.

getRightsAsArrayOrNull

public java.lang.String[] getRightsAsArrayOrNull()
Return a copy of the rights associated with this service.
Returns:
String[] - a copy of the list of rights.

getServiceIds

protected static java.lang.String[] getServiceIds()
Return the list of names of the services.
Returns:
String[] - the list of names of the services.

hasRight

public boolean hasRight(java.lang.String right)
Return true if this service has the specified right. Do NOT check if the right is valid.
Parameters:
right - String - the name of the right.
Returns:
boolean - true if this service has the right else false.

isReferencingRight

public boolean isReferencingRight(java.lang.String right)
Return true if the specified right is being referenced. Do NOT check if the right is valid.
Parameters:
right - String - the name of the right.
Returns:
boolean - true if the right is being referenced else false.

load

protected static void load()
                    throws DSESecurityException
Load the current state of the services from the database.
Throws:
DSESecurityException - - database error.

loadr

protected static Dictionary loadr()
                           throws DSESecurityException
Load and return the current state of the services from the database.
Returns:
Dictionary - the database.
Throws:
DSESecurityException - - database error.

numberOfServices

protected static int numberOfServices()
Return the number of services that are currently defined.
Returns:
int - the number of services that are currently defined.

reset

protected static void reset()
                     throws DSESecurityException
Reset the services.
Throws:
DSESecurityException - - database error.

resetAttributes

public void resetAttributes()
                     throws DSESecurityException
Reset all attributes of this service with the exception of the service's name.
Throws:
DSESecurityException - - error during save.

resetRights

public void resetRights()
                 throws DSESecurityException
Reset the rights for this service.
Throws:
DSESecurityException - - database error.

save

protected static void save()
                    throws DSESecurityException
Save the current state of the services to the database.
Throws:
DSESecurityException - - database error.

services

protected static Dictionary services()
Return a copy of the dictionary of services.
Returns:
Dictionary - the copy of the services.

setDB

protected static void setDB(SecurityPersistence securityPersistence)
Set the persistence controller for this class.
Parameters:
securityPersistence - SecurityPersistence - the persistence controller.

setFileName

protected static void setFileName(java.lang.String fileName)
Set the filename of this database.
Parameters:
fileName - String - the name of this database.

setPersist

protected static void setPersist(boolean persistence)
Enable or disable persistence for services.
Parameters:
persistence - boolean - true to enable persistence, false to disable it.

setRights

public void setRights(java.lang.String[] rights)
               throws DSESecurityException
Set the rights for this service.
Parameters:
rights - String[] - the rights.
Throws:
DSESecurityException - - one of the rights does not exist.

setRights

public void setRights(Array rights)
               throws DSESecurityException
Set the rights for this service.
Parameters:
rights - Array - the rights.
Throws:
DSESecurityException - - one of the rights does not exist.

setRights

public void setRights(Array rights,
                      boolean save)
               throws DSESecurityException
Set the rights for this service.
Parameters:
rights - Array - the rights.
save - boolean - true if the change is to be saved else false.
Throws:
DSESecurityException - - database error.

shutdown

protected static void shutdown()
                        throws DSESecurityException
Shutdown the security component.
Throws:
DSESecurityException - - error in the request.

toString

public java.lang.String toString()
Returns a string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
String - a string representation of this object.

verify

public void verify()
            throws DSESecurityException
Verify this service.
Throws:
DSESecurityException - - error in the request.

verifyAll

protected static void verifyAll()
                         throws DSESecurityException
Verify the consistancy of this database.
Throws:
DSESecurityException - - error in the request.