Source Code Cross Referenced for TagModuleManager.java in  » Portal » Open-Portal » com » sun » portal » providers » userinfo » tag » 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.providers.userinfo.tag 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.providers.userinfo.tag;
007:
008:        import java.util.Map;
009:        import java.util.Hashtable;
010:        import java.util.HashMap;
011:        import java.util.Iterator;
012:        import java.util.logging.Logger;
013:        import java.util.logging.Level;
014:
015:        import javax.servlet.http.HttpServletRequest;
016:
017:        import com.sun.portal.providers.context.ProviderContext;
018:        import com.sun.portal.providers.context.ProviderContextException;
019:        import com.sun.portal.log.common.PortalLogger;
020:
021:        /**
022:         * this class manages tag modules for a particular provider
023:         */
024:
025:        public class TagModuleManager {
026:            private ProviderContext context = null;
027:            private Map modules = null;
028:            private Map tags = null;
029:            private String channel = null;
030:            private static Logger logger = PortalLogger
031:                    .getLogger(TagModuleManager.class);
032:
033:            public TagModuleManager(String channel, ProviderContext context,
034:                    HttpServletRequest req) throws TagException {
035:                init(channel, context, req);
036:            }
037:
038:            private void init(String channel, ProviderContext context,
039:                    HttpServletRequest req) throws TagException {
040:                this .channel = channel;
041:                if (context == null) {
042:                    throw new TagException(
043:                            "TagModuleManager.init(): provider context was null");
044:                }
045:                // set provider context
046:                this .context = context;
047:
048:                tags = null;
049:                modules = new HashMap();
050:                Map moduleClassnames = null;
051:
052:                try {
053:                    tags = context.getCollectionProperty(channel, "tags");
054:                    moduleClassnames = context.getCollectionProperty(channel,
055:                            "tagModules");
056:                } catch (ProviderContextException pce) {
057:                    throw new TagException(
058:                            "TagModuleManager.init(): Failed to get properties");
059:                }
060:
061:                for (Iterator i = moduleClassnames.keySet().iterator(); i
062:                        .hasNext();) {
063:                    String module = (String) i.next();
064:                    String moduleClass = (String) moduleClassnames.get(module);
065:
066:                    logger.log(Level.FINEST, "PSCR_CSPPUIT0003", new Object[] {
067:                            module, moduleClass });
068:
069:                    //
070:                    // cast to the common parent. we don't know if it's read or write
071:                    //
072:                    try {
073:                        TagModule tm = (TagModule) (Class.forName(moduleClass)
074:                                .newInstance());
075:
076:                        try {
077:                            tm.init(channel, context, req);
078:                        } catch (TagException ta) {
079:                            logger.log(Level.INFO, "PSCR_CSPPUIT0004", ta);
080:                            continue;
081:                        }
082:                        modules.put(module, tm);
083:                        logger.log(Level.FINER, "PSCR_CSPPUIT0005");
084:                    } catch (ClassNotFoundException cnfe) {
085:                        logger.log(Level.INFO, "PSCR_CSPPUIT0004", cnfe);
086:                        continue;
087:                    } catch (IllegalAccessException iae) {
088:                        logger.log(Level.INFO, "PSCR_CSPPUIT0004", iae);
089:                        continue;
090:                    } catch (InstantiationException ie) {
091:                        logger.log(Level.INFO, "PSCR_CSPPUIT0004", ie);
092:                        continue;
093:                    }
094:                }
095:
096:            }
097:
098:            public WriteTag getWriteTag(String tag) throws TagException {
099:                String module = (String) tags.get(tag);
100:                WriteTag wt = null;
101:
102:                try {
103:                    wt = (WriteTag) modules.get(module);
104:                } catch (ClassCastException cce) {
105:                    throw new TagCastException("error casting to write tag",
106:                            cce);
107:                }
108:
109:                if (wt == null) {
110:                    throw new UndefinedTagException("undefined tag=" + tag);
111:                }
112:
113:                return wt;
114:            }
115:
116:            public ReadTag getReadTag(String tag) throws TagException {
117:                String module = (String) tags.get(tag);
118:                ReadTag rt = null;
119:
120:                try {
121:                    rt = (ReadTag) modules.get(module);
122:                } catch (ClassCastException cce) {
123:                    throw new TagCastException("error casting to read tag", cce);
124:                }
125:
126:                if (rt == null) {
127:                    throw new UndefinedTagException(
128:                            "no module defined for tag=" + tag);
129:                }
130:
131:                return rt;
132:            }
133:
134:            public Hashtable getTable() {
135:                Hashtable table = new Hashtable();
136:                Map escapeTags = null;
137:                try {
138:                    //escapeTags collection part of UserInfoProvider version 2 and up
139:                    if (context.getProviderVersion(channel) >= 2) {
140:                        escapeTags = context.getCollectionProperty(channel,
141:                                "escapeTags");
142:                    }
143:                } catch (ProviderContextException pce) {
144:                    // Cannot read escapeTags collection. Not a fatal error. Proceed.
145:                    logger.log(Level.FINE, "PSCR_CSPPUIT0006", pce);
146:                }
147:                for (Iterator i = tags.keySet().iterator(); i.hasNext();) {
148:                    String tag = (String) i.next();
149:
150:                    ReadTag rt = null;
151:                    try {
152:                        rt = getReadTag(tag);
153:                    } catch (TagCastException tce) {
154:                        //
155:                        // this is not an error. it just means one of the defined tags
156:                        // is write-only, and therefore just not be stuck in the
157:                        // tag table for reading
158:                        //
159:                        logger.log(Level.FINE, "PSCR_CSPPUIT0007", tag);
160:                        continue;
161:                    } catch (TagException te) {
162:                        //
163:                        // don't die on this. we just failed for one tag
164:                        //
165:                        logger.log(Level.FINE, "PSCR_CSPPUIT0008", te);
166:                        continue;
167:                    }
168:
169:                    if (rt == null) {
170:                        logger.log(Level.FINE, "PSCR_CSPPUIT0009", tag);
171:                        continue;
172:                    }
173:                    TagModuleElement tme = null;
174:                    //
175:                    // Get the escape boolean value for the tag from escapeTags collection.
176:                    // 
177:                    if ((escapeTags == null) || (!escapeTags.containsKey(tag))) {
178:                        // 
179:                        // The tag was not found in the escapeTags collection. Dont escape this tag.
180:                        // 
181:                        tme = new TagModuleElement(rt, tag, false, context);
182:                    } else {
183:                        tme = new TagModuleElement(rt, tag,
184:                                ((Boolean) escapeTags.get(tag)).booleanValue(),
185:                                context);
186:                    }
187:
188:                    //
189:                    // to lazy evaluation of tags
190:                    //
191:                    table.put(tag, tme);
192:                }
193:
194:                return table;
195:            }
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.