Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: cor/gui/JspmCoreDb.java


1   /*-----------------------------------------------------------------------------------------------------*/
2   /*                                                                                                     */
3   /*  Copyright (C)                                                                                      */
4   /*                                                                                                     */
5   /*  This program is free software; you can redistribute it and/or modify it under the terms of the GNU */
6   /*  General Public License as published by the Free Software Foundation; either version 2 of the       */
7   /*  License, or (at your option) any later version.                                                    */
8   /*                                                                                                     */
9   /*  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;          */
10  /*  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR                   */
11  /*  PURPOSE. See the GNU General Public License for more details.                                      */
12  /*                                                                                                     */
13  /*  You should have received a copy of the GNU General Public License along with this program; if      */
14  /*  not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA           */
15  /*  02111-1307 USA                                                                                     */
16  /*                                                                                                     */
17  /*-----------------------------------------------------------------------------------------------------*/
18  /*                                                                                                     */
19  /*  $Author: strand01 $ $Revision: 1.3 $ $Date: 2001/12/20 14:23:01 $                                  */
20  /*                                                                                                     */
21  /*-----------------------------------------------------------------------------------------------------*/
22  
23  package cor.gui;
24  
25  // Java classes
26  import java.io.*;
27  import java.util.*;
28  import java.sql.*;
29  import java.net.*;
30  
31  // JSPM classes
32  import com.jdk.*;
33  import cor.gui.evt.*;
34  import cor.gui.clp.*;
35  import cor.gui.obj.*;
36  
37  /**
38   * This program defines the connection to the performance management database. It
39   * includes all the methods to create/delete/update performance data records in the 
40   * Jspm performance management database.
41   *
42   * Each implementation has to define all methods described in this interface.
43   *
44   * @author  Steve Randall (strand012001@yahoo.com)
45   * @version 0.0.8
46   * @date 31/10/2001
47   */
48  public interface JspmCoreDb
49  {    
50      /**
51       * Connects to the performance managment database on the specified host.
52       *
53       * @param db (String) db to connect to.
54       * @param host (String) host name of the database host.
55       * @param user (String) DB user.
56       * @param passwd (String) DB user password.
57       * @return connected (boolean) whether we could connect ot not.
58       */
59      public boolean connect( String host, String user, String passwd );
60      
61      /**
62       * Returns the actual database connection.
63       */
64      public Connection getConnection();
65      
66      /**
67       * Closes the DB connection.
68       */
69      public void close();
70      
71      /**
72       * Return a vector of DB servers.
73       */
74      public Vector getServer();
75          
76     /**
77       * Returns the data base type
78       */
79      public int getDbType();     
80  
81  /***************************************************************************************************************
82   *
83   * Performance Management
84   *
85   ***************************************************************************************************************/
86  
87      /**
88       * Returns the total number of sponsors.
89       * 
90       * @return count (int) number of sponsors.
91       */
92      public int getPrfSponsorCount();
93  
94      /**
95       * Return a vector of sponsors definitions.
96       * 
97       * @return sponsors (Vector) all sponsor definitions.
98       */
99      public Vector getPrfHosts();
100 
101     /**
102      * Return a vector of sponsors definitions.
103      * 
104      * @return sponsors (Vector) all sponsor definitions.
105      */
106     public Vector getPrfResource( String hostName );
107 
108     /**
109      * Return a vector of sponsors definitions.
110      * 
111      * @return sponsors (Vector) all sponsor definitions.
112      */
113     public Vector getPrfSubresource( String hostName, String resource );
114 
115     /**
116      * Return a vector of sponsors definitions.
117      * 
118      * @return sponsors (Vector) all sponsor definitions.
119      */
120     public Vector getPrfInstance( String hostName, String resource, String subresource );
121 
122     /**
123      * Return a vector of sponsors definitions.
124      * 
125      * @param host (String) host name.
126      * @param resource (String) resource name.
127      * @param subResource (String) sub resource name.
128      * @param instance (String) instance name.
129      * @return sponsors (Vector) specified sponsor definitions.
130      */
131     public Hashtable getPerfSponsor( String host, String resource, String subresource, String instance );
132 
133     /**
134      * Return a vector daily performance data. Each record is represented as as Hashtable.
135      *
136      * @param host (String) host name.
137      * @param resource (String) resource name.
138      * @param subResource (String) sub resource name.
139      * @param instance (String) instance name.
140      * @param diff (int) difference between today and data offset.
141      * @return data (Vector) daily sponsor data.
142      */
143     public Vector getDailyPerfData( String host, String resource, String subResource, String instance, int diff );
144     
145     /**
146      * Return a vector weekly performance data. Each record is represented as as Hashtable.
147      *
148      * @param host (String) host name.
149      * @param resource (String) resource name.
150      * @param subResource (String) sub resource name.
151      * @param instance (String) instance name.
152      * @param diff (int) difference between today and data offset.
153      * @return data (Vector) daily sponsor data.
154      */
155     public Vector getWeeklyPerfData( String host, String resource, String subResource, String instance, int diff );
156     
157     /**
158      * Return a vector monthly performance data. Each record is represented as as Hashtable.
159      *
160      * @param host (String) host name.
161      * @param resource (String) resource name.
162      * @param subResource (String) sub resource name.
163      * @param instance (String) instance name.
164      * @param diff (int) difference between today and data offset.
165      * @return data (Vector) daily sponsor data.
166      */
167     public Vector getMonthlyPerfData( String host, String resource, String subResource, String instance, int diff );
168     
169     /**
170      * Return a vector monthly performance data. Each record is represented as as Hashtable.
171      *
172      * @param host (String) host name.
173      * @param resource (String) resource name.
174      * @param subResource (String) sub resource name.
175      * @param instance (String) instance name.
176      * @param diff (int) difference between today and data offset.
177      * @return data (Vector) daily sponsor data.
178      */
179     public Vector getYearlyPerfData( String host, String resource, String subResource, String instance, int diff );
180     
181     /**
182      * Deletes a sponsor definition.
183      *
184      * @param host (String) host name.
185      * @param resource (String) resource name.
186      * @param subResource (String) sub resource name.
187      * @param instance (String) instance name.
188      */
189     public void deleteSponsor( String host, String resource, String subResource, String instance );
190 
191     /**
192      * Get the thresholds for a sponsor.
193      *
194      * @param host (String) host name.
195      * @param resource (String) resource name.
196      * @param subResource (String) sub resource name.
197      * @param instance (String) instance name.
198      */
199     public Hashtable getThresholds( String host, String resource, String subResource, String instance );
200 
201 /***************************************************************************************************************
202  *
203  * Event Management
204  *
205  ***************************************************************************************************************/
206 
207     /**
208      * Return a vector of messages. Each record is represented as as Hashtable.
209      */
210     public Vector getMessages();
211 
212     /**
213      * Returns a vector of group names.
214      *
215      * @return groups (Vector) group vector.
216      */
217     public Vector getEvtGroups();
218 
219     /**
220      * Return a vector of messages from a certain group. Each record is represented as as Hashtable.
221      *
222      * @param group (String) group name.
223      */
224     public Vector getMessages( String group );
225 
226     /**
227      * Returns a message  with a certain msgid as hashtable.
228      *
229      * @param msgid (int) message id.
230      * @return msg (JspmEvtMessage) message record.
231      */
232     public JspmEvtMessage getMessage( int msgid );
233 
234     /**
235      * Write a file with all messages and the corresponding actions to a file belonging
236      * to the specified message group to a file.
237      *
238      * @since 0.0.2
239      * @param file (File) file to write to.
240      * @param msggroup (String) message group.
241      */
242     public void saveMessages( File file, String msggroup );
243 
244     /**
245      * Updates a message in the DB
246      *
247      * @param msg (JspmEvtMessage) message to be updated.
248      */
249     public void updateMessage( JspmEvtMessage msg );
250 
251     /**
252      * Adds a message to the database.
253      *
254      * @param msg (JspmEvtMessage) message to add.
255      */
256     public void addMessage( JspmEvtMessage msg );
257 
258     /**
259      * Return a vector of actions. Each record is represented as as Hashtable.
260      */
261     public Vector getActions();
262 
263     /**
264      * Return a vector of actions from a certain group. Each record is represented as as Hashtable.
265      *
266      * @param group (String) group name.
267      * @return actions (Vector) Vector of actions. Each element is a Hashtable.
268      */
269     public Vector getActions( String group );
270 
271     /**
272      * Return a vector of actions belonginf to a specified message ID. Each record is represented as as Hashtable.
273      *
274      * @param msgid (msgid) message ID.
275      * @return actions (Vector) Vector of actions. Each element is a Hashtable.
276      */
277     public Vector getActions( int msgid );
278 
279     /**
280      * Returns a action with a certain actid as hashtable.
281      *
282      * @param actid (int) action id
283      * @return act (JspmEvtAction) action record.
284      */
285     public JspmEvtAction getAction( int actid );
286 
287     /**
288      * Updates an action in the DB
289      *
290      * @param msg (JspmEvtAction) action to be updated.
291      */
292     public void updateAction( JspmEvtAction act );
293 
294     /**
295      * Return a vector of action definitions. Each record is represented as as Hashtable.
296      *
297      * @return actiondef (Vector) Vector of actions definition. Each element is a Hashtable.
298      */
299     public Vector getActionDefinitions();
300 
301 /***************************************************************************************************************
302  *
303  * Common Object Repository
304  *
305  ***************************************************************************************************************/
306 
307     /**
308      * Returns the data base type
309      *
310      * @param className (String) class name.
311      */
312     public String getPrfIcon( String className );     
313 
314     /**
315      * Returns current status of a CORe object.
316      *
317      * @param className (String) class name.
318      * @param instName (String) instance name.
319      * @param status (int) current status.
320      */
321     public int getObjectStatus( String className, String instName );
322 
323     /**
324      * Get the total number of class definitions.
325      */
326     public int getClassDefCount();
327 
328     /**
329      * Returns a vector of names which are the child of the parent class.
330      *
331      * @param parentName (String) name of the parent class
332      * @return childClasses (Vector) child class names.
333      */
334     public Vector getChildClasses( String parentName );
335 
336     /**
337      * Returns a vector of Hashtable with the class level property definitions.
338      *
339      * @param className (String) name of the class
340      * @return classDef (Vector) class level property definitions.
341      */
342     public Vector getClassDef( String className );
343 
344     /**
345      * Returns a vector of Hashtable with the instance level property definitions.
346      *
347      * @param className (String) name of the class
348      * @return ilpDef (Vector) instance level property definitions.
349      */
350     public Vector getIlpDef( String className );
351 
352     /**
353      * Returns the table name for the instance storage.
354      *
355      * @param className (String) name of the class
356      * @return storage (String) name of the instance storage table.
357      */
358     public String getInstanceStorage( String className );
359 
360     /**
361      * Returns a vector of Hashtable with the instance level properties of all
362      * object in a given class.
363      *
364      * @param className (String) name of the class
365      * @return objects (Vector) object list.
366      */
367     public Vector getObjectList( String className );
368 }