Catalog Entry
From MightyWiki
Mighty Box use a catalog to manage collections of items. The catalog contains different entries of sub catalogs, and they may nest sub catalogs of their own, recursively. The catalog hierarchical structure allows us to delegate indexing of different data types to different catalogs. As an example, consider the next catalog:
Main catalog
- Files & Folders
- Desktop
- My Documents
- User Home
- Google
- Gmail Contacts
- Google Calendar
- Calendars
- Future Events
- Google Docs
- Documents
- Spreadsheets
- Presentations
Contents |
Catalog Entry Properties
Catalogs hold a Catalog Info which is basically a large dictionary with keys and values. It is designed for the only purpose of holding information regarding a single catalog. The information includes general info about the catalog (name, description, icon etc) plus all the information the engine needs to begin indexing the catalog (settings, source, etc..).
Persistence
MBCatalogInfo is designed to allow persistence. in other words, this object should be serializable for storage in text files mainly. so mightybox could persist use settings easily.
| Property | Type | Description |
|---|---|---|
| ID | String | Unique identifier for this catalog.
Example: itunesCatalog |
| Enabled | Bool | When a catalog entry is enabled it will be indexed regularly every 10 minutes, and a check will appear next to the entry in the list. |
| isVisible | Bool | Some entries are for core and plugins use alone. entries who are invisible benefit from regular indexing at preset intervals, and are hidden from the user's view (the do not see them in the catalog and may not control them). |
| ItemSource | String | The ID of the Items Source in charge of indexing the items for this entry.
Example: FileSystemSource |
| Settings | Dictionary | A dictionary of custom settings the source needs in order to index the entry
Example: below this text |
| Name | String | The name of this catalog entry. this string will appear in the catalog next to a check box
Example: Desktop |
| Icon | URI | Icon to appear next to the catalog name in the list |
| Children | List | List of sub catalogs
Example: for itunes plugins, this will be Playlists, Artists, Albums, Songs, Recent |
| Category | String | |
| CatalogPath | String | a path that defines the requested location for the catalog entry (By default it is "/" - which means by default entries are added under the root of the main catalog, but a developer may wish to place his catalog under an existing entry, e.g. Google Docs plugin might be placed under the existing Google sub-catalog by specifing catalogPath="/google/") |
The Main Catalog
Mighty Box Main Catalog is the ancestor of all catalogs. And all catalogs are simply entries in the main catalog. There is only one like it, and the engine holds a reference to it.
Indexing
Every 10 minutes, or on every other preset time interval, the engine initiates an indexing task on the main catalog which recursively initiates the indexing of all enabled sub catalogs. Catalogs that are disabled will not be indexed. Each catalog contain all the information it needs for indexing, although a catalog is not the object which perform the indexing directly.
The catalog retrieves a reference to the Item Source by id from the engine, and then query the source for items with the defined settings. The source returns a collection of items which are then cached inside the catalog as contents.
more in Catalog Indexing
Presets
The term presets entry describes special catalog entries, usually ones that the user cannot define on his own, that was created automatically by MightyBox or a plugin, and is usually not editable, or only partially editable. Examples: Delicious Tags, Google Docs, Gmail Contacts, are all presets. An example of a non-preset catalog is one created by the user, like a user-defined directory like "C:\IndexThisDir\Please\".
