Source Code Cross Referenced for SunReferenceEnhancer.java in  » Database-ORM » TJDO » com » triactive » jdo » enhance » 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 ORM » TJDO » com.triactive.jdo.enhance 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: SunReferenceEnhancer.java,v 1.6 2003/10/20 05:59:26 jackknifebarber Exp $
003:         */
004:
005:        package com.triactive.jdo.enhance;
006:
007:        import java.io.File;
008:        import java.util.Arrays;
009:        import java.util.ArrayList;
010:        import java.util.Collection;
011:        import java.util.List;
012:
013:        /**
014:         * This is an implementation of the Enhancer that wraps Sun's JDO Reference
015:         * Implementation class endhancer.
016:         *
017:         * @version $Revision: 1.6 $
018:         */
019:        public class SunReferenceEnhancer extends Enhancer {
020:            private final Collection jdoFiles;
021:            private final String destDir;
022:            private final boolean verbose;
023:
024:            private SunReferenceEnhancer(String destDir, boolean verbose,
025:                    Collection jdoFiles) {
026:                super ();
027:
028:                this .destDir = destDir;
029:                this .verbose = verbose;
030:                this .jdoFiles = jdoFiles;
031:            }
032:
033:            /**
034:             * This method accepts a list of jdo files that should be enhanced by
035:             * the Sun Reference Implementation enhancer.
036:             *
037:             * @param classNames  The list of class names to be enhanced
038:             */
039:            protected int callExternalEnhancer(String[] classNames)
040:                    throws Exception {
041:                int returnCode = 0;
042:
043:                if (classNames.length > 0) {
044:                    ArrayList args = new ArrayList();
045:
046:                    args.add("-f"); // Force writing of .class files.
047:                    args.add("-d");
048:                    args.add(destDir);
049:
050:                    if (verbose)
051:                        args.add("-v");
052:
053:                    args.addAll(jdoFiles);
054:
055:                    for (int i = 0; i < classNames.length; ++i) {
056:                        String name = classNames[i];
057:                        System.out.println("Enhancing class " + name);
058:
059:                        args.add(new File(destDir, name.replace('.', '/')
060:                                + ".class").toString());
061:                    }
062:
063:                    com.sun.jdori.enhancer.Main main = new com.sun.jdori.enhancer.Main();
064:                    returnCode = main.process((String[]) args
065:                            .toArray(new String[args.size()]));
066:                }
067:
068:                return returnCode;
069:            }
070:
071:            /**
072:             * Called when the class is invoked from the command line.
073:             *
074:             * @param args
075:             *   A list of JDO metadata files (*.jdo files). The list may optionally
076:             *   be prefixed by a -l flag followed by the name of a file to which
077:             *   the list of enhanced classes will be written to.  The -d argument
078:             *   is also accepted to specify the destination directory to write the
079:             *   class files to.  The -v flag makes the enhancer run with verbose
080:             *   output.
081:             */
082:            public static void main(String[] args) throws Exception {
083:                String classListFile = null;
084:                String destDir = ".";
085:                boolean verbose = false;
086:                ArrayList jdoFiles = new ArrayList();
087:
088:                for (int i = 0; i < args.length; i++) {
089:                    if (args[i].equals("-l")) {
090:                        classListFile = args[++i];
091:                    } else if (args[i].equals("-d")) {
092:                        destDir = args[++i];
093:                    } else if (args[i].equals("-v")) {
094:                        verbose = true;
095:                    } else {
096:                        jdoFiles.add(args[i]);
097:                    }
098:                }
099:
100:                List classNames = getOrderedClassNames((String[]) jdoFiles
101:                        .toArray(new String[jdoFiles.size()]));
102:
103:                if (classListFile != null)
104:                    writeClassListFile(classListFile, classNames);
105:
106:                System
107:                        .exit(new SunReferenceEnhancer(destDir, verbose,
108:                                jdoFiles).enhance(classNames));
109:            }
110:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.