Java Doc for GroupManager.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » auth » authorize » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Wiki Engine » JSPWiki » com.ecyrd.jspwiki.auth.authorize 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ecyrd.jspwiki.auth.authorize.GroupManager

GroupManager
final public class GroupManager implements Authorizer,WikiEventListener(Code)

Facade class for storing, retrieving and managing wiki groups on behalf of AuthorizationManager, JSPs and other presentation-layer classes. GroupManager works in collaboration with a back-end GroupDatabase , which persists groups to permanent storage.

Note: prior to JSPWiki 2.4.19, GroupManager was an interface; it is now a concrete, final class. The aspects of GroupManager which previously extracted group information from storage (e.g., wiki pages) have been refactored into the GroupDatabase interface.


author:
   Andrew Jaquith
since:
   2.4.19


Field Summary
final public static  StringMESSAGES_KEY
     Key used for adding UI messages to a user's WikiSession.
final static  Loggerlog
    
protected  WikiEnginem_engine
    
protected  WikiEventListenerm_groupListener
    


Method Summary
public  voidactionPerformed(WikiEvent event)
     Listens for com.ecyrd.jspwiki.event.WikiSecurityEvent.PROFILE_NAME_CHANGED events.
final public synchronized  voidaddWikiEventListener(WikiEventListener listener)
     Registers a WikiEventListener with this instance.
final protected  voidcheckGroupName(WikiSession session, String name)
     Checks if a String is blank or a restricted Group name, and if it is, appends an error to the WikiSession's message list.
final protected  String[]extractMembers(String memberLine)
     Extracts carriage-return separated members into a Set of String objects.
public  PrincipalfindRole(String name)
    

Returns a GroupPrincipal matching a given name.

final protected  voidfireEvent(int type, Object target)
     Fires a WikiSecurityEvent of the provided type, Principal and target Object to all registered listeners.
final public  GroupgetGroup(String name)
     Returns the Group matching a given name.
final public  GroupDatabasegetGroupDatabase()
     Returns the current external GroupDatabase in use.
final public  Principal[]getRoles()
     Returns an array of GroupPrincipals this GroupManager knows about.
final public  voidinitialize(WikiEngine engine, Properties props)
     Initializes the group cache by initializing the group database and obtaining a list of all of the groups it stores.
final public  booleanisUserInRole(WikiSession session, Principal role)
    

Determines whether the Subject associated with a WikiSession is in a particular role.

final public  GroupparseGroup(String name, String memberLine, boolean create)
    

Extracts group name and members from passed parameters and populates an existing Group with them.

final public  GroupparseGroup(WikiContext context, boolean create)
    

Extracts group name and members from the HTTP request and populates an existing Group with them.

final public  voidremoveGroup(String index)
     Removes a named Group from the group database.
final public synchronized  voidremoveWikiEventListener(WikiEventListener listener)
     Un-registers a WikiEventListener with this instance.
final public  voidsetGroup(WikiSession session, Group group)
    

Saves the Group created by a user in a wiki session.

final public  voidvalidateGroup(WikiContext context, Group group)
     Validates a Group, and appends any errors to the session errors list.

Field Detail
MESSAGES_KEY
final public static String MESSAGES_KEY(Code)
Key used for adding UI messages to a user's WikiSession.



log
final static Logger log(Code)



m_engine
protected WikiEngine m_engine(Code)



m_groupListener
protected WikiEventListener m_groupListener(Code)





Method Detail
actionPerformed
public void actionPerformed(WikiEvent event)(Code)
Listens for com.ecyrd.jspwiki.event.WikiSecurityEvent.PROFILE_NAME_CHANGED events. If a user profile's name changes, each group is inspected. If an entry contains a name that has changed, it is replaced with the new one. No group events are emitted as a consequence of this method, because the group memberships are still the same; it is only the representations of the names within that are changing.
Parameters:
  event - the incoming event



addWikiEventListener
final public synchronized void addWikiEventListener(WikiEventListener listener)(Code)
Registers a WikiEventListener with this instance. This is a convenience method.
Parameters:
  listener - the event listener



checkGroupName
final protected void checkGroupName(WikiSession session, String name) throws WikiSecurityException(Code)
Checks if a String is blank or a restricted Group name, and if it is, appends an error to the WikiSession's message list.
Parameters:
  session - the wiki session
Parameters:
  name - the Group name to test
throws:
  WikiSecurityException - if session isnull or the Group name is illegal
See Also:   Group.RESTRICTED_GROUPNAMES



extractMembers
final protected String[] extractMembers(String memberLine)(Code)
Extracts carriage-return separated members into a Set of String objects.
Parameters:
  memberLine - the list of members the list of members



findRole
public Principal findRole(String name)(Code)

Returns a GroupPrincipal matching a given name. If a group cannot be found, return null.


Parameters:
  name - Name of the group. This is case-sensitive. A DefaultGroup instance.



fireEvent
final protected void fireEvent(int type, Object target)(Code)
Fires a WikiSecurityEvent of the provided type, Principal and target Object to all registered listeners.
See Also:   com.ecyrd.jspwiki.event.WikiSecurityEvent
Parameters:
  type - the event type to be fired
Parameters:
  target - the changed Object, which may be null



getGroup
final public Group getGroup(String name) throws NoSuchPrincipalException(Code)
Returns the Group matching a given name. If the group cannot be found, this method throws a NoSuchPrincipalException.
Parameters:
  name - the name of the group to find the group
throws:
  NoSuchPrincipalException - if the group cannot be found



getGroupDatabase
final public GroupDatabase getGroupDatabase() throws WikiSecurityException(Code)
Returns the current external GroupDatabase in use. This method is guaranteed to return a properly-initialized GroupDatabase, unless it could not be initialized. In that case, this method throws a com.ecyrd.jspwiki.WikiException . The GroupDatabase is lazily initialized.
throws:
  com.ecyrd.jspwiki.auth.WikiSecurityException - if the GroupDatabase couldnot be initialized the current GroupDatabase
since:
   2.3



getRoles
final public Principal[] getRoles()(Code)
Returns an array of GroupPrincipals this GroupManager knows about. This method will return an array of GroupPrincipal objects corresponding to the wiki groups managed by this class. This method actually returns a defensive copy of an internally stored hashmap. an array of Principals representing the roles



initialize
final public void initialize(WikiEngine engine, Properties props) throws WikiSecurityException(Code)
Initializes the group cache by initializing the group database and obtaining a list of all of the groups it stores.
Parameters:
  engine - the wiki engine
Parameters:
  props - the properties used to initialize the wiki engine
See Also:   GroupDatabase.initialize(com.ecyrd.jspwiki.WikiEnginejava.util.Properties)
See Also:   GroupDatabase.groups
throws:
  WikiSecurityException - if GroupManager cannot be initialized



isUserInRole
final public boolean isUserInRole(WikiSession session, Principal role)(Code)

Determines whether the Subject associated with a WikiSession is in a particular role. This method takes two parameters: the WikiSession containing the subject and the desired role ( which may be a Role or a Group). If either parameter is null, or if the user is not authenticated, this method returns false.

With respect to this implementation, the supplied Principal must be a GroupPrincipal. The Subject posesses the "role" if it the session is authenticated and a Subject's principal is a member of the corresponding Group. This method simply finds the Group in question, then delegates to Group.isMember(Principal) for each of the principals in the Subject's principal set.


Parameters:
  session - the current WikiSession
Parameters:
  role - the role to check true if the user is considered to be in the role,false otherwise



parseGroup
final public Group parseGroup(String name, String memberLine, boolean create) throws WikiSecurityException(Code)

Extracts group name and members from passed parameters and populates an existing Group with them. The Group will either be a copy of an existing Group (if one can be found), or a new, unregistered Group (if not). Optionally, this method can throw a WikiSecurityException if the Group does not yet exist in the GroupManager cache.

The group parameter in the HTTP request contains the Group name to look up and populate. The members parameter contains the member list. If these differ from those in the existing group, the passed values override the old values.

This method does not commit the new Group to the GroupManager cache. To do that, use GroupManager.setGroup(WikiSession,Group) .


Parameters:
  name - the name of the group to construct
Parameters:
  memberLine - the line of text containing the group membership list
Parameters:
  create - whether this method should create a new, empty Group if onewith the requested name is not found. If false,groups that do not exist will cause aNoSuchPrincipalException to be thrown a new, populated group
See Also:   com.ecyrd.jspwiki.auth.authorize.Group.RESTRICTED_GROUPNAMES
throws:
  WikiSecurityException - if the group name isn't allowed, or ifcreate is falseand the Group named name does not exist



parseGroup
final public Group parseGroup(WikiContext context, boolean create) throws WikiSecurityException(Code)

Extracts group name and members from the HTTP request and populates an existing Group with them. The Group will either be a copy of an existing Group (if one can be found), or a new, unregistered Group (if not). Optionally, this method can throw a WikiSecurityException if the Group does not yet exist in the GroupManager cache.

The group parameter in the HTTP request contains the Group name to look up and populate. The members parameter contains the member list. If these differ from those in the existing group, the passed values override the old values.

This method does not commit the new Group to the GroupManager cache. To do that, use GroupManager.setGroup(WikiSession,Group) .


Parameters:
  context - the current wiki context
Parameters:
  create - whether this method should create a new, empty Group if onewith the requested name is not found. If false,groups that do not exist will cause aNoSuchPrincipalException to be thrown a new, populated group
throws:
  WikiSecurityException - if the group name isn't allowed, or ifcreate is falseand the Group does not exist



removeGroup
final public void removeGroup(String index) throws WikiSecurityException(Code)
Removes a named Group from the group database. If not found, throws a NoSuchPrincipalException. After removal, this method will commit the delete to the back-end group database. It will also fire a com.ecyrd.jspwiki.event.WikiSecurityEvent.GROUP_REMOVE event with the GroupManager instance as the source and the Group as target. If index is null, this method throws an IllegalArgumentException .
Parameters:
  index - the group to remove
throws:
  WikiSecurityException - if the Group cannot be removed bythe back-end
See Also:   com.ecyrd.jspwiki.auth.authorize.GroupDatabase.delete(Group)



removeWikiEventListener
final public synchronized void removeWikiEventListener(WikiEventListener listener)(Code)
Un-registers a WikiEventListener with this instance. This is a convenience method.
Parameters:
  listener - the event listener



setGroup
final public void setGroup(WikiSession session, Group group) throws WikiSecurityException(Code)

Saves the Group created by a user in a wiki session. This method registers the Group with the GroupManager and saves it to the back-end database. If an existing Group with the same name already exists, the new group will overwrite it. After saving the Group, the group database changes are committed.

This method fires the following events:

In addition, if the save or commit actions fail, this method will attempt to restore the older version of the wiki group if it exists. This will result in a GROUP_REMOVE event (for the new version of the Group) followed by a GROUP_ADD event (to indicate restoration of the old version).

This method will register the new Group with the GroupManager. For example, com.ecyrd.jspwiki.auth.AuthenticationManager attaches each WikiSession as a GroupManager listener. Thus, the act of registering a Group with setGroup means that all WikiSessions will automatically receive group add/change/delete events immediately.


Parameters:
  session - the wiki session, which may not be null
Parameters:
  group - the Group, which may not be null
throws:
  WikiSecurityException - if the Group cannot be saved by the back-end



validateGroup
final public void validateGroup(WikiContext context, Group group)(Code)
Validates a Group, and appends any errors to the session errors list. Any validation errors are added to the wiki session's messages collection (see WikiSession.getMessages .
Parameters:
  context - the current wiki context
Parameters:
  group - the supplied Group



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.