001: package org.apache.ojb.odmg;
002:
003: /* Copyright 2002-2005 The Apache Software Foundation
004: *
005: * Licensed under the Apache License, Version 2.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: import org.odmg.Implementation;
019:
020: /**
021: * Offers useful none odmg-standard methods of the odmg {@link org.odmg.Implementation} interface.
022: * <p>
023: * Note: All listed methods are <strong>not</strong> part of the standard ODMG-api -
024: * they are special (proprietary) OJB extensions.
025: * </p>
026: *
027: * @version $Id: ImplementationExt.java,v 1.1.2.6 2005/12/21 22:29:21 tomdz Exp $
028: */
029: public interface ImplementationExt extends Implementation {
030: /**
031: * The used collection type class returned by OQL queries.
032: *
033: * @see org.apache.ojb.odmg.oql.EnhancedOQLQuery#execute()
034: * @see org.odmg.OQLQuery#execute()
035: * @return The collection class type
036: */
037: public Class getOqlCollectionClass();
038:
039: /**
040: * Set the used collection type class returned by OQL queries.
041: * <p/>
042: * NOTE: Each specified class must implement interface {@link org.apache.ojb.broker.ManageableCollection}
043: * to work proper with OJB.
044: *
045: * @param oqlCollectionClass The collection class used in OQL queries.
046: */
047: public void setOqlCollectionClass(Class oqlCollectionClass);
048:
049: /**
050: * If the OJB implicit locking feature (see {@link TransactionExt#setImplicitLocking(boolean)}) is
051: * enabled, this define the lock type of all implicit locked objects.
052: * <p/>
053: * If set to <em>true</em>, acquiring a write-lock on a given object x implies write locks on all
054: * implicit locked objects.
055: * <br/>
056: * If set to <em>false</em>, in any case implicit read-locks are acquired.
057: * Acquiring a read- or write lock on x thus allways results in implicit read-locks
058: * on all associated objects.
059: *
060: * @param impliciteWriteLocks If <em>true</em> implicit write locks will enabled.
061: */
062: public void setImpliciteWriteLocks(boolean impliciteWriteLocks);
063:
064: /**
065: * Is <em>true</em> when implicite write locks are enabled.
066: *
067: * @return <em>true</em> when implicit write locks are enabled.
068: * @see #setImpliciteWriteLocks(boolean)
069: */
070: public boolean isImpliciteWriteLocks();
071:
072: /**
073: * Set the global property <em>implicit locking</em>. This method can be used
074: * to activate or deactivate the global implicit
075: * locking mechanism.
076: * <br/>
077: * If set <em>true</em> OJB implicitly locks objects to ODMG transactions
078: * after performing OQL queries. Also if implicit locking is used
079: * locking objects is recursive, that is associated objects are also
080: * locked. If ImplicitLocking is set to 'false', no locks are obtained
081: * in OQL queries, lookup objects and there is also no recursive locking.
082: * <p/>
083: * However it's possible to set this value only for the current used {@link org.odmg.Transaction}
084: * using {@link TransactionExt#setImplicitLocking(boolean)} and to detect the implicit locking
085: * state of the used transaction instance call {@link TransactionExt#isImplicitLocking()}.
086: * <br/>
087: * Turning off implicit locking may improve performance but requires
088: * additional care to make sure that all changed objects are properly
089: * registered to the transaction.
090: *
091: * @param impliciteLocking If set <em>true</em> implicit locking is enabled,
092: * if <em>false</em>, implicit locking is disabled.
093: */
094: public void setImplicitLocking(boolean impliciteLocking);
095:
096: /**
097: * Returns <em>true</em> if the global implicit locking is enabled
098: * for this {@link org.odmg.Implementation} instance, else <em>false</em>.
099: * <br/>
100: * <strong>Important:</strong> The returned value is the global used setting for all
101: * {@link org.odmg.Transaction#lock(Object, int)} calls.
102: * <br/>
103: * However it's possible to set this value only for the current used {@link org.odmg.Transaction}
104: * using {@link TransactionExt#setImplicitLocking(boolean)} and to detect the implicit locking
105: * state of the used transaction instance call {@link TransactionExt#isImplicitLocking()}.
106: *
107: * @return <em>true</em> if the global property <em>implicit locking</em><em>true</em> is enabled.
108: * @see #setImplicitLocking(boolean)
109: */
110: public boolean isImplicitLocking();
111:
112: /**
113: * Returns <em>true</em> if OJB's ordering algorithm is enabled.
114: *
115: * @see #setOrdering(boolean)
116: */
117: public boolean isOrdering();
118:
119: /**
120: * Disable/enable OJB's ordering algorithm when insert, update, delete a
121: * bunch of objects within a transaction. The ordering algorithm try to
122: * calculate the correct order of the modified/new persistent objects to
123: * prevent problems on commit of the transaction.
124: * <br/>
125: * If the used databases support 'deferred checks' it's recommended to
126: * use this feature and to disable OJB's object ordering.
127: * <p/>
128: * However it's possible to set this value only for the current
129: * used {@link org.odmg.Transaction} using {@link TransactionExt#setOrdering(boolean)}
130: *
131: * @param ordering If <em>true</em> OJB's ordering algorithm is used.
132: */
133: public void setOrdering(boolean ordering);
134:
135: // /**
136: // * Returns whether or not the persistent method calls determine
137: // * the persistent object order on commit.
138: // *
139: // * @see #setNoteUserOrder(boolean)
140: // */
141: // public boolean isNoteUserOrder();
142: //
143: // /**
144: // * If <em>true</em> the order of persisting method calls like
145: // * <br/> - {@link org.odmg.Transaction#lock(Object, int)}).
146: // * <br/> - {@link org.odmg.Database#deletePersistent(Object)}).
147: // * <br/> - {@link org.odmg.Database#makePersistent(Object)})
148: // * determine the order of objects before commit.
149: // * <br/>
150: // * If <em>false</em> the ordering was determined by OJB's internal
151: // * method calls and user calls.
152: // * <br/>
153: // * However it's possible to set this value only for the current
154: // * used {@link org.odmg.Transaction} using {@link TransactionExt#setNoteUserOrder(boolean)}
155: // * <p/>
156: // * <strong>NOTE:</strong> If OJB's ordering algorithm (see
157: // * {@link #setOrdering(boolean)}) is enabled, the
158: // * order of objects may change on commit.
159: // *
160: // * @param noteUserOrder If <em>true</em> the order of persisting
161: // * method calls determine the order of objects.
162: // */
163: // public void setNoteUserOrder(boolean noteUserOrder);
164:
165: // /**
166: // * Get object by OJB's {@link org.apache.ojb.broker.Identity}.
167: // *
168: // * @param id The identity of the object to look for.
169: // * @return The matching object or <em>null</em>.
170: // */
171: // public Object getObjectByIdentity(Identity id);
172:
173: // /**
174: // * If set <em>true</em> the odmg implementation do it's best to find out the user intension, if set
175: // * <em>false</em> OJB use an optimized mode and the user has to adhere strictly the odmg-api:
176: // * <ul>
177: // * <li>
178: // * New objects can only be made persistent by using {@link org.odmg.Database#makePersistent(Object)}
179: // * </li>
180: // * <li>
181: // * Only persistent objects can be locked with {@link org.odmg.Transaction#lock(Object, int)}.
182: // * </li>
183: // * <li>
184: // * When deleting an object with {@link org.odmg.Database#deletePersistent(Object)} to reuse it
185: // * within a transaction a call to {@link org.odmg.Database#makePersistent(Object)} is needed and
186: // * field changes on objects marked as "deleted" are not allowed.
187: // * </li>
188: // * </ul>
189: // * When running odmg in <em>safe-mode</em> these restrictions are "softened" and it's e.g. possible
190: // * to persist new objects with {@link org.odmg.Transaction#lock(Object, int)}.
191: // * <p/>
192: // * The <em>optimized-mode</em> show a significant better performance, but needs strictness in using the API.
193: // *
194: // * @param safeMode Set <em>true</em> to enable the <em>safe-mode</em>, use <em>false</em> to enable
195: // * the <em>optimized-mode</em>.
196: // */
197: // void setSafeMode(boolean safeMode);
198: //
199: // /**
200: // * Returns <em>true</em> if this class use the safe-mode for
201: // * user interaction, else the optimized-mode is used.
202: // */
203: // boolean isSafeMode();
204: }
|