The File Content Provider

From Apache OpenOffice Wiki
Jump to: navigation, search



The File Content Provider (FCP), a content provider for the Universal Content Broker (UCB), provides access to the local file system by providing file content objects that represent a directory or a file in the local file system. The FCP is able to restrict access to the file system to a number of directories shown to the client under configurable aliases.

File Contents

The FCP provides content representing a directory or file in the local file system.

  1. A directory contains other directories or files.
  2. A file is a container for document data or content. The FCP can not determine the MediaType property of a file content.

Creation of New File Contents

A content representing directories implements the interface com.sun.star.ucb.XContentCreator. A file content object supports the command "insert". To create a new directory or file in a directory:

  1. The parent directory creates a new content by calling its createNewContent() method. The content type for new folders is "application/vnd.sun.staroffice.fsys-folder". To create a new file, use the type string "application/vnd.sun.staroffice.fsys-file". A new file content object is the return value.
  2. Set a title at the new file content object. The new child executes a "setPropertyValues" command that sets the property Title to a non-empty value.
  3. The new file content object, not the parent, executes the command "insert". This creates the corresponding physical file or directory. For files, supply the implementation of an com.sun.star.io.XInputStream with the command's parameters that provide access to the stream data.

URL Schemes for File Contents

The file URL Scheme

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

 file:///<path>

where <path> is a hierarchical path of the form

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

The first part of <path> ( <name1> ) is not required to denote a physically existing directory, but may be remapped to such a directory. If this is done, the FCP refuses file access for any URL whose <name1>-part is not an element of a predefined list of alias names.

The vnd.sun.star.wfs URL Scheme

In the Sun ONE Webtop, the server-side file system is addressed with vnd.sun.star.wfs URLs. The wfs stands for Webtop File System. The file URL scheme is reserved for a potential client-side file system.

URL schemes for file contents

The vnd.sun.star.wfs URL scheme is completely hidden from the FCP, that is, the server side FCP internally works with file URLs, like any other FCP: There is a Remote Access Content Provider (RAP) between the UCB and the FCP. The RAP, among other things, can route requests to another UCP and rewrite URLs. This feature is used so that the client of the UCB works with vnd.sun.star.wfs URLs and the FCP remains unmodified and works with file URLs, with a RAP in between that maps between those two URL schemes.

Except for the different scheme name, the syntax of the vnd.sun.star.wfs URL scheme is exactly the same as the file URL scheme.

Commands and Properties

UCB Type (returned by XContent::getContentType ) Properties Commands Interfaces
File application/vnd.sun.staroffice.fsys-file [readonly] ContentType

DateCreated
DateModified
[readonly] IsDocument
[readonly] IsFolder
Size
Title
IsReadOnly

getCommandInfo

getPropertySetInfo
getPropertyValues
setPropertyValues
insert
delete
open
transfer

XServiceInfo

XComponent
XContent
XCommandProcessor
XPropertiesChangeNotifier
XPropertyContainer
XPropertySetInfoChangeNotifier
XCommandInfoChangeNotifier
XChild
XContentCreator

Directory application/vnd.sun.staroffice.fsys-folder [readonly] ContentType

DateCreated
DateModified
[readonly] IsDocument
[readonly] IsFolder
Size
Title
IsReadOnly

getCommandInfo

getPropertySetInfo
getPropertyValues
setPropertyValues
insert
delete
open

XServiceInfo

XComponent
XContent
XCommandProcessor
XPropertiesChangeNotifier
XPropertyContainer
XPropertySetInfoChangeNotifier
XCommandInfoChangeNotifier
XChild

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