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


001:        /** 
002:         * Copyright 2002 Sun Microsystems, Inc. All 
003:         * rights reserved. Use of this product is subject 
004:         * to license terms. Federal Acquisitions: 
005:         * Commercial Software -- Government Users 
006:         * Subject to Standard License Terms and 
007:         * Conditions. 
008:         * 
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE 
010:         * are trademarks or registered trademarks of Sun Microsystems, 
011:         * Inc. in the United States and other countries. 
012:         *
013:         * @ Author Bhavanishankar
014:         */package com.sun.portal.netlet.admin;
015:
016:        // JDK classes
017:
018:        import java.util.MissingResourceException;
019:        import java.util.ResourceBundle;
020:
021:        import com.iplanet.am.console.base.model.AMModelBase;
022:        import com.iplanet.am.util.Debug;
023:        import com.iplanet.am.util.Locale;
024:        import com.iplanet.jato.ModelManager;
025:        import com.iplanet.jato.ModelTypeMap;
026:        import com.iplanet.jato.RequestContext;
027:        import com.iplanet.sso.SSOException;
028:        import com.iplanet.sso.SSOToken;
029:        import com.iplanet.sso.SSOTokenManager;
030:
031:        //import com.iplanet.am.console.base.model.AMAdminLog;
032:
033:        public class NetletAdminModelManager extends ModelManager {
034:
035:            public static final String SRAP_NETLET_MODEL_MGR_KEY = "srapNetletModelMgrKey";
036:
037:            private static final String TOKEN_DELIMITER = "|";
038:
039:            protected SSOToken token = null;
040:            protected String rbName = "srapnetletadminmsgs";
041:            protected ResourceBundle bundle = null;
042:            protected java.util.Locale locale = null;
043:            private static Debug debug = AMModelBase.debug;
044:            private static String CURR_NETLETRULES_ROW = "currentNetletRulesRow";
045:
046:            static {
047:                if (AMModelBase.debug == null) {
048:                    debug = AMModelBase.debug = com.iplanet.am.util.Debug
049:                            .getInstance("amConsole");
050:                }
051:
052:            }
053:
054:            public NetletAdminModelManager(RequestContext requestContext,
055:                    ModelTypeMap typeMap) {
056:                super (requestContext, typeMap);
057:                initSSOToken(requestContext);
058:                initRB();
059:            }
060:
061:            /**
062:             * Initializes the SSO token for use in this request. The SSO token
063:             * can then be used as a store for session info across requests.
064:             * @param requestContext is the JATO request context.
065:             */
066:            void initSSOToken(RequestContext requestContext) {
067:                try {
068:                    SSOTokenManager manager = SSOTokenManager.getInstance();
069:                    token = manager.createSSOToken(requestContext.getRequest());
070:                    manager.getInstance().validateToken(token);
071:                } catch (Exception e) {
072:                    token = null;
073:                }
074:            }
075:
076:            /**
077:             * Initializes the resuource bundle using the locale from the
078:             * SSO token.
079:             */
080:            void initRB() {
081:                if (token != null) {
082:                    try {
083:                        String lstr = token.getProperty("Locale");
084:                        locale = Locale.getLocale(lstr);
085:                    } catch (SSOException ssoe) {
086:                        locale = java.util.Locale.getDefault();
087:                    }
088:                } else {
089:                    locale = java.util.Locale.getDefault();
090:                }
091:                try {
092:                    bundle = ResourceBundle.getBundle(rbName, locale);
093:                } catch (MissingResourceException mre) {
094:                }
095:            }
096:
097:            public static boolean warningEnabled() {
098:                return debug.warningEnabled();
099:            }
100:
101:            public static boolean messageEnabled() {
102:                return debug.messageEnabled();
103:            }
104:
105:            public static void debugWarning(String message) {
106:                if (debug.warningEnabled())
107:                    debug.warning(message);
108:            }
109:
110:            public static void debugWarning(String message, Throwable t) {
111:                if (debug.warningEnabled())
112:                    debug.warning(message, t);
113:            }
114:
115:            public static void debugMessage(String message) {
116:                if (debug.messageEnabled())
117:                    debug.message(message);
118:            }
119:
120:            public static void debugMessage(String message, Throwable t) {
121:                if (debug.messageEnabled())
122:                    debug.message(message, t);
123:            }
124:
125:            public static void debugError(String message) {
126:                debug.error(message);
127:            }
128:
129:            public static void debugError(String message, Throwable t) {
130:                debug.error(message, t);
131:            }
132:
133:            /**
134:             * Returns the localized resource string for the corresponding
135:             * resource key.
136:             */
137:            public String getString(String key) {
138:                String result = null;
139:                try {
140:                    if (bundle != null) {
141:                        result = bundle.getString(key);
142:                    }
143:                } catch (MissingResourceException mre) {
144:                }
145:                return (result == null ? key : result);
146:            }
147:
148:            public ResourceBundle getAdminMsgsRB() {
149:                return bundle;
150:            }
151:
152:            public void setCurrentNetletRulesRow(int currRow) {
153:                if (token != null) {
154:                    try {
155:                        token.setProperty(CURR_NETLETRULES_ROW, "" + currRow);
156:                    } catch (SSOException ssoe) {
157:                        NetletAdminModelManager
158:                                .debugError("Error setting currentRow in ssoToken - "
159:                                        + ssoe);
160:                    }
161:                }
162:            }
163:
164:            public int getCurrentNetletRulesRow() {
165:                String tmp = null;
166:                int currRow = -1;
167:                if (token != null) {
168:                    try {
169:                        tmp = token.getProperty(CURR_NETLETRULES_ROW);
170:                        currRow = Integer.parseInt(tmp.trim());
171:                    } catch (SSOException ssoe) {
172:                        currRow = -1;
173:                        NetletAdminModelManager
174:                                .debugError("Error getting currentRow from ssoToken - "
175:                                        + ssoe);
176:                    } catch (NumberFormatException nfe) {
177:                        currRow = -1;
178:                        NetletAdminModelManager
179:                                .debugError("Error getting currentRow from ssoToken - "
180:                                        + nfe);
181:                    }
182:                }
183:                return currRow;
184:            }
185:
186:            /*    public void storeToSession(String key, String value) {
187:             if(token != null) {
188:             try {
189:             token.setProperty(key, value);
190:             } catch(SSOException ssoe) {
191:             NetletAdminModelManager.debugError("Error setting property in ssoToken - " + ssoe);
192:             }
193:             }
194:             }
195:             
196:             public String getFromSession(String key) {
197:             String value = null;
198:             if(token != null) {
199:             try {
200:             value = token.getProperty(key);
201:             } catch(SSOException ssoe) {
202:             NetletAdminModelManager.debugError("Error getting property from ssoToken - " + ssoe);
203:             }
204:             }
205:             return value;
206:             }    
207:             */
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.