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


001:        /**
002:         * $Id: DPAdminWrapper.java,v 1.14 2005/10/21 07:15:09 dg154973 Exp $
003:         * Copyright 2004 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 Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.desktop.admin.mbeans;
014:
015:        import java.io.*;
016:        import java.util.List;
017:        import java.util.logging.Level;
018:        import java.util.logging.Logger;
019:
020:        import com.sun.portal.log.common.PortalLogger;
021:
022:        import com.sun.portal.desktop.admin.mbeans.tasks.DPAException;
023:        import com.sun.portal.desktop.context.AdminDPContext;
024:        import com.sun.portal.desktop.admin.mbeans.tasks.DPHelper;
025:        import com.sun.portal.desktop.admin.mbeans.tasks.DesktopDataException;
026:
027:        import com.sun.portal.admin.common.context.PSConfigContext;
028:        import com.sun.portal.admin.common.PSConfigConstants;
029:        import com.sun.portal.admin.common.context.PortalDomainContext;
030:        import com.sun.portal.admin.common.PSMBeanException;
031:        import com.sun.portal.admin.server.mbeans.PSResource;
032:        import com.sun.portal.admin.server.AdminServerUtil;
033:
034:        //DP operations
035:        import com.sun.portal.desktop.admin.mbeans.tasks.DPAAdd;
036:        import com.sun.portal.desktop.admin.mbeans.tasks.DPAList;
037:        import com.sun.portal.desktop.admin.mbeans.tasks.DPAMerge;
038:        import com.sun.portal.desktop.admin.mbeans.tasks.DPAModify;
039:        import com.sun.portal.desktop.admin.mbeans.tasks.DPARemove;
040:
041:        //This class implements DPAdminWrapperMBean interface and implements methods
042:        //to interact with existing dpadmin cli for dp manipulation.
043:
044:        public class DPAdminWrapper extends PSResource implements 
045:                DPAdminWrapperMBean {
046:            private static final String MSG_PREFIX = "desktop.";
047:            private String psPortalID;
048:            private PSConfigContext cc = null;
049:            private static Logger logger = PortalLogger
050:                    .getLogger(DPAdminWrapper.class);
051:
052:            public DPAdminWrapper() {
053:                ;
054:            }
055:
056:            public void init(PSConfigContext cc, PortalDomainContext pdc,
057:                    List path) {
058:                super .init(cc, pdc, path);
059:
060:                this .cc = cc;
061:                this .psPortalID = (String) path.get(1);
062:
063:            }
064:
065:            //Method for dp Add
066:            public void dpAdd(String dn, String parent,
067:                    byte[][] arrayByteArray, Boolean global, Boolean dryrun,
068:                    Boolean verbose) throws PSMBeanException {
069:
070:                AdminDPContext adpContext = getAdminDPContext();
071:                //get xml byte stream
072:                InputStream[] xmlByteStreams;
073:                xmlByteStreams = getXMLInputFromByteArray(arrayByteArray);
074:
075:                DPAAdd dpaadd = new DPAAdd();
076:                try {
077:                    dpaadd.process(adpContext, dn, global.booleanValue(),
078:                            parent, xmlByteStreams, verbose.booleanValue(),
079:                            dryrun.booleanValue(), logger);
080:                } catch (DPAException dpae) {
081:                    logger.log(Level.SEVERE, "PSDT_CSPDAMB0005", dpae
082:                            .getOrigEx());
083:                    throw new PSMBeanException(MSG_PREFIX + dpae.getKey(), dpae
084:                            .getOrigEx(), dpae.getTokens());
085:                } finally {
086:                    try {
087:                        for (int i = 0; i < xmlByteStreams.length; i++) {
088:                            xmlByteStreams[i].close();
089:                        }
090:                    } catch (IOException ioe) {
091:                        throw new PSMBeanException(MSG_PREFIX
092:                                + "errorStreamClose", ioe);
093:                    }
094:                }
095:
096:            };
097:
098:            //Method for dp list
099:            public String dpList(String dn, String name, Boolean global,
100:                    Boolean verbose) throws PSMBeanException {
101:
102:                //get the admin dp context  ;
103:                AdminDPContext adpContext = getAdminDPContext();
104:
105:                DPAList dpalist = new DPAList();
106:                String dp;
107:                try {
108:                    dp = dpalist.process(adpContext, dn, global.booleanValue(),
109:                            name, verbose.booleanValue(), logger);
110:                    if (dp != null) {
111:                        return dp;
112:                    } else {
113:                        logger.log(Level.INFO, "PSDT_CSPDAMB0007");
114:                        throw new PSMBeanException(MSG_PREFIX + "errorNodp");
115:                    }
116:                } catch (DPAException dpae) {
117:
118:                    logger.log(Level.SEVERE, "PSDT_CSPDAMB0005"
119:                            + dpae.getOrigEx());
120:                    throw new PSMBeanException(MSG_PREFIX + dpae.getKey(), dpae
121:                            .getOrigEx(), dpae.getTokens());
122:                }
123:            };
124:
125:            public String dpMerge(String dn, String name, Boolean global,
126:                    Boolean verbose) throws PSMBeanException {
127:
128:                //get the admin dp context  ;
129:                AdminDPContext adpContext = getAdminDPContext();
130:                DPAMerge dpamerge = new DPAMerge();
131:                try {
132:                    String dp = dpamerge.process(adpContext, dn, global
133:                            .booleanValue(), name, verbose.booleanValue(),
134:                            logger);
135:                    if (dp != null) {
136:                        return dp;
137:                    } else {
138:                        logger.log(Level.INFO, "PSDT_CSPDAMB0007");
139:                        throw new PSMBeanException(MSG_PREFIX + "errorNodp");
140:                    }
141:                } catch (DPAException dpae) {
142:                    logger.log(Level.SEVERE, "PSDT_CSPDAMB0005"
143:                            + dpae.getOrigEx());
144:                    throw new PSMBeanException(MSG_PREFIX + dpae.getKey(), dpae
145:                            .getOrigEx(), dpae.getTokens());
146:                }
147:            };
148:
149:            public void dpModify(String dn, String parent, Boolean global,
150:                    byte[][] arrayByteArray, Boolean combine, Boolean dryrun,
151:                    Boolean verbose) throws PSMBeanException {
152:
153:                //get the admin dp context  ;
154:                AdminDPContext adpContext = getAdminDPContext();
155:                //get xml byte stream
156:                InputStream[] xmlByteStreams;
157:                xmlByteStreams = getXMLInputFromByteArray(arrayByteArray);
158:
159:                DPAModify dpamodify = new DPAModify();
160:                try {
161:                    dpamodify.process(adpContext, dn, global.booleanValue(),
162:                            parent, combine.booleanValue(), xmlByteStreams,
163:                            verbose.booleanValue(), dryrun.booleanValue(),
164:                            logger);
165:
166:                } catch (DPAException dpae) {
167:
168:                    logger.log(Level.SEVERE, "PSDT_CSPDAMB0005"
169:                            + dpae.getOrigEx());
170:                    throw new PSMBeanException(MSG_PREFIX + dpae.getKey(), dpae
171:                            .getOrigEx(), dpae.getTokens());
172:
173:                } finally {
174:                    try {
175:                        for (int i = 0; i < xmlByteStreams.length; i++) {
176:                            xmlByteStreams[i].close();
177:                        }
178:                    } catch (IOException ioe) {
179:                        throw new PSMBeanException(MSG_PREFIX
180:                                + "errorStreamClose", ioe);
181:                    }
182:                }
183:
184:            };
185:
186:            public void dpRemove(String dn, String parent, String name,
187:                    String type, Boolean global, Boolean dryrun, Boolean verbose)
188:                    throws PSMBeanException {
189:
190:                //get the admin dp context  ;
191:                AdminDPContext adpContext = getAdminDPContext();
192:                DPARemove dparemove = new DPARemove();
193:                try {
194:                    dparemove.process(adpContext, dn, global.booleanValue(),
195:                            parent, name, type, verbose.booleanValue(), dryrun
196:                                    .booleanValue(), logger);
197:
198:                } catch (DPAException dpae) {
199:
200:                    logger.log(Level.SEVERE, "PSDT_CSPDAMB0005"
201:                            + dpae.getOrigEx());
202:                    throw new PSMBeanException(MSG_PREFIX + dpae.getKey(), dpae
203:                            .getOrigEx(), dpae.getTokens());
204:
205:                }
206:            };
207:
208:            //-----------------common methods-----------------------------------------------------------------------------//
209:            //utlity method to get Stream of byte arrays
210:            private InputStream[] getXMLInputFromByteArray(
211:                    byte[][] arrayByteArray) {
212:                InputStream[] streams = null;
213:                streams = new InputStream[arrayByteArray.length];
214:                for (int i = 0; i < arrayByteArray.length; i++) {
215:                    streams[i] = new ByteArrayInputStream(arrayByteArray[i]);
216:                }
217:                return streams;
218:            }
219:
220:            //method to get admin dp context
221:            private AdminDPContext getAdminDPContext() throws PSMBeanException {
222:                AdminDPContext adpContext = null;
223:                try {
224:                    DPHelper dpHelper = DPHelper.getDPHelper(
225:                            getPSConfigContext(),
226:                            AdminServerUtil.getSSOToken(), psPortalID);
227:                    adpContext = (AdminDPContext) dpHelper
228:                            .getAdminDPContext(psPortalID);
229:                    adpContext.init(AdminServerUtil.getSSOToken(), null,
230:                            psPortalID);
231:                } catch (DesktopDataException de) {
232:                    logger.log(Level.SEVERE, "PSDT_CSPDAMB0006" + de);
233:                    throw new PSMBeanException(MSG_PREFIX + "errorDesktopData",
234:                            de);
235:                }
236:                return adpContext;
237:            }
238:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.