Source Code Cross Referenced for DDCreator.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » ejb » 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 » Build » ANT » org.apache.tools.ant.taskdefs.optional.ejb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:        package org.apache.tools.ant.taskdefs.optional.ejb;
019:
020:        import java.io.File;
021:        import org.apache.tools.ant.BuildException;
022:        import org.apache.tools.ant.DirectoryScanner;
023:        import org.apache.tools.ant.taskdefs.Java;
024:        import org.apache.tools.ant.taskdefs.MatchingTask;
025:        import org.apache.tools.ant.types.Commandline;
026:        import org.apache.tools.ant.types.Path;
027:        import org.apache.tools.ant.util.FileUtils;
028:
029:        /**
030:         * Builds a serialized deployment descriptor given a text file description of the
031:         * descriptor in the format supported by WebLogic.
032:         *
033:         * This ant task is a front end for the weblogic DDCreator tool.
034:         *
035:         */
036:        public class DDCreator extends MatchingTask {
037:            /**
038:             * The root directory of the tree containing the textual deployment descriptors. The actual
039:             * deployment descriptor files are selected using include and exclude constructs
040:             * on the EJBC task, as supported by the MatchingTask superclass.
041:             */
042:            private File descriptorDirectory;
043:
044:            /**
045:             * The directory where generated serialised deployment descriptors are placed.
046:             */
047:            private File generatedFilesDirectory;
048:
049:            /**
050:             * The classpath to be used in the weblogic ejbc calls. It must contain the weblogic
051:             * classes necessary fro DDCreator <b>and</b> the implementation classes of the
052:             * home and remote interfaces.
053:             */
054:            private String classpath;
055:
056:            /**
057:             * Do the work.
058:             *
059:             * The work is actually done by creating a helper task. This approach allows
060:             * the classpath of the helper task to be set. Since the weblogic tools require
061:             * the class files of the project's home and remote interfaces to be available in
062:             * the classpath, this also avoids having to start ant with the class path of the
063:             * project it is building.
064:             *
065:             * @exception BuildException if something goes wrong with the build
066:             */
067:            public void execute() throws BuildException {
068:                if (descriptorDirectory == null
069:                        || !descriptorDirectory.isDirectory()) {
070:                    throw new BuildException("descriptors directory "
071:                            + descriptorDirectory.getPath() + " is not valid");
072:                }
073:                if (generatedFilesDirectory == null
074:                        || !generatedFilesDirectory.isDirectory()) {
075:                    throw new BuildException("dest directory "
076:                            + generatedFilesDirectory.getPath()
077:                            + " is not valid");
078:                }
079:
080:                String args = descriptorDirectory + " "
081:                        + generatedFilesDirectory;
082:
083:                // get all the files in the descriptor directory
084:                DirectoryScanner ds = super 
085:                        .getDirectoryScanner(descriptorDirectory);
086:
087:                String[] files = ds.getIncludedFiles();
088:
089:                for (int i = 0; i < files.length; ++i) {
090:                    args += " " + files[i];
091:                }
092:
093:                String systemClassPath = System.getProperty("java.class.path");
094:                String execClassPath = FileUtils.translatePath(systemClassPath
095:                        + ":" + classpath);
096:                Java ddCreatorTask = new Java(this );
097:                ddCreatorTask.setFork(true);
098:                ddCreatorTask
099:                        .setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper");
100:                Commandline.Argument arguments = ddCreatorTask.createArg();
101:                arguments.setLine(args);
102:                ddCreatorTask
103:                        .setClasspath(new Path(getProject(), execClassPath));
104:                if (ddCreatorTask.executeJava() != 0) {
105:                    throw new BuildException(
106:                            "Execution of ddcreator helper failed");
107:                }
108:            }
109:
110:            /**
111:             * Set the directory from where the text descriptions of the deployment descriptors are
112:             * to be read.
113:             *
114:             * @param dirName the name of the directory containing the text deployment descriptor files.
115:             */
116:            public void setDescriptors(String dirName) {
117:                descriptorDirectory = new File(dirName);
118:            }
119:
120:            /**
121:             * Set the directory into which the serialized deployment descriptors are to
122:             * be written.
123:             *
124:             * @param dirName the name of the directory into which the serialised deployment
125:             *                descriptors are written.
126:             */
127:            public void setDest(String dirName) {
128:                generatedFilesDirectory = new File(dirName);
129:            }
130:
131:            /**
132:             * Set the classpath to be used for this compilation.
133:             *
134:             * @param s the classpath to use for the ddcreator tool.
135:             */
136:            public void setClasspath(String s) {
137:                this.classpath = FileUtils.translatePath(s);
138:            }
139:        }
w___ww_.___j_a_va2__s___._c_o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.