KickJava   Java API By Example, From Geeks To Geeks.

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


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.metadata.MDStatics;
15
16 import java.util.List JavaDoc;
17 import java.util.Collections JavaDoc;
18 import java.util.ArrayList JavaDoc;
19
20 /**
21  * Event logged when data is fetched for several instances at once.
22  */

23 public class SmFetchBulkEvent extends SmFetchEventBase {
24
25     private int inputSize;
26     private String JavaDoc[] oids;
27
28     public SmFetchBulkEvent(int storageManagerId, int type, int inputSize,
29             String JavaDoc fetchGroup, String JavaDoc fieldName) {
30         super(storageManagerId, type, fieldName, fetchGroup);
31         this.inputSize = inputSize;
32     }
33
34     public int getInputSize() {
35         return inputSize;
36     }
37
38     /**
39      * Return the OIDs requested.
40      */

41     public String JavaDoc[] getOids() {
42         return oids;
43     }
44
45     public void setOids(String JavaDoc[] oids) {
46         this.oids = oids;
47     }
48
49     /**
50      * Get a long description for this event (e.g. the query text).
51      */

52     public String JavaDoc getDescription() {
53         return inputSize + " input OID(s) " +
54                 (fieldName == null ? "" : fieldName + " ") +
55                 returnedSize + " state(s)";
56     }
57
58     /**
59      * Get a list of all the ClassAndOID's for all the input OIDs.
60      */

61     public List JavaDoc getInputOIDs() {
62         if (oids == null) return Collections.EMPTY_LIST;
63         int n = oids.length;
64         ArrayList JavaDoc a = new ArrayList JavaDoc(n);
65         for (int i = 0; i < n; i++) {
66             String JavaDoc 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 }
75
Popular Tags