00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package collections.ship.index;
00011
00012 import com.sleepycat.bind.EntryBinding;
00013 import com.sleepycat.bind.serial.ClassCatalog;
00014 import com.sleepycat.bind.serial.SerialBinding;
00015 import com.sleepycat.collections.StoredEntrySet;
00016 import com.sleepycat.collections.StoredSortedMap;
00017
00024 public class SampleViews {
00025
00026 private StoredSortedMap partMap;
00027 private StoredSortedMap supplierMap;
00028 private StoredSortedMap shipmentMap;
00029 private StoredSortedMap shipmentByPartMap;
00030 private StoredSortedMap shipmentBySupplierMap;
00031 private StoredSortedMap supplierByCityMap;
00032
00036 public SampleViews(SampleDatabase db) {
00037
00038
00039
00040
00041
00042
00043 ClassCatalog catalog = db.getClassCatalog();
00044 EntryBinding partKeyBinding =
00045 new SerialBinding(catalog, PartKey.class);
00046 EntryBinding partDataBinding =
00047 new SerialBinding(catalog, PartData.class);
00048 EntryBinding supplierKeyBinding =
00049 new SerialBinding(catalog, SupplierKey.class);
00050 EntryBinding supplierDataBinding =
00051 new SerialBinding(catalog, SupplierData.class);
00052 EntryBinding shipmentKeyBinding =
00053 new SerialBinding(catalog, ShipmentKey.class);
00054 EntryBinding shipmentDataBinding =
00055 new SerialBinding(catalog, ShipmentData.class);
00056 EntryBinding cityKeyBinding =
00057 new SerialBinding(catalog, String.class);
00058
00059
00060
00061
00062
00063
00064 partMap =
00065 new StoredSortedMap(db.getPartDatabase(),
00066 partKeyBinding, partDataBinding, true);
00067 supplierMap =
00068 new StoredSortedMap(db.getSupplierDatabase(),
00069 supplierKeyBinding, supplierDataBinding, true);
00070 shipmentMap =
00071 new StoredSortedMap(db.getShipmentDatabase(),
00072 shipmentKeyBinding, shipmentDataBinding, true);
00073 shipmentByPartMap =
00074 new StoredSortedMap(db.getShipmentByPartDatabase(),
00075 partKeyBinding, shipmentDataBinding, true);
00076 shipmentBySupplierMap =
00077 new StoredSortedMap(db.getShipmentBySupplierDatabase(),
00078 supplierKeyBinding, shipmentDataBinding, true);
00079 supplierByCityMap =
00080 new StoredSortedMap(db.getSupplierByCityDatabase(),
00081 cityKeyBinding, supplierDataBinding, true);
00082 }
00083
00084
00085
00086
00087
00088
00089
00090
00094 public final StoredSortedMap getPartMap() {
00095
00096 return partMap;
00097 }
00098
00102 public final StoredSortedMap getSupplierMap() {
00103
00104 return supplierMap;
00105 }
00106
00110 public final StoredSortedMap getShipmentMap() {
00111
00112 return shipmentMap;
00113 }
00114
00118 public final StoredEntrySet getPartEntrySet() {
00119
00120 return (StoredEntrySet) partMap.entrySet();
00121 }
00122
00126 public final StoredEntrySet getSupplierEntrySet() {
00127
00128 return (StoredEntrySet) supplierMap.entrySet();
00129 }
00130
00134 public final StoredEntrySet getShipmentEntrySet() {
00135
00136 return (StoredEntrySet) shipmentMap.entrySet();
00137 }
00138
00142 public StoredSortedMap getShipmentByPartMap() {
00143
00144 return shipmentByPartMap;
00145 }
00146
00150 public StoredSortedMap getShipmentBySupplierMap() {
00151
00152 return shipmentBySupplierMap;
00153 }
00154
00158 public final StoredSortedMap getSupplierByCityMap() {
00159
00160 return supplierByCityMap;
00161 }
00162 }