001: /**
002: * Speedo: an implementation of JDO compliant personality on top of JORM generic
003: * I/O sub-system.
004: * Copyright (C) 2001-2005 France Telecom R&D
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: *
021: *
022: * Contact: speedo@objectweb.org
023: *
024: * Authors: S.Chassande-Barrioz.
025: *
026: */package org.objectweb.speedo.mim.api;
027:
028: import java.util.Collection;
029:
030: import javax.jdo.Extent;
031: import javax.jdo.PersistenceManager;
032: import javax.jdo.Query;
033:
034: /**
035: * Fetch groups are activated using methods on this interface. An
036: * instance of this interface can be obtained from {@link
037: * PersistenceManager#getFetchPlan}, {@link Extent#getFetchPlan}, and
038: * {@link Query#getFetchPlan}. When a <code>Query</code> or
039: * <code>Extent</code> is retrieved from a
040: * <code>PersistenceManager</code>, its <code>FetchPlan</code> is
041: * initialized to the same settings as that of the
042: * <code>PersistenceManager</code>. Subsequent modifications of the
043: * <code>Query</code> or <code>Extent</code>'s <code>FetchPlan</code>
044: * are not reflected in the <code>FetchPlan</code> of the
045: * <code>PersistenceManager</code>.
046: */
047: public interface FetchPlanItf {
048: /**
049: * For use with {@link #speedoAddGroup(String)}, {@link #speedoRemoveGroup(String)}, and the
050: * various {@link #speedoSetGroups} calls. Value: <code>default</code>.
051: */
052: public static final String DEFAULT = "default";
053:
054: /**
055: * For use with {@link #speedoAddGroup(String)}, {@link #speedoRemoveGroup(String)}, and the
056: * various {@link #speedoSetGroups} calls. Value: <code>all</code>.
057: */
058: public static final String ALL = "all";
059:
060: /**
061: * For use with {@link #speedoAddGroup(String)}, {@link #speedoRemoveGroup(String)}, and the
062: * various {@link #speedoSetGroups} calls. Value: <code>values</code>.
063: */
064: public static final String VALUES = "values";
065:
066: /**
067: * For use with {@link #speedoAddGroup(String)}, {@link #speedoRemoveGroup(String)}, and the
068: * various {@link #speedoSetGroups} calls. Value: <code>none</code>.
069: */
070: public static final String NONE = "none";
071:
072: /**
073: * For use with {@link #setFetchSize}. Value: -1.
074: */
075: public static final int FETCH_SIZE_GREEDY = -1;
076:
077: /**
078: * For use with {@link #setFetchSize}. Value: 0.
079: */
080: public static final int FETCH_SIZE_OPTIMAL = 0;
081:
082: /**
083: * Add the fetch group to the set of active fetch groups.
084: * @return the FetchPlan
085: */
086: FetchPlanItf speedoAddGroup(String fetchGroupName);
087:
088: /**
089: * Remove the fetch group from the set active fetch groups.
090: * @return the FetchPlan
091: */
092: FetchPlanItf speedoRemoveGroup(String fetchGroupName);
093:
094: /**
095: * Remove all active groups leaving no active fetch group.
096: * @return the FetchPlan
097: */
098: FetchPlanItf speedoClearGroups();
099:
100: /**
101: * Return the names of all active fetch groups.
102: * @return the names of active fetch groups
103: * @return the FetchPlan
104: */
105: Collection speedoGetGroups();
106:
107: /**
108: * Set a collection of groups.
109: * @param fetchGroupNames a collection of names of fetch groups
110: * @return the FetchPlan
111: */
112: FetchPlanItf speedoSetGroups(Collection fetchGroupNames);
113:
114: /**
115: * Set a collection of groups.
116: * @param fetchGroupNames a String array of names of fetch groups
117: * @return the FetchPlan
118: */
119: FetchPlanItf speedoSetGroups(String[] fetchGroupNames);
120:
121: /**
122: * Set the active fetch groups to the single named fetch group.
123: * @param fetchGroupName the single fetch group
124: * @return the FetchPlan
125: */
126: FetchPlanItf speedoSetGroup(String fetchGroupName);
127:
128: /**
129: * Set the fetch size for large result set support. Use
130: * {@link #FETCH_SIZE_OPTIMAL} to unset, and {@link #FETCH_SIZE_GREEDY}
131: * to force loading of everything.
132: * @param fetchSize the fetch size
133: * @return the FetchPlan
134: */
135: FetchPlanItf speedoSetFetchSize(int fetchSize);
136:
137: /**
138: * Return the fetch size, or {@link #FETCH_SIZE_OPTIMAL} if not set,
139: * or {@link #FETCH_SIZE_GREEDY} to fetch all.
140: * @return the fetch size
141: */
142: int speedoGetFetchSize();
143:
144: }
|