Source Code Cross Referenced for NotesCalendarHelper.java in  » Portal » Open-Portal » com » sun » portal » providers » calendar » 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.calendar 
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 iPlanet
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */package com.sun.portal.providers.calendar;
013:
014:        import com.iplanet.sso.*;
015:        import com.sun.ssoadapter.SSOAdapter;
016:        import com.sun.ssoadapter.SSOAdapterException;
017:        import com.sun.comclient.calendar.*;
018:        import java.util.Properties;
019:        import java.net.HttpURLConnection;
020:        import java.net.URL;
021:        import java.net.URLEncoder;
022:        import java.io.*;
023:        import java.util.*;
024:        import java.util.logging.Level;
025:        import java.util.logging.Logger;
026:        import javax.servlet.http.*;
027:        import com.sun.portal.providers.context.ProviderContext;
028:        import com.sun.portal.providers.context.ProviderContextException;
029:        import com.sun.portal.providers.Provider;
030:        import com.sun.portal.providers.ProfileProviderAdapter;
031:        import com.sun.portal.providers.ApplicationHelper;
032:        import com.sun.portal.providers.ProviderException;
033:        import com.sun.portal.providers.ProviderEditUtility;
034:        import com.sun.portal.log.common.PortalLogger;
035:
036:        /**
037:         * This class implements CalendarSSOAdapter and CalendarApplicationAdapter functionality
038:         * specific to the Sun One Portal and Calendar services.
039:         * <p>Specific features include:
040:         * <ul>
041:         * <li>Support for username/password style authentication.</li>
042:         * <li>Ability to generate web application URLs for the following:
043:         * <ul>
044:         * <li>Calendar Express</li>
045:         * <li>MAP JSP Calendar application.  The URL generated in this
046:         *     case will specify a configuration index via the
047:         *     query string parameter:  "ci". </li>
048:         * </ul>
049:         * </li>
050:         * </ul>
051:         * <p>At the present time, username/password is stored in the clear.
052:         * <p>This CalendarSSOAdapter implementation consumes the following
053:         *    Configuration properties:
054:         * <ul>
055:         * <li><b>protocol</b>:     Required value.  Specifies the protocol
056:         *                       JCAPI will use to connect to the calendar server.
057:         *                       For the time being, this should always be "http".
058:         * <li><b>uid</b>:  Required value.  Username (uid) of calendar user.
059:         * <li><b>password</b>:     Required value.  Password of calendar user.
060:         * <li><b>host</b>:  Required value.  Name of host providing IMAP service.
061:         * <li><b>port</b>:  Optional value.  Port number of calendar server.
062:         * <li><b>clientProtocol</b>:  Protocol to specify within URLs that activate
063:         *                web application functionality.  Defaults to "http".
064:         * <li><b>clientPort</b>:  Port to specify within URLs that that activate web
065:         *               application functionality.  Defaults to "80".
066:         * <li><b>jspContextPath</b>:  The "request context path" to use when forming a URL
067:         *                             that activates MAP JSP application functionality.
068:         *                             Defaults to request.getContextPath().
069:         * <li><b>jspLaunch</b>:  The document path to use when forming a URL
070:         *              that activates MAP JSP application functionality.
071:         * </ul>
072:         *
073:         * @version 1.0
074:         * @see com.sun.sso.SSOAdapter
075:         * @see com.sun.sso.SSOAdapterFactory
076:         * @see com.sun.portal.sso.CalendarSSOAdapter
077:         *
078:         */
079:
080:        public class NotesCalendarHelper extends ApplicationHelper implements 
081:                CalendarApplicationHelper {
082:
083:            public CalendarProvider provider = null;
084:            public SSOAdapter ssoAdapter = null;
085:            public Properties adapterProperties = null;
086:            protected String appName = "";
087:            protected String containerName = "";
088:
089:            // Create a logger for this class
090:            private static Logger debugLogger = PortalLogger
091:                    .getLogger(NotesCalendarHelper.class);
092:
093:            /**
094:             * Initialize Helper.
095:             *
096:             * @param provider    CalendarProvider
097:             * @param ssoAdapter  SSOAdapter
098:             */
099:            public void init(CalendarProvider provider, SSOAdapter ssoAdapter)
100:                    throws Exception {
101:                super .init((ProfileProviderAdapter) provider, ssoAdapter);
102:                this .provider = provider;
103:                this .ssoAdapter = ssoAdapter;
104:
105:                if (ssoAdapter != null) {
106:                    this .adapterProperties = ssoAdapter.getProperties();
107:                }
108:
109:            }
110:
111:            /**
112:             * Returns a client URL, if supported by the service.
113:             *
114:             * @param provider    CalendarProvider
115:             * @param ssoAdapter  SSOAdapter
116:             */
117:            public String getStartURL(CalendarProvider provider,
118:                    HttpServletRequest request) {
119:                String url = null;
120:
121:                try {
122:                    url = getApplicationURL(provider, request);
123:                    ProviderContext pc = provider.getProviderContext();
124:                    url = pc.escape(url);
125:                } catch (Exception e) {
126:                    debugLogger.log(Level.FINE, "PSCC_CSPPC0002", e);
127:                }
128:
129:                return url;
130:            }
131:
132:            /**
133:             * Returns client aware URL for calendar application access
134:             * to service associated with a particular instance
135:             * of a NotesCalendarHelper.
136:             *
137:             * @param provider  CalendarProvider
138:             * @param request   HttpServletRequest
139:             */
140:            public String getApplicationURL(CalendarProvider provider,
141:                    HttpServletRequest request) throws Exception {
142:                String clientProtocol = adapterProperties.getProperty(
143:                        "clientProtocol", "http");
144:                String clientPort = adapterProperties.getProperty("clientPort",
145:                        adapterProperties.getProperty("port", "80"));
146:                String host = adapterProperties.getProperty("host");
147:
148:                String clientURL = clientProtocol + "://" + host + ":"
149:                        + clientPort;
150:
151:                // check for valid session, if not valid then return base url
152:                SSOToken tok = ssoAdapter.getSSOToken();
153:
154:                String fileName = new String("/");
155:                if (tok != null) {
156:                    String mailFileName = ((CalendarStore) ssoAdapter
157:                            .getConnection()).getSession().getProperty(
158:                            "lotus.mailFileName");
159:                    if (mailFileName == null || mailFileName.equals("")) {
160:                        fileName += "mail/";
161:                        String idFileName = ((CalendarStore) ssoAdapter
162:                                .getConnection()).getSession().getProperty(
163:                                "lotus.sso.user");
164:                        if (idFileName == null || idFileName.equals("")) {
165:                            idFileName = adapterProperties.getProperty("uid");
166:                        }
167:                        fileName += idFileName;
168:                    } else {
169:                        fileName += mailFileName;
170:                    }
171:                    clientURL += fileName + ".nsf";
172:                }
173:                return clientURL;
174:            }
175:
176:            /**
177:             * Returns client aware URL for event access
178:             * to service associated with a particular instance
179:             * of a PortalCalendarSSOHelper.
180:             *
181:             * @param provider  CalendarProvider
182:             * @param request   HttpServletRequest
183:             * @param event     Calendar Event
184:             */
185:            public String getEventURL(CalendarProvider provider,
186:                    HttpServletRequest request, VEvent event) throws Exception {
187:                return null;
188:            }
189:
190:            /**
191:             * Returns client aware URL for task access
192:             * to service associated with a particular instance
193:             * of a PortalCalendarSSOHelper.
194:             *
195:             * @param provider  CalendarProvider
196:             * @param request   HttpServletRequest
197:             * @param task      Calendar Task
198:             */
199:            public String getTaskURL(CalendarProvider provider,
200:                    HttpServletRequest request, VTodo task) throws Exception {
201:                return null;
202:            }
203:
204:            /**
205:             *  Returns the contents of the CalendarProviders edit page
206:             *
207:             *@param  cprov  Description of the Parameter
208:             *@param  req    Description of the Parameter
209:             *@param  res    Description of the Parameter
210:             *@return        The appPrefsEdit value
211:             */
212:            public StringBuffer getAppPrefsEdit(CalendarProvider cprov,
213:                    HttpServletRequest req, HttpServletResponse res) {
214:                setEditContainer(cprov.editContainer);
215:                setContainerName(cprov.containerName);
216:                setTargetProvider(cprov.targetProvider);
217:                return super .getAppPrefsEdit((Provider) cprov, req, res);
218:            }
219:
220:            /**
221:             *  Processes values returned from the CalendarProvider edit page
222:             *
223:             *@param  cprov  Instance of Calendar Provider
224:             *@param  req    servlet request
225:             *@param  res    servlet response
226:             */
227:            public URL processAppPrefsEdit(CalendarProvider cprov,
228:                    HttpServletRequest request, HttpServletResponse response)
229:                    throws ProviderException {
230:                setEditContainer(cprov.editContainer);
231:                setContainerName(cprov.containerName);
232:                setTargetProvider(cprov.targetProvider);
233:                return super .processAppPrefsEdit((Provider) cprov, request,
234:                        response);
235:            }
236:
237:            /**
238:             * Returns a HTML link containing encoding specific for the app helper
239:             */
240:
241:            public String getAppHelperEditLink(HttpServletRequest req,
242:                    ProviderContext pc) {
243:
244:                Hashtable tagTable = new Hashtable();
245:                StringBuffer link = new StringBuffer();
246:                try {
247:                    link.append(pc.getDesktopURL(req));
248:                } catch (Exception e) {
249:                    return "";
250:                }
251:                link.append("?action=edit&provider=");
252:                link.append(ProviderEditUtility.getRequestParameter("provider",
253:                        req));
254:                link.append("&targetprovider=" + provider.getName());
255:                link.append("&containerName=");
256:                link.append(ProviderEditUtility.getRequestParameter(
257:                        "containerName", req));
258:                link.append("&appPref=" + this .getName());
259:
260:                tagTable.put("editLink", link.toString());
261:                String content = null;
262:
263:                try {
264:                    String fontTag = pc.getStringProperty(provider.getName(),
265:                            "fontFace1", "Sans-serif");
266:                    tagTable.put("iwtDesktop-fontFace1", fontTag);
267:                    content = pc.getTemplate(provider.getName(),
268:                            "edit-link.template", tagTable).toString();
269:                    debugLogger.log(Level.FINER, "PSCC_CSPPC0004", content
270:                            .toString());
271:                } catch (Exception e) {
272:                    debugLogger.log(Level.INFO, "PSCC_CSPPC0005", e);
273:                    content = "";
274:                }
275:
276:                debugLogger.log(Level.FINER, "PSCC_CSPPC0006", content
277:                        .toString());
278:
279:                return content;
280:            }
281:
282:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.