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


001:        /**
002:         * $Id: ExchangeABStore.java,v 1.5 2006/04/25 20:14:35 rakeshn Exp $
003:         * Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use of this
004:         * product is subject to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users Subject to Standard License Terms
006:         * and Conditions.
007:         *
008:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE are trademarks or 
009:         * registered trademarks of Sun Microsystems, Inc. in the United States
010:         * and other countries.
011:         */package com.sun.ssoadapter.ab.exchange;
012:
013:        import com.sun.addressbook.ABSession;
014:        import com.sun.addressbook.AddressBook;
015:        import com.sun.addressbook.ABStoreException;
016:        import com.sun.ssoadapter.ab.pim.JPimABStore;
017:        import com.aligo.pim.exceptions.PimException;
018:        import com.aligo.pim.interfaces.PimAddressBook;
019:        import com.aligo.pim.interfaces.PimFolders;
020:
021:        import com.sun.addressbook.MissingPropertiesException;
022:
023:        import com.aligo.pim.PimContainerType;
024:        import com.aligo.pim.PimUserInfoParameter;
025:        import com.aligo.pim.interfaces.PimUserInfo;
026:
027:        import java.util.StringTokenizer;
028:
029:        public class ExchangeABStore extends JPimABStore {
030:            /**
031:             * Returns the Container Type corresponding to the exchange backend
032:             */
033:            public PimContainerType getPimContainerType(ABSession session) {
034:                String pimInterfaceType = session
035:                        .getProperty(PIM_INTERFACE_TYPE);
036:                if ((pimInterfaceType == null)
037:                        || (!pimInterfaceType.equals(PIM_CDO))) {
038:                    // Default to WEBDAV
039:                    return PimContainerType.EXCHANGE_WEBDAV;
040:                } else {
041:                    return PimContainerType.EXCHANGE;
042:                }
043:            }
044:
045:            public void init(ABSession session, PimUserInfo pimU)
046:                    throws MissingPropertiesException {
047:                String userName = session.getProperty(USERNAME);
048:                String userPasswd = session.getProperty(USERPASSWD);
049:                String userDomain = session.getProperty(USERDOMAIN);
050:                String jPimHost = session.getProperty(JPIMHOST);
051:                String jPimPort = session.getProperty(JPIMPORT);
052:                String ocxHost = session.getProperty(OCXHOST);
053:                String authHost = session.getProperty(AUTHHOST);
054:                String pimInterfaceType = session
055:                        .getProperty(PIM_INTERFACE_TYPE);
056:                String usersBaseDn = session.getProperty(USERS_BASE_DN);
057:
058:                if (userName == null) {
059:                    throw new MissingPropertiesException(
060:                            "Cannot connect to JPim server:: Missing Property: "
061:                                    + USERNAME);
062:                }
063:
064:                if (userPasswd == null) {
065:                    throw new MissingPropertiesException(
066:                            "Cannot connect to JPim server:: Missing Property: "
067:                                    + USERPASSWD);
068:                }
069:
070:                if (jPimHost == null) {
071:                    throw new MissingPropertiesException(
072:                            "Cannot connect to JPim server:: Missing Property: "
073:                                    + JPIMHOST);
074:                }
075:
076:                if (jPimPort == null) {
077:                    jPimPort = EXCHANGE_DEFAULT_PORT;
078:                }
079:
080:                if (userDomain == null) {
081:                    throw new MissingPropertiesException(
082:                            "Cannot connect to JPim server:: Missing Property: "
083:                                    + USERDOMAIN);
084:                }
085:
086:                //No easy way to turn the debug on, hence it is set to on for Aligo all the time
087:                pimU.set(PimUserInfoParameter.DEBUG, "true");
088:                if ((pimInterfaceType == null)
089:                        || (!pimInterfaceType.equals(PIM_CDO))) {
090:                    //Default to webdav
091:                    pimU.set(PimUserInfoParameter.EXCHANGE_USERNAME, userName);
092:                    pimU
093:                            .set(PimUserInfoParameter.EXCHANGE_PASSWORD,
094:                                    userPasswd);
095:                    pimU.set(PimUserInfoParameter.EXCHANGE_MAILBOX, userName);
096:                    String webdav_url = "http://" + jPimHost + ":" + jPimPort;
097:                    pimU.set(PimUserInfoParameter.EXCHANGE_WEBDAV_URL,
098:                            webdav_url);
099:
100:                    //ldapUserName should be like "chertseydomain\a"
101:                    String ldapUserName = userDomain + "\\" + userName;
102:
103:                    if (usersBaseDn == null || usersBaseDn.equals("")) {
104:                        //it should be like CN=Users,dc=chertsey,dc=red,dc=iplanet,dc=com for Exchange 2000 and 2003
105:                        //cn=Recipients,ou=..... for 5.5 . Hence defaults to 2000
106:                        String ubaseDn = "CN=Users";
107:                        StringTokenizer strTok = new StringTokenizer(jPimHost,
108:                                ".");
109:                        while (strTok.hasMoreTokens()) {
110:                            ubaseDn += (",DC=" + strTok.nextToken());
111:                        }
112:                        usersBaseDn = ubaseDn;
113:                    }
114:
115:                    //System.out.println("ldap userName=" + ldapUserName+" usersBaseDn="+usersBaseDn);
116:
117:                    //For webdav the ocxhost contains the host name of the active directory
118:                    if ((ocxHost == null) || (ocxHost.length() == 0)) {
119:                        ocxHost = jPimHost;
120:                    }
121:                    pimU.set(PimUserInfoParameter.JNDI_LDAP_SERVER, ocxHost);
122:                    pimU.set(PimUserInfoParameter.JNDI_LDAP_USERNAME,
123:                            ldapUserName);
124:                    pimU.set(PimUserInfoParameter.JNDI_LDAP_PASSWORD,
125:                            userPasswd);
126:                    pimU.set(PimUserInfoParameter.JNDI_LDAP_PORT, "389");
127:                    pimU.set(PimUserInfoParameter.JNDI_LDAP_AB_BASE,
128:                            usersBaseDn);
129:                    pimU
130:                            .set(
131:                                    PimUserInfoParameter.JNDI_LDAP_TRY_ANONYMOUS_FALLBACK,
132:                                    "true");
133:                } else {
134:                    pimU.set(PimUserInfoParameter.EXCHANGE_USERNAME, userName);
135:                    pimU
136:                            .set(PimUserInfoParameter.EXCHANGE_PASSWORD,
137:                                    userPasswd);
138:                    pimU.set(PimUserInfoParameter.EXCHANGE_NT_DOMAIN,
139:                            userDomain);
140:                    pimU.set(PimUserInfoParameter.EXCHANGE_SERVER, jPimHost);
141:                    if (ocxHost != null) {
142:                        pimU.set(
143:                                PimUserInfoParameter.EXCHANGE_OCXHOST_LOCATION,
144:                                ocxHost);
145:                    }
146:
147:                    if (authHost != null) {
148:                        pimU
149:                                .set(
150:                                        PimUserInfoParameter.EXCHANGE_ALIGOAUTH_LOCATION,
151:                                        authHost);
152:                    }
153:
154:                }
155:                boolean debugEnabled = (new Boolean(session
156:                        .getProperty("ab.pim.debug"))).booleanValue();
157:                if (debugEnabled) {
158:                    pimU.set(PimUserInfoParameter.DEBUG, "true");
159:                }
160:            }
161:
162:            /**
163:             * Method to retrieve a address book from the backend service.
164:             *
165:             * @param abID    A specific address book ID. (Its not the same as name).
166:             * @return         The specified address book 
167:             *
168:             * @exception ABStoreException if unable to load the specified calendar
169:             */
170:            public AddressBook openAddressBook(String abID)
171:                    throws ABStoreException {
172:                PimAddressBook pBook = topLevelPimAB;
173:
174:                if ((abID != null) && (!abID.trim().equals(""))) {
175:                    try {
176:                        PimFolders pimFolders = pBook.getFolders();
177:                        pBook = (PimAddressBook) pimFolders.getFolder(abID);
178:                    } catch (PimException pe) {
179:                        pe.printStackTrace();
180:                        throw new ABStoreException("getFolder() failed: " + pe);
181:                    }
182:                }
183:
184:                AddressBook aBook = new ExchangeAddressBook(this, pBook, abID);
185:                return aBook;
186:            }
187:
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.