The FTP Content Provider
Preface
The FTP Content Provider implements a Content Provider for the Universal Content Broker (UCB). It provides access to the contents (folders and documents) made available by FTP servers.
FTP Contents
The FTP Content Provider provides two different types of contents: Folders and Documents.
An FTP Folder is a content which represents a directory on an FTP server. An FTP Folder never has a content stream, but it can have both FTP Folders and FTP Documents as children.
An FTP Document is a content which represents a single file on an FTP server. An FTP Document always has a content stream and never has children.
Creation
of New FTP Contents
FTP Folders implement the interface XContentCreator. FTP Folders and FTP Documents support the command 'insert.' That way, all FTP Folders can create new FTP Folders and FTP Documents. To create a new child of an FTP Folder:
Let the folder create a new content by calling its createNewContent-method. The content type to use for new folders is application/vnd.sun.staroffice.ftp-folder. To create a new document, use the type string application/vnd.sun.staroffice.ftp-file.
Set a title at the new folder or document. (Let the new child execute a setPropertyValues-command that sets at least the property 'Title' to a non-empty value).
Let the new child (not the parent!) execute the command 'insert.' This will commit the creation process. For documents, you need to supply an XInputStream (whose contents will be transfered to the FTP server) with the command's parameters.
URL Scheme for FTP Contents
Each FTP content has an identifier corresponding to the following scheme (see also RFCs 1738, 2234, 2396, and 2732):
ftp-URL = "ftp://" login *("/" segment)
login = [user [":" password] "@"] hostport
user = *(escaped / unreserved / "$" / "&" / "+" / "," / ";" / "=")
password = *(escaped / unreserved / "$" / "&" / "+" / "," / ";"
/ "=")
hostport = host [":" port]
host = incomplete-hostname / hostname / IPv4address
incomplete-hostname = *(domainlabel ".") domainlabel
hostname = *(domainlabel ".") toplabel ["."]
domainlabel = alphanum [*(alphanum / "-") alphanum]
toplabel = ALPHA [*(alphanum / "-") alphanum]
IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
port = *DIGIT
segment = *pchar
pchar = escaped / unreserved / "$" / "&" / "+" / "," / ":" / "="
/ "@"
escaped = "%" HEXDIG HEXDIG
unreserved = alphanum / mark
alphanum = ALPHA / DIGIT
mark = "!" / "'" / "(" / ")" / "*" / "-" / "." / "_" / "~"
FTP Folders and FTP Documents have a login part followed by one or more (nonempty) segments that might be followed by a slash.
Examples:
ftp://username@ftp.host/ The root-directory of user 'username' on the FTP server 'ftp.host.'
ftp://ftp.host/pub/doc1.txt A document on an anonymous FTP account.
ftp://username:password@ftp.host/secret-documents/ A folder within the account of user 'username,' with the password specified directly in the URL (works, but is not recommended).
Appendix
The following table gives an overview of the different FTP contents.
|
UCB Type (returned by XContent::getContentType ) |
Properties |
Commands |
Interfaces |
---|---|---|---|---|
Folder |
application/vnd.sun.staroffice.ftp-folder |
[readonly] ContentType [readonly] IsDocument [readonly] IsFolder Title [readonly] DateCreated |
getCommandInfo getPropertySetInfo getPropertyValues setPropertyValues insert delete open |
lang::XTypeProvider lang::XServiceInfo lang::XComponent ucb::XContent ucb::XCommandProcessor beans::XPropertiesChangeNotifier beans::XPropertyContainer beans::XPropertySetInfoChangeNotifier ucb::XCommandInfoChangeNotifier ucb::XContentCreator container::XChild
|
Document |
application/vnd.sun.staroffice.ftp-file |
[readonly] ContentType [readonly] IsDocument [readonly] IsFolder Title [readonly] DateCreated [readonly] DateModified [readonly] IsReadOnly [readonly] Size MediaType |
getCommandInfo getPropertySetInfo getPropertyValues setPropertyValues insert delete open |
same as FTP Folder |