It is intended that the Bundle Manager provide the mechanism to install and track applications for other executable systems, as a 68K compatiblity environment, or Java apps.
The Bundle Manager APIs operate on three levels:
Bundle Indexes: every bundle present in the system has a unique index number, and index values will not be re-used. These indexes are stored in variables of type AlpBundle. You'll use bundle indexes to iterate over available bundles, retrieve metadata, and generally work across multiple bundles.
Bundle Refs: in order to operate on the contents of a bundle, it must be opened. This gives back a handle, stored in a variable of type AlpBundleRef. Many operations can only be performed on a bundle if it is open. (Generally, the contents of a bundle are only accessible while it is open. Other information, such as metadata, can be accessed if it isn't open.) You'll use bundle refs to work within a particular bundle. Opening a bundle to get a ref is a potentially expensive operation (consuming time, memory, limited resources, etc.) so you want to do this only when you have to.
Bundle Names: each bundle has a supplied name of some sort. Bundles can be retrieved by name. However, there can be conflicts (bundles of the same name, perhaps installed on separate locations on the system). If there are conflicts, one bundle is always 'elected' to respond to the name, based on conflict resolution rules. The name of a bundle is text, and is intended as a symbolic reference. You'll use bundle names to retrieve a bundle by a symbolic name, probably as part of the your program's resource material.
There are some other concepts used by the Bundle Manager:
Schemes: each type of bundle is considered a distinct 'scheme'. The ALP native appliacation format is the 'bar' scheme.
Stores: each bundle is stored in a particular location (perhaps a folder in a file-system). A 'store' is a name for such a location.
Images: one of the characteristics of a bundle is that it can be put into a flattened format for transmitting off of the device, to a another device, "beamed" via IR, attached to e-mail, downloaded off the web, etc. An "image" is flat file containing a bundle.
Metadata: information about a bundle is called "metadata". This includes material retrieved from the bundle's header/manifest/etc., as well as dynamic information about the actual use of the bundle (ref-count, system paths, etc.) Metadata for a bundle can be retrieved without opening the bundle.
Properties: a property is generic (but structured) material associated with a bundle. In the case of ALP native bundles, the properties are retrieved from arbitray XML in the bundle's manifest. Properties are intended for customization by the developer, representing arbitray information about a bundle. Various ALP components may rely on particular properties, such as the Application Manager using the "application" property. Properties for a bundle can be retrieved without opening the bundle.
URLs: various naming concepts used by the Bundle Manager are designed to be represented as text, which can be fitted together into standard URL syntax. To give a quick example of some of the possibilities:
bar:com.access.apps.memo
bar:com.access.apps.memo/ListView.xml
bar:com.access.apps.memo/libalp_memo.so?main
bar:com.access.apps.memo/^p/application/icon
These represent scheme:name/path?entry, as will be described in the API reference. Generally, you don't need to use URLs with the Bundle Manager APIs, however there are a few routines which benefit from them, and give a lot of flexibility if they are used.
ALP native bundles
ALP native bundles are represented as folders or bar files which contain a Manifest.xml at its root.
The Manifest must have an outer-most <manifest> element, which can have these attributes:
name: this attribute is required, and contains the name of the bundle. It should not start with "bar:", as that part of the name is implied.
version: this attribute is optional, and if present should be an integer. If not present, the bundle version is considered to be 0.
arch: this attribute is optional, and if present should be a string indicating which architecture this bundle is intended for.
desired_filename: this attribute is optional, and if present indicates the file name which should be used to convert the bundle to an image file. The name given will have the ".bar" extension appended to it.
searchpath: this attribute is optional. If present, it should be a string in the form of a set of colon separate path prefixes, potentially containing "^l" to indicate a locale fill-point. This affects how localized resources are searched for. If not present, it defaults to /rsc/locale/^l/^f:/rsc/^f:/.
textdomain: this attribute is optional. If present, it defines the gettext omain applied by default to code running from this bundle. It should be a string potentially containing "^n" or "^N". The former is mapped to the bundle name without scheme ("com.companyname.appname"), while the latter is mapped to the complete bundle name ("bar:com.companyname.appname"). If not present, this attribute defaults to bar-^n.
bindtextdomain: this attribute is optional. If present, it defines the directory the gettext domain is bound to. It should be a string which defines a path relative to the base of the bundle. If not present, this attribute defaults to rsc.
The rest of the manifest should be in this form:
<manifest name="foo.bar" searchpath="/share/^l/:/"> <a> <b>1</b> <c>2</c> </a> <a> <x></x> </a> <other> <somevalue/> </other> </manifest>
Any elements within the manifest at the third level ("b", "c", and "x" in the above example) will be registered as bundle "properties", specifically:
property "a", #0, key "b" -> "1" key "c" -> "2" property "a", #1, key "x" -> "" property "other", #0, key "somevalue" -> ""
Any second-level elements not containing third-level elements, or any elements otherwise not conforming, will be ignored for the purpose of generating bundle properties. They won't prevent the bundle from being accepted, however.
Two properties have specific impact on the support for native bundles:
<reference>
<to>bundle-name</to>
<optional/>
</reference>
Any "reference" properties present will indicate that this bundle has a dependency on another bundle, particularly regarding use of shared libraries exported by the other bundle. The other bundle will automatically be opened when this bundle is opened. If the "optional" element isn't present, then this bundle cannot be opened if the one it is dependant on isn't present.
<export>
<library>somelib.so</library>
<as>lib_somelib.so.3</as>
</export>
Or
<export>
<classpath>lib/myclass.jar</classpath>
</export>
The "library" syntax will cause a library exported from this bundle to be available whenever the bundle is open. The optional "as" element changes the name used for the exported version of the library.
The "classpath" syntax adds an entry (either a folder or .jar file) to the CLASSPATH environment variable while the bundle is open.
Either "export" element can be repeated to export multiple things.
The resource files associated with ALP native bundles map directly to the contents of the bundle's folder. A path starting with a slash is a "fixed path", and matches only that exact file within the bundle: /rsc/MyView.xml. A path starting without a slash is looked up through the locale search path, which can translate "MyView.xml" into "/rsc/en_US/MyView.xml", as appropriate.
Note that the use of a leading slash to distinguish fixed paths from localized paths means that you might need to use two slashes in URL syntax:
bar:com.access.apps.memo//my/filename
There is one "magic" resource syntax specifically supported by ALP native bundles: the translation syntax is:
^t/Some string
This "path" will be retrieved by taking the part of the path after the slash, and feeding it through gettext() to perform a translation to the current locale. The result of the translation is considered the "contents" of the resource.
In URL syntax:
bar:com.access.apps.memo/^t/MemoPad
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 | |
| #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. | |
|
|
Value: ({ \
AlpBundleRef _ref; \
AlpBundleRef _me = alp_bundle_ref_me(); \
gchar * _pathname = alp_bundle_acquire_ro_pathname((url), &_ref, _me); \
GladeXML * _result = glade_xml_new_with_domain(_pathname, (root), alp_bundle_ref_gettextdomain(_ref)); \
g_free(_pathname); \
alp_bundle_close(_ref); \
_result; \
})
|
|
|
Use this define as the path to retrieve the manifest from a bar bundle.
|
|
|
Retrieve the dlsym() function pointer held by the closure, if any.
|
|
|
Retrieve the dlopen() handle held by the closure, if any.
|
|
|
Retrieve the R/O library path used by setting up the closure, if any.
|
|
|
Retrieve the AlpBundleRef held by the closure, if any.
|
|
|
After closure invocation, this will be zero on a successful invocation, less than zero for some internal errors, positive if an executable was invoked and terminated with a signal |
|
|
Retrieve the symbol name used by dlsym(), if any.
|
|
|
|
|
|
Prefix to resource names specific to finger-touch.
|
|
|
Flag to pass to some bundle manager routines to indicate all associated data should be removed.
|
|
|
Flag to pass to some bundle manager routines to cause an image install to overwrite a bundle of the same name, if it exists.
|
|
|
Utility macro to retrieve a gettext localization from the current bundle You might want to say:
#define _(x) alp_bundle_gettext(x)
|
|
|
Constant which is a NULL AlpBundle value.
|
|
|
The "application" manifest metadata indicates that the bundle contains an app.
|
|
|
Utility macro to retrieve a gettext localization
|
|
|
Utility macro to retrieve a gettext localization
|
|
|
|
|
|
One R/W sub-folder is automatically backed up to the desktop. If you want data to be backed up, please use the ALP_BUNDLE_RW_SAVED path: path = alp_bundle_rw_pathname(pkg, ALP_BUNDLE_RW_SAVED "mydata"); |
|
|
The common extension used for files containing ALP native bundles.
|
|
|
The common extension used for files containing GVM bundles.
|
|
|
The common extension used for files containing Java bundles.
|
|
|
The common mimetype used for files containing ALP native bundles.
|
|
|
The common mimetype used for files containing GVM bundles.
|
|
|
A less common mimetype used for files containing GVM bundles.
|
|
|
The common mimetype used for files containing Java bundles (JAR files).
|
|
|
The common mimetype used for files which are associated with Java bundles (JAD files).
|
|
|
The name of the native ALP bundle scheme, "bar".
|
|
|
The GVM bundle type.
|
|
|
The Java bundle type.
|
|
|
Name of notification sent when a bundle has is in the process of being copied. If a handler of this notification set bit 0 of the handled flag, the copy will be cancelled. |
|
|
Name of notification sent when a bundle has is in the process of being deleted. If a handler of this notification set bit 0 of the handled flag, the deletion will be cancelled. |
|
|
Name of notification sent when a bundle has is in the process of being moved. If a handler of this notification set bit 0 of the handled flag, the move will be cancelled. |
|
|
Name of notification sent when new bundle name has appeared. |
|
|
Name of notification sent when a bundle name has changed to refer to a different bundle. |
|
|
Name of notification sent when a bundle name has been removed. |
|
|
Name of notification sent when a bundle has been registered. |
|
|
Name of notification sent when all bundle manager state has been lost |
|
|
Name of notification sent when a store has been added |
|
|
Name of notification sent when a store has been removed |
|
|
Name of notification sent when a bundle has is in the process of being unregistered. |
|
|
Bundle Mgr operation canceled (eg. delete or copy).
|
|
|
Generic failure.
|
|
|
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. Do not attempt to manipulate AlpBundle values numerically: always use values returned from alp_bundle_by_name() or alp_bundle_search(). An AlpBundle may be "NULL", meaning that it is a not a valid bundle index. This condition can be tested with alp_bundle_is_NULL().
|
|
|
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. The structure contains some fields that should be filled in by the caller, and other fields which will be filled in by either of the image routines. Note that the fields filled in are only good for the duration of the image routine execution, and should only be retrieved from within the callback function. After the image routine returns, the fields will be zeroed. To use this structure, create an object of the right size, and set version to ALP_BUNDLE_PROGRESSIVE_DATA_VERSION. |
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Get a function pointer to a shared library via a URL.
bar:com.access.apps.calculator bar:com.access.apps.calculator/libalp_calculator.so A symbol name can be supplied with '?' syntax:
bar:bundle.name/lib_mylib.so?OtherEntry
The default symbol name is An alternate functionality is available: if the path names an executable instead of a shared library, the returned closure will invoke the executable as a child process. URL may be NULL, if a relativeRef is supplied. If this is the case, all defaults will be used.
AlpBundleRef myRef = alp_bundle_open(myBundleName); GClosure * myRoutine = alp_bundle_acquire_entrypoint("/somelib?routine", myRef); alp_bundle_close(myRef); g_closure_invoke(myRoutine, ...); g_close_unref(myRoutine); |
|
||||||||||||
|
Get an GIOChannel for a R/O file within a bundle via a URL. This routine returns the pathname to a bundle resource. This only operates for some bundle types, particularly ALP native bundles (bar). Other types may not support direct file access, preventing this routine from being used. In that case, please consider using other routines, such as acquire_ro_data or acquire_ro_tempfile.
AlpBundleRef myRef = alp_bundle_open(myBundleName); AlpBundleRef outRef; GIOChannel * channel = alp_bundle_acquire_ro_channel("/somefile", myRef); alp_bundle_close(myRef); // process channel g_io_channel_unref(channel); |
|
||||||||||||||||||||
|
Get a block of data from the contents of a R/O file within a bundle via a URL.
AlpBundleRef myRef = alp_bundle_open(myBundleName); AlpBundleRef outRef; gchar * data; alp_status_t result = alp_bundle_acquire_ro_data("/sometextfile", &data, NULL, myRef); // process data g_free(data); |
|
||||||||||||||||
|
Get a pathname to a R/O file within a bundle via a URL.
AlpBundleRef myRef = alp_bundle_open(myBundleName); AlpBundleRef outRef; gchar * pathname = alp_bundle_acquire_ro_pathname("/somefile", &outRef, myRef); alp_bundle_close(myRef); FILE * f = fopen(pathname, "r"); // process f flcose(f); alp_bundle_close(outRef); |
|
||||||||||||||||||||||||
|
Get a temporary file for the contents of a R/O file within a bundle via a URL.
AlpBundleRef myRef = alp_bundle_open(myBundleName); AlpBundleRef outRef; gchar * filename = alp_bundle_acquire_ro_tempfile("/somefile", &outRef, FALSE, NULL, myRef); alp_bundle_close(myRef); FILE * f = fopen(filename, "r"); // process f flcose(f); alp_bundle_close(outRef); |
|
|
Given a bundle index, return a list of property key hash tables or NULL if no properties exist.
GList *props = alp_bundle_all_properties (index); while (props) { GHashTable * prop = (GHashTable *)props->data; // find property name in hash table gchar *pname = (gchar *) g_hash_table_lookup (prop, ""); // iterate over keys in hash table g_hash_table_foreach(prop, do_something_for_each_key_value, NULL); // done with property hash table so free it g_hash_table_destroy (prop); // advance to next property item in list props = g_list_next(props); } g_list_free (props); // done with list |
|
|
Return a bundle index of the running application Returns a bundle index to the bundle which contains the launched ALP application.
|
|
|
Get bundle index for a given name.
|
|
|
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.
|
|
||||||||||||||||
|
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.
|
|
||||||||||||
|
Delete a bundle.
|
|
||||||||||||||||
|
Invoke a GClosure with command-line parameters from function parameters, return result This routine is a convenience function to invoke a GClosure with a set of parameters resembling the C 'main' entry sequence:
int (closure)(int argc, char *argv[], char *envp[]) This routine takes an arbitrary number of C parameters, packs them up and invokes the given closure. The result of the closure invocation is returned as an integer.
|
|
||||||||||||||||
|
Invoke a GClosure with command-line parameters from an array, return result. This routine is a convenience function to invoke a GClosure with a set of parameters resembling the C 'main' entry sequence:
int (closure)(int argc, char *argv[], char *envp[]) This routine takes argv and evnvp array pointers, packs up their contents and invokes the given closure. The result of the closure invocation is returned as an integer.
|
|
|
Returns status of last failing alp_bundle routine. Some Bundle Manager routines cannot return a detailed status value. Any Bundle Manager routine which fails (and returns and error value) will set an error status value which can be retrieved via this function. Successfull operations do not clear this status -- it is only modified by failing functions. This function should not be used except immediately after a failing Bundle Manager routine.
|
|
|
Shutdown (finalize) the bundle manager client library. If you explicitly initialized the bundle manager with alp_bundle_init(), you should use alp_bundle_fini(). This routine will decrement a refcount, and then shut down the bundle manager. |
|
||||||||||||||||||||||||
|
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.).
|
|
||||||||||||||||||||||||||||||||||||
|
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.
|
|
||||||||||||||||||||||||||||||||
|
Verify that a bundle image is somewhat undamaged, and get its metainfo. This routine will verify that an uninstalled/unregistered image of a bundle (i.e., the contents of a .jar, .bar, or .prc file) fulfills some basic consistency checks, and will retrieve the static metainformation from that bundle. This routine operates on a GIOChannel, so the bundle image can be read from a file, or from some other data-source, potentially a streaming source.
|
|
|
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. Use this routine if you want to support running in environments without an initialized bundle manager. If the bundle manager is already initialized (in any mode), this will increment a refcount. Thus, it's safe to use from arbitrary code. |
|
|
Test to see if an AlpBundle value is NULL.
|
|
|
Return a list of all bundle names in the system.
|
|
|
Return a list of all properties which are present in any bundle in the system.
|
|
|
Return a list of all valid bundle types the system supports. All of these return a GList of allocated strings.
|
|
|
Return a list of all stores current available in the system.
|
|
|
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).
|
|
|
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. This routine identifies the caller, and determines if that caller is in library loaded from a bundle. If the immediate caller is not in a bundle, NULL will be returned.
|
|
|
|
|
||||||||||||
|
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.
|
|
||||||||||||||||
|
Move a bundle to an active store This uses the bundle manager to move a registered bundle from one store to another.
|
|
|
Given a bundle index, this will retrieve the bundle's name
|
|
|
Open a bundle Given a bundle index, open the bundle, making its contents available for use, until it is closed. Note that opening a bundle will automatically make sure that any bundles it requires are also opened -- if any requirements are not met that are not optional, the open will fail. |
|
||||||||||||||||
|
Given a bundle index and a property name, return the key value hash table for that property.
|
|
||||||||||||||||||||
|
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.
|
|
|
Return a bundle ref to the running application Returns a bundle ref to the bundle which the running application was launched from.
|
|
|
Return a bundle index given a bundle ref Returns a bundle index for a supplied bundle ref.
|
|
|
Given a bundle ref, this will retrieve its domain for gettext Some bundle types (ALP native bundles -- "bar") support gettext for localization. For these types of bundles, you can retrieve a text domain.
|
|
|
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. This routine identifies the caller, and determines if that caller is in library loaded from a bundle. If the immediate caller is not in a bundle, NULL will be returned.
|
|
|
Given a bundle ref, this will retrieve the bundle's name
|
|
||||||||||||
|
Open a GIOChannel to retrieve a read-only file from a bundle. Given a pathname referring to a file existing within a bundle, this routine will open it for reading, and seeking if possible, and return a GIOChannel to the caller. If the pathname starts with a slash, then it is taken as a fixed path within the bundle. If it does not start with a slash, it will be looked up according to the bundle's search path.
|
|
||||||||||||||||||||
|
Retrieve a read-only file in a bundle as an allocated data block. Given a pathname referring to a file existing within a bundle, this routine will load the file contents into a newly allocated data block. If the pathname starts with a slash, then it is taken as a fixed path within the bundle. If it does not start with a slash, it will be looked up according to the bundle's search path.
|
|
||||||||||||||||
|
Retrieve list of resources within a bundle. Given a pathname referring to a folder within a bundle, this routine will return a list of all items in that folder inside the bundle.
|
|
||||||||||||
|
Retrieve a pathname for read-only file in a bundle. Given a pathname referring to a file existing within a bundle, this routine will convert it to an absolute path, suitable for use with normal C and POSIX calls. If the pathname starts with a slash, then it is taken as a fixed path within the bundle. If it does not start with a slash, it will be looked up according to the bundle's search path.
|
|
||||||||||||||||||||
|
Create a temporary file with the contents of a read-only file in a bundle. Given a pathname referring to a file existing within a bundle, this routine will return the name of a temporary file suitable for retrieving the contents. If the pathname starts with a slash, then it is taken as a fixed path within the bundle. If it does not start with a slash, it will be looked up according to the bundle's search path.
|
|
||||||||||||||||
|
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.
|
|
||||||||||||||||
|
Returns the path to the R/W data folder for a bundle. This routine will automatically make any folders necessary. I.e., a call to alp_bundle_rw_pathname(pkg, "a/b/c", TRUE); will gaurantee that the "a", and "a/b" folders exist, so that the "a/b/c" file can be created if it does not already exist.
|
|
||||||||||||
|
Given a bundle index, retrieve the matching saved global settings key Saved settings are global settings specific to a bundle which survive even when the associated bundle is deleted. The settings are related to bundle name, so any bundles of the same name share the same saved global settings.
|
|
||||||||||||
|
Given a filename and/or mimetype, determine what bundle scheme is appropriate. If there's enough information to make a guess about the type of bundle represented by a filename and/or mimetype, this routine will return the matching scheme name. The scheme name returned may not be correct, and this does not gaurantee that attempting to install such a named bundle with that scheme will succeed -- this is strictly a front-line convenience routine.
|
|
||||||||||||
|
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.
|
|
|
Return all data describing a scheme Given a scheme name, returns a hashtable containing keys and values describing the scheme. As an example, the "bar" scheme has "extension" and "mimetype" keys. The value for the "extension" key is ".bar".
|
|
||||||||||||||||||||||||
|
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.
|
|
|
Retrieve information about a store.
|
|
||||||||||||
|
Retrieve a particular information value about a store.
|
|
|
Releases any storage associated with a tempfile returned from alp_bundle_ref_ro_tempfile(). This routine should be used when you are done with a tempfile. It'll take care of releasing any storage (file, memory, heap, etc.) associated with a tempfile.
|
|
||||||||||||
|
Given a bundle index, retrieve the matching unsaved global settings key Unsaved settings are global settings specific to a bundle which are deleted when the associated bundle is deleted. The settings are related to bundle name, so any bundles of the same name share the same unsaved global settings.
|
Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.