Source Code Cross Referenced for CMCUserImpl.java in  » Portal » Open-Portal » com » sun » portal » community » mc » impl » manager » 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 » Portal » Open Portal » com.sun.portal.community.mc.impl.manager 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: CMCUserImpl.java,v 1.5 2007/01/26 03:47:54 portalbld Exp $
003:         * Copyright 2005 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.community.mc.impl.manager;
014:
015:        import java.util.Properties;
016:        import java.util.Map;
017:        import java.util.HashMap;
018:        import java.util.Set;
019:        import java.util.HashSet;
020:        import java.util.Iterator;
021:        import java.util.Collection;
022:        import com.sun.portal.community.mc.impl.Debug;
023:        import com.sun.portal.community.mc.impl.CMCProperties;
024:        import com.sun.portal.community.mc.impl.CMCUserManager;
025:        import com.sun.portal.community.mc.CMCUser;
026:        import com.sun.portal.community.mc.CMCException;
027:        import com.sun.portal.community.mc.CMCPrincipal;
028:        import com.sun.portal.community.mc.CMCRolePrincipal;
029:        import com.sun.portal.community.mc.ConfigTable;
030:
031:        import java.util.logging.Logger;
032:        import java.util.logging.Level;
033:
034:        import com.sun.portal.log.common.PortalLogger;
035:
036:        /**
037:         * Community MC community user manager implementation.
038:         *
039:         * This class delegates to one or all (depending on the operation)
040:         * of its contributors for the operations in the
041:         * <code>CommunityUser</code> interface.
042:         */
043:        public class CMCUserImpl extends CMCImpl implements  CMCUserManager {
044:            private static Logger logger = PortalLogger
045:                    .getLogger(CMCUserImpl.class);
046:
047:            private Map contributors = new HashMap();
048:            private String userId = null;
049:
050:            public void init(Properties p, String userId) throws CMCException {
051:                init(p, userId, CMCProperties.getContributorNames());
052:            }
053:
054:            public void init(Properties p, String userId, Iterator types)
055:                    throws CMCException {
056:                this .userId = userId;
057:                loadContributors(types);
058:            }
059:
060:            protected Class getClass(String type) {
061:                return CMCProperties.getUserClass(type);
062:            }
063:
064:            protected void initContributor(Object c) throws CMCException {
065:                CMCUser cu = (CMCUser) c;
066:                cu.init(CMCProperties.getProperties(), getUserId());
067:            }
068:
069:            public String getUserId() {
070:                return userId;
071:            }
072:
073:            public Set getMembership() throws CMCException {
074:                Set membership = new HashSet();
075:
076:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
077:                    String type = (String) i.next();
078:                    CMCUser user = (CMCUser) contributors.get(type);
079:                    try {
080:                        Set m = user.getMembership();
081:                        membership.addAll(m);
082:                    } catch (CMCException cmce) {
083:                        if (logger.isLoggable(Level.WARNING)) {
084:                            Object[] tokens = { type };
085:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0004",
086:                                    tokens);
087:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
088:                        }
089:                    }
090:                }
091:
092:                return membership;
093:            }
094:
095:            public Set getMembershipByName() throws CMCException {
096:                Set membership = new HashSet();
097:
098:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
099:                    String type = (String) i.next();
100:                    CMCUser user = (CMCUser) contributors.get(type);
101:                    try {
102:                        Set m = user.getMembershipByName();
103:                        membership.addAll(m);
104:                    } catch (CMCException cmce) {
105:                        if (logger.isLoggable(Level.WARNING)) {
106:                            Object[] tokens = { type };
107:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0004",
108:                                    tokens);
109:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
110:                        }
111:                    }
112:                }
113:
114:                return membership;
115:            }
116:
117:            public Set getMembershipByRole() throws CMCException {
118:                Set membership = new HashSet();
119:
120:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
121:                    String type = (String) i.next();
122:                    CMCUser user = (CMCUser) contributors.get(type);
123:                    try {
124:                        Set m = user.getMembershipByRole();
125:                        membership.addAll(m);
126:                    } catch (CMCException cmce) {
127:                        if (logger.isLoggable(Level.WARNING)) {
128:                            Object[] tokens = { type };
129:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0004",
130:                                    tokens);
131:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
132:                        }
133:                    }
134:                }
135:
136:                return membership;
137:            }
138:
139:            public Set getMembership(Set rps) throws CMCException {
140:                Set membership = new HashSet();
141:
142:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
143:                    String type = (String) i.next();
144:                    CMCUser user = (CMCUser) contributors.get(type);
145:                    try {
146:                        Set m = user.getMembership(rps);
147:                        membership.addAll(m);
148:                    } catch (CMCException cmce) {
149:                        if (logger.isLoggable(Level.WARNING)) {
150:                            Object[] tokens = { type };
151:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0004",
152:                                    tokens);
153:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
154:                        }
155:                    }
156:                }
157:
158:                return membership;
159:            }
160:
161:            public Set getMembershipByName(Set rps) throws CMCException {
162:                Set membership = new HashSet();
163:
164:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
165:                    String type = (String) i.next();
166:                    CMCUser user = (CMCUser) contributors.get(type);
167:                    try {
168:                        Set m = user.getMembershipByName(rps);
169:                        membership.addAll(m);
170:                    } catch (CMCException cmce) {
171:                        if (logger.isLoggable(Level.WARNING)) {
172:                            Object[] tokens = { type };
173:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0004",
174:                                    tokens);
175:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
176:                        }
177:                    }
178:                }
179:
180:                return membership;
181:            }
182:
183:            public Set getMembershipByRole(Set rps) throws CMCException {
184:                Set membership = new HashSet();
185:
186:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
187:                    String type = (String) i.next();
188:                    CMCUser user = (CMCUser) contributors.get(type);
189:                    try {
190:                        Set m = user.getMembershipByRole(rps);
191:                        membership.addAll(m);
192:                    } catch (CMCException cmce) {
193:                        if (logger.isLoggable(Level.WARNING)) {
194:                            Object[] tokens = { type };
195:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0004",
196:                                    tokens);
197:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
198:                        }
199:                    }
200:                }
201:
202:                return membership;
203:            }
204:
205:            public Set getAvailable() throws CMCException {
206:                Set available = new HashSet();
207:
208:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
209:                    String type = (String) i.next();
210:                    CMCUser user = (CMCUser) contributors.get(type);
211:                    try {
212:                        Set m = user.getAvailable();
213:                        available.addAll(m);
214:                    } catch (CMCException cmce) {
215:                        if (logger.isLoggable(Level.WARNING)) {
216:                            Object[] tokens = { type };
217:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0003",
218:                                    tokens);
219:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
220:                        }
221:                    }
222:                }
223:
224:                return available;
225:            }
226:
227:            private CMCUser getUserContributor(String type) throws CMCException {
228:                CMCUser cu = (CMCUser) contributors.get(type);
229:                if (cu == null) {
230:                    throw new CMCException("contributor not found for type: "
231:                            + type);
232:                }
233:
234:                return cu;
235:            }
236:
237:            public boolean hasRole(CMCPrincipal cp, CMCRolePrincipal rp)
238:                    throws CMCException {
239:                CMCUser contributor = getUserContributor(cp.getType());
240:                return contributor.hasRole(cp, rp);
241:            }
242:
243:            public long getRoleCreationTime(CMCPrincipal cp,
244:                    CMCRolePrincipal rolePrincipal) throws CMCException {
245:                CMCUser contributor = getUserContributor(cp.getType());
246:                return contributor.getRoleCreationTime(cp, rolePrincipal);
247:            }
248:
249:            public ConfigTable getDPDocuments(ConfigTable lastReadTimes)
250:                    throws CMCException {
251:                ConfigTable dps = new ConfigTable();
252:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
253:                    String type = (String) i.next();
254:                    CMCUser user = (CMCUser) contributors.get(type);
255:                    try {
256:                        dps.putAll(user.getDPDocuments(lastReadTimes));
257:                    } catch (CMCException cmce) {
258:                        if (logger.isLoggable(Level.WARNING)) {
259:                            Object[] tokens = { type };
260:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0002",
261:                                    tokens);
262:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
263:                        }
264:                    }
265:                }
266:
267:                return dps;
268:            }
269:
270:            public ConfigTable getDPDocuments(ConfigTable lastReadTimes,
271:                    Set membership) throws CMCException {
272:                ConfigTable dps = new ConfigTable();
273:                for (Iterator i = contributors.keySet().iterator(); i.hasNext();) {
274:                    String type = (String) i.next();
275:                    CMCUser user = (CMCUser) contributors.get(type);
276:                    try {
277:                        dps.putAll(user.getDPDocuments(lastReadTimes,
278:                                membership));
279:                    } catch (CMCException cmce) {
280:                        if (logger.isLoggable(Level.WARNING)) {
281:                            Object[] tokens = { type };
282:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0002",
283:                                    tokens);
284:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
285:                        }
286:                    }
287:                }
288:
289:                return dps;
290:            }
291:
292:            /**
293:             * Load and initialize all contributors.
294:             */
295:            private void loadContributors(Iterator types) throws CMCException {
296:                while (types.hasNext()) {
297:                    String type = (String) types.next();
298:                    try {
299:                        CMCUser cu = (CMCUser) createContributor(type);
300:                        contributors.put(type, cu);
301:                    } catch (CMCException cmce) {
302:                        if (logger.isLoggable(Level.WARNING)) {
303:                            Object[] tokens = { type };
304:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0001",
305:                                    tokens);
306:                            logger.log(Level.WARNING, "PSCMC_CSPCMM0000", cmce);
307:                        }
308:                    }
309:                }
310:            }
311:
312:            private Collection getContributors() {
313:                return contributors.values();
314:            }
315:        }
w_w_w__._j_a___va_2s_.__c_om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.