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


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