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.domains.storagemodel.impl;
016:
017: import javax.naming.Context;
018: import javax.naming.InitialContext;
019: import javax.naming.NamingException;
020:
021: import com.metaboss.enterprise.bo.BOException;
022: import com.metaboss.enterprise.bo.BONamingAndDirectoryServiceInvocationException;
023: import com.metaboss.enterprise.bo.BOPersistenceServiceInvocationException;
024: import com.metaboss.enterprise.ps.PSException;
025: import com.metaboss.sdlctools.domains.storagemodel.BORelationalStorageTechnology;
026: import com.metaboss.sdlctools.domains.storagemodel.BORelationalStorageTechnologyDomainStorageList;
027: import com.metaboss.sdlctools.domains.storagemodel.storage.PSRelationalStorageTechnology;
028: import com.metaboss.sdlctools.domains.storagemodel.storage.STRelationalStorageTechnology;
029: import com.metaboss.sdlctools.domains.storagemodel.storage.STStorageTechnology;
030: import com.metaboss.sdlctools.types.storagemodel.NameConversionType;
031:
032: public class BORelationalStorageTechnologyImpl extends
033: BOStorageTechnologyImpl implements
034: BORelationalStorageTechnology {
035: protected STRelationalStorageTechnology mRelationalStorageTechnologyDetails = null;
036:
037: /* Instance creator */
038: public static BORelationalStorageTechnologyImpl createInstanceForExisting(
039: BOMetaBossDomainImpl pMetaBossDomainImpl,
040: String pStorageTechnologyRef, STStorageTechnology pDetails)
041: throws BOException {
042: BORelationalStorageTechnologyImpl lImpl = new BORelationalStorageTechnologyImpl();
043: lImpl.setupInstanceForExisting(pMetaBossDomainImpl,
044: pStorageTechnologyRef, pDetails);
045: lImpl.setupForExisting();
046: return lImpl;
047: }
048:
049: /* Protect an access to this constructor */
050: protected BORelationalStorageTechnologyImpl() throws BOException {
051: }
052:
053: /* Setup instance representing an existing entity */
054: protected void setupInstanceForExisting(
055: BOMetaBossDomainImpl pMetaBossDomainImpl,
056: String pStorageTechnologyRef,
057: STStorageTechnology pStorageTechnologyDetails)
058: throws BOException {
059: // Just call super class
060: super .setupInstanceForExisting(pMetaBossDomainImpl,
061: pStorageTechnologyRef, pStorageTechnologyDetails);
062: }
063:
064: /* Retrieves all domain storage definitions for this storage technology */
065: public BORelationalStorageTechnologyDomainStorageList getRelationalDomainStorages()
066: throws BOException {
067: return BORelationalStorageTechnologyDomainStorageListImpl
068: .createInstanceForExisting(mMetaBossDomainImpl, this );
069: }
070:
071: /* Getter for the maximum length of the table name */
072: public int getMaxTableNameLength() throws BOException {
073: loadDetailsIfNecessary();
074: return mRelationalStorageTechnologyDetails.MaxTableNameLength;
075: }
076:
077: /* Getter for the name conversion algorithm type for the association table */
078: public NameConversionType getAssociationTableNameConversionType()
079: throws BOException {
080: loadDetailsIfNecessary();
081: return mRelationalStorageTechnologyDetails.AssociationTableNameConversionType;
082: }
083:
084: /* Getter for the association table prefix. It gets prepended to the association name from the model after name conversion argorithm is invoked */
085: public String getAssociationTableNamePrefix() throws BOException {
086: loadDetailsIfNecessary();
087: return mRelationalStorageTechnologyDetails.AssociationTableNamePrefix;
088: }
089:
090: /* Getter for the association table suffix. It gets appended to the association name from the model after name conversion argorithm is invoked */
091: public String getAssociationTableNameSuffix() throws BOException {
092: loadDetailsIfNecessary();
093: return mRelationalStorageTechnologyDetails.AssociationTableNameSuffix;
094: }
095:
096: /* Getter for the name conversion algorithm type for the entity table */
097: public NameConversionType getEntityTableNameConversionType()
098: throws BOException {
099: loadDetailsIfNecessary();
100: return mRelationalStorageTechnologyDetails.EntityTableNameConversionType;
101: }
102:
103: /* Getter for the entity table prefix. It gets prepended to the association name from the model after name conversion argorithm is invoked */
104: public String getEntityTableNamePrefix() throws BOException {
105: loadDetailsIfNecessary();
106: return mRelationalStorageTechnologyDetails.EntityTableNamePrefix;
107: }
108:
109: /* Getter for the entity table suffix. It gets appended to the association name from the model after name conversion argorithm is invoked */
110: public String getEntityTableNameSuffix() throws BOException {
111: loadDetailsIfNecessary();
112: return mRelationalStorageTechnologyDetails.EntityTableNameSuffix;
113: }
114:
115: /* Getter for the name conversion algorithm type for the reference table */
116: public NameConversionType getReferenceTableNameConversionType()
117: throws BOException {
118: loadDetailsIfNecessary();
119: return mRelationalStorageTechnologyDetails.ReferenceTableNameConversionType;
120: }
121:
122: /* Getter for the reference table prefix. It gets prepended to the association name from the model after name conversion argorithm is invoked */
123: public String getReferenceTableNamePrefix() throws BOException {
124: loadDetailsIfNecessary();
125: return mRelationalStorageTechnologyDetails.ReferenceTableNamePrefix;
126: }
127:
128: /* Getter for the reference table suffix. It gets appended to the association name from the model after name conversion argorithm is invoked */
129: public String getReferenceTableNameSuffix() throws BOException {
130: loadDetailsIfNecessary();
131: return mRelationalStorageTechnologyDetails.ReferenceTableNameSuffix;
132: }
133:
134: /* Getter for the maximum length of the column name */
135: public int getMaxColumnNameLength() throws BOException {
136: loadDetailsIfNecessary();
137: return mRelationalStorageTechnologyDetails.MaxColumnNameLength;
138: }
139:
140: /* Getter for the name conversion algorithm type for the attribute column */
141: public NameConversionType getAttributeColumnNameConversionType()
142: throws BOException {
143: loadDetailsIfNecessary();
144: return mRelationalStorageTechnologyDetails.AttributeColumnNameConversionType;
145: }
146:
147: /* Getter for the attribute column name prefix. It gets prepended to the attribute name from the model after name conversion argorithm is invoked */
148: public String getAttributeColumnNamePrefix() throws BOException {
149: loadDetailsIfNecessary();
150: return mRelationalStorageTechnologyDetails.AttributeColumnNamePrefix;
151: }
152:
153: /* Getter for the attribute column name suffix. It gets appended to the attribute name from the model after name conversion argorithm is invoked */
154: public String getAttributeColumnNameSuffix() throws BOException {
155: loadDetailsIfNecessary();
156: return mRelationalStorageTechnologyDetails.AttributeColumnNameSuffix;
157: }
158:
159: /* Getter for the name conversion algorithm type for the association role column */
160: public NameConversionType getAssociationRoleColumnNameConversionType()
161: throws BOException {
162: loadDetailsIfNecessary();
163: return mRelationalStorageTechnologyDetails.AssociationRoleColumnNameConversionType;
164: }
165:
166: /* Getter for the association role column name prefix. It gets prepended to the association role name from the model after name conversion argorithm is invoked */
167: public String getAssociationRoleColumnNamePrefix()
168: throws BOException {
169: loadDetailsIfNecessary();
170: return mRelationalStorageTechnologyDetails.AssociationRoleColumnNamePrefix;
171: }
172:
173: /* Getter for the association role column name suffix. It gets apppended to the association role name from the model after name conversion argorithm is invoked */
174: public String getAssociationRoleColumnNameSuffix()
175: throws BOException {
176: loadDetailsIfNecessary();
177: return mRelationalStorageTechnologyDetails.AssociationRoleColumnNameSuffix;
178: }
179:
180: /* Getter for the name of the column to store entity instance id */
181: public String getEntityInstanceIdColumnName() throws BOException {
182: loadDetailsIfNecessary();
183: return mRelationalStorageTechnologyDetails.EntityInstanceIdColumnName;
184: }
185:
186: /* Getter for the name of the column to store entity version id */
187: public String getEntityVersionIdColumnName() throws BOException {
188: loadDetailsIfNecessary();
189: return mRelationalStorageTechnologyDetails.EntityVersionIdColumnName;
190: }
191:
192: /* Getter for the name of the column to store entity state */
193: public String getEntityStateColumnName() throws BOException {
194: loadDetailsIfNecessary();
195: return mRelationalStorageTechnologyDetails.EntityStateColumnName;
196: }
197:
198: /* Getter for the name of the column to store enumnerable value name */
199: public String getReferenceValueColumnName() throws BOException {
200: loadDetailsIfNecessary();
201: return mRelationalStorageTechnologyDetails.ReferenceValueColumnName;
202: }
203:
204: /* Getter for the name of the column to store enumnerable value description */
205: public String getReferenceDescriptionColumnName()
206: throws BOException {
207: loadDetailsIfNecessary();
208: return mRelationalStorageTechnologyDetails.ReferenceDescriptionColumnName;
209: }
210:
211: /* Getter for the name of the column to store enumnerable value weight */
212: public String getReferenceWeightColumnName() throws BOException {
213: loadDetailsIfNecessary();
214: return mRelationalStorageTechnologyDetails.ReferenceWeightColumnName;
215: }
216:
217: /* Getter for the maximum length of the constraint name */
218: public int getMaxConstraintNameLength() throws BOException {
219: loadDetailsIfNecessary();
220: return mRelationalStorageTechnologyDetails.MaxConstraintNameLength;
221: }
222:
223: /* Getter for the name conversion algorithm type for the association role referential integrity constraints. */
224: public NameConversionType getAssociationRoleReferentialConstraintNameConversionType()
225: throws BOException {
226: loadDetailsIfNecessary();
227: return mRelationalStorageTechnologyDetails.AssociationRoleReferentialConstraintNameConversionType;
228: }
229:
230: /* Getter for the association role referential integrity constraint name prefix. It gets prepended to the association role referential integrity constraint name after name conversion argorithm is invoked. */
231: public String getAssociationRoleReferentialConstraintNamePrefix()
232: throws BOException {
233: loadDetailsIfNecessary();
234: return mRelationalStorageTechnologyDetails.AssociationRoleReferentialConstraintNamePrefix;
235: }
236:
237: /* Getter for the association role referential integrity constraint name suffix. It gets appended to the association role referential integrity constraint name after name conversion argorithm is invoked. */
238: public String getAssociationRoleReferentialConstraintNameSuffix()
239: throws BOException {
240: loadDetailsIfNecessary();
241: return mRelationalStorageTechnologyDetails.AssociationRoleReferentialConstraintNameSuffix;
242: }
243:
244: /* Getter for the name conversion algorithm type for the association primary key constraints. */
245: public NameConversionType getAssociationPrimaryKeyConstraintNameConversionType()
246: throws BOException {
247: loadDetailsIfNecessary();
248: return mRelationalStorageTechnologyDetails.AssociationPrimaryKeyConstraintNameConversionType;
249: }
250:
251: /* Getter for the association primary key constraint name prefix. It gets prepended to the name after name conversion argorithm is invoked. */
252: public String getAssociationPrimaryKeyConstraintNamePrefix()
253: throws BOException {
254: loadDetailsIfNecessary();
255: return mRelationalStorageTechnologyDetails.AssociationPrimaryKeyConstraintNamePrefix;
256: }
257:
258: /* Getter for the association primary key constraint name suffix. It gets appended to the name after name conversion argorithm is invoked. */
259: public String getAssociationPrimaryKeyConstraintNameSuffix()
260: throws BOException {
261: loadDetailsIfNecessary();
262: return mRelationalStorageTechnologyDetails.AssociationPrimaryKeyConstraintNameSuffix;
263: }
264:
265: /* Getter for the name conversion algorithm type for the entity primary key constraints. */
266: public NameConversionType getEntityPrimaryKeyConstraintNameConversionType()
267: throws BOException {
268: loadDetailsIfNecessary();
269: return mRelationalStorageTechnologyDetails.EntityPrimaryKeyConstraintNameConversionType;
270: }
271:
272: /* Getter for the entity primary key constraint name prefix. It gets prepended to the name after name conversion argorithm is invoked. */
273: public String getEntityPrimaryKeyConstraintNamePrefix()
274: throws BOException {
275: loadDetailsIfNecessary();
276: return mRelationalStorageTechnologyDetails.EntityPrimaryKeyConstraintNamePrefix;
277: }
278:
279: /* Getter for the entity primary key constraint name suffix. It gets appended to the name after name conversion argorithm is invoked. */
280: public String getEntityPrimaryKeyConstraintNameSuffix()
281: throws BOException {
282: loadDetailsIfNecessary();
283: return mRelationalStorageTechnologyDetails.EntityPrimaryKeyConstraintNameSuffix;
284: }
285:
286: /* Getter for the name conversion algorithm type for the entity natural primary key constraints. */
287: public NameConversionType getEntityNaturalPrimaryKeyConstraintNameConversionType()
288: throws BOException {
289: loadDetailsIfNecessary();
290: return mRelationalStorageTechnologyDetails.EntityNaturalPrimaryKeyConstraintNameConversionType;
291: }
292:
293: /* Getter for the entity natural primary key constraint name prefix. It gets prepended to the name after name conversion argorithm is invoked. */
294: public String getEntityNaturalPrimaryKeyConstraintNamePrefix()
295: throws BOException {
296: loadDetailsIfNecessary();
297: return mRelationalStorageTechnologyDetails.EntityNaturalPrimaryKeyConstraintNamePrefix;
298: }
299:
300: /* Getter for the entity natural primary key constraint name suffix. It gets appended to the name after name conversion argorithm is invoked. */
301: public String getEntityNaturalPrimaryKeyConstraintNameSuffix()
302: throws BOException {
303: loadDetailsIfNecessary();
304: return mRelationalStorageTechnologyDetails.EntityNaturalPrimaryKeyConstraintNameSuffix;
305: }
306:
307: /* Getter for the name conversion algorithm type for the attribute referential constraints. */
308: public NameConversionType getEntityAttributeRefConstraintNameConversionType()
309: throws BOException {
310: loadDetailsIfNecessary();
311: return mRelationalStorageTechnologyDetails.EntityAttributeRefConstraintNameConversionType;
312: }
313:
314: /* Getter for the attribute referential constraint name prefix. It gets prepended to the name after name conversion argorithm is invoked. */
315: public String getEntityAttributeRefConstraintNamePrefix()
316: throws BOException {
317: loadDetailsIfNecessary();
318: return mRelationalStorageTechnologyDetails.EntityAttributeRefConstraintNamePrefix;
319: }
320:
321: /* Getter for the attribute referential constraint name suffix. It gets appended to the name after name conversion argorithm is invoked. */
322: public String getEntityAttributeRefConstraintNameSuffix()
323: throws BOException {
324: loadDetailsIfNecessary();
325: return mRelationalStorageTechnologyDetails.EntityAttributeRefConstraintNameSuffix;
326: }
327:
328: /** Getter for the name conversion algorithm type for the enumerable datatype primary key constraints. */
329: public NameConversionType getReferencePrimaryKeyConstraintNameConversionType()
330: throws BOException {
331: loadDetailsIfNecessary();
332: return mRelationalStorageTechnologyDetails.ReferencePrimaryKeyConstraintNameConversionType;
333: }
334:
335: /** Getter for the enumerable datatype primary key constraint name prefix. It gets prepended to the name after name conversion argorithm is invoked. */
336: public String getReferencePrimaryKeyConstraintNamePrefix()
337: throws BOException {
338: loadDetailsIfNecessary();
339: return mRelationalStorageTechnologyDetails.ReferencePrimaryKeyConstraintNamePrefix;
340: }
341:
342: /** Getter for the enumerable datatype primary key constraint name suffix. It gets appended to the name after name conversion argorithm is invoked. */
343: public String getReferencePrimaryKeyConstraintNameSuffix()
344: throws BOException {
345: loadDetailsIfNecessary();
346: return mRelationalStorageTechnologyDetails.ReferencePrimaryKeyConstraintNameSuffix;
347: }
348:
349: /** Getter for the name conversion algorithm type for the enumerable datatype weight column constraints. */
350: public NameConversionType getReferenceWeightConstraintNameConversionType()
351: throws BOException {
352: loadDetailsIfNecessary();
353: return mRelationalStorageTechnologyDetails.ReferenceWeightConstraintNameConversionType;
354: }
355:
356: /** Getter for the enumerable datatype weight constraint name prefix. It gets prepended to the name after name conversion argorithm is invoked. */
357: public String getReferenceWeightConstraintNamePrefix()
358: throws BOException {
359: loadDetailsIfNecessary();
360: return mRelationalStorageTechnologyDetails.ReferenceWeightConstraintNamePrefix;
361: }
362:
363: /** Getter for the enumerable datatype weight constraint name suffix. It gets appended to the name after name conversion argorithm is invoked. */
364: public String getReferenceWeightConstraintNameSuffix()
365: throws BOException {
366: loadDetailsIfNecessary();
367: return mRelationalStorageTechnologyDetails.ReferenceWeightConstraintNameSuffix;
368: }
369:
370: private void loadDetailsIfNecessary() throws BOException {
371: if (mRelationalStorageTechnologyDetails == null) {
372: try {
373: // Get the instance of the enterprise ps home via jndi
374: Context ctx = new InitialContext();
375: PSRelationalStorageTechnology lPs = (PSRelationalStorageTechnology) ctx
376: .lookup(PSRelationalStorageTechnology.COMPONENT_URL);
377: mRelationalStorageTechnologyDetails = lPs
378: .getRelationalStorageTechnologyDetails(getRef());
379: if (mRelationalStorageTechnologyDetails == null)
380: throw new BOException(
381: "Relation Storage Technology details the StorageTechnology not found. StorageTechnologyRef: "
382: + getRef());
383: } catch (NamingException e) {
384: throw new BONamingAndDirectoryServiceInvocationException(
385: "", e);
386: } catch (PSException e) {
387: throw new BOPersistenceServiceInvocationException(
388: "Exception caught during loading of Relational Storage Technology details. StorageTechnologyRef: "
389: + getRef(), e);
390: }
391: }
392: }
393: }
|