org.placelab.mapper
Class CompoundMapper

java.lang.Object
  extended byorg.placelab.mapper.SimpleMapper
      extended byorg.placelab.mapper.CompoundMapper
All Implemented Interfaces:
Mapper

public class CompoundMapper
extends SimpleMapper

A Mapper that draws upon multiple mappers to find Beacons. The precedence for which Beacon is chosen when multiple Mappers know of the Beacon is determined by the order in which the sub-Mappers were added.


Field Summary
 java.util.Vector mappers
           
 
Constructor Summary
CompoundMapper()
           
 
Method Summary
 void addMapper(Mapper m)
          Adds a Mapper at lower precedence than all other Mappers in the CompoundMapper.
 void addMapperAtHead(Mapper m)
          Adds a Mapper and gives it the highest precedence for Beacons where multiple Mappers find the same Beacon.
static Mapper createDefaultMapper(boolean exitOnError, boolean shouldCache)
          This method returns a Mapper (not necessarily a CompoundMapper) according to the default set in PlacelabProperties.
 java.util.Vector findBeacons(java.lang.String id)
          Find all Beacons in the Mapper that match the given id.
 boolean overrideOnPut()
           
 java.util.Enumeration query(Coordinate c1, Coordinate c2)
          c1 and c2 define opposing corners of a rectangular area in which you wish to get an Iterator over all Beacons in that area.
 
Methods inherited from class org.placelab.mapper.SimpleMapper
close, createBeacon, deleteAll, endBulkPuts, findBeacon, isOpened, iterator, open, putBeacon, putBeacons, startBulkPuts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mappers

public java.util.Vector mappers
Constructor Detail

CompoundMapper

public CompoundMapper()
Method Detail

addMapper

public void addMapper(Mapper m)
Adds a Mapper at lower precedence than all other Mappers in the CompoundMapper.

Parameters:
m -

addMapperAtHead

public void addMapperAtHead(Mapper m)
Adds a Mapper and gives it the highest precedence for Beacons where multiple Mappers find the same Beacon.


findBeacons

public java.util.Vector findBeacons(java.lang.String id)
Description copied from interface: Mapper
Find all Beacons in the Mapper that match the given id.

Parameters:
id - the unique identifier for the Beacon
Returns:
a Vector of all Beacons matching the id in the Mapper that may be empty if no Beacons match.

query

public java.util.Enumeration query(Coordinate c1,
                                   Coordinate c2)
Description copied from interface: Mapper
c1 and c2 define opposing corners of a rectangular area in which you wish to get an Iterator over all Beacons in that area.

Specified by:
query in interface Mapper
Overrides:
query in class SimpleMapper

createDefaultMapper

public static Mapper createDefaultMapper(boolean exitOnError,
                                         boolean shouldCache)
This method returns a Mapper (not necessarily a CompoundMapper) according to the default set in PlacelabProperties. Set the property placelab.mapper to JDBM for a JDBMMapper or Hsql for an HsqlMapper. In either case, the Mappers will load from the default Mapper location for their type, also specified in PlacelabProperties. See the documentation for the individual Mapper types for the name of that property.

See Also:
JDBMMapper, HsqlMapper

overrideOnPut

public boolean overrideOnPut()