Source Code Cross Referenced for JOnASBaseTask.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) 2004-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:         * --------------------------------------------------------------------------
022:         * $Id: JOnASBaseTask.java 8231 2006-04-11 14:23:27Z pelletib $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.ant;
025:
026:        import java.io.File;
027:        import java.util.ArrayList;
028:        import java.util.Iterator;
029:        import java.util.List;
030:
031:        import org.apache.tools.ant.BuildException;
032:        import org.apache.tools.ant.Project;
033:        import org.apache.tools.ant.Task;
034:        import org.apache.tools.ant.taskdefs.Copy;
035:        import org.apache.tools.ant.types.FileSet;
036:
037:        import org.objectweb.jonas.ant.jonasbase.BaseTaskItf;
038:        import org.objectweb.jonas.ant.jonasbase.Carol;
039:        import org.objectweb.jonas.ant.jonasbase.Db;
040:        import org.objectweb.jonas.ant.jonasbase.Dbm;
041:        import org.objectweb.jonas.ant.jonasbase.Discovery;
042:        import org.objectweb.jonas.ant.jonasbase.JdbcRa;
043:        import org.objectweb.jonas.ant.jonasbase.Jms;
044:        import org.objectweb.jonas.ant.jonasbase.Lib;
045:        import org.objectweb.jonas.ant.jonasbase.Mail;
046:        import org.objectweb.jonas.ant.jonasbase.Services;
047:        import org.objectweb.jonas.ant.jonasbase.Tasks;
048:        import org.objectweb.jonas.ant.jonasbase.WebContainer;
049:        import org.objectweb.jonas.ant.jonasbase.wsdl.WsdlPublish;
050:
051:        /**
052:         * Class used to create a JOnAS base with different configuration like port, url
053:         * for JNDI, etc
054:         * @author Florent Benoit
055:         */
056:        public class JOnASBaseTask extends Task {
057:
058:            /**
059:             * Name of JOnAS configuration file
060:             */
061:            public static final String JONAS_CONF_FILE = "jonas.properties";
062:
063:            /**
064:             * Name of Joram configuration file
065:             */
066:            public static final String JORAM_CONF_FILE = "a3servers.xml";
067:
068:            /**
069:             * Name of Joram admin configuration file (resource adaptor)
070:             */
071:            public static final String JORAM_ADMIN_CONF_FILE = "joramAdmin.xml";
072:
073:            /**
074:             * Name of Carol configuration file
075:             */
076:            public static final String CAROL_CONF_FILE = "carol.properties";
077:
078:            /**
079:             * Name of JGroups CMI configuration file
080:             */
081:            public static final String JGROUPS_CMI_CONF_FILE = "jgroups-cmi.xml";
082:
083:            /**
084:             * Name of JGroups HA configuration file
085:             */
086:            public static final String JGROUPS_HA_CONF_FILE = "jgroups-ha.xml";
087:
088:            /**
089:             * Name of Tomcat configuration file
090:             */
091:            public static final String TOMCAT_CONF_FILE = "server.xml";
092:
093:            /**
094:             * Name of Tomcat configuration file
095:             */
096:            public static final String JETTY_CONF_FILE = "jetty5.xml";
097:
098:            /**
099:             * Name of P6Spy configuration file
100:             */
101:            public static final String P6SPY_CONF_FILE = "spy.properties";
102:
103:            /**
104:             * Name of domain management file
105:             */
106:            public static final String DOMAIN_CONF_FILE = "domain.xml";
107:
108:            /**
109:             * List of Wars to copy for each JONAS_BASE
110:             */
111:            public static final String[] WARS_LIST = new String[] {
112:                    "juddi.war", "autoload/jonasAdmin.war" };
113:
114:            /**
115:             * List of Rars to copy for each JONAS_BASE
116:             */
117:            public static final String[] RARS_LIST = new String[] {
118:                    "autoload/JOnAS_jdbcCP.rar", "autoload/JOnAS_jdbcDM.rar",
119:                    "autoload/JOnAS_jdbcDS.rar", "autoload/JOnAS_jdbcXA.rar",
120:                    "autoload/joram_for_jonas_ra.rar" };
121:
122:            /**
123:             * List of EjbJars to copy for each JONAS_BASE
124:             */
125:            public static final String[] EJBJARS_LIST = new String[] { "" };
126:
127:            /**
128:             * List of Apps to copy for each JONAS_BASE
129:             */
130:            public static final String[] APPS_LIST = new String[] { "autoload/mejb.ear" };
131:
132:            /**
133:             * Source directory (JOnAS root)
134:             */
135:            private File jonasRoot = null;
136:
137:            /**
138:             * Destination directory (Where create the jonasBase)
139:             */
140:            private File destDir = null;
141:
142:            /**
143:             * Update only JONAS_BASE without erasing it
144:             */
145:            private boolean onlyUpdate = false;
146:
147:            /**
148:             * List of tasks to do
149:             */
150:            private List tasks = null;
151:
152:            /**
153:             * Constructor
154:             */
155:            public JOnASBaseTask() {
156:                tasks = new ArrayList();
157:            }
158:
159:            /**
160:             * Run this task
161:             * @see org.apache.tools.ant.Task#execute()
162:             */
163:            public void execute() {
164:                if (jonasRoot == null) {
165:                    throw new BuildException("jonasRoot element is not set");
166:                }
167:
168:                if (destDir == null) {
169:                    throw new BuildException("destDir element is not set");
170:                }
171:
172:                if (jonasRoot.getPath().equals(destDir.getPath())) {
173:                    throw new BuildException(
174:                            "jonasRoot and destDir is the same path !");
175:                }
176:
177:                File jprops = new File(destDir.getPath() + File.separator
178:                        + "conf" + File.separator + "jonas.properties");
179:
180:                if (onlyUpdate) {
181:                    if (jprops.exists()) {
182:                        log("Only updating JONAS_BASE in the directory '"
183:                                + destDir + "' from source directory '"
184:                                + jonasRoot + "'", Project.MSG_INFO);
185:                        JOnASAntTool.updateJonasBase(this , jonasRoot, destDir);
186:                        return;
187:                    } else {
188:                        throw new BuildException("JOnAS base directory '"
189:                                + destDir.getPath()
190:                                + "' doesn't exists. Cannot update.");
191:                    }
192:                }
193:
194:                // First, create JOnAS base
195:                log("Creating JONAS_BASE in the directory '" + destDir
196:                        + "' from source directory '" + jonasRoot + "'",
197:                        Project.MSG_INFO);
198:                Copy copy = new Copy();
199:                JOnASAntTool.configure(this , copy);
200:                copy.setTodir(destDir);
201:                FileSet fileSet = new FileSet();
202:                fileSet.setDir(new File(new File(jonasRoot, "templates"),
203:                        "conf"));
204:                copy.addFileset(fileSet);
205:                copy.setOverwrite(true);
206:                copy.execute();
207:
208:                for (Iterator it = tasks.iterator(); it.hasNext();) {
209:                    BaseTaskItf task = (BaseTaskItf) it.next();
210:                    task.setDestDir(destDir);
211:                    task.setJonasRoot(jonasRoot);
212:                    JOnASAntTool.configure(this , (Task) task);
213:                    String info = task.getLogInfo();
214:                    if (info != null) {
215:                        log(info, Project.MSG_INFO);
216:                    }
217:                    task.execute();
218:                }
219:
220:                // Then update JonasBase
221:                JOnASAntTool.updateJonasBase(this , jonasRoot, destDir);
222:            }
223:
224:            /**
225:             * Add tasks for configured object
226:             * @param subTasks some tasks to do on files
227:             */
228:            public void addTasks(Tasks subTasks) {
229:                if (subTasks != null) {
230:                    for (Iterator it = subTasks.getTasks().iterator(); it
231:                            .hasNext();) {
232:                        tasks.add(it.next());
233:                    }
234:                }
235:            }
236:
237:            /**
238:             * Add a task for configure some objects
239:             * @param task the task to do
240:             */
241:            public void addTask(BaseTaskItf task) {
242:                if (task != null) {
243:                    tasks.add(task);
244:                }
245:            }
246:
247:            /**
248:             * Add tasks for services (wrapped to default method)
249:             * @param servicesTasks tasks to do on files
250:             */
251:            public void addConfiguredServices(Services servicesTasks) {
252:                addTask(servicesTasks);
253:            }
254:
255:            /**
256:             * Add tasks for JMS configuration
257:             * @param jmsTasks tasks to do on files
258:             */
259:            public void addConfiguredJms(Jms jmsTasks) {
260:                addTasks(jmsTasks);
261:            }
262:
263:            /**
264:             * Add task for Resource adaptor
265:             * @param jdbcRaTask task to do
266:             */
267:            public void addConfiguredJdbcRa(JdbcRa jdbcRaTask) {
268:                addTask(jdbcRaTask);
269:            }
270:
271:            /**
272:             * Add task for Resource adaptor
273:             * @param mailTask task to do
274:             */
275:            public void addConfiguredMail(Mail mailTask) {
276:                addTask(mailTask);
277:            }
278:
279:            /**
280:             * Add task for the DB service
281:             * @param dbTask task to do
282:             */
283:            public void addConfiguredDb(Db dbTask) {
284:                addTask(dbTask);
285:            }
286:
287:            /**
288:             * Add task for the DBM service
289:             * @param dbTask task to do
290:             */
291:            public void addConfiguredDbm(Dbm dbTask) {
292:                addTask(dbTask);
293:            }
294:
295:            /**
296:             * Add task for library to put in JONAS_BASE/lib/ext
297:             * @param libTask task to do
298:             */
299:            public void addConfiguredLib(Lib libTask) {
300:                addTask(libTask);
301:            }
302:
303:            /**
304:             * Add task for WSDL
305:             * @param wsdlTask task to do
306:             */
307:            public void addConfiguredWsdlPublish(WsdlPublish wsdlTask) {
308:                addTask(wsdlTask);
309:            }
310:
311:            /**
312:             * Add tasks for Carol configuration
313:             * @param carolTasks tasks to do on files
314:             */
315:            public void addConfiguredCarol(Carol carolTasks) {
316:                addTasks(carolTasks);
317:            }
318:
319:            /**
320:             * Add tasks for Discovery configuration
321:             * @param discoveryTasks tasks to do on files
322:             */
323:            public void addConfiguredDiscovery(Discovery discoveryTasks) {
324:                addTasks(discoveryTasks);
325:            }
326:
327:            /**
328:             * Add tasks for the web container configuration
329:             * @param webContainerTasks tasks to do on files
330:             */
331:            public void addConfiguredWebContainer(WebContainer webContainerTasks) {
332:                addTasks(webContainerTasks);
333:            }
334:
335:            /**
336:             * Set the destination directory for the replacement
337:             * @param destDir the destination directory
338:             */
339:            public void setDestDir(File destDir) {
340:                this .destDir = destDir;
341:            }
342:
343:            /**
344:             * Set the source directory for the replacement
345:             * @param jonasRoot the source directory
346:             */
347:            public void setJonasRoot(File jonasRoot) {
348:                this .jonasRoot = jonasRoot;
349:            }
350:
351:            /**
352:             * Set if this is only an update or a new JONAS_BASE
353:             * @param onlyUpdate If true update, else create and then update
354:             */
355:            public void setUpdate(boolean onlyUpdate) {
356:                this.onlyUpdate = onlyUpdate;
357:            }
358:
359:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.