Source Code Cross Referenced for AbstractAccreditableManager.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » lenya » ac » impl » 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 » Content Management System » apache lenya 2.0 » org.apache.lenya.ac.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:
019:        /* $Id: AbstractAccreditableManager.java 499783 2007-01-25 13:33:38Z andreas $  */
020:
021:        package org.apache.lenya.ac.impl;
022:
023:        import java.util.ArrayList;
024:        import java.util.Iterator;
025:        import java.util.List;
026:
027:        import org.apache.avalon.framework.container.ContainerUtil;
028:        import org.apache.avalon.framework.logger.AbstractLogEnabled;
029:        import org.apache.avalon.framework.logger.Logger;
030:        import org.apache.lenya.ac.AccessControlException;
031:        import org.apache.lenya.ac.AccreditableManager;
032:        import org.apache.lenya.ac.GroupManager;
033:        import org.apache.lenya.ac.IPRangeManager;
034:        import org.apache.lenya.ac.Item;
035:        import org.apache.lenya.ac.ItemManagerListener;
036:        import org.apache.lenya.ac.RoleManager;
037:        import org.apache.lenya.ac.UserManager;
038:
039:        /**
040:         * Abstract base class for accreditable managers.
041:         */
042:        public abstract class AbstractAccreditableManager extends
043:                AbstractLogEnabled implements  AccreditableManager,
044:                ItemManagerListener {
045:
046:            /**
047:             * @param logger The logger.
048:             */
049:            public AbstractAccreditableManager(Logger logger) {
050:                ContainerUtil.enableLogging(this , logger);
051:            }
052:
053:            private UserManager userManager = null;
054:            private GroupManager groupManager = null;
055:            private IPRangeManager ipRangeManager = null;
056:            private RoleManager roleManager = null;
057:
058:            private List itemManagerListeners = new ArrayList();
059:
060:            /**
061:             * Attaches an item manager listener to this accreditable manager.
062:             * @param listener An item manager listener.
063:             */
064:            public void addItemManagerListener(ItemManagerListener listener) {
065:                if (!this .itemManagerListeners.contains(listener)) {
066:
067:                    if (getLogger().isDebugEnabled()) {
068:                        getLogger()
069:                                .debug("Adding listener: [" + listener + "]");
070:                    }
071:
072:                    this .itemManagerListeners.add(listener);
073:                }
074:            }
075:
076:            /**
077:             * Removes an item manager listener from this accreditable manager.
078:             * @param listener An item manager listener.
079:             */
080:            public void removeItemManagerListener(ItemManagerListener listener) {
081:                if (getLogger().isDebugEnabled()) {
082:                    getLogger().debug("Removing listener: [" + listener + "]");
083:                }
084:
085:                this .itemManagerListeners.remove(listener);
086:            }
087:
088:            /**
089:             * Notifies the listeners that an item was added.
090:             * @param item The item that was added.
091:             * @throws AccessControlException when a notified listener threw this exception.
092:             */
093:            protected void notifyAdded(Item item) throws AccessControlException {
094:                List clone = new ArrayList(this .itemManagerListeners);
095:                for (Iterator i = clone.iterator(); i.hasNext();) {
096:                    ItemManagerListener listener = (ItemManagerListener) i
097:                            .next();
098:                    listener.itemAdded(item);
099:                }
100:            }
101:
102:            /**
103:             * Notifies the listeners that an item was removed.
104:             * @param item The item that was removed.
105:             * @throws AccessControlException when a notified listener threw this exception.
106:             */
107:            protected void notifyRemoved(Item item)
108:                    throws AccessControlException {
109:                List clone = new ArrayList(this .itemManagerListeners);
110:                for (Iterator i = clone.iterator(); i.hasNext();) {
111:                    ItemManagerListener listener = (ItemManagerListener) i
112:                            .next();
113:                    listener.itemRemoved(item);
114:                }
115:            }
116:
117:            /**
118:             * @see org.apache.lenya.ac.ItemManagerListener#itemAdded(org.apache.lenya.ac.Item)
119:             */
120:            public void itemAdded(Item item) throws AccessControlException {
121:                if (getLogger().isDebugEnabled()) {
122:                    getLogger().debug(
123:                            "Item was added: [" + item
124:                                    + "] - notifying listeners");
125:                }
126:                notifyAdded(item);
127:            }
128:
129:            /**
130:             * @see org.apache.lenya.ac.ItemManagerListener#itemRemoved(org.apache.lenya.ac.Item)
131:             */
132:            public void itemRemoved(Item item) throws AccessControlException {
133:                if (getLogger().isDebugEnabled()) {
134:                    getLogger().debug(
135:                            "Item was removed: [" + item
136:                                    + "] - notifying listeners");
137:                }
138:                notifyRemoved(item);
139:            }
140:
141:            /**
142:             * @see org.apache.lenya.ac.AccreditableManager#getUserManager()
143:             */
144:            public UserManager getUserManager() throws AccessControlException {
145:                if (this .userManager == null) {
146:                    this .userManager = initializeUserManager();
147:                    this .userManager.addItemManagerListener(this );
148:                }
149:                return this .userManager;
150:            }
151:
152:            /**
153:             * @see org.apache.lenya.ac.AccreditableManager#getGroupManager()
154:             */
155:            public GroupManager getGroupManager() throws AccessControlException {
156:                if (this .groupManager == null) {
157:                    this .groupManager = initializeGroupManager();
158:                    this .groupManager.addItemManagerListener(this );
159:                }
160:                return this .groupManager;
161:            }
162:
163:            /**
164:             * @see org.apache.lenya.ac.AccreditableManager#getRoleManager()
165:             */
166:            public RoleManager getRoleManager() throws AccessControlException {
167:                if (this .roleManager == null) {
168:                    this .roleManager = initializeRoleManager();
169:                    this .roleManager.addItemManagerListener(this );
170:                }
171:                return this .roleManager;
172:            }
173:
174:            /**
175:             * @see org.apache.lenya.ac.AccreditableManager#getIPRangeManager()
176:             */
177:            public IPRangeManager getIPRangeManager()
178:                    throws AccessControlException {
179:                if (this .ipRangeManager == null) {
180:                    this .ipRangeManager = initializeIPRangeManager();
181:                    this .ipRangeManager.addItemManagerListener(this );
182:                }
183:                return this .ipRangeManager;
184:            }
185:
186:            /**
187:             * Initializes the group manager.
188:             * 
189:             * @return A group manager.
190:             * @throws AccessControlException when something went wrong.
191:             */
192:            protected abstract GroupManager initializeGroupManager()
193:                    throws AccessControlException;
194:
195:            /**
196:             * Initializes the IP range manager.
197:             * 
198:             * @return An IP range manager.
199:             * @throws AccessControlException when something went wrong.
200:             */
201:            protected abstract IPRangeManager initializeIPRangeManager()
202:                    throws AccessControlException;
203:
204:            /**
205:             * Initializes the role manager.
206:             * 
207:             * @return A role manager.
208:             * @throws AccessControlException when something went wrong.
209:             */
210:            protected abstract RoleManager initializeRoleManager()
211:                    throws AccessControlException;
212:
213:            /**
214:             * Initializes the user manager.
215:             * 
216:             * @return A user manager.
217:             * @throws AccessControlException when something went wrong.
218:             */
219:            protected abstract UserManager initializeUserManager()
220:                    throws AccessControlException;
221:
222:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.