Source Code Cross Referenced for MetaBossGeneratorTask.java in  » UML » MetaBoss » org » apache » tools » ant » taskdefs » optional » metaboss » 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 » UML » MetaBoss » org.apache.tools.ant.taskdefs.optional.metaboss 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package org.apache.tools.ant.taskdefs.optional.metaboss;
016:
017:        import java.io.File;
018:        import java.util.ArrayList;
019:        import java.util.Arrays;
020:        import java.util.HashSet;
021:        import java.util.Iterator;
022:        import java.util.List;
023:        import java.util.Set;
024:
025:        import javax.naming.Context;
026:        import javax.naming.InitialContext;
027:
028:        import org.apache.tools.ant.BuildException;
029:
030:        import com.metaboss.sdlctools.applications.anttasks.MetaBossModelToolTask;
031:        import com.metaboss.sdlctools.applications.anttasks.ModelElementRefType;
032:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
033:        import com.metaboss.sdlctools.services.codegeneration.BSGenericGenerator;
034:
035:        /** The Ant task used to invoke MetaBoss Generic pluggable generators.
036:         * <p>In addition to atttributes supported by {@link com.metaboss.sdlctools.applications.anttasks.MetaBossModelToolTask  MetaBossModelToolTask},
037:         * this task supports following attributes:
038:         * <table border="1" cellpadding="2" cellspacing="0">
039:         *   <tr>
040:         *     <th>Attribute Name</th>
041:         *     <th>Attribute Description</th>
042:         *     <th>Required</th>
043:         *   </tr>
044:         *   <tr>
045:         *     <td valign="top">planname</td>
046:         *     <td valign="top">Mandatory string attribute used to specify the name of the plan to execute.
047:         *     </td>
048:         *     <td valign="top">Yes</td>
049:         *   </tr>
050:         *   <tr>
051:         *     <td valign="top">ref</td>
052:         *     <td valign="top">Optional string attribute used to specify the reference of the
053:         *      topmost model element to execute the plan with. If it is not given - plan will be
054:         *      executed on the whole enteprise model.</td>
055:         *     <td valign="top">No</td>
056:         *   </tr>
057:         *   <tr>
058:         *     <td valign="top">destinationdir</td>
059:         *     <td valign="top">The mandatory directory location where generated files shall be stored.
060:         *     Directory will be created if it does not exist</td>
061:         *     <td valign="top">Yes</td>
062:         *   </tr>
063:         * </table>
064:         */
065:        public class MetaBossGeneratorTask extends MetaBossModelToolTask {
066:            private File mDestinationDir = null;
067:            private String mPlanName = null;
068:            private String mRef = null;
069:            // List of the custom references to the model elements. If this
070:            // list is empty it means that whole root element should be used
071:            private List mModelElementIncludes = null;
072:
073:            /** Default constructor */
074:            public MetaBossGeneratorTask() {
075:                // This task uses existing model
076:                super (true);
077:            }
078:
079:            /** The setter for the "planname" attribute */
080:            public void setPlanName(String pPlanName) {
081:                mPlanName = pPlanName;
082:            }
083:
084:            /** The getter for the "planname" attribute. */
085:            public String getPlanName() {
086:                if (mPlanName == null)
087:                    throw new BuildException(
088:                            "Missing 'PlanName' attribute, which is mandatory for <"
089:                                    + getTaskName() + "> task.");
090:                return mPlanName;
091:            }
092:
093:            /** The setter for the "ref" attribute */
094:            public void setRef(String pRef) {
095:                mRef = pRef;
096:            }
097:
098:            /** The getter for the "ref" attribute. */
099:            public String getRef() {
100:                return mRef;
101:            }
102:
103:            /** The special creator asking to include only particular ModelElements in to the generation process.
104:             * This allows to filter down elements owned by root element. For example if 'ref' attribute of the
105:             * module dealing with services is referring to the System, the IncludeModelElement subelements could be used
106:             * to only specify certain subset of services */
107:            public ModelElementRefType createIncludeModelElement()
108:                    throws BuildException {
109:                if (mModelElementIncludes == null)
110:                    mModelElementIncludes = new ArrayList();
111:                ModelElementRefType lModelElementRefType = new ModelElementRefType(
112:                        this , null);
113:                mModelElementIncludes.add(lModelElementRefType);
114:                return lModelElementRefType;
115:            }
116:
117:            /** The setter for the "destinationdir" attribute */
118:            public void setDestinationdir(File pDestinationDir) {
119:                mDestinationDir = pDestinationDir;
120:            }
121:
122:            // The getter for the "destinationdir" attribute
123:            protected File getDestinationdir() {
124:                if (mDestinationDir == null)
125:                    throw new BuildException(
126:                            "Missing 'destinationdir' attribute, which is mandatory for <"
127:                                    + getTaskName() + "> task.");
128:                return mDestinationDir;
129:            }
130:
131:            // The method executing the tool
132:            public void runTool() throws Exception {
133:                // Get the generator
134:                Context ctx = new InitialContext();
135:                BSGenericGenerator lGenerator = (BSGenericGenerator) ctx
136:                        .lookup(BSGenericGenerator.COMPONENT_URL);
137:                // Cal various flavours of the generator depending what has been set
138:                if (mRef == null && mModelElementIncludes == null) {
139:                    // Generator will run against the whole model
140:                    lGenerator.generateDirectoryAsPerPlan(getDestinationdir()
141:                            .getAbsolutePath(), getPlanName(),
142:                            getInvocationParameters());
143:                } else if (mRef != null && mModelElementIncludes == null) {
144:                    // Generator will run against particular model element
145:                    lGenerator
146:                            .generateDirectoryAsPerPlanForMetaBossModelElement(
147:                                    getDestinationdir().getAbsolutePath(),
148:                                    getPlanName(), mRef,
149:                                    getInvocationParameters());
150:                } else {
151:                    // Generator will run against the set of elements
152:                    ModelElement lRootModelElement = getRef() != null ? this 
153:                            .getModelElement(getRef(), null) : null;
154:
155:                    // Collect all modules from all definitions
156:                    Set lAllElements = new HashSet();
157:                    for (Iterator lIter = mModelElementIncludes.iterator(); lIter
158:                            .hasNext();) {
159:                        ModelElementRefType lModelElementRefType = (ModelElementRefType) lIter
160:                                .next();
161:                        lAllElements
162:                                .addAll(Arrays
163:                                        .asList(lModelElementRefType
164:                                                .getReferencedModelElements(lRootModelElement)));
165:                    }
166:                    lGenerator.generateDirectoryAsPerPlan(getDestinationdir()
167:                            .getAbsolutePath(), getPlanName(), lAllElements,
168:                            getInvocationParameters());
169:                }
170:            }
171:        }
www___.__j__av___a___2___s___._com___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.