1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: updatesvc.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef CONFIGMGR_BACKEND_UPDATESVC_HXX
32 #define CONFIGMGR_BACKEND_UPDATESVC_HXX
34 #include "serviceinfohelper.hxx"
35 #include <cppuhelper/implbase3.hxx>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/configuration/backend/XUpdateHandler.hpp>
41 // -----------------------------------------------------------------------------
43 namespace com
{ namespace sun
{ namespace star
{ namespace configuration
{ namespace backend
{
48 // -----------------------------------------------------------------------------
52 // -----------------------------------------------------------------------------
55 // -----------------------------------------------------------------------------
56 namespace uno
= ::com::sun::star::uno
;
57 namespace lang
= ::com::sun::star::lang
;
58 namespace backenduno
= ::com::sun::star::configuration::backend
;
59 // -----------------------------------------------------------------------------
61 class UpdateService
: public ::cppu::WeakImplHelper3
<
62 lang::XInitialization
,
64 backenduno::XUpdateHandler
69 UpdateService(uno::Reference
< uno::XComponentContext
> const & _xContext
);
73 initialize( const uno::Sequence
< uno::Any
>& aArguments
)
74 throw (uno::Exception
, uno::RuntimeException
);
77 virtual ::rtl::OUString SAL_CALL
78 getImplementationName( )
79 throw (uno::RuntimeException
);
81 virtual sal_Bool SAL_CALL
82 supportsService( const ::rtl::OUString
& ServiceName
)
83 throw (uno::RuntimeException
);
85 virtual uno::Sequence
< ::rtl::OUString
> SAL_CALL
86 getSupportedServiceNames( )
87 throw (uno::RuntimeException
);
90 uno::Reference
< lang::XMultiServiceFactory
> getServiceFactory() const
91 { return m_xServiceFactory
; }
93 void checkSourceLayer() SAL_THROW( (lang::IllegalAccessException
) )
94 { validateSourceLayerAndCheckNotEmpty(); }
96 uno::Reference
< backenduno::XLayer
> getSourceLayer() SAL_THROW( (lang::IllegalAccessException
) );
98 void writeUpdatedLayer(uno::Reference
< backenduno::XLayer
> const & _xLayer
);
100 virtual sal_Bool
setImplementationProperty(rtl::OUString
const & aName
, uno::Any
const & aValue
);
102 void raiseIllegalAccessException(sal_Char
const * pMsg
)
103 SAL_THROW( (lang::IllegalAccessException
) );
106 bool validateSourceLayerAndCheckNotEmpty() SAL_THROW( (lang::IllegalAccessException
) );
109 uno::Reference
< lang::XMultiServiceFactory
> m_xServiceFactory
;
110 uno::Reference
< backenduno::XLayer
> m_xSourceLayer
;
111 uno::Reference
< backenduno::XLayerHandler
> m_xLayerWriter
;
112 enum { merge
, truncate
, protect
} m_aSourceMode
;
114 static ServiceInfoHelper
getServiceInfo();
116 // -----------------------------------------------------------------------------
118 // -----------------------------------------------------------------------------
120 } // namespace configmgr