org.placelab.mapper
Class SimpleMapper

java.lang.Object
  extended byorg.placelab.mapper.SimpleMapper
All Implemented Interfaces:
Mapper
Direct Known Subclasses:
CompoundMapper, FakeMapper, TestMapper

public abstract class SimpleMapper
extends java.lang.Object
implements Mapper

A stub/do-nothing Mapper meant to be subclassed


Constructor Summary
SimpleMapper()
           
 
Method Summary
 boolean close()
          Closes the Mapper.
 Beacon createBeacon(java.lang.String keyValuePairs)
          Implementation dependent method to unpack a Beacon from the Mapper
 boolean deleteAll()
          Deletes all Beacon records in the Mapper.
 void endBulkPuts()
           
 Beacon findBeacon(java.lang.String id)
          Returns the first Beacon found that has a matching id, or null if no Beacon is returned.
 boolean isOpened()
           
 java.util.Enumeration iterator()
           
 boolean open()
          Opens the Mapper.
 boolean putBeacon(java.lang.String id, Beacon beacon)
          Load a new single Beacon into the Mapper
 boolean putBeacons(java.lang.String id, java.util.Vector list)
          Put a Vector of Beacons for one unique id into the Mapper
 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.
 void startBulkPuts()
          Signals to the Mapper that it is about to be loaded in bulk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.placelab.mapper.Mapper
findBeacons, overrideOnPut
 

Constructor Detail

SimpleMapper

public SimpleMapper()
Method Detail

findBeacon

public Beacon findBeacon(java.lang.String id)
Description copied from interface: Mapper
Returns the first Beacon found that has a matching id, or null if no Beacon is returned.

Specified by:
findBeacon in interface Mapper
Parameters:
id - the unique identifier for the Beacon

putBeacons

public boolean putBeacons(java.lang.String id,
                          java.util.Vector list)
Description copied from interface: Mapper
Put a Vector of Beacons for one unique id into the Mapper

Specified by:
putBeacons in interface Mapper
Parameters:
id - the unique id to key the Beacons to
list - the Beacons to add
Returns:
whether or not the put succeeded

putBeacon

public boolean putBeacon(java.lang.String id,
                         Beacon beacon)
Description copied from interface: Mapper
Load a new single Beacon into the Mapper

Specified by:
putBeacon in interface Mapper
Parameters:
id - the unique id for the Beacon
beacon - a new Beacon to be put into the Mapper
Returns:
whether or not the Beacon was successfully added

createBeacon

public Beacon createBeacon(java.lang.String keyValuePairs)
Description copied from interface: Mapper
Implementation dependent method to unpack a Beacon from the Mapper

Specified by:
createBeacon in interface Mapper

close

public boolean close()
Description copied from interface: Mapper
Closes the Mapper. Closed Mappers can no longer be queried.

Specified by:
close in interface Mapper
Returns:
whether or not the Mapper was successfully closed.

deleteAll

public boolean deleteAll()
Description copied from interface: Mapper
Deletes all Beacon records in the Mapper. This is typically used by MapLoaders prior to reloading the Mapper with data.

Specified by:
deleteAll in interface Mapper
Returns:
whether or not the Mapper was successfully emptied.

endBulkPuts

public void endBulkPuts()
Specified by:
endBulkPuts in interface Mapper

isOpened

public boolean isOpened()
Specified by:
isOpened in interface Mapper

open

public boolean open()
Description copied from interface: Mapper
Opens the Mapper. You must call this method before querying the mapper.

Specified by:
open in interface Mapper
Returns:
whether or not the Mapper was successfully opened.

startBulkPuts

public void startBulkPuts()
Description copied from interface: Mapper
Signals to the Mapper that it is about to be loaded in bulk. Some implementations can use this to lock their underlying database and speed up loading. You should not query the Mapper while using bulk loading.

Specified by:
startBulkPuts in interface Mapper
See Also:
Mapper.endBulkPuts()

iterator

public java.util.Enumeration iterator()

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