KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > component > lifecycle > mock > ServiceUnitMock


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: ServiceUnitMock.java 11:40:31 ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.jbi.component.lifecycle.mock;
23
24 import javax.jbi.JBIException;
25 import javax.jbi.component.ComponentContext;
26 import javax.jbi.component.ComponentLifeCycle;
27 import javax.management.ObjectName JavaDoc;
28
29 import org.objectweb.petals.tools.jbicommon.descriptor.Identification;
30 import org.objectweb.petals.tools.jbicommon.descriptor.ServiceUnit;
31
32 /**
33  * Mock object of the ServiceUnit
34  *
35  * @author ddesjardins - eBMWebsourcing
36  */

37 public class ServiceUnitMock extends ServiceUnit implements ComponentLifeCycle {
38
39     private String JavaDoc state = "Shutdown";
40
41     private String JavaDoc targetArtifactsZip;
42
43     public String JavaDoc getTargetArtifactsZip() {
44         return targetArtifactsZip;
45     }
46
47     public void setTargetArtifactsZip(String JavaDoc targetArtifactsZip) {
48         this.targetArtifactsZip = targetArtifactsZip;
49     }
50
51     public ServiceUnitMock() {
52         super();
53     }
54
55     private Identification identification;
56
57     private String JavaDoc targetComponentName;
58
59     public void setIdentification(Identification identification) {
60         this.identification = identification;
61     }
62
63     public void setTargetComponentName(String JavaDoc targetComponentName) {
64         this.targetComponentName = targetComponentName;
65     }
66
67     public ObjectName JavaDoc getExtensionMBeanName() {
68         return null;
69     }
70
71     public void init(ComponentContext context) throws JBIException {
72     }
73
74     public void shutDown() throws JBIException {
75         state = "Shutdown";
76     }
77
78     public void start() throws JBIException {
79         state = "Started";
80     }
81
82     public void stop() throws JBIException {
83         state = "Stopped";
84     }
85
86     public String JavaDoc getState() {
87         return state;
88     }
89
90     public Identification getIdentification() {
91         return identification;
92     }
93
94     public String JavaDoc getTargetComponentName() {
95         return targetComponentName;
96     }
97
98     public void setState(String JavaDoc state) {
99         this.state = state;
100     }
101
102 }
103
Popular Tags