001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: *
021: */
022: package org.enhydra.dods.statistics;
023:
024: import java.util.Date;
025:
026: /**
027: * This interface provides information about table and its statistics.
028: *
029: * @author Tanja Jovanovic
030: * @author Nenad Vico
031: * @author Zorica Suvajdzin
032: * @version 2.0 15.06.2003.
033: */
034: public interface Statistics {
035:
036: /**
037: * When there are no caches (data object and query caches), statistics is
038: * TABLE_STATISTICS (contains only information about tables).
039: */
040: public static final int TABLE_STATISTICS = 0;
041:
042: /**
043: * When there is only data object cache (there are no query caches),
044: * statistics is CACHE_STATISTICS (contains information about tables and
045: * data object cache).
046: */
047: public static final int CACHE_STATISTICS = 1;
048:
049: /**
050: * When there are both data object and query caches, statistics is
051: * QUERY_CACHE_STATISTICS (contains information about tables, data object
052: * and query caches).
053: */
054: public static final int QUERY_CACHE_STATISTICS = 2;
055:
056: /**
057: * Returns type of the statistics (TABLE_STATISTICS, CACHE_STATISTICS, or
058: * QUERY_CACHE_STATISTICS).
059: *
060: * @return Type of statistics (0 if statistics is TABLE_STATISTICS, 1 if
061: * statistics is CACHE_STATISTICS, or 2 if statistics is
062: * QUERY_CACHE_STATISTICS.
063: */
064: public int getStatisticsType();
065:
066: /**
067: * Returns number of insert statements performed on the table.
068: *
069: * @return Number of insert statements performed on the table.
070: */
071: public int getInsertNum();
072:
073: /**
074: * Sets number of insert statements performed on the table.
075: *
076: * @param newInsertNum New number of insert statements performed on the
077: * table.
078: */
079: public void setInsertNum(int newInsertNum);
080:
081: /**
082: * Increases number of insert statements performed on the table.
083: */
084: public void incrementInsertNum();
085:
086: /**
087: * Returns number of update statements performed on the table.
088: *
089: * @return Number of update statements performed on the table.
090: */
091: public int getUpdateNum();
092:
093: /**
094: * Sets number of update statements performed on the table.
095: *
096: * @param newUpdateNum New number of update statements performed on the
097: * table.
098: */
099: public void setUpdateNum(int newUpdateNum);
100:
101: /**
102: * Increases number of update statements performed on the table.
103: */
104: public void incrementUpdateNum();
105:
106: /**
107: * Returns number of delete statements performed on the table.
108: *
109: * @return Number of delete statements performed on the table.
110: */
111: public int getDeleteNum();
112:
113: /**
114: * Sets number of delete statements performed on the table.
115: *
116: * @param newDeleteNum New number of delete statements performed on the
117: * table.
118: */
119: public void setDeleteNum(int newDeleteNum);
120:
121: /**
122: * Increases number of delete statements performed on table.
123: */
124: public void incrementDeleteNum();
125:
126: /**
127: * Returns number of DML operations (inserts, updates and deletes) performed
128: * on the table.
129: *
130: * @return Number of DML operations performed on the table.
131: */
132: public int getDMLNum();
133:
134: /**
135: * Returns number of lazy loadings performed on the table.
136: *
137: * @return Number of lazy loadings performed on the table.
138: */
139: public int getLazyLoadingNum();
140:
141: /**
142: * Sets number of lazy loadings performed on the table.
143: *
144: * @param newLazyLoadingNum New number of lazy loadings performed on the
145: * table.
146: */
147: public void setLazyLoadingNum(int newLazyLoadingNum);
148:
149: /**
150: * Increases number of lazy loadings performed on the table for one.
151: */
152: public void incrementLazyLoadingNum();
153:
154: /**
155: * Returns time when the statistics was started.
156: *
157: * @return Time when the statistics was started.
158: */
159: public Date getStartTime();
160:
161: /**
162: * Sets time when the statistics starts.
163: *
164: * @param startTime Time when the statistics starts.
165: */
166: public void setStartTime(Date startTime);
167:
168: /**
169: * Returns time when the statistics was stopped.
170: *
171: * @return Time when the statistics was stopped.
172: */
173: public Date getStopTime();
174:
175: /**
176: * Sets time when the statistics stops.
177: *
178: * @param stopTime time when the statistics stops.
179: */
180: public void setStopTime(Date stopTime);
181:
182: /**
183: * Sets stop time to current time.
184: */
185: public void stopTime();
186:
187: /**
188: * Returns total number of non-oid queries performed on the table.
189: * Query by oid is query which "where" clause contains request for DO with
190: * specified oid. Non-oid query is any other query.
191: *
192: * @return Total number of non-oid queries performed on the table.
193: */
194: public int getQueryNum();
195:
196: /**
197: * Sets total number of non-oid queries performed on the table.
198: * Query by oid is query which "where" clause contains request for DO with
199: * specified oid. Non-oid query is any other query.
200: *
201: * @param newQueryNum New total number of non-oid queries performed on
202: * the table.
203: */
204: public void setQueryNum(int newQueryNum);
205:
206: /**
207: * Increases total number of non-oid queries performed on the table.
208: * Query by oid is query which "where" clause contains request for DO with
209: * specified oid. Non-oid query is any other query.
210: */
211: public void incrementQueryNum();
212:
213: /**
214: * Returns total number of queries by oid performed on the table.
215: * Query by oid is query which "where" clause contains request for DO with
216: * specified oid.
217: *
218: * @return Total number of queries by oid performed on the table.
219: */
220: public int getQueryByOIdNum();
221:
222: /**
223: * Sets total number of queries by oid performed on the table.
224: * Query by oid is query which "where" clause contains request for DO with
225: * specified oid.
226: *
227: * @param newQueryByOIdNum New total number of queries by oid performed on
228: * the table.
229: */
230: public void setQueryByOIdNum(int newQueryByOIdNum);
231:
232: /**
233: * Increases total number of queries by oid performed on the table for one.
234: * Query by oid is query which "where" clause contains request for DO with
235: * specified oid.
236: */
237: public void incrementQueryByOIdNum();
238:
239: /**
240: * Returns average time needed for executing non-oid query.
241: * Query by oid is query which "where" clause contains request for DO with
242: * specified oid. Non-oid query is any other query.
243: *
244: * @return Average time needed for executing non-oid query.
245: */
246: public int getQueryAverageTime();
247:
248: /**
249: * Updates average time needed for executing non-oid queries.
250: * Query by oid is query which "where" clause contains request for DO with
251: * specified oid. Non-oid query is any other query.
252: *
253: * @param newTime New query time in miliseconds.
254: */
255: public void updateQueryAverageTime(int newTime);
256:
257: /**
258: * Returns average time needed for executing query by oid.
259: * Query by oid is query which "where" clause contains request for DO with
260: * specified oid.
261: *
262: * @return Average time needed for executing oid query.
263: */
264: public int getQueryByOIdAverageTime();
265:
266: /**
267: * Updates average time for executing OId queries and increments number
268: * of them by paramether <code>no</code>.
269: * Query by oid is query which "where" clause contains request for DO with
270: * specified oid.
271: *
272: * @param newTime New query time in miliseconds for no queries by OId.
273: * @param no Number of queries by OId.
274: */
275: public void updateQueryByOIdAverageTime(int newTime, int no);
276:
277: /**
278: * Clears DO, simple query and complex query statistics.
279: */
280: public void clear();
281:
282: /**
283: * Returns query statistics for :
284: * DO (data object) cache when cache has value 0
285: * (value rg.enhydra.dods.cache.CacheConstants.DATA_CACHE)
286: * simple query cache when cache has value 1
287: * (value org.enhydra.dods.cache.CacheConstants.SIMPLE_QUERY_CACHE)
288: * complex query cache when cache has value 2
289: * (org.enhydra.dods.cache.CacheConstants.COMPLEX_QUERY_CACHE)
290: *
291: * @param type Value 0 (org.enhydra.dods.cache.CacheConstants.DATA_CACHE)
292: * for DO (data object) cache,
293: * value 1 (org.enhydra.dods.cache.CacheConstants.SIMPLE_QUERY_CACHE) for
294: * simple query cache and value 2
295: * (org.enhydra.dods.cache.CacheConstants.COMPLEX_QUERY_CACHE) for complex
296: * query cache.
297: * @return Query statistics for DO (data object) cache, simple query or
298: * complex query cache.
299: */
300: public CacheStatistics getCacheStatistics(int type);
301: }
|