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


001:        /**
002:          LoaderJobAttrReader - Class used for reading attributes from  tag.
003:            Copyright (C) 2002-2003  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:         LoaderJobAttrReader.java
016:         Date: 20.5.2003.
017:         @version 1.0.0
018:         @author: Zoran Milakovic zoran@prozone.co.yu
019:         */package org.webdocwf.util.loader;
020:
021:        import java.io.IOException;
022:        import java.io.InputStream;
023:
024:        import javax.xml.parsers.DocumentBuilder;
025:        import javax.xml.parsers.DocumentBuilderFactory;
026:
027:        import org.w3c.dom.Document;
028:        import org.w3c.dom.NamedNodeMap;
029:        import org.w3c.dom.Node;
030:        import org.w3c.dom.NodeList;
031:        import org.webdocwf.util.loader.logging.Logger;
032:
033:        /**
034:         * Class used for reading attribute values from tags in XML file.
035:         *
036:         * @author     Zoran Milakovic
037:         * @version    1.1
038:         */
039:        public class LoaderJobAttrReader {
040:
041:            //parametri loaderJob elementa
042:            boolean bDefaultOnErrorContinue = false;
043:            boolean bDefaultCommit = true;
044:            String strDefaultUserID = "";
045:            String strDefaultLogDir = "";
046:            String strDefaultLogFile = "default";
047:            String strDefaultVendorConfig = "OctopusDBVendors.xml";
048:            boolean bDefaultObjectIDAutoCreate = false;
049:            int iDefaultObjectIDStartValue = 1;
050:            int iDefaultCommitCount = 100;
051:            int iLoaderJobCommitCount = 0;
052:            boolean bDefaultOidLogic = true;
053:
054:            String strDefaultLogMode = "normal";
055:            int iDefaultObjectIDIncrement = 20;
056:            String strDefaultObjectIDTableName = "objectid";
057:            String strDefaultObjectIDColumnName = "next";
058:            String strDefaultObjectIDNameColumnName = "";
059:            String strDefaultObjectIDNameColumnValue = "";
060:            String strDefaultTableMode = "Query";
061:
062:            //rale
063:            String strDefaultDataCutOff = "";
064:            String strLogTableName = "";
065:            String strLogTable = "";
066:            String strLogColumnName = "";
067:            String strLogRowNumber = "";
068:            String strLogOriginalValue = "";
069:            String strLogNewValue = "";
070:            String strLogImportDefinitionName = "";
071:            String strLogOperationName = "";
072:            String strLogTypeName = "";
073:            String strLogFailedStatemet = "";
074:            String strLogTime = "";
075:
076:            private Logger logger;
077:            String strLogClassName = "";
078:            String strPathToLoggerConf = "";
079:            String setFetchSize = "";
080:            String setCursorName = "";
081:
082:            /**
083:             * Method importLoaderJobAttributes is used to analyse import XML file
084:             * about attributes of root element(loaderJob). Values of these attributes puts in global variables.
085:             * @param inputStream Data from inputXML file which is converted into InputStream.
086:             * @throws LoaderException
087:             */
088:            public void importLoaderJobAttributes(InputStream inputStream)
089:                    throws LoaderException {
090:                Document doc = null;
091:                this .logger.write("full",
092:                        "\timportLoaderJobAttributes method is started.");
093:                try {
094:                    DocumentBuilderFactory dbf = DocumentBuilderFactory
095:                            .newInstance();
096:                    DocumentBuilder db = null;
097:                    db = dbf.newDocumentBuilder();
098:                    doc = db.parse(inputStream);
099:                } catch (Exception e) {
100:                    this .logger.write("normal", "Sorry, an error occurred: "
101:                            + e);
102:                    LoaderException le = new LoaderException("Exception: ",
103:                            (Throwable) e);
104:                    throw le;
105:                    //            System.exit(1);
106:                }
107:                if (doc != null) {
108:                    NodeList tagRestartCounter = doc
109:                            .getElementsByTagName("loaderJob");
110:                    if (tagRestartCounter.getLength() != 0) {
111:                        NamedNodeMap attrs = tagRestartCounter.item(0)
112:                                .getAttributes();
113:                        Node nodeResult = attrs.getNamedItem("logMode");
114:                        if (nodeResult != null)
115:                            this .strDefaultLogMode = nodeResult.getNodeValue();
116:
117:                        nodeResult = attrs.getNamedItem("objectIDIncrement");
118:                        String strIncrement = "";
119:                        if (nodeResult != null)
120:                            strIncrement = nodeResult.getNodeValue();
121:                        if (!strIncrement.equals(""))
122:                            this .iDefaultObjectIDIncrement = Integer
123:                                    .parseInt(strIncrement);
124:
125:                        nodeResult = attrs.getNamedItem("objectIDTableName");
126:                        if (nodeResult != null)
127:                            this .strDefaultObjectIDTableName = nodeResult
128:                                    .getNodeValue();
129:
130:                        nodeResult = attrs.getNamedItem("objectIDColumnName");
131:                        if (nodeResult != null)
132:                            this .strDefaultObjectIDColumnName = nodeResult
133:                                    .getNodeValue();
134:
135:                        //log table
136:                        nodeResult = attrs.getNamedItem("dataCutOff");
137:                        if (nodeResult != null)
138:                            this .strDefaultDataCutOff = nodeResult
139:                                    .getNodeValue();
140:
141:                        nodeResult = attrs.getNamedItem("logTableName");
142:                        if (nodeResult != null)
143:                            this .strLogTableName = nodeResult.getNodeValue();
144:
145:                        nodeResult = attrs.getNamedItem("logTable");
146:                        if (nodeResult != null)
147:                            this .strLogTable = nodeResult.getNodeValue();
148:
149:                        nodeResult = attrs.getNamedItem("logColumnName");
150:                        if (nodeResult != null)
151:                            this .strLogColumnName = nodeResult.getNodeValue();
152:
153:                        nodeResult = attrs.getNamedItem("logRowNumber");
154:                        if (nodeResult != null)
155:                            this .strLogRowNumber = nodeResult.getNodeValue();
156:
157:                        nodeResult = attrs.getNamedItem("logOriginalValue");
158:                        if (nodeResult != null)
159:                            this .strLogOriginalValue = nodeResult
160:                                    .getNodeValue();
161:
162:                        nodeResult = attrs.getNamedItem("logNewValue");
163:                        if (nodeResult != null)
164:                            this .strLogNewValue = nodeResult.getNodeValue();
165:
166:                        nodeResult = attrs
167:                                .getNamedItem("logImportDefinitionName");
168:                        if (nodeResult != null)
169:                            this .strLogImportDefinitionName = nodeResult
170:                                    .getNodeValue();
171:
172:                        nodeResult = attrs.getNamedItem("logOperationName");
173:                        if (nodeResult != null)
174:                            this .strLogOperationName = nodeResult
175:                                    .getNodeValue();
176:
177:                        nodeResult = attrs.getNamedItem("logTypeName");
178:                        if (nodeResult != null)
179:                            this .strLogTypeName = nodeResult.getNodeValue();
180:                        //ZK added to support more information in logtable
181:                        nodeResult = attrs.getNamedItem("logTime");
182:                        if (nodeResult != null)
183:                            this .strLogTime = nodeResult.getNodeValue();
184:
185:                        nodeResult = attrs.getNamedItem("logPrimaryKeyValue");
186:                        if (nodeResult != null)
187:                            this .strLogFailedStatemet = nodeResult
188:                                    .getNodeValue();
189:                        //end
190:
191:                        nodeResult = attrs
192:                                .getNamedItem("objectIDNameColumnName");
193:                        if (nodeResult != null)
194:                            this .strDefaultObjectIDNameColumnName = nodeResult
195:                                    .getNodeValue();
196:
197:                        nodeResult = attrs
198:                                .getNamedItem("objectIDNameColumnValue");
199:                        if (nodeResult != null)
200:                            this .strDefaultObjectIDNameColumnValue = nodeResult
201:                                    .getNodeValue();
202:
203:                        nodeResult = attrs.getNamedItem("onErrorContinue");
204:                        if (nodeResult != null)
205:                            this .bDefaultOnErrorContinue = (new Boolean(
206:                                    nodeResult.getNodeValue())).booleanValue();
207:
208:                        nodeResult = attrs.getNamedItem("commit");
209:                        if (nodeResult != null)
210:                            this .bDefaultCommit = (new Boolean(nodeResult
211:                                    .getNodeValue())).booleanValue();
212:
213:                        nodeResult = attrs.getNamedItem("userID");
214:                        if (nodeResult != null)
215:                            this .strDefaultUserID = nodeResult.getNodeValue();
216:
217:                        nodeResult = attrs.getNamedItem("logDir");
218:                        if (nodeResult != null)
219:                            this .strDefaultLogDir = nodeResult.getNodeValue();
220:
221:                        nodeResult = attrs.getNamedItem("logFile");
222:                        if (nodeResult != null)
223:                            this .strDefaultLogFile = nodeResult.getNodeValue();
224:
225:                        nodeResult = attrs.getNamedItem("vendorConfig");
226:                        if (nodeResult != null)
227:                            this .strDefaultVendorConfig = nodeResult
228:                                    .getNodeValue();
229:
230:                        nodeResult = attrs.getNamedItem("objectIDAutoCreate");
231:                        if (nodeResult != null)
232:                            this .bDefaultObjectIDAutoCreate = (new Boolean(
233:                                    nodeResult.getNodeValue())).booleanValue();
234:
235:                        nodeResult = attrs.getNamedItem("objectIDStartValue");
236:                        if (nodeResult != null)
237:                            this .iDefaultObjectIDStartValue = Integer
238:                                    .parseInt(nodeResult.getNodeValue());
239:
240:                        nodeResult = attrs.getNamedItem("commitCount");
241:                        if (nodeResult != null)
242:                            this .iLoaderJobCommitCount = Integer
243:                                    .parseInt(nodeResult.getNodeValue());
244:
245:                        nodeResult = attrs.getNamedItem("oidLogic");
246:                        if (nodeResult != null)
247:                            this .bDefaultOidLogic = (new Boolean(nodeResult
248:                                    .getNodeValue())).booleanValue();
249:
250:                        nodeResult = attrs.getNamedItem("tableMode");
251:                        if (nodeResult != null)
252:                            this .strDefaultTableMode = nodeResult
253:                                    .getNodeValue();
254:
255:                        //        nodeResult = attrs.getNamedItem("logClassName");
256:                        //        if (nodeResult != null)
257:                        //          this.strLogClassName = nodeResult.getNodeValue();
258:
259:                        //        nodeResult = attrs.getNamedItem("pathToLoggerConf");
260:                        //        if (nodeResult != null)
261:                        //          this.strPathToLoggerConf = nodeResult.getNodeValue();
262:
263:                        nodeResult = attrs.getNamedItem("returnCode");
264:                        if (nodeResult != null) {
265:                            if (!ReturnCode.isParameter)
266:                                ReturnCode.setDefaultErrorReturnCode(Integer
267:                                        .parseInt(nodeResult.getNodeValue()));
268:                        }
269:
270:                        nodeResult = attrs.getNamedItem("setFetchSize");
271:                        if (nodeResult != null)
272:                            this .setFetchSize = nodeResult.getNodeValue();
273:
274:                        nodeResult = attrs.getNamedItem("setCursorName");
275:                        if (nodeResult != null)
276:                            this .setCursorName = nodeResult.getNodeValue();
277:
278:                    }
279:                }
280:                try {
281:                    inputStream.reset();
282:                } catch (IOException e) {
283:                    this .logger.write("normal", "Sorry, an error occurred: "
284:                            + e);
285:                    LoaderException le = new LoaderException("IOException: ",
286:                            (Throwable) e);
287:                    throw le;
288:                }
289:                this .logger.write("full",
290:                        "\timportLoaderJobAttributes method is finished.");
291:            }
292:
293:            /**
294:             * This method set setCursorName parameter
295:             * @param setCursorName is value of parameter
296:             */
297:            public void setSetCursorName(String setCursorName) {
298:                this .setCursorName = setCursorName;
299:            }
300:
301:            /**
302:             * This method read value from setCursorName parameter
303:             * @return value attribute.
304:             */
305:            public String getSetCursorName() {
306:                return this .setCursorName;
307:            }
308:
309:            /**
310:             * This method set setFetchSize parameter
311:             * @param setFetchSize is value of parameter
312:             */
313:            public void setSetFetchSize(String setFetchSize) {
314:                this .setFetchSize = setFetchSize;
315:            }
316:
317:            /**
318:             * This method read value from setFetchSize parameter
319:             * @return value attribute.
320:             */
321:            public String getSetFetchSize() {
322:                return this .setFetchSize;
323:            }
324:
325:            /**
326:             * Set Logger which is used for write in log file.
327:             * @param logger Logger object.
328:             */
329:            public void setLogger(Logger logger) {
330:                this .logger = logger;
331:            }
332:
333:            /**
334:             * This method read value from strDefaultTableMode parameter
335:             * @return default value of TableMode attribute.
336:             */
337:            public String getDefaultTableMode() {
338:                return this .strDefaultTableMode;
339:            }
340:
341:            /**
342:             * This method reads value from strDefaultDataCutOff parameter
343:             * @return value of parameter
344:             */
345:            public String getDefaultDataCutOff() {
346:                return this .strDefaultDataCutOff;
347:            }
348:
349:            /**
350:             * This method read value from strDefaultObjectIDNameColumnValue parameter
351:             * @return default value of ObjectIDNameColumnValue attribute.
352:             */
353:            public String getDefaultObjectIDNameColumnValue() {
354:                return this .strDefaultObjectIDNameColumnValue;
355:            }
356:
357:            /**
358:             * This method read value from strDefaultObjectIDNameColumnName parameter
359:             * @return default value of ObjectIDNameColumnName attribute.
360:             */
361:            public String getDefaultObjectIDNameColumnName() {
362:                return this .strDefaultObjectIDNameColumnName;
363:            }
364:
365:            /**
366:             * This method read value from strDefaultObjectIDColumnName parameter
367:             * @return default value of ObjectIDColumnName attribute.
368:             */
369:            public String getDefaultObjectIDColumnName() {
370:                return this .strDefaultObjectIDColumnName;
371:            }
372:
373:            /**
374:             * This method read value from strDefaultObjectIDTableName parameter
375:             * @return default value of ObjectIDTableName attribute.
376:             */
377:            public String getDefaultObjectIDTableName() {
378:                return this .strDefaultObjectIDTableName;
379:            }
380:
381:            /**
382:             * This method read value from iDefaultObjectIDIncrement parameter
383:             * @return default value of ObectIDIncrement attribute.
384:             */
385:            public int getDefaultObjectIDIncrement() {
386:                return this .iDefaultObjectIDIncrement;
387:            }
388:
389:            /**
390:             * This method read value from strDefaultLogMode parameter
391:             * @return default value of LogMode attribute.
392:             */
393:            public String getDefaultLogMode() {
394:                return this .strDefaultLogMode;
395:            }
396:
397:            /**
398:             * This method set value for strDefaultLogMode parameter
399:             */
400:            public void setDefaultLogMode(String logMode) {
401:                this .strDefaultLogMode = logMode;
402:            }
403:
404:            /**
405:             * This method read value from bDefaultOidLogic parameter
406:             * @return default value of OidLogic attribute.
407:             */
408:            public boolean getDefaultOidLogic() {
409:                return this .bDefaultOidLogic;
410:            }
411:
412:            /**
413:             * This method read value from iDefaultCommitCount parameter
414:             * @return default value of CommitCount attribute.
415:             */
416:            public int getDefaultCommitCount() {
417:                return this .iDefaultCommitCount;
418:            }
419:
420:            /**
421:             * This method read value from iLoaderJobCommitCount parameter
422:             * @return default value of iLoaderJobCommitCount attribute.
423:             */
424:            public int getLoaderJobCommitCount() {
425:                return this .iLoaderJobCommitCount;
426:            }
427:
428:            /**
429:             * This method read value from iDefaultObjectIDStartValue parameter
430:             * @return default value of ObjectIDStartValue attribute.
431:             */
432:            public int getDefaultObjectIDStartValue() {
433:                return this .iDefaultObjectIDStartValue;
434:            }
435:
436:            /**
437:             * This method read value from bDefaultObjectIDAutoCreate parameter
438:             * @return default value of ObjectIDAutoCreate attribute.
439:             */
440:            public boolean getDefaultObjectIDAutoCreate() {
441:                return this .bDefaultObjectIDAutoCreate;
442:            }
443:
444:            /**
445:             * This method read value from strDefaultVendorConfig parameter
446:             * @return default value of VendorConfig attribute.
447:             */
448:            public String getDefaultVendorConfig() {
449:                return this .strDefaultVendorConfig;
450:            }
451:
452:            /**
453:             * This method read value from strDefaultLogFile parameter
454:             * @return default value of LogFile attribute.
455:             */
456:            public String getDefaultLogFile() {
457:                return this .strDefaultLogFile;
458:            }
459:
460:            /**
461:             * This method read value from strDefaultLogDir parameter
462:             * @return default value of LogDir attribute.
463:             */
464:            public String getDefaultLogDir() {
465:                return this .strDefaultLogDir;
466:            }
467:
468:            /**
469:             * This method read value from strDefaultUserID parameter
470:             * @return default value of UserID attribute.
471:             */
472:            public String getDefaultUserID() {
473:                return this .strDefaultUserID;
474:            }
475:
476:            /**
477:             * This method read value from bDefaultCommit parameter
478:             * @return default value of Commit attribute.
479:             */
480:            public boolean getDefaultCommit() {
481:                return this .bDefaultCommit;
482:            }
483:
484:            /**
485:             * This method read value from bDefaultOnErrorContinue parameter
486:             * @return default value of OnErrorContinue attribute.
487:             */
488:            public boolean getDefaultOnErrorContinue() {
489:                return this .bDefaultOnErrorContinue;
490:            }
491:
492:            public void setDefaultOnErrorContinue(boolean value) {
493:                this .bDefaultOnErrorContinue = value;
494:            }
495:
496:            /**
497:             * This method read value from parameter strLogTableName
498:             * @return value of parameter
499:             */
500:            public String getLogTableName() {
501:                return this .strLogTableName;
502:            }
503:
504:            /**
505:             * This method read value from parameter strLogTable
506:             * @return value of parameter
507:             */
508:            public String getLogTable() {
509:                return this .strLogTable;
510:            }
511:
512:            /**
513:             * This method read value from parameter strLogColumnName
514:             * @return value of parameter
515:             */
516:            public String getLogColumnName() {
517:                return this .strLogColumnName;
518:            }
519:
520:            /**
521:             * This method read value from parameter strLogRowNumber
522:             * @return value of parameter
523:             */
524:            public String getLogRowNumber() {
525:                return this .strLogRowNumber;
526:            }
527:
528:            /**
529:             * This method read value from parameter strLogOriginalValue
530:             * @return value of parameter
531:             */
532:            public String getLogOriginalValue() {
533:                return this .strLogOriginalValue;
534:            }
535:
536:            /**
537:             * This method read value from parameter strLogNewValue
538:             * @return value of parameter
539:             */
540:            public String getLogNewValue() {
541:                return this .strLogNewValue;
542:            }
543:
544:            /**
545:             * This method read value from parameter strLogImportDefinitionName
546:             * @return value of parameter
547:             */
548:            public String getLogImportDefinitionName() {
549:                return this .strLogImportDefinitionName;
550:            }
551:
552:            /**
553:             * This method read value from parameter strLogOperationName
554:             * @return value of parameter
555:             */
556:            public String getLogOperationName() {
557:                return this .strLogOperationName;
558:            }
559:
560:            /**
561:             * This method read value from parameter strLogTypeName
562:             * @return value of parameter
563:             */
564:            public String getLogTypeName() {
565:                return this .strLogTypeName;
566:            }
567:
568:            /**
569:             *This method read value from parameter strLogPrimaryKeyValue
570:             * @return String column name
571:             */
572:            public String getLogFailedStatement() {
573:                return this .strLogFailedStatemet;
574:            }
575:
576:            /**
577:             * This method read value from parameter strLogTime
578:             * @return String column name
579:             */
580:            public String getLogTime() {
581:                return this.strLogTime;
582:            }
583:
584:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.