The Hierarchy Content Provider

From Apache OpenOffice Wiki
Jump to: navigation, search



The Hierarchy Content Provider (HCP) implements a content provider for the Universal Content Broker (UCB). It provides access to a persistent, customizable hierarchy of contents.

HCP Contents

The HCP provides three different types of contents: link, folder and root folder.

  1. An HCP link is a content that "points" to another UCB content. It is always contained in an HCP Folder. An HCP Link has no children.
  2. An HCP folder is a container for other HCP Folders and HCP Links.
  3. There is at least one instance of an HCP root folder at a time. All other HCP contents are children of this folder. The HCP root folder contains HCP folders and links. It has the URL vnd.sun.star.hier:/.
A Hierarchy Content Provider

Creation of New HCP Content

HCP folders and the HCP root folder implement the interface com.sun.star.ucb.XContentCreator. HCP links and HCP folders support the command "insert" allowing all the HCP folders, as well as the HCP root folder to create new HCP folders and HCP links. To create a new child of an HCP folder:

  1. The parent folder creates a new content by calling its createNewContent() method. The content type for new folders is "application/vnd.sun.star.hier-folder". To create a new link, use the type string "application/vnd.sun.star.hier-link".
  2. Set a title at the new folder or link. The new child executes the "setPropertyValues" command that sets the property Title to a non-empty value. For a link, set the property TargetURL to a non-empty value.
  3. The new child, not the parent executes the command "insert". This commits the creation process.

URL Scheme for HCP Contents

Each HCP content has an identifier corresponding to the following scheme:

 vnd.sun.star.hier:/<path>

where <path> is a hierarchical path of the form

 <name>/<name>/.../<name>

where <name> is an encoded string according to the URL conventions.

Examples:

 vnd.sun.star.hier:/(The URL of the HCP Root Folder)
 
 vnd.sun.star.hier:/Bookmarks/Sun%20Microssystems%20Home%20Page
 
 vnd.sun.star.hier:/Workplace/Printers

Commands and Properties

UCB Type (returned by XContent::getContentType ) Properties Commands Interfaces
Link application/vnd.sun.star.hier-link [readonly] ContentType

[readonly] IsDocument
[readonly] IsFolder
Title
TargetURL

getCommandInfo

getPropertySetInfo
getPropertyValues
setPropertyValues
insert
delete

XTypeProvider

XServiceInfo
XComponent
XContent
XCommandProcessor
XPropertiesChangeNotifier
XPropertyContainer
XPropertySetInfoChangeNotifier
XCommandInfoChangeNotifier
XChild

Folder application/vnd.sun.star.hier-folder [readonly] ContentType

[readonly] IsDocument
[readonly] IsFolder
Title

getCommandInfo

getPropertySetInfo
getPropertyValues
setPropertyValues
insert
delete
open
transfer1

same as HCP Link, plus XContentCreator
Root Folder application/vnd.sun.star.hier-folder [readonly] ContentType

[readonly] IsDocument
[readonly] IsFolder
Title

getCommandInfo

getPropertySetInfo
getPropertyValues
setPropertyValues
open
transfer

same as HCP Link, plus XContentCreator

1 The "transfer" command only transfers HCP-contents to HCP folders. It does not handle contents with a URL scheme other then the HCP-URL-scheme.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages