Source Code Cross Referenced for ISChannelTaskAdminContext.java in  » Portal » Open-Portal » com » sun » portal » taskadmin » context » 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.taskadmin.context 
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:        package com.sun.portal.taskadmin.context;
006:
007:        import java.util.Iterator;
008:        import java.util.Map;
009:        import java.util.HashMap;
010:        import java.util.Set;
011:        import java.util.HashSet;
012:        import java.util.Locale;
013:        import java.util.Collections;
014:        import java.util.Properties;
015:        import java.util.logging.Level;
016:        import java.util.logging.Logger;
017:        import java.io.FileNotFoundException;
018:        import java.io.IOException;
019:
020:        import javax.servlet.http.HttpServletRequest;
021:
022:        import com.sun.portal.taskadmin.TaskAdminException;
023:        import com.sun.portal.desktop.context.DSAMEAdminDPContext;
024:        import com.sun.portal.desktop.context.AdminDPContext;
025:        import com.sun.portal.desktop.context.ContextError;
026:        import com.sun.portal.desktop.dp.DPError;
027:        import com.sun.portal.desktop.context.DSAMEMultiPortalConstants;
028:        import com.sun.portal.desktop.context.ProviderClassLoader;
029:
030:        import com.sun.portal.util.ResourceLoader;
031:        import com.sun.portal.log.common.PortalLogger;
032:
033:        import com.iplanet.sso.SSOToken;
034:        import com.iplanet.sso.SSOTokenListener;
035:        import com.iplanet.sso.SSOException;
036:        import com.iplanet.am.sdk.AMException;
037:        import com.iplanet.am.sdk.AMTemplate;
038:        import com.iplanet.am.sdk.AMRole;
039:
040:        public class ISChannelTaskAdminContext implements 
041:                ChannelTaskAdminContext {
042:            private static final String ATTR_DP_CAN_VIEW = "sunPortalDesktopDpCanView";
043:            protected TaskAdminContext taskAdminContext = null;
044:            protected TaskAdminISConnection conn = null;
045:            protected boolean ssoTokenListenerAdded = false;
046:            private boolean canViewDTAttributes = true;
047:            private AdminDPContext dpContext = null;
048:            protected ProviderClassLoader pcl = null;
049:            private static Logger logger = PortalLogger
050:                    .getLogger(ISChannelTaskAdminContext.class);
051:
052:            private String sid = null;
053:
054:            public void init(HttpServletRequest req) {
055:                try {
056:                    conn = new TaskAdminISConnection(req);
057:                    taskAdminContext = TaskAdminContextFactoryManager
058:                            .getFactory().getTaskAdminContext(req);
059:                    String portalId = ResourceLoader.getInstance(
060:                            System.getProperties()).getPortalId();
061:                    initCanViewFlag(portalId);
062:                    initDPContext(req);
063:                    initProviderClassLoader();
064:                    sid = conn.getSSOToken().getTokenID().toString();
065:                } catch (TaskAdminException tae) {
066:                    throw new ContextError(
067:                            "ISTaskAdminContext.init(req):couldn't initialize TaskASdminContext",
068:                            tae);
069:                }
070:            }
071:
072:            public void init(SSOToken ssoToken, String portalId) {
073:                try {
074:                    conn = new TaskAdminISConnection(ssoToken);
075:                    taskAdminContext = TaskAdminContextFactoryManager
076:                            .getFactory(portalId).getTaskAdminContext(ssoToken,
077:                                    portalId);
078:                    initCanViewFlag(portalId);
079:                    initDPContext(ssoToken, portalId);
080:                    initProviderClassLoader(portalId);
081:                    sid = ssoToken.getTokenID().toString();
082:                } catch (TaskAdminException tae) {
083:                    throw new ContextError(
084:                            "ISTaskAdminContext.init(req):couldn't initialize TaskASdminContext",
085:                            tae);
086:                }
087:            }
088:
089:            private void initDPContext(HttpServletRequest req) {
090:                try {
091:                    dpContext = new DSAMEAdminDPContext();
092:                    dpContext.init(req);
093:                } catch (DPError e) {
094:                    logger.log(Level.INFO, "PSDT_CSPTC0002", e.getMessage());
095:                    throw new ContextError(e.getMessage());
096:                }
097:            }
098:
099:            private void initDPContext(SSOToken ssoToken, String portalId) {
100:                try {
101:                    dpContext = new DSAMEAdminDPContext();
102:                    dpContext.init(ssoToken, null, portalId);
103:                } catch (DPError e) {
104:                    logger.log(Level.INFO, "PSDT_CSPTC0002", e.getMessage());
105:                    throw new ContextError(e.getMessage());
106:                }
107:            }
108:
109:            private void initProviderClassLoader() {
110:                String providerClassBaseDir = null;
111:                try {
112:                    Properties desktopProps = ResourceLoader.getInstance(
113:                            System.getProperties()).getProperties(
114:                            "desktopconfig.properties");
115:                    providerClassBaseDir = desktopProps
116:                            .getProperty("providerClassBaseDir");
117:                } catch (FileNotFoundException fnfe) {
118:                    //do nothing. ignore
119:                } catch (IOException ioe) {
120:                    //do nothing. ignore
121:                }
122:                if (providerClassBaseDir != null) {
123:                    pcl = ProviderClassLoader.getInstance(providerClassBaseDir);
124:                }
125:            }
126:
127:            private void initProviderClassLoader(String portalId) {
128:                String providerClassBaseDir = null;
129:                try {
130:                    Properties desktopProps = ResourceLoader.getInstance(
131:                            portalId).getProperties("desktopconfig.properties");
132:                    providerClassBaseDir = desktopProps
133:                            .getProperty("providerClassBaseDir");
134:                } catch (FileNotFoundException fnfe) {
135:                    //do nothing. ignore
136:                } catch (IOException ioe) {
137:                    //do nothing. ignore
138:                }
139:                if (providerClassBaseDir != null) {
140:                    pcl = ProviderClassLoader.getInstance(providerClassBaseDir);
141:                }
142:            }
143:
144:            public ProviderClassLoader getProviderClassLoader() {
145:                return pcl;
146:            }
147:
148:            /**
149:             * This attribute if set in the delegated admin's roles
150:             * means that a delegated admin doesn't have
151:             * access to any channels/containers other than the ones defined at
152:             * the DN for which the admin has permission to administer and also
153:             * doesn't have permission to access the service attributes.
154:             * In the case of taskadmin, this flag setting can be overriden
155:             * by defining an adminchannel that allows access to the channels
156:             * in the mergers. This is used when invoked from mbeans
157:             */
158:            private void initCanViewFlag(String portalId) {
159:                try {
160:                    Iterator ri = conn.getUser().getRoleDNs().iterator();
161:                    while (ri.hasNext() && canViewDTAttributes) {
162:                        AMRole amRole = conn.getConnection().getRole(
163:                                (String) ri.next());
164:                        if ((amRole != null) && amRole.isExists()) {
165:                            DSAMEMultiPortalConstants.createInstance(portalId);
166:                            AMTemplate amTemplate = amRole
167:                                    .getTemplate(
168:                                            DSAMEMultiPortalConstants
169:                                                    .getInstance(portalId).MP_SUN_DESKTOP_SERVICE,
170:                                            AMTemplate.DYNAMIC_TEMPLATE);
171:                            if ((amTemplate != null) && (amTemplate.isExists())) {
172:                                String value = amTemplate
173:                                        .getStringAttribute(ATTR_DP_CAN_VIEW);
174:                                if (value.length() > 0) {
175:                                    canViewDTAttributes = Boolean
176:                                            .valueOf(value).booleanValue();
177:                                }
178:                            }
179:                        }
180:                    }
181:                } catch (AMException ame) {
182:                    throw new ContextError(
183:                            "TaskAdmin.init:Couldn't initialize the canView flag",
184:                            ame);
185:                } catch (SSOException ssoe) {
186:                    throw new ContextError(
187:                            "TaskAdmin.init:Couldn't initialize the canView flag",
188:                            ssoe);
189:                }
190:            }
191:
192:            public Locale getLocale() {
193:                return taskAdminContext.getLocale();
194:            }
195:
196:            public AdminDPContext getDPContext() {
197:                return dpContext;
198:            }
199:
200:            public Set getBaseDNs() {
201:                return taskAdminContext.getBaseDNs();
202:            }
203:
204:            public String DNToName(String dn) {
205:                return taskAdminContext.DNToName(dn);
206:            }
207:
208:            public boolean canViewDTAttributes() {
209:                return canViewDTAttributes;
210:            }
211:
212:            protected TaskAdminISConnection getISConnection() {
213:                return conn;
214:            }
215:
216:            public void store(String nodeDN, String dpText) {
217:                if (dpContext.isGlobal(nodeDN)) {
218:                    dpContext.storeGlobalDPDocument(dpText);
219:                } else {
220:                    dpContext.storeDPDocument(nodeDN, dpText);
221:                }
222:            }
223:
224:            /**
225:             * Return the orgDN from the given baseDN.
226:             * @param baseDN base DN.
227:             * @return String contaning org DN.
228:             */
229:            public String getOrganizationDN(String baseDN) {
230:                try {
231:                    return conn.getConnection().getEntity(baseDN)
232:                            .getOrganizationDN();
233:                } catch (SSOException ssoe) {
234:                    throw new ContextError(
235:                            "TaskAdminContext.getOrganizationDN(): ", ssoe);
236:                } catch (AMException ame) {
237:                    throw new ContextError(
238:                            "TaskAdminContext.getOrganizationDN: ", ame);
239:                }
240:            }
241:
242:            public void addSSOTokenListener(SSOTokenListener sl) {
243:                SSOToken token = conn.getSSOToken();
244:
245:                //
246:                // only register as an SSO token listener
247:                // once per session
248:                //
249:
250:                try {
251:                    if (!ssoTokenListenerAdded) {
252:                        synchronized (this ) {
253:                            if (!ssoTokenListenerAdded) {
254:                                token.addSSOTokenListener(sl);
255:                                ssoTokenListenerAdded = true;
256:                            }
257:                        }
258:                    }
259:                } catch (SSOException ssoe) {
260:                    throw new ContextError(
261:                            "TaskAdminContext.addSSOTokenListener(): ", ssoe);
262:                }
263:            }
264:
265:            public String getSessionID() {
266:                return sid;
267:            }
268:
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.