Services and Interfaces

From Apache OpenOffice Wiki
Jump to: navigation, search



Each UCB content implements the service com.sun.star.ucb.Content. The UCB content service interfaces include:

The interface com.sun.star.ucb.XContent provides access to a content's type and identifier. The com.sun.star.ucb.XCommandProcessor executes commands at the content object, such as opening a content that provides access to the content's data stream or its children, and setting and getting property values. The interface com.sun.star.beans.XPropertyContainer adds new properties to a content or removes properties that were previously added using this interface. The properties added are always made persistent.

Documentation caution.png If you change the set of properties by adding or removing properties, the cache of scripting languages, such as Apache OpenOffice Basic might not reflect these changes. Thus, use the get/set methods to access the properties in scripting languages rather than relying on their automatic recognition of properties.

The com.sun.star.ucb.XContentCreator interface is for creating new resources, such as a new folder in the local file system. Not all content implementation can create new resources, therefore this interface is optional. The optional interface com.sun.star.container.XChild provides access to the content object's parent content object. Not all data sources represented by content implementations are organized hierarchically, therefore a parent cannot always be specified.

Documentation note.png The interface com.sun.star.ucb.XCommandProcessor2 is the improved version of com.sun.star.ucb.XCommandProcessor. It has been introduced to release command identifiers retrieved through createCommandIdentifier() at the XCommandProcessor interface. To avoid resource leaks, use XCommandProcessor2.

Some content commands defined by the UCB API are listed in the following table:

Selected Command Names for com.sun.star.ucb.XCommandProcessor
"getCommandInfo" Obtains an interface that queries information on commands supported by a content.
"getPropertySetInfo" Obtains an interface that queries information on properties supported by a content.
"getPropertyValues" Obtains property values from the content.
"setPropertyValues" Sets property values of the content.
"open" Gives access to the data stream of a document or to the children of a folder.
"delete" Destroys a resource.
"insert" Commits newly-created resources. Writes new data stream of existing document resources.
"transfer" Copies or moves a content object.


Some interesting content properties defined by the UCB API:

Selected Properties of UCB Contents
ContentType Contains a unique(!), read-only type string for the content, for example, "application/vnd.sun.star.hierarchy-link". This is not the Media-Type!
IsFolder Indicates whether a content can contain other contents.
IsDocument Indicates whether a content is a document.
Title Contains the title of an object, for example, the name of a file.
DateCreated Contains the date and time the object was created.
DateModified Contains the date and time the object was last modified.
MediaType Contains the media type (MIME type) of a content.
Size Contains the size, usually in bytes, of an object.

Every UCP implements the service com.sun.star.ucb.ContentProvider. The UCP core interface is com.sun.star.ucb.XContentProvider. This interface facilitates the creation of content objects based on a given content identifier.

A UCB implements the service com.sun.star.ucb.UniversalContentBroker. The UCB core interfaces are com.sun.star.ucb.XContentProvider and com.sun.star.ucb.XContentProviderManager. The com.sun.star.ucb.XContentProvider interface implementation delegates requests to create content objects to the content provider registered for the supplied content identifier. The com.sun.star.ucb.XContentProviderManager interface is used to query the UCPs registered with a given UCB, and to register and remove UCPs.

Documentation note.png A specification for the implementation for each of the UCPs, including URL schemes, content types, supported commands and properties is located in Universal Content Providers.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages