1 23 package org.apache.slide.store.impl.rdbms.expression; 24 25 import java.util.Collection ; 26 import java.util.HashSet ; 27 import java.util.Iterator ; 28 29 import org.apache.slide.common.SlideRuntimeException; 30 import org.apache.slide.search.BadQueryException; 31 import org.apache.slide.search.basic.IBasicResultSet; 32 33 35 public class RDBMSResultSet extends HashSet implements IBasicResultSet { 36 37 private boolean _initialized; 38 private final RDBMSExpressionFactory _factory; 39 40 public RDBMSResultSet(RDBMSExpressionFactory factory) { 41 _factory = factory; 42 } 43 44 private void initialize() { 45 try { 46 super.addAll(_factory.getRequestedResourcePool().getPool()); 47 } 48 catch (BadQueryException e) { 49 throw new SlideRuntimeException(e.toString(), true); 50 } 51 _initialized = true; 52 } 53 54 public boolean isPartialResultSet() { 55 return _factory.getRequestedResourcePool().partialResult(); 56 } 57 58 public void clear() { 59 if (!_initialized) { 60 _initialized = true; 61 } 62 super.clear(); 63 } 64 65 public boolean contains(Object arg0) { 66 if (!_initialized) { 67 initialize(); 68 } 69 return super.contains(arg0); 70 } 71 72 public boolean isEmpty() { 73 if (!_initialized) { 74 initialize(); 75 } 76 return super.isEmpty(); 77 } 78 79 public Iterator iterator() { 80 if (!_initialized) { 81 initialize(); 82 } 83 return super.iterator(); 84 } 85 86 public boolean remove(Object arg0) { 87 if (!_initialized) { 88 initialize(); 89 } 90 return super.remove(arg0); 91 } 92 93 public int size() { 94 if (!_initialized) { 95 initialize(); 96 } 97 return super.size(); 98 } 99 100 public boolean removeAll(Collection arg0) { 101 if (!_initialized) { 102 initialize(); 103 } 104 return super.removeAll(arg0); 105 } 106 107 public boolean containsAll(Collection arg0) { 108 if (!_initialized) { 109 initialize(); 110 } 111 return super.containsAll(arg0); 112 } 113 114 public boolean retainAll(Collection arg0) { 115 if (!_initialized) { 116 initialize(); 117 } 118 return super.retainAll(arg0); 119 } 120 121 public Object [] toArray() { 122 if (!_initialized) { 123 initialize(); 124 } 125 return super.toArray(); 126 } 127 128 public Object [] toArray(Object [] arg0) { 129 if (!_initialized) { 130 initialize(); 131 } 132 return super.toArray(arg0); 133 } 134 135 } | Popular Tags |