User:Alsroot/trash/Object Bundles: Difference between revisions

Line 26: Line 26:
This feature is a first approach to unified format for all types of bundles(in 0.86 it will support only Journal entries and new library bundles).
This feature is a first approach to unified format for all types of bundles(in 0.86 it will support only Journal entries and new library bundles).


=== Bundle files hierarchy ===
Object bundle should have ''METADATA'' file in top directory of .xo bundle.


* ''MANIFEST'' EOL-terminalted list of files inside bundle
=== METADATA file ===
* ''METADATA'' file in [http://docs.python.org/library/configparser.html INI] format which describes bundle


=== METADATA file ===
This file is in [http://docs.python.org/library/configparser.html INI] format which describes how to setup bundle.


Object bundle can be installed to Journal in two forms:
Object bundle can be installed to Journal in two forms:
* files from bundle will be unpacked and installed as separate Journal entries, bundle itself will be removed(similar to .xoj)<br>final Journal entries can have ''activity'' field, so they are regular Journal entries that imported to Journal(w/o ''activity'' field) or created by activities(with ''activity'' field)<br>''METADATA'' should not contain ''[Entry]'' section
* files from bundle will be unpacked and installed as separate Journal entries, bundle itself will be removed(similar to .xoj)<br>final Journal entries can have ''activity'' field, so they are regular Journal entries that imported to Journal(w/o ''activity'' field) or created by activities(with ''activity'' field)<br>''METADATA'' should contain ''[Entry]'' sections for each Journal entry<br>if bundle has more then one entry, sections should be parted by different suffixes e.g. ''[Entry2]'', ''[Entry.additional]'' etc.
* bundles will be installed as a composite object i.e. as a directory of packaged to the bundle files that are represented by one Journal entry<br>final Journal entry can't have ''activity'' field<br>''METADATA'' should contain ''[Entry]'' section
* bundle will be installed as a composite object i.e. as a directory of packaged to the bundle files that are represented by one Journal entry<br>final Journal entry can't have ''activity'' field<br>''METADATA'' should contain only one ''[Bundle]'' section


Any field in METADATA file can have ''_file'' suffix, in that case content of this field(substring w/o ''_file'' suffix) will be fetched from file inside of the bundle.
METADATA file can have one or several sections(depends on installation method) that describe metadata fields of final entry(ies) in Journal.
 
==== [Metadata] section ====
 
This section is mandatory. It describes Datastore metadata fields of final entry in Journal. If bundle is composite(section ''[Entry]'' presents) this section defines Journal entry to represent composite object, otherwise Journal entry for ''[Metadata]/entry'' file.


{| border=1 cellpadding=3 style="border: 1px solid white; border-collapse: collapse; background: #e3e4e5;"
{| border=1 cellpadding=3 style="border: 1px solid white; border-collapse: collapse; background: #e3e4e5;"
Line 66: Line 61:
|}
|}


METADATA file could have several ''[Manifest]'' sections, in that case they should be parted by different suffixes e.g. ''[Manifest2]'', ''[Manifest.additional]'' etc. Multi-object bundles could be utilized in >0.86 for collections of objects or actions.
Any field in ''METADATA'' file can have ''_file'' suffix, in that case content of this field(substring w/o ''_file'' suffix) will be fetched from file inside of the bundle.
 
==== [Entry] section ====
 
If this section exists bundle will be installed as a composite object i.e. all bundle files will be represented by one Journal entry(could be useful in case of libraries).
 
{| border=1 cellpadding=3 style="border: 1px solid white; border-collapse: collapse; background: #e3e4e5;"
|-style="background:#787878; color: white;"
! Field
! Flags
! Notes
|-
| ''exec''
| optional
| how to activate Journal entry, overrides ''[Metadata]'' fields(like ''activity'' and ''mime_type'') of ''[Metadata]/entry'' file
|-
|}
 
=== MANIFEST file ===
 
File which contains a new-line-terminated list of file names inside bundle.


== Benefit to Sugar ==
== Benefit to Sugar ==