|
uPortal 2.4.1 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.groups.filesystem.FileSystemGroupStore
This class is an IEntityGroupStore
that uses the native file
system for its back end. It also implements IEntityStore
and
a no-op IEntitySearcher
. You can substitute a functional entity
searcher by adding it to the group service element for this component in the
configuration document, compositeGroupServices.xml
.
A groups file system looks like this:
-- groups root
-- org.jasig.portal.ChannelDefinition
-- channel definition file
-- org.jasig.portal.security.IPerson
-- channel definition file
...
-- person directory
etc.
-- person file
-- person directory
-- person file
...
The groups root is a file system directory declared in the group service configuration document, where it is an attribute of the filesystem group service element. This directory has sub-directories, each named for the underlying entity type that groups in that sub-directory contain. If a service only contains groups of IPersons, the groups root would have 1 sub-directory named org.jasig.portal.security.IPerson.
A directory named for a type may contain both sub-directories and files. The sub-directories represent groups that can contain other groups. The files represent groups that can contain entity as well as group members. The files contain keys, one to a line, and look like this:
# this is a comment
# another comment
key1 Key One
key2
group:org$jasig$portal$security$IPerson/someDirectory/someFile
key3
# comment
Blank lines and lines that start with the COMMENT
String (here
#
) are ignored. The first token on a non-ignored line is
assumed to be a group member key. If the key starts with the
GROUP_PREFIX
(here :group
), it is treated as a
local group key. Otherwise, it is assumed to be an entity key. The rest of
the tokens on the line are ignored.
The file above contains 3 entity keys, key1
, key2
,
and key3
, and 1 group key,
org$jasig$portal$security$IPerson/someDirectory/someFile
. It
represents a group with 3 entity members and 1 group member. The local key
of a group is its file path starting at the type name, with the
FileSystemGroupStore.SUBSTITUTE_PERIOD
character substituted
for the real period character.
The store is not implemented as a singleton, so you can have multiple concurrent instances pointing to different groups root directories.
Field Summary |
Fields inherited from interface org.jasig.portal.groups.IGroupConstants |
CHANNEL_CATEGORIES, CONTAINS, ENDS_WITH, EVERYONE, IS, NODE_SEPARATOR, PORTAL_ADMINISTRATORS, STARTS_WITH |
Constructor Summary | |
FileSystemGroupStore()
FileSystemGroupStore constructor. |
Method Summary | |
boolean |
contains(IEntityGroup group,
IGroupMember member)
Answers if group contains member . |
boolean |
containsGroupNamed(IEntityGroup group,
java.lang.String name)
Answers if group contains a member group named
name . |
void |
delete(IEntityGroup group)
Delete this IEntityGroup from the data store. |
IEntityGroup |
find(java.lang.String key)
Returns an instance of the IEntityGroup from the data store. |
java.util.Iterator |
findContainingGroups(IGroupMember gm)
Returns an Iterator over the Collection of
IEntityGroups that the IGroupMember belongs to. |
java.util.Iterator |
findEntitiesForGroup(IEntityGroup group)
Returns an Iterator over the Collection of
IEntities that are members of this IEntityGroup . |
ILockableEntityGroup |
findLockable(java.lang.String key)
Returns an instance of the ILockableEntityGroup from the data store. |
java.lang.String[] |
findMemberGroupKeys(IEntityGroup group)
Returns a String[] containing the keys of IEntityGroups
that are members of this IEntityGroup . |
java.util.Iterator |
findMemberGroups(IEntityGroup group)
Returns an Iterator over the Collection of
IEntityGroups that are members of this IEntityGroup . |
java.util.Set |
getAllDirectoriesBelow(java.io.File dir)
Recursive search of directories underneath dir for files that match filter. |
java.io.File[] |
getAllFilesBelow(java.io.File dir)
Recursive search of directories underneath dir for files that match filter. |
java.lang.String |
getGroupsRootPath()
|
IEntityGroup |
newInstance(java.lang.Class entityType)
|
IEntity |
newInstance(java.lang.String key)
|
IEntity |
newInstance(java.lang.String key,
java.lang.Class type)
|
EntityIdentifier[] |
searchForEntities(java.lang.String query,
int method,
java.lang.Class type)
Find EntityIdentifiers for entities whose name matches the query string according to the specified method and is of the specified type |
EntityIdentifier[] |
searchForGroups(java.lang.String query,
int searchMethod,
java.lang.Class leafType)
Returns an EntityIdentifier[] of groups of the given leaf type whose names match the query string according to the search method. |
void |
update(IEntityGroup group)
Adds or updates the IEntityGroup AND ITS MEMBERSHIPS to the
data store, as appropriate. |
void |
updateMembers(IEntityGroup group)
Commits the group memberships of the IEntityGroup to
the data store. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileSystemGroupStore()
Method Detail |
public void delete(IEntityGroup group) throws GroupsException
IEntityGroup
from the data store. We assume that
groups will be deleted via the file system, not the group service.
delete
in interface IEntityGroupStore
group
- org.jasig.portal.groups.IEntityGroup
GroupsException
public IEntityGroup find(java.lang.String key) throws GroupsException
IEntityGroup
from the data store.
find
in interface IEntityGroupStore
key
- java.lang.String
GroupsException
public java.util.Iterator findContainingGroups(IGroupMember gm) throws GroupsException
Iterator
over the Collection
of
IEntityGroups
that the IGroupMember
belongs to.
findContainingGroups
in interface IEntityGroupStore
gm
- org.jasig.portal.groups.IEntityGroup
GroupsException
public java.util.Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException
Iterator
over the Collection
of
IEntities
that are members of this IEntityGroup
.
findEntitiesForGroup
in interface IEntityGroupStore
group
- org.jasig.portal.groups.IEntityGroup
GroupsException
public ILockableEntityGroup findLockable(java.lang.String key) throws GroupsException
ILockableEntityGroup
from the data store.
findLockable
in interface IEntityGroupStore
key
- java.lang.String
GroupsException
public java.lang.String[] findMemberGroupKeys(IEntityGroup group) throws GroupsException
String[]
containing the keys of IEntityGroups
that are members of this IEntityGroup
. In a composite group
system, a group may contain a member group from a different service. This is
called a foreign membership, and is only possible in an internally-managed
service. A group store in such a service can return the key of a foreign member
group, but not the group itself, which can only be returned by its local store.
findMemberGroupKeys
in interface IEntityGroupStore
group
- org.jasig.portal.groups.IEntityGroup
GroupsException
public java.util.Iterator findMemberGroups(IEntityGroup group) throws GroupsException
Iterator
over the Collection
of
IEntityGroups
that are members of this IEntityGroup
.
findMemberGroups
in interface IEntityGroupStore
group
- org.jasig.portal.groups.IEntityGroup
GroupsException
public java.util.Set getAllDirectoriesBelow(java.io.File dir)
public java.io.File[] getAllFilesBelow(java.io.File dir)
public java.lang.String getGroupsRootPath()
public IEntityGroup newInstance(java.lang.Class entityType) throws GroupsException
newInstance
in interface IEntityGroupStore
GroupsException
public IEntity newInstance(java.lang.String key) throws GroupsException
newInstance
in interface IEntityStore
key
- java.lang.String
GroupsException
public IEntity newInstance(java.lang.String key, java.lang.Class type) throws GroupsException
newInstance
in interface IEntityStore
key
- java.lang.String - the entity's keytype
- java.lang.Class - the entity's Type
GroupsException
public EntityIdentifier[] searchForEntities(java.lang.String query, int method, java.lang.Class type) throws GroupsException
searchForEntities
in interface IEntitySearcher
GroupsException
public EntityIdentifier[] searchForGroups(java.lang.String query, int searchMethod, java.lang.Class leafType) throws GroupsException
searchForGroups
in interface IEntityGroupStore
query
- String the string used to match group names.searchMethod
- see org.jasig.portal.groups.IGroupConstants.leafType
- the leaf type of the groups we are searching for.
GroupsException
public void update(IEntityGroup group) throws GroupsException
IEntityGroup
AND ITS MEMBERSHIPS to the
data store, as appropriate. We assume that groups will be updated via the
file system, not the group service.
update
in interface IEntityGroupStore
group
- org.jasig.portal.groups.IEntityGroup
GroupsException
public void updateMembers(IEntityGroup group) throws GroupsException
IEntityGroup
to
the data store. We assume that groups will be updated via the
file system, not the group service.
updateMembers
in interface IEntityGroupStore
group
- org.jasig.portal.groups.IEntityGroup
GroupsException
public boolean contains(IEntityGroup group, IGroupMember member) throws GroupsException
group
contains member
.
contains
in interface IEntityGroupStore
group
- org.jasig.portal.groups.IEntityGroupmember
- org.jasig.portal.groups.IGroupMember
GroupsException
public boolean containsGroupNamed(IEntityGroup group, java.lang.String name) throws GroupsException
group
contains a member group named
name
.
group
- org.jasig.portal.groups.IEntityGroupname
- java.lang.String
GroupsException
|
uPortal 2.4.1 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |