The FTP Content Provider
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 three different types of contents: accounts, folders and documents.
- An FTP account is a content that represents an account for an FTP server. An account is uniquely determined by a combination of a user name and the host name of the FTP server. Anonymous FTP accounts have the string "anonymous" as a user name. An FTP account also represents the base directory, that is, the directory that is selected when the user logs in to the FTP server, and behaves like an FTP folder.
- An FTP folder is a content that represents a directory on an FTP server. An FTP folder never has a content stream, but it can have FTP folders and FTP documents as children.
- An FTP document is a content that represents a single file on an FTP server. An FTP document always has a content stream and never has children.
Creation of New FTP Content
FTP accounts and FTP folders implement the interface com.sun.star.ucb.XContentCreator. FTP folders and FTP documents support the command "insert"allowing all the FTP accounts and FTP folders to create new FTP folders and FTP documents. To create a new child of an FTP account or FTP folder:
- The folder creates a new content by calling its
createNewContent()
method. The content type 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. The new child executes a "
setPropertyValues
" command that sets the propertyTitle
to a non-empty value. - The new child, not the parent, executes the command "insert". This commits the creation process. For documents, supply an com.sun.star.io.XInputStream, whose contents are transferred to the FTP server with the command's parameters.
FTP accounts cannot be created the way new FTP folders or FTP documents are created. When you call the FTP content provider's queryContent()
method with the URL of an FTP account, a content object representing that account, user name and host combination, is automatically created. The same as the URL of an already existing FTP folder or FTP document.
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 accounts have a login part, optionally followed by a single slash, and no segments. FTP folders have a login part followed by one or more nonempty segments that must be followed by a slash. FTP documents have a login part followed by one or more nonempty segments that must not be followed by a slash, that is, the FTP content provider uses a potential final slash of a URL to distinguish between folders and documents. Note that this is subject to change in future versions of the provider.
Examples:
- The account of user "me" on the FTP server "ftp.host".
- A document on an anonymous FTP account.
ftp://me:secret@ftp.host/secret-documents/
- A folder within the account of user "me" with the password specified directly in the URL. Not recommended.
Commands and Properties
UCB Type (returned by XContent::getContentType ) | Properties | Commands | Interfaces | |
---|---|---|---|---|
Account | application/vnd.sun.staroffice.ftp-box | [readonly] ContentType [readonly] IsDocument |
getCommandInfo getPropertySetInfo |
XTypeProvider XServiceInfo |
Folder | application/vnd.sun.staroffice.ftp-folder | [readonly] ContentType [readonly] IsDocument |
getCommandInfo getPropertySetInfo |
same as FTP Account plus |
Document | application/vnd.sun.staroffice.ftp-file | [readonly] ContentType [readonly] IsDocument |
getCommandInfo getPropertySetInfo |
same as FTP Folder minus |
1 The property FTPAccount
is similar to Password
. Some FTP servers not only require authentication through a password, but also through a second token called an "account".
2 The property ServerBase
is used to override the default directory associated with an FTP account.
3 The "transfer
" command only transfers contents within one FTP Account. It cannot transfer contents between different FTP accounts or between the FTP content provider and another content provider.
Content on this page is licensed under the Public Documentation License (PDL). |