KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > storagemanager > logging > StorageManagerEvent


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.storagemanager.logging;
13
14 import com.versant.core.logging.LogEvent;
15
16 /**
17  * Base for StorageManager events.
18  */

19 public class StorageManagerEvent extends LogEvent {
20
21     private int storageManagerId;
22     private int type;
23
24     public static final int BEGIN = 1;
25     public static final int COMMIT = 2;
26     public static final int ROLLBACK = 3;
27     public static final int FETCH = 4;
28     public static final int FETCH_BULK = 5;
29     public static final int STORE = 6;
30     public static final int COMPILE = 7;
31     public static final int EXEC = 8;
32     public static final int EXEC_ALL = 9;
33     public static final int EXEC_COUNT = 10;
34     public static final int FETCH_BATCH = 11;
35     public static final int FETCH_INDEX = 12;
36     public static final int FETCH_COUNT = 13;
37     public static final int QUERY_CLOSE = 14;
38
39     public StorageManagerEvent(int storageManagerId, int type) {
40         this.storageManagerId = storageManagerId;
41         this.type = type;
42     }
43
44     public String JavaDoc getTypeStr() {
45         switch (type) {
46             case BEGIN: return "sm.begin";
47             case COMMIT: return "sm.commit";
48             case ROLLBACK: return "sm.rollback";
49             case FETCH: return "sm.fetch";
50             case FETCH_BULK: return "sm.fetch.bulk";
51             case STORE: return "sm.store";
52             case COMPILE: return "sm.compile";
53             case EXEC: return "sm.exec";
54             case EXEC_ALL: return "sm.exec.all";
55             case EXEC_COUNT: return "sm.exec.count";
56             case FETCH_BATCH: return "sm.fetch.batch";
57             case FETCH_INDEX: return "sm.fetch.index";
58             case FETCH_COUNT: return "sm.fetch.count";
59             case QUERY_CLOSE: return "sm.query.close";
60         }
61         return "UNKNOWN(" + type + ")";
62     }
63
64     public String JavaDoc getName() {
65         return getTypeStr();
66     }
67
68     public String JavaDoc getDescription() {
69         return "";
70     }
71
72     public int getStorageManagerId() {
73         return storageManagerId;
74     }
75
76     public int getType() {
77         return type;
78     }
79
80 }
81
Popular Tags