KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > samplers > RemoteSampleListenerImpl


1 // $Header: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java,v 1.7 2004/02/13 02:40:53 sebb Exp $
2
/*
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * 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 */

18
19 package org.apache.jmeter.samplers;
20
21 import java.rmi.RemoteException JavaDoc;
22
23 import org.apache.jmeter.engine.event.LoopIterationEvent;
24 import org.apache.jmeter.testelement.TestListener;
25
26 /**
27  * @version $Revision: 1.7 $
28  */

29 public class RemoteSampleListenerImpl
30     extends java.rmi.server.UnicastRemoteObject JavaDoc
31     implements RemoteSampleListener, SampleListener, TestListener
32 {
33     TestListener testListener;
34     SampleListener sampleListener;
35
36     public RemoteSampleListenerImpl() throws RemoteException JavaDoc
37     {
38         super();
39     }
40
41     public void setListener(Object JavaDoc listener)
42     {
43         if (listener instanceof TestListener)
44         {
45             testListener = (TestListener) listener;
46         }
47         if (listener instanceof SampleListener)
48         {
49             sampleListener = (SampleListener) listener;
50         }
51     }
52
53     public RemoteSampleListenerImpl(Object JavaDoc listener) throws RemoteException JavaDoc
54     {
55         super();
56         setListener(listener);
57     }
58
59     public void testStarted()
60     {
61         if (testListener != null)
62         {
63             testListener.testStarted();
64         }
65     }
66
67     public void testStarted(String JavaDoc host)
68     {
69         if (testListener != null)
70         {
71             testListener.testStarted(host);
72         }
73     }
74
75     public void testEnded()
76     {
77         if (testListener != null)
78         {
79             testListener.testEnded();
80         }
81     }
82
83     public void testEnded(String JavaDoc host)
84     {
85         if (testListener != null)
86         {
87             testListener.testEnded(host);
88         }
89     }
90
91     public void sampleOccurred(SampleEvent e)
92     {
93         if (sampleListener != null)
94         {
95             sampleListener.sampleOccurred(e);
96         }
97     }
98
99     /**
100      * A sample has started.
101      */

102     public void sampleStarted(SampleEvent e)
103     {
104         if (sampleListener != null)
105         {
106             sampleListener.sampleStarted(e);
107         }
108     }
109
110     /**
111      * A sample has stopped.
112      */

113     public void sampleStopped(SampleEvent e)
114     {
115         if (sampleListener != null)
116         {
117             sampleListener.sampleStopped(e);
118         }
119     }
120     
121     /* (non-Javadoc)
122      * @see TestListener#testIterationStart(LoopIterationEvent)
123      */

124     public void testIterationStart(LoopIterationEvent event)
125     {
126     }
127 }
128
Popular Tags