mobi.voiceassistant.base.content
Class PatternUriProvider

java.lang.Object
  extended by android.content.ContentProvider
      extended by mobi.voiceassistant.base.content.PatternUriProvider
All Implemented Interfaces:
ComponentCallbacks, ComponentCallbacks2

public abstract class PatternUriProvider
extends ContentProvider

Extend this class to rewrite pattern content uris in runtime. May be useful to separate test and debug servers or servers for different languages. For example content://com.example/entity -> http://example.com/api


Nested Class Summary
 
Nested classes/interfaces inherited from class android.content.ContentProvider
ContentProvider.PipeDataWriter<T>
 
Field Summary
 
Fields inherited from interface android.content.ComponentCallbacks2
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
 
Constructor Summary
PatternUriProvider()
           
 
Method Summary
 int delete(Uri uri, String selection, String[] selectionArgs)
          Not supported.
 String getType(Uri uri)
          Always returns AgentContract.Content.URI_TYPE
abstract  Uri getUri(Uri contentUri)
          Override this method to rewrite uri
 Uri insert(Uri uri, ContentValues values)
          Not supported.
 boolean onCreate()
          Always returns true
 Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
           
 int update(Uri uri, ContentValues values, String selection, String[] selectionArgs)
          Not supported.
 
Methods inherited from class android.content.ContentProvider
applyBatch, attachInfo, bulkInsert, call, dump, getContext, getPathPermissions, getReadPermission, getStreamTypes, getWritePermission, isTemporary, onConfigurationChanged, onLowMemory, onTrimMemory, openAssetFile, openFile, openFileHelper, openPipeHelper, openTypedAssetFile, query, setPathPermissions, setReadPermission, setWritePermission, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternUriProvider

public PatternUriProvider()
Method Detail

getUri

public abstract Uri getUri(Uri contentUri)
Override this method to rewrite uri

Parameters:
contentUri - Uri from uri attribute of pattern element.
Returns:
Rewritten uri which will be used by matcher.

onCreate

public boolean onCreate()
Always returns true

Specified by:
onCreate in class ContentProvider
Returns:
true

query

public Cursor query(Uri uri,
                    String[] projection,
                    String selection,
                    String[] selectionArgs,
                    String sortOrder)
Specified by:
query in class ContentProvider

getType

public final String getType(Uri uri)
Always returns AgentContract.Content.URI_TYPE

Specified by:
getType in class ContentProvider
Parameters:
uri - Uri from uri attribute of pattern element.
Returns:
AgentContract.Content.URI_TYPE

insert

public final Uri insert(Uri uri,
                        ContentValues values)
Not supported. Always throws UnsupportedOperationException.

Specified by:
insert in class ContentProvider
Throws:
UnsupportedOperationException

delete

public final int delete(Uri uri,
                        String selection,
                        String[] selectionArgs)
Not supported. Always throws UnsupportedOperationException.

Specified by:
delete in class ContentProvider
Throws:
UnsupportedOperationException

update

public final int update(Uri uri,
                        ContentValues values,
                        String selection,
                        String[] selectionArgs)
Not supported. Always throws UnsupportedOperationException.

Specified by:
update in class ContentProvider
Throws:
UnsupportedOperationException