001    package org.apache.ojb.broker.accesslayer;
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 java.util.Collection;
019    
020    import org.apache.ojb.broker.metadata.ClassDescriptor;
021     
022    /**
023     * Interface for Relationship Prefetchers.
024     * Each Prefetcher handles a single Relationship (1:1 or 1:n)
025     * 
026     * @author <a href="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi</a>
027     * @version $Id: RelationshipPrefetcher.java,v 1.1 2007-08-24 22:17:30 ewestfal Exp $
028     */
029    public interface RelationshipPrefetcher
030    {
031        /**
032         * Returns the ClassDescriptor of the item Class
033         * @return ClassDescriptor
034         */
035        public ClassDescriptor getItemClassDescriptor();
036    
037        /**
038             * Prepare the Relationship for prefetch (ie: disable auto-retrieve)
039             */ 
040            public void prepareRelationshipSettings();
041    
042            /**
043             * Prefetch the Relationship for the owners (the 1 side of a 1:n)
044             */ 
045            public void prefetchRelationship(Collection owners);
046    
047            /**
048             * Restore the Relationship settings(ie: enable auto-retrieve)
049             */ 
050            public void restoreRelationshipSettings();
051    
052        /**
053         * The limit of objects loaded by one SQL query
054         */
055        public int getLimit();
056    }