Source Code Cross Referenced for Transformations.java in  » Database-JDBC-Connection-Pool » octopus » org » webdocwf » util » loader » transformation » 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 JDBC Connection Pool » octopus » org.webdocwf.util.loader.transformation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:          Transformation - Transformations in Octopus Loader.
003:            Copyright (C) 2002-2004  Together
004:            This library is free software; you can redistribute it and/or
005:            modify it under the terms of the GNU Lesser General Public
006:            License as published by the Free Software Foundation; either
007:            version 2.1 of the License, or (at your option) any later version.
008:            This library is distributed in the hope that it will be useful,
009:            but WITHOUT ANY WARRANTY; without even the implied warranty of
010:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
011:            Lesser General Public License for more details.
012:            You should have received a copy of the GNU Lesser General Public
013:            License along with this library; if not, write to the Free Software
014:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
015:         Transformation.java
016:         Date: 05.04.2004.
017:         @version 1.0
018:         @author: Zoran Milakovic zoran@prozone.co.yu
019:         @author: Milosevic Sinisa sinisa@prozone.co.yu
020:         */package org.webdocwf.util.loader.transformation;
021:
022:        import java.util.ArrayList;
023:        import java.util.List;
024:        import java.util.Vector;
025:
026:        import org.w3c.dom.Document;
027:        import org.webdocwf.util.loader.LoaderException;
028:        import org.webdocwf.util.loader.OctopusXMLUtil;
029:        import org.webdocwf.util.loader.logging.Logger;
030:
031:        /**
032:         *
033:         * Transformation - transformations in Octopus Loader.
034:         */
035:        public class Transformations {
036:
037:            public ArrayList transformations = new ArrayList();
038:            public ArrayList transformationsTableIDList = new ArrayList();
039:            public Logger logger;
040:
041:            private int iTransformationSourceColumsCnt = 0;
042:
043:            private Vector transformationNames = new Vector();// vector with names of all transformation tags(names from transformation tag)
044:            private Vector transformationClassNames = new Vector();//vector with classNames of all transformation tags(className from transformation tag)
045:            private Vector transformatorConfigNames = new Vector();//vector with configNames of all transformation tags(configName from transformation tag)
046:            private Vector transformationsTargetColumnNames = new Vector();//vector with tableNames of all transformation tags(tableName from transformation tag)
047:            private Vector transformationsTableNames = new Vector();//vector with tableNames of all transformation tags(tableName from transformation tag)
048:            private Vector transformationsTableIDs = new Vector();//vector with tableIDs of all transformation tags(tableID from transformation tag)
049:            private Vector transformationsValueModes = new Vector();//vector with valueMode of all transformation tags(valueMode from transformation tag)
050:
051:            /* cached data to avoid loops */
052:
053:            //list with all source column names, of all transformations in this transformations tag
054:            private List allTransformationsSourceColNames = new ArrayList();
055:
056:            /**
057:             * Empty constructor of Transformations class
058:             */
059:            public Transformations(Logger logger) {
060:
061:                this .transformationNames = new Vector();
062:                this .transformationClassNames = new Vector();
063:                this .transformatorConfigNames = new Vector();
064:                this .transformationsTableNames = new Vector();
065:                this .transformationsTableIDs = new Vector();
066:                this .transformationsTableIDList = new ArrayList();
067:                this .transformationsValueModes = new Vector();
068:                this .logger = logger;
069:            }
070:
071:            /**
072:             * This method creates transformation elements with data from transformation tag (loaderJob.olj)
073:             * @param doc represents Object document
074:             * @param importJob represents current import job
075:             */
076:            //Creates Vectors filled with data from transformation tag(name, transformatorClassName, transformatorConfig)
077:            //and also from targetColumn tags(tableName, tableID).
078:            public void createTransformationElements(Document doc, int importJob)
079:                    throws LoaderException {
080:                //transformation tags
081:                this .transformationNames = OctopusXMLUtil.importValue(doc,
082:                        "transformation", "name", importJob);
083:                this .transformationClassNames = OctopusXMLUtil.importValue(doc,
084:                        "transformation", "transformatorClassName", importJob);
085:                this .transformatorConfigNames = OctopusXMLUtil.importValue(doc,
086:                        "transformation", "transformatorConfig", importJob);
087:                //targetColumn tags
088:                this .transformationsTargetColumnNames = OctopusXMLUtil
089:                        .importValue(doc, "targetColumn", "name", importJob);
090:                this .transformationsTableNames = OctopusXMLUtil.importValue(
091:                        doc, "targetColumn", "tableName", importJob);
092:                this .transformationsTableIDs = OctopusXMLUtil.importValue(doc,
093:                        "targetColumn", "tableID", importJob);
094:                this .transformationsValueModes = OctopusXMLUtil.importValue(
095:                        doc, "targetColumn", "valueMode", importJob);
096:
097:                createList(this .transformationsTableIDs);
098:                try {
099:                    createTransformations(doc, importJob);
100:                } catch (Exception e) {
101:                    throw new LoaderException("Error in Transformations.", e);
102:                }
103:                //count all transformations source columns
104:                for (int i = 0; i < this .getTransformations().size(); i++) {
105:                    this .iTransformationSourceColumsCnt += ((Transformation) this 
106:                            .getTransformations().get(i))
107:                            .getSourceColumnNames().size();
108:                }
109:            }
110:
111:            /** This method will create ArrayList from transTableIDs and transTableNames which are Vectors.
112:             * @param transTableIDs represents target table names in importDefinition
113:             */
114:            private void createList(Vector transTableIDs) {
115:                for (int i = 0; i < transTableIDs.size(); i++) {
116:                    String tableID = transTableIDs.elementAt(i).toString();
117:                    if (!transformationsTableIDList.contains(tableID)) {
118:                        transformationsTableIDList.add(tableID);
119:                    }
120:                }
121:
122:            }
123:
124:            /**
125:             * This method will create new ArrayList with objects of Transformation class
126:             * @param doc represents Object document
127:             * @param importJob represents current import job
128:             */
129:            private void createTransformations(Document doc, int iJobNumber)
130:                    throws LoaderException {
131:
132:                for (int i = 0; i < this .transformationNames.size(); i++) {
133:                    try {
134:                        Transformation newTransformation = new Transformation(
135:                                this .transformationNames.get(i).toString(),
136:                                this .transformationClassNames.get(i).toString(),
137:                                this .transformatorConfigNames.get(i).toString(),
138:                                OctopusXMLUtil.getDocumentFragment(doc,
139:                                        "transformation", i, iJobNumber));
140:                        transformations.add(newTransformation);
141:                        allTransformationsSourceColNames
142:                                .addAll(newTransformation
143:                                        .getSourceColumnNames());
144:                    } catch (ClassNotFoundException e) {
145:                        LoaderException le = new LoaderException(
146:                                "ClassNotFoundException for class "
147:                                        + this .transformationClassNames.get(i)
148:                                        + " while init transformation named :  "
149:                                        + this .transformationNames.get(i)
150:                                        + "\n", e);
151:                        this .logger
152:                                .write(
153:                                        "normal",
154:                                        "\nError : ClassNotFoundException for class "
155:                                                + this .transformationClassNames
156:                                                        .get(i)
157:                                                + " while init transformation named :  "
158:                                                + this .transformationNames
159:                                                        .get(i) + "\n");
160:                        throw le;
161:                    } catch (Exception e) {
162:                        LoaderException le = new LoaderException(
163:                                "Exception while init transformation named :  "
164:                                        + this .transformationNames.get(i)
165:                                        + "\n", e);
166:                        this .logger.write("normal",
167:                                "\nError : Exception while init transformation named :  "
168:                                        + this .transformationNames.get(i)
169:                                        + "\n");
170:                        throw le;
171:                    }
172:                }
173:
174:            }
175:
176:            /**
177:             * This method returns transform (ArrayList) in which are objects of class Transformation with data for each
178:             * transformation tag in this importJob
179:             */
180:            //returns array list with all Transformation objects
181:            public ArrayList getTransformations() {
182:                return transformations;
183:            }
184:
185:            /**
186:             * This method returns transformationsTableIDs (ArrayList)
187:             */
188:            //ZK added this for comparation which table has transformation tags or not
189:            public ArrayList getTransformationsTableIDs() {
190:                return transformationsTableIDList;
191:            }
192:
193:            /**
194:             * This method reset all variables
195:             */
196:            //reset transform (array list in which are placed transformation objects)
197:            public void reset() {
198:
199:                this .transformationNames = new Vector();
200:                this .transformationsTargetColumnNames = new Vector();
201:                this .transformationClassNames = new Vector();
202:                this .transformatorConfigNames = new Vector();
203:                this .transformationsValueModes = new Vector();
204:                this .transformationsTableIDList = new ArrayList();
205:                this .transformations = new ArrayList();
206:            }
207:
208:            public int getTransformationSourceColumsCnt() {
209:                return this .iTransformationSourceColumsCnt;
210:            }
211:
212:            public List getAllTransformationSourceColNames() {
213:                return this.allTransformationsSourceColNames;
214:            }
215:
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.