Source Code Cross Referenced for IncludeBusinessServiceHandcodedImplementationDefinition.java in  » UML » MetaBoss » com » metaboss » sdlctools » applications » anttasks » builder » modules » subelements » 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.builder.modules.subelements 
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.builder.modules.subelements;
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.jmi.reflect.JmiException;
026:
027:        import org.apache.tools.ant.BuildException;
028:
029:        import com.metaboss.enterprise.bs.BSException;
030:        import com.metaboss.sdlctools.applications.anttasks.builder.ModuleDefinition;
031:        import com.metaboss.sdlctools.applications.anttasks.builder.ModuleElementDefinition;
032:        import com.metaboss.sdlctools.applications.anttasks.builder.ToolInvocationDefinition;
033:        import com.metaboss.sdlctools.applications.anttasks.builder.tools.JavaCompilerInvocationDefinitionUtils;
034:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
035:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Enterprise;
036:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Servicemodule;
037:        import com.metaboss.sdlctools.services.codegeneration.CodeGenerationStylesheetAccessor;
038:        import com.metaboss.sdlctools.services.codegenerationstylesheet.STServicemoduleStylesheet;
039:        import com.metaboss.util.StringUtils;
040:
041:        /** The definition of how to build a handcoded implementation of the business service. */
042:        public class IncludeBusinessServiceHandcodedImplementationDefinition
043:                extends ModuleElementDefinition {
044:            // Initialise metadata for supplying in the constructor
045:            private static ElementMetadata sElementMetadata = new ElementMetadata();
046:            static {
047:                sElementMetadata.ElementTypeName = "IncludeBusinessServiceHandcodedImplementation";
048:                sElementMetadata.SupportsModelElementRefs = true;
049:                sElementMetadata.AllowedModelElementTypes = new Class[] {
050:                        Enterprise.class,
051:                        com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System.class,
052:                        Servicemodule.class, };
053:            }
054:            // The type of the implementation 
055:            private String mType = null;
056:            private Set mServicemodulesToDo = new HashSet();
057:            // Additional attribute pinting to the absolute directory where handcoded source resides
058:            private File mImplsSrcDir = null;
059:
060:            /** The only available constructor */
061:            public IncludeBusinessServiceHandcodedImplementationDefinition(
062:                    ModuleDefinition pOwnerModule) {
063:                super (pOwnerModule, sElementMetadata);
064:            }
065:
066:            // The setter for the "type" attribute
067:            public void setType(String pType) {
068:                mType = pType;
069:            }
070:
071:            // The getter for the "type" attribute
072:            public String getType() {
073:                if (mType == null)
074:                    throw new BuildException(
075:                            "Missing 'type' attribute, which is mandatory for generated implementation definition.");
076:                return mType;
077:            }
078:
079:            // The setter for optional "implssrcdir" attribute
080:            public void setImplsSrcDir(File pSrcDir) {
081:                mImplsSrcDir = pSrcDir;
082:            }
083:
084:            // The getter for optional "srcdir" attribute
085:            public File getImplsSrcDir() throws BuildException {
086:                if (mImplsSrcDir != null)
087:                    return mImplsSrcDir;
088:                if (getOwnerTask().getImplsSrcDir() != null)
089:                    return getOwnerTask().getImplsSrcDir();
090:                throw new BuildException(
091:                        "Missing 'implssrcdir' attribute here and in the task. This is expected to be defined.");
092:            }
093:
094:            // Called when initialisation of parameters has been completed and generation is about to commence
095:            public void completeInitialisation() throws BuildException {
096:                try {
097:                    // Work on included module elements
098:                    ModelElement[] lIncludedModelElements = getIncludedModelElements();
099:                    // First collect list of al domains to generate implementations for
100:                    for (int lElementsIndex = 0; lElementsIndex < lIncludedModelElements.length; lElementsIndex++) {
101:                        ModelElement lIncludedModelElement = lIncludedModelElements[lElementsIndex];
102:                        mServicemodulesToDo.addAll(Arrays.asList(getOwnerTask()
103:                                .findModelElementsByXPath(
104:                                        lIncludedModelElement,
105:                                        "descendant-or-self::Servicemodule",
106:                                        new Class[] { Servicemodule.class })));
107:                    }
108:                } catch (JmiException e) {
109:                    throw new BuildException(
110:                            "Caught exception while preparing to build module. "
111:                                    + e.getMessage());
112:                }
113:            }
114:
115:            /** Returns array of storages included in this definition */
116:            public Servicemodule[] getIncludedServicemodules() {
117:                return (Servicemodule[]) mServicemodulesToDo
118:                        .toArray(new Servicemodule[mServicemodulesToDo.size()]);
119:            }
120:
121:            /** @return proposed package name for the given servicemodule */
122:            public String getPackageName(Servicemodule pServicemodule)
123:                    throws BSException {
124:                STServicemoduleStylesheet lServicemoduleStylesheet = CodeGenerationStylesheetAccessor
125:                        .getServicemoduleStylesheet(pServicemodule);
126:                return lServicemoduleStylesheet.getPackageName() + "."
127:                        + getType().toLowerCase();
128:            }
129:
130:            /** @return proposed source location for the given servicemodule */
131:            public String getSourceLocation(Servicemodule pServicemodule)
132:                    throws BSException {
133:                String lImplementationPackageName = getPackageName(pServicemodule);
134:                File lSrcDir = getImplsSrcDir();
135:                STServicemoduleStylesheet lServicemoduleStylesheet = CodeGenerationStylesheetAccessor
136:                        .getServicemoduleStylesheet(pServicemodule);
137:                return lSrcDir.getAbsolutePath()
138:                        + File.separator
139:                        + StringUtils.replace(lImplementationPackageName, ".",
140:                                File.separator);
141:            }
142:
143:            // Returns plan to invoke any number of code generators necessary to build the module  
144:            public ToolInvocationDefinition[] getGenerationPlan() {
145:                List lInvocations = new ArrayList();
146:                // Nothing to generate
147:                // Return what we have		
148:                return (ToolInvocationDefinition[]) lInvocations
149:                        .toArray(new ToolInvocationDefinition[lInvocations
150:                                .size()]);
151:            }
152:
153:            // Returns tasks to do after generation. (Normally compillation would go in here  
154:            public ToolInvocationDefinition[] getCompilationPlan() {
155:                try {
156:                    List lInvocations = new ArrayList();
157:                    // Compile parts of the core
158:                    for (Iterator lServicemodulesIterator = mServicemodulesToDo
159:                            .iterator(); lServicemodulesIterator.hasNext();) {
160:                        Servicemodule lServicemodule = (Servicemodule) lServicemodulesIterator
161:                                .next();
162:
163:                        File lImplementationDirectory = new File(
164:                                getSourceLocation(lServicemodule))
165:                                .getAbsoluteFile();
166:                        if (lImplementationDirectory != null
167:                                && lImplementationDirectory.exists())
168:                            lInvocations
169:                                    .add(JavaCompilerInvocationDefinitionUtils
170:                                            .createForAbsoluteSourceDirectory(
171:                                                    this ,
172:                                                    lImplementationDirectory));
173:                    }
174:                    // Return what we have		
175:                    return (ToolInvocationDefinition[]) lInvocations
176:                            .toArray(new ToolInvocationDefinition[lInvocations
177:                                    .size()]);
178:                } catch (BSException e) {
179:                    throw new BuildException(
180:                            "Caught exception while generating compillation plan. "
181:                                    + e.getMessage());
182:                }
183:            }
184:
185:            /** Return tool invocations */
186:            public String[] getJarClassIncludes() throws BSException {
187:                List lJarClassIncludes = new ArrayList();
188:                // Compile parts of the core
189:                for (Iterator lServicemodulesIterator = mServicemodulesToDo
190:                        .iterator(); lServicemodulesIterator.hasNext();) {
191:                    Servicemodule lServicemodule = (Servicemodule) lServicemodulesIterator
192:                            .next();
193:                    String lImplementationPackage = getPackageName(lServicemodule);
194:                    String lImplementationSubdirectory = StringUtils.replace(
195:                            lImplementationPackage, ".", File.separator);
196:                    lJarClassIncludes.add(lImplementationSubdirectory
197:                            + File.separator + "**" + File.separator + "*.*");
198:                }
199:                // Return what we have		
200:                return (String[]) lJarClassIncludes
201:                        .toArray(new String[lJarClassIncludes.size()]);
202:            }
203:        }
w_w__w__._j___a__v_a2___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.