KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdo > query > mem > CompiledMemQuery


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.jdo.query.mem;
13
14 import com.versant.core.jdo.QueryDetails;
15 import com.versant.core.metadata.ClassMetaData;
16 import com.versant.core.metadata.ModelMetaData;
17 import com.versant.core.jdo.query.*;
18 import com.versant.core.server.CompiledQuery;
19
20 import com.versant.core.common.BindingSupportImpl;
21
22 /**
23  * Holds query information after parsing filters, params, variables and orders.
24  */

25 public class CompiledMemQuery implements CompiledQuery {
26
27     private int id;
28     public ParamNode[] params = null;
29     public VarNode[] vars = null;
30     public Node filter = null;
31     public QueryDetails queryParams = null;
32     public OrderNode[] orders = null;
33     private QueryParser qParser;
34     private ModelMetaData jmd;
35
36     public CompiledMemQuery(ModelMetaData jmd) {
37         this.jmd = jmd;
38     }
39
40     public int[] getClassIndexes() {
41         return new int[0];
42     }
43
44     /**
45      * The typeCode of each column.
46      *
47      * @see com.versant.core.metadata.MDStatics
48      */

49     public int[] getResultTypeCodes() {
50         return new int[0]; //To change body of implemented methods use File | Settings | File Templates.
51
}
52
53     /**
54      * If this is a query with a single/unique result.
55      */

56     public boolean isUnique() {
57         if (true) throw BindingSupportImpl.getInstance().notImplemented("");
58         return false; //To change body of implemented methods use File | Settings | File Templates.
59
}
60
61     public boolean isRandomAccess() {
62         return false; //To change body of implemented methods use File | Settings | File Templates.
63
}
64
65     public int getQueryResultBatchSize() {
66         return 0;
67     }
68
69     public int getFetchGroupIndex() {
70         return 0;
71     }
72
73     public QueryDetails getQueryDetails() {
74         return queryParams;
75     }
76
77     /**
78      * Is this a non default projection query.
79      * This will return false for the default projection.
80      */

81     public boolean isProjectionQuery() {
82         return false; //To change body of implemented methods use File | Settings | File Templates.
83
}
84
85     /**
86      * If this query returns default results.
87      */

88     public boolean isDefaultResult() {
89         return false; //To change body of implemented methods use File | Settings | File Templates.
90
}
91
92     /**
93      * The index of the first occurance of 'this' in the projection.
94      */

95     public int getFirstThisIndex() {
96         return 0; //To change body of implemented methods use File | Settings | File Templates.
97
}
98
99     /**
100      * If this is a result/projection that only contains 'this' and no other
101      * fields in the projection or if no projection was specified.
102      */

103     public boolean isContainsThisOnly() {
104         return false; //To change body of implemented methods use File | Settings | File Templates.
105
}
106
107     /**
108      * If the results of the query should be copied for caching.
109      * This should only happen for non-default type projection queries that
110      * contains references.
111      * If this is a projection that only specifies 'this' then this should
112      * also return false.
113      */

114     public boolean isCopyResultsForCache() {
115         return false; //To change body of implemented methods use File | Settings | File Templates.
116
}
117
118     /**
119      * Array containing the index pos of ref fields of the projection.
120      */

121     public int[] getRefIndexArray() {
122         return new int[]{}; //To change body of implemented methods use File | Settings | File Templates.
123
}
124
125     public void compile(QueryDetails qParams) throws ParseException {
126         qParser = new QueryParser(jmd);
127
128         try {
129             qParser.parse(qParams);
130             params = qParser.getParams();
131             filter = qParser.getFilter();
132             orders = qParser.getOrders();
133             vars = qParser.getVars();
134         } catch (Exception JavaDoc e) {
135             throw BindingSupportImpl.getInstance().invalidOperation(e.getMessage(), e);
136         } catch (TokenMgrError e) {
137             throw BindingSupportImpl.getInstance().invalidOperation(e.getMessage(), e);
138         }
139     }
140
141     public ClassMetaData[] getQueryClasses() {
142         return null;
143     }
144
145     public boolean isCacheble() {
146         return false;
147     }
148
149     public void setCacheable(boolean on) {
150         // ignore
151
}
152
153     public int getMaxRows() {
154         return 0;
155     }
156
157     public int[] getEvictionClassBits() {
158         return new int[0];
159     }
160
161     public int getId() {
162         return id;
163     }
164
165     public void setId(int id) {
166         this.id = id;
167     }
168
169 }
170
171
Popular Tags