|
deegree 2.2 (2008/12/22 11:33 build-3038-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deegree.security.drm.SQLRegistry
public final class SQLRegistry
This is an implementation of a Registry
using an SQL-Database (via JDBC) as
backend.
Constructor Summary | |
---|---|
SQLRegistry()
|
Method Summary | |
---|---|
void |
abortTransaction(SecurityTransaction transaction)
Signals the SQLRegistry that the current transaction shall be aborted. |
void |
beginTransaction(SecurityTransaction transaction)
Signals the SQLRegistry that a new transaction begins. |
void |
clean(SecurityTransaction transaction)
Deletes all data from the Registry and sets the default
objects (SEC_ADMIN user, role and group) and standard rights and
privileges. |
void |
commitTransaction(SecurityTransaction transaction)
Signals the SQLRegistry that the current transaction ends, i.e. the changes
made by the transaction are made persistent. |
void |
deregisterGroup(SecurityTransaction transaction,
Group group)
Removes an existing Group from the Registry (including its
relations). |
void |
deregisterPrivilege(SecurityTransaction transaction,
Privilege privilege)
Removes an existing Privilege from the Registry (including its
relations). |
void |
deregisterRightType(SecurityTransaction transaction,
RightType type)
Removes an existing RightType from the Registry (including its
relations). |
void |
deregisterRole(SecurityTransaction transaction,
Role role)
Removes an existing Role from the Registry (including its
relations). |
void |
deregisterSecuredObject(SecurityTransaction transaction,
SecuredObject object)
Removes an existing SecuredObject from the Registry (including
its associations). |
void |
deregisterUser(SecurityTransaction transaction,
User user)
Removes an existing User |
Group[] |
getAllGroups(SecurityAccess securityAccess)
Retrieves all Group s from the Registry . |
Role[] |
getAllRoles(SecurityAccess securityAccess)
Retrieves all Role s from the Registry , except those that are
only used internally (these have namespaces that begin with $). |
SecuredObject[] |
getAllSecuredObjects(SecurityAccess securityAccess,
String type)
Retrieves all SecuredObject s with the given type from the
Registry . |
User[] |
getAllUsers(SecurityAccess securityAccess)
Retrieves all User s from the Registry . |
Group |
getGroupById(SecurityAccess securityAccess,
int id)
Retrieves a Group from the Registry . |
Group |
getGroupByName(SecurityAccess securityAccess,
String name)
Retrieves a Group from the Registry . |
Group[] |
getGroupsForGroup(SecurityAccess securityAccess,
Group group)
Retrieves all Group s from the Registry that the given
Group is a DIRECT member (i.e. not via inheritance) of. |
Group[] |
getGroupsForUser(SecurityAccess securityAccess,
User user)
Retrieves all Group s from the Registry that the given
User is a DIRECT (i.e. not via inheritance) member of. |
Group[] |
getGroupsInGroup(SecurityAccess securityAccess,
Group group)
Retrieves all Groups s from the Registry that are members of
another Group DIRECTLY (i.e. not via inheritance). |
Group[] |
getGroupsWithRole(SecurityAccess securityAccess,
Role role)
Retrieves all Group s from the Registry that are associated
with a given Role DIRECTLY (i.e. not via inheritance). |
Privilege |
getPrivilegeByName(SecurityAccess securityAccess,
String name)
Retrieves a Privilege from the Registry . |
Privilege[] |
getPrivilegesForRole(SecurityAccess securityAccess,
Role role)
Retrieves all Privileges s from the Registry that are
associated DIRECTLY (i.e. not via group memberships) with a given Role . |
Right[] |
getRights(SecurityAccess securityAccess,
SecurableObject object,
Role role)
Retrieves the Rights from the Registry that are associated with
a given Role and a SecurableObject . |
RightType |
getRightTypeByName(SecurityAccess securityAccess,
String name)
Retrieves a Right from the Registry . |
Role |
getRoleById(SecurityAccess securityAccess,
int id)
Retrieves a Role from the Registry . |
Role |
getRoleByName(SecurityAccess securityAccess,
String name)
Retrieves a Role from the Registry . |
Role[] |
getRolesByNS(SecurityAccess securityAccess,
String ns)
Retrieves all Roles s from the Registry that have a certain
namespace. |
Role[] |
getRolesForGroup(SecurityAccess securityAccess,
Group group)
Retrieves all Role s from the Registry that are associated with
a given Group DIRECTLY (i.e. not via inheritance). |
Role[] |
getRolesForUser(SecurityAccess securityAccess,
User user)
Retrieves all Role s from the Registry that are associated with
a given User DIRECTLY (i.e. not via group memberships). |
SecuredObject |
getSecuredObjectById(SecurityAccess securityAccess,
int id)
Retrieves a SecuredObject from the Registry . |
SecuredObject |
getSecuredObjectByName(SecurityAccess securityAccess,
String name,
String type)
Retrieves a SecuredObject from the Registry . |
SecuredObject[] |
getSecuredObjectsByNS(SecurityAccess securityAccess,
String ns,
String type)
Retrieves all SecuredObject s from the Registry that have a
certain namespace. |
User |
getUserById(SecurityAccess securityAccess,
int id)
Retrieves a User from the Registry . |
User |
getUserByName(SecurityAccess securityAccess,
String name)
Retrieves a User from the Registry . |
User[] |
getUsersInGroup(SecurityAccess securityAccess,
Group group)
Retrieves all User s from the Registry that belong to the given
Group DIRECTLY (i.e. not via inheritance). |
User[] |
getUsersWithRole(SecurityAccess securityAccess,
Role role)
Retrieves all Users s from the Registry that are associated
DIRECTLY (i.e. not via group memberships) with a given Role . |
void |
initialize(Properties properties)
Initializes the SQLRegistry -instance according to the contents of the
submitted Properties . |
Group |
registerGroup(SecurityTransaction transaction,
String name,
String title)
Adds a new group account to the Registry . |
Privilege |
registerPrivilege(SecurityTransaction transaction,
String name)
Adds a new Privilege to the Registry . |
RightType |
registerRightType(SecurityTransaction transaction,
String name)
Adds a new Right to the Registry . |
Role |
registerRole(SecurityTransaction transaction,
String name)
Adds a new role to the Registry . |
SecuredObject |
registerSecuredObject(SecurityTransaction transaction,
String type,
String name,
String title)
Adds a new SecuredObject to the Registry . |
User |
registerUser(SecurityTransaction transaction,
String name,
String password,
String lastName,
String firstName,
String emailAddress)
Adds a new user account to the Registry . |
void |
setGroupsForGroup(SecurityTransaction transaction,
Group group,
Group[] groups)
Sets the Group s that a given Group is member of DIRECTLY (i.e. |
void |
setGroupsForUser(SecurityTransaction transaction,
User user,
Group[] groups)
Sets the Group s that a given User is member of DIRECTLY (i.e. |
void |
setGroupsInGroup(SecurityTransaction transaction,
Group group,
Group[] groups)
Sets the Groups s that are members of a given Group DIRECTLY
(i.e. not via inheritance). |
void |
setGroupsWithRole(SecurityTransaction transaction,
Role role,
Group[] groups)
Sets the Group s that a given Role is associated to DIRECTLY
(i.e. not via inheritance). |
void |
setPrivilegesForRole(SecurityTransaction transaction,
Role role,
Privilege[] privileges)
Sets all Privilege s that are associated with a given Role . |
void |
setRights(SecurityTransaction transaction,
SecurableObject[] objects,
Role role,
Right right)
Sets one Right to be associated with a given Role and all given
SecurableObjects . |
void |
setRights(SecurityTransaction transaction,
SecurableObject object,
Role role,
Right[] rights)
Sets the Rights to be associated with a given Role and
SecurableObject . |
void |
setRolesForGroup(SecurityTransaction transaction,
Group group,
Role[] roles)
Sets the Role s that a given Group is associated to directly
(i.e. not via inheritance). |
void |
setRolesForUser(SecurityTransaction transaction,
User user,
Role[] roles)
Sets the Role s that a given User is directly associated to
(i.e. not via Group membership). |
void |
setUsersInGroup(SecurityTransaction transaction,
Group group,
User[] users)
Sets the User s that are members of a given Group DIRECTLY
(i.e. not via inheritance). |
void |
setUsersWithRole(SecurityTransaction transaction,
Role role,
User[] users)
Sets the User s that a given Role is associated to DIRECTLY
(i.e. not via Group membership). |
void |
updateUser(SecurityTransaction transaction,
User user)
Updates the metadata (name, email, etc.) of a User in the
Registry . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQLRegistry()
Method Detail |
---|
public void clean(SecurityTransaction transaction) throws GeneralSecurityException
SecurityRegistry
Registry
and sets the default
objects (SEC_ADMIN user, role and group) and standard rights and
privileges.
clean
in interface SecurityRegistry
GeneralSecurityException
public User registerUser(SecurityTransaction transaction, String name, String password, String lastName, String firstName, String emailAddress) throws GeneralSecurityException
Registry
.
registerUser
in interface SecurityRegistry
transaction
- name
-
GeneralSecurityException
- this is a DuplicateException
if the group already existedpublic void deregisterUser(SecurityTransaction transaction, User user) throws GeneralSecurityException
User from the Registry
(including its relations).
- Specified by:
deregisterUser
in interface SecurityRegistry
- Parameters:
transaction
- user
-
- Throws:
GeneralSecurityException
public void updateUser(SecurityTransaction transaction, User user) throws GeneralSecurityException
User
in the
Registry
.
updateUser
in interface SecurityRegistry
GeneralSecurityException
- this is a DuplicateException
if a user with the new name already
existedpublic User getUserByName(SecurityAccess securityAccess, String name) throws GeneralSecurityException
User
from the Registry
.
getUserByName
in interface SecurityRegistry
securityAccess
- name
-
GeneralSecurityException
- this is an UnknownException
if the user is not known to the
Registry
public User getUserById(SecurityAccess securityAccess, int id) throws GeneralSecurityException
User
from the Registry
.
getUserById
in interface SecurityRegistry
securityAccess
- id
-
GeneralSecurityException
- this is an UnknownException
if the user is not known to the
Registry
public User[] getAllUsers(SecurityAccess securityAccess) throws GeneralSecurityException
User
s from the Registry
.
getAllUsers
in interface SecurityRegistry
securityAccess
-
GeneralSecurityException
public User[] getUsersWithRole(SecurityAccess securityAccess, Role role) throws GeneralSecurityException
Users
s from the Registry
that are associated
DIRECTLY (i.e. not via group memberships) with a given Role
.
getUsersWithRole
in interface SecurityRegistry
securityAccess
- role
-
GeneralSecurityException
public User[] getUsersInGroup(SecurityAccess securityAccess, Group group) throws GeneralSecurityException
User
s from the Registry
that belong to the given
Group
DIRECTLY (i.e. not via inheritance).
getUsersInGroup
in interface SecurityRegistry
securityAccess
- group
-
GeneralSecurityException
public Group registerGroup(SecurityTransaction transaction, String name, String title) throws GeneralSecurityException
Registry
.
registerGroup
in interface SecurityRegistry
transaction
- name
-
GeneralSecurityException
- this is a DuplicateException
if the group already existedpublic void deregisterGroup(SecurityTransaction transaction, Group group) throws GeneralSecurityException
Group
from the Registry
(including its
relations).
deregisterGroup
in interface SecurityRegistry
transaction
- group
-
GeneralSecurityException
public Group getGroupByName(SecurityAccess securityAccess, String name) throws GeneralSecurityException
Group
from the Registry
.
getGroupByName
in interface SecurityRegistry
securityAccess
- name
-
GeneralSecurityException
- this is an UnknownException
if the group is not known to the
Registry
public Group getGroupById(SecurityAccess securityAccess, int id) throws GeneralSecurityException
Group
from the Registry
.
getGroupById
in interface SecurityRegistry
securityAccess
- id
-
GeneralSecurityException
- this is an UnknownException
if the group is not known to the
Registry
public Group[] getAllGroups(SecurityAccess securityAccess) throws GeneralSecurityException
Group
s from the Registry
.
getAllGroups
in interface SecurityRegistry
securityAccess
-
GeneralSecurityException
public Role registerRole(SecurityTransaction transaction, String name) throws GeneralSecurityException
Registry
.
registerRole
in interface SecurityRegistry
transaction
- name
-
GeneralSecurityException
- this is a DuplicateException
if the role already existedpublic void deregisterRole(SecurityTransaction transaction, Role role) throws GeneralSecurityException
Role
from the Registry
(including its
relations).
deregisterRole
in interface SecurityRegistry
transaction
- role
-
GeneralSecurityException
public Role getRoleByName(SecurityAccess securityAccess, String name) throws GeneralSecurityException
Role
from the Registry
.
getRoleByName
in interface SecurityRegistry
securityAccess
- name
-
GeneralSecurityException
- this is an UnknownException
if the role is not known to the
Registry
public Role[] getRolesByNS(SecurityAccess securityAccess, String ns) throws GeneralSecurityException
Roles
s from the Registry
that have a certain
namespace.
getRolesByNS
in interface SecurityRegistry
securityAccess
- ns
- null for default namespace
GeneralSecurityException
public Role getRoleById(SecurityAccess securityAccess, int id) throws GeneralSecurityException
Role
from the Registry
.
getRoleById
in interface SecurityRegistry
securityAccess
- id
-
GeneralSecurityException
- this is an UnknownException
if the role is not known to the
Registry
public Role[] getAllRoles(SecurityAccess securityAccess) throws GeneralSecurityException
Role
s from the Registry
, except those that are
only used internally (these have namespaces that begin with $).
getAllRoles
in interface SecurityRegistry
securityAccess
-
GeneralSecurityException
public SecuredObject registerSecuredObject(SecurityTransaction transaction, String type, String name, String title) throws GeneralSecurityException
SecuredObject
to the Registry
.
registerSecuredObject
in interface SecurityRegistry
transaction
- type
- name
- title
-
GeneralSecurityException
- this is a DuplicateException
if the object already existedpublic void deregisterSecuredObject(SecurityTransaction transaction, SecuredObject object) throws GeneralSecurityException
SecuredObject
from the Registry
(including
its associations).
deregisterSecuredObject
in interface SecurityRegistry
transaction
- object
-
GeneralSecurityException
public SecuredObject getSecuredObjectByName(SecurityAccess securityAccess, String name, String type) throws GeneralSecurityException
SecuredObject
from the Registry
.
getSecuredObjectByName
in interface SecurityRegistry
securityAccess
- name
-
GeneralSecurityException
- this is an UnknownException
if the object is not known to the
Registry
public SecuredObject getSecuredObjectById(SecurityAccess securityAccess, int id) throws GeneralSecurityException
SecuredObject
from the Registry
.
getSecuredObjectById
in interface SecurityRegistry
securityAccess
- id
-
GeneralSecurityException
- this is an UnknownException
if the object is not known to the
Registry
public SecuredObject[] getSecuredObjectsByNS(SecurityAccess securityAccess, String ns, String type) throws GeneralSecurityException
SecuredObject
s from the Registry
that have a
certain namespace.
getSecuredObjectsByNS
in interface SecurityRegistry
securityAccess
- ns
- null for default namespacetype
-
GeneralSecurityException
public SecuredObject[] getAllSecuredObjects(SecurityAccess securityAccess, String type) throws GeneralSecurityException
SecuredObject
s with the given type from the
Registry
.
getAllSecuredObjects
in interface SecurityRegistry
securityAccess
- type
-
GeneralSecurityException
public Privilege registerPrivilege(SecurityTransaction transaction, String name) throws GeneralSecurityException
Privilege
to the Registry
.
registerPrivilege
in interface SecurityRegistry
transaction
- name
-
GeneralSecurityException
- this is a DuplicateException
if the Privilege
already existedpublic void deregisterPrivilege(SecurityTransaction transaction, Privilege privilege) throws GeneralSecurityException
Registry
(including its
relations).
deregisterPrivilege
in interface SecurityRegistry
transaction
- privilege
-
GeneralSecurityException
public Privilege getPrivilegeByName(SecurityAccess securityAccess, String name) throws GeneralSecurityException
Privilege
from the Registry
.
getPrivilegeByName
in interface SecurityRegistry
securityAccess
- name
-
GeneralSecurityException
- this is an UnknownException
if the privilege is not known to the
Registry
public Privilege[] getPrivilegesForRole(SecurityAccess securityAccess, Role role) throws GeneralSecurityException
Privileges
s from the Registry
that are
associated DIRECTLY (i.e. not via group memberships) with a given Role
.
getPrivilegesForRole
in interface SecurityRegistry
securityAccess
- role
-
GeneralSecurityException
public void setPrivilegesForRole(SecurityTransaction transaction, Role role, Privilege[] privileges) throws GeneralSecurityException
Privilege
s that are associated with a given Role
.
setPrivilegesForRole
in interface SecurityRegistry
transaction
- role
- privileges
-
GeneralSecurityException
public RightType registerRightType(SecurityTransaction transaction, String name) throws GeneralSecurityException
Right
to the Registry
.
registerRightType
in interface SecurityRegistry
transaction
- name
-
GeneralSecurityException
- this is a DuplicateException
if the Right
already
existedpublic void deregisterRightType(SecurityTransaction transaction, RightType type) throws GeneralSecurityException
RightType
from the Registry
(including its
relations).
deregisterRightType
in interface SecurityRegistry
transaction
- type
-
GeneralSecurityException
public RightType getRightTypeByName(SecurityAccess securityAccess, String name) throws GeneralSecurityException
Right
from the Registry
.
getRightTypeByName
in interface SecurityRegistry
securityAccess
- name
-
GeneralSecurityException
- this is an UnknownException
if the Right
is not
known to the Registry
public Right[] getRights(SecurityAccess securityAccess, SecurableObject object, Role role) throws GeneralSecurityException
Rights
from the Registry
that are associated with
a given Role
and a SecurableObject
.
getRights
in interface SecurityRegistry
securityAccess
- object
- role
-
GeneralSecurityException
public void setRights(SecurityTransaction transaction, SecurableObject object, Role role, Right[] rights) throws GeneralSecurityException
Rights
to be associated with a given Role
and
SecurableObject
.
setRights
in interface SecurityRegistry
transaction
- object
- role
- rights
-
GeneralSecurityException
public void setRights(SecurityTransaction transaction, SecurableObject[] objects, Role role, Right right) throws GeneralSecurityException
Right
to be associated with a given Role
and all given
SecurableObjects
.
setRights
in interface SecurityRegistry
transaction
- objects
- role
- right
-
GeneralSecurityException
public Group[] getGroupsForUser(SecurityAccess securityAccess, User user) throws GeneralSecurityException
Group
s from the Registry
that the given
User
is a DIRECT (i.e. not via inheritance) member of.
getGroupsForUser
in interface SecurityRegistry
securityAccess
- user
-
GeneralSecurityException
public Group[] getGroupsInGroup(SecurityAccess securityAccess, Group group) throws GeneralSecurityException
Groups
s from the Registry
that are members of
another Group
DIRECTLY (i.e. not via inheritance).
getGroupsInGroup
in interface SecurityRegistry
securityAccess
- group
-
GeneralSecurityException
public Group[] getGroupsForGroup(SecurityAccess securityAccess, Group group) throws GeneralSecurityException
Group
s from the Registry
that the given
Group
is a DIRECT member (i.e. not via inheritance) of.
getGroupsForGroup
in interface SecurityRegistry
securityAccess
- group
-
GeneralSecurityException
public Group[] getGroupsWithRole(SecurityAccess securityAccess, Role role) throws GeneralSecurityException
Group
s from the Registry
that are associated
with a given Role
DIRECTLY (i.e. not via inheritance).
getGroupsWithRole
in interface SecurityRegistry
securityAccess
- role
-
GeneralSecurityException
public Role[] getRolesForUser(SecurityAccess securityAccess, User user) throws GeneralSecurityException
Role
s from the Registry
that are associated with
a given User
DIRECTLY (i.e. not via group memberships).
getRolesForUser
in interface SecurityRegistry
securityAccess
- user
-
GeneralSecurityException
public Role[] getRolesForGroup(SecurityAccess securityAccess, Group group) throws GeneralSecurityException
Role
s from the Registry
that are associated with
a given Group
DIRECTLY (i.e. not via inheritance).
getRolesForGroup
in interface SecurityRegistry
securityAccess
- group
-
GeneralSecurityException
public void setGroupsForUser(SecurityTransaction transaction, User user, Group[] groups) throws GeneralSecurityException
Group
s that a given User
is member of DIRECTLY (i.e.
not via inheritance).
setGroupsForUser
in interface SecurityRegistry
transaction
- user
- groups
-
GeneralSecurityException
public void setGroupsForGroup(SecurityTransaction transaction, Group group, Group[] groups) throws GeneralSecurityException
Group
s that a given Group
is member of DIRECTLY (i.e.
not via inheritance).
setGroupsForGroup
in interface SecurityRegistry
transaction
- group
- groups
-
GeneralSecurityException
public void setGroupsWithRole(SecurityTransaction transaction, Role role, Group[] groups) throws GeneralSecurityException
Group
s that a given Role
is associated to DIRECTLY
(i.e. not via inheritance).
setGroupsWithRole
in interface SecurityRegistry
transaction
- role
- groups
-
GeneralSecurityException
public void setUsersWithRole(SecurityTransaction transaction, Role role, User[] users) throws GeneralSecurityException
User
s that a given Role
is associated to DIRECTLY
(i.e. not via Group
membership).
setUsersWithRole
in interface SecurityRegistry
transaction
- role
- users
-
GeneralSecurityException
public void setUsersInGroup(SecurityTransaction transaction, Group group, User[] users) throws GeneralSecurityException
User
s that are members of a given Group
DIRECTLY
(i.e. not via inheritance).
setUsersInGroup
in interface SecurityRegistry
transaction
- group
- users
-
GeneralSecurityException
public void setGroupsInGroup(SecurityTransaction transaction, Group group, Group[] groups) throws GeneralSecurityException
Groups
s that are members of a given Group
DIRECTLY
(i.e. not via inheritance).
setGroupsInGroup
in interface SecurityRegistry
transaction
- group
- groups
-
GeneralSecurityException
public void setRolesForUser(SecurityTransaction transaction, User user, Role[] roles) throws GeneralSecurityException
Role
s that a given User
is directly associated to
(i.e. not via Group
membership).
setRolesForUser
in interface SecurityRegistry
transaction
- user
- roles
-
GeneralSecurityException
public void setRolesForGroup(SecurityTransaction transaction, Group group, Role[] roles) throws GeneralSecurityException
Role
s that a given Group
is associated to directly
(i.e. not via inheritance).
setRolesForGroup
in interface SecurityRegistry
transaction
- group
- roles
-
GeneralSecurityException
public void initialize(Properties properties) throws GeneralSecurityException
SQLRegistry
-instance according to the contents of the
submitted Properties
.
initialize
in interface SecurityRegistry
properties
-
GeneralSecurityException
public void beginTransaction(SecurityTransaction transaction) throws GeneralSecurityException
SQLRegistry
that a new transaction begins.
Only one transaction can be active at a time.
beginTransaction
in interface SecurityRegistry
transaction
-
GeneralSecurityException
public void commitTransaction(SecurityTransaction transaction) throws GeneralSecurityException
SQLRegistry
that the current transaction ends, i.e. the changes
made by the transaction are made persistent.
commitTransaction
in interface SecurityRegistry
transaction
-
GeneralSecurityException
public void abortTransaction(SecurityTransaction transaction) throws GeneralSecurityException
SQLRegistry
that the current transaction shall be aborted. Changes
made during the transaction are undone.
abortTransaction
in interface SecurityRegistry
transaction
-
GeneralSecurityException
|
deegree 2.2 (2008/12/22 11:33 build-3038-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://deegree.sourceforge.net