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