Source Code Cross Referenced for Engine1Deployer.java in  » ESB » open-esb » com » sun » jbi » ui » ant » test » engine1 » 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.ant.test.engine1.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:         * @(#)Engine1Deployer.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.ant.test.engine1.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 Engine1Deployer implements  ServiceUnitManager {
043:            /**
044:             * fix it
045:             */
046:            private Engine1Runtime 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 Engine1Deployer(Engine1Runtime 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("ANT_ENGINE1: 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:                            "ANT_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:                            "ANT_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:             * helper method to create XML exception string.
182:             *
183:             * @param compid Component id.
184:             * @param oper operation like deploy or undeploy
185:             * @param status success r failure
186:             * @param loctoken some failure string token like SEQ_300001
187:             * @param locparam parameters for error message.
188:             * @param locmessage error message.
189:             * @param stckTrElem stack trace of exception.
190:             *
191:             * @return XML string.
192:             */
193:            private String createExceptionMessage(String compid, String oper,
194:                    String status, String loctoken, String locparam,
195:                    String locmessage, Throwable exObj) {
196:
197:                String[] locParams = new String[1];
198:                locParams[0] = locparam;
199:
200:                ComponentMessageHolder msgMap = new ComponentMessageHolder(
201:                        "EXCEPTION_MSG");
202:
203:                msgMap.setComponentName(compid);
204:                msgMap.setTaskName(oper);
205:                msgMap.setTaskResult(status);
206:                msgMap.setLocToken(1, loctoken);
207:                msgMap.setLocParam(1, locParams);
208:                msgMap.setLocMessage(1, locmessage);
209:                msgMap.setExceptionObject(exObj);
210:
211:                /*
212:                msgMap.put("COMPONENTID", compid);
213:                msgMap.put("TASKIDENTIFIER", oper);
214:                msgMap.put("TASKRSLTSTATUS", status);
215:                msgMap.put("COMPONENTEXLOCTOKEN", loctoken);
216:                msgMap.put("COMPONENTEXLOCPARAM", locparam);
217:                msgMap.put("COMPONENTEXLOCMESSAGE", locmessage);
218:                msgMap.put("COMPONENTEXSTACKTRACE", sb.toString());
219:                 */
220:
221:                String retMsg = null;
222:
223:                try {
224:                    retMsg = this .mContext.getMgmtMsgBuilder()
225:                            .buildComponentMessage(msgMap);
226:                } catch (Exception e) {
227:                    this .mContext.getLogger().log(Level.INFO,
228:                            "Failed to create Mgmt Msg", e);
229:                }
230:
231:                return retMsg;
232:            }
233:
234:            /**
235:             * Initialize the deployment. This is the first phase of a two-phase
236:             * start, where the component must prepare to receive service requests
237:             * related to the deployment (if any).
238:             * @param serviceUnitName the name of the Service Unit being initialized.
239:             * @param serviceUnitRootPath the full path to the Service Unit artifact
240:             * root directory.
241:             * @throws javax.jbi.management.DeploymentException if the Service Unit is
242:             * not deployed, or is in an incorrect state.
243:             */
244:            public void init(String serviceUnitName, String serviceUnitRootPath)
245:                    throws javax.jbi.management.DeploymentException {
246:            }
247:
248:            /**
249:             * Shut down the deployment. This causes the deployment to return to the
250:             * state it was in after <code>deploy()</code> and before <code>init()</code>.
251:             * @param serviceUnitName the name of the Service Unit being shut down.
252:             * @throws javax.jbi.management.DeploymentException if the Service Unit
253:             * is not deployed, or is in an incorrect state.
254:             */
255:            public void shutDown(String serviceUnitName)
256:                    throws javax.jbi.management.DeploymentException {
257:            }
258:
259:            /**
260:             * Start the deployment. This is the second phase of a two-phase start,
261:             * where the component can now initiate service requests related to the
262:             * deployment.
263:             * @param serviceUnitName the name of the Service Unit being started.
264:             * @throws javax.jbi.management.DeploymentException if the Service Unit
265:             * is not deployed, or is in an incorrect state.
266:             */
267:            public void start(String serviceUnitName)
268:                    throws javax.jbi.management.DeploymentException {
269:            }
270:
271:            /**
272:             * Stop the deployment. This causes the component to cease generating
273:             * service requests related to the deployment. This returns the deployment
274:             * to a state equivalent to after <code>init()</code> was called.
275:             * @param serviceUnitName the name of the Service Unit being stopped.
276:             * @throws javax.jbi.management.DeploymentException if the Service Unit
277:             * is not deployed, or is in an incorrect state.
278:             */
279:            public void stop(String serviceUnitName)
280:                    throws javax.jbi.management.DeploymentException {
281:            }
282:
283:        }
w___w__w_.___j_a_va___2___s_._c_om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.