Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider");
XContentProvider xContentProvider =
(XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, o);
// create the ucb
XContentIdentifierFactory xContentIdentifierFactory =
(XContentIdentifierFactory)UnoRuntime.queryInterface(
XContentIdentifierFactory.class, xMSF.createInstance(
"com.sun.star.ucb.UniversalContentBroker"));
// create a content identifier from the ucb for tdoc
XContentIdentifier xContentIdentifier =
xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/");
// get content
xContent = xContentProvider.queryContent(xContentIdentifier);
String content = xContent.getContentType();
log.println("#### Content root: " + content);
// try to get some documents: should be "countDocs" at least.
XContentIdentifier[] xContentId = new XContentIdentifier[countDocs+5];
XContent[] xCont = new XContent[countDocs+5];
for (int i=0; i<countDocs+5; i++) {
xContentId[i] = xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/" + i);
// get content
xCont[i] = xContentProvider.queryContent(xContentId[i]);
int returnVal = xContentProvider.compareContentIds(xContentId[i], xContentIdentifier);
String cont = null;
if (xCont[i] != null)
cont = xCont[i].getContentType();
log.println("Document Content " + i + ": " + cont + " compare with root: " + returnVal);
xContentId[i] = xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/" + i + "/content.xml");
// get content
xCont[i] = xContentProvider.queryContent(xContentId[i]);
cont = null;
if (xCont[i] != null)
cont = xCont[i].getContentType();