com.micello.mapapi.store
Class DataStore

java.lang.Object
  extended by com.micello.mapapi.store.DataStore

public class DataStore
extends java.lang.Object

This class access data objects through a local cache and remote network requests.


Field Summary
static int COMMUNITY_REQUEST
           
static int GENERAL_REQUEST
           
static int MINIMUM_VERSION
           
static int THEME_REQUEST
           
static int UNKNOWN_VERSION
          This is the version that should be requested if the desired version is not known.
 
Constructor Summary
DataStore()
           
 
Method Summary
 void clearCommunityCache(int cid)
           
 void clearRequestInfo(int type)
          This method clears the request history for a given tyep of request.
protected static boolean getSkipCheckLatest()
          This metho retrieves the skip check latest flag.
 void intraCommunitySearch(int cid, java.lang.String query, int mapVersion, int entityVersion, IntraCommunitySearchDataListener dataListener)
          This method asynchronously loads an intracommunity search, passing it to the data listener.
 void loadCommunity(int cid, CommunityDataListener dataListener)
          This method asynchronously loads the community, passing it to the community data listener.
 void loadDetail(int cid, InfoObject.StandardDetailInfo detailInfo, int version, DetailDataListener dataListener)
          This method asynchronously loads object deatil, passing it to the data listener.
 void loadDrawingDirectory(int cid, int did, int mapVersion, int entityVersion, DrawingDirectoryDataListener dataListener)
          This method loads the directory associated with a drawing.
 void loadDrawingEntities(int cid, int did, int associatedMapVersion, DrawingEntitiesDataListener dataListener)
          This method asynchronously loads the drawing entities, passing it to the community data listener.
 void loadImage(java.lang.String url, java.lang.String ref, ImageDataListener listener, MicelloManager micelloManager)
          This method requests and caches an image from the given URL.
 void loadLevelGeometry(int cid, int did, int lid, int version, LevelGeometryDataListener dataListener)
          This method asynchronously loads the level geometry, passing it to the community data listener.
 void loadTheme(java.lang.String family, java.lang.String mapType, int mapTypeVersion, ThemeDataListener dataListener)
          This method asynchronously loads the theme, passing it to the community data listener.
 void routeRequest(int cid, RouteInfo routeInfo, int mapVersion, AnnotationResponseDataListener dataListener, java.lang.String layerName)
          This method asynchronously loads an intra-community search, passing it to the data listener.
static void setHostUrl(java.lang.String hostUrl)
          This method is intended for testing only.
 void setLang(java.lang.String lang)
          This sets the language for requests.
 void setRequestKey(java.lang.String key)
          This method sets the request key.
static void setSkipCheckLatest(boolean skipCheckLatest)
          This method forces the application to use a cached version of the data without checking the latest version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_VERSION

public static final int UNKNOWN_VERSION
This is the version that should be requested if the desired version is not known.

See Also:
Constant Field Values

MINIMUM_VERSION

public static final int MINIMUM_VERSION
See Also:
Constant Field Values

GENERAL_REQUEST

public static final int GENERAL_REQUEST
See Also:
Constant Field Values

COMMUNITY_REQUEST

public static final int COMMUNITY_REQUEST
See Also:
Constant Field Values

THEME_REQUEST

public static final int THEME_REQUEST
See Also:
Constant Field Values
Constructor Detail

DataStore

public DataStore()
Method Detail

setRequestKey

public void setRequestKey(java.lang.String key)
This method sets the request key.


setLang

public void setLang(java.lang.String lang)
This sets the language for requests. This is intended for internal use. To set the language for the maps, call setLang on the object MicelloManager.

Parameters:
lang - The language

setHostUrl

public static void setHostUrl(java.lang.String hostUrl)
This method is intended for testing only. It sets the host URL.


setSkipCheckLatest

public static void setSkipCheckLatest(boolean skipCheckLatest)
This method forces the application to use a cached version of the data without checking the latest version. This method should only be called in special circumstances. It may allow for incompatible data files to be used together.

Parameters:
skipCheckLatest -

getSkipCheckLatest

protected static final boolean getSkipCheckLatest()
This metho retrieves the skip check latest flag.


loadCommunity

public void loadCommunity(int cid,
                          CommunityDataListener dataListener)
This method asynchronously loads the community, passing it to the community data listener. The object is checked in the cache and if it is not present a network request is made.

Parameters:
cid - The id of the requested community
lang - The language desired.
dataListener - The listener that will receive the object.

loadLevelGeometry

public void loadLevelGeometry(int cid,
                              int did,
                              int lid,
                              int version,
                              LevelGeometryDataListener dataListener)
This method asynchronously loads the level geometry, passing it to the community data listener. The object is checked in the cache and if it is not present a network request is made.

Parameters:
cid - The community id of the requested level
did - The drawing id of the requested level
lid - The level id of the requested level
lang - The language desired
dataListener - The listener that will receive the object.

loadDrawingEntities

public void loadDrawingEntities(int cid,
                                int did,
                                int associatedMapVersion,
                                DrawingEntitiesDataListener dataListener)
This method asynchronously loads the drawing entities, passing it to the community data listener. The object is checked in the cache and if it is not present a network request is made.

Parameters:
cid - The community id of the requested level
did - The drawing id of the requested community
associatedMapVersion - This is the map version with which the entity version should be compatible.
dataListener - The listener that will receive the object.

loadTheme

public void loadTheme(java.lang.String family,
                      java.lang.String mapType,
                      int mapTypeVersion,
                      ThemeDataListener dataListener)
This method asynchronously loads the theme, passing it to the community data listener. The object is checked in the cache and if it is not present a network request is made.

Parameters:
family - The family for the requested theme. For the standard theme use the value DEFAULT_THEME. Also, the value null can be set in which case a theme family will be chosen by the server.
mapType - The map type for the requested theme.
mapTypeVersion - The minimum map type version to return. If unknown use the value UNKNOWN_VERSION, in which case The latest version will be queried over the network and downloaded if it is not present on the device.
dataListener - The listener that will receive the object.

loadDrawingDirectory

public void loadDrawingDirectory(int cid,
                                 int did,
                                 int mapVersion,
                                 int entityVersion,
                                 DrawingDirectoryDataListener dataListener)
This method loads the directory associated with a drawing.

Parameters:
cid - The community ID
did - The drawing ID
lang - The deesired language
mapVersion - The desired map version. Using UNKONWN_VERSION will return the latest version.
entityVersion - The desired entity version. Using UNKONWN_VERSION will return the latest version.
dataListener - The listener to recieve the directory data.

loadDetail

public void loadDetail(int cid,
                       InfoObject.StandardDetailInfo detailInfo,
                       int version,
                       DetailDataListener dataListener)
This method asynchronously loads object deatil, passing it to the data listener. The object is not cached persistently.

Parameters:
cid - The community id
detailInfo - The request info
version - The desired version, which should be the proper map or entity version
dataListener - The listener that will receive the object.

intraCommunitySearch

public void intraCommunitySearch(int cid,
                                 java.lang.String query,
                                 int mapVersion,
                                 int entityVersion,
                                 IntraCommunitySearchDataListener dataListener)
This method asynchronously loads an intracommunity search, passing it to the data listener. The object is not cached persistently.

Parameters:
cid - The community id
query - The query string
lang - The desired language
mapVersion - The desired map version
entityVersion - The desired entity version
dataListener - The listener that will receive the object.

routeRequest

public void routeRequest(int cid,
                         RouteInfo routeInfo,
                         int mapVersion,
                         AnnotationResponseDataListener dataListener,
                         java.lang.String layerName)
This method asynchronously loads an intra-community search, passing it to the data listener. The object is not cached persistently.

Parameters:
cid - The community id
query - The query string
lang - The desired language
mapVersion - The desired map version
dataListener - The listener that will receive the object.
layerName - The name for the layer. This can only be set at layer instantiation time.

loadImage

public void loadImage(java.lang.String url,
                      java.lang.String ref,
                      ImageDataListener listener,
                      MicelloManager micelloManager)
This method requests and caches an image from the given URL. The value of ref is passed back in the callback to be used as a reference to the string requested.


clearRequestInfo

public void clearRequestInfo(int type)
This method clears the request history for a given tyep of request.


clearCommunityCache

public void clearCommunityCache(int cid)