Source Code Cross Referenced for UMLToMetaBoss.java in  » UML » MetaBoss » com » metaboss » sdlctools » applications » anttasks » convertors » 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 » com.metaboss.sdlctools.applications.anttasks.convertors 
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 com.metaboss.sdlctools.applications.anttasks.convertors;
016:
017:        import java.io.File;
018:        import java.util.Properties;
019:
020:        import org.apache.tools.ant.BuildException;
021:
022:        import com.metaboss.sdlctools.applications.anttasks.AntMetaBossUtils;
023:        import com.metaboss.sdlctools.applications.anttasks.MetaBossModelToolTask;
024:        import com.metaboss.sdlctools.models.ModelRepository;
025:        import com.metaboss.sdlctools.models.metabossmodel.ModelUtils;
026:
027:        /** Special Ant task used to convert UML Model to MetaBoss model and save it.
028:         * The source UML Model must conform to UML Profile For MetaBoss Design Model. 
029:         * This task extends abstract {@link com.metaboss.sdlctools.applications.anttasks.MetaBossModelToolTask MetaBossModelToolTask}
030:         * and therefore suports all of its attributes. In addition it supports the following attributes:
031:         * <table border="1" cellpadding="2" cellspacing="0">
032:         *   <tr>
033:         *     <th>Attribute Name</th>
034:         *     <th>Attribute Description</th>
035:         *   </tr>
036:         *   <tr>
037:         *     <td valign="top">umlfile</td>
038:         *     <td valign="top">The mandatory path and name of the uml file where source model should be
039:         *     obtained from.
040:         *     </td>
041:         *   </tr>
042:         *   <tr>
043:         *     <td valign="top">rectify</td>
044:         *     <td valign="top">The optional boolean flag. If this flag is set to true (this is the default) the attempt will be made to 
045:         *     "rectify" the converted model. This process validates the model and attempts to fix all discovered constraint violations.
046:         *     Obviously not all constraint violations can be fixed, but some of them can.
047:         *     </td>
048:         *   </tr>
049:         *   <tr>
050:         *     <td valign="top">validate</td>
051:         *     <td valign="top">The optional boolean flag. If this flag is trus (this is the default) the 
052:         *     invalid model will not be saved. If this flag is false the model will be saved without validation.
053:         *     </td>
054:         *   </tr>
055:         * </table>
056:         */
057:        public class UMLToMetaBoss extends MetaBossModelToolTask {
058:            private File mUMLFile = null;
059:            private boolean mValidate = true;
060:            private boolean mRectify = true;
061:
062:            /** Default constructor */
063:            public UMLToMetaBoss() {
064:                // Convertor to MetaBoss uses brand new model
065:                super (false);
066:            }
067:
068:            /** The setter for the "UMLFile" attribute */
069:            public void setUMLFile(File pUMLFile) {
070:                mUMLFile = pUMLFile;
071:            }
072:
073:            /** The getter for the "UMLFile" attribute */
074:            public File getUMLFile() {
075:                if (mUMLFile == null)
076:                    throw new BuildException(
077:                            "Missing 'umlfile' attribute, which is mandatory for <"
078:                                    + getTaskName() + "> task.");
079:                return mUMLFile;
080:            }
081:
082:            /** The setter for the "rectify" attribute */
083:            public void setRectify(boolean pRectify) {
084:                mRectify = pRectify;
085:            }
086:
087:            /** The setter for the "validate" attribute */
088:            public void setValidate(boolean pValidate) {
089:                mValidate = pValidate;
090:            }
091:
092:            /** The getter for the "rectify" attribute */
093:            public boolean needToRectify() {
094:                return mRectify;
095:            }
096:
097:            /** The getter for the "validate" attribute */
098:            public boolean needToValidate() {
099:                return mValidate;
100:            }
101:
102:            // The method executing the tool
103:            public void runTool() throws Exception {
104:                String lSourceUMLModelName = getUMLFile().getAbsolutePath();
105:                String lTargetEntepriseModelName = "TempEnterprise_"
106:                        + getModelName() + "_TempEnterprise";
107:                try {
108:                    // Read in UML model
109:                    AntMetaBossUtils.getModelRepository().openModel(
110:                            lSourceUMLModelName, getUMLFile(),
111:                            ModelRepository.METAMODEL_NAME_UML);
112:                    // Convert model to MetaBoss
113:                    ModelUtils.convertUMLModelToMetaBossModel(
114:                            lSourceUMLModelName, lTargetEntepriseModelName);
115:                    // Rectify resulting model if it is allowed
116:                    if (needToRectify())
117:                        AntMetaBossUtils.getModelRepository().rectifyModel(
118:                                lTargetEntepriseModelName);
119:                    // Export model into the file
120:                    // First ensure that the model file is absent
121:                    File lDestinationFile = new File(getModelName());
122:                    if (lDestinationFile.exists())
123:                        lDestinationFile.delete();
124:                    AntMetaBossUtils.getModelRepository().exportModel(
125:                            lTargetEntepriseModelName, needToValidate(),
126:                            lDestinationFile, new Properties());
127:                } finally {
128:                    // Delete temporary loaded models
129:                    if (AntMetaBossUtils.getModelRepository().containsModel(
130:                            lSourceUMLModelName))
131:                        AntMetaBossUtils.getModelRepository().closeModel(
132:                                lSourceUMLModelName);
133:                    if (AntMetaBossUtils.getModelRepository().containsModel(
134:                            lTargetEntepriseModelName))
135:                        AntMetaBossUtils.getModelRepository().closeModel(
136:                                lTargetEntepriseModelName);
137:                }
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.