001: /**********************************************************************
002: Copyright (c) 2007 Andy Jefferson and others. All rights reserved.
003: Licensed under the Apache License, Version 2.0 (the "License");
004: you may not use this file except in compliance with the License.
005: You may obtain a copy of the License at
006:
007: http://www.apache.org/licenses/LICENSE-2.0
008:
009: Unless required by applicable law or agreed to in writing, software
010: distributed under the License is distributed on an "AS IS" BASIS,
011: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: See the License for the specific language governing permissions and
013: limitations under the License.
014:
015: Contributors:
016: ...
017: **********************************************************************/package org.jpox.jdo;
018:
019: import java.util.Iterator;
020:
021: import javax.jdo.Extent;
022: import javax.jdo.FetchPlan;
023: import javax.jdo.PersistenceManager;
024:
025: /**
026: * Wrapper implementation of a JDO Extent.
027: *
028: * @version $Revision: 1.2 $
029: */
030: public class JDOExtent implements Extent {
031: /** Underlying PersistenceManager. */
032: PersistenceManager pm;
033:
034: /** Underlying JPOX Extent. */
035: org.jpox.store.Extent extent;
036:
037: /** JDO Fetch Plan. */
038: JDOFetchPlan fetchPlan = null;
039:
040: /**
041: * Constructor.
042: * @param pm PersistenceManager
043: * @param extent Underlying JPOX Extent
044: */
045: public JDOExtent(PersistenceManager pm, org.jpox.store.Extent extent) {
046: this .pm = pm;
047: this .extent = extent;
048: fetchPlan = new JDOFetchPlan(extent.getFetchPlan());
049: }
050:
051: /**
052: * Method to close the Extent iterator.
053: * @param iterator Iterator for the extent.
054: */
055: public void close(Iterator iterator) {
056: extent.close(iterator);
057: }
058:
059: /**
060: * Method to close all Extent iterators.
061: */
062: public void closeAll() {
063: extent.closeAll();
064: }
065:
066: /**
067: * Accessor for the candidate class of the Extent.
068: * @return Candidate class
069: */
070: public Class getCandidateClass() {
071: return extent.getCandidateClass();
072: }
073:
074: /**
075: * Accessor for whether the Extent includes subclasses.
076: * @return Whether it has subclasses
077: */
078: public boolean hasSubclasses() {
079: return extent.hasSubclasses();
080: }
081:
082: /**
083: * Accessor for the FetchPlan for the Extent.
084: * @return FetchPlan
085: */
086: public FetchPlan getFetchPlan() {
087: return fetchPlan;
088: }
089:
090: /**
091: * Accessor for the PersistenceManager.
092: * @return The PM
093: */
094: public PersistenceManager getPersistenceManager() {
095: return pm;
096: }
097:
098: /**
099: * Accessor for the real extent.
100: * @return The Underlying extent
101: */
102: public org.jpox.store.Extent getExtent() {
103: return extent;
104: }
105:
106: /**
107: * Accessor for an iterator for this Extent.
108: * @return The iterator
109: */
110: public Iterator iterator() {
111: return extent.iterator();
112: }
113: }
|