KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > clif > analyser > lib > AnalyserImpl


1 /*
2 * CLIF is a Load Injection Framework
3 * Copyright (C) 2003,2004 France Telecom R&D
4 * Copyright (C) 2003 INRIA
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * CLIF $Name: $
21 *
22 * Contact: clif@objectweb.org
23 */

24
25
26 package org.objectweb.clif.analyser.lib;
27
28 import java.util.Iterator JavaDoc;
29 import java.io.Serializable JavaDoc;
30 import org.objectweb.fractal.api.NoSuchInterfaceException;
31 import org.objectweb.fractal.api.Interface;
32 import org.objectweb.clif.storage.api.StorageRead;
33 import org.objectweb.clif.analyser.api.AnalyserControl;
34 import org.objectweb.fractal.api.control.BindingController;
35
36 /**
37  * Supervisor implementation, used to deploy and control test plans among CLIF servers.
38  * It relies on a FractalRMI registry to find Fractal seeds where CLIF servers may be deployed
39  * (the same registry used by Fractal seeds to register themselves).
40  * This class extends the Observable class in order to provide feedback information about the state
41  * of the test plan's blades and the occurrence of alarms.
42  *
43  *
44  * @author Damien Croizer
45  */

46
47
48 public class AnalyserImpl implements AnalyserControl, BindingController
49 {
50
51
52
53     ////////////////////////////////
54
// fields for client bindings //
55
////////////////////////////////
56

57
58
59     /** contains BladeControl Fractal interfaces indexed by their names */
60     private StorageRead srItf;
61
62     /** keeps a cache of all bound client interfaces names (null value means invalidation) */
63     private String JavaDoc[] interfaceNamesCache = null;
64
65
66
67     /////////////////////////////////
68
// interface BindingController //
69
/////////////////////////////////
70

71
72     public Object JavaDoc lookupFc(String JavaDoc clientItfName)
73     {
74         if (clientItfName.equals(StorageRead.STORAGE_READ))
75         {
76             return srItf;
77         }
78         else
79         {
80             return null;
81         }
82     }
83
84
85     public synchronized void bindFc(String JavaDoc clientItfName, Object JavaDoc serverItf)
86     {
87         if (clientItfName.equals(StorageRead.STORAGE_READ))
88         {
89             srItf = (StorageRead) serverItf;
90             interfaceNamesCache = null;
91         }
92     }
93
94
95     public synchronized void unbindFc(String JavaDoc clientItfName)
96     {
97         if (clientItfName.equals(StorageRead.STORAGE_READ))
98         {
99             srItf = null;
100             interfaceNamesCache = null;
101         }
102     }
103
104
105     public synchronized String JavaDoc[] listFc()
106     {
107         if (interfaceNamesCache == null)
108         {
109             interfaceNamesCache = new String JavaDoc[(srItf == null ? 0 : 1)];
110             if (srItf != null)
111             {
112                 interfaceNamesCache[0] = StorageRead.STORAGE_READ;
113             }
114             }
115         return interfaceNamesCache;
116     }
117
118
119
120     ///////////////////////////
121
// interface StorageRead //
122
///////////////////////////
123
//The getView function return all the paramX and all the paramY values
124
//with their respective date since the origin of the test called testId.
125
//all the paramX and all the paramY data are from the injector called nameOfInjector
126
// and notified by the thread numthread between the dates begindate and enddate
127
//nameOfInjector = "all" mean consider all injectors of the test testId
128
//numthread = "-1" mean consider all threads (virtual client) of the the test testId and the injector nameOfInjector
129

130   public void getView(String JavaDoc nameOfTheView,String JavaDoc testId,String JavaDoc nameOfInjector,int numthread,int paramX,int paramY,long begindate, long enddate)
131     {
132     System.out.println("AnalyserImpl\n");
133 // srItf.getView(nameOfTheView,testId,nameOfInjector,numthread,paramX,paramY,begindate,enddate);
134
}
135
136
137
138 }
139
Popular Tags