Accessing a UCB Content
From Apache OpenOffice Wiki
< Documentation | DevGuide
Each UCB content can be identified using a URL that points to a folder or a document content in the data source you want to work with. To create a content object for a given URL:
- Obtain access to the UCB.
- Let the UCB create a content identifier object for the requested URL using
createContentIdentifier()
at the com.sun.star.ucb.XContentIdentifierFactory of the UCB. - Let the UCB create a content object for the content identifier using
queryContent()
at the com.sun.star.ucb.XContentProvider interface of the UCB.
The UCB selects a UCP according to the URL contained in the identifier object and dispatches the queryContent()
call to it. The UCP creates the content implementation object and returns it to the UCB, which passes it on to the caller.
Creating a UCB content from a given URL:
import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.Xinterface; import com.sun.star.ucb.*; { String aURL = ... ///////////////////////////////////////////////////////////////////// // Obtain access to UCB... ///////////////////////////////////////////////////////////////////// XInterface xUCB = ... // Obtain required UCB interfaces XContentIdentifierFactory and XContentProvider XContentIdentifierFactory xIdFactory = (XContentIdentifierFactory)UnoRuntime.queryInterface( XContentIdentifierFactory.class, xUCB); XContentProvider xProvider = (XContentProvider)UnoRuntime.queryInterface( XContentProvider.class, xUCB); ///////////////////////////////////////////////////////////////////// // Obtain content object from UCB... ///////////////////////////////////////////////////////////////////// // Create identifier object for given URL. XContentIdentifier xId = xIdFactory.createContentIdentifier(aURL); XContent xContent = xProvider.queryContent(xId); }
Content on this page is licensed under the Public Documentation License (PDL). |