summaryrefslogtreecommitdiff
path: root/stoc/source/security
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2013-12-16 13:38:14 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2013-12-18 07:15:49 +0100
commite20f27f0a04a3c0c0ba38a2b78f5c2591e27bbc0 (patch)
tree42f53ae75e98031ca70563fe69471e0a148c94ee /stoc/source/security
parent291e846db9840b9f82bc28e495b54ae5ac51d0fc (diff)
bootstrap component: Split into implementation functions.
Change-Id: I91cb0177edd79485eab885e995e79b1a19a769d5
Diffstat (limited to 'stoc/source/security')
-rw-r--r--stoc/source/security/access_controller.cxx58
-rw-r--r--stoc/source/security/file_policy.cxx50
2 files changed, 54 insertions, 54 deletions
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index 30f4efb361f5..6de5cceef057 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -49,7 +49,6 @@
#include "lru_cache.h"
#include "permissions.h"
-#include "bootstrapservices.hxx"
#define SERVICE_NAME "com.sun.star.security.AccessController"
@@ -62,9 +61,10 @@ using namespace ::osl;
using namespace ::cppu;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+using namespace stoc_sec;
+
+namespace {
-namespace stoc_sec
-{
// static stuff initialized when loading lib
static OUString s_envType = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
const char s_acRestriction[] = "access-control.restriction";
@@ -962,7 +962,7 @@ Reference< security::XAccessControlContext > AccessController::getContext()
OUString AccessController::getImplementationName()
throw (RuntimeException)
{
- return stoc_bootstrap::ac_getImplementationName();
+ return OUString(IMPL_NAME);
}
//__________________________________________________________________________________________________
sal_Bool AccessController::supportsService( OUString const & serviceName )
@@ -971,41 +971,39 @@ sal_Bool AccessController::supportsService( OUString const & serviceName )
return cppu::supportsService(this, serviceName);
}
//__________________________________________________________________________________________________
+static Sequence< OUString > AccessController_getSupportedServiceNames()
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString(SERVICE_NAME);
+ return aSNS;
+}
+
Sequence< OUString > AccessController::getSupportedServiceNames()
throw (RuntimeException)
{
- return stoc_bootstrap::ac_getSupportedServiceNames();
+ return AccessController_getSupportedServiceNames();
}
+
}
-//##################################################################################################
-namespace stoc_bootstrap {
-//--------------------------------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL ac_create(
+
+static Reference< XInterface > SAL_CALL AccessController_create(
Reference< XComponentContext > const & xComponentContext )
SAL_THROW( (Exception) )
{
- return (OWeakObject *)new stoc_sec::AccessController( xComponentContext );
-}
-//--------------------------------------------------------------------------------------------------
-Sequence< OUString > ac_getSupportedServiceNames() SAL_THROW(())
-{
- Sequence< OUString > aSNS( 1 );
- aSNS.getArray()[0] = OUString(SERVICE_NAME);
- return aSNS;
-}
-//--------------------------------------------------------------------------------------------------
-OUString ac_getImplementationName() SAL_THROW(())
-{
- return OUString(IMPL_NAME);
+ return (OWeakObject *)new AccessController( xComponentContext );
}
-//--------------------------------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL filepolicy_create(
- Reference< XComponentContext > const & xComponentContext )
- SAL_THROW( (Exception) );
-//--------------------------------------------------------------------------------------------------
-Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(());
-//--------------------------------------------------------------------------------------------------
-OUString filepolicy_getImplementationName() SAL_THROW(());
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_security_comp_stoc_AccessController_component_getFactory(
+ const char * , void * , void * )
+{
+ Reference< css::lang::XSingleComponentFactory > xFactory;
+ xFactory = createSingleComponentFactory(
+ AccessController_create,
+ IMPL_NAME,
+ AccessController_getSupportedServiceNames() );
+ xFactory->acquire();
+ return xFactory.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 36bb86641757..4d51240f6017 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -39,8 +39,6 @@
#include <com/sun/star/io/FilePermission.hpp>
#include <com/sun/star/connection/SocketPermission.hpp>
-#include "bootstrapservices.hxx"
-
#define SERVICE_NAME "com.sun.star.security.Policy"
#define IMPL_NAME "com.sun.star.security.comp.stoc.FilePolicy"
@@ -50,8 +48,7 @@ using namespace ::cppu;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-namespace stoc_sec
-{
+namespace {
struct MutexHolder
{
@@ -526,7 +523,7 @@ void FilePolicy::refresh()
OUString FilePolicy::getImplementationName()
throw (RuntimeException)
{
- return stoc_bootstrap::filepolicy_getImplementationName();
+ return OUString(IMPL_NAME);
}
//__________________________________________________________________________________________________
sal_Bool FilePolicy::supportsService( OUString const & serviceName )
@@ -535,34 +532,39 @@ sal_Bool FilePolicy::supportsService( OUString const & serviceName )
return cppu::supportsService(this, serviceName);
}
//__________________________________________________________________________________________________
+static Sequence< OUString > FilePolicy_getSupportedServiceNames() SAL_THROW(())
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString(SERVICE_NAME);
+ return aSNS;
+}
+
Sequence< OUString > FilePolicy::getSupportedServiceNames()
throw (RuntimeException)
{
- return stoc_bootstrap::filepolicy_getSupportedServiceNames();
+ return FilePolicy_getSupportedServiceNames();
}
-}
-//##################################################################################################
-namespace stoc_bootstrap
-{
-//--------------------------------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL filepolicy_create(
+
+} // namespace
+
+static Reference< XInterface > FilePolicy_CreateInstance(
Reference< XComponentContext > const & xComponentContext )
SAL_THROW( (Exception) )
{
- return (OWeakObject *)new stoc_sec::FilePolicy( xComponentContext );
-}
-//--------------------------------------------------------------------------------------------------
-Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(())
-{
- Sequence< OUString > aSNS( 1 );
- aSNS.getArray()[0] = OUString(SERVICE_NAME);
- return aSNS;
+ return (OWeakObject *)new FilePolicy( xComponentContext );
}
-//--------------------------------------------------------------------------------------------------
-OUString filepolicy_getImplementationName() SAL_THROW(())
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_security_comp_stoc_FilePolicy_component_getFactory(
+ const char * , void * , void * )
{
- return OUString(IMPL_NAME);
-}
+ Reference< css::lang::XSingleComponentFactory > xFactory;
+ xFactory = createSingleComponentFactory(
+ FilePolicy_CreateInstance,
+ IMPL_NAME,
+ FilePolicy_getSupportedServiceNames() );
+ xFactory->acquire();
+ return xFactory.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */