001: /*
002: * Copyright (c) 1998 - 2005 Versant Corporation
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * Versant Corporation - initial API and implementation
010: */
011: package com.versant.core.jdo;
012:
013: import com.versant.core.logging.LogEvent;
014: import com.versant.core.logging.LogEvent;
015:
016: /**
017: * Server side performance events.
018: */
019: public class ServerLogEvent extends LogEvent {
020:
021: protected int type;
022: protected String description;
023:
024: public static final int JDOQL_COMPILE = 1;
025: public static final int JDOQL_EXEC = 2;
026: public static final int JDOQL_EXEC_COUNT = 33;
027: public static final int SET_PROPERTY = 3;
028: public static final int REMOTE_PMF_CONNECT = 4;
029: public static final int REMOTE_PMF_DISCONNECT = 5;
030: public static final int REMOTE_PMF_BAD_AUTH = 6;
031: public static final int REMOTE_PMF_DISABLED = 7;
032: public static final int REMOTE_PMF_BAD_VERSION = 8;
033: public static final int REMOTE_PM_DISABLED = 12;
034: public static final int PM_CREATED = 13;
035: public static final int PM_CLOSED = 14;
036: public static final int PM_CLOSED_AUTO = 15;
037: public static final int PM_CLOSED_AUTO_TX = 16;
038: public static final int TX_BEGIN = 17;
039: public static final int TX_BEGIN_DATASTORE = 18;
040: public static final int TX_COMMIT = 19;
041: public static final int TX_ROLLBACK = 20;
042: public static final int TX_FLUSH_AUTO = 21;
043: public static final int TX_FLUSH = 22;
044: public static final int PMF_EVICT = 23;
045: public static final int PMF_EVICT_ALL = 24;
046: public static final int PMF_EVICT_CLASS = 25;
047: public static final int PM_ALLOC = 26;
048: public static final int PM_RELEASE = 27;
049: public static final int LOCK_CLEANUP = 28;
050: public static final int JDOQL_CACHE_HIT = 29;
051: public static final int JDOQL_CACHE_EVICT = 30;
052: public static final int JDOQL_CACHE_FAIL = 31;
053: public static final int SET_DATASTORE_TX_LOCKING = 32;
054: public static final int GET_STATE = 34;
055: public static final int GET_STATE_MULTI = 35;
056: public static final int GET_QUERY_BATCH = 36;
057: public static final int GET_QUERY_ALL = 37;
058: public static final int USER = 38;
059: public static final int SET_RETAIN_CONNECTION_IN_OPT_TX = 39;
060:
061: public ServerLogEvent(int type, String description) {
062: this .type = type;
063: this .description = description;
064: }
065:
066: /**
067: * Get a short descriptive name for this event.
068: */
069: public String getName() {
070: switch (type) {
071: case JDOQL_COMPILE:
072: return "jdoql.compile";
073: case JDOQL_EXEC:
074: return "jdoql.exec";
075: case JDOQL_EXEC_COUNT:
076: return "jdoql.exec.count";
077: case JDOQL_CACHE_HIT:
078: return "jdoql.cache.hit";
079: case JDOQL_CACHE_EVICT:
080: return "jdoql.cache.evict";
081: case JDOQL_CACHE_FAIL:
082: return "jdoql.cache.fail";
083: case GET_STATE:
084: return "get.state";
085: case GET_STATE_MULTI:
086: return "get.state.multi";
087: case GET_QUERY_BATCH:
088: return "get.query.batch";
089: case GET_QUERY_ALL:
090: return "get.query.all";
091: case PMF_EVICT:
092: return "pmf.evict";
093: case PMF_EVICT_ALL:
094: return "pmf.evict.all";
095: case PMF_EVICT_CLASS:
096: return "pmf.evict.class";
097: case REMOTE_PMF_CONNECT:
098: return "remote.pmf.connect";
099: case REMOTE_PMF_DISCONNECT:
100: return "remote.pmf.disconnect";
101: case REMOTE_PMF_BAD_AUTH:
102: return "remote.pmf.badauth";
103: case REMOTE_PMF_DISABLED:
104: return "remote.pmf.disabled";
105: case REMOTE_PMF_BAD_VERSION:
106: return "remote.pmf.bad.version";
107: case REMOTE_PM_DISABLED:
108: return "remote.pm.disabled";
109: case PM_CREATED:
110: return "pm.created";
111: case PM_CLOSED:
112: return "pm.closed";
113: case PM_CLOSED_AUTO:
114: return "pm.closed.auto";
115: case PM_CLOSED_AUTO_TX:
116: return "pm.closed.auto.tx";
117: case PM_ALLOC:
118: return "pm.alloc";
119: case PM_RELEASE:
120: return "pm.release";
121: case SET_DATASTORE_TX_LOCKING:
122: return "set.ds.tx.locking";
123: case SET_RETAIN_CONNECTION_IN_OPT_TX:
124: return "set.retain.con.in.opt.tx";
125: case TX_BEGIN:
126: return "tx.begin";
127: case TX_BEGIN_DATASTORE:
128: return "tx.begin.datastore";
129: case TX_COMMIT:
130: return "tx.commit";
131: case TX_ROLLBACK:
132: return "tx.rollback";
133: case TX_FLUSH_AUTO:
134: return "tx.flush.auto";
135: case TX_FLUSH:
136: return "tx.flush";
137: case LOCK_CLEANUP:
138: return "lock.cleanup";
139: case SET_PROPERTY:
140: return "set.property";
141: case USER:
142: return "user";
143: }
144: return "UNKNOWN(" + type + ")";
145: }
146:
147: /**
148: * Get a long description for this event (e.g. the query text).
149: */
150: public String getDescription() {
151: return description;
152: }
153:
154: public void setDescription(String description) {
155: this.description = description;
156: }
157:
158: }
|