Source Code Cross Referenced for JOnASAntTool.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » ant » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.ant 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2005 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * Initial developer: Benoit Pelletier
022:         * --------------------------------------------------------------------------
023:         * $Id: JOnASAntTool.java 7884 2006-01-11 08:30:02Z pelletib $
024:         * --------------------------------------------------------------------------
025:         */package org.objectweb.jonas.ant;
026:
027:        import java.io.File;
028:
029:        import org.apache.tools.ant.Project;
030:        import org.apache.tools.ant.Task;
031:        import org.apache.tools.ant.types.FileSet;
032:        import org.apache.tools.ant.types.PatternSet.NameEntry;
033:
034:        import org.objectweb.jonas.ant.jonasbase.Apps;
035:        import org.objectweb.jonas.ant.jonasbase.Archives;
036:        import org.objectweb.jonas.ant.jonasbase.Ejbjars;
037:        import org.objectweb.jonas.ant.jonasbase.Rars;
038:        import org.objectweb.jonas.ant.jonasbase.Wars;
039:
040:        /**
041:         * Common constants or methods used by several classes of the package
042:         * @author Benoit Pelletier
043:         */
044:        public class JOnASAntTool {
045:
046:            /**
047:             * Name of JOnAS configuration file
048:             */
049:            public static final String JONAS_CONF_FILE = "jonas.properties";
050:
051:            /**
052:             * Name of Joram configuration file
053:             */
054:            public static final String JORAM_CONF_FILE = "a3servers.xml";
055:
056:            /**
057:             * Name of Joram admin configuration file (resource adaptor)
058:             */
059:            public static final String JORAM_ADMIN_CONF_FILE = "joramAdmin.xml";
060:
061:            /**
062:             * Name of Carol configuration file
063:             */
064:            public static final String CAROL_CONF_FILE = "carol.properties";
065:
066:            /**
067:             * Name of Tomcat configuration file
068:             */
069:            public static final String TOMCAT_CONF_FILE = "server.xml";
070:
071:            /**
072:             * Name of Tomcat configuration file
073:             */
074:            public static final String JETTY_CONF_FILE = "jetty5.xml";
075:
076:            /**
077:             * Name of P6Spy configuration file
078:             */
079:            public static final String P6SPY_CONF_FILE = "spy.properties";
080:
081:            /**
082:             * List of Wars to copy for each JONAS_BASE
083:             */
084:            public static final String[] WARS_LIST = new String[] {
085:                    "juddi.war", "autoload/jonasAdmin.war" };
086:
087:            /**
088:             * List of Rars to copy for each JONAS_BASE
089:             */
090:            public static final String[] RARS_LIST = new String[] {
091:                    "autoload/JOnAS_jdbcCP.rar", "autoload/JOnAS_jdbcDM.rar",
092:                    "autoload/JOnAS_jdbcDS.rar", "autoload/JOnAS_jdbcXA.rar" };
093:
094:            /**
095:             * List of EjbJars to copy for each JONAS_BASE
096:             */
097:            public static final String[] EJBJARS_LIST = new String[] { "" };
098:
099:            /**
100:             * List of Apps to copy for each JONAS_BASE
101:             */
102:            public static final String[] APPS_LIST = new String[] { "autoload/mejb.ear" };
103:
104:            /**
105:             * Private constructor for tool class
106:             */
107:            private JOnASAntTool() {
108:
109:            }
110:
111:            /**
112:             * Update the JONAS_BASE directory with ejbjars, webapps, rars, etc.
113:             * @param antTask target task
114:             * @param jonasRoot JONAS_ROOT
115:             * @param destDir destination directory
116:             **/
117:            public static void updateJonasBase(Task antTask, File jonasRoot,
118:                    File destDir) {
119:                Archives wars = new Wars();
120:                updateJonasBaseForArchives(antTask, jonasRoot, destDir, wars,
121:                        "webapps", WARS_LIST);
122:
123:                Archives ejbjars = new Ejbjars();
124:                updateJonasBaseForArchives(antTask, jonasRoot, destDir,
125:                        ejbjars, "ejbjars", EJBJARS_LIST);
126:
127:                Archives rars = new Rars();
128:                updateJonasBaseForArchives(antTask, jonasRoot, destDir, rars,
129:                        "rars", RARS_LIST);
130:
131:                Archives apps = new Apps();
132:                updateJonasBaseForArchives(antTask, jonasRoot, destDir, apps,
133:                        "apps", APPS_LIST);
134:
135:            }
136:
137:            /**
138:             * Update JONAS_BASE with given archives with lists of includes
139:             * @param antTask target task
140:             * @param jonasRoot JONAS_ROOT
141:             * @param destDir destination directory
142:             * @param archives tasks (webapps, rars, ejbjars)
143:             * @param folderName where to put files
144:             * @param listOfIncludes files to include
145:             */
146:            public static void updateJonasBaseForArchives(Task antTask,
147:                    File jonasRoot, File destDir, Archives archives,
148:                    String folderName, String[] listOfIncludes) {
149:                configure(antTask, archives);
150:                archives.setDestDir(destDir);
151:                FileSet fileSet = new FileSet();
152:                fileSet.setDir(new File(jonasRoot, folderName));
153:                for (int f = 0; f < listOfIncludes.length; f++) {
154:                    NameEntry ne = fileSet.createInclude();
155:                    ne.setName(listOfIncludes[f]);
156:                }
157:                archives.addFileset(fileSet);
158:                archives.setOverwrite(true);
159:                String info = archives.getLogInfo();
160:                if (info != null) {
161:                    antTask.log(info, Project.MSG_INFO);
162:                }
163:                archives.execute();
164:            }
165:
166:            /**
167:             * Configure the given task by setting name, project root, etc
168:             * @param srcTask source task
169:             * @param dstTask destination task
170:             */
171:            public static void configure(Task srcTask, Task dstTask) {
172:                dstTask.setTaskName(srcTask.getTaskName());
173:                dstTask.setProject(srcTask.getProject());
174:            }
175:
176:            /**
177:             * Delete a file. If the file is a directory, delete recursivly all the
178:             * files inside.
179:             * @param aFile file to delete.
180:             */
181:            public static void deleteAllFiles(File aFile) {
182:                if (aFile.isDirectory()) {
183:                    File someFiles[] = aFile.listFiles();
184:                    for (int i = 0; i < someFiles.length; i++) {
185:                        deleteAllFiles(someFiles[i]);
186:                    }
187:                }
188:                aFile.delete();
189:            }
190:
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.