xref: /AOO41X/main/desktop/source/deployment/registry/inc/dp_backend.h (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #if ! defined INCLUDED_DP_REGISTRY_H
29*cdf0e10cSrcweir #define INCLUDED_DP_REGISTRY_H
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "dp_misc.h"
32*cdf0e10cSrcweir #include "dp_resource.h"
33*cdf0e10cSrcweir #include "dp_interact.h"
34*cdf0e10cSrcweir #include "rtl/ref.hxx"
35*cdf0e10cSrcweir #include "cppuhelper/weakref.hxx"
36*cdf0e10cSrcweir #include "cppuhelper/implbase1.hxx"
37*cdf0e10cSrcweir #include "cppuhelper/compbase1.hxx"
38*cdf0e10cSrcweir #include "cppuhelper/compbase2.hxx"
39*cdf0e10cSrcweir #include "tools/inetmime.hxx"
40*cdf0e10cSrcweir #include "com/sun/star/lang/XEventListener.hpp"
41*cdf0e10cSrcweir #include "com/sun/star/deployment/XPackageRegistry.hpp"
42*cdf0e10cSrcweir #include "com/sun/star/deployment/XPackageManager.hpp"
43*cdf0e10cSrcweir #include "com/sun/star/deployment/InvalidRemovedParameterException.hpp"
44*cdf0e10cSrcweir #include <memory>
45*cdf0e10cSrcweir #include <hash_map>
46*cdf0e10cSrcweir #include <list>
47*cdf0e10cSrcweir #include "dp_registry.hrc"
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir namespace dp_registry
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir namespace backend
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir namespace css = ::com::sun::star;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir class PackageRegistryBackend;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir char const* const BACKEND_SERVICE_NAME =
59*cdf0e10cSrcweir "com.sun.star.deployment.PackageRegistryBackend";
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1<
62*cdf0e10cSrcweir     css::deployment::XPackage > t_PackageBase;
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir //==============================================================================
65*cdf0e10cSrcweir class Package : protected ::dp_misc::MutexHolder, public t_PackageBase
66*cdf0e10cSrcweir {
67*cdf0e10cSrcweir     PackageRegistryBackend * getMyBackend() const;
68*cdf0e10cSrcweir     void processPackage_impl(
69*cdf0e10cSrcweir         bool registerPackage,
70*cdf0e10cSrcweir         bool startup,
71*cdf0e10cSrcweir         css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
72*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv );
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir protected:
75*cdf0e10cSrcweir     ::rtl::Reference<PackageRegistryBackend> m_myBackend;
76*cdf0e10cSrcweir     const ::rtl::OUString m_url;
77*cdf0e10cSrcweir     ::rtl::OUString m_name;
78*cdf0e10cSrcweir     ::rtl::OUString m_displayName;
79*cdf0e10cSrcweir     const css::uno::Reference<css::deployment::XPackageTypeInfo> m_xPackageType;
80*cdf0e10cSrcweir     const bool m_bRemoved;
81*cdf0e10cSrcweir     //Only set if m_bRemoved = true;
82*cdf0e10cSrcweir     const ::rtl::OUString m_identifier;
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir     void check() const;
85*cdf0e10cSrcweir     void fireModified();
86*cdf0e10cSrcweir     virtual void SAL_CALL disposing();
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     void checkAborted(
89*cdf0e10cSrcweir         ::rtl::Reference< ::dp_misc::AbortChannel > const & abortChannel );
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir     // @@@ to be implemented by specific backend:
92*cdf0e10cSrcweir     virtual css::beans::Optional< css::beans::Ambiguous<sal_Bool> >
93*cdf0e10cSrcweir     isRegistered_(
94*cdf0e10cSrcweir         ::osl::ResettableMutexGuard & guard,
95*cdf0e10cSrcweir         ::rtl::Reference< ::dp_misc::AbortChannel > const & abortChannel,
96*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
97*cdf0e10cSrcweir         = 0;
98*cdf0e10cSrcweir     virtual void processPackage_(
99*cdf0e10cSrcweir         ::osl::ResettableMutexGuard & guard,
100*cdf0e10cSrcweir         bool registerPackage,
101*cdf0e10cSrcweir         bool startup,
102*cdf0e10cSrcweir         ::rtl::Reference< ::dp_misc::AbortChannel > const & abortChannel,
103*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
104*cdf0e10cSrcweir         = 0;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     virtual ~Package();
107*cdf0e10cSrcweir     Package( ::rtl::Reference<PackageRegistryBackend> const & myBackend,
108*cdf0e10cSrcweir              ::rtl::OUString const & url,
109*cdf0e10cSrcweir              ::rtl::OUString const & name,
110*cdf0e10cSrcweir              ::rtl::OUString const & displayName,
111*cdf0e10cSrcweir              css::uno::Reference<css::deployment::XPackageTypeInfo> const &
112*cdf0e10cSrcweir              xPackageType,
113*cdf0e10cSrcweir              bool bRemoved,
114*cdf0e10cSrcweir              ::rtl::OUString const & identifier);
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir public:
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     class TypeInfo :
119*cdf0e10cSrcweir         public ::cppu::WeakImplHelper1<css::deployment::XPackageTypeInfo>
120*cdf0e10cSrcweir     {
121*cdf0e10cSrcweir         const ::rtl::OUString m_mediaType;
122*cdf0e10cSrcweir         const ::rtl::OUString m_fileFilter;
123*cdf0e10cSrcweir         const ::rtl::OUString m_shortDescr;
124*cdf0e10cSrcweir         const sal_uInt16 m_smallIcon, m_smallIcon_HC;
125*cdf0e10cSrcweir     public:
126*cdf0e10cSrcweir         virtual ~TypeInfo();
127*cdf0e10cSrcweir         TypeInfo( ::rtl::OUString const & mediaType,
128*cdf0e10cSrcweir                   ::rtl::OUString const & fileFilter,
129*cdf0e10cSrcweir                   ::rtl::OUString const & shortDescr,
130*cdf0e10cSrcweir                   sal_uInt16 smallIcon, sal_uInt16 smallIcon_HC )
131*cdf0e10cSrcweir             : m_mediaType(mediaType), m_fileFilter(fileFilter),
132*cdf0e10cSrcweir               m_shortDescr(shortDescr),
133*cdf0e10cSrcweir               m_smallIcon(smallIcon), m_smallIcon_HC(smallIcon_HC)
134*cdf0e10cSrcweir             {}
135*cdf0e10cSrcweir         // XPackageTypeInfo
136*cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getMediaType()
137*cdf0e10cSrcweir             throw (css::uno::RuntimeException);
138*cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getDescription()
139*cdf0e10cSrcweir             throw (css::deployment::ExtensionRemovedException,
140*cdf0e10cSrcweir                    css::uno::RuntimeException);
141*cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getShortDescription()
142*cdf0e10cSrcweir             throw (css::deployment::ExtensionRemovedException,
143*cdf0e10cSrcweir                    css::uno::RuntimeException);
144*cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getFileFilter()
145*cdf0e10cSrcweir             throw (css::uno::RuntimeException);
146*cdf0e10cSrcweir         virtual css::uno::Any SAL_CALL getIcon( sal_Bool highContrast,
147*cdf0e10cSrcweir                                                 sal_Bool smallIcon )
148*cdf0e10cSrcweir             throw (css::uno::RuntimeException);
149*cdf0e10cSrcweir     };
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     // XComponent
152*cdf0e10cSrcweir     virtual void SAL_CALL dispose() throw (css::uno::RuntimeException);
153*cdf0e10cSrcweir     virtual void SAL_CALL addEventListener(
154*cdf0e10cSrcweir         css::uno::Reference<css::lang::XEventListener> const & xListener )
155*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
156*cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener(
157*cdf0e10cSrcweir         css::uno::Reference<css::lang::XEventListener> const & xListener )
158*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     // XModifyBroadcaster
161*cdf0e10cSrcweir     virtual void SAL_CALL addModifyListener(
162*cdf0e10cSrcweir         css::uno::Reference<css::util::XModifyListener> const & xListener )
163*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
164*cdf0e10cSrcweir     virtual void SAL_CALL removeModifyListener(
165*cdf0e10cSrcweir         css::uno::Reference<css::util::XModifyListener> const & xListener )
166*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir     // XPackage
169*cdf0e10cSrcweir     virtual css::uno::Reference<css::task::XAbortChannel> SAL_CALL
170*cdf0e10cSrcweir     createAbortChannel() throw (css::uno::RuntimeException);
171*cdf0e10cSrcweir     virtual css::beans::Optional< css::beans::Ambiguous<sal_Bool> >
172*cdf0e10cSrcweir     SAL_CALL isRegistered(
173*cdf0e10cSrcweir         css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
174*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
175*cdf0e10cSrcweir         throw (css::deployment::DeploymentException,
176*cdf0e10cSrcweir                css::ucb::CommandFailedException,
177*cdf0e10cSrcweir                css::ucb::CommandAbortedException,
178*cdf0e10cSrcweir                css::uno::RuntimeException);
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL checkPrerequisites(
181*cdf0e10cSrcweir 		const css::uno::Reference< css::task::XAbortChannel >& xAbortChannel,
182*cdf0e10cSrcweir 		const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv,
183*cdf0e10cSrcweir         sal_Bool noLicenseChecking)
184*cdf0e10cSrcweir 		throw (css::deployment::DeploymentException,
185*cdf0e10cSrcweir                css::deployment::ExtensionRemovedException,
186*cdf0e10cSrcweir                css::ucb::CommandFailedException,
187*cdf0e10cSrcweir                css::ucb::CommandAbortedException,
188*cdf0e10cSrcweir                css::uno::RuntimeException);
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL checkDependencies(
191*cdf0e10cSrcweir 		const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
192*cdf0e10cSrcweir 		throw (css::deployment::DeploymentException,
193*cdf0e10cSrcweir                css::deployment::ExtensionRemovedException,
194*cdf0e10cSrcweir                css::ucb::CommandFailedException,
195*cdf0e10cSrcweir                css::uno::RuntimeException);
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir     virtual void SAL_CALL registerPackage(
198*cdf0e10cSrcweir         sal_Bool startup,
199*cdf0e10cSrcweir         css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
200*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
201*cdf0e10cSrcweir         throw (css::deployment::DeploymentException,
202*cdf0e10cSrcweir                css::deployment::ExtensionRemovedException,
203*cdf0e10cSrcweir                css::ucb::CommandFailedException,
204*cdf0e10cSrcweir                css::ucb::CommandAbortedException,
205*cdf0e10cSrcweir                css::lang::IllegalArgumentException, css::uno::RuntimeException);
206*cdf0e10cSrcweir     virtual void SAL_CALL revokePackage(
207*cdf0e10cSrcweir         css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
208*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
209*cdf0e10cSrcweir         throw (css::deployment::DeploymentException,
210*cdf0e10cSrcweir                css::ucb::CommandFailedException,
211*cdf0e10cSrcweir                css::ucb::CommandAbortedException,
212*cdf0e10cSrcweir                css::lang::IllegalArgumentException,
213*cdf0e10cSrcweir                css::uno::RuntimeException);
214*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isBundle()
215*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
216*cdf0e10cSrcweir     virtual css::uno::Sequence< css::uno::Reference<css::deployment::XPackage> >
217*cdf0e10cSrcweir     SAL_CALL getBundle(
218*cdf0e10cSrcweir         css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
219*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
220*cdf0e10cSrcweir         throw (css::deployment::DeploymentException,
221*cdf0e10cSrcweir                css::ucb::CommandFailedException,
222*cdf0e10cSrcweir                css::ucb::CommandAbortedException,
223*cdf0e10cSrcweir                css::lang::IllegalArgumentException,
224*cdf0e10cSrcweir                css::uno::RuntimeException);
225*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getName()
226*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
227*cdf0e10cSrcweir     virtual css::beans::Optional< ::rtl::OUString > SAL_CALL getIdentifier()
228*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
229*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getVersion()
230*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
231*cdf0e10cSrcweir                css::uno::RuntimeException);
232*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getURL()
233*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
234*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getDisplayName()
235*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
236*cdf0e10cSrcweir                css::uno::RuntimeException);
237*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getDescription()
238*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
239*cdf0e10cSrcweir                css::uno::RuntimeException);
240*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getLicenseText()
241*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
242*cdf0e10cSrcweir                css::uno::RuntimeException);
243*cdf0e10cSrcweir     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL
244*cdf0e10cSrcweir     getUpdateInformationURLs()
245*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
246*cdf0e10cSrcweir                css::uno::RuntimeException);
247*cdf0e10cSrcweir     virtual css::beans::StringPair SAL_CALL getPublisherInfo()
248*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
249*cdf0e10cSrcweir                css::uno::RuntimeException);
250*cdf0e10cSrcweir     virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL
251*cdf0e10cSrcweir     getIcon( sal_Bool bHighContrast )
252*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
253*cdf0e10cSrcweir                css::uno::RuntimeException);
254*cdf0e10cSrcweir     virtual css::uno::Reference<css::deployment::XPackageTypeInfo> SAL_CALL
255*cdf0e10cSrcweir     getPackageType() throw (css::uno::RuntimeException);
256*cdf0e10cSrcweir     virtual void SAL_CALL exportTo(
257*cdf0e10cSrcweir         ::rtl::OUString const & destFolderURL,
258*cdf0e10cSrcweir         ::rtl::OUString const & newTitle,
259*cdf0e10cSrcweir         sal_Int32 nameClashAction,
260*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
261*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
262*cdf0e10cSrcweir                css::ucb::CommandFailedException,
263*cdf0e10cSrcweir                css::ucb::CommandAbortedException, css::uno::RuntimeException);
264*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getRepositoryName()
265*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
266*cdf0e10cSrcweir     virtual css::beans::Optional< ::rtl::OUString > SAL_CALL getRegistrationDataURL()
267*cdf0e10cSrcweir         throw (css::deployment::ExtensionRemovedException,
268*cdf0e10cSrcweir                css::uno::RuntimeException);
269*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isRemoved()
270*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir };
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper2<
275*cdf0e10cSrcweir     css::lang::XEventListener,
276*cdf0e10cSrcweir     css::deployment::XPackageRegistry > t_BackendBase;
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir //==============================================================================
279*cdf0e10cSrcweir class PackageRegistryBackend
280*cdf0e10cSrcweir     : protected ::dp_misc::MutexHolder, public t_BackendBase
281*cdf0e10cSrcweir {
282*cdf0e10cSrcweir     //The map held originally WeakReferences. The map entries are removed in the disposing
283*cdf0e10cSrcweir     //function, which is called when the XPackages are destructed or they are
284*cdf0e10cSrcweir     //explicitely disposed. The latter happens, for example, when a extension is
285*cdf0e10cSrcweir     //removed (see dp_manager.cxx). However, because of how the help systems work, now
286*cdf0e10cSrcweir     // XPackageManager::getDeployedPackages is called often. This results in a lot
287*cdf0e10cSrcweir     //of bindPackage calls which are costly. Therefore we keep hard references in
288*cdf0e10cSrcweir     //the map now.
289*cdf0e10cSrcweir     typedef ::std::hash_map<
290*cdf0e10cSrcweir         ::rtl::OUString, css::uno::Reference<css::deployment::XPackage>,
291*cdf0e10cSrcweir         ::rtl::OUStringHash > t_string2ref;
292*cdf0e10cSrcweir     t_string2ref m_bound;
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir protected:
295*cdf0e10cSrcweir     ::rtl::OUString m_cachePath;
296*cdf0e10cSrcweir     css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir     ::rtl::OUString m_context;
299*cdf0e10cSrcweir     // currently only for library containers:
300*cdf0e10cSrcweir     enum {
301*cdf0e10cSrcweir         CONTEXT_UNKNOWN,
302*cdf0e10cSrcweir         CONTEXT_USER, CONTEXT_SHARED,CONTEXT_BUNDLED, CONTEXT_TMP, CONTEXT_BUNDLED_PREREG,
303*cdf0e10cSrcweir         CONTEXT_DOCUMENT
304*cdf0e10cSrcweir     } m_eContext;
305*cdf0e10cSrcweir     bool m_readOnly;
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir     struct StrCannotDetectMediaType : public ::dp_misc::StaticResourceString<
308*cdf0e10cSrcweir         StrCannotDetectMediaType, RID_STR_CANNOT_DETECT_MEDIA_TYPE> {};
309*cdf0e10cSrcweir     struct StrUnsupportedMediaType : public ::dp_misc::StaticResourceString<
310*cdf0e10cSrcweir         StrUnsupportedMediaType, RID_STR_UNSUPPORTED_MEDIA_TYPE> {};
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     // @@@ to be implemented by specific backend:
313*cdf0e10cSrcweir     virtual css::uno::Reference<css::deployment::XPackage> bindPackage_(
314*cdf0e10cSrcweir         ::rtl::OUString const & url, ::rtl::OUString const & mediaType,
315*cdf0e10cSrcweir         sal_Bool bRemoved, ::rtl::OUString const & identifier,
316*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
317*cdf0e10cSrcweir         = 0;
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir     void check();
320*cdf0e10cSrcweir     virtual void SAL_CALL disposing();
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir     virtual ~PackageRegistryBackend();
323*cdf0e10cSrcweir     PackageRegistryBackend(
324*cdf0e10cSrcweir         css::uno::Sequence<css::uno::Any> const & args,
325*cdf0e10cSrcweir         css::uno::Reference<css::uno::XComponentContext> const & xContext );
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir     /* creates a folder with a unique name.
328*cdf0e10cSrcweir        If url is empty then it is created in the the backend folder, otherwise
329*cdf0e10cSrcweir        at a location relative to that folder specified by url.
330*cdf0e10cSrcweir     */
331*cdf0e10cSrcweir     ::rtl::OUString createFolder(
332*cdf0e10cSrcweir         ::rtl::OUString const & relUrl,
333*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
334*cdf0e10cSrcweir     /* deletes folders and files.
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir        All folder all files which end with ".tmp" or ".tmp_" and which are
337*cdf0e10cSrcweir        not used are deleted.
338*cdf0e10cSrcweir      */
339*cdf0e10cSrcweir     void deleteUnusedFolders(
340*cdf0e10cSrcweir         ::rtl::OUString const & relUrl,
341*cdf0e10cSrcweir         ::std::list< ::rtl::OUString> const & usedFolders);
342*cdf0e10cSrcweir     /* deletes one folder with a "temporary" name and the corresponding
343*cdf0e10cSrcweir        tmp file, which was used to derive the folder name.
344*cdf0e10cSrcweir     */
345*cdf0e10cSrcweir     static void deleteTempFolder(
346*cdf0e10cSrcweir         ::rtl::OUString const & folderUrl);
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     ::rtl::OUString getSharedRegistrationDataURL(
349*cdf0e10cSrcweir         css::uno::Reference<css::deployment::XPackage> const & extension,
350*cdf0e10cSrcweir         css::uno::Reference<css::deployment::XPackage> const & item);
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir     /* The backends must implement this function, which is called
353*cdf0e10cSrcweir        from XPackageRegistry::packageRemoved (also implemented here).
354*cdf0e10cSrcweir        This ensure that the backends clean up their registration data
355*cdf0e10cSrcweir        when an extension was removed.
356*cdf0e10cSrcweir     */
357*cdf0e10cSrcweir //    virtual void deleteDbEntry( ::rtl::OUString const & url) = 0;
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir public:
362*cdf0e10cSrcweir     struct StrRegisteringPackage : public ::dp_misc::StaticResourceString<
363*cdf0e10cSrcweir         StrRegisteringPackage, RID_STR_REGISTERING_PACKAGE> {};
364*cdf0e10cSrcweir     struct StrRevokingPackage : public ::dp_misc::StaticResourceString<
365*cdf0e10cSrcweir         StrRevokingPackage, RID_STR_REVOKING_PACKAGE> {};
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir     inline css::uno::Reference<css::uno::XComponentContext> const &
368*cdf0e10cSrcweir     getComponentContext() const { return m_xComponentContext; }
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir     inline ::rtl::OUString const & getCachePath() const { return m_cachePath; }
371*cdf0e10cSrcweir     inline bool transientMode() const { return m_cachePath.getLength() == 0; }
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir     inline ::rtl::OUString getContext() const {return m_context; }
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir     // XEventListener
376*cdf0e10cSrcweir     virtual void SAL_CALL disposing( css::lang::EventObject const & evt )
377*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir     // XPackageRegistry
380*cdf0e10cSrcweir     virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL bindPackage(
381*cdf0e10cSrcweir         ::rtl::OUString const & url, ::rtl::OUString const & mediaType,
382*cdf0e10cSrcweir         sal_Bool bRemoved, ::rtl::OUString const & identifier,
383*cdf0e10cSrcweir         css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
384*cdf0e10cSrcweir         throw (css::deployment::DeploymentException,
385*cdf0e10cSrcweir                css::deployment::InvalidRemovedParameterException,
386*cdf0e10cSrcweir                css::ucb::CommandFailedException,
387*cdf0e10cSrcweir                css::lang::IllegalArgumentException, css::uno::RuntimeException);
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir //     virtual void SAL_CALL packageRemoved(
390*cdf0e10cSrcweir //         ::rtl::OUString const & url, ::rtl::OUString const & mediaType)
391*cdf0e10cSrcweir //         throw (css::deployment::DeploymentException,
392*cdf0e10cSrcweir //                css::uno::RuntimeException);
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir };
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir }
397*cdf0e10cSrcweir }
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir #endif
400*cdf0e10cSrcweir 
401