Source Code Cross Referenced for Engine4Deployer.java in  » ESB » open-esb » com » sun » jbi » ui » cli » test » engine4 » rt » 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 » ESB » open esb » com.sun.jbi.ui.cli.test.engine4.rt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)Engine4Deployer.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.ui.cli.test.engine4.rt;
030:
031:        import com.sun.jbi.management.ComponentMessageHolder;
032:        import java.util.HashMap;
033:        import java.util.Map;
034:        import java.util.logging.Level;
035:        import javax.jbi.component.ServiceUnitManager;
036:        import javax.jbi.management.DeploymentException;
037:
038:        /**
039:         * fix it
040:         * @author Sun Microsystems, Inc.
041:         */
042:        public class Engine4Deployer implements  ServiceUnitManager {
043:            /**
044:             * fix it
045:             */
046:            private Engine4Runtime mContext;
047:            /**
048:             * fix it
049:             */
050:            private Map mDeployMap;
051:
052:            /**
053:             * Creates a new instance of Binding1Deployer
054:             * @param ctx fix it
055:             */
056:            public Engine4Deployer(Engine4Runtime ctx) {
057:                this .mDeployMap = new HashMap();
058:
059:                this .mContext = ctx;
060:
061:            }
062:
063:            /**
064:             * fix it
065:             * @param asaId fix it
066:             * @param asaJarPath fix it
067:             * @throws DeploymentException fix it
068:             * @return fix it
069:             */
070:            public String deploy(String asaId, String asaJarPath)
071:                    throws DeploymentException {
072:                // this.mContext.getLogger().log(Level.INFO, "");
073:                System.out.println("cli_ENGINE4: Deploying " + asaId);
074:
075:                String asaInfo = (String) this .mDeployMap.get(asaId);
076:                if (asaInfo != null) {
077:                    // throw already exists
078:                    String exMsg = createExceptionMessage(
079:                            this .mContext.getId(), "deploy", "FAILED",
080:                            "cli_E1_0001", asaId, "ASA " + asaId
081:                                    + " Already Exists", null);
082:                    throw new DeploymentException(exMsg);
083:                } else {
084:                    this .mDeployMap.put(asaId, asaJarPath);
085:                    // return "Deployed " + asaId;
086:                    try {
087:                        ComponentMessageHolder compMsgHolder = new ComponentMessageHolder(
088:                                "STATUS_MSG");
089:                        compMsgHolder.setComponentName(this .mContext.getId());
090:                        compMsgHolder.setTaskName("deploy");
091:                        compMsgHolder.setTaskResult("SUCCESS");
092:
093:                        return this .mContext.getMgmtMsgBuilder()
094:                                .buildComponentMessage(compMsgHolder);
095:
096:                        /*
097:                        return this.mContext.getMgmtMsgBuilder().buildComponentTaskStatusMessage(
098:                        this.mContext.getId(),
099:                        "deploy","SUCCESS", null
100:                        );
101:                         */
102:                    } catch (Exception ex) {
103:                        ex.printStackTrace();
104:                        return null;
105:                    }
106:
107:                }
108:            }
109:
110:            /**
111:             * fix it
112:             * @param asaId fix it
113:             * @return fix it
114:             */
115:            public String getDeploymentInfo(String asaId) {
116:                // Should throw exception if asaId not exists
117:                return (String) this .mDeployMap.get(asaId);
118:            }
119:
120:            /**
121:             * fix it
122:             * @return fix it
123:             */
124:            public String[] getDeployments() {
125:                return (String[]) this .mDeployMap.keySet().toArray(
126:                        new String[0]);
127:            }
128:
129:            /**
130:             * fix it
131:             * @param asaId fix it
132:             * @return fix it
133:             */
134:            public boolean isDeployed(String asaId) {
135:                return (this .mDeployMap.get(asaId) != null);
136:            }
137:
138:            /**
139:             * fix it
140:             * @param asaId fix it
141:             * @throws DeploymentException fix it
142:             * @return fix it
143:             */
144:            public String undeploy(String asaId, String asaJarPath)
145:                    throws DeploymentException {
146:                String asaInfo = (String) this .mDeployMap.remove(asaId);
147:                if (asaInfo == null) {
148:                    // throw exception
149:                    String exMsg = createExceptionMessage(
150:                            this .mContext.getId(), "undeploy", "FAILED",
151:                            "cli_E1_0002", asaId, "ASA with " + asaId
152:                                    + " Not Found", null);
153:                    throw new DeploymentException(exMsg);
154:                } else {
155:                    // return "Undeployed " + asaId;
156:                    try {
157:                        ComponentMessageHolder compMsgHolder = new ComponentMessageHolder(
158:                                "STATUS_MSG");
159:                        compMsgHolder.setComponentName(this .mContext.getId());
160:                        compMsgHolder.setTaskName("undeploy");
161:                        compMsgHolder.setTaskResult("SUCCESS");
162:
163:                        return this .mContext.getMgmtMsgBuilder()
164:                                .buildComponentMessage(compMsgHolder);
165:
166:                        /*
167:                        return this.mContext.getMgmtMsgBuilder().buildComponentTaskStatusMessage(
168:                        this.mContext.getId(),
169:                        "undeploy","SUCCESS", null
170:                        );
171:                         */
172:                    } catch (Exception ex) {
173:                        ex.printStackTrace();
174:                        return null;
175:                    }
176:
177:                }
178:            }
179:
180:            /**
181:             * Initialize the deployment. This is the first phase of a two-phase
182:             * start, where the component must prepare to receive service requests
183:             * related to the deployment (if any).
184:             * @param serviceUnitName the name of the Service Unit being initialized.
185:             * @param serviceUnitRootPath the full path to the Service Unit artifact
186:             * root directory.
187:             * @throws javax.jbi.management.DeploymentException if the Service Unit is
188:             * not deployed, or is in an incorrect state.
189:             */
190:            public void init(String serviceUnitName, String serviceUnitRootPath)
191:                    throws javax.jbi.management.DeploymentException {
192:            }
193:
194:            /**
195:             * Shut down the deployment. This causes the deployment to return to the
196:             * state it was in after <code>deploy()</code> and before <code>init()</code>.
197:             * @param serviceUnitName the name of the Service Unit being shut down.
198:             * @throws javax.jbi.management.DeploymentException if the Service Unit
199:             * is not deployed, or is in an incorrect state.
200:             */
201:            public void shutDown(String serviceUnitName)
202:                    throws javax.jbi.management.DeploymentException {
203:            }
204:
205:            /**
206:             * Start the deployment. This is the second phase of a two-phase start,
207:             * where the component can now initiate service requests related to the
208:             * deployment.
209:             * @param serviceUnitName the name of the Service Unit being started.
210:             * @throws javax.jbi.management.DeploymentException if the Service Unit
211:             * is not deployed, or is in an incorrect state.
212:             */
213:            public void start(String serviceUnitName)
214:                    throws javax.jbi.management.DeploymentException {
215:            }
216:
217:            /**
218:             * Stop the deployment. This causes the component to cease generating
219:             * service requests related to the deployment. This returns the deployment
220:             * to a state equivalent to after <code>init()</code> was called.
221:             * @param serviceUnitName the name of the Service Unit being stopped.
222:             * @throws javax.jbi.management.DeploymentException if the Service Unit
223:             * is not deployed, or is in an incorrect state.
224:             */
225:            public void stop(String serviceUnitName)
226:                    throws javax.jbi.management.DeploymentException {
227:            }
228:
229:            /**
230:             * helper method to create XML exception string.
231:             *
232:             * @param compid Component id.
233:             * @param oper operation like deploy or undeploy
234:             * @param status success r failure
235:             * @param loctoken some failure string token like SEQ_300001
236:             * @param locparam parameters for error message.
237:             * @param locmessage error message.
238:             * @param stckTrElem stack trace of exception.
239:             *
240:             * @return XML string.
241:             */
242:            private String createExceptionMessage(String compid, String oper,
243:                    String status, String loctoken, String locparam,
244:                    String locmessage, Throwable exObj) {
245:
246:                String[] locParams = new String[1];
247:                locParams[0] = locparam;
248:
249:                ComponentMessageHolder msgMap = new ComponentMessageHolder(
250:                        "EXCEPTION_MSG");
251:
252:                msgMap.setComponentName(compid);
253:                msgMap.setTaskName(oper);
254:                msgMap.setTaskResult(status);
255:                msgMap.setLocToken(1, loctoken);
256:                msgMap.setLocParam(1, locParams);
257:                msgMap.setLocMessage(1, locmessage);
258:                msgMap.setExceptionObject(exObj);
259:
260:                /*
261:                msgMap.put("COMPONENTID", compid);
262:                msgMap.put("TASKIDENTIFIER", oper);
263:                msgMap.put("TASKRSLTSTATUS", status);
264:                msgMap.put("COMPONENTEXLOCTOKEN", loctoken);
265:                msgMap.put("COMPONENTEXLOCPARAM", locparam);
266:                msgMap.put("COMPONENTEXLOCMESSAGE", locmessage);
267:                msgMap.put("COMPONENTEXSTACKTRACE", sb.toString());
268:                 */
269:
270:                String retMsg = null;
271:
272:                try {
273:                    retMsg = this .mContext.getMgmtMsgBuilder()
274:                            .buildComponentMessage(msgMap);
275:                } catch (Exception e) {
276:                    this .mContext.getLogger().log(Level.INFO,
277:                            "Failed to create Mgmt Msg", e);
278:                }
279:
280:                return retMsg;
281:            }
282:
283:        }
www_.__j___a___v__a__2__s___.c__o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.