Source Code Cross Referenced for Template.java in  » UML » AndroMDA-3.2 » org » andromda » core » cartridge » template » 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 » AndroMDA 3.2 » org.andromda.core.cartridge.template 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.core.cartridge.template;
002:
003:        import java.io.File;
004:
005:        import org.andromda.core.cartridge.Resource;
006:        import org.andromda.core.metafacade.MetafacadeConstants;
007:        import org.apache.commons.lang.StringUtils;
008:        import org.apache.commons.lang.builder.ToStringBuilder;
009:
010:        /**
011:         * This class implements the <code>&lt;template&gt;</code> tag in a cartridge
012:         * descriptor file.
013:         *
014:         * @author <a href="http://www.mbohlen.de">Matthias Bohlen </a>
015:         * @author Anthony Mowers
016:         * @author Chad Brandon
017:         */
018:        public class Template extends Resource {
019:            /**
020:             * The default constructor used by the {@link XmlObjectFactory} to instantiate the template configuration.
021:             */
022:            public Template() {
023:                this .supportedModelElements = new ModelElements();
024:            }
025:
026:            /**
027:             * A flag indicating whether or not empty files should
028:             * be generated.
029:             */
030:            private boolean generateEmptyFiles = false;
031:
032:            /**
033:             * Tells us whether output files should be generated if this template does not produce any output.
034:             *
035:             * @param generateEmptyFiles generate files for empty output yes/no
036:             */
037:            public void setGenerateEmptyFiles(final boolean generateEmptyFiles) {
038:                this .generateEmptyFiles = generateEmptyFiles;
039:            }
040:
041:            /**
042:             * Tells us whether output files are generated by this template if the template produces empty output.
043:             *
044:             * @return boolean
045:             */
046:            public boolean isGenerateEmptyFiles() {
047:                return generateEmptyFiles;
048:            }
049:
050:            /**
051:             * Returns the fully qualified output file, this means:
052:             * <ul>
053:             * <li>the output pattern has been translated</li>
054:             * <li>the output dir name has been prepended</li>
055:             * </ul>
056:             *
057:             * @param metafacadeName name of the metafacade.
058:             * @param packageName name of the package from the model in which the class
059:             *        is contained
060:             * @param directory the directory as a File.
061:             * @param outputPattern if defined, this overrides the value of {@link Resource#getOutputPattern()}.
062:             * @return File absolute directory.
063:             */
064:            public File getOutputLocation(final String metafacadeName,
065:                    final String packageName, final File directory,
066:                    String outputPattern) {
067:                File file;
068:
069:                if (outputPattern == null || outputPattern.trim().length() == 0) {
070:                    outputPattern = this .getOutputPattern();
071:                }
072:                // - if singleFileOutput is set to true, then
073:                //   just use the output pattern as the file to
074:                //   output to, otherwise we replace using message format.
075:                if (this .isOutputToSingleFile()) {
076:                    file = super .getOutputLocation(
077:                            new String[] { outputPattern }, directory,
078:                            outputPattern);
079:                } else {
080:                    file = super 
081:                            .getOutputLocation(
082:                                    new String[] {
083:                                            StringUtils
084:                                                    .replace(
085:                                                            StringUtils
086:                                                                    .trimToEmpty(packageName),
087:                                                            MetafacadeConstants.NAMESPACE_SCOPE_OPERATOR,
088:                                                            File.separator),
089:                                            metafacadeName }, directory,
090:                                    outputPattern);
091:                }
092:                return file;
093:            }
094:
095:            /**
096:             * Tells us the model elements that are supported by this template (i.e. will be processed by this template)
097:             *
098:             * @return ModelElements all the model elements that should be processed by thsi template
099:             * @see org.andromda.core.cartridge.template.ModelElements
100:             */
101:            public ModelElements getSupportedModeElements() {
102:                final String methodName = "Template.getModelElements";
103:                if (this .supportedModelElements == null) {
104:                    throw new TemplateException(methodName
105:                            + " - supportedModelElements is null!");
106:                }
107:                return this .supportedModelElements;
108:            }
109:
110:            /**
111:             * Sets the model elements that are suported by this template.
112:             *
113:             * @param supportedModelElements the ModelElements instance.
114:             * @see org.andromda.core.cartridge.template.ModelElements
115:             */
116:            public void setSupportedModelElements(
117:                    final ModelElements supportedModelElements) {
118:                this .supportedModelElements = supportedModelElements;
119:            }
120:
121:            private boolean outputToSingleFile = false;
122:
123:            /**
124:             * If output to single file is <code>true</code> then all model elements found by the processor (i.e. all those
125:             * having matching modelElements) will aggregated and output to one single file.
126:             *
127:             * @return Returns the outputToSingleFile.
128:             */
129:            public boolean isOutputToSingleFile() {
130:                return outputToSingleFile;
131:            }
132:
133:            /**
134:             * Sets whether or not we should aggregate elements and output to a single file.
135:             *
136:             * @param outputToSingleFile The outputToSingleFile to set.
137:             */
138:            public void setOutputToSingleFile(final boolean outputToSingleFile) {
139:                this .outputToSingleFile = outputToSingleFile;
140:            }
141:
142:            /**
143:             * Indicates whether or not files should be output when there are no elements when aggregating.
144:             */
145:            private boolean outputOnEmptyElements = true;
146:
147:            /**
148:             * Indicates that when there are no elements in the collection of elements (when {@link #isOutputToSingleFile()} is
149:             * <code>true</code>, whether or not the file should be output.  Default is <code>true</code>
150:             *
151:             * @return true/false
152:             * @see #isOutputToSingleFile()
153:             */
154:            public boolean isOutputOnEmptyElements() {
155:                return this .outputOnEmptyElements;
156:            }
157:
158:            /**
159:             * Sets whether or not we should output a file when no elements exist in the collection of elements when {@link
160:             * #isOutputToSingleFile()} returns <code>true</code>.
161:             *
162:             * @param outputOnEmptyElements the boolean flag.
163:             * @see #isOutputOnEmptyElements()
164:             * @see #isOutputToSingleFile()
165:             */
166:            public void setOutputOnEmptyElements(
167:                    final boolean outputOnEmptyElements) {
168:                this .outputOnEmptyElements = outputOnEmptyElements;
169:            }
170:
171:            /**
172:             * @see java.lang.Object#toString()
173:             */
174:            public String toString() {
175:                return ToStringBuilder.reflectionToString(this );
176:            }
177:
178:            /**
179:             * The model elements (i.e. metafacades) supported by this template.
180:             */
181:            private ModelElements supportedModelElements = null;
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.