KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > servicemix > jbi > installation > DummyComponent


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.servicemix.jbi.installation;
18
19 import javax.jbi.JBIException;
20 import javax.jbi.component.Component;
21 import javax.jbi.component.ComponentContext;
22 import javax.jbi.component.ComponentLifeCycle;
23 import javax.jbi.component.ServiceUnitManager;
24 import javax.jbi.management.DeploymentException;
25 import javax.jbi.messaging.MessageExchange;
26 import javax.jbi.servicedesc.ServiceEndpoint;
27 import javax.management.ObjectName JavaDoc;
28
29 import org.w3c.dom.Document JavaDoc;
30 import org.w3c.dom.DocumentFragment JavaDoc;
31
32 public class DummyComponent implements Component, ComponentLifeCycle, ServiceUnitManager {
33
34     private String JavaDoc result;
35     private boolean exception;
36     
37     public DummyComponent() {
38     }
39
40     public ComponentLifeCycle getLifeCycle() {
41         return this;
42     }
43
44     public ServiceUnitManager getServiceUnitManager() {
45         return this;
46     }
47
48     public Document JavaDoc getServiceDescription(ServiceEndpoint endpoint) {
49         return null;
50     }
51
52     public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
53         return false;
54     }
55
56     public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
57         return false;
58     }
59
60     public ServiceEndpoint resolveEndpointReference(DocumentFragment JavaDoc epr) {
61         return null;
62     }
63
64     public ObjectName JavaDoc getExtensionMBeanName() {
65         return null;
66     }
67
68     public void init(ComponentContext context) throws JBIException {
69     }
70
71     public void shutDown() throws JBIException {
72     }
73
74     public void start() throws JBIException {
75     }
76
77     public void stop() throws JBIException {
78     }
79
80     public String JavaDoc deploy(String JavaDoc serviceUnitName, String JavaDoc serviceUnitRootPath) throws DeploymentException {
81         if (exception) {
82             throw new DeploymentException(result);
83         }
84         return result;
85     }
86
87     public void init(String JavaDoc serviceUnitName, String JavaDoc serviceUnitRootPath) throws DeploymentException {
88     }
89
90     public void start(String JavaDoc serviceUnitName) throws DeploymentException {
91     }
92
93     public void stop(String JavaDoc serviceUnitName) throws DeploymentException {
94     }
95
96     public void shutDown(String JavaDoc serviceUnitName) throws DeploymentException {
97     }
98
99     public String JavaDoc undeploy(String JavaDoc serviceUnitName, String JavaDoc serviceUnitRootPath) throws DeploymentException {
100         if (exception) {
101             throw new DeploymentException(result);
102         }
103         return result;
104     }
105
106     public String JavaDoc getResult() {
107         return result;
108     }
109
110     public void setResult(String JavaDoc result) {
111         this.result = result;
112     }
113
114     public boolean isException() {
115         return exception;
116     }
117
118     public void setException(boolean exception) {
119         this.exception = exception;
120     }
121
122 }
123
Popular Tags