001: /*
002:
003: Derby - Class org.apache.derby.iapi.sql.compile.NodeFactory
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.iapi.sql.compile;
023:
024: import java.util.Properties;
025:
026: import org.apache.derby.iapi.services.context.ContextManager;
027:
028: import org.apache.derby.iapi.sql.dictionary.DataDictionary;
029: import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
030:
031: import org.apache.derby.iapi.error.StandardException;
032:
033: /* Strictly speaking we shouldn't import classes under the impl hierarchy here
034: * but this is work in progress.
035: * manish - Wed Mar 28 13:05:19 PST 2001
036: */
037: import org.apache.derby.impl.sql.compile.QueryTreeNode;
038: import org.apache.derby.impl.sql.compile.ResultColumnList;
039: import org.apache.derby.impl.sql.compile.ResultSetNode;
040:
041: /**
042: This is an interface for NodeFactories.
043: <p>
044: There is expected to be only one of these configured per database.
045:
046: @author Rick Hillegas
047: */
048:
049: public abstract class NodeFactory {
050: /**
051: Module name for the monitor's module locating system.
052: */
053: public static final String MODULE = "org.apache.derby.iapi.sql.compile.NodeFactory";
054:
055: /**
056: * Tell whether to do join order optimization.
057: *
058: * @return Boolean.TRUE means do join order optimization, Boolean.FALSE
059: * means don't do it.
060: */
061: public abstract Boolean doJoinOrderOptimization();
062:
063: /**
064: * Get a node that takes no initializer arguments.
065: *
066: * @param nodeType Identifier for the type of node.
067: * @param cm A ContextManager
068: *
069: * @return A new QueryTree node.
070: *
071: * @exception StandardException Thrown on error.
072: */
073: public abstract QueryTreeNode getNode(int nodeType,
074: ContextManager cm) throws StandardException;
075:
076: /**
077: * Get a node that takes one initializer argument.
078: *
079: * @param nodeType Identifier for the type of node.
080: * @param arg1 The initializer argument
081: * @param cm A ContextManager
082: *
083: * @return A new QueryTree node.
084: *
085: * @exception StandardException Thrown on error.
086: */
087: public final QueryTreeNode getNode(int nodeType, Object arg1,
088: ContextManager cm) throws StandardException {
089: QueryTreeNode retval = getNode(nodeType, cm);
090:
091: retval.init(arg1);
092:
093: return retval;
094: }
095:
096: /**
097: * Get a node that takes two initializer arguments.
098: *
099: * @param nodeType Identifier for the type of node.
100: * @param arg1 An initializer argument
101: * @param arg2 An initializer argument
102: * @param cm A ContextManager
103: *
104: * @return A new QueryTree node.
105: *
106: * @exception StandardException Thrown on error.
107: */
108: public final QueryTreeNode getNode(int nodeType, Object arg1,
109: Object arg2, ContextManager cm) throws StandardException {
110: QueryTreeNode retval = getNode(nodeType, cm);
111:
112: retval.init(arg1, arg2);
113:
114: return retval;
115: }
116:
117: /**
118: * Get a node that takes three initializer arguments.
119: *
120: * @param nodeType Identifier for the type of node.
121: * @param arg1 An initializer argument
122: * @param arg2 An initializer argument
123: * @param arg3 An initializer argument
124: * @param cm A ContextManager
125: *
126: * @return A new QueryTree node.
127: *
128: * @exception StandardException Thrown on error.
129: */
130: public final QueryTreeNode getNode(int nodeType, Object arg1,
131: Object arg2, Object arg3, ContextManager cm)
132: throws StandardException {
133: QueryTreeNode retval = getNode(nodeType, cm);
134:
135: retval.init(arg1, arg2, arg3);
136:
137: return retval;
138: }
139:
140: /**
141: * Get a node that takes four initializer arguments.
142: *
143: * @param nodeType Identifier for the type of node.
144: * @param arg1 An initializer argument
145: * @param arg2 An initializer argument
146: * @param arg3 An initializer argument
147: * @param arg4 An initializer argument
148: * @param cm A ContextManager
149: *
150: * @return A new QueryTree node.
151: *
152: * @exception StandardException Thrown on error.
153: */
154: public QueryTreeNode getNode(int nodeType, Object arg1,
155: Object arg2, Object arg3, Object arg4, ContextManager cm)
156: throws StandardException {
157: QueryTreeNode retval = getNode(nodeType, cm);
158:
159: retval.init(arg1, arg2, arg3, arg4);
160:
161: return retval;
162: }
163:
164: /**
165: * Get a node that takes five initializer arguments.
166: *
167: * @param nodeType Identifier for the type of node.
168: * @param arg1 An initializer argument
169: * @param arg2 An initializer argument
170: * @param arg3 An initializer argument
171: * @param arg4 An initializer argument
172: * @param arg5 An initializer argument
173: * @param cm A ContextManager
174: *
175: * @return A new QueryTree node.
176: *
177: * @exception StandardException Thrown on error.
178: */
179: public QueryTreeNode getNode(int nodeType, Object arg1,
180: Object arg2, Object arg3, Object arg4, Object arg5,
181: ContextManager cm) throws StandardException {
182: QueryTreeNode retval = getNode(nodeType, cm);
183:
184: retval.init(arg1, arg2, arg3, arg4, arg5);
185:
186: return retval;
187: }
188:
189: /**
190: * Get a node that takes six initializer arguments.
191: *
192: * @param nodeType Identifier for the type of node.
193: * @param arg1 An initializer argument
194: * @param arg2 An initializer argument
195: * @param arg3 An initializer argument
196: * @param arg4 An initializer argument
197: * @param arg5 An initializer argument
198: * @param arg6 An initializer argument
199: * @param cm A ContextManager
200: *
201: * @return A new QueryTree node.
202: *
203: * @exception StandardException Thrown on error.
204: */
205: public final QueryTreeNode getNode(int nodeType, Object arg1,
206: Object arg2, Object arg3, Object arg4, Object arg5,
207: Object arg6, ContextManager cm) throws StandardException {
208: QueryTreeNode retval = getNode(nodeType, cm);
209:
210: retval.init(arg1, arg2, arg3, arg4, arg5, arg6);
211:
212: return retval;
213: }
214:
215: /**
216: * Get a node that takes seven initializer arguments.
217: *
218: * @param nodeType Identifier for the type of node.
219: * @param arg1 An initializer argument
220: * @param arg2 An initializer argument
221: * @param arg3 An initializer argument
222: * @param arg4 An initializer argument
223: * @param arg5 An initializer argument
224: * @param arg6 An initializer argument
225: * @param arg7 An initializer argument
226: * @param cm A ContextManager
227: *
228: * @return A new QueryTree node.
229: *
230: * @exception StandardException Thrown on error.
231: */
232: public final QueryTreeNode getNode(int nodeType, Object arg1,
233: Object arg2, Object arg3, Object arg4, Object arg5,
234: Object arg6, Object arg7, ContextManager cm)
235: throws StandardException {
236: QueryTreeNode retval = getNode(nodeType, cm);
237:
238: retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
239:
240: return retval;
241: }
242:
243: /**
244: * Get a node that takes eight initializer arguments.
245: *
246: * @param nodeType Identifier for the type of node.
247: * @param arg1 An initializer argument
248: * @param arg2 An initializer argument
249: * @param arg3 An initializer argument
250: * @param arg4 An initializer argument
251: * @param arg5 An initializer argument
252: * @param arg6 An initializer argument
253: * @param arg7 An initializer argument
254: * @param arg8 An initializer argument
255: * @param cm A ContextManager
256: *
257: * @return A new QueryTree node.
258: *
259: * @exception StandardException Thrown on error.
260: */
261: public final QueryTreeNode getNode(int nodeType, Object arg1,
262: Object arg2, Object arg3, Object arg4, Object arg5,
263: Object arg6, Object arg7, Object arg8, ContextManager cm)
264: throws StandardException {
265: QueryTreeNode retval = getNode(nodeType, cm);
266:
267: retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
268:
269: return retval;
270: }
271:
272: /**
273: * Get a node that takes nine initializer arguments.
274: *
275: * @param nodeType Identifier for the type of node.
276: * @param arg1 An initializer argument
277: * @param arg2 An initializer argument
278: * @param arg3 An initializer argument
279: * @param arg4 An initializer argument
280: * @param arg5 An initializer argument
281: * @param arg6 An initializer argument
282: * @param arg7 An initializer argument
283: * @param arg8 An initializer argument
284: * @param arg9 An initializer argument
285: * @param cm A ContextManager
286: *
287: * @return A new QueryTree node.
288: *
289: * @exception StandardException Thrown on error.
290: */
291: public final QueryTreeNode getNode(int nodeType, Object arg1,
292: Object arg2, Object arg3, Object arg4, Object arg5,
293: Object arg6, Object arg7, Object arg8, Object arg9,
294: ContextManager cm) throws StandardException {
295: QueryTreeNode retval = getNode(nodeType, cm);
296:
297: retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
298: arg9);
299:
300: return retval;
301: }
302:
303: /**
304: * Get a node that takes ten initializer arguments.
305: *
306: * @param nodeType Identifier for the type of node.
307: * @param arg1 An initializer argument
308: * @param arg2 An initializer argument
309: * @param arg3 An initializer argument
310: * @param arg4 An initializer argument
311: * @param arg5 An initializer argument
312: * @param arg6 An initializer argument
313: * @param arg7 An initializer argument
314: * @param arg8 An initializer argument
315: * @param arg9 An initializer argument
316: * @param arg10 An initializer argument
317: * @param cm A ContextManager
318: *
319: * @return A new QueryTree node.
320: *
321: * @exception StandardException Thrown on error.
322: */
323: public final QueryTreeNode getNode(int nodeType, Object arg1,
324: Object arg2, Object arg3, Object arg4, Object arg5,
325: Object arg6, Object arg7, Object arg8, Object arg9,
326: Object arg10, ContextManager cm) throws StandardException {
327: QueryTreeNode retval = getNode(nodeType, cm);
328:
329: retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
330: arg9, arg10);
331:
332: return retval;
333: }
334:
335: /**
336: * Get a node that takes eleven initializer arguments.
337: *
338: * @param nodeType Identifier for the type of node.
339: * @param arg1 An initializer argument
340: * @param arg2 An initializer argument
341: * @param arg3 An initializer argument
342: * @param arg4 An initializer argument
343: * @param arg5 An initializer argument
344: * @param arg6 An initializer argument
345: * @param arg7 An initializer argument
346: * @param arg8 An initializer argument
347: * @param arg9 An initializer argument
348: * @param arg10 An initializer argument
349: * @param arg11 An initializer argument
350: * @param cm A ContextManager
351: *
352: * @return A new QueryTree node.
353: *
354: * @exception StandardException Thrown on error.
355: */
356: public final QueryTreeNode getNode(int nodeType, Object arg1,
357: Object arg2, Object arg3, Object arg4, Object arg5,
358: Object arg6, Object arg7, Object arg8, Object arg9,
359: Object arg10, Object arg11, ContextManager cm)
360: throws StandardException {
361: QueryTreeNode retval = getNode(nodeType, cm);
362:
363: retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
364: arg9, arg10, arg11);
365:
366: return retval;
367: }
368:
369: /**
370: * Get a node that takes twelve initializer arguments.
371: *
372: * @param nodeType Identifier for the type of node.
373: * @param arg1 An initializer argument
374: * @param arg2 An initializer argument
375: * @param arg3 An initializer argument
376: * @param arg4 An initializer argument
377: * @param arg5 An initializer argument
378: * @param arg6 An initializer argument
379: * @param arg7 An initializer argument
380: * @param arg8 An initializer argument
381: * @param arg9 An initializer argument
382: * @param arg10 An initializer argument
383: * @param arg11 An initializer argument
384: * @param arg12 An initializer argument
385: * @param cm A ContextManager
386: *
387: * @return A new QueryTree node.
388: *
389: * @exception StandardException Thrown on error.
390: */
391: public final QueryTreeNode getNode(int nodeType, Object arg1,
392: Object arg2, Object arg3, Object arg4, Object arg5,
393: Object arg6, Object arg7, Object arg8, Object arg9,
394: Object arg10, Object arg11, Object arg12, ContextManager cm)
395: throws StandardException {
396: QueryTreeNode retval = getNode(nodeType, cm);
397:
398: retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
399: arg9, arg10, arg11, arg12);
400:
401: return retval;
402: }
403:
404: /**
405: * Get a node that takes thirteen initializer arguments.
406: *
407: * @param nodeType Identifier for the type of node.
408: * @param arg1 An initializer argument
409: * @param arg2 An initializer argument
410: * @param arg3 An initializer argument
411: * @param arg4 An initializer argument
412: * @param arg5 An initializer argument
413: * @param arg6 An initializer argument
414: * @param arg7 An initializer argument
415: * @param arg8 An initializer argument
416: * @param arg9 An initializer argument
417: * @param arg10 An initializer argument
418: * @param arg11 An initializer argument
419: * @param arg12 An initializer argument
420: * @param arg13 An initializer argument
421: * @param cm A ContextManager
422: *
423: * @return A new QueryTree node.
424: *
425: * @exception StandardException Thrown on error.
426: */
427: public final QueryTreeNode getNode(int nodeType, Object arg1,
428: Object arg2, Object arg3, Object arg4, Object arg5,
429: Object arg6, Object arg7, Object arg8, Object arg9,
430: Object arg10, Object arg11, Object arg12, Object arg13,
431: ContextManager cm) throws StandardException {
432: QueryTreeNode retval = getNode(nodeType, cm);
433:
434: retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
435: arg9, arg10, arg11, arg12, arg13);
436:
437: return retval;
438: }
439:
440: /**
441: * Get a node that takes fourteen initializer arguments.
442: *
443: * @param nodeType Identifier for the type of node.
444: * @param arg1 An initializer argument
445: * @param arg2 An initializer argument
446: * @param arg3 An initializer argument
447: * @param arg4 An initializer argument
448: * @param arg5 An initializer argument
449: * @param arg6 An initializer argument
450: * @param arg7 An initializer argument
451: * @param arg8 An initializer argument
452: * @param arg9 An initializer argument
453: * @param arg10 An initializer argument
454: * @param arg11 An initializer argument
455: * @param arg12 An initializer argument
456: * @param arg13 An initializer argument
457: * @param arg14 An initializer argument
458: * @param cm A ContextManager
459: *
460: * @return A new QueryTree node.
461: *
462: * @exception StandardException Thrown on error.
463: */
464: public final QueryTreeNode getNode(int nodeType, Object arg1,
465: Object arg2, Object arg3, Object arg4, Object arg5,
466: Object arg6, Object arg7, Object arg8, Object arg9,
467: Object arg10, Object arg11, Object arg12, Object arg13,
468: Object arg14, ContextManager cm) throws StandardException {
469: QueryTreeNode retval = getNode(nodeType, cm);
470:
471: retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
472: arg9, arg10, arg11, arg12, arg13, arg14);
473:
474: return retval;
475: }
476:
477: /**
478: * Get one of the several types of create alias nodes. Carved out of parser
479: * so this could be used by ALTER PUBLICATION.
480: *
481: * @param aliasName The name of the alias
482: * @param targetName The full path/method name
483: * @param aliasSpecificInfo The full path of the target method name,
484: * if any
485: * @param aliasType The type of alias to create
486: * @param delimitedIdentifier Whether or not to treat the class name
487: * as a delimited identifier if trying to
488: * resolve it as a class alias.
489: * @param cm A ContextManager
490: *
491: * @return A CreateAliasNode matching the given parameters
492: *
493: * @exception StandardException Thrown on error
494: */
495: public abstract QueryTreeNode getCreateAliasNode(Object aliasName,
496: Object targetName, Object aliasSpecificInfo,
497: char aliasType, Boolean delimitedIdentifier,
498: ContextManager cm) throws StandardException;
499:
500: /**
501: * Return a correctly configured node that represents
502: * a scan from a VTI dervied from the TableDesciptor.
503: * Used to convert from system diagnostic tables
504: * to VTI scans.
505: * @param td Table that is really a vti
506: * @param vtiClass Java class name for virtual table
507: * @param correlationName Correlation name of table clause
508: * @param resultColumns Columns extracted from table.
509: * @param tableProperties Properties being passed onto the table scan
510: * @param cm Current context manager
511: */
512: public abstract ResultSetNode mapTableAsVTI(TableDescriptor td,
513: String vtiClass, String correlationName,
514: ResultColumnList resultColumns, Properties tableProperties,
515: ContextManager cm) throws StandardException;
516:
517: }
|