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


001:        /*
002:         * DPRootSpecifier.java
003:         *
004:         * Created on November 15, 2001, 3:45 PM
005:         */
006:
007:        package com.sun.portal.desktop.deployment;
008:
009:        import org.w3c.dom.Document;
010:
011:        import java.util.Properties;
012:        import java.io.FileInputStream;
013:        import java.io.IOException;
014:        import java.io.FileNotFoundException;
015:
016:        import com.sun.portal.desktop.dp.DPRoot;
017:        import com.sun.portal.desktop.dp.DPFactory;
018:        import com.sun.portal.desktop.dp.DPProvider;
019:        import com.sun.portal.desktop.dp.DPChannel;
020:        import com.sun.portal.desktop.dp.DPReference;
021:
022:        import com.sun.portal.desktop.dp.xml.XMLDPFactory;
023:        import com.sun.portal.desktop.dp.xml.XMLDPRoot;
024:
025:        import com.sun.portal.desktop.context.AdminDPContext;
026:        import com.sun.portal.desktop.context.DSAMEAdminDPContext;
027:        import com.sun.portal.desktop.context.DPContext;
028:        import com.sun.portal.util.ResourceLoader;
029:        import com.iplanet.sso.SSOToken;
030:
031:        /**
032:         *
033:         * @author  yabob
034:         * @version 
035:         */
036:        public class DPRootSpecifier {
037:
038:            private DPRootSpecifier(String user, String pwd)
039:                    throws ParFileException {
040:                String sysprop = System.getProperty(DTPROPFILE);
041:                if (sysprop == null) {
042:                    Object tok[] = { DTPROPFILE };
043:                    throw new ParFileException("errorSystemProp", tok);
044:                }
045:
046:                try {
047:                    //m_ADPCtxObj = getAdminDPContextObject(sysprop);
048:                    m_ADPCtxObj = new DSAMEAdminDPContext();
049:                    ((AdminDPContext) m_ADPCtxObj).init(user, pwd, null,
050:                            ResourceLoader.getInstance(System.getProperties())
051:                                    .getPortalId());
052:
053:                    m_Factory = XMLDPFactory.getInstance();
054:                } catch (Exception ex) {
055:                    throw new ParFileException("errorAuthenticate", ex);
056:                }
057:            }
058:
059:            private DPRootSpecifier(SSOToken ssoToken, String portalId)
060:                    throws ParFileException {
061:                String sysprop = System.getProperty(DTPROPFILE);
062:                if (sysprop == null) {
063:                    Object tok[] = { DTPROPFILE };
064:                    throw new ParFileException("errorSystemProp", tok);
065:                }
066:
067:                try {
068:                    //m_ADPCtxObj = getAdminDPContextObject(sysprop);
069:                    m_ADPCtxObj = new DSAMEAdminDPContext();
070:                    //need to change the logfile
071:                    ((AdminDPContext) m_ADPCtxObj).init(ssoToken, null,
072:                            portalId);
073:                    m_Factory = XMLDPFactory.getInstance();
074:                } catch (Exception ex) {
075:                    throw new ParFileException("errorAuthenticate", ex);
076:                }
077:            }
078:
079:            // Use static method so we don't have a public constructor throwing exceptions.
080:
081:            public static DPRootSpecifier makeSpecifier(String user, String pwd)
082:                    throws ParFileException {
083:                return new DPRootSpecifier(user, pwd);
084:            }
085:
086:            public static DPRootSpecifier makeSpecifier(SSOToken ssoToken,
087:                    String portalId) throws ParFileException {
088:                return new DPRootSpecifier(ssoToken, portalId);
089:            }
090:
091:            // setDN must be written so as to not cause unneccesary revalidation when
092:            // recalled with the same string.
093:
094:            public void setDN(String dn) {
095:                if (dn != null && m_DN != null && dn.equals(m_DN)) {
096:                    return;
097:                }
098:                m_DN = dn;
099:                m_IsGlobal = dn.equalsIgnoreCase(GLOBAL);
100:                m_DRoot = null; // invalidate, so we perform lookup at next getRoot().
101:            }
102:
103:            public DPRoot getRoot() throws ParFileException {
104:                if (m_DRoot != null) {
105:                    return m_DRoot;
106:                }
107:                if (m_DN == null) {
108:                    throw new ParFileException("errorNoDirName");
109:                }
110:
111:                try {
112:                    String buf = m_IsGlobal ? ((AdminDPContext) m_ADPCtxObj)
113:                            .getGlobalDPDocument()
114:                            : ((AdminDPContext) m_ADPCtxObj)
115:                                    .getDPDocument(m_DN);
116:                    m_DRoot = m_Factory
117:                            .createRoot((DPContext) m_ADPCtxObj, buf);
118:                } catch (Exception ex) {
119:                    throw new ParFileException("errorDPFetch", ex);
120:                }
121:
122:                return m_DRoot;
123:            }
124:
125:            public String getDN() {
126:                return m_DN;
127:            }
128:
129:            public DPProvider createProvider(String name, String classname,
130:                    int providerVersion) throws ParFileException {
131:
132:                // FIXME - we shouldn't be coercing to implementation classes.
133:
134:                try {
135:                    Document doc = ((XMLDPRoot) m_DRoot).getDocument();
136:                    return m_Factory.createProvider((DPContext) m_ADPCtxObj,
137:                            m_DRoot, doc, name, classname, providerVersion);
138:                } catch (Exception ex) {
139:                    throw new ParFileException("errorDPCreate", ex);
140:                }
141:            }
142:
143:            public DPChannel createChannel(String name, String provider)
144:                    throws ParFileException {
145:
146:                // FIXME - XMLDPFactory methods aren't public yet, and we
147:                // shouldn't be coercing to implementation classes.
148:
149:                try {
150:                    Document doc = ((XMLDPRoot) m_DRoot).getDocument();
151:                    return m_Factory.createChannel((DPContext) m_ADPCtxObj,
152:                            m_DRoot, doc, name, provider);
153:                } catch (Exception ex) {
154:                    throw new ParFileException("errorDPCreate", ex);
155:                }
156:            }
157:
158:            public DPReference createReference(String name)
159:                    throws ParFileException {
160:
161:                // FIXME - we shouldn't be coercing to implementation classes.
162:
163:                try {
164:                    Document doc = ((XMLDPRoot) m_DRoot).getDocument();
165:                    return m_Factory.createReference((DPContext) m_ADPCtxObj,
166:                            m_DRoot, doc, name);
167:                } catch (Exception ex) {
168:                    throw new ParFileException("errorDPCreate", ex);
169:                }
170:            }
171:
172:            public void flush() throws ParFileException {
173:                try {
174:                    m_DRoot.setDirty(false);
175:                    StringBuffer buf = new StringBuffer(256);
176:                    m_DRoot.toXML(buf, 0);
177:                    if (m_IsGlobal) {
178:                        ((AdminDPContext) m_ADPCtxObj)
179:                                .storeGlobalDPDocument(buf.toString());
180:                    } else {
181:                        ((AdminDPContext) m_ADPCtxObj).storeDPDocument(m_DN,
182:                                buf.toString());
183:                    }
184:                } catch (Exception ex) {
185:                    throw new ParFileException("errorDPFlush", ex);
186:                }
187:            }
188:
189:            private Object getAdminDPContextObject(String propsFileName)
190:                    throws ParFileException {
191:                Properties desktopProps = new Properties();
192:                try {
193:                    desktopProps.load(new FileInputStream(propsFileName));
194:                } catch (FileNotFoundException fnfe) {
195:                    throw new ParFileException(
196:                            "DPRootSpecifier.getAdminDPContext() ", fnfe);
197:                } catch (IOException ioe) {
198:                    throw new ParFileException(
199:                            "DPRootSpecifier.getAdminDPContext() ", ioe);
200:                }
201:
202:                String adminDPContextClassName = desktopProps
203:                        .getProperty(AdminDPContext.ADMINDPCONTEXTCLASSNAME_KEY);
204:                Object adcObj = null;
205:
206:                try {
207:                    adcObj = (Class.forName(adminDPContextClassName)
208:                            .newInstance());
209:                } catch (ClassNotFoundException cnfe) {
210:                    throw new ParFileException(
211:                            "DPRootSpecifier.getAdminDPContext()", cnfe);
212:                } catch (NoClassDefFoundError ncdfe) {
213:                    throw new ParFileException(
214:                            "DPRootSpecifier.getAdminDPContext()", ncdfe);
215:                } catch (IllegalAccessException iae) {
216:                    throw new ParFileException(
217:                            "DPRootSpecifier.getAdminDPContext()", iae);
218:                } catch (ClassCastException cce) {
219:                    throw new ParFileException(
220:                            "DPRootSpecifier.getAdminDPContext()", cce);
221:                } catch (InstantiationException ie) {
222:                    throw new ParFileException(
223:                            "DPRootSpecifier.getAdminDPContext()", ie);
224:                } catch (SecurityException se) {
225:                    throw new ParFileException(
226:                            "DPRootSpecifier.getAdminDPContext()", se);
227:                }
228:
229:                return adcObj;
230:            }
231:
232:            private String DTPROPFILE = "desktop.propertiesFile";
233:
234:            private boolean m_IsGlobal;
235:            private String m_DN = null;
236:            private DPRoot m_DRoot = null;
237:            private Object m_ADPCtxObj;
238:            private XMLDPFactory m_Factory;
239:            private static String GLOBAL = "global";
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.