Source Code Cross Referenced for BusinessServicesInterfaceModuleDefinition.java in  » UML » MetaBoss » com » metaboss » sdlctools » applications » anttasks » builder » modules » 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 
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;
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.Map;
024:        import java.util.Set;
025:
026:        import javax.jmi.reflect.JmiException;
027:
028:        import org.apache.tools.ant.BuildException;
029:
030:        import com.metaboss.enterprise.bs.BSException;
031:        import com.metaboss.sdlctools.applications.anttasks.builder.MetaBossBuilderTask;
032:        import com.metaboss.sdlctools.applications.anttasks.builder.ModuleDefinition;
033:        import com.metaboss.sdlctools.applications.anttasks.builder.ToolInvocationDefinition;
034:        import com.metaboss.sdlctools.applications.anttasks.builder.modules.subelements.IncludeAdapterDefinition;
035:        import com.metaboss.sdlctools.applications.anttasks.builder.modules.subelements.IncludeBusinessServiceProxyDefinition;
036:        import com.metaboss.sdlctools.applications.anttasks.builder.modules.subelements.IncludeDataDictionaryDefinition;
037:        import com.metaboss.sdlctools.applications.anttasks.builder.tools.CoreCodeGeneratorInvocationDefinition;
038:        import com.metaboss.sdlctools.applications.anttasks.builder.tools.JarPackagerInvocationDefinition;
039:        import com.metaboss.sdlctools.applications.anttasks.builder.tools.JavaCompilerInvocationDefinitionUtils;
040:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
041:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataDictionary;
042:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Enterprise;
043:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Servicemodule;
044:        import com.metaboss.sdlctools.services.codegeneration.CodeGenerationStylesheetAccessor;
045:        import com.metaboss.sdlctools.services.codegenerationstylesheet.STDataDictionaryStylesheet;
046:        import com.metaboss.sdlctools.services.codegenerationstylesheet.STEnterpriseStylesheet;
047:        import com.metaboss.sdlctools.services.codegenerationstylesheet.STServicemoduleStylesheet;
048:        import com.metaboss.sdlctools.services.codegenerationstylesheet.STSystemStylesheet;
049:        import com.metaboss.util.StringUtils;
050:
051:        /** The definition of how to build system interface module */
052:        public class BusinessServicesInterfaceModuleDefinition extends
053:                ModuleDefinition {
054:            // Initialise metadata for supplying in the constructor
055:            private static ElementMetadata sElementMetadata = new ElementMetadata();
056:            static {
057:                sElementMetadata.ElementTypeName = "BusinessServicesInterfaceModule";
058:                sElementMetadata.SupportsModelElementRefs = true;
059:                sElementMetadata.AllowedModelElementTypes = new Class[] {
060:                        Enterprise.class,
061:                        com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System.class,
062:                        Servicemodule.class };
063:            }
064:            private List mIncludeDataDictionaryElements = new ArrayList();
065:            private List mIncludeAdapterElements = new ArrayList();
066:            private List mIncludeServiceProxyElements = new ArrayList();
067:
068:            private List mReferencedServicemodulesToDo = new ArrayList(); // Referenced only. Need to generate and compile but do not package
069:            private List mReferencedDataDictionariesToDo = new ArrayList(); // Referenced only. Need to generate and compile but do not package
070:            private Set mServicemodulesToDo = new HashSet(); // Included. Do everything
071:            private Set mDataDictionariesToDo = new HashSet(); // Included. Do everything
072:            private List mDataDictionariesToGenerateAndCompile = new ArrayList(); // Combined list to use when generating and compiling
073:            private List mServicemodulesToGenerateAndCompile = new ArrayList(); // Combined list to use when generating and compiling
074:            private String mDestinationArchiveName = null;
075:
076:            /** The only available constructor */
077:            public BusinessServicesInterfaceModuleDefinition(
078:                    MetaBossBuilderTask pOwnerTask) {
079:                super (pOwnerTask, sElementMetadata);
080:            }
081:
082:            /** The special creator asking to build DataDictionary */
083:            public IncludeDataDictionaryDefinition createIncludeDataDictionary() {
084:                IncludeDataDictionaryDefinition lDataDictionaryDefinition = new IncludeDataDictionaryDefinition(
085:                        this );
086:                mIncludeDataDictionaryElements.add(lDataDictionaryDefinition);
087:                return lDataDictionaryDefinition;
088:            }
089:
090:            /** The special creator asking to build BusinessServiceAdapterDefinition */
091:            public IncludeAdapterDefinition createIncludeAdapter() {
092:                IncludeAdapterDefinition lAdapterDefinition = new IncludeAdapterDefinition(
093:                        this );
094:                mIncludeAdapterElements.add(lAdapterDefinition);
095:                return lAdapterDefinition;
096:            }
097:
098:            /** The special creator asking to build BusinessServiceAdapterDefinition */
099:            public IncludeBusinessServiceProxyDefinition createIncludeServiceProxy() {
100:                IncludeBusinessServiceProxyDefinition lProxyDefinition = new IncludeBusinessServiceProxyDefinition(
101:                        this );
102:                mIncludeServiceProxyElements.add(lProxyDefinition);
103:                return lProxyDefinition;
104:            }
105:
106:            /** Called when initialisation of parameters has been completed and generation is about to commence */
107:            public void completeInitialisation() throws BuildException {
108:                try {
109:                    // Work on included elements
110:                    ModelElement[] lIncludedModelElements = getIncludedModelElements();
111:                    // First collect list of al domains to generate implementations for
112:                    for (int lElementsIndex = 0; lElementsIndex < lIncludedModelElements.length; lElementsIndex++) {
113:                        ModelElement lIncludedModelElement = lIncludedModelElements[lElementsIndex];
114:                        mServicemodulesToDo.addAll(Arrays.asList(getOwnerTask()
115:                                .findModelElementsByXPath(
116:                                        lIncludedModelElement,
117:                                        "descendant-or-self::Servicemodule",
118:                                        new Class[] { Servicemodule.class })));
119:                    }
120:
121:                    // Work on the module name
122:                    String lModuleName = getModuleName();
123:                    if (lModuleName == null) {
124:                        ModelElement lRootModelElement = getRootModelElement();
125:                        if (lRootModelElement instanceof  Enterprise) {
126:                            // Set up module name for the domain
127:                            STEnterpriseStylesheet lEntepriseStylesheet = CodeGenerationStylesheetAccessor
128:                                    .getEnterpriseStylesheet(lRootModelElement
129:                                            .getName());
130:                            lModuleName = lEntepriseStylesheet
131:                                    .getBusinessServicesInterfaceModuleName();
132:                        } else if (lRootModelElement instanceof  com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System) {
133:                            // Set up module name for the system
134:                            STSystemStylesheet lSystemStylesheet = CodeGenerationStylesheetAccessor
135:                                    .getSystemStylesheet(lRootModelElement
136:                                            .getRef());
137:                            lModuleName = lSystemStylesheet
138:                                    .getBusinessServicesInterfaceModuleName();
139:                        } else {
140:                            // We are given a servicemodule
141:                            STServicemoduleStylesheet lServicemodulesStylesheet = CodeGenerationStylesheetAccessor
142:                                    .getServicemoduleStylesheet(lRootModelElement
143:                                            .getRef());
144:                            lModuleName = lServicemodulesStylesheet
145:                                    .getBusinessServicesInterfaceModuleName();
146:                        }
147:                    }
148:                    // We now have a automatically generated modules name. Se if we need to use it or the explicit one
149:                    StringBuffer lModuleNameBuffer = new StringBuffer(
150:                            lModuleName);
151:                    // Finish building the archive name
152:                    String lVersionToken = getOwnerTask().getVersionToken();
153:                    if (lVersionToken != null) {
154:                        lModuleNameBuffer.append("_");
155:                        lModuleNameBuffer.append(lVersionToken);
156:                    }
157:                    lModuleNameBuffer.append(".jar");
158:                    mDestinationArchiveName = lModuleNameBuffer.toString();
159:
160:                    // It is possible that there is an external data dictionary or servicemodule we need to have available to compile this one successfully.
161:                    for (Iterator lServicemodulesIterator = mServicemodulesToDo
162:                            .iterator(); lServicemodulesIterator.hasNext();) {
163:                        Servicemodule lServicemodule = (Servicemodule) lServicemodulesIterator
164:                                .next();
165:                        mReferencedDataDictionariesToDo.addAll(lServicemodule
166:                                .getReferencedDataDictionaries());
167:                        mReferencedServicemodulesToDo.addAll(lServicemodule
168:                                .getReferencedServicemodules());
169:                    }
170:
171:                    // Work on included data dictionaries
172:                    for (Iterator lDataDictionariesIterator = mIncludeDataDictionaryElements
173:                            .iterator(); lDataDictionariesIterator.hasNext();) {
174:                        IncludeDataDictionaryDefinition lIncludeDataDictionaryDefinition = (IncludeDataDictionaryDefinition) lDataDictionariesIterator
175:                                .next();
176:                        lIncludeDataDictionaryDefinition
177:                                .setDefaultRootModelElement(getRootModelElement());
178:                        lIncludeDataDictionaryDefinition
179:                                .completeInitialisation();
180:                        mReferencedDataDictionariesToDo.addAll(Arrays
181:                                .asList(lIncludeDataDictionaryDefinition
182:                                        .getDataDictionariesToReference()));
183:                        mDataDictionariesToDo.addAll(Arrays
184:                                .asList(lIncludeDataDictionaryDefinition
185:                                        .getDataDictionariesToInclude()));
186:                    }
187:
188:                    // Create combined lists 
189:                    mDataDictionariesToGenerateAndCompile
190:                            .addAll(mReferencedDataDictionariesToDo);
191:                    mDataDictionariesToGenerateAndCompile
192:                            .addAll(mDataDictionariesToDo);
193:                    mServicemodulesToGenerateAndCompile
194:                            .addAll(mReferencedServicemodulesToDo);
195:                    mServicemodulesToGenerateAndCompile
196:                            .addAll(mServicemodulesToDo);
197:
198:                    // Need to complete initialisation of the servicemodule adapters and verify that all adapter implementations are associated with the included servicemodules
199:                    for (Iterator lAdaptersIterator = mIncludeAdapterElements
200:                            .iterator(); lAdaptersIterator.hasNext();) {
201:                        IncludeAdapterDefinition lIncludedAdapterDefinition = (IncludeAdapterDefinition) lAdaptersIterator
202:                                .next();
203:                        lIncludedAdapterDefinition
204:                                .setDefaultRootModelElement(getRootModelElement());
205:                        lIncludedAdapterDefinition
206:                                .setAdditionalRootModelElements((ModelElement[]) mDataDictionariesToDo
207:                                        .toArray(new ModelElement[mDataDictionariesToDo
208:                                                .size()]));
209:                        lIncludedAdapterDefinition.completeInitialisation();
210:                        Servicemodule[] lIncludedServicemodules = lIncludedAdapterDefinition
211:                                .getIncludedServicemodules();
212:                        for (int i = 0; i < lIncludedServicemodules.length; i++) {
213:                            Servicemodule lIncludedServicemodule = lIncludedServicemodules[i];
214:                            if (!mServicemodulesToDo
215:                                    .contains(lIncludedServicemodule))
216:                                throw new BuildException(
217:                                        "The <IncludeAdapter> subelement must refer to the Servicemodule referenced in the parent <"
218:                                                + getElementMetadata().ElementTypeName
219:                                                + "> element.");
220:                        }
221:                    }
222:
223:                    // Need to complete initialisation of the proxy implementations and verify that all proxy implementations are associated with the included servicemodules
224:                    for (Iterator lProxiesIterator = mIncludeServiceProxyElements
225:                            .iterator(); lProxiesIterator.hasNext();) {
226:                        IncludeBusinessServiceProxyDefinition lIncludedProxyDefinition = (IncludeBusinessServiceProxyDefinition) lProxiesIterator
227:                                .next();
228:                        lIncludedProxyDefinition
229:                                .setDefaultRootModelElement(getRootModelElement());
230:                        lIncludedProxyDefinition.completeInitialisation();
231:                        Servicemodule[] lAffectedServicemodules = lIncludedProxyDefinition
232:                                .getAffectedServicemodules();
233:                        for (int i = 0; i < lAffectedServicemodules.length; i++) {
234:                            Servicemodule lAffectedServicemodule = lAffectedServicemodules[i];
235:                            if (!mServicemodulesToDo
236:                                    .contains(lAffectedServicemodule))
237:                                throw new BuildException(
238:                                        "The <IncludeServiceProxy> subelement must refer to the one of the Servicemodules (or the Service containeed within one of the Servicemodules) referenced in the parent <"
239:                                                + getElementMetadata().ElementTypeName
240:                                                + "> element.");
241:                        }
242:
243:                        // Manage required adapter definitions
244:                        IncludeAdapterDefinition[] lRequiredAdapterDefinitions = lIncludedProxyDefinition
245:                                .getRequiredAdapterDefinitions();
246:                        if (lRequiredAdapterDefinitions != null
247:                                && lRequiredAdapterDefinitions.length > 0) {
248:                            for (int i = 0; i < lRequiredAdapterDefinitions.length; i++) {
249:                                IncludeAdapterDefinition lRequiredAdapterDefinition = lRequiredAdapterDefinitions[i];
250:                                lRequiredAdapterDefinition
251:                                        .setDefaultRootModelElement(getRootModelElement());
252:                                lRequiredAdapterDefinition
253:                                        .completeInitialisation();
254:                                Servicemodule[] lIncludedServicemodules = lRequiredAdapterDefinition
255:                                        .getIncludedServicemodules();
256:                                for (int j = 0; j < lIncludedServicemodules.length; j++) {
257:                                    Servicemodule lIncludedServicemodule = lIncludedServicemodules[j];
258:                                    if (!mServicemodulesToDo
259:                                            .contains(lIncludedServicemodule))
260:                                        throw new BuildException(
261:                                                "The <IncludeServiceAdapter> subelement must refer to the Servicemodule referenced in the parent <"
262:                                                        + getElementMetadata().ElementTypeName
263:                                                        + "> element.");
264:                                }
265:                                // Add this adapter to the ones to be executed
266:                                mIncludeAdapterElements
267:                                        .add(lRequiredAdapterDefinition);
268:                            }
269:                        }
270:                    }
271:                } catch (JmiException e) {
272:                    throw new BuildException(
273:                            "Caught exception while preparing to build module. "
274:                                    + e.getMessage());
275:                } catch (BSException e) {
276:                    throw new BuildException(
277:                            "Caught exception while preparing to build module. "
278:                                    + e.getMessage());
279:                }
280:            }
281:
282:            // Returns plan to invoke any number of code generators necessary to build the module  
283:            public ToolInvocationDefinition[] getGenerationPlan() {
284:                //		try
285:                //		{
286:                List lInvocations = new ArrayList();
287:                // Work on referenced and included data dictionaries
288:                for (Iterator lDataDictionariesIterator = mDataDictionariesToGenerateAndCompile
289:                        .iterator(); lDataDictionariesIterator.hasNext();) {
290:                    DataDictionary lDataDictionary = (DataDictionary) lDataDictionariesIterator
291:                            .next();
292:                    if ((mReferencedDataDictionariesToDo
293:                            .contains(lDataDictionary) == false)
294:                            || (getOwnerTask()
295:                                    .isArtefactPresentOnCompileClasspath(
296:                                            CoreCodeGeneratorInvocationDefinition
297:                                                    .getGeneratorIdentifier(),
298:                                            lDataDictionary.getRef()) == false)) {
299:                        // Will need to generate core of the system this is where service definitions are
300:                        CoreCodeGeneratorInvocationDefinition lCoreGeneratorInvocationDefinition = new CoreCodeGeneratorInvocationDefinition(
301:                                getOwnerTask());
302:                        lCoreGeneratorInvocationDefinition
303:                                .setDataDictionaryRef(lDataDictionary.getRef());
304:                        lInvocations.add(lCoreGeneratorInvocationDefinition);
305:                    }
306:                }
307:
308:                // Work on referenced and included servicemodules
309:                for (Iterator lServicemodulesIterator = mServicemodulesToGenerateAndCompile
310:                        .iterator(); lServicemodulesIterator.hasNext();) {
311:                    Servicemodule lServicemodule = (Servicemodule) lServicemodulesIterator
312:                            .next();
313:                    if ((mReferencedServicemodulesToDo.contains(lServicemodule) == false)
314:                            || (getOwnerTask()
315:                                    .isArtefactPresentOnCompileClasspath(
316:                                            CoreCodeGeneratorInvocationDefinition
317:                                                    .getGeneratorIdentifier(),
318:                                            lServicemodule.getRef()) == false)) {
319:                        // Generate system core
320:                        CoreCodeGeneratorInvocationDefinition lSystemCoreGeneratorInvocationDefinition = new CoreCodeGeneratorInvocationDefinition(
321:                                getOwnerTask());
322:                        lSystemCoreGeneratorInvocationDefinition
323:                                .setSystemRef(lServicemodule.getSystem()
324:                                        .getRef());
325:                        lInvocations
326:                                .add(lSystemCoreGeneratorInvocationDefinition);
327:                    }
328:                }
329:
330:                // May need to generate servicemodule adapters
331:                for (Iterator lAdaptersIterator = mIncludeAdapterElements
332:                        .iterator(); lAdaptersIterator.hasNext();) {
333:                    IncludeAdapterDefinition lServicemoduleAdapterDefinition = (IncludeAdapterDefinition) lAdaptersIterator
334:                            .next();
335:                    ToolInvocationDefinition[] lToolInvocations = lServicemoduleAdapterDefinition
336:                            .getGenerationPlan();
337:                    if (lToolInvocations != null && lToolInvocations.length > 0)
338:                        lInvocations.addAll(Arrays.asList(lToolInvocations));
339:                }
340:
341:                // May need to generate service proxies
342:                for (Iterator lProxiesIterator = mIncludeServiceProxyElements
343:                        .iterator(); lProxiesIterator.hasNext();) {
344:                    IncludeBusinessServiceProxyDefinition lServiceProxyDefinition = (IncludeBusinessServiceProxyDefinition) lProxiesIterator
345:                            .next();
346:                    ToolInvocationDefinition[] lToolInvocations = lServiceProxyDefinition
347:                            .getGenerationPlan();
348:                    if (lToolInvocations != null && lToolInvocations.length > 0)
349:                        lInvocations.addAll(Arrays.asList(lToolInvocations));
350:                }
351:
352:                // Return what we have		
353:                return (ToolInvocationDefinition[]) lInvocations
354:                        .toArray(new ToolInvocationDefinition[lInvocations
355:                                .size()]);
356:                //		}
357:                //		catch(BSException e)
358:                //		{
359:                //			throw new BuildException("Caught exception while generating build plan. " + e.getMessage());
360:                //		}
361:            }
362:
363:            // Returns tasks to invoke any number of compilers necessary to build the module  
364:            public ToolInvocationDefinition[] getCompilationPlan() {
365:                try {
366:                    List lInvocations = new ArrayList();
367:                    // Work on referenced and included data dictionaries
368:                    for (Iterator lDataDictionariesIterator = mDataDictionariesToGenerateAndCompile
369:                            .iterator(); lDataDictionariesIterator.hasNext();) {
370:                        DataDictionary lDataDictionary = (DataDictionary) lDataDictionariesIterator
371:                                .next();
372:                        if ((mReferencedDataDictionariesToDo
373:                                .contains(lDataDictionary) == false)
374:                                || (getOwnerTask()
375:                                        .isArtefactPresentOnCompileClasspath(
376:                                                CoreCodeGeneratorInvocationDefinition
377:                                                        .getGeneratorIdentifier(),
378:                                                lDataDictionary.getRef()) == false)) {
379:                            if (getOwnerTask().getTypesSrcDir() != null) {
380:                                // Compile custom enterprise types
381:                                lInvocations
382:                                        .add(JavaCompilerInvocationDefinitionUtils
383:                                                .createForCustomDataDictionaryTypes(
384:                                                        this , lDataDictionary));
385:                            }
386:                            lInvocations
387:                                    .add(JavaCompilerInvocationDefinitionUtils
388:                                            .createForDataDictionaryTypes(this ,
389:                                                    lDataDictionary));
390:                        }
391:                    }
392:
393:                    // Work on referenced and included servicemodules
394:                    for (Iterator lServicemodulesIterator = mServicemodulesToGenerateAndCompile
395:                            .iterator(); lServicemodulesIterator.hasNext();) {
396:                        Servicemodule lServicemodule = (Servicemodule) lServicemodulesIterator
397:                                .next();
398:                        if ((mReferencedServicemodulesToDo
399:                                .contains(lServicemodule) == false)
400:                                || (getOwnerTask()
401:                                        .isArtefactPresentOnCompileClasspath(
402:                                                CoreCodeGeneratorInvocationDefinition
403:                                                        .getGeneratorIdentifier(),
404:                                                lServicemodule.getRef()) == false)) {
405:                            STServicemoduleStylesheet lServicemoduleStylesheet = CodeGenerationStylesheetAccessor
406:                                    .getServicemoduleStylesheet(lServicemodule);
407:                            // Compile Services packages
408:                            lInvocations
409:                                    .add(JavaCompilerInvocationDefinitionUtils
410:                                            .createForServicemoduleInterfaces(
411:                                                    this , lServicemodule));
412:                            // Compile EventPipelines packages
413:                            lInvocations
414:                                    .add(JavaCompilerInvocationDefinitionUtils
415:                                            .createForEventPublisherInterfaces(
416:                                                    this , lServicemodule));
417:                        }
418:                    }
419:
420:                    // May need to compile servicemodule adapters
421:                    for (Iterator lAdaptersIterator = mIncludeAdapterElements
422:                            .iterator(); lAdaptersIterator.hasNext();) {
423:                        IncludeAdapterDefinition lServicemoduleAdapterDefinition = (IncludeAdapterDefinition) lAdaptersIterator
424:                                .next();
425:                        ToolInvocationDefinition[] lToolInvocations = lServicemoduleAdapterDefinition
426:                                .getCompilationPlan();
427:                        if (lToolInvocations != null
428:                                && lToolInvocations.length > 0)
429:                            lInvocations
430:                                    .addAll(Arrays.asList(lToolInvocations));
431:                    }
432:
433:                    // May need to compile service proxies
434:                    for (Iterator lProxiesIterator = mIncludeServiceProxyElements
435:                            .iterator(); lProxiesIterator.hasNext();) {
436:                        IncludeBusinessServiceProxyDefinition lServiceProxyDefinition = (IncludeBusinessServiceProxyDefinition) lProxiesIterator
437:                                .next();
438:                        ToolInvocationDefinition[] lToolInvocations = lServiceProxyDefinition
439:                                .getCompilationPlan();
440:                        if (lToolInvocations != null
441:                                && lToolInvocations.length > 0)
442:                            lInvocations
443:                                    .addAll(Arrays.asList(lToolInvocations));
444:                    }
445:                    // Return what we have		
446:                    return (ToolInvocationDefinition[]) lInvocations
447:                            .toArray(new ToolInvocationDefinition[lInvocations
448:                                    .size()]);
449:                } catch (BSException e) {
450:                    throw new BuildException(
451:                            "Caught exception while generating packaging plan. "
452:                                    + e.getMessage());
453:                }
454:            }
455:
456:            // Returns tasks to invoke any number of packagers necessary to build the module  
457:            public ToolInvocationDefinition[] getPackagingPlan()
458:                    throws BuildException {
459:                try {
460:                    JarPackagerInvocationDefinition lJarPackager = new JarPackagerInvocationDefinition(
461:                            getOwnerTask());
462:                    lJarPackager.setDestFileName(mDestinationArchiveName);
463:                    // There may be some additional files to include
464:                    lJarPackager.addFileSetIncludes(getAdditionalFiles());
465:
466:                    // Work only on included datadictionaries
467:                    for (Iterator lDataDictionariesIterator = mDataDictionariesToDo
468:                            .iterator(); lDataDictionariesIterator.hasNext();) {
469:                        DataDictionary lDataDictionary = (DataDictionary) lDataDictionariesIterator
470:                                .next();
471:                        STDataDictionaryStylesheet lDataDictionaryStylesheet = CodeGenerationStylesheetAccessor
472:                                .getDataDictionaryStylesheet(lDataDictionary);
473:                        String lClassSubdirectory = StringUtils.replace(
474:                                lDataDictionaryStylesheet.getPackageName(),
475:                                ".", File.separator);
476:                        lJarPackager.addClassInclude(lClassSubdirectory
477:                                + File.separator + "*.class");
478:                        lJarPackager.addClassInclude(lClassSubdirectory
479:                                + File.separator + "**" + File.separator
480:                                + "*.class");
481:                        lJarPackager.addGensrcInclude(lClassSubdirectory
482:                                + File.separator + "*.properties");
483:                        lJarPackager.addGensrcInclude(lClassSubdirectory
484:                                + File.separator + "**" + File.separator
485:                                + "*.properties");
486:                        // Add contents information
487:                        lJarPackager.addJarContentsEntry(
488:                                CoreCodeGeneratorInvocationDefinition
489:                                        .getGeneratorIdentifier(),
490:                                lDataDictionary.getRef());
491:                    }
492:
493:                    // Work only on included servicemodules
494:                    for (Iterator lServicemodulesIterator = mServicemodulesToDo
495:                            .iterator(); lServicemodulesIterator.hasNext();) {
496:                        Servicemodule lServicemodule = (Servicemodule) lServicemodulesIterator
497:                                .next();
498:                        STServicemoduleStylesheet lServicemoduleStylesheet = CodeGenerationStylesheetAccessor
499:                                .getServicemoduleStylesheet(lServicemodule);
500:                        // Service interfaces 
501:                        String lServicesSubdirectory = StringUtils.replace(
502:                                lServicemoduleStylesheet.getPackageName(), ".",
503:                                File.separator);
504:                        lJarPackager.addClassInclude(lServicesSubdirectory
505:                                + File.separator + "*.*");
506:                        lJarPackager.addGensrcInclude(lServicesSubdirectory
507:                                + File.separator + "*.properties");
508:                        // Event Pipeline interfaces 
509:                        String lEventPipelinesSubdirectory = StringUtils
510:                                .replace(lServicemoduleStylesheet
511:                                        .getEventPublisherPackageName(), ".",
512:                                        File.separator);
513:                        lJarPackager
514:                                .addClassInclude(lEventPipelinesSubdirectory
515:                                        + File.separator + "*.*");
516:                        lJarPackager
517:                                .addGensrcInclude(lEventPipelinesSubdirectory
518:                                        + File.separator + "*.properties");
519:                        // Add contents information
520:                        lJarPackager.addJarContentsEntry(
521:                                CoreCodeGeneratorInvocationDefinition
522:                                        .getGeneratorIdentifier(),
523:                                lServicemodule.getRef());
524:                    }
525:
526:                    // May need to package service module adapters
527:                    for (Iterator lAdaptersIterator = mIncludeAdapterElements
528:                            .iterator(); lAdaptersIterator.hasNext();) {
529:                        IncludeAdapterDefinition lServicemoduleAdapterDefinition = (IncludeAdapterDefinition) lAdaptersIterator
530:                                .next();
531:                        String[] lJarClassIncludes = lServicemoduleAdapterDefinition
532:                                .getJarClassIncludes();
533:                        if (lJarClassIncludes != null
534:                                && lJarClassIncludes.length > 0)
535:                            lJarPackager.addClassIncludes(lJarClassIncludes);
536:                        String[] lJarSourceIncludes = lServicemoduleAdapterDefinition
537:                                .getJarSourceIncludes();
538:                        if (lJarSourceIncludes != null
539:                                && lJarSourceIncludes.length > 0)
540:                            lJarPackager.addGensrcIncludes(lJarSourceIncludes);
541:                        // Add contents information
542:                        Map lJarContentsMap = lServicemoduleAdapterDefinition
543:                                .getJarContentsInformation();
544:                        if (lJarContentsMap != null
545:                                && lJarContentsMap.size() > 0)
546:                            lJarPackager.addJarContents(lJarContentsMap);
547:                    }
548:
549:                    // May need to package service proxies
550:                    for (Iterator lProxiesIterator = mIncludeServiceProxyElements
551:                            .iterator(); lProxiesIterator.hasNext();) {
552:                        IncludeBusinessServiceProxyDefinition lServiceProxyDefinition = (IncludeBusinessServiceProxyDefinition) lProxiesIterator
553:                                .next();
554:                        String[] lJarClassIncludes = lServiceProxyDefinition
555:                                .getJarClassIncludes();
556:                        if (lJarClassIncludes != null
557:                                && lJarClassIncludes.length > 0)
558:                            lJarPackager.addClassIncludes(lJarClassIncludes);
559:                    }
560:
561:                    // Return what we have		
562:                    return new ToolInvocationDefinition[] { lJarPackager };
563:                } catch (BSException e) {
564:                    throw new BuildException(
565:                            "Caught exception while generating packaging plan. "
566:                                    + e.getMessage());
567:                }
568:            }
569:        }
w_ww___.__j__a__va__2_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.