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.services.codegenerationstylesheet.cachedfacadeimpl;
016:
017: import java.util.Map;
018:
019: import javax.naming.Context;
020: import javax.naming.InitialContext;
021:
022: import org.apache.commons.logging.Log;
023: import org.apache.commons.logging.LogFactory;
024:
025: import com.metaboss.enterprise.bs.BSException;
026: import com.metaboss.enterprise.bs.BSNamingAndDirectoryServiceInvocationException;
027: import com.metaboss.sdlctools.models.ModelRepository;
028: import com.metaboss.sdlctools.services.codegenerationstylesheet.BSCodeGenerationStylesheet;
029:
030: // The implementation which wraps around another one and caches its output
031: public class BSCodeGenerationStylesheetImpl implements
032: BSCodeGenerationStylesheet {
033: // Commons Logging instance.
034: private static final Log sLogger = LogFactory
035: .getLog(BSCodeGenerationStylesheetImpl.class);
036:
037: // This is the model repository we will use
038: private ModelRepository mModelRepository = null;
039: private Object mModelRepositoryCreationSemaphore = new Object();
040: // This is the stylesheet service we use ourselves. It can not be initialised in
041: // constructor because of possible circular creation and stack overflow
042: private BSCodeGenerationStylesheet mStylesheetService = null; // The styleshet service we use ourselves
043: private Object mStylesheetServiceCreationSemaphore = new Object();
044: private Map mCache = null;
045:
046: public BSCodeGenerationStylesheetImpl(Map pCache) {
047: mCache = pCache;
048: }
049:
050: /* Returns the stylesheet which describes names pertained to the Enterprise */
051: public BSCodeGenerationStylesheet.STGetEnterpriseStylesheetResult getEnterpriseStylesheet(
052: BSCodeGenerationStylesheet.STGetEnterpriseStylesheetInput pInput)
053: throws BSException {
054: try {
055: // Cache key needs to take the model name into account
056: String lCacheKey = getModelRepository()
057: .getDefaultModelName()
058: + ".Enterprise." + pInput.getEnterpriseName();
059: BSCodeGenerationStylesheet.STGetEnterpriseStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetEnterpriseStylesheetResult) mCache
060: .get(lCacheKey);
061: if (lResult == null)
062: mCache.put(lCacheKey, lResult = getStylesheetService()
063: .getEnterpriseStylesheet(pInput));
064: return lResult;
065: } catch (com.metaboss.enterprise.bo.BOException e) {
066: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
067: "Caught error while generating Enteprise stylesheet. Enteprise Name: "
068: + pInput.getEnterpriseName(), e);
069: }
070: }
071:
072: /* Returns the stylesheet which describes names pertained to the DesignLibrary */
073: public BSCodeGenerationStylesheet.STGetDesignLibraryStylesheetResult getDesignLibraryStylesheet(
074: BSCodeGenerationStylesheet.STGetDesignLibraryStylesheetInput pInput)
075: throws BSException {
076: try {
077: // Cache key needs to take the model name into account
078: String lCacheKey = getModelRepository()
079: .getDefaultModelName()
080: + ".DesignLibrary"
081: + (pInput.getDesignLibraryName() != null ? ("." + pInput
082: .getDesignLibraryName())
083: : "");
084: BSCodeGenerationStylesheet.STGetDesignLibraryStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetDesignLibraryStylesheetResult) mCache
085: .get(lCacheKey);
086: if (lResult == null)
087: mCache.put(lCacheKey, lResult = getStylesheetService()
088: .getDesignLibraryStylesheet(pInput));
089: return lResult;
090: } catch (com.metaboss.enterprise.bo.BOException e) {
091: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
092: "Caught error while generating DesignLibrary stylesheet.",
093: e);
094: }
095: }
096:
097: /* Returns the stylesheet which describes names pertained to the servicemodule */
098: public BSCodeGenerationStylesheet.STGetServicemoduleStylesheetResult getServicemoduleStylesheet(
099: BSCodeGenerationStylesheet.STGetServicemoduleStylesheetInput pInput)
100: throws BSException {
101: try {
102: // Cache key needs to take the model name into account
103: String lCacheKey = getModelRepository()
104: .getDefaultModelName()
105: + ".Servicemodule." + pInput.getServicemoduleRef();
106: BSCodeGenerationStylesheet.STGetServicemoduleStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetServicemoduleStylesheetResult) mCache
107: .get(lCacheKey);
108: if (lResult == null)
109: mCache.put(lCacheKey, lResult = getStylesheetService()
110: .getServicemoduleStylesheet(pInput));
111: return lResult;
112: } catch (com.metaboss.enterprise.bo.BOException e) {
113: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
114: "Caught error while generating Servicemodule stylesheet. ServicemoduleRef: "
115: + pInput.getServicemoduleRef(), e);
116: }
117: }
118:
119: /* Returns the stylesheet which describes names pertained to the System */
120: public BSCodeGenerationStylesheet.STGetSystemStylesheetResult getSystemStylesheet(
121: BSCodeGenerationStylesheet.STGetSystemStylesheetInput pInput)
122: throws BSException {
123: try {
124: // Cache key needs to take the model name into account
125: String lCacheKey = getModelRepository()
126: .getDefaultModelName()
127: + ".System." + pInput.getSystemRef();
128: BSCodeGenerationStylesheet.STGetSystemStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetSystemStylesheetResult) mCache
129: .get(lCacheKey);
130: if (lResult == null)
131: mCache.put(lCacheKey, lResult = getStylesheetService()
132: .getSystemStylesheet(pInput));
133: return lResult;
134: } catch (com.metaboss.enterprise.bo.BOException e) {
135: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
136: "Caught error while generating System stylesheet. SystemRef: "
137: + pInput.getSystemRef(), e);
138: }
139: }
140:
141: /* Returns the stylesheet which describes names pertained to the TypeTemplate */
142: public BSCodeGenerationStylesheet.STGetTypeTemplateStylesheetResult getTypeTemplateStylesheet(
143: BSCodeGenerationStylesheet.STGetTypeTemplateStylesheetInput pInput)
144: throws BSException {
145: try {
146: // Cache key needs to take the model name into account
147: String lCacheKey = getModelRepository()
148: .getDefaultModelName()
149: + ".TypeTemplate." + pInput.getTypeTemplateRef();
150: BSCodeGenerationStylesheet.STGetTypeTemplateStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetTypeTemplateStylesheetResult) mCache
151: .get(lCacheKey);
152: if (lResult == null)
153: mCache.put(lCacheKey, lResult = getStylesheetService()
154: .getTypeTemplateStylesheet(pInput));
155: return lResult;
156: } catch (com.metaboss.enterprise.bo.BOException e) {
157: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
158: "Caught error while generating TypeTemplate stylesheet. TypeTemplateRef: "
159: + pInput.getTypeTemplateRef(), e);
160: }
161: }
162:
163: /* Returns the stylesheet which describes names pertained to the Namespace */
164: public BSCodeGenerationStylesheet.STGetNamespaceStylesheetResult getNamespaceStylesheet(
165: BSCodeGenerationStylesheet.STGetNamespaceStylesheetInput pInput)
166: throws BSException {
167: try {
168: // Cache key needs to take the model name into account
169: String lCacheKey = getModelRepository()
170: .getDefaultModelName()
171: + ".Namespace." + pInput.getNamespaceRef();
172: BSCodeGenerationStylesheet.STGetNamespaceStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetNamespaceStylesheetResult) mCache
173: .get(lCacheKey);
174: if (lResult == null)
175: mCache.put(lCacheKey, lResult = getStylesheetService()
176: .getNamespaceStylesheet(pInput));
177: return lResult;
178: } catch (com.metaboss.enterprise.bo.BOException e) {
179: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
180: "Caught error while generating Namespace stylesheet. NamespaceRef: "
181: + pInput.getNamespaceRef(), e);
182: }
183: }
184:
185: /* Returns the stylesheet which describes names pertained to the DataDictionary */
186: public BSCodeGenerationStylesheet.STGetDataDictionaryStylesheetResult getDataDictionaryStylesheet(
187: BSCodeGenerationStylesheet.STGetDataDictionaryStylesheetInput pInput)
188: throws BSException {
189: try {
190: // Cache key needs to take the model name into account
191: String lCacheKey = getModelRepository()
192: .getDefaultModelName()
193: + ".DataDictionary."
194: + pInput.getDataDictionaryRef();
195: BSCodeGenerationStylesheet.STGetDataDictionaryStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetDataDictionaryStylesheetResult) mCache
196: .get(lCacheKey);
197: if (lResult == null)
198: mCache.put(lCacheKey, lResult = getStylesheetService()
199: .getDataDictionaryStylesheet(pInput));
200: return lResult;
201: } catch (com.metaboss.enterprise.bo.BOException e) {
202: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
203: "Caught error while generating DataDictionary stylesheet. DataDictionaryRef: "
204: + pInput.getDataDictionaryRef(), e);
205: }
206: }
207:
208: /* Returns the stylesheet which describes names pertained to the service */
209: public BSCodeGenerationStylesheet.STGetServiceStylesheetResult getServiceStylesheet(
210: BSCodeGenerationStylesheet.STGetServiceStylesheetInput pInput)
211: throws BSException {
212: try {
213: // Cache key needs to take the model name into account
214: String lCacheKey = getModelRepository()
215: .getDefaultModelName()
216: + ".Service." + pInput.getServiceRef();
217: BSCodeGenerationStylesheet.STGetServiceStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetServiceStylesheetResult) mCache
218: .get(lCacheKey);
219: if (lResult == null)
220: mCache.put(lCacheKey, lResult = getStylesheetService()
221: .getServiceStylesheet(pInput));
222: return lResult;
223: } catch (com.metaboss.enterprise.bo.BOException e) {
224: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
225: "Caught error while generating Service stylesheet. ServiceRef: "
226: + pInput.getServiceRef(), e);
227: }
228: }
229:
230: /* Returns the stylesheet which describes names pertained to the event subscription */
231: public BSCodeGenerationStylesheet.STGetEventSubscriptionStylesheetResult getEventSubscriptionStylesheet(
232: BSCodeGenerationStylesheet.STGetEventSubscriptionStylesheetInput pInput)
233: throws BSException {
234: try {
235: // Cache key needs to take the model name into account
236: String lCacheKey = getModelRepository()
237: .getDefaultModelName()
238: + ".EventSubscription."
239: + pInput.getEventSubscriptionRef();
240: BSCodeGenerationStylesheet.STGetEventSubscriptionStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetEventSubscriptionStylesheetResult) mCache
241: .get(lCacheKey);
242: if (lResult == null)
243: mCache.put(lCacheKey, lResult = getStylesheetService()
244: .getEventSubscriptionStylesheet(pInput));
245: return lResult;
246: } catch (com.metaboss.enterprise.bo.BOException e) {
247: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
248: "Caught error while generating EventSubscription stylesheet. EventSubscriptionRef: "
249: + pInput.getEventSubscriptionRef(), e);
250: }
251: }
252:
253: /* Returns the stylesheet which describes names pertained to the structure */
254: public BSCodeGenerationStylesheet.STGetStructureStylesheetResult getStructureStylesheet(
255: BSCodeGenerationStylesheet.STGetStructureStylesheetInput pInput)
256: throws BSException {
257: try {
258: // Cache key needs to take the model name into account
259: String lCacheKey = getModelRepository()
260: .getDefaultModelName()
261: + ".Structure." + pInput.getStructureRef();
262: BSCodeGenerationStylesheet.STGetStructureStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetStructureStylesheetResult) mCache
263: .get(lCacheKey);
264: if (lResult == null)
265: mCache.put(lCacheKey, lResult = getStylesheetService()
266: .getStructureStylesheet(pInput));
267: return lResult;
268: } catch (com.metaboss.enterprise.bo.BOException e) {
269: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
270: "Caught error while generating Structure stylesheet. StructureRef: "
271: + pInput.getStructureRef(), e);
272: }
273: }
274:
275: /* Returns the stylesheet which describes names pertained to the operation input field */
276: public BSCodeGenerationStylesheet.STGetSelectorInputFieldStylesheetResult getSelectorInputFieldStylesheet(
277: BSCodeGenerationStylesheet.STGetSelectorInputFieldStylesheetInput pInput)
278: throws BSException {
279: try {
280: // Cache key needs to take the model name into account
281: String lCacheKey = getModelRepository()
282: .getDefaultModelName()
283: + ".SelectorInputField."
284: + pInput.getSelectorInputFieldRef();
285: BSCodeGenerationStylesheet.STGetSelectorInputFieldStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetSelectorInputFieldStylesheetResult) mCache
286: .get(lCacheKey);
287: if (lResult == null)
288: mCache.put(lCacheKey, lResult = getStylesheetService()
289: .getSelectorInputFieldStylesheet(pInput));
290: return lResult;
291: } catch (com.metaboss.enterprise.bo.BOException e) {
292: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
293: "Caught error while generating SelectorInputField stylesheet. SelectorInputFieldRef: "
294: + pInput.getSelectorInputFieldRef(), e);
295: }
296: }
297:
298: /* Returns the stylesheet which describes names pertained to the operation */
299: public BSCodeGenerationStylesheet.STGetOperationStylesheetResult getOperationStylesheet(
300: BSCodeGenerationStylesheet.STGetOperationStylesheetInput pInput)
301: throws BSException {
302: try {
303: // Cache key needs to take the model name into account
304: String lCacheKey = getModelRepository()
305: .getDefaultModelName()
306: + ".Operation." + pInput.getOperationRef();
307: BSCodeGenerationStylesheet.STGetOperationStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetOperationStylesheetResult) mCache
308: .get(lCacheKey);
309: if (lResult == null)
310: mCache.put(lCacheKey, lResult = getStylesheetService()
311: .getOperationStylesheet(pInput));
312: return lResult;
313: } catch (com.metaboss.enterprise.bo.BOException e) {
314: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
315: "Caught error while generating Operation stylesheet. OperationRef: "
316: + pInput.getOperationRef(), e);
317: }
318: }
319:
320: /* Returns the stylesheet which describes names pertained to the operation input field */
321: public BSCodeGenerationStylesheet.STGetOperationInputFieldStylesheetResult getOperationInputFieldStylesheet(
322: BSCodeGenerationStylesheet.STGetOperationInputFieldStylesheetInput pInput)
323: throws BSException {
324: try {
325: // Cache key needs to take the model name into account
326: String lCacheKey = getModelRepository()
327: .getDefaultModelName()
328: + ".OperationInputField."
329: + pInput.getOperationInputFieldRef();
330: BSCodeGenerationStylesheet.STGetOperationInputFieldStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetOperationInputFieldStylesheetResult) mCache
331: .get(lCacheKey);
332: if (lResult == null)
333: mCache.put(lCacheKey, lResult = getStylesheetService()
334: .getOperationInputFieldStylesheet(pInput));
335: return lResult;
336: } catch (com.metaboss.enterprise.bo.BOException e) {
337: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
338: "Caught error while generating OperationInputField stylesheet. OperationInputFieldRef: "
339: + pInput.getOperationInputFieldRef(), e);
340: }
341: }
342:
343: /* Returns the stylesheet which describes names pertained to the operation result field */
344: public BSCodeGenerationStylesheet.STGetOperationOutputFieldStylesheetResult getOperationOutputFieldStylesheet(
345: BSCodeGenerationStylesheet.STGetOperationOutputFieldStylesheetInput pInput)
346: throws BSException {
347: try {
348: // Cache key needs to take the model name into account
349: String lCacheKey = getModelRepository()
350: .getDefaultModelName()
351: + ".OperationOutputField."
352: + pInput.getOperationOutputFieldRef();
353: BSCodeGenerationStylesheet.STGetOperationOutputFieldStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetOperationOutputFieldStylesheetResult) mCache
354: .get(lCacheKey);
355: if (lResult == null)
356: mCache.put(lCacheKey, lResult = getStylesheetService()
357: .getOperationOutputFieldStylesheet(pInput));
358: return lResult;
359: } catch (com.metaboss.enterprise.bo.BOException e) {
360: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
361: "Caught error while generating OperationOutputField stylesheet. OperationOutputFieldRef: "
362: + pInput.getOperationOutputFieldRef(), e);
363: }
364: }
365:
366: /* Returns the stylesheet which describes names pertained to the operation result message */
367: public BSCodeGenerationStylesheet.STGetOperationOutputMessageStylesheetResult getOperationOutputMessageStylesheet(
368: BSCodeGenerationStylesheet.STGetOperationOutputMessageStylesheetInput pInput)
369: throws BSException {
370: try {
371: // Cache key needs to take the model name into account
372: String lCacheKey = getModelRepository()
373: .getDefaultModelName()
374: + ".OperationOutputMessage."
375: + pInput.getOperationOutputMessageRef();
376: BSCodeGenerationStylesheet.STGetOperationOutputMessageStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetOperationOutputMessageStylesheetResult) mCache
377: .get(lCacheKey);
378: if (lResult == null)
379: mCache.put(lCacheKey, lResult = getStylesheetService()
380: .getOperationOutputMessageStylesheet(pInput));
381: return lResult;
382: } catch (com.metaboss.enterprise.bo.BOException e) {
383: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
384: "Caught error while generating OperationOutputMessage stylesheet. OperationOutputMessageRef: "
385: + pInput.getOperationOutputMessageRef(), e);
386: }
387: }
388:
389: /* Returns the stylesheet which describes names pertained to the entity */
390: public BSCodeGenerationStylesheet.STGetEntityStylesheetResult getEntityStylesheet(
391: BSCodeGenerationStylesheet.STGetEntityStylesheetInput pInput)
392: throws BSException {
393: try {
394: // Cache key needs to take the model name into account
395: String lCacheKey = getModelRepository()
396: .getDefaultModelName()
397: + ".Entity." + pInput.getEntityRef();
398: BSCodeGenerationStylesheet.STGetEntityStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetEntityStylesheetResult) mCache
399: .get(lCacheKey);
400: if (lResult == null)
401: mCache.put(lCacheKey, lResult = getStylesheetService()
402: .getEntityStylesheet(pInput));
403: return lResult;
404: } catch (com.metaboss.enterprise.bo.BOException e) {
405: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
406: "Caught error while generating Entity stylesheet. EntityRef: "
407: + pInput.getEntityRef(), e);
408: }
409: }
410:
411: /* Returns the stylesheet which describes names pertained to the domain */
412: public BSCodeGenerationStylesheet.STGetDomainStylesheetResult getDomainStylesheet(
413: BSCodeGenerationStylesheet.STGetDomainStylesheetInput pInput)
414: throws BSException {
415: try {
416: // Cache key needs to take the model name into account
417: String lCacheKey = getModelRepository()
418: .getDefaultModelName()
419: + ".Domain." + pInput.getDomainRef();
420: BSCodeGenerationStylesheet.STGetDomainStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetDomainStylesheetResult) mCache
421: .get(lCacheKey);
422: if (lResult == null)
423: mCache.put(lCacheKey, lResult = getStylesheetService()
424: .getDomainStylesheet(pInput));
425: return lResult;
426: } catch (com.metaboss.enterprise.bo.BOException e) {
427: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
428: "Caught error while generating Domain stylesheet. DomainRef: "
429: + pInput.getDomainRef(), e);
430: }
431: }
432:
433: /* Returns the stylesheet which describes names pertained to the datatype */
434: public BSCodeGenerationStylesheet.STGetDatatypeStylesheetResult getDatatypeStylesheet(
435: BSCodeGenerationStylesheet.STGetDatatypeStylesheetInput pInput)
436: throws BSException {
437: try {
438: // Cache key needs to take the model name into account
439: String lCacheKey = getModelRepository()
440: .getDefaultModelName()
441: + ".Datatype." + pInput.getDatatypeRef();
442: BSCodeGenerationStylesheet.STGetDatatypeStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetDatatypeStylesheetResult) mCache
443: .get(lCacheKey);
444: if (lResult == null)
445: mCache.put(lCacheKey, lResult = getStylesheetService()
446: .getDatatypeStylesheet(pInput));
447: return lResult;
448: } catch (com.metaboss.enterprise.bo.BOException e) {
449: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
450: "Caught error while generating Datatype stylesheet. DatatypeRef: "
451: + pInput.getDatatypeRef(), e);
452: }
453: }
454:
455: /* Returns the stylesheet which describes names pertained to the datatype translation */
456: public BSCodeGenerationStylesheet.STGetDatatypeTranslationStylesheetResult getDatatypeTranslationStylesheet(
457: BSCodeGenerationStylesheet.STGetDatatypeTranslationStylesheetInput pInput)
458: throws BSException {
459: try {
460: // Cache key needs to take the model name into account
461: String lCacheKey = getModelRepository()
462: .getDefaultModelName()
463: + ".DatatypeTranslation." + pInput.getDatatypeRef();
464: BSCodeGenerationStylesheet.STGetDatatypeTranslationStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetDatatypeTranslationStylesheetResult) mCache
465: .get(lCacheKey);
466: if (lResult == null)
467: mCache.put(lCacheKey, lResult = getStylesheetService()
468: .getDatatypeTranslationStylesheet(pInput));
469: return lResult;
470: } catch (com.metaboss.enterprise.bo.BOException e) {
471: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
472: "Caught error while generating DatatypeTranslation stylesheet. DatatypeRef: "
473: + pInput.getDatatypeRef(), e);
474: }
475: }
476:
477: /* Returns the stylesheet which describes names pertained to the structure */
478: public BSCodeGenerationStylesheet.STGetDocumentationStylesheetResult getDocumentationStylesheet(
479: BSCodeGenerationStylesheet.STGetDocumentationStylesheetInput pInput)
480: throws BSException {
481: try {
482: // Cache key needs to take the model name into account
483: String lCacheKey = getModelRepository()
484: .getDefaultModelName()
485: + ".Documentation";
486: BSCodeGenerationStylesheet.STGetDocumentationStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetDocumentationStylesheetResult) mCache
487: .get(lCacheKey);
488: if (lResult == null)
489: mCache.put(lCacheKey, lResult = getStylesheetService()
490: .getDocumentationStylesheet(pInput));
491: return lResult;
492: } catch (com.metaboss.enterprise.bo.BOException e) {
493: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
494: "Caught error while generating Documentation stylesheet.",
495: e);
496: }
497: }
498:
499: /* Returns the stylesheet which describes names pertained to the message */
500: public BSCodeGenerationStylesheet.STGetMessageStylesheetResult getMessageStylesheet(
501: BSCodeGenerationStylesheet.STGetMessageStylesheetInput pInput)
502: throws BSException {
503: try {
504: // Cache key needs to take the model name into account
505: String lCacheKey = getModelRepository()
506: .getDefaultModelName()
507: + ".Message." + pInput.getMessageRef();
508: BSCodeGenerationStylesheet.STGetMessageStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetMessageStylesheetResult) mCache
509: .get(lCacheKey);
510: if (lResult == null)
511: mCache.put(lCacheKey, lResult = getStylesheetService()
512: .getMessageStylesheet(pInput));
513: return lResult;
514: } catch (com.metaboss.enterprise.bo.BOException e) {
515: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
516: "Caught error while generating Message stylesheet. MessageRef: "
517: + pInput.getMessageRef(), e);
518: }
519: }
520:
521: /* Returns the stylesheet which describes names pertained to the association */
522: public BSCodeGenerationStylesheet.STGetAssociationStylesheetResult getAssociationStylesheet(
523: BSCodeGenerationStylesheet.STGetAssociationStylesheetInput pInput)
524: throws BSException {
525: try {
526: // Cache key needs to take the model name into account
527: String lCacheKey = getModelRepository()
528: .getDefaultModelName()
529: + ".Association." + pInput.getAssociationRef();
530: BSCodeGenerationStylesheet.STGetAssociationStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetAssociationStylesheetResult) mCache
531: .get(lCacheKey);
532: if (lResult == null)
533: mCache.put(lCacheKey, lResult = getStylesheetService()
534: .getAssociationStylesheet(pInput));
535: return lResult;
536: } catch (com.metaboss.enterprise.bo.BOException e) {
537: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
538: "Caught error while generating Association stylesheet. AssociationRef: "
539: + pInput.getAssociationRef(), e);
540: }
541: }
542:
543: /* Returns the stylesheet which describes names pertained to the association role */
544: public BSCodeGenerationStylesheet.STGetAssociationRoleStylesheetResult getAssociationRoleStylesheet(
545: BSCodeGenerationStylesheet.STGetAssociationRoleStylesheetInput pInput)
546: throws BSException {
547: try {
548: // Cache key needs to take the model name into account
549: String lCacheKey = getModelRepository()
550: .getDefaultModelName()
551: + ".AssociationRole."
552: + pInput.getAssociationRoleRef();
553: BSCodeGenerationStylesheet.STGetAssociationRoleStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetAssociationRoleStylesheetResult) mCache
554: .get(lCacheKey);
555: if (lResult == null)
556: mCache.put(lCacheKey, lResult = getStylesheetService()
557: .getAssociationRoleStylesheet(pInput));
558: return lResult;
559: } catch (com.metaboss.enterprise.bo.BOException e) {
560: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
561: "Caught error while generating AssociationRole stylesheet. AssociationRoleRef: "
562: + pInput.getAssociationRoleRef(), e);
563: }
564: }
565:
566: /* Returns the stylesheet which describes names pertained to the report */
567: public BSCodeGenerationStylesheet.STGetReportStylesheetResult getReportStylesheet(
568: BSCodeGenerationStylesheet.STGetReportStylesheetInput pInput)
569: throws BSException {
570: try {
571: // Cache key needs to take the model name into account
572: String lCacheKey = getModelRepository()
573: .getDefaultModelName()
574: + ".Report." + pInput.getReportRef();
575: BSCodeGenerationStylesheet.STGetReportStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetReportStylesheetResult) mCache
576: .get(lCacheKey);
577: if (lResult == null)
578: mCache.put(lCacheKey, lResult = getStylesheetService()
579: .getReportStylesheet(pInput));
580: return lResult;
581: } catch (com.metaboss.enterprise.bo.BOException e) {
582: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
583: "Caught error while generating Report stylesheet. ReportRef: "
584: + pInput.getReportRef(), e);
585: }
586: }
587:
588: /* Returns the stylesheet which describes names pertained to the report output element */
589: public BSCodeGenerationStylesheet.STGetReportOutputElementStylesheetResult getReportOutputElementStylesheet(
590: BSCodeGenerationStylesheet.STGetReportOutputElementStylesheetInput pInput)
591: throws BSException {
592: try {
593: // Cache key needs to take the model name into account
594: String lCacheKey = getModelRepository()
595: .getDefaultModelName()
596: + ".ReportOutputElement."
597: + pInput.getReportOutputElementRef();
598: BSCodeGenerationStylesheet.STGetReportOutputElementStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetReportOutputElementStylesheetResult) mCache
599: .get(lCacheKey);
600: if (lResult == null)
601: mCache.put(lCacheKey, lResult = getStylesheetService()
602: .getReportOutputElementStylesheet(pInput));
603: return lResult;
604: } catch (com.metaboss.enterprise.bo.BOException e) {
605: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
606: "Caught error while generating ReportOutputElement stylesheet. ReportOutputElementRef: "
607: + pInput.getReportOutputElementRef(), e);
608: }
609: }
610:
611: /* Returns the stylesheet which describes names pertained to the attribute */
612: public BSCodeGenerationStylesheet.STGetAttributeStylesheetResult getAttributeStylesheet(
613: BSCodeGenerationStylesheet.STGetAttributeStylesheetInput pInput)
614: throws BSException {
615: try {
616: // Cache key needs to take the model name into account
617: String lCacheKey = getModelRepository()
618: .getDefaultModelName()
619: + ".Attribute." + pInput.getAttributeRef();
620: BSCodeGenerationStylesheet.STGetAttributeStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetAttributeStylesheetResult) mCache
621: .get(lCacheKey);
622: if (lResult == null)
623: mCache.put(lCacheKey, lResult = getStylesheetService()
624: .getAttributeStylesheet(pInput));
625: return lResult;
626: } catch (com.metaboss.enterprise.bo.BOException e) {
627: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
628: "Caught error while generating Attribute stylesheet. AttributeRef: "
629: + pInput.getAttributeRef(), e);
630: }
631: }
632:
633: /* Returns the stylesheet which describes names pertained to the structure field */
634: public BSCodeGenerationStylesheet.STGetStructureFieldStylesheetResult getStructureFieldStylesheet(
635: BSCodeGenerationStylesheet.STGetStructureFieldStylesheetInput pInput)
636: throws BSException {
637: try {
638: // Cache key needs to take the model name into account
639: String lCacheKey = getModelRepository()
640: .getDefaultModelName()
641: + ".StructureField."
642: + pInput.getStructureFieldRef();
643: BSCodeGenerationStylesheet.STGetStructureFieldStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetStructureFieldStylesheetResult) mCache
644: .get(lCacheKey);
645: if (lResult == null)
646: mCache.put(lCacheKey, lResult = getStylesheetService()
647: .getStructureFieldStylesheet(pInput));
648: return lResult;
649: } catch (com.metaboss.enterprise.bo.BOException e) {
650: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
651: "Caught error while generating StructureField stylesheet. StructureFieldRef: "
652: + pInput.getStructureFieldRef(), e);
653: }
654: }
655:
656: /* Returns the stylesheet which describes names pertained to the mesage field */
657: public BSCodeGenerationStylesheet.STGetMessageFieldStylesheetResult getMessageFieldStylesheet(
658: BSCodeGenerationStylesheet.STGetMessageFieldStylesheetInput pInput)
659: throws BSException {
660: try {
661: // Cache key needs to take the model name into account
662: String lCacheKey = getModelRepository()
663: .getDefaultModelName()
664: + ".MessageField." + pInput.getMessageFieldRef();
665: BSCodeGenerationStylesheet.STGetMessageFieldStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetMessageFieldStylesheetResult) mCache
666: .get(lCacheKey);
667: if (lResult == null)
668: mCache.put(lCacheKey, lResult = getStylesheetService()
669: .getMessageFieldStylesheet(pInput));
670: return lResult;
671: } catch (com.metaboss.enterprise.bo.BOException e) {
672: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
673: "Caught error while generating MessageField stylesheet. MessageFieldRef: "
674: + pInput.getMessageFieldRef(), e);
675: }
676: }
677:
678: /* Returns the stylesheet which describes names pertained to the event subscription operation */
679: public BSCodeGenerationStylesheet.STGetEventSubscriptionOperationStylesheetResult getEventSubscriptionOperationStylesheet(
680: BSCodeGenerationStylesheet.STGetEventSubscriptionOperationStylesheetInput pInput)
681: throws BSException {
682: try {
683: // Cache key needs to take the model name into account
684: String lCacheKey = getModelRepository()
685: .getDefaultModelName()
686: + ".EventSubscriptionOperation."
687: + pInput.getEventSubscriptionOperationRef();
688: BSCodeGenerationStylesheet.STGetEventSubscriptionOperationStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetEventSubscriptionOperationStylesheetResult) mCache
689: .get(lCacheKey);
690: if (lResult == null)
691: mCache
692: .put(
693: lCacheKey,
694: lResult = getStylesheetService()
695: .getEventSubscriptionOperationStylesheet(
696: pInput));
697: return lResult;
698: } catch (com.metaboss.enterprise.bo.BOException e) {
699: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
700: "Caught error while generating EventSubscriptionOperation stylesheet. EventSubscriptionOperationRef: "
701: + pInput.getEventSubscriptionOperationRef(),
702: e);
703: }
704: }
705:
706: /* Returns the stylesheet which describes names pertained to the event */
707: public BSCodeGenerationStylesheet.STGetEventStylesheetResult getEventStylesheet(
708: BSCodeGenerationStylesheet.STGetEventStylesheetInput pInput)
709: throws BSException {
710: try {
711: // Cache key needs to take the model name into account
712: String lCacheKey = getModelRepository()
713: .getDefaultModelName()
714: + ".Event." + pInput.getEventRef();
715: BSCodeGenerationStylesheet.STGetEventStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetEventStylesheetResult) mCache
716: .get(lCacheKey);
717: if (lResult == null)
718: mCache.put(lCacheKey, lResult = getStylesheetService()
719: .getEventStylesheet(pInput));
720: return lResult;
721: } catch (com.metaboss.enterprise.bo.BOException e) {
722: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
723: "Caught error while generating Event stylesheet. EventRef: "
724: + pInput.getEventRef(), e);
725: }
726: }
727:
728: /* Returns the stylesheet which describes names pertained to the event data field */
729: public BSCodeGenerationStylesheet.STGetEventDataFieldStylesheetResult getEventDataFieldStylesheet(
730: BSCodeGenerationStylesheet.STGetEventDataFieldStylesheetInput pInput)
731: throws BSException {
732: try {
733: // Cache key needs to take the model name into account
734: String lCacheKey = getModelRepository()
735: .getDefaultModelName()
736: + ".EventDataField."
737: + pInput.getEventDataFieldRef();
738: BSCodeGenerationStylesheet.STGetEventDataFieldStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetEventDataFieldStylesheetResult) mCache
739: .get(lCacheKey);
740: if (lResult == null)
741: mCache.put(lCacheKey, lResult = getStylesheetService()
742: .getEventDataFieldStylesheet(pInput));
743: return lResult;
744: } catch (com.metaboss.enterprise.bo.BOException e) {
745: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
746: "Caught error while generating EventDataField stylesheet. EventDataFieldRef: "
747: + pInput.getEventDataFieldRef(), e);
748: }
749: }
750:
751: /* Returns the stylesheet which describes names pertained to the event message field */
752: public BSCodeGenerationStylesheet.STGetEventMessageFieldStylesheetResult getEventMessageFieldStylesheet(
753: BSCodeGenerationStylesheet.STGetEventMessageFieldStylesheetInput pInput)
754: throws BSException {
755: try {
756: // Cache key needs to take the model name into account
757: String lCacheKey = getModelRepository()
758: .getDefaultModelName()
759: + ".EventMessageField."
760: + pInput.getEventMessageFieldRef();
761: BSCodeGenerationStylesheet.STGetEventMessageFieldStylesheetResult lResult = (BSCodeGenerationStylesheet.STGetEventMessageFieldStylesheetResult) mCache
762: .get(lCacheKey);
763: if (lResult == null)
764: mCache.put(lCacheKey, lResult = getStylesheetService()
765: .getEventMessageFieldStylesheet(pInput));
766: return lResult;
767: } catch (com.metaboss.enterprise.bo.BOException e) {
768: throw new com.metaboss.enterprise.bs.BSDomainObjectInvocationException(
769: "Caught error while generating EventMessageField stylesheet. EventMessageFieldRef: "
770: + pInput.getEventMessageFieldRef(), e);
771: }
772: }
773:
774: // Helper. Gets implementation stylesheet service. Looks it up in the context if necessary
775: private BSCodeGenerationStylesheet getStylesheetService()
776: throws BSException {
777: if (mStylesheetService == null) {
778: synchronized (mStylesheetServiceCreationSemaphore) {
779: if (mStylesheetService == null) {
780: try {
781: Context lContext = new InitialContext();
782: mStylesheetService = (BSCodeGenerationStylesheet) lContext
783: .lookup(BSCodeGenerationStylesheet.COMPONENT_URL);
784: } catch (javax.naming.NamingException e) {
785: throw new BSNamingAndDirectoryServiceInvocationException(
786: "Unable to access stylesheet service.",
787: e);
788: }
789: }
790: }
791: }
792: return mStylesheetService;
793: }
794:
795: // Helper. Gets model repository. Looks it up in the context if necessary
796: private ModelRepository getModelRepository() throws BSException {
797: if (mModelRepository == null) {
798: synchronized (mModelRepositoryCreationSemaphore) {
799: if (mModelRepository == null) {
800: try {
801: Context lContext = new InitialContext();
802: mModelRepository = (ModelRepository) lContext
803: .lookup(ModelRepository.COMPONENT_URL);
804: } catch (javax.naming.NamingException e) {
805: throw new BSNamingAndDirectoryServiceInvocationException(
806: "Unable to access model repository.", e);
807: }
808: }
809: }
810: }
811: return mModelRepository;
812: }
813: }
|