Source Code Cross Referenced for DerbyEclipsePlugin.java in  » Database-DBMS » db-derby-10.2 » org » apache » derbyBuild » eclipse » 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.derbyBuild.eclipse 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derbyBuild.eclipse.DerbyEclipsePlugin
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.derbyBuild.eclipse;
023:
024:        import java.util.*;
025:        import java.io.File;
026:        import java.io.FileOutputStream;
027:        import java.io.FileWriter;
028:        import java.io.InputStream;
029:        import org.apache.derby.iapi.services.info.ProductGenusNames;
030:        import org.apache.derby.iapi.services.info.PropertyNames;
031:
032:        /**
033:         * This class provides the functionality to create the build related
034:         * related properties, which are used for creating the Derby plug-in
035:         * for Eclipse by the ANT script.
036:         *
037:         * - The Eclipse plugin will be called 'Apache Derby Core Plug-in for Eclipse'
038:         *
039:         * - The plugin can be build from the main build.xml using 'ant' with the 'plugin'
040:         *   argument.
041:         *
042:         * - The package name for the Derby plug-in will
043:         *   be: org.apache.derby.core_<major>.<minor>.<interim> (example: org.apache.derby.core_10.1.0).
044:         *
045:         * - The plugin.xml in the Derby plug-in will show the actual version of the
046:         *   the Derby build (example: 10.1.0.0 (111545M) ). This can be viewed from
047:         *   Help - About Eclipse Platform - Plug-in Details of Eclipse of the Eclipse IDE
048:         *
049:         * - The zip file created for the DerbyEclipse under the jars directory will have the name:
050:         *   derby_core_plugin_<major>.<minor>.<interim>.zip (example:derby_core_plugin_10.1.0.zip)
051:         *
052:         * - The current packaging includes derby.jar, derbynet.jar and
053:         *   derbytools.jar. The locale jars for Derby are not included yet.
054:         *
055:         * @author Rajesh Kartha
056:         */
057:        public class DerbyEclipsePlugin {
058:            /*
059:             * Derby plug-in package property and name
060:             */
061:            private static String PLUGIN_PKG = "plugin.derby.core";
062:            private static String PLUGIN_PKG_NAME = "org.apache.derby.core";
063:            /*
064:             * Derby plug-in zip file property and name
065:             */
066:            private static String PLUGIN_ZIP_FILE = "plugin.derby.core.zipfile";
067:            private static String PLUGIN_ZIP_FILE_NAME = "derby_core_plugin";
068:            /*
069:             * Derby plug-in build properties and name
070:             */
071:            private static String PLUGIN_VERSION = "plugin.derby.version";
072:            private static String PLUGIN_VERSION_BUILD_NUMBER = "plugin.derby.version.build.number";
073:            private static int MAINT_DIV = 1000000;
074:
075:            /*
076:             * plugin.xml file information, split into three parts
077:             */
078:            private static String part_1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
079:                    + "<?eclipse version=\"3.0\"?> \n"
080:                    + "<plugin \n"
081:                    + "\t id=\"org.apache.derby.core\" \n"
082:                    + "\t name=\"Apache Derby Core Plug-in for Eclipse\" \n"
083:                    + "\t version=\"";
084:
085:            private static String part_2 = "\n\t provider-name=\"";
086:            private static String part_3 = "\n\t <runtime> \n"
087:                    + "\t\t <library name=\"derby.jar\"> \n"
088:                    + "\t\t\t <export name=\"*\"/> \n" + "\t\t </library> \n"
089:                    + "\t\t <library name=\"derbyclient.jar\"> \n"
090:                    + "\t\t\t <export name=\"*\"/> \n" + "\t\t </library> \n"
091:                    + "\t\t <library name=\"derbytools.jar\"> \n"
092:                    + "\t\t\t <export name=\"*\"/> \n" + "\t\t </library> \n"
093:                    + "\t\t <library name=\"derbynet.jar\"> \n"
094:                    + "\t\t\t <export name=\"*\"/> \n" + "\t\t </library> \n"
095:                    + "\t </runtime> \n" + "\t <requires> \n"
096:                    + "\t </requires> \n" + "</plugin>";
097:
098:            private String version = "";
099:            private String tmpPropFile = "plugintmp.properties";
100:            private static File tmpFileLocation = null;
101:            private static Properties tmpProp = new Properties();
102:            private String pluginXMLFile = "plugin.xml";
103:
104:            /*
105:             * The public main() method to test the working of this class. A valid destination
106:             * String is all that is needed as an argument for running this class.
107:             * <p>
108:             * example: java DerbyEclipsePlugin <destination>
109:             * <p>
110:             */
111:
112:            public static void main(String[] args) {
113:                if (args.length <= 0) {
114:                    System.out.println("Incorrect number of arguments.");
115:                    return;
116:                }
117:                try {
118:                    tmpFileLocation = new File(args[0]);
119:                    DerbyEclipsePlugin dep = new DerbyEclipsePlugin();
120:                    dep.getProps();
121:                    dep.createTmpFiles();
122:                } catch (Exception e) {
123:                    e.printStackTrace();
124:                }
125:
126:            }
127:
128:            /*
129:             * For internal use only.
130:             * getProps() generates the required Properties from the DBMS.properties file.
131:             *
132:             * @exception	Exception if there is an error
133:             */
134:            private void getProps() throws Exception {
135:                InputStream versionStream = getClass().getResourceAsStream(
136:                        ProductGenusNames.DBMS_INFO);
137:                Properties prop = new Properties();
138:                prop.load(versionStream);
139:
140:                //create the tmp Prop file
141:                tmpProp.put(PLUGIN_PKG, PLUGIN_PKG_NAME); //package name
142:                tmpProp.put(PLUGIN_ZIP_FILE, PLUGIN_ZIP_FILE_NAME); //zip file name
143:                tmpProp.put(PropertyNames.PRODUCT_VENDOR_NAME, prop
144:                        .getProperty(PropertyNames.PRODUCT_VENDOR_NAME));
145:                int maint = Integer.parseInt(prop
146:                        .getProperty(PropertyNames.PRODUCT_MAINT_VERSION));
147:                version = prop.getProperty(PropertyNames.PRODUCT_MAJOR_VERSION)
148:                        + "."
149:                        + prop.getProperty(PropertyNames.PRODUCT_MINOR_VERSION)
150:                        + "." + maint / MAINT_DIV;
151:                tmpProp.put(PLUGIN_VERSION, version);
152:
153:                //With Eclipse 3.1M5a release, adding '(PRODUCT_BUILD_NUMBER)' to the 'version' info in
154:                //the plugin.xml creates some issues while loading. It has been removed and only the
155:                //MAJOR.Minor.interim.point has been added to the plugin.xml.
156:                //The actual Derby build version can be obtained using the 'sysinfo' tool.
157:
158:                version += "." + maint % MAINT_DIV;
159:                tmpProp.put(PLUGIN_VERSION_BUILD_NUMBER, version + " ("
160:                        + prop.getProperty(PropertyNames.PRODUCT_BUILD_NUMBER)
161:                        + ")");
162:
163:                //add info to plugin.xml strings
164:                part_1 += version + "\"";
165:                part_2 += tmpProp
166:                        .getProperty(PropertyNames.PRODUCT_VENDOR_NAME)
167:                        + "\">\n";
168:
169:            }
170:
171:            /*
172:             * For internal use only.
173:             * createTmpFiles() create the temporary files with the build properties at the specified location.
174:             *
175:             * @exception	Exception if there is an error
176:             */
177:            private void createTmpFiles() throws Exception {
178:                File file = new File(tmpFileLocation.getAbsolutePath()
179:                        + File.separator + tmpPropFile);
180:                FileOutputStream fo = new FileOutputStream(file);
181:                tmpProp.store(fo, null);
182:                fo.close();
183:                file = new File(tmpFileLocation.getAbsolutePath()
184:                        + File.separator + pluginXMLFile);
185:                FileWriter fw = new FileWriter(file);
186:                fw.write(part_1 + part_2 + part_3);
187:                fw.close();
188:
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.