Coverage Report - org.apache.ojb.broker.util.sequence.SequenceManager
 
Classes in this File Line Coverage Branch Coverage Complexity
SequenceManager
N/A
N/A
1
 
 1  
 package org.apache.ojb.broker.util.sequence;
 2  
 
 3  
 /* Copyright 2002-2005 The Apache Software Foundation
 4  
  *
 5  
  * Licensed under the Apache License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 import org.apache.ojb.broker.accesslayer.JdbcAccess;
 19  
 import org.apache.ojb.broker.metadata.ClassDescriptor;
 20  
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 21  
 
 22  
 /**
 23  
  * SequenceManagers are responsible for creating new unique
 24  
  * ID's - unique accross all "extent" object declarations in OJB metadata.
 25  
  * There are some standard sequence manager implementations in
 26  
  * this package.
 27  
  * <p/>
 28  
  * SequenceManager objects are obtained from a factory class called
 29  
  * {@link SequenceManagerFactory}.
 30  
  * This Factory can be configured to provide instances of user defined
 31  
  * implementors of this interface.
 32  
  * <p/>
 33  
  * NOTE: SequenceManagers should be aware of "extents" ("extent" is an OJB inheritance feature),
 34  
  * that is: if you ask for an uid for an Interface (more exact for one implementor class)
 35  
  * with several implementor classes, or a baseclass with several subclasses the returned uid
 36  
  * should be unique accross all tables representing objects of the extent in question.
 37  
  *
 38  
  * @version $Id: SequenceManager.java,v 1.1 2007-08-24 22:17:29 ewestfal Exp $
 39  
  */
 40  
 public interface SequenceManager
 41  
 {
 42  
     /**
 43  
      * This method is called to get an unique value <strong>before</strong> the object
 44  
      * is written to persistent storage.
 45  
      * <br/>
 46  
      * Returns a unique object for the given field attribute.
 47  
      * The returned value takes in account the jdbc-type
 48  
      * and the FieldConversion.sql2java() conversion defined for <code>field</code>.
 49  
      * The returned object is unique accross all tables of "extent" classes the
 50  
      * field belongs to.
 51  
      * <br/>
 52  
      * Implementations using native identity columns should return a unique
 53  
      * incremented counter object for temporary use by OJB.
 54  
      */
 55  
     public Object getUniqueValue(FieldDescriptor field) throws SequenceManagerException;
 56  
 
 57  
     /**
 58  
      * This method is called <strong>after</strong> the object was written to the persistent storage.
 59  
      * <br/>
 60  
      * This is to support native Identity columns (auto_increment columns) on the db side.
 61  
      * Other implementations may ignore this method.
 62  
      * @param dbAccess Current used {@link org.apache.ojb.broker.accesslayer.JdbcAccess} instance
 63  
      * @param cld Descriptor for specified object
 64  
      * @param obj The object to associate with identity value
 65  
      */
 66  
     public void afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object obj) throws SequenceManagerException;
 67  
 }