KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > component > mock > MockEndpointService


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: MockEndpointService.java 12:19:04 PM ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.jbi.component.mock;
23
24 import javax.jbi.JBIException;
25 import javax.jbi.messaging.MessageExchange;
26 import javax.jbi.servicedesc.ServiceEndpoint;
27 import javax.xml.namespace.QName JavaDoc;
28
29 import org.objectweb.fractal.api.NoSuchInterfaceException;
30 import org.objectweb.fractal.api.control.IllegalBindingException;
31 import org.objectweb.fractal.api.control.IllegalLifeCycleException;
32 import org.objectweb.petals.jbi.management.service.EndpointService;
33 import org.objectweb.petals.jbi.registry.AbstractEndpoint;
34 import org.objectweb.petals.jbi.registry.ConsumerEndpoint;
35 import org.objectweb.petals.jbi.registry.InternalEndpoint;
36 import org.w3c.dom.Document JavaDoc;
37
38 /**
39  * Mock object of the EndpointService
40  *
41  * @author ddesjardins - eBMWebsourcing
42  * @author wjoseph - eBMWebsourcing
43  */

44 public class MockEndpointService implements EndpointService {
45
46     private boolean deactivateEndpoint;
47
48     private boolean deregisterInternalEndpoint;
49
50     private boolean deregisterExternalEndpoint;
51
52     private boolean getEndpoint;
53
54     private boolean getInternalEndpointsForInterface;
55
56     private boolean getInternalEndpointsForService;
57
58     private boolean getExternalEndpointsForInterface;
59
60     private boolean getExternalEndpointsForService;
61
62     private boolean registerExternalEndpoint;
63
64     public InternalEndpoint activateEndpoint(QName JavaDoc serviceName,
65         String JavaDoc endpointName, ConsumerEndpoint address) throws JBIException {
66         return new InternalEndpoint(serviceName, endpointName, "compo", "0",
67             this);
68     }
69
70     public void bindFc(String JavaDoc arg0, Object JavaDoc arg1)
71         throws NoSuchInterfaceException, IllegalBindingException,
72         IllegalLifeCycleException {
73     }
74
75     public void createConnection(QName JavaDoc consInterface, QName JavaDoc provService, String JavaDoc provEndpoint) throws JBIException {
76     }
77
78     public void createConnection(QName JavaDoc consService, String JavaDoc consEndpoint, QName JavaDoc provService, String JavaDoc provEndpoint) throws JBIException {
79         throw new JBIException("createConnection testing exception");
80     }
81
82     public void deactivateEndpoint(ServiceEndpoint endpoint)
83         throws JBIException {
84         deactivateEndpoint = true;
85     }
86
87     public void deleteConnection(QName JavaDoc consInterface, QName JavaDoc provService, String JavaDoc provEndpoint) throws JBIException {
88     }
89
90     public void deleteConnection(QName JavaDoc consService, String JavaDoc consEndpoint, QName JavaDoc provService, String JavaDoc provEndpoint) throws JBIException {
91     }
92
93     public void deregisterExternalEndpoint(ServiceEndpoint endpoint)
94         throws JBIException {
95         deregisterExternalEndpoint = true;
96     }
97
98     public void deregisterInternalEndpoint(ServiceEndpoint endpoint)
99         throws JBIException {
100         deregisterInternalEndpoint = true;
101     }
102
103     public ServiceEndpoint getEndpoint(QName JavaDoc service, String JavaDoc name) {
104         getEndpoint = true;
105         return null;
106     }
107
108     public ServiceEndpoint getEndpoint(QName JavaDoc service, String JavaDoc name, boolean resolve) {
109         getEndpoint = true;
110         return null;
111     }
112     
113     public Document JavaDoc getEndpointDescriptorForEndpoint(ServiceEndpoint endpoint) {
114         return null;
115     }
116
117     public ServiceEndpoint[] getExternalEndpointsForInterface(
118         QName JavaDoc interfaceName) {
119         getExternalEndpointsForInterface = true;
120         return new ServiceEndpoint[]{};
121     }
122
123     public ServiceEndpoint[] getExternalEndpointsForService(QName JavaDoc serviceName) {
124         getExternalEndpointsForService = true;
125         return new ServiceEndpoint[]{};
126     }
127
128     public String JavaDoc getFcState() {
129         return null;
130     }
131
132     public QName JavaDoc[] getInterfacesForEndpoint(AbstractEndpoint endpoint) {
133         return null;
134     }
135
136     public AbstractEndpoint getInternalEndpoint(QName JavaDoc service, String JavaDoc name) {
137         return null;
138     }
139
140     public ServiceEndpoint[] getInternalEndpointsForInterface(
141         QName JavaDoc interfaceName) {
142         getInternalEndpointsForInterface = true;
143         return new ServiceEndpoint[]{};
144     }
145
146     public ServiceEndpoint[] getInternalEndpointsForService(QName JavaDoc serviceName) {
147         getInternalEndpointsForService = true;
148         return new ServiceEndpoint[]{};
149     }
150
151     public boolean isContainerStarted(AbstractEndpoint endpoint) {
152         return false;
153     }
154
155     public boolean isDeactivateEndpoint() {
156         return deactivateEndpoint;
157     }
158
159     public boolean isDeregisterExternalEndpoint() {
160         return deregisterExternalEndpoint;
161     }
162
163     public boolean isDeregisterInternalEndpoint() {
164         return deregisterInternalEndpoint;
165     }
166
167     public boolean isExchangeWithConsumerOkayForComponent(InternalEndpoint internalEndpoint, MessageExchange exchange) {
168         return false;
169     }
170
171     public boolean isExchangeWithConsumerOkayForComponent(String JavaDoc componentName,
172         InternalEndpoint internalEndpoint, MessageExchange exchange) {
173         return false;
174     }
175
176     public boolean isExchangeWithProviderOkayForComponent(InternalEndpoint internalEndpoint, MessageExchange exchange) {
177         return false;
178     }
179
180     public boolean isExchangeWithProviderOkayForComponent(String JavaDoc componentName,
181         InternalEndpoint internalEndpoint, MessageExchange exchange) {
182         return false;
183     }
184
185     public boolean isGetEndpoint() {
186         return getEndpoint;
187     }
188
189     public boolean isGetExternalEndpointsForInterface() {
190         return getExternalEndpointsForInterface;
191     }
192
193     public boolean isGetExternalEndpointsForService() {
194         return getExternalEndpointsForService;
195     }
196
197     public boolean isGetInternalEndpointsForInterface() {
198         return getInternalEndpointsForInterface;
199     }
200
201     public boolean isGetInternalEndpointsForService() {
202         return getInternalEndpointsForService;
203     }
204
205     public boolean isRegisterExternalEndpoint() {
206         return registerExternalEndpoint;
207     }
208
209     public String JavaDoc[] listFc() {
210         return null;
211     }
212
213     public Object JavaDoc lookupFc(String JavaDoc arg0) throws NoSuchInterfaceException {
214         return null;
215     }
216
217     public void registerExternalEndpoint(ServiceEndpoint externalEndpoint)
218         throws JBIException {
219         registerExternalEndpoint = true;
220     }
221
222     public void setDeactivateEndpoint(boolean deactivateEndpoint) {
223         this.deactivateEndpoint = deactivateEndpoint;
224     }
225
226     public void setDeregisterExternalEndpoint(boolean deregisterExternalEndpoint) {
227         this.deregisterExternalEndpoint = deregisterExternalEndpoint;
228     }
229
230     public void setDeregisterInternalEndpoint(boolean deregisterInternalEndpoint) {
231         this.deregisterInternalEndpoint = deregisterInternalEndpoint;
232     }
233
234     public void setGetEndpoint(boolean getEndpoint) {
235         this.getEndpoint = getEndpoint;
236     }
237
238     public void setGetExternalEndpointsForInterface(
239         boolean getExternalEndpointsForInterface) {
240         this.getExternalEndpointsForInterface = getExternalEndpointsForInterface;
241     }
242
243     public void setGetExternalEndpointsForService(
244         boolean getExternalEndpointsForService) {
245         this.getExternalEndpointsForService = getExternalEndpointsForService;
246     }
247
248     public void setGetInternalEndpointsForInterface(
249         boolean getInternalEndpointsForInterface) {
250         this.getInternalEndpointsForInterface = getInternalEndpointsForInterface;
251     }
252
253     public void setGetInternalEndpointsForService(
254         boolean getInternalEndpointsForService) {
255         this.getInternalEndpointsForService = getInternalEndpointsForService;
256     }
257
258     public void setRegisterExternalEndpoint(boolean registerExternalEndpoint) {
259         this.registerExternalEndpoint = registerExternalEndpoint;
260     }
261
262     public void startFc() throws IllegalLifeCycleException {
263     }
264
265     public void stopFc() throws IllegalLifeCycleException {
266     }
267
268     public void unbindFc(String JavaDoc arg0) throws NoSuchInterfaceException,
269         IllegalBindingException, IllegalLifeCycleException {
270     }
271
272 }
273
Popular Tags