KickJava   Java API By Example, From Geeks To Geeks.

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


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

23
24
25 package org.objectweb.clif.analyser.lib;
26
27 import java.io.*;
28 import org.objectweb.clif.storage.api.StorageRead;
29 import org.objectweb.clif.storage.api.ActionEvent;
30 import org.objectweb.clif.analyser.Concat;
31 import java.util.*;
32
33
34 /**
35  * Overrides the collect() method of the basic ConsoleFileStorage class, in order to
36  * build an archive.clif file holding the all events.
37  * Implements the StorageRead interface.
38  *
39  * @author Bruno Dillenseger
40  * @author Damien Croizer
41  */

42 public class ConsoleFileStorageImpl
43     extends org.objectweb.clif.storage.lib.filestorage.ConsoleFileStorageImpl
44     implements StorageRead
45 {
46     ////////////////////////////
47
// interface StorageAdmin //
48
////////////////////////////
49

50
51     public void collect()
52     {
53         super.collect();
54         try
55         {
56             makeArchive();
57         }
58         catch (Exception JavaDoc ex)
59         {
60             throw new RuntimeException JavaDoc("Could not make the archive.clif file", ex);
61         }
62     }
63
64
65     /**
66      * Terminate the collect operation by merging all data from the test in the archive.clif file
67      *
68      */

69     private void makeArchive()
70     {
71         String JavaDoc[] names = new String JavaDoc[100];
72         Vector files = new Vector() ;
73         int max = 10000000; //here for a 3 hour test the date max in testplan.txt
74
String JavaDoc homeDir = testDirbase + File.separator + testId + File.separator;
75         names = new File(homeDir).list();
76         for(int i=0; i<names.length; i++)
77         {
78             String JavaDoc filename = homeDir + names[i] + File.separator + ActionEvent.EVENT_TYPE_LABEL;
79             if (new File(filename).exists())
80             {
81                 files.add(filename);
82             }
83         }
84         String JavaDoc out = homeDir + "archive.clif";
85         Concat concat = new Concat(files, max, out) ;
86         concat.concatAllFiles() ;
87     }
88
89
90     ////////////////////////////
91
// interface StorageRead //
92
////////////////////////////
93

94
95     /**
96      * The getView function return all the paramX and all the paramY values
97      * with their respective date since the origin of the test called testId.
98      * all the paramX and all the paramY data are from the injector called nameOfInjector
99      * and notified by the thread numthread between the dates begindate and enddate
100      * @param nameOfTheView
101      * @param testId
102      * @param nameOfInjector = "all" mean consider all injectors of the test testId
103      * @param numthread = "-1" mean consider all threads (virtual client) of the the test testId and the injector nameOfInjector
104      * @param paramX = the parameter that will be on the X axis of the graph
105      * @param paramY = the parameter that will be on the Y axis of the graph
106      * @param begindate
107      * @param enddate
108      */

109     public void getView(String JavaDoc nameOfTheView,String JavaDoc testId,String JavaDoc nameOfInjector,int numthread,int paramX,int paramY,long begindate, long enddate)
110     {
111         //for this time only local analysis is provide. sorry
112
}
113 }
114
Popular Tags