Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

Private
[Bundle Manager]


Defines

#define ALP_PRV_BUNDLE_FLAG_DO_NOT_NOTIFY   2
 Flag to pass to some bundle manager routines to prevent notifications from being generated.
#define ALP_PRV_BUNDLE_FLAG_FORCE_DELETE   4
 Flag to pass to some bundle manager routines to force a bundle deletion even if the bundle is in use.
#define ALP_PRV_BUNDLE_FLAG_FORCE_UNREGISTER   8
 Flag to pass to some bundle manager routines to force a bundle unregistration even if the bundle is in use.
#define ALP_PRV_BUNDLE_FLAG_FORCE_UNMOUNT   16
 Flag to pass to some bundle manager routines to force an unmount even if the bundle is in use.
#define ALP_PRV_BUNDLE_FLAG_DO_NOT_MAKE_STUB   32
 Flag to pass to some bundle manager routines to prevent unregistration from creating a stub bundle for R/W data retention.
#define ALP_PRV_BUNDLE_FLAG_LAZY_DELETE   64
 Flag to pass to some bundle manager routines to cause a bundle deletion as soon it is fully closed (or on reboot) If this flag is passed to alp_bundle_delete(), then a lazy delete will always be used if the bundle is open, even if a force unregister is possible, and ALP_PRV_BUNDLE_FLAG_FORCE_UNREGISTER is supplied.
#define ALP_PRV_BUNDLE_FLAG_RECURSE   128
 Apply to alp_prv_bundle_open() flags to indicate that referenced bundles should be opened first.
#define ALP_PRV_BUNDLE_FLAG_APPLY_LOCAL_EFFECTS   256
 Apply to alp_prv_bundle_open() flags to indicate that local effects should be applied (updating gettext domain, setting java CLASSPATH, etc.
#define ALP_PRV_BUNDLE_FLAG_NESTED_TRANSACTION   512
 Flag to pass to some bundle manager routines to prevent them from starting/finishing a SQL transaction, so the caller can set up its own transaction.

Functions

alp_status_t alp_prv_bundle_init (gboolean server, const char *database, const char *live_database, const char *ipc_channel, const char *work_path, const char *rw_path, gboolean notify)
alp_status_t alp_prv_bundle_init_playground (gboolean server, const char *playground_name, gboolean notify)
alp_status_t alp_prv_bundle_fini (void)
alp_status_t alp_prv_bundle_wipe ()
int alp_prv_bundle_state ()
void alp_prv_bundle_dump ()
AlpBundleRef alp_prv_bundle_open (AlpBundle idx, int flags)
 Open a bundle Given a bundle index, open the bundle, making its contents available for use, until it is closed.
alp_status_t alp_prv_bundle_close (AlpBundleRef ref, int flags)
AlpBundle alp_prv_bundle_register_bundle (const char *id, const char *scheme, const char *store, int flags)
 Register a bundle with the bundle manager.
alp_status_t alp_prv_bundle_unregister_bundle (AlpBundle index, int flags)
 Unregister a bundle from the bundle manager.
alp_status_t alp_prv_bundle_add_store (const char *store, const char *arguments[])
 Creates a new store.
alp_status_t alp_prv_bundle_delete_store (const char *store)
 Remove a store. Any bundles on that store will be unregistered (not deleted).
void alp_prv_bundle_set_application (AlpBundle index)
 Set the bundle index to return as the index of the running application.
void alp_prv_bundle_set_application_ref (AlpBundleRef ref)
 Set which bundle to return as the index of the running application.
alp_status_t alp_prv_bundle_incref (AlpBundle index, int flags)
 Increment the refcount on a bundle.
alp_status_t alp_prv_bundle_decref (AlpBundle index, int flags)
 Decrement the refcount on an open bundle.
alp_status_t alp_prv_bundle_ref_incref (AlpBundleRef ref)
 Increment the refcount on an open bundle.
alp_status_t alp_prv_bundle_ref_decref (AlpBundleRef ref)
 Decrement the refcount on an open bundle.
GList * alp_prv_bundle_expand_searchpath (const char *path)
 Given a path including escapes, create a list of possible paths using the current locale.
GList * alp_prv_bundle_expand_locale (const char *locale)
 Given an XPG/4 locale name, break off each optional part in turn, giving a list of possible locale paths in preferred order Multiple entries may be separated by colons.
alp_status_t alp_prv_bundle_scan_store (const char *store, int wipe_invalid, int scheme_filter)
 Sync registration of all bundles on a store For bar files, this will scan the contents of the store's bar_folder, and register any bar folders or files which were not previously registered. Any missing folders or files will have their bundle unregistered.
alp_status_t alp_prv_bundle_rescan_volumes (void)
 Sync volumes and stores.
alp_status_t alp_prv_bundle_reg_notify (AlpBundle index, int flags)
alp_status_t alp_prv_bundle_unreg_notify (AlpBundle index, int flags)
alp_status_t alp_prv_bundle_deactivate (AlpBundle index, int flags)
void alp_prv_bundle_update_names (const char *name, int flags)
 Utility routine to update name table, and emit notifications about changes to named bundles.
alp_status_t alp_prv_bundle_force_close (AlpBundle index, int flags)
 Utility routine to close a bundle.
alp_status_t alp_prv_bundle_hold_notifications (gboolean hold)


Define Documentation

#define ALP_PRV_BUNDLE_FLAG_APPLY_LOCAL_EFFECTS   256
 

Apply to alp_prv_bundle_open() flags to indicate that local effects should be applied (updating gettext domain, setting java CLASSPATH, etc.

). This is automatically applied by alp_bundle_open()

#define ALP_PRV_BUNDLE_FLAG_DO_NOT_MAKE_STUB   32
 

Flag to pass to some bundle manager routines to prevent unregistration from creating a stub bundle for R/W data retention.

#define ALP_PRV_BUNDLE_FLAG_DO_NOT_NOTIFY   2
 

Flag to pass to some bundle manager routines to prevent notifications from being generated.

#define ALP_PRV_BUNDLE_FLAG_FORCE_DELETE   4
 

Flag to pass to some bundle manager routines to force a bundle deletion even if the bundle is in use.

#define ALP_PRV_BUNDLE_FLAG_FORCE_UNMOUNT   16
 

Flag to pass to some bundle manager routines to force an unmount even if the bundle is in use.

#define ALP_PRV_BUNDLE_FLAG_FORCE_UNREGISTER   8
 

Flag to pass to some bundle manager routines to force a bundle unregistration even if the bundle is in use.

#define ALP_PRV_BUNDLE_FLAG_LAZY_DELETE   64
 

Flag to pass to some bundle manager routines to cause a bundle deletion as soon it is fully closed (or on reboot) If this flag is passed to alp_bundle_delete(), then a lazy delete will always be used if the bundle is open, even if a force unregister is possible, and ALP_PRV_BUNDLE_FLAG_FORCE_UNREGISTER is supplied.

I.e., if you want a lazy delete only as a last resort, you'll have to try a separate FORCE_UNREGISTER delete before you use LAZY_DELETE.

#define ALP_PRV_BUNDLE_FLAG_NESTED_TRANSACTION   512
 

Flag to pass to some bundle manager routines to prevent them from starting/finishing a SQL transaction, so the caller can set up its own transaction.

#define ALP_PRV_BUNDLE_FLAG_RECURSE   128
 

Apply to alp_prv_bundle_open() flags to indicate that referenced bundles should be opened first.

This is automatically applied by alp_bundle_open().


Function Documentation

alp_status_t alp_prv_bundle_add_store const char *  store,
const char *  arguments[]
 

Creates a new store.

Create a new store of a given name. The store is defined by a set of arguments supplied as an array of const char*'s, which is terminated by a NULL pointer. The array is read as key/value pairs. Only particular keys are allowed.

Parameters:
[in] store Name of store
[in] arguments NULL terminated array of const char*, which will be read as key/value pairs
Returns:
Non-zero if the store was not created

alp_status_t alp_prv_bundle_close AlpBundleRef  ref,
int  flags
 

alp_status_t alp_prv_bundle_deactivate AlpBundle  index,
int  flags
 

Utility routine to deactivate a bundle before unregistering it.

alp_status_t alp_prv_bundle_decref AlpBundle  index,
int  flags
 

Decrement the refcount on an open bundle.

Decrement the refcount on a bundle: this undoes the effects of alp_prv_bundle_incref(). Note that this refcount is separate from those maintained by AlpBundleRefs. A bundle will not be considered closed by the system until all AlpBundleRefs on it are destroyed, in addition to not having any active alp_prv_bundle_incref()s.

alp_status_t alp_prv_bundle_delete_store const char *  store  ) 
 

Remove a store. Any bundles on that store will be unregistered (not deleted).

Parameters:
[in] store Name of store to delete
Returns:
Non-zero if the store was not deleted

void alp_prv_bundle_dump  ) 
 

Debug routine which will dump out the current bundle manager state via trace mgr

GList* alp_prv_bundle_expand_locale const char *  locale  ) 
 

Given an XPG/4 locale name, break off each optional part in turn, giving a list of possible locale paths in preferred order Multiple entries may be separated by colons.

GList* alp_prv_bundle_expand_searchpath const char *  path  ) 
 

Given a path including escapes, create a list of possible paths using the current locale.

Given a path containing zero or more paths separated by colons, containing escapes marked with carets, expand any ^l escapes with a complete set of locale folders -- the result is the list of expanded folders, in order.

alp_status_t alp_prv_bundle_fini void   ) 
 

Tear down bundle manager library within a process (either client or server). Is harmless if the bundle manager has not been initialized. Once torn down, the bundle manager will be capable of being reinitialized, potentially in a different state.

Returns:
Non-zero status if finalization failed

alp_status_t alp_prv_bundle_force_close AlpBundle  index,
int  flags
 

Utility routine to close a bundle.

Parameters:
[in] index Bundle to force closed
[in] flags 0 or selection from ALP_PRV_FLAG_*. Zero if successful

alp_status_t alp_prv_bundle_hold_notifications gboolean  hold  ) 
 

This routine can be used to ask the bundlemgr server to not hold notifications pending until such time as they are released. The pending notifications are held in a database table, and will persist along with other data.

Some notifications will not be delivered at all if they are held: the bundle delete, move, and copy notifications are synchronous and require real-time action. As such, it makes no sense to pend these, and they will simply be discarded.

Notification holds to not stack: holding a second time (or releasing twice) is an error.

Parameters:
[in] hold TRUE to start holding notifications, FALSE to release them Zero if successful

alp_status_t alp_prv_bundle_incref AlpBundle  index,
int  flags
 

Increment the refcount on a bundle.

Increment the refcount on a bundle: this works regardless of whether the bundle is already open, and effectively "pins" the bundle as open (and in-use) until a matching alp_prv_bundle_decref() is invoked. Note that this call does not track caller lifetime: if the calling process exits, the reference still remains on the bundle. The intended use of this is to pin a bundle in use, e.g., for system operations that want to allow a shared library in a bundle to be used by system executables.

alp_status_t alp_prv_bundle_init gboolean  server,
const char *  database,
const char *  live_database,
const char *  ipc_channel,
const char *  work_path,
const char *  rw_path,
gboolean  notify
 

Initialize the bundle manager library within the current process. This will fail if the bundle manager has already been initialized.

Parameters:
[in] server TRUE if the server side should be started, otherwise the client side
[in] database Name of file to use for database, or NULL to use default. (Default is hard-coded in platform/libraries/packagemgr/init.c). Note that this name is relative to $ALP_RUN_TOP.
[in] live_database Name of file to use for database containing live metadata, or NULL to use default. (Default is hard-coded in platform/libraries/packagemgr/init.c). Note that this name is relative to $ALP_RUN_TOP.
[in] ipc_channel Name of IPC channel to use, or NULL to use the default.
[in] work_path Override of working folder path (libs, links, etc.), or NULL to use the default
[in] rw_path Base of RW data folder, or NULL to use the default
[in] notify True if notifications should be sent out
Returns:
Non-zero status if init failed
Note:
In all normal situations, the developer will not need to explicitly invoke this routine, as it will be done for them by the NLP. There's normally no reason to override the database or channel name -- however, those overrides are useful for unit testing the bundle manager, as it allows a private PM state to be constructed, if a unique database and channel name are used.

alp_status_t alp_prv_bundle_init_playground gboolean  server,
const char *  playground_name,
gboolean  notify
 

Initialize the bundle manager library for private use, for testing purposes.

This routine invokes alp_prv_bundle_init() with a set of arguments derived from a "playground" name, which is used to distinguish one invocation from another. All files, paths, etc. will be places into /tmp using names which will not interfere with another playground, or with the primary ALP instantiation of the bundle manager.

Parameters:
[in] server Same as for alp_prv_bundle_init
[in] playground_name string which shouldn't contain slashes
[in] notify Same as for alp_prv_bundle_init

AlpBundleRef alp_prv_bundle_open AlpBundle  idx,
int  flags
 

Open a bundle Given a bundle index, open the bundle, making its contents available for use, until it is closed.

Parameters:
[in] idx Bundle index to open
[in] flags Possibly ALP_PRV_BUNDLE_FLAG_RECURSE and/or ALP_PRV_BUNDLE_FLAG_APPLY_LOCAL_EFFECTS

alp_status_t alp_prv_bundle_ref_decref AlpBundleRef  ref  ) 
 

Decrement the refcount on an open bundle.

Identical to alp_bundle_close(). Decrement the refcount on an open bundle, in symmetry to alp_prv_bundle_ref_incref(). In operation, this routine is identical to alp_bundle_close().

alp_status_t alp_prv_bundle_ref_incref AlpBundleRef  ref  ) 
 

Increment the refcount on an open bundle.

Increment the refcount on an open bundle: use this if a separate piece of code wishes to retain a reference to an open bundle ref after the original caller invokes alp_bundle_ref_close(). Note that it is also possible to call alp_bundle_open(alp_bundle_ref_bundle(bundleref)) to get a new bundleref on a bundle you already have a bundleref for. This will also serve as an identical refcount to keep the bundle open, but would give you a bundleref with a different value.

alp_status_t alp_prv_bundle_reg_notify AlpBundle  index,
int  flags
 

Utility routine to send out registration notification for a bundle which was registered with the ALP_PRV_FLAG_DO_NOT_NOTIFY. This also activates the bundle.

AlpBundle alp_prv_bundle_register_bundle const char *  id,
const char *  scheme,
const char *  store,
int  flags
 

Register a bundle with the bundle manager.

This puts information about a bundle into the bundle manager's database. This does not copy or move the bundle itself, it merely records information about the bundle (including extracting metadata from it). Notifications are sent about the registered bundle.

Parameters:
[in] id filename for bar/java bundle
[in] scheme valid scheme name (e.g., "bar")
[in] store valid store name (e.g., "internal"). This routine does not accept a NULL store.
[in] flags Normally 0. Flags of interest may include ALP_PRV_BUNDLE_FLAG_DO_NOT_NOTIFY.
Returns:
An AlpBundle index if the bundle was successfully registred, otherwise ALP_BUNDLE_NULL.

alp_status_t alp_prv_bundle_rescan_volumes void   ) 
 

Sync volumes and stores.

This routine will create stores for any volumes which don't have appropriate stores. Since this normally happens automatically through notifications, this is unlikely to be useful.

alp_status_t alp_prv_bundle_scan_store const char *  store,
int  wipe_invalid,
int  scheme_filter
 

Sync registration of all bundles on a store For bar files, this will scan the contents of the store's bar_folder, and register any bar folders or files which were not previously registered. Any missing folders or files will have their bundle unregistered.

Note that this routine will not detect changes to bundles, only new or old ones. to tell the bundle manager about changes, an explicit unregister/register sequence will be needed.

If wipe_invalid is true, then any file or folder which is not a valid bundle (or has a specific name indicating it was temporary material, introduced during installation) will be deleted outright.

Parameters:
[in] store Name of store to re-scan
[in] wipe_invalid 0 if invalid bundles aren't to be removed 1 if invalid bundles should be removed as the store setting wipe_by_default directs 2 if invalid bundles are always to be removed
[in] scheme_filter Bit set of schemes to not scan on named store. Or in value 1 to skip bars. Or in value 2 to skip ghost, etc.

void alp_prv_bundle_set_application AlpBundle  index  ) 
 

Set the bundle index to return as the index of the running application.

This will set the application index directly. If the application ref is requested, with alp_bundle_ref_application(), then this index will be opened, and the ref cached. If alp_prv_bundle_set_application() is reinvoked, the cached ref will be closed.

There is not an equivalent routine alp_prv_bundle_set_me(): the "me" functionality is implemented using alp_bundle_locate(dladdr(__builtin_return_address(0))) to locate the actual bundle containing the shared library which invoked the me() routine.

Parameters:
[in] index index to return from the alp_bundle_application() function. May be NULL.

void alp_prv_bundle_set_application_ref AlpBundleRef  ref  ) 
 

Set which bundle to return as the index of the running application.

This will set the application index from a ref. If the application ref is requested, with alp_bundle_ref_application() then this ref will be returned directly. If the application is changed, the supplied ref will be discarded. These routines will not incref or decref it.

There is not an equivalent routine alp_prv_bundle_set_me(): the "me" functionality is implemented using alp_bundle_locate(dladdr(__builtin_return_address(0))) to locate the actual bundle containing the shared library which invoked the me() routine.

Parameters:
[in] ref ref to return from the alp_bundle_ref_application() function. May be NULL.

int alp_prv_bundle_state  ) 
 

Return bundle manager state (initialized as server or client, or unitialized).

Returns:
0, 1, or 2

alp_status_t alp_prv_bundle_unreg_notify AlpBundle  index,
int  flags
 

Utility routine to send out unregistration notification for a bundle before actually unregistering it.

alp_status_t alp_prv_bundle_unregister_bundle AlpBundle  index,
int  flags
 

Unregister a bundle from the bundle manager.

This removes information about a bundle from the bundle manager's database. This does not delete the bundle itself, it only removes the informatino recorded into the database. Notifications are sent, as appropriate, about the unregistration.

Parameters:
[in] index bundle to unregister
[in] flags Normally 0. Flags of interest may include ALP_PRV_BUNDLE_FLAG_DO_NOT_NOTIFY, ALP_PRV_BUNDLE_FLAG_FORCE_UNREGISTER, ALP_PRV_BUNDLE_FLAG_FORCE_UNMOUNT, and ALP_PRV_BUNDLE_FLAG_DO_NOT_MAKE_STUB.
Returns:
Non-zero if the bundle wasn't successfully unregistered.

void alp_prv_bundle_update_names const char *  name,
int  flags
 

Utility routine to update name table, and emit notifications about changes to named bundles.

Update the names table: the mechanism to determine which package should answer to a particular name is not automatic, and requires invocation of this routine to update the names table which keeps track of that information.

Parameters:
[in] name If NULL, update the entire table for all names. Otherwise, only update the table for that specific name.
Updates to the table may remove one or more entries if there are no longer packages with such names.

alp_status_t alp_prv_bundle_wipe  ) 
 

Wipe out bundle manager tables, also creating those tables if necessary. The bundle manager initialization does not currently do this by itself, so the process responsible for booting an instance of the bundle manager should invoke this routine after initializing the bundle manager server.

Returns:
Non-zero status if finalization failed


Generated on Sat Dec 16 20:29:50 2006 for hiker-0.9 by  doxygen 1.4.4