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