include/hiker/bundlemgr.h File Reference

#include <hiker/types.h>
#include <glib.h>
#include <glib-object.h>

Go to the source code of this file.

Data Structures

struct  _AlpBundle
 Data type used to refer to a particular bundle The AlpBundle type is a short integral type used to index available bundles. An AlpBundle value will be good until (reset?). (If a bundle is deleted, the AlpBundle value will not be immediately reused). Any routine called with an invalid AlpBundle value will fail. Using an invalid AlpBundle value will not cause any alp_bundle routine to crash. More...
struct  _AlpBundleProgressiveData
struct  _AlpNotifyEventBundleCopy
struct  _AlpNotifyEventBundleDelete
struct  _AlpNotifyEventBundleMove
struct  _AlpNotifyEventBundleNameAdded
struct  _AlpNotifyEventBundleNameChanged
struct  _AlpNotifyEventBundleNameRemoved
struct  _AlpNotifyEventBundleRegister
struct  _AlpNotifyEventBundleResetEverything
struct  _AlpNotifyEventBundleUnregister
struct  AlpBundleEntrypointClosure

Miscellaneous and localization assistance

#define alp_bundle_acquire_glade_xml(url, root)
#define ALP_BUNDLE_FINGERTOUCH_RSC_PREFIX   "finger-"
 Prefix to resource names specific to finger-touch.
#define ALP_BUNDLE_FLAG_DELETE_EVERYTHING   1
 Flag to pass to some bundle manager routines to indicate all associated data should be removed.
#define ALP_BUNDLE_FLAG_OVERWRITE_DUPLICATE   128
 Flag to pass to some bundle manager routines to cause an image install to overwrite a bundle of the same name, if it exists.
#define alp_bundle_gettext(text)   dgettext(alp_bundle_ref_gettextdomain(alp_bundle_ref_me()), (text))
#define alp_bundle_ref_cgettext(ref, text, category)   dcgettext(alp_bundle_ref_gettextdomain((ref)), (text), (category)) \
#define alp_bundle_ref_gettext(ref, text)   dgettext(alp_bundle_ref_gettextdomain((ref)), (text)) \
alp_status_t alp_bundle_error (void)
gchar * alp_bundle_name (AlpBundle index)
const char * alp_bundle_ref_gettextdomain (AlpBundleRef ref)
const char * alp_bundle_ref_name (AlpBundleRef ref)
gchar * alp_bundle_saved_settings (AlpBundle index, const char *key)
gchar * alp_bundle_unsaved_settings (AlpBundle index, const char *key)

Operations on BundleRefs

#define ALP_BUNDLE_BAR_MANIFEST   "/Manifest.xml"
 Use this define as the path to retrieve the manifest from a bar bundle.
alp_status_t alp_bundle_close (AlpBundleRef ref)
 Close an open bundle Close a bundleref. No further access through the bundleref should be attempted. If all references to a bundle are closed, the bundle manager may disconnect or otherwise make the bundle unavailable for operations. Pathnames to ro bundle files may not function once it is closed.
AlpBundleRef alp_bundle_open (AlpBundle idx)
 Open a bundle Given a bundle index, open the bundle, making its contents available for use, until it is closed.
AlpBundleRef alp_bundle_ref_application ()
 Return a bundle ref to the running application Returns a bundle ref to the bundle which the running application was launched from.
AlpBundle alp_bundle_ref_bundle (AlpBundleRef ref)
 Return a bundle index given a bundle ref Returns a bundle index for a supplied bundle ref.
AlpBundleRef alp_bundle_ref_me ()
 Return a bundle ref to the running code Returns a bundle ref to the bundle which contains the code which invoked this function. Note that this function explicitly detects what routine it is being called from. Don't expect it to operate from a utility subroutine -- consider using a macro.
GIOChannel * alp_bundle_ref_ro_channel (AlpBundleRef ref, const char *path)
 Open a GIOChannel to retrieve a read-only file from a bundle.
alp_status_t alp_bundle_ref_ro_data (AlpBundleRef ref, const char *path, gchar **data, size_t *length)
 Retrieve a read-only file in a bundle as an allocated data block.
GList * alp_bundle_ref_ro_directory (AlpBundleRef ref, const char *path, gboolean recurse)
 Retrieve list of resources within a bundle.
gchar * alp_bundle_ref_ro_pathname (AlpBundleRef ref, const char *path)
 Retrieve a pathname for read-only file in a bundle.
gchar * alp_bundle_ref_ro_tempfile (AlpBundleRef ref, const char *path, gboolean keep, const char *ext)
 Create a temporary file with the contents of a read-only file in a bundle.
alp_status_t alp_bundle_tempfile_release (gchar *tempfile)
 Releases any storage associated with a tempfile returned from alp_bundle_ref_ro_tempfile().

Acquisition operations

These are all implemented as composites of other routines, really just conveniences.

The URLs allowed by these routines may have a scheme and bundle name and/or a path and/or a search entry for entrypoint selection.

That is, you can say:

        bar:bundle.name/resource/path
        /resource/path
        bar:bundle.name
        bar:bundle.name/library?function

An additional path syntax is available from the acquire routines to use bundle properties:

        bar:bundle.name/^p/application/icon

This has the affect of retrieving the value of the icon key of the application property of the bar:bundle.name bundle, and using that value as the name of another resource.

#define ALP_BUNDLE_ENTRYPOINT_CLOSURE_CALLBACK(closure)   (((AlpBundleEntrypointClosure*)(closure))->callback)
 Retrieve the dlsym() function pointer held by the closure, if any.
#define ALP_BUNDLE_ENTRYPOINT_CLOSURE_DLHANDLE(closure)   (((AlpBundleEntrypointClosure*)(closure))->dlhandle)
 Retrieve the dlopen() handle held by the closure, if any.
#define ALP_BUNDLE_ENTRYPOINT_CLOSURE_PATH(closure)   (((AlpBundleEntrypointClosure*)(closure))->path)
 Retrieve the R/O library path used by setting up the closure, if any.
#define ALP_BUNDLE_ENTRYPOINT_CLOSURE_REF(closure)   (((AlpBundleEntrypointClosure*)(closure))->ref)
 Retrieve the AlpBundleRef held by the closure, if any.
#define ALP_BUNDLE_ENTRYPOINT_CLOSURE_RESULT_SIGNAL(closure)   (((AlpBundleEntrypointClosure*)(closure))->result_signal)
#define ALP_BUNDLE_ENTRYPOINT_CLOSURE_SYM(closure)   (((AlpBundleEntrypointClosure*)(closure))->sym)
 Retrieve the symbol name used by dlsym(), if any.
#define ALP_BUNDLE_ENTRYPOINT_CLOSURE_VERSION   1
GClosure * alp_bundle_acquire_entrypoint (const char *url, AlpBundleRef relativeRef)
 Get a function pointer to a shared library via a URL.
GIOChannel * alp_bundle_acquire_ro_channel (const char *url, AlpBundleRef relativeRef)
 Get an GIOChannel for a R/O file within a bundle via a URL.
alp_status_t alp_bundle_acquire_ro_data (const char *url, gchar **data, size_t *length, AlpBundleRef relativeRef)
 Get a block of data from the contents of a R/O file within a bundle via a URL.
gchar * alp_bundle_acquire_ro_pathname (const char *url, AlpBundleRef *openRef, AlpBundleRef relativeRef)
 Get a pathname to a R/O file within a bundle via a URL.
gchar * alp_bundle_acquire_ro_tempfile (const char *url, AlpBundleRef *openRef, gboolean keep, const char *ext, AlpBundleRef relativeRef)
 Get a temporary file for the contents of a R/O file within a bundle via a URL.
int alp_bundle_entrypoint_closure_execl (GClosure *closure, const char *arg,...)
int alp_bundle_entrypoint_closure_execve (GClosure *closure, char *const argv[], char *const envp[])
 Invoke a GClosure with command-line parameters from an array, return result.

Data types

#define ALP_BUNDLE_NULL   ((struct _AlpBundle){0})
 Constant which is a NULL AlpBundle value.
#define ALP_BUNDLE_REF_NULL   (NULL)
#define ALP_STATUS_BUNDLEMGR_CANCELED   (ALP_CLASS_BUNDLE | 0x00020000)
 Bundle Mgr operation canceled (eg. delete or copy).
#define ALP_STATUS_BUNDLEMGR_FAILURE   (ALP_CLASS_BUNDLE | 0x00010000)
 Generic failure.
typedef _AlpBundle AlpBundle
 Data type used to refer to a particular bundle The AlpBundle type is a short integral type used to index available bundles. An AlpBundle value will be good until (reset?). (If a bundle is deleted, the AlpBundle value will not be immediately reused). Any routine called with an invalid AlpBundle value will fail. Using an invalid AlpBundle value will not cause any alp_bundle routine to crash.
typedef _AlpBundleRef * AlpBundleRef
 Data type used as handle to an open bundle The AlpBundleRef type is a pointer to an opaque type, used as a handle to open bundles.
static gboolean alp_bundle_is_NULL (AlpBundle index)
 Test to see if an AlpBundle value is NULL.

Manifest Metadata

These constants define the names of common manifest metadata property lists.

#define ALP_BUNDLE_PROPERTY_APPLICATION   "application"
 The "application" manifest metadata indicates that the bundle contains an app.

Operations on Bundles

#define ALP_BUNDLE_RW_SAVED   "/saved/"
GList * alp_bundle_all_properties (AlpBundle index)
 Given a bundle index, return a list of property key hash tables or NULL if no properties exist.
AlpBundle alp_bundle_application ()
 Return a bundle index of the running application Returns a bundle index to the bundle which contains the launched ALP application.
AlpBundle alp_bundle_copy_to_store (AlpBundle bundle, const char *store, int flags)
 Copy a bundle to an active store This uses the bundle manager to copy a registered bundle from one store to another. The new copy will be registered along with the old one -- only one will have its name registered, and which one will depend on the particular stores.
alp_status_t alp_bundle_delete (AlpBundle bundle, int everything)
 Delete a bundle.
AlpBundle alp_bundle_locate_file (const char *filename)
 Identify open bundle containing a file Given a POSIX file path, this will attempt to identify an open bundle which matches that path. The supplied path can be the root of a folder, or any file or folder name within that folder (existing or not).
AlpBundle alp_bundle_me ()
 Return a bundle index of the bundle containing the running code Returns a bundle index to the bundle which contains the code which invoked this function. Note that this function explicitly detects what routine it is being called from. Don't expect it to operate from a utility subroutine -- consider using a macro.
GHashTable * alp_bundle_metadata (AlpBundle)
gchar * alp_bundle_metadata_value (AlpBundle index, const char *key)
 Return a the value for a metadata key of a bundle Given a bundle index and a key name, return the value of that key as an allocated string, or NULL if there is no such key.
AlpBundle alp_bundle_move_to_store (AlpBundle bundle, const char *store, int flags)
 Move a bundle to an active store This uses the bundle manager to move a registered bundle from one store to another.
GHashTable * alp_bundle_properties (AlpBundle index, const char *property, int which)
 Given a bundle index and a property name, return the key value hash table for that property.
gchar * alp_bundle_property_value (AlpBundle index, const char *property, int which, const char *key)
 Given a bundle index and a key name, return the value of that key as an allocated string, or NULL if there is no such key.
alp_status_t alp_bundle_rw_delete (AlpBundle index, const char *folder_path, gboolean itself)
 Delete some or all files within a bundles R/W data folder As a convenience, you can easily delete all of the R/W data for a bundle, or a subset of that data, using this routine. If the supplied file_path is empty (""), then all data will be removed, otherwise only data in a folder matching the supplied path.
gchar * alp_bundle_rw_pathname (AlpBundle index, const char *file_path, gboolean vivify)
 Returns the path to the R/W data folder for a bundle.

Bundle Types

These constants define the schemes for various bundle types.

#define ALP_BUNDLE_SCHEME_EXTENSION_BAR   ".bar"
 The common extension used for files containing ALP native bundles.
#define ALP_BUNDLE_SCHEME_EXTENSION_GVM   ".prc"
 The common extension used for files containing GVM bundles.
#define ALP_BUNDLE_SCHEME_EXTENSION_JAVA   ".jar"
 The common extension used for files containing Java bundles.
#define ALP_BUNDLE_SCHEME_MIMETYPE_BAR   "x-application/access-bar"
 The common mimetype used for files containing ALP native bundles.
#define ALP_BUNDLE_SCHEME_MIMETYPE_GVM   "application/vnd.palm"
 The common mimetype used for files containing GVM bundles.
#define ALP_BUNDLE_SCHEME_MIMETYPE_GVM_2   "application/x-pilot"
 A less common mimetype used for files containing GVM bundles.
#define ALP_BUNDLE_SCHEME_MIMETYPE_JAVA   "application/java-archive"
 The common mimetype used for files containing Java bundles (JAR files).
#define ALP_BUNDLE_SCHEME_MIMETYPE_JAVA_2   "text/vnd.sun.j2me.app-descriptor"
 The common mimetype used for files which are associated with Java bundles (JAD files).
#define ALP_BUNDLE_TYPE_BAR   "bar"
 The name of the native ALP bundle scheme, "bar".
#define ALP_BUNDLE_TYPE_GVM   "GHost"
 The GVM bundle type.
#define ALP_BUNDLE_TYPE_JAVA   "java"
 The Java bundle type.

Notifications

#define ALP_NOTIFY_EVENT_BUNDLE_COPY   "/alp/bundlemgr/copy_bundle"
#define ALP_NOTIFY_EVENT_BUNDLE_DELETE   "/alp/bundlemgr/delete_bundle"
#define ALP_NOTIFY_EVENT_BUNDLE_MOVE   "/alp/bundlemgr/move_bundle"
#define ALP_NOTIFY_EVENT_BUNDLE_NAME_ADDED   "/alp/bundlemgr/name_added"
#define ALP_NOTIFY_EVENT_BUNDLE_NAME_CHANGED   "/alp/bundlemgr/name_changed"
#define ALP_NOTIFY_EVENT_BUNDLE_NAME_REMOVED   "/alp/bundlemgr/name_removed"
#define ALP_NOTIFY_EVENT_BUNDLE_REGISTER   "/alp/bundlemgr/register_bundle"
#define ALP_NOTIFY_EVENT_BUNDLE_RESET_EVERYTHING   "/alp/bundlemgr/reset_everything"
#define ALP_NOTIFY_EVENT_BUNDLE_STORE_ADDED   "/alp/bundlemgr/store_added"
#define ALP_NOTIFY_EVENT_BUNDLE_STORE_REMOVED   "/alp/bundlemgr/store_removed"
#define ALP_NOTIFY_EVENT_BUNDLE_UNREGISTER   "/alp/bundlemgr/unregister_bundle"
typedef _AlpNotifyEventBundleCopy AlpNotifyEventBundleCopy
typedef _AlpNotifyEventBundleDelete AlpNotifyEventBundleDelete
typedef _AlpNotifyEventBundleMove AlpNotifyEventBundleMove
typedef _AlpNotifyEventBundleNameAdded AlpNotifyEventBundleNameAdded
typedef _AlpNotifyEventBundleNameChanged AlpNotifyEventBundleNameChanged
typedef _AlpNotifyEventBundleNameRemoved AlpNotifyEventBundleNameRemoved
typedef _AlpNotifyEventBundleRegister AlpNotifyEventBundleRegister
typedef _AlpNotifyEventBundleResetEverything AlpNotifyEventBundleResetEverything
typedef char AlpNotifyEventBundleStoreAdded []
typedef char AlpNotifyEventBundleStoreRemoved []
typedef _AlpNotifyEventBundleUnregister AlpNotifyEventBundleUnregister

Operations on Images

typedef _AlpBundleProgressiveData AlpBundleProgressiveData
 Tracks data for callback regarding progression of install or archive of bundle images An object of type AlpBundleProgressiveData is used to indicate to the alp_bundle_image_install() and alp_bundle_image_archive() routines that they should periodically invoke a callback function to let their caller know that the image creation/transfer process is proceeding.
enum  { ALP_BUNDLE_PROGRESSIVE_DATA_VERSION = 1 }
alp_status_t alp_bundle_image_archive (AlpBundle index, char **desired_filename, char **desired_mimetype, GIOChannel *image, AlpBundleProgressiveData *progress)
 Archive a bundle to an I/O channel Given a bundle, and a data sink specified by a GIOChannel, this routine will flatten a bundle into an image, and write it to that channel. This is the fundamental routine used to prepare bundles for sending outside the device. (e-mail, beaming, files, etc.).
AlpBundle alp_bundle_image_install (const char *provide_filename, const char *provide_mimetype, GIOChannel *image, const char *destination_store, int flags, GHashTable **metadata, GHashTable **properties, AlpBundleProgressiveData *progress)
 Install a bundle into the system from an I/O channel Given a data source specified by a GIOChannel, this routine will read a bundle from that source, and install it into a store in the system. This is the fundamental routine used to install new programs.
int alp_bundle_image_verify (const char *provide_filename, const char *provide_mimetype, GIOChannel *image, gboolean full_check, GHashTable **metadata, GHashTable **properties, AlpBundleProgressiveData *progress)
 Verify that a bundle image is somewhat undamaged, and get its metainfo.

Finding bundles

AlpBundle alp_bundle_by_name (const char *name)
 Get bundle index for a given name.
GList * alp_bundle_list_names (void)
 Return a list of all bundle names in the system.
GList * alp_bundle_list_properties (void)
 Return a list of all properties which are present in any bundle in the system.
GList * alp_bundle_list_schemes (void)
 Return a list of all valid bundle types the system supports.
GList * alp_bundle_list_stores (void)
 Return a list of all stores current available in the system.
GArray * alp_bundle_search (const char *name, gboolean named, const char *scheme, const char *store, const char *property)
 Search for bundles that match a set of criteria, including name, store, properties, type. This function returns zero, one, or more AlpBundle indexes for bundle which match a set of criteria. This is the fundamental routine for finding AlpBundle identifiers if you can't use alp_bundle_by_name(). If you want to retrieve all valid bundle indexes, use this routine with a set of NULL parameters.

Initialization

alp_status_t alp_bundle_fini (void)
 Shutdown (finalize) the bundle manager client library.
alp_status_t alp_bundle_init (void)
 Initialize the bundle manager client library. Needed if you are not running as an ALP application The bundle manager needs to be initialized before you can do anything with it. ALP applications normally run in an environment where the bundle manager is already initialized.

Scheme routines

gchar * alp_bundle_scheme_identify (const char *filename, const char *mimetype)
 Given a filename and/or mimetype, determine what bundle scheme is appropriate.
gchar * alp_bundle_scheme_value (const char *scheme, const char *key)
 Return a the value for a scheme description key Given a scheme name and a key name, return the value of that key as an allocated string, or NULL if there is no such key.
GHashTable * alp_bundle_scheme_values (const char *scheme)
 Return all data describing a scheme Given a scheme name, returns a hashtable containing keys and values describing the scheme.

Operations on Stores

GHashTable * alp_bundle_store (const char *store)
 Retrieve information about a store.
gchar * alp_bundle_store_value (const char *store, const char *key)
 Retrieve a particular information value about a store.


Generated on Wed Jul 30 07:06:39 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.