Updates from code review for end of September release

This commit is contained in:
John Rice
2002-09-27 11:16:30 +00:00
parent a9dcd87448
commit e168de6dd3
18 changed files with 2476 additions and 1985 deletions

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: StorageBridge.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: aledoux $ $Date: 2002-09-24 12:59:32 $
* last change: $Author: jmrice $ $Date: 2002-09-27 12:16:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,11 +59,6 @@
*
************************************************************************/
#include <stdio.h>
#include <rtl/ustring.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp>
@@ -79,77 +74,91 @@ using namespace ::drafts::com::sun::star::script::framework;
namespace scripting_runtimemgr
{
const char* const SCRIPTIMPLACCESS_SERVICE = "drafts.com.sun.star.script.framework.storage.StorageProxy";
const char* const SCRIPTSTORAGEMANAGER_SERVICE = "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager";
const char* const SCRIPTIMPLACCESS_SERVICE =
"drafts.com.sun.star.script.framework.storage.StorageProxy";
const char* const SCRIPTSTORAGEMANAGER_SERVICE =
"/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager";
const int STORAGEID = 0;
const int STORAGEPROXY = 0;
//*************************************************************************
// StorageBridge Constructor
StorageBridge::StorageBridge( const Reference< XComponentContext >& xContext, sal_Int16 sid ):m_xContext(xContext),m_sid(sid)
StorageBridge::StorageBridge( const Reference< XComponentContext >& xContext,
sal_uInt16 sid ) : m_xContext( xContext ), m_sid( sid )
{
try
{
initStorage();
}
catch(RuntimeException& re)
catch ( RuntimeException & re )
{
OUString temp = OUSTR("StorageBridge::StorageBridge(salIn32&): ");
throw RuntimeException( temp.concat(re.Message), Reference< XInterface >());
OUString temp = OUSTR( "StorageBridge::StorageBridge(salIn32&): " );
throw RuntimeException( temp.concat( re.Message ), Reference< XInterface >() );
}
}
//*************************************************************************
void
StorageBridge::initStorage() throw (::com::sun::star::uno::RuntimeException)
StorageBridge::initStorage() throw ( ::com::sun::star::uno::RuntimeException )
{
try
{
Reference< lang::XMultiComponentFactory > xMultiComFac = m_xContext->getServiceManager();
validateXRef(xMultiComFac, "StorageBridge::StorageBridge: cannot get multicomponentfactory from multiservice factory");
Reference< lang::XMultiComponentFactory > xMultiComFac =
m_xContext->getServiceManager();
validateXRef( xMultiComFac,
"StorageBridge::StorageBridge: cannot get multicomponentfactory from multiservice factory" );
Reference< XInterface > temp;
if(STORAGEPROXY)
if ( STORAGEPROXY )
{
temp = xMultiComFac->createInstanceWithContext(OUString::createFromAscii(SCRIPTIMPLACCESS_SERVICE),m_xContext);
validateXRef(temp, "StorageBridge::StorageBridge: cannot get Storage service");
m_xScriptImplAccess = Reference< storage::XScriptImplAccess > (temp, UNO_QUERY_THROW);
temp = xMultiComFac->createInstanceWithContext(
OUString::createFromAscii( SCRIPTIMPLACCESS_SERVICE ), m_xContext );
validateXRef( temp, "StorageBridge::StorageBridge: cannot get Storage service" );
m_xScriptImplAccess = Reference< storage::XScriptImplAccess > ( temp,
UNO_QUERY_THROW );
}
else
{
Any a = m_xContext->getValueByName(OUString::createFromAscii(SCRIPTSTORAGEMANAGER_SERVICE));
Any a = m_xContext->getValueByName(
OUString::createFromAscii( SCRIPTSTORAGEMANAGER_SERVICE ) );
a >>= temp;
validateXRef(temp, "StorageBridge::StorageBridge: cannot get Storage service");
Reference < storage::XScriptStorageManager > xScriptStorageManager = Reference< storage::XScriptStorageManager > (temp, UNO_QUERY_THROW);
validateXRef(xScriptStorageManager, "StorageBridge::StorageBridge: cannot get Script Storage Manager service");
Reference < XInterface > xScriptStorage = xScriptStorageManager->getScriptStorage(m_sid);
validateXRef(xScriptStorage, "StorageBridge::StorageBridge: cannot get Script Storage service");
m_xScriptImplAccess = Reference< storage::XScriptImplAccess > (xScriptStorage, UNO_QUERY_THROW);
validateXRef( temp,
"StorageBridge::StorageBridge: cannot get Storage service" );
Reference< storage::XScriptStorageManager > xScriptStorageManager =
Reference< storage::XScriptStorageManager > ( temp, UNO_QUERY_THROW );
validateXRef( xScriptStorageManager,
"StorageBridge::StorageBridge: cannot get Script Storage Manager service" );
Reference< XInterface > xScriptStorage =
xScriptStorageManager->getScriptStorage( m_sid );
validateXRef( xScriptStorage,
"StorageBridge::StorageBridge: cannot get Script Storage service" );
m_xScriptImplAccess =
Reference< storage::XScriptImplAccess > ( xScriptStorage, UNO_QUERY_THROW );
}
}
catch (Exception e)
catch ( Exception e )
{
OUString temp = OUSTR("StorageBridge::StorageBridge: ");
throw RuntimeException( temp.concat(e.Message), Reference< XInterface >());
OUString temp = OUSTR( "StorageBridge::StorageBridge: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
}
}
//*************************************************************************
Sequence < Reference< scripturi::XScriptURI > >
StorageBridge::getImplementations(const Reference< scripturi::XScriptURI >& queryURI )
throw (lang::IllegalArgumentException, RuntimeException)
StorageBridge::getImplementations( const Reference< scripturi::XScriptURI >& queryURI )
throw ( lang::IllegalArgumentException, RuntimeException )
{
OSL_TRACE("In StorageBridge getImplementations...\n");
OSL_TRACE( "In StorageBridge getImplementations...\n" );
Sequence < Reference< scripturi::XScriptURI > > results;
try
{
results = m_xScriptImplAccess->getImplementations(queryURI);
results = m_xScriptImplAccess->getImplementations( queryURI );
}
catch (Exception e)
catch ( Exception e )
{
OUString temp = OUSTR("StorageBridge::getImplementations: ");
throw RuntimeException( temp.concat(e.Message), Reference< XInterface >());
OUString temp = OUSTR( "StorageBridge::getImplementations: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
}
return results;
}
}
}// namespace