KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > servicemix > beanflow > ProxyActivity


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.beanflow;
18
19 import java.util.Timer JavaDoc;
20 import java.util.concurrent.TimeUnit JavaDoc;
21
22 /**
23  * A simple proxy to an underlying activity making it easy to compose activities
24  * together
25  *
26  * @version $Revision: $
27  */

28 public class ProxyActivity implements Activity {
29
30     private Activity proxy;
31
32     public ProxyActivity(Activity proxy) {
33         this.proxy = proxy;
34     }
35
36     public void fail(String JavaDoc reason) {
37         getProxy().fail(reason);
38     }
39
40     public String JavaDoc getFailedReason() {
41         return getProxy().getFailedReason();
42     }
43
44     public Throwable JavaDoc getFailedException() {
45         return getProxy().getFailedException();
46     }
47
48     public State<Transitions> getState() {
49         return getProxy().getState();
50     }
51
52     public boolean isFailed() {
53         return getProxy().isFailed();
54     }
55
56     public boolean isStopped() {
57         return getProxy().isStopped();
58     }
59
60     public void start() {
61         getProxy().start();
62     }
63
64     public void startWithTimeout(Timer JavaDoc timer, long timeout) {
65         getProxy().startWithTimeout(timer, timeout);
66     }
67
68     public void stop() {
69         getProxy().stop();
70     }
71
72     public void onFailure(Runnable JavaDoc runnable) {
73         getProxy().onFailure(runnable);
74     }
75
76     public void onStop(Runnable JavaDoc runnable) {
77         getProxy().onStop(runnable);
78     }
79
80     public void join() {
81         getProxy().join();
82     }
83     
84     public boolean join(int time, TimeUnit JavaDoc unit) {
85         return getProxy().join(time, unit);
86     }
87
88     protected Activity getProxy() {
89         return proxy;
90     }
91
92     protected void setProxy(Activity proxy) {
93         this.proxy = proxy;
94     }
95 }
96
Popular Tags