01: /*
02:
03: Derby - Class org.apache.derby.iapi.sql.dictionary.StatisticsDescriptor
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21:
22: package org.apache.derby.iapi.sql.dictionary;
23:
24: import org.apache.derby.catalog.Statistics;
25: import org.apache.derby.catalog.UUID;
26:
27: import org.apache.derby.iapi.sql.dictionary.DataDictionary;
28: import java.sql.Timestamp;
29:
30: /**
31: * Implementation of StatisticsDescriptor.
32: *
33: */
34: public class StatisticsDescriptor extends TupleDescriptor {
35: private UUID statID; // my UUID
36: private UUID statRefID; // UUID of object for which I'm a statistic
37: private UUID statTableID; // UUID of table for which I'm a stat
38: private Timestamp statUpdateTime; // when was I last modified
39:
40: /* I for Index, T for table and such; even though right now all
41: our statistics are 'I' but who knows what we'll need later.
42: */
43: private String statType;
44: private boolean statValid = true; // am I valid?
45: private Statistics statStat; // the real enchilada.
46: private int statColumnCount; // for how many columns??
47:
48: public StatisticsDescriptor(DataDictionary dd, UUID newUUID,
49: UUID objectUUID, UUID tableUUID, String type,
50: Statistics stat, int colCount) {
51: super (dd);
52: this .statID = newUUID;
53: this .statRefID = objectUUID;
54: this .statTableID = tableUUID;
55: this .statUpdateTime = new Timestamp(System.currentTimeMillis());
56: this .statType = "I"; // for now only index.
57: this .statStat = stat;
58: this .statColumnCount = colCount;
59: }
60:
61: public UUID getUUID() {
62: return statID;
63: }
64:
65: /*----- getter functions for rowfactory ------*/
66: public UUID getTableUUID() {
67: return statTableID;
68: }
69:
70: public UUID getReferenceID() {
71: return statRefID;
72: }
73:
74: public Timestamp getUpdateTimestamp() {
75: return statUpdateTime;
76: }
77:
78: public String getStatType() {
79: return statType;
80: }
81:
82: public boolean isValid() {
83: return statValid;
84: }
85:
86: public Statistics getStatistic() {
87: return statStat;
88: }
89:
90: public int getColumnCount() {
91: return statColumnCount;
92: }
93:
94: public String toString() {
95: return "statistics: table=" + getTableUUID().toString()
96: + ",conglomerate=" + getReferenceID() + ",colCount="
97: + getColumnCount() + ",stat=" + getStatistic();
98: }
99: }
|