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.metadata.MDStatics;
14:
15: import java.util.List;
16: import java.util.Collections;
17: import java.util.ArrayList;
18:
19: /**
20: * Event logged when data is fetched for several instances at once.
21: */
22: public class SmFetchBulkEvent extends SmFetchEventBase {
23:
24: private int inputSize;
25: private String[] oids;
26:
27: public SmFetchBulkEvent(int storageManagerId, int type,
28: int inputSize, String fetchGroup, String fieldName) {
29: super (storageManagerId, type, fieldName, fetchGroup);
30: this .inputSize = inputSize;
31: }
32:
33: public int getInputSize() {
34: return inputSize;
35: }
36:
37: /**
38: * Return the OIDs requested.
39: */
40: public String[] getOids() {
41: return oids;
42: }
43:
44: public void setOids(String[] oids) {
45: this .oids = oids;
46: }
47:
48: /**
49: * Get a long description for this event (e.g. the query text).
50: */
51: public String getDescription() {
52: return inputSize + " input OID(s) "
53: + (fieldName == null ? "" : fieldName + " ")
54: + returnedSize + " state(s)";
55: }
56:
57: /**
58: * Get a list of all the ClassAndOID's for all the input OIDs.
59: */
60: public List getInputOIDs() {
61: if (oids == null)
62: return Collections.EMPTY_LIST;
63: int n = oids.length;
64: ArrayList a = new ArrayList(n);
65: for (int i = 0; i < n; i++) {
66: String oid = oids[i];
67: int j = oid.indexOf(MDStatics.OID_CHAR_SEPERATOR);
68: int classId = Integer.parseInt(oid.substring(0, j));
69: a.add(new ClassAndOID(oid, getNameForClassID(classId)));
70: }
71: return a;
72: }
73:
74: }
|