1 2 12 package com.versant.core.jdo; 13 14 import javax.jdo.Extent; 15 import javax.jdo.PersistenceManager; 16 import java.util.Iterator ; 17 18 21 public final class ExtentImp implements Extent { 22 23 26 private final PMProxy pm; 27 30 private Class candidateClass; 31 34 private VersantQueryImp clientQuery; 35 38 private QueryResult resultCol; 39 42 private boolean subClasses = false; 43 44 public ExtentImp(Class pcClass, boolean subclasses, PMProxy pm) { 45 this.candidateClass = pcClass; 46 this.subClasses = subclasses; 47 this.pm = pm; 48 } 49 50 public Iterator iterator() { 51 if (clientQuery == null) { 52 clientQuery = new VersantQueryImp(pm); 53 clientQuery.setCandidates(this); 54 clientQuery.setFilter(null); 55 resultCol = (QueryResult)clientQuery.execute(); 56 } 57 Iterator iter = resultCol.iterator(); 58 return iter; 59 } 60 61 public boolean hasSubclasses() { 62 return subClasses; 63 } 64 65 public Class getCandidateClass() { 66 return candidateClass; 67 } 68 69 public PersistenceManager getPersistenceManager() { 70 return pm; 71 } 72 73 public void closeAll() { 74 if (clientQuery != null) clientQuery.closeAll(); 75 } 76 77 public void close(Iterator it) { 78 ((JDOListIterator)it).close(); 79 } 80 } 81 | Popular Tags |