Source Code Cross Referenced for IncludeStorageImplementationDefinition.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:        import javax.naming.Context;
027:        import javax.naming.InitialContext;
028:        import javax.naming.NamingException;
029:
030:        import org.apache.tools.ant.BuildException;
031:
032:        import com.metaboss.enterprise.bs.BSException;
033:        import com.metaboss.sdlctools.applications.anttasks.builder.ModuleDefinition;
034:        import com.metaboss.sdlctools.applications.anttasks.builder.ModuleElementDefinition;
035:        import com.metaboss.sdlctools.applications.anttasks.builder.ToolInvocationDefinition;
036:        import com.metaboss.sdlctools.applications.anttasks.builder.tools.JavaCompilerInvocationDefinitionUtils;
037:        import com.metaboss.sdlctools.applications.anttasks.builder.tools.StorageImplementationGeneratorInvocationDefinition;
038:        import com.metaboss.sdlctools.applications.anttasks.builder.tools.CoreCodeGeneratorInvocationDefinition;
039:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
040:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Enterprise;
041:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Domain;
042:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.DomainRelationalStorageDefinition;
043:        import com.metaboss.sdlctools.services.codegeneration.BSStorageImplementationGenerator;
044:        import com.metaboss.sdlctools.services.codegeneration.CodeGenerationStylesheetAccessor;
045:        import com.metaboss.sdlctools.services.codegenerationstylesheet.STDomainStylesheet;
046:        import com.metaboss.util.StringUtils;
047:
048:        /** The definition of included storage implementation. */
049:        public class IncludeStorageImplementationDefinition extends
050:                ModuleElementDefinition {
051:            // Initialise metadata for supplying in the constructor
052:            private static ElementMetadata sElementMetadata = new ElementMetadata();
053:            static {
054:                sElementMetadata.ElementTypeName = "IncludeStorageImplementation";
055:                sElementMetadata.SupportsModelElementRefs = true;
056:                sElementMetadata.AllowedModelElementTypes = new Class[] {
057:                        Enterprise.class,
058:                        com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System.class,
059:                        Domain.class, DomainRelationalStorageDefinition.class };
060:            }
061:            private BSStorageImplementationGenerator mStorageImplementationGenerator = null;
062:            private Set mStoragesToDo = new HashSet();
063:
064:            /** The only available constructor */
065:            public IncludeStorageImplementationDefinition(
066:                    ModuleDefinition pOwnerModule) {
067:                super (pOwnerModule, sElementMetadata);
068:            }
069:
070:            // Called when initialisation of parameters has been completed and generation is about to commence
071:            public void completeInitialisation() throws BuildException {
072:                try {
073:                    // First obtain the storage implementation generator
074:                    Context lContext = new InitialContext();
075:                    mStorageImplementationGenerator = (BSStorageImplementationGenerator) lContext
076:                            .lookup(BSStorageImplementationGenerator.COMPONENT_URL);
077:
078:                    // Work on included module elements
079:                    ModelElement[] lIncludedModelElements = getIncludedModelElements();
080:                    // First collect list of al domains to generate implementations for
081:                    for (int lElementsIndex = 0; lElementsIndex < lIncludedModelElements.length; lElementsIndex++) {
082:                        ModelElement lIncludedModelElement = lIncludedModelElements[lElementsIndex];
083:                        mStoragesToDo
084:                                .addAll(Arrays
085:                                        .asList(getOwnerTask()
086:                                                .findModelElementsByXPath(
087:                                                        lIncludedModelElement,
088:                                                        "descendant-or-self::DomainRelationalStorageDefinition",
089:                                                        new Class[] { DomainRelationalStorageDefinition.class })));
090:                    }
091:                } catch (NamingException e) {
092:                    throw new BuildException(
093:                            "Unable to locate generator for the Storage Implementation. Caught NamingException: "
094:                                    + e.getMessage());
095:                } catch (JmiException e) {
096:                    throw new BuildException(
097:                            "Caught exception while preparing to build module. "
098:                                    + e.getMessage());
099:                }
100:            }
101:
102:            /** Returns array of storages included in this definition */
103:            public DomainRelationalStorageDefinition[] getIncludedStorages() {
104:                return (DomainRelationalStorageDefinition[]) mStoragesToDo
105:                        .toArray(new DomainRelationalStorageDefinition[mStoragesToDo
106:                                .size()]);
107:            }
108:
109:            // Returns plan to invoke any number of code generators necessary to build the module  
110:            public ToolInvocationDefinition[] getGenerationPlan() {
111:                List lInvocations = new ArrayList();
112:                for (Iterator lDomainStoragesIterator = mStoragesToDo
113:                        .iterator(); lDomainStoragesIterator.hasNext();) {
114:                    DomainRelationalStorageDefinition lDomainRelationalStorageDefinition = (DomainRelationalStorageDefinition) lDomainStoragesIterator
115:                            .next();
116:                    // Will need to generate core of the system this is where domain is
117:                    CoreCodeGeneratorInvocationDefinition lSystemCoreGeneratorInvocationDefinition = new CoreCodeGeneratorInvocationDefinition(
118:                            getOwnerTask());
119:                    lSystemCoreGeneratorInvocationDefinition
120:                            .setSystemRef(lDomainRelationalStorageDefinition
121:                                    .getDomain().getSystem().getRef());
122:                    lInvocations.add(lSystemCoreGeneratorInvocationDefinition);
123:                    // Generate storage code
124:                    StorageImplementationGeneratorInvocationDefinition lStorageImplementationGeneratorInvocationDefinition = new StorageImplementationGeneratorInvocationDefinition(
125:                            getOwnerTask());
126:                    lStorageImplementationGeneratorInvocationDefinition
127:                            .setGenerator(mStorageImplementationGenerator);
128:                    lStorageImplementationGeneratorInvocationDefinition
129:                            .setDomainRelationalStorageDefinition(lDomainRelationalStorageDefinition);
130:                    lInvocations
131:                            .add(lStorageImplementationGeneratorInvocationDefinition);
132:                }
133:                // Return what we have		
134:                return (ToolInvocationDefinition[]) lInvocations
135:                        .toArray(new ToolInvocationDefinition[lInvocations
136:                                .size()]);
137:            }
138:
139:            // Returns tasks to do after generation. (Normally compillation would go in here  
140:            public ToolInvocationDefinition[] getCompilationPlan() {
141:                try {
142:                    List lInvocations = new ArrayList();
143:                    // Compile parts of the core
144:                    for (Iterator lDomainStoragesIterator = mStoragesToDo
145:                            .iterator(); lDomainStoragesIterator.hasNext();) {
146:                        DomainRelationalStorageDefinition lDomainRelationalStorageDefinition = (DomainRelationalStorageDefinition) lDomainStoragesIterator
147:                                .next();
148:                        Domain lDomain = lDomainRelationalStorageDefinition
149:                                .getDomain();
150:                        // Will need to compile enterprise types
151:                        lInvocations.add(JavaCompilerInvocationDefinitionUtils
152:                                .createForEnterpriseTypes(this , lDomain
153:                                        .getSystem().getEnterprise()));
154:                        // Will need to compile system types
155:                        lInvocations
156:                                .add(JavaCompilerInvocationDefinitionUtils
157:                                        .createForSystemTypes(this , lDomain
158:                                                .getSystem()));
159:                        // Storage interfaces
160:                        lInvocations.add(JavaCompilerInvocationDefinitionUtils
161:                                .createForStorageInterfaces(this , lDomain));
162:                        // Storage implementations
163:                        lInvocations.add(JavaCompilerInvocationDefinitionUtils
164:                                .createForStorageImplementation(this ,
165:                                        lDomainRelationalStorageDefinition,
166:                                        mStorageImplementationGenerator));
167:                    }
168:                    // Return what we have		
169:                    return (ToolInvocationDefinition[]) lInvocations
170:                            .toArray(new ToolInvocationDefinition[lInvocations
171:                                    .size()]);
172:                } catch (BSException e) {
173:                    throw new BuildException(
174:                            "Caught exception while generating packaging plan. "
175:                                    + e.getMessage());
176:                }
177:            }
178:
179:            /** Return tool invocations */
180:            public String[] getJarClassIncludes() throws BSException {
181:                List lJarClassIncludes = new ArrayList();
182:                // Compile parts of the core
183:                for (Iterator lDomainStoragesIterator = mStoragesToDo
184:                        .iterator(); lDomainStoragesIterator.hasNext();) {
185:                    DomainRelationalStorageDefinition lDomainRelationalStorageDefinition = (DomainRelationalStorageDefinition) lDomainStoragesIterator
186:                            .next();
187:                    Domain lDomain = lDomainRelationalStorageDefinition
188:                            .getDomain();
189:                    com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System lSystem = lDomain
190:                            .getSystem();
191:                    STDomainStylesheet lDomainStylesheet = CodeGenerationStylesheetAccessor
192:                            .getDomainStylesheet(lDomain);
193:                    // Storage interfaces
194:                    String lStorageInterfacePackage = lDomainStylesheet
195:                            .getStoragePackageName();
196:                    String lStorageInterfaceSubdirectory = StringUtils.replace(
197:                            lStorageInterfacePackage, ".", File.separator);
198:                    lJarClassIncludes.add(lStorageInterfaceSubdirectory
199:                            + File.separator + "*.*");
200:                    // Storage implementation
201:                    String lStorageImplementationPackage = mStorageImplementationGenerator
202:                            .getImplementationPackageName(lDomainRelationalStorageDefinition
203:                                    .getRef());
204:                    String lStorageImplementationSubdirectory = StringUtils
205:                            .replace(lStorageImplementationPackage, ".",
206:                                    File.separator);
207:                    lJarClassIncludes.add(lStorageImplementationSubdirectory
208:                            + File.separator + "**" + File.separator + "*.*");
209:                }
210:                // Return what we have		
211:                return (String[]) lJarClassIncludes
212:                        .toArray(new String[lJarClassIncludes.size()]);
213:            }
214:        }
w_w___w_._j__ava2__s___.__com_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.