Hi,
the implementation of "com.sun.star.ucb.HierarchyDataReadWriteAccess" relies on other services. For example, it needs "com.sun.star.configuration.ConfigurationProvider". Are you able to instanciate this service?
For details of the implementation of HierarchyDataSource::createInstance refer to http://ucb.openoffice.org/source/browse/ucb/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
- Kai.
Sunil Todi wrote:
Hi,
Thanks for the quick response. I have further queries.
I tried to use DefaultHierarchyDataSource service. I was able to get instance of the this service. According to the documentation, through it's own XMultiServiceFactory interface implementation, I am trying to create the instance of com.sun.star.ubp.HierarchyDataReadWriteAccess. It's not creating the instance, even though it shows this service name in getAvailableServiceNames() method. Am I doing something wrong? Do I need to do something more to create an instance of com.sun.star.ubp.HierarchyDataReadWriteAccess?
Below is my uno client code:
int SAL_CALL main(int argc, char **argv) { Reference< XSimpleRegistry > xReg = createSimpleRegistry(); if(!xReg.is()) { cout<<"### cannot get service instance of \"com.sun.star.regiystry.SimpleRegistry\"!\n"; exit(EXIT_FAILURE); }
xReg->open(OUString::createFromAscii("./types.rdb"), sal_False, sal_False); if(!xReg->isValid()) { cout<<"### cannot open test registry \"types.rdb\"!\n"; exit(EXIT_FAILURE); }
Reference< XComponentContext > xContext = bootstrap_InitialComponentContext(xReg); if(!xContext.is()) { cout<<"### cannot create intial component context!\n"; exit(EXIT_FAILURE); }
Reference< XMultiComponentFactory > xMgr = xContext->getServiceManager(); if(!xMgr.is()) { cout<<"### cannot get initial service manager!\n"; exit(EXIT_FAILURE); }
// get a HierarchyDataReadWriteAccess instance Reference< XInterface > HierarchyDataSource ; HierarchyDataSource = xMgr->createInstanceWithContext(OUString::createFromAscii("com.sun.star.ucb. DefaultHierarchyDataSource"), xContext);
if(!HierarchyDataSource.is()) { cout<<"### cannot get service instance of \"com.sun.star.ucb.DefaultHierarchyDataSource\"!\n"; exit(EXIT_FAILURE); }
Reference< XMultiServiceFactory > xMSF( HierarchyDataSource, UNO_QUERY ); if(!xMSF.is()) { cout<<"### cannot get intetrface \"XMultiServiceFactory\"!\n"; exit(EXIT_FAILURE); }
Sequence< OUString > supportedServiceNames = xMSF->getAvailableServiceNames(); //Printing all supported services. for( sal_Int32 serviceCount = 0 ; serviceCount < supportedServiceNames.getLength() ; serviceCount ++ ) { cout<<serviceCount+1<<". ";
cout<<OUStringToOString(supportedServiceNames.getConstArray()[serviceCount], RTL_TEXTENCODING_ASCII_US).getStr(); cout<<endl; }
Reference< XInterface > HieDataReadWriteAcc = xMSF->createInstance(OUString::createFromAscii("com.sun.star.ucb.HierarchyDa taReadWriteAccess"));
if(!HieDataReadWriteAcc.is()) { cout<<"### cannot get service instance of \"com.sun.star.ucb.HierarchyDataReadWriteAccess\"!\n"; exit(EXIT_FAILURE); }
Reference< XNameContainer > xNC( HieDataReadWriteAcc, UNO_QUERY ); if(!xNC.is()) { cout<<"### cannot get intetrface \"XNameContainer\"!\n"; exit(EXIT_FAILURE); }
Reference< XComponent >::query( xContext )->dispose(); return 0; }
Thanks and Regards, Sunil
-----Original Message----- From: Joerg Barfurth [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 7:38 PM To: [email protected] Subject: Re: [dev] Problem in accessing HierarchyDataReadWriteAccess service
Hi Sunil,
Sunil Todi wrote:
Hi,
I am trying to find the implementations of HierarchyDataReadWriteAccess and HierarchyDataReadAccess services. I tried services.rdb but couldn't locate them there. Do I need to download them separately and register?? Online documentation for these services can be found at
Hava a look at services HierarchyDataSource and DefaultHierarchyDataSource.
BTW: Services are abstract concepts, not concrete classes. Thus there isn't necessarily *the* implementations of these services. For any given service there may be any number of implementations. I am sure there are some services defined in OOo IDL for which there are zero implementations - but if there is an implementation of DefaultHierarchyDataSource this probably isn't a case of that.
HTH, Joerg
-- Joerg Barfurth Sun Microsystems - Desktop - Hamburg >>>>>>>>>>>>>>>>>> using std::disclaimer <<<<<<<<<<<<<<<<<<<<<<< Software Engineer [EMAIL PROTECTED] OpenOffice.org Configuration http://util.openoffice.org
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
