KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > tools > ant > util > DeploymentServiceMoc


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: JMXPetalsMoc.java 13:56:03 ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.tools.ant.util;
23
24 import javax.management.MBeanServer JavaDoc;
25
26 /**
27  * Moc object of the deployment service
28  *
29  * @author ddesjardins - eBMWebsourcing
30  */

31 public class DeploymentServiceMoc implements DeploymentServiceMocMBean {
32
33     private MBeanServer JavaDoc beanServer;
34
35     private String JavaDoc state = "Shutdown";
36
37     public DeploymentServiceMoc(MBeanServer JavaDoc beanServer) {
38         super();
39         this.beanServer = beanServer;
40         // Used to suppress the warning
41
this.beanServer.getClass();
42     }
43
44     public boolean canDeployToComponent(String JavaDoc arg0) {
45         return false;
46     }
47
48     public String JavaDoc deploy(String JavaDoc arg0) throws Exception JavaDoc {
49         String JavaDoc out = null;
50         if (arg0.indexOf("unsuccess") > -1) {
51             out = "Unsuccessfully deployed\n";
52             out += "<loc-param>foo0002</loc-param>";
53         } else {
54             out = "Successfully\n";
55             out += "<loc-param>foo0002</loc-param>";
56         }
57         return out;
58     }
59
60     public String JavaDoc[] getComponentsForDeployedServiceAssembly(String JavaDoc arg0)
61             throws Exception JavaDoc {
62         return new String JavaDoc[0];
63     }
64
65     public String JavaDoc[] getDeployedServiceAssemblies() throws Exception JavaDoc {
66         return new String JavaDoc[] { "foo0002" };
67     }
68
69     public String JavaDoc[] getDeployedServiceAssembliesForComponent(String JavaDoc arg0)
70             throws Exception JavaDoc {
71         return null;
72     }
73
74     public String JavaDoc[] getDeployedServiceUnitList(String JavaDoc arg0) throws Exception JavaDoc {
75         return null;
76     }
77
78     public String JavaDoc getServiceAssemblyDescriptor(String JavaDoc arg0) throws Exception JavaDoc {
79         return null;
80     }
81
82     public String JavaDoc getState(String JavaDoc arg0) throws Exception JavaDoc {
83         return state;
84     }
85
86     public boolean isDeployedServiceUnit(String JavaDoc arg0, String JavaDoc arg1)
87             throws Exception JavaDoc {
88         return false;
89     }
90
91     public String JavaDoc shutDown(String JavaDoc arg0) throws Exception JavaDoc {
92         String JavaDoc out = "Successfully\n";
93         out += "<loc-param>foo0002</loc-param>";
94         state = "Shutdown";
95         return out;
96     }
97
98     public String JavaDoc start(String JavaDoc arg0) throws Exception JavaDoc {
99         String JavaDoc out = null;
100         if (arg0.indexOf("unsuccess") > -1) {
101             out = "Uncsuccessful start\n";
102         } else {
103             out = "Successfully\n";
104             out += "<loc-param>foo0002</loc-param>";
105             state = "Started";
106         }
107         return out;
108     }
109
110     public String JavaDoc stop(String JavaDoc arg0) throws Exception JavaDoc {
111         String JavaDoc out = "Successfully\n";
112         out += "<loc-param>foo0002</loc-param>";
113         state = "Stopped";
114         return out;
115     }
116
117     public String JavaDoc undeploy(String JavaDoc arg0) throws Exception JavaDoc {
118         String JavaDoc out = "Successfully\n";
119         out += "<loc-param>foo0002</loc-param>";
120         return out;
121     }
122
123 }
124
Popular Tags