01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.storagemanager.logging;
12:
13: import com.versant.core.logging.LogEvent;
14:
15: /**
16: * Base for StorageManager events.
17: */
18: public class StorageManagerEvent extends LogEvent {
19:
20: private int storageManagerId;
21: private int type;
22:
23: public static final int BEGIN = 1;
24: public static final int COMMIT = 2;
25: public static final int ROLLBACK = 3;
26: public static final int FETCH = 4;
27: public static final int FETCH_BULK = 5;
28: public static final int STORE = 6;
29: public static final int COMPILE = 7;
30: public static final int EXEC = 8;
31: public static final int EXEC_ALL = 9;
32: public static final int EXEC_COUNT = 10;
33: public static final int FETCH_BATCH = 11;
34: public static final int FETCH_INDEX = 12;
35: public static final int FETCH_COUNT = 13;
36: public static final int QUERY_CLOSE = 14;
37:
38: public StorageManagerEvent(int storageManagerId, int type) {
39: this .storageManagerId = storageManagerId;
40: this .type = type;
41: }
42:
43: public String getTypeStr() {
44: switch (type) {
45: case BEGIN:
46: return "sm.begin";
47: case COMMIT:
48: return "sm.commit";
49: case ROLLBACK:
50: return "sm.rollback";
51: case FETCH:
52: return "sm.fetch";
53: case FETCH_BULK:
54: return "sm.fetch.bulk";
55: case STORE:
56: return "sm.store";
57: case COMPILE:
58: return "sm.compile";
59: case EXEC:
60: return "sm.exec";
61: case EXEC_ALL:
62: return "sm.exec.all";
63: case EXEC_COUNT:
64: return "sm.exec.count";
65: case FETCH_BATCH:
66: return "sm.fetch.batch";
67: case FETCH_INDEX:
68: return "sm.fetch.index";
69: case FETCH_COUNT:
70: return "sm.fetch.count";
71: case QUERY_CLOSE:
72: return "sm.query.close";
73: }
74: return "UNKNOWN(" + type + ")";
75: }
76:
77: public String getName() {
78: return getTypeStr();
79: }
80:
81: public String getDescription() {
82: return "";
83: }
84:
85: public int getStorageManagerId() {
86: return storageManagerId;
87: }
88:
89: public int getType() {
90: return type;
91: }
92:
93: }
|