public abstract class SpatialDbContentSource extends java.lang.Object implements Importer
Implementors may expect that all directory and file processing will occur in a thread-safe manner and that transactions will be applied to the spatial database and catalog externally.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATAK_ACTION_HANDLE_DATA |
static java.lang.String |
ATAK_GROUP_NAME_EXTRA |
protected SpatialDbContentResolver |
contentResolver |
protected DataSourceFeatureDataStore |
database |
protected java.lang.String |
groupName |
protected boolean |
notifyUserAfterImport |
static int |
PROCESS_ACCEPT
Flag indicating that the current file should be processed for content.
|
static int |
PROCESS_RECURSE
Flag indicating that processing should recurse into the current directory.
|
static int |
PROCESS_REJECT
Flag indicating that the current file should not undergo further processing.
|
protected java.lang.String |
type |
Modifier | Constructor and Description |
---|---|
protected |
SpatialDbContentSource(DataSourceFeatureDataStore database,
java.lang.String groupName,
java.lang.String type) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkValidEntry(java.io.File file)
Returns a flag indicating whether or not the catalog entry is valid.
|
MapOverlay |
createOverlay(android.content.Context context,
FeatureDataStoreDeepMapItemQuery query) |
void |
deleteAll() |
boolean |
deleteData(android.net.Uri uri,
java.lang.String mime)
The method used to remove the imported data
|
void |
dispose()
Dispose the importer - to be called when the map component is destroyed
|
SpatialDbContentResolver |
getContentResolver() |
DataSourceFeatureDataStore |
getDatabase()
Returns the data base that backs the features.
|
abstract java.lang.String |
getFileDirectoryName()
Returns the principal directory containing the content (e.g.
|
abstract java.lang.String |
getFileMimeType()
Returns the MIME type associated with the content.
|
java.lang.String |
getGroupName()
Returns the group name for the content.
|
abstract int |
getIconId()
Returns the Resource ID of the icon drawable (used in notifications)
|
abstract java.lang.String |
getIconPath()
Returns the path to an icon appropriate for the content.
|
static int |
getNotificationId()
Reuse from just a few IDs to avoid many many notifications
|
protected abstract java.lang.String |
getProviderHint(java.io.File file)
Processes the specified file.
|
java.util.Set<java.lang.String> |
getSupportedMIMETypes()
Returns the set of mime types supported by this importer.
|
java.lang.String |
getType()
Returns the type of the content.
|
CommsMapComponent.ImportResult |
importData(java.io.InputStream source,
java.lang.String mime,
android.os.Bundle bundle)
The method used to import the data
|
CommsMapComponent.ImportResult |
importData(android.net.Uri uri,
java.lang.String mime,
android.os.Bundle b)
The method used to import the data
|
static MapGroup |
makeMapGroup(SpatialDbContentSource contentSource)
Creates a new
MapGroup for the source using the source's group name and icon. |
static void |
notifyUserOfError(com.atakmap.spatial.file.DataIngestReport report,
java.io.File fromFile) |
static void |
notifyUserOfError(java.io.File file,
java.lang.String ticker,
java.lang.String message) |
protected static void |
notifyUserOfError(java.lang.String allThree) |
static void |
notifyUserOfError(java.lang.String title,
java.lang.String ticker,
java.lang.String message) |
int |
processAccept(java.io.File f,
int depth)
Returns a flag instructing the process loop how to handle the file.
|
boolean |
processFile(java.io.File file)
Processes the specified file.
|
void |
setContentResolver(SpatialDbContentResolver resolver)
Set the content resolver for this importer
The resolver will be notified of any adds, updates, or removals of
database content
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContentType
public static final int PROCESS_ACCEPT
public static final int PROCESS_REJECT
public static final int PROCESS_RECURSE
public static final java.lang.String ATAK_ACTION_HANDLE_DATA
public static final java.lang.String ATAK_GROUP_NAME_EXTRA
protected final java.lang.String groupName
protected final java.lang.String type
protected final DataSourceFeatureDataStore database
protected final boolean notifyUserAfterImport
protected SpatialDbContentResolver contentResolver
protected SpatialDbContentSource(DataSourceFeatureDataStore database, java.lang.String groupName, java.lang.String type)
public final DataSourceFeatureDataStore getDatabase()
public void dispose()
public final java.lang.String getType()
public final java.lang.String getGroupName()
public abstract java.lang.String getFileDirectoryName()
public abstract java.lang.String getFileMimeType()
public abstract java.lang.String getIconPath()
null
to indicate
no icon.public abstract int getIconId()
public void setContentResolver(SpatialDbContentResolver resolver)
resolver
- Content resolver or null to disposepublic SpatialDbContentResolver getContentResolver()
public MapOverlay createOverlay(android.content.Context context, FeatureDataStoreDeepMapItemQuery query)
public boolean processFile(java.io.File file)
file
- The file to be processed.protected abstract java.lang.String getProviderHint(java.io.File file)
file
- The file to be processed.protected boolean checkValidEntry(java.io.File file)
file
- A file. The catalog may or may not contain an entry for the file.false
if there is no catalog entry for the file or if the file failspublic static MapGroup makeMapGroup(SpatialDbContentSource contentSource)
MapGroup
for the source using the source's group name and icon. The
group's ignoreOffscreen
metadata is set to true
.contentSource
- The sourceMapGroup
for the source.public int processAccept(java.io.File f, int depth)
f
- The file to be processeddepth
- The current recursion depthPROCESS_ACCEPT
, PROCESS_RECURSE
or
PROCESS_REJECT
.public static void notifyUserOfError(com.atakmap.spatial.file.DataIngestReport report, java.io.File fromFile)
public static void notifyUserOfError(java.io.File file, java.lang.String ticker, java.lang.String message)
protected static void notifyUserOfError(java.lang.String allThree)
public static void notifyUserOfError(java.lang.String title, java.lang.String ticker, java.lang.String message)
public java.util.Set<java.lang.String> getSupportedMIMETypes()
Importer
getSupportedMIMETypes
in interface Importer
public CommsMapComponent.ImportResult importData(java.io.InputStream source, java.lang.String mime, android.os.Bundle bundle)
Importer
importData
in interface Importer
source
- the input stream to use when importingmime
- the mime type for the input streambundle
- the bundle that would have additional information concerning
the importpublic CommsMapComponent.ImportResult importData(android.net.Uri uri, java.lang.String mime, android.os.Bundle b)
Importer
importData
in interface Importer
uri
- the uri to use when importingmime
- the mime type for the input streamb
- the bundle that would have additional information concerning
the importpublic boolean deleteData(android.net.Uri uri, java.lang.String mime)
Importer
deleteData
in interface Importer
uri
- the input stream to use when importingmime
- the mime type for the input streampublic static int getNotificationId()
public void deleteAll()