Source Code Cross Referenced for AggregatorInfo.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » sql » execute » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.sql.execute 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.sql.execute.AggregatorInfo
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.impl.sql.execute;
023:
024:        import org.apache.derby.iapi.sql.ResultDescription;
025:        import org.apache.derby.iapi.services.io.StoredFormatIds;
026:        import org.apache.derby.iapi.services.io.FormatIdUtil;
027:        import org.apache.derby.iapi.services.io.Formatable;
028:        import org.apache.derby.iapi.services.sanity.SanityManager;
029:
030:        import java.io.ObjectOutput;
031:        import java.io.ObjectInput;
032:        import java.io.IOException;
033:
034:        /**
035:         * This is a simple class used to store the run time information
036:         * needed to invoke an aggregator.  This class is serializable
037:         * because it is stored with the plan.  It is serializable rather
038:         * than externalizable because it isn't particularly complicated
039:         * and presumbably we don't need version control on plans.
040:         *
041:         * @author jamie
042:         */
043:        public class AggregatorInfo implements  Formatable {
044:            /********************************************************
045:             **
046:             **	This class implements Formatable. That means that it
047:             **	can write itself to and from a formatted stream. If
048:             **	you add more fields to this class, make sure that you
049:             **	also write/read them with the writeExternal()/readExternal()
050:             **	methods.
051:             **
052:             **	If, inbetween releases, you add more fields to this class,
053:             **	then you should bump the version number emitted by the getTypeFormatId()
054:             **	method.  OR, since this is something that is used
055:             **	in stored prepared statements, it is ok to change it
056:             **	if you make sure that stored prepared statements are
057:             **	invalidated across releases.
058:             **
059:             ********************************************************/
060:
061:            /*
062:             ** See the constructor for the meaning of these fields
063:             */
064:            String aggregateName;
065:            int inputColumn;
066:            int outputColumn;
067:            int aggregatorColumn;
068:            String aggregatorClassName;
069:            boolean isDistinct;
070:            ResultDescription rd;
071:
072:            /**
073:             * Niladic constructor for Formattable
074:             */
075:            public AggregatorInfo() {
076:            }
077:
078:            /**
079:             * Consructor
080:             *
081:             * @param aggregateName	the name of the aggregate.  Not
082:             *		actually used anywhere except diagnostics.  Should
083:             *		be the names as found in the language (e.g. MAX).
084:             * @param aggregatorClassName	the name of the aggregator
085:             *		used to process this aggregate.  Aggregator expected
086:             *		to have a null arg constructor and implement
087:             *		Aggregator.
088:             * @param inputColNum	the input column number
089:             * @param outputColNum	the output column number
090:             * @param aggregatorColNum	the column number in which the 
091:             *		aggregator is stored.
092:             * @param isDistinct	if it is a distinct aggregate
093:             * @param rd	the result description
094:             *
095:             */
096:            public AggregatorInfo(String aggregateName,
097:                    String aggregatorClassName, int inputColNum,
098:                    int outputColNum, int aggregatorColNum, boolean isDistinct,
099:                    ResultDescription rd) {
100:                this .aggregateName = aggregateName;
101:                this .aggregatorClassName = aggregatorClassName;
102:                this .inputColumn = inputColNum;
103:                this .outputColumn = outputColNum;
104:                this .aggregatorColumn = aggregatorColNum;
105:                this .isDistinct = isDistinct;
106:                this .rd = rd;
107:            }
108:
109:            /**
110:             * Get the name of the aggergate (e.g. MAX)
111:             *
112:             * @return the aggeregate name
113:             */
114:            public String getAggregateName() {
115:                return aggregateName;
116:            }
117:
118:            /**
119:             * Get the name of the class that implements the user
120:             * aggregator for this class.
121:             *
122:             * @return the aggeregator class name
123:             */
124:            public String getAggregatorClassName() {
125:                return aggregatorClassName;
126:            }
127:
128:            /**
129:             * Get the column number for the aggregator
130:             * column.
131:             *
132:             * @return the aggeregator colid
133:             */
134:            public int getAggregatorColNum() {
135:                return aggregatorColumn;
136:            }
137:
138:            /**
139:             * Get the column number for the input
140:             * (addend) column.
141:             *
142:             * @return the aggeregator colid
143:             */
144:            public int getInputColNum() {
145:                return inputColumn;
146:            }
147:
148:            /**
149:             * Get the column number for the output
150:             * (result) column.
151:             *
152:             * @return the aggeregator colid
153:             */
154:            public int getOutputColNum() {
155:                return outputColumn;
156:            }
157:
158:            /**
159:             * Is the aggergate distinct
160:             *
161:             * @return whether it is distinct
162:             */
163:            public boolean isDistinct() {
164:                return isDistinct;
165:            }
166:
167:            /**
168:             * Get the result description for the input value
169:             * to this aggregate.
170:             *
171:             * @return the rd
172:             */
173:            public ResultDescription getResultDescription() {
174:                return rd;
175:            }
176:
177:            /**
178:             * Get a string for the object
179:             *
180:             * @return string
181:             */
182:            public String toString() {
183:                if (SanityManager.DEBUG) {
184:                    return "AggregatorInfo = Name: " + aggregateName
185:                            + "\n\tClass: " + aggregatorClassName
186:                            + "\n\tInputColNum: " + inputColumn
187:                            + "\n\tOutputColNum: " + outputColumn
188:                            + "\n\tAggregatorColNum: " + aggregatorColumn
189:                            + "\n\tDistinct: " + isDistinct + "\n" + rd;
190:                } else {
191:                    return "";
192:                }
193:            }
194:
195:            //////////////////////////////////////////////
196:            //
197:            // FORMATABLE
198:            //
199:            //////////////////////////////////////////////
200:            /**
201:             * Write this object out
202:             *
203:             * @param out write bytes here
204:             *
205:             * @exception IOException thrown on error
206:             */
207:            public void writeExternal(ObjectOutput out) throws IOException {
208:                out.writeObject(aggregateName);
209:                out.writeInt(inputColumn);
210:                out.writeInt(outputColumn);
211:                out.writeInt(aggregatorColumn);
212:                out.writeObject(aggregatorClassName);
213:                out.writeBoolean(isDistinct);
214:                out.writeObject(rd);
215:            }
216:
217:            /**
218:             * Read this object from a stream of stored objects.
219:             *
220:             * @param in read this.
221:             *
222:             * @exception IOException					thrown on error
223:             * @exception ClassNotFoundException		thrown on error
224:             */
225:            public void readExternal(ObjectInput in) throws IOException,
226:                    ClassNotFoundException {
227:                aggregateName = (String) in.readObject();
228:                inputColumn = in.readInt();
229:                outputColumn = in.readInt();
230:                aggregatorColumn = in.readInt();
231:                aggregatorClassName = (String) in.readObject();
232:                isDistinct = in.readBoolean();
233:                rd = (ResultDescription) in.readObject();
234:            }
235:
236:            /**
237:             * Get the formatID which corresponds to this class.
238:             *
239:             *	@return	the formatID of this class
240:             */
241:            public int getTypeFormatId() {
242:                return StoredFormatIds.AGG_INFO_V01_ID;
243:            }
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.