Run a content-resolver action on a private thread, invoking callbacks on the caller's thread when done.
Return a org.positronicnet.orm.ContentQuery obeying the Long-id
convention, as described above.
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.
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.
Tag for the facility to use in log entries
Tag for the facility to use in log entries
Writes a debugging log method, using the facility's logTag
Writes a debugging log method, using the facility's logTag
Run a content-resolver action on the current thread
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.
Run func on the facility's thread.
Run func on the facility's thread.
Return a org.positronicnet.orm.ContentQuery obeying the URI-id convention, as described above.
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 individualContentProviders, including those provided by other apps or the platform itself.The best treatment of row-IDs here isn't quite clear. The underlying platform
insertmethod on aContentProviderreturns a URI for the newly created row, but by convention that row will almost always include aLongwhich can be obtained from the URI itself via theContentURIs.parseIDmethod 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--- sayandroid.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
insertwill return aLongID, orqueryHandle = Resolver.withUriIds( Calls.CONTENT_URI )to obtain one on which
insertis 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 thewithUriIdsvariant 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.ContentResolveris available by callingrealResolver, q.v.; this, of course, supports the full, unrestricted plafrom API.)