Difference between revisions of "Documentation/DevGuide/UCB/Accessing a UCB Content"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (FINAL VERSION FOR L10N)
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
|NextPage=Documentation/DevGuide/UCB/Executing Content Commands
 
|NextPage=Documentation/DevGuide/UCB/Executing Content Commands
 
}}
 
}}
{{DISPLAYTITLE:Accessing a UCB Content}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/UCB/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Accessing a UCB Content}}
 
<!--<idltopic>com.sun.star.ucb.XContentIdentifierFactory;com.sun.star.ucb.XContentProvider</idltopic>-->
 
<!--<idltopic>com.sun.star.ucb.XContentIdentifierFactory;com.sun.star.ucb.XContentProvider</idltopic>-->
 
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:
 
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:
Line 11: Line 12:
 
# Obtain access to the UCB.
 
# Obtain access to the UCB.
 
# Let the UCB create a content identifier object for the requested URL using <code>createContentIdentifier()</code> at the <idl>com.sun.star.ucb.XContentIdentifierFactory</idl> of the UCB.
 
# Let the UCB create a content identifier object for the requested URL using <code>createContentIdentifier()</code> at the <idl>com.sun.star.ucb.XContentIdentifierFactory</idl> of the UCB.
# Let the UCB create a content object for the content identifier using <code>Content()</code> at the <idl>com.sun.star.ucb.XContentProvider</idl> interface of the UCB.
+
# Let the UCB create a content object for the content identifier using <code>queryContent()</code> at the <idl>com.sun.star.ucb.XContentProvider</idl> interface of the UCB.
  
 
The UCB selects a UCP according to the URL contained in the identifier object and dispatches the <code>queryContent()</code> call to it. The UCP creates the content implementation object and returns it to the UCB, which passes it on to the caller.
 
The UCB selects a UCP according to the URL contained in the identifier object and dispatches the <code>queryContent()</code> call to it. The UCP creates the content implementation object and returns it to the UCB, which passes it on to the caller.
Line 48: Line 49:
 
   </source>
 
   </source>
 
{{PDL1}}
 
{{PDL1}}
[[Category: Universal Content Broker]]
+
 
 +
[[Category:Documentation/Developer's Guide/Universal Content Broker]]

Revision as of 13:06, 15 May 2009



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:

  1. Obtain access to the UCB.
  2. Let the UCB create a content identifier object for the requested URL using createContentIdentifier() at the com.sun.star.ucb.XContentIdentifierFactory of the UCB.
  3. 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).
Personal tools
In other languages