org.positronicnet.content

PositronicContentResolver

object PositronicContentResolver extends AppFacility with WorkerThread

Simple AppFacility for interacting with Android ContentProviders using the Positronic Net ContentQuery convenience shorthands, or the orm. Once the facility has been opened (via openInContext), it can be used to produce ContentQuery objects that refer to individual ContentProviders, including those provided by other apps or the platform itself.

The best treatment of row-IDs here isn't quite clear. The underlying platform insert method on a ContentProvider returns a URI for the newly created row, but by convention that row will almost always include a Long which can be obtained from the URI itself via the ContentURIs.parseID method provided by the framework, and which will also be used to identify the row in the same bulk queries. Since it isn't obvious which is better, we give you both choices, as follows:

Let's say you have the URI of some ContentProvider --- say android.provider.CallLog.Calls.CONTENT_URI, just to be concrete. Once you've got a resolver opened like so:

    object Resolver extends PositronicContentResolver( "call_log_app" )
    ...
    class SomeActivity {
      onCreate {
        useAppFacility( Resolver )
      }
    }

you can either say

    queryHandle = Resolver( Calls.CONTENT_URI )

to get a org.positronicnet.orm.ContentQuery on which insert will return a Long ID, or

    queryHandle = Resolver.withUriIds( Calls.CONTENT_URI )

to obtain one on which insert is typed to return the raw URIs.

There's no other difference between the two, but only the latter will work with the orm, which requires long IDs for the moment.

In general, the Long-id variants are easier to deal with for providers which support that convention (most of the standard ones on the platform, for starters), but the withUriIds variant is there if you prefer it.

There are also limited facilities for using org.positronicnet.content.PositronicContentResolver for asynch operations, using actor-like syntax; in particular, batch updates are supported via org.positronicnet.content.BatchOperation.

(The underlying android.content.ContentResolver is available by calling realResolver, q.v.; this, of course, supports the full, unrestricted plafrom API.)

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. PositronicContentResolver
  2. WorkerThread
  3. AppFacility
  4. AnyRef
  5. Any
Visibility
  1. Public
  2. All

Value Members

  1. def ! (action: ContentResolverAction): Unit

    Run a content-resolver action on a private thread, invoking callbacks on the caller's thread when done.

  2. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  3. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  4. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  5. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  6. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  7. def apply (uri: Uri): ContentProviderQuery[Long]

    Return a org.positronicnet.orm.ContentQuery obeying the Long-id convention, as described above.

  8. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  9. def assertOnThread (s: String): Unit

    Throws an assertion error if called from anywhere but this activity's thread.

    Throws an assertion error if called from anywhere but this activity's thread.

    Definition Classes
    WorkerThread
  10. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def close : Unit

    Close the facility.

    Close the facility.

    First, decrements the "nested open" count. If it has reached zero, do a "real" close, using the protected realclose method. Otherwise, some other activity is still using the facility, and it stays open.

    When the last activity or service calls close, the facility actually does shut down, using the protected realClose method, which will shut down threads, close files, or whatever.

    Definition Classes
    AppFacility
  12. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  13. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  14. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  15. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef
  16. def getLogTag : String

    Tag for the facility to use in log entries

    Tag for the facility to use in log entries

    Definition Classes
    PositronicContentResolverAppFacility
  17. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  18. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  19. def log (s: String): AnyVal

    Writes a debugging log method, using the facility's logTag

    Writes a debugging log method, using the facility's logTag

    Definition Classes
    AppFacility
  20. var logTag : String

  21. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  22. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  23. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  24. def onThisThread (action: ContentResolverAction): Unit

    Run a content-resolver action on the current thread

  25. def openInContext (ctx: Context): Unit

    Open the facility.

    Open the facility.

    If the facility isn't already open, does setup which depends on the particular facility (which may involve opening files, starting threads, or whatever) --- a "real" open, using the protected realOpen method. The given Context may be used for setup, depending on the nature of the facility.

    If it is already open, just increments a "nested open" count; see close below.

    Definition Classes
    AppFacility
  26. def realClose : Unit

    Attributes
    protected
    Definition Classes
    WorkerThreadAppFacility
  27. def realOpen (ctx: Context): Unit

    Attributes
    protected
    Definition Classes
    PositronicContentResolverWorkerThreadAppFacility
  28. def runOnThread (func: ⇒ Unit): Unit

    Run func on the facility's thread.

    Run func on the facility's thread.

    Definition Classes
    WorkerThread
  29. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  30. def toString (): String

    Definition Classes
    AnyRef → Any
  31. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  32. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  33. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  34. def withUriIds (uri: Uri): ContentProviderQuery[Uri]

    Return a org.positronicnet.orm.ContentQuery obeying the URI-id convention, as described above.

Inherited from WorkerThread

Inherited from AppFacility

Inherited from AnyRef

Inherited from Any