Source Code Cross Referenced for ExternalUDTDescriptorTransformer.java in  » Database-ORM » ODAL » com » completex » objective » tools » generators » 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 » ODAL » com.completex.objective.tools.generators 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Objective Database Abstraction Layer (ODAL)
003:         *  Copyright (c) 2004, The ODAL Development Group
004:         *  All rights reserved.
005:         *  For definition of the ODAL Development Group please refer to LICENCE.txt file
006:         *
007:         *  Distributable under LGPL license.
008:         *  See terms of license at gnu.org.
009:         */package com.completex.objective.tools.generators;
010:
011:        import com.completex.objective.components.log.Log;
012:        import com.completex.objective.components.log.adapter.StdOutputLogAdapter;
013:        import com.completex.objective.components.persistency.UserDefinedTypeMetaModel;
014:        import com.completex.objective.components.persistency.meta.MetaModel;
015:        import com.completex.objective.components.persistency.meta.ModelStorerPlugin;
016:        import com.completex.objective.components.persistency.meta.adapter.ModelLoaderAdapter;
017:        import com.completex.objective.components.sdl.reader.SdlReader;
018:        import com.completex.objective.components.sdl.reader.impl.SdlReaderImpl;
019:        import com.completex.objective.util.PropertyMap;
020:
021:        import java.io.FileInputStream;
022:        import java.io.IOException;
023:        import java.io.InputStream;
024:        import java.sql.SQLException;
025:        import java.util.Properties;
026:
027:        /**
028:         * Under construction
029:         *
030:         * @author Gennady Krizhevsky
031:         */
032:        public class ExternalUDTDescriptorTransformer {
033:
034:            protected static final Log logger = StdOutputLogAdapter
035:                    .newInfoLogInstance();
036:            protected ModelLoaderAdapter modelFileLoaderAdapter;
037:            protected MetaModel model;
038:            protected SdlReader sdlReader = new SdlReaderImpl();
039:            protected ModelStorerPlugin modelStorerPlugin;
040:            private UserDefinedTypeMetaModel userDefinedTypeMetaModel;
041:
042:            //    static final String INTERNAL_DESC_FILE = PersistentDescriptorGenerator.INTERNAL_DESC_FILE;             // Internal descriptor file path
043:            //    static final String EXTERNAL_DESC_FILE = PersistentDescriptorGenerator.EXTERNAL_DESC_FILE;             // External descriptor file path
044:            static final String OUT_DIR = PersistentDescriptorGenerator.TAG_OUT_DIR;
045:            static final String URL = PersistentDescriptorGenerator.TAG_URL;
046:            static final String PLUGINS_TRANSFORMER_CLASS = "plugins.transformer_class";
047:
048:            //
049:            // input params:
050:            //
051:            private boolean useDefaultPlugins;
052:            private String url;
053:
054:            public ExternalUDTDescriptorTransformer(String propertiesPath)
055:                    throws Exception {
056:                setUp(propertiesPath);
057:            }
058:
059:            protected void setUp(String propertiesPath) throws Exception,
060:                    SQLException {
061:                //        PropertyMap propertyMap = getProperties(propertiesPath);
062:                //
063:                //        String outDir = propertyMap.getProperty(OUT_DIR, true);
064:                //        //
065:                //        // plugins:
066:                //        //
067:                //
068:                //        url = propertyMap.getProperty(URL, true);
069:                //        useDefaultPlugins = propertyMap.getBoolean(USE_DEFAULT_PLUGINS);
070:                //        String pexFileName = propertyMap.getProperty(PLUGINS_EXTERNAL_DESC_FILE);
071:                //        String pinFileName = propertyMap.getProperty(PLUGINS_INTERNAL_DESC_FILE);
072:                //        String poutDir = propertyMap.getProperty(PLUGINS_OUT_DIR);
073:                //        String pluginTransformerClassName = propertyMap.getProperty(PLUGINS_TRANSFORMER_CLASS);
074:                //        if (useDefaultPlugins && url.indexOf("oracle") >= 0) {
075:                //
076:                //
077:                //            OracleUdtDatabaseModelLoaderPlugin loaderPlugin = new OracleUdtDatabaseModelLoaderPlugin(pexFileName, pinFileName, poutDir, false);
078:                //            userDefinedTypeMetaModel = loaderPlugin.load(null);
079:                //
080:                //            if (pluginTransformerClassName != null) {
081:                //                UserDefinedTypeModelTransformer userDefinedTypeModelTransformer = null;
082:                //                try {
083:                //                    userDefinedTypeModelTransformer = (UserDefinedTypeModelTransformer) Class.forName(pluginTransformerClassName).newInstance();
084:                //                } catch (Exception e) {
085:                //                    throw new RuntimeException(e.getMessage() + " : Cannot create UserDefinedTypeModelTransformer", e);
086:                //                }
087:                //                userDefinedTypeModelTransformer.transformModel(userDefinedTypeMetaModel);
088:                //            }
089:                //
090:                //            UdtModelStorerPlugin storerPlugin = new UdtModelStorerPlugin(pexFileName, pinFileName, poutDir);
091:                //            modelStorerPlugin = storerPlugin.getExternalFileModelStorerAdapter();
092:                //        }
093:                //        System.out.println("GENERATED FILES IN " + outDir);
094:            }
095:
096:            protected UserDefinedTypeMetaModel transform(
097:                    UserDefinedTypeMetaModel userDefinedTypeMetaModel) {
098:                return userDefinedTypeMetaModel;
099:            }
100:
101:            public void process() throws IOException {
102:                if (userDefinedTypeMetaModel == null) {
103:                    throw new RuntimeException(
104:                            "Set up was not run for this component");
105:                }
106:
107:                UserDefinedTypeMetaModel model = transform(userDefinedTypeMetaModel);
108:                modelStorerPlugin.store(model);
109:            }
110:
111:            protected PropertyMap getProperties(String propertiesPath)
112:                    throws IOException {
113:                if (propertiesPath == null) {
114:                    throw new IllegalArgumentException("propertiesPath is null");
115:                }
116:                InputStream inputStream = null;
117:                inputStream = new FileInputStream(propertiesPath);
118:                return getProperties(inputStream);
119:            }
120:
121:            protected PropertyMap getProperties(InputStream inputStream)
122:                    throws IOException {
123:                Properties properties = new Properties();
124:                properties.load(inputStream);
125:                PropertyMap propertyMap = new PropertyMap(properties);
126:                return propertyMap;
127:            }
128:
129:            protected MetaModel loadModelFromFile() throws Exception {
130:                logger.info("loadModelFromFile started");
131:
132:                MetaModel model = modelFileLoaderAdapter.load(null);
133:                logger.info("loadModelFromFile ended");
134:
135:                return model;
136:            }
137:
138:            public static void main(String[] args) throws Exception {
139:                if (args.length < 1) {
140:                    System.out
141:                            .println("ERROR:  ExternalUDTDescriptorTransformer has to have one command line parameter - <descritor.properties> ");
142:                    System.exit(1);
143:                }
144:                ExternalUDTDescriptorTransformer transformer = new ExternalUDTDescriptorTransformer(
145:                        args[0]);
146:                transformer.process();
147:            }
148:
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.