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.tools;
016:
017: import java.io.File;
018:
019: import org.apache.tools.ant.types.Path;
020:
021: import com.metaboss.enterprise.bs.BSException;
022: import com.metaboss.sdlctools.applications.anttasks.builder.MetaBossBuilderTaskElement;
023: import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataDictionary;
024: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Enterprise;
025: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Service;
026: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Servicemodule;
027: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Domain;
028: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.DomainRelationalStorageDefinition;
029: import com.metaboss.sdlctools.services.codegeneration.BSAdapterGenerator;
030: import com.metaboss.sdlctools.services.codegeneration.BSDomainSupportServicesImplementationGenerator;
031: import com.metaboss.sdlctools.services.codegeneration.BSServiceDistributionGenerator;
032: import com.metaboss.sdlctools.services.codegeneration.BSServiceImplementationGenerator;
033: import com.metaboss.sdlctools.services.codegeneration.BSServiceProxyGenerator;
034: import com.metaboss.sdlctools.services.codegeneration.BSStorageImplementationGenerator;
035: import com.metaboss.sdlctools.services.codegeneration.CodeGenerationStylesheetAccessor;
036: import com.metaboss.sdlctools.services.codegenerationstylesheet.STDataDictionaryStylesheet;
037: import com.metaboss.sdlctools.services.codegenerationstylesheet.STDesignLibraryStylesheet;
038: import com.metaboss.sdlctools.services.codegenerationstylesheet.STDomainStylesheet;
039: import com.metaboss.sdlctools.services.codegenerationstylesheet.STServicemoduleStylesheet;
040: import com.metaboss.sdlctools.services.codegenerationstylesheet.STSystemStylesheet;
041: import com.metaboss.util.StringUtils;
042:
043: /** This static utilit toolbox class is used to create commonly used Java compiler invocations */
044: public class JavaCompilerInvocationDefinitionUtils {
045: // Returns Java compiler definition used to compile enterprise types
046: public static JavaCompilerInvocationDefinition createForEnterpriseTypes(
047: MetaBossBuilderTaskElement pOwnerElement,
048: Enterprise pEnterprise) throws BSException {
049: // Get to enterprise types package
050: STDesignLibraryStylesheet lDesignLibraryStylesheet = CodeGenerationStylesheetAccessor
051: .getDesignLibraryStylesheet(pEnterprise
052: .getDesignLibrary());
053: String lTypesRootSubdirectory = StringUtils.replace(
054: lDesignLibraryStylesheet.getTypesRootPackageName(),
055: ".", File.separator);
056: // Construct compilation step
057: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
058: pOwnerElement.getOwnerTask(),
059: "Compile data types for the " + pEnterprise.getName()
060: + " enterprise");
061: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
062: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
063: if (lCompileClasspath != null)
064: lCompiler.setAdditionalClasspath(lCompileClasspath);
065: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
066: .getGenDir());
067: lCompiler.addSourceInclude(lTypesRootSubdirectory
068: + File.separator + "**" + File.separator + "*.java");
069: return lCompiler;
070: }
071:
072: // Returns Java compiler definition used to compile datadictionary types
073: public static JavaCompilerInvocationDefinition createForDataDictionaryTypes(
074: MetaBossBuilderTaskElement pOwnerElement,
075: DataDictionary pDataDictionary) throws BSException {
076: // Get to enterprise types package
077: STDataDictionaryStylesheet lDataDictionaryStylesheet = CodeGenerationStylesheetAccessor
078: .getDataDictionaryStylesheet(pDataDictionary);
079: String lTypesRootSubdirectory = StringUtils.replace(
080: lDataDictionaryStylesheet.getPackageName(), ".",
081: File.separator);
082: // Construct compilation step
083: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
084: pOwnerElement.getOwnerTask(),
085: "Compile contents of the "
086: + (pDataDictionary.getSystem() != null ? (pDataDictionary
087: .getSystem().getName() + " system data dictionary")
088: : (pDataDictionary.getName() + " data dictionary")));
089: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
090: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
091: if (lCompileClasspath != null)
092: lCompiler.setAdditionalClasspath(lCompileClasspath);
093: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
094: .getGenDir());
095: lCompiler.addSourceInclude(lTypesRootSubdirectory
096: + File.separator + "*.java");
097: lCompiler.addSourceInclude(lTypesRootSubdirectory
098: + File.separator + "**" + File.separator + "*.java");
099: return lCompiler;
100: }
101:
102: // Returns Java compiler definition used to compile enterprise types
103: public static JavaCompilerInvocationDefinition createForCustomEnterpriseTypes(
104: MetaBossBuilderTaskElement pOwnerElement,
105: Enterprise pEnterprise) throws BSException {
106: // Get to enterprise types package
107: STDesignLibraryStylesheet lDesignLibraryStylesheet = CodeGenerationStylesheetAccessor
108: .getDesignLibraryStylesheet(pEnterprise
109: .getDesignLibrary());
110: String lTypesRootSubdirectory = StringUtils.replace(
111: lDesignLibraryStylesheet.getTypesRootPackageName(),
112: ".", File.separator);
113: // Construct compilation step
114: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
115: pOwnerElement.getOwnerTask(),
116: "Compile custom data types for the "
117: + pEnterprise.getName() + " enterprise");
118: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
119: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
120: if (lCompileClasspath != null)
121: lCompiler.setAdditionalClasspath(lCompileClasspath);
122: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
123: .getTypesSrcDir());
124: lCompiler.addSourceInclude(lTypesRootSubdirectory
125: + File.separator + "**" + File.separator + "*.java");
126: return lCompiler;
127: }
128:
129: // Returns Java compiler definition used to compile enterprise types
130: public static JavaCompilerInvocationDefinition createForCustomDataDictionaryTypes(
131: MetaBossBuilderTaskElement pOwnerElement,
132: DataDictionary pDataDictionary) throws BSException {
133: // Get to enterprise types package
134: STDataDictionaryStylesheet lDataDictionaryStylesheet = CodeGenerationStylesheetAccessor
135: .getDataDictionaryStylesheet(pDataDictionary);
136: String lTypesRootSubdirectory = StringUtils.replace(
137: lDataDictionaryStylesheet.getPackageName(), ".",
138: File.separator);
139: // Construct compilation step
140: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
141: pOwnerElement.getOwnerTask(),
142: "Compile custom data types of the "
143: + (pDataDictionary.getSystem() != null ? (pDataDictionary
144: .getSystem().getName() + " system data dictionary")
145: : (pDataDictionary.getName() + " data dictionary")));
146: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
147: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
148: if (lCompileClasspath != null)
149: lCompiler.setAdditionalClasspath(lCompileClasspath);
150: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
151: .getTypesSrcDir());
152: lCompiler.addSourceInclude(lTypesRootSubdirectory
153: + File.separator + "**" + File.separator + "*.java");
154: return lCompiler;
155: }
156:
157: // Returns Java compiler definition used to compile system types
158: public static JavaCompilerInvocationDefinition createForSystemTypes(
159: MetaBossBuilderTaskElement pOwnerElement,
160: com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System pSystem)
161: throws BSException {
162: // Get to system types package
163: STSystemStylesheet lSystemStylesheet = CodeGenerationStylesheetAccessor
164: .getSystemStylesheet(pSystem.getRef());
165: String lTypesRootSubdirectory = StringUtils.replace(
166: lSystemStylesheet.getTypesRootPackageName(), ".",
167: File.separator);
168: // Construct compilation step
169: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
170: pOwnerElement.getOwnerTask(),
171: "Compile data types for the " + pSystem.getRef()
172: + " system");
173: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
174: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
175: if (lCompileClasspath != null)
176: lCompiler.setAdditionalClasspath(lCompileClasspath);
177: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
178: .getGenDir());
179: lCompiler.addSourceInclude(lTypesRootSubdirectory
180: + File.separator + "**" + File.separator + "*.java");
181: return lCompiler;
182: }
183:
184: // Returns Java compiler definition used to compile system types
185: public static JavaCompilerInvocationDefinition createForCustomSystemTypes(
186: MetaBossBuilderTaskElement pOwnerElement,
187: com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System pSystem)
188: throws BSException {
189: // Get to system types package
190: STSystemStylesheet lSystemStylesheet = CodeGenerationStylesheetAccessor
191: .getSystemStylesheet(pSystem.getRef());
192: String lTypesRootSubdirectory = StringUtils.replace(
193: lSystemStylesheet.getTypesRootPackageName(), ".",
194: File.separator);
195: // Construct compilation step
196: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
197: pOwnerElement.getOwnerTask(),
198: "Compile custom data types for the " + pSystem.getRef()
199: + " system");
200: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
201: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
202: if (lCompileClasspath != null)
203: lCompiler.setAdditionalClasspath(lCompileClasspath);
204: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
205: .getTypesSrcDir());
206: lCompiler.addSourceInclude(lTypesRootSubdirectory
207: + File.separator + "**" + File.separator + "*.java");
208: return lCompiler;
209: }
210:
211: // Returns Java compiler definition used to compile servicemodule interfaces
212: public static JavaCompilerInvocationDefinition createForServicemoduleInterfaces(
213: MetaBossBuilderTaskElement pOwnerElement,
214: Servicemodule pServicemodule) throws BSException {
215: STServicemoduleStylesheet lServicemoduleStylesheet = CodeGenerationStylesheetAccessor
216: .getServicemoduleStylesheet(pServicemodule);
217: String lServicemoduleInterfaceSubdirectory = StringUtils
218: .replace(lServicemoduleStylesheet.getPackageName(),
219: ".", File.separator);
220: // Construct compilation step
221: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
222: pOwnerElement.getOwnerTask(),
223: "Compile servicemodule interfaces for the "
224: + pServicemodule.getRef() + " servicemodule");
225: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
226: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
227: if (lCompileClasspath != null)
228: lCompiler.setAdditionalClasspath(lCompileClasspath);
229: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
230: .getGenDir());
231: lCompiler.addSourceInclude(lServicemoduleInterfaceSubdirectory
232: + File.separator + "*.java");
233: return lCompiler;
234: }
235:
236: // Returns Java compiler definition used to compile servicemodule interfaces
237: public static JavaCompilerInvocationDefinition createForEventPublisherInterfaces(
238: MetaBossBuilderTaskElement pOwnerElement,
239: Servicemodule pServicemodule) throws BSException {
240: STServicemoduleStylesheet lServicemoduleStylesheet = CodeGenerationStylesheetAccessor
241: .getServicemoduleStylesheet(pServicemodule);
242: String lServicemoduleInterfaceSubdirectory = StringUtils
243: .replace(lServicemoduleStylesheet
244: .getEventPublisherPackageName(), ".",
245: File.separator);
246: // Construct compilation step
247: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
248: pOwnerElement.getOwnerTask(),
249: "Compile servicemodule event publisher interfaces for the "
250: + pServicemodule.getRef() + " servicemodule");
251: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
252: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
253: if (lCompileClasspath != null)
254: lCompiler.setAdditionalClasspath(lCompileClasspath);
255: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
256: .getGenDir());
257: lCompiler.addSourceInclude(lServicemoduleInterfaceSubdirectory
258: + File.separator + "*.java");
259: return lCompiler;
260: }
261:
262: // Returns Java compiler definition used to compile servicemodule distribution pieces
263: public static JavaCompilerInvocationDefinition createForServicemoduleDistribution(
264: MetaBossBuilderTaskElement pOwnerElement,
265: Servicemodule pServicemodule,
266: BSServiceDistributionGenerator pGenerator)
267: throws BSException {
268: String lServicesClientSubdirectory = StringUtils
269: .replace(
270: pGenerator
271: .getServicesClientImplementationPackageName(pServicemodule
272: .getRef()), ".", File.separator);
273: String lServicesServerSubdirectory = StringUtils
274: .replace(
275: pGenerator
276: .getServicesServerImplementationPackageName(pServicemodule
277: .getRef()), ".", File.separator);
278: String lEventPublishersClientSubdirectory = StringUtils
279: .replace(
280: pGenerator
281: .getEventPublishersClientImplementationPackageName(pServicemodule
282: .getRef()), ".", File.separator);
283: String lEventPublishersServerSubdirectory = StringUtils
284: .replace(
285: pGenerator
286: .getEventPublishersServerImplementationPackageName(pServicemodule
287: .getRef()), ".", File.separator);
288: // Construct compilation step
289: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
290: pOwnerElement.getOwnerTask(),
291: "Compile servicemodule distribution for the "
292: + pServicemodule.getRef() + " servicemodule");
293: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
294: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
295: if (lCompileClasspath != null)
296: lCompiler.setAdditionalClasspath(lCompileClasspath);
297: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
298: .getGenDir());
299: lCompiler.addSourceInclude(lServicesClientSubdirectory
300: + File.separator + "**" + File.separator + "*.java");
301: lCompiler.addSourceInclude(lServicesServerSubdirectory
302: + File.separator + "**" + File.separator + "*.java");
303: lCompiler.addSourceInclude(lEventPublishersClientSubdirectory
304: + File.separator + "**" + File.separator + "*.java");
305: lCompiler.addSourceInclude(lEventPublishersServerSubdirectory
306: + File.separator + "**" + File.separator + "*.java");
307: return lCompiler;
308: }
309:
310: // Returns Java compiler definition used to compile servicemodule adapter pieces
311: public static JavaCompilerInvocationDefinition createForServicemoduleAdapter(
312: MetaBossBuilderTaskElement pOwnerElement,
313: String pAdapterType, Servicemodule pServicemodule,
314: BSAdapterGenerator pGenerator) throws BSException {
315: String lServicesAdapterSubdirectory = StringUtils
316: .replace(
317: pGenerator
318: .getPackageNameForServicemoduleServices(pServicemodule
319: .getRef()), ".", File.separator);
320: String lEventPublishersAdapterSubdirectory = StringUtils
321: .replace(
322: pGenerator
323: .getPackageNameForServicemoduleEventPublishers(pServicemodule
324: .getRef()), ".", File.separator);
325: // Construct compilation step
326: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
327: pOwnerElement.getOwnerTask(), "Compile " + pAdapterType
328: + " adapter for the " + pServicemodule.getRef()
329: + " servicemodule");
330: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
331: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
332: if (lCompileClasspath != null)
333: lCompiler.setAdditionalClasspath(lCompileClasspath);
334: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
335: .getGenDir());
336: lCompiler.addSourceInclude(lServicesAdapterSubdirectory
337: + File.separator + "*.java");
338: lCompiler.addSourceInclude(lEventPublishersAdapterSubdirectory
339: + File.separator + "*.java");
340: return lCompiler;
341: }
342:
343: // Returns Java compiler definition used to compile data dictionary adapter pieces
344: public static JavaCompilerInvocationDefinition createForDataDictionaryAdapter(
345: MetaBossBuilderTaskElement pOwnerElement,
346: String pAdapterType, DataDictionary pDataDictionary,
347: BSAdapterGenerator pGenerator) throws BSException {
348: String lAdapterSubdirectory = StringUtils.replace(pGenerator
349: .getPackageNameForDataDictionary(pDataDictionary
350: .getRef()), ".", File.separator);
351: // Construct compilation step
352: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
353: pOwnerElement.getOwnerTask(), "Compile " + pAdapterType
354: + " adapter for the "
355: + pDataDictionary.getRef() + " data dictionary");
356: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
357: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
358: if (lCompileClasspath != null)
359: lCompiler.setAdditionalClasspath(lCompileClasspath);
360: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
361: .getGenDir());
362: lCompiler.addSourceInclude(lAdapterSubdirectory
363: + File.separator + "*.java");
364: lCompiler.addSourceInclude(lAdapterSubdirectory
365: + File.separator + "**" + File.separator + "*.java");
366: return lCompiler;
367: }
368:
369: // Returns Java compiler definition used to compile service proxy pieces
370: public static JavaCompilerInvocationDefinition createForServiceProxy(
371: MetaBossBuilderTaskElement pOwnerElement,
372: String pProxyType, Service pService,
373: BSServiceProxyGenerator pGenerator) throws BSException {
374: String lProxySubdirectory = StringUtils.replace(pGenerator
375: .getPackageNameForService(pService.getRef()), ".",
376: File.separator);
377: // Construct compilation step
378: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
379: pOwnerElement.getOwnerTask(), "Compile " + pProxyType
380: + " proxy for the " + pService.getRef()
381: + " service");
382: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
383: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
384: if (lCompileClasspath != null)
385: lCompiler.setAdditionalClasspath(lCompileClasspath);
386: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
387: .getGenDir());
388: lCompiler.addSourceInclude(lProxySubdirectory + File.separator
389: + "*.java");
390: return lCompiler;
391: }
392:
393: // Returns Java compiler definition used to compile servicemodule proxy pieces
394: public static JavaCompilerInvocationDefinition createForServicemoduleProxy(
395: MetaBossBuilderTaskElement pOwnerElement,
396: String pProxyType, Servicemodule pServicemodule,
397: BSServiceProxyGenerator pGenerator) throws BSException {
398: String lProxySubdirectory = StringUtils.replace(
399: pGenerator
400: .getPackageNameForServicemodule(pServicemodule
401: .getRef()), ".", File.separator);
402: // Construct compilation step
403: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
404: pOwnerElement.getOwnerTask(), "Compile " + pProxyType
405: + " proxy for the " + pServicemodule.getRef()
406: + " servicemodule");
407: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
408: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
409: if (lCompileClasspath != null)
410: lCompiler.setAdditionalClasspath(lCompileClasspath);
411: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
412: .getGenDir());
413: lCompiler.addSourceInclude(lProxySubdirectory + File.separator
414: + "*.java");
415: return lCompiler;
416: }
417:
418: // Returns Java compiler definition used to compile domain interfaces
419: public static JavaCompilerInvocationDefinition createForDomainInterfaces(
420: MetaBossBuilderTaskElement pOwnerElement, Domain pDomain)
421: throws BSException {
422: STDomainStylesheet lDomainStylesheet = CodeGenerationStylesheetAccessor
423: .getDomainStylesheet(pDomain);
424: String lDomainInterfaceSubdirectory = StringUtils.replace(
425: lDomainStylesheet.getDomainPackageName(), ".",
426: File.separator);
427: // Construct compilation step
428: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
429: pOwnerElement.getOwnerTask(),
430: "Compile business object interfaces for the "
431: + pDomain.getRef() + " domain");
432: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
433: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
434: if (lCompileClasspath != null)
435: lCompiler.setAdditionalClasspath(lCompileClasspath);
436: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
437: .getGenDir());
438: lCompiler.addSourceInclude(lDomainInterfaceSubdirectory
439: + File.separator + "*.java");
440: return lCompiler;
441: }
442:
443: // Returns Java compiler definition used to compile domain implementation
444: public static JavaCompilerInvocationDefinition createForDomainImplementation(
445: MetaBossBuilderTaskElement pOwnerElement, Domain pDomain)
446: throws BSException {
447: STDomainStylesheet lDomainStylesheet = CodeGenerationStylesheetAccessor
448: .getDomainStylesheet(pDomain);
449: String lDomainImplementationSubdirectory = StringUtils.replace(
450: lDomainStylesheet.getImplementationPackageName(), ".",
451: File.separator);
452: // Construct compilation step
453: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
454: pOwnerElement.getOwnerTask(),
455: "Compile business object implementations for the "
456: + pDomain.getRef() + " domain");
457: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
458: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
459: if (lCompileClasspath != null)
460: lCompiler.setAdditionalClasspath(lCompileClasspath);
461: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
462: .getGenDir());
463: lCompiler.addSourceInclude(lDomainImplementationSubdirectory
464: + File.separator + "*.java");
465: return lCompiler;
466: }
467:
468: // Returns Java compiler definition used to compile domain storage interfaces
469: public static JavaCompilerInvocationDefinition createForStorageInterfaces(
470: MetaBossBuilderTaskElement pOwnerElement, Domain pDomain)
471: throws BSException {
472: STDomainStylesheet lDomainStylesheet = CodeGenerationStylesheetAccessor
473: .getDomainStylesheet(pDomain);
474: String lStorageInterfaceSubdirectory = StringUtils.replace(
475: lDomainStylesheet.getStoragePackageName(), ".",
476: File.separator);
477: // Construct compilation step
478: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
479: pOwnerElement.getOwnerTask(),
480: "Compile storage interfaces for the "
481: + pDomain.getRef() + " domain");
482: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
483: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
484: if (lCompileClasspath != null)
485: lCompiler.setAdditionalClasspath(lCompileClasspath);
486: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
487: .getGenDir());
488: lCompiler.addSourceInclude(lStorageInterfaceSubdirectory
489: + File.separator + "*.java");
490: return lCompiler;
491: }
492:
493: // Returns Java compiler definition used to compile domain storage implementation
494: public static JavaCompilerInvocationDefinition createForStorageImplementation(
495: MetaBossBuilderTaskElement pOwnerElement,
496: DomainRelationalStorageDefinition pRelationalStorageDefinition,
497: BSStorageImplementationGenerator pStorageImplementationGenerator)
498: throws BSException {
499: String lStorageInterfaceSubdirectory = StringUtils
500: .replace(
501: pStorageImplementationGenerator
502: .getImplementationPackageName(pRelationalStorageDefinition
503: .getRef()), ".", File.separator);
504: // Construct compilation step
505: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
506: pOwnerElement.getOwnerTask(),
507: "Compile storage implementation for the "
508: + pRelationalStorageDefinition.getRef()
509: + " storage");
510: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
511: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
512: if (lCompileClasspath != null)
513: lCompiler.setAdditionalClasspath(lCompileClasspath);
514: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
515: .getGenDir());
516: lCompiler.addSourceInclude(lStorageInterfaceSubdirectory
517: + File.separator + "**" + File.separator + "*.java");
518: return lCompiler;
519: }
520:
521: // Returns Java compiler definition used to compile domain interfaces
522: public static JavaCompilerInvocationDefinition createForDomainSupportImplementation(
523: MetaBossBuilderTaskElement pOwnerElement,
524: Domain pDomain,
525: BSDomainSupportServicesImplementationGenerator pServiceImplementationGenerator)
526: throws BSException {
527: String lImplementationPackage = pServiceImplementationGenerator
528: .getImplementationPackageName(pDomain.getRef());
529: String lImplementationSubdirectory = StringUtils.replace(
530: lImplementationPackage, ".", File.separator);
531: // Construct compilation step
532: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
533: pOwnerElement.getOwnerTask(),
534: "Compile domain support service implementation for the "
535: + pDomain.getRef() + " domain");
536: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
537: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
538: if (lCompileClasspath != null)
539: lCompiler.setAdditionalClasspath(lCompileClasspath);
540: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
541: .getGenDir());
542: lCompiler.addSourceInclude(lImplementationSubdirectory
543: + File.separator + "*.java");
544: return lCompiler;
545: }
546:
547: // Returns Java compiler definition used to compile generated servcie implementations
548: public static JavaCompilerInvocationDefinition createForGeneratedServiceImplementation(
549: MetaBossBuilderTaskElement pOwnerElement,
550: String pImplementationType,
551: Service pService,
552: BSServiceImplementationGenerator pServiceImplementationGenerator)
553: throws BSException {
554: String lImplementationPackage = pServiceImplementationGenerator
555: .getPackageNameForService(pService.getRef());
556: String lImplementationSubdirectory = StringUtils.replace(
557: lImplementationPackage, ".", File.separator);
558: // Construct compilation step
559: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
560: pOwnerElement.getOwnerTask(), "Compile "
561: + pImplementationType
562: + " implementation for the "
563: + pService.getRef() + " service");
564: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
565: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
566: if (lCompileClasspath != null)
567: lCompiler.setAdditionalClasspath(lCompileClasspath);
568: lCompiler.setSourceRootDir(pOwnerElement.getOwnerTask()
569: .getGenDir());
570: lCompiler.addSourceInclude(lImplementationSubdirectory
571: + File.separator + "*.java");
572: return lCompiler;
573: }
574:
575: // Returns Java compiler definition used to compile generated servcie implementations
576: public static JavaCompilerInvocationDefinition createForAbsoluteSourceDirectory(
577: MetaBossBuilderTaskElement pOwnerElement,
578: File pAbsoluteSourceDirectory) throws BSException {
579: // Found source for the specified servicemodule. Include compilation step
580: JavaCompilerInvocationDefinition lCompiler = new JavaCompilerInvocationDefinition(
581: pOwnerElement.getOwnerTask(), "Compile source in "
582: + pAbsoluteSourceDirectory.getAbsolutePath()
583: + " directory");
584: lCompiler.setClasspathName("MetaBossModuleCompileClasspath");
585: Path lCompileClasspath = pOwnerElement.getCompileClasspath();
586: if (lCompileClasspath != null)
587: lCompiler.setAdditionalClasspath(lCompileClasspath);
588: lCompiler.setSourceRootDir(pAbsoluteSourceDirectory);
589: lCompiler.addSourceInclude("**" + File.separator + "*.java");
590: return lCompiler;
591: }
592: }
|