2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2004-08-12 11:07:07 +00:00
|
|
|
|
2013-10-28 03:35:57 +01:00
|
|
|
#ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_MANAGER_DP_MANAGER_H
|
|
|
|
#define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_MANAGER_DP_MANAGER_H
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
#include "dp_manager.hrc"
|
|
|
|
#include "dp_misc.h"
|
|
|
|
#include "dp_interact.h"
|
2007-01-18 14:00:22 +00:00
|
|
|
#include "dp_activepackages.hxx"
|
2014-06-04 10:55:43 +02:00
|
|
|
#include <rtl/ref.hxx>
|
|
|
|
#include <cppuhelper/compbase1.hxx>
|
|
|
|
#include <cppuhelper/implbase2.hxx>
|
|
|
|
#include <ucbhelper/content.hxx>
|
|
|
|
#include <com/sun/star/deployment/XPackageRegistry.hpp>
|
|
|
|
#include <com/sun/star/deployment/XPackageManager.hpp>
|
2004-08-12 11:07:07 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
namespace dp_manager {
|
|
|
|
|
|
|
|
typedef ::cppu::WeakComponentImplHelper1<
|
|
|
|
css::deployment::XPackageManager > t_pm_helper;
|
|
|
|
|
2014-02-25 18:19:04 +01:00
|
|
|
|
2004-08-12 11:07:07 +00:00
|
|
|
class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper
|
|
|
|
{
|
|
|
|
css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_context;
|
|
|
|
OUString m_registrationData;
|
|
|
|
OUString m_registrationData_expanded;
|
|
|
|
OUString m_registryCache;
|
2004-08-12 11:07:07 +00:00
|
|
|
bool m_readOnly;
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_activePackages;
|
|
|
|
OUString m_activePackages_expanded;
|
2014-09-30 12:26:27 +02:00
|
|
|
::std::unique_ptr< ActivePackages > m_activePackagesDB;
|
2008-02-12 15:18:35 +00:00
|
|
|
//This mutex is only used for synchronization in addPackage
|
|
|
|
::osl::Mutex m_addMutex;
|
2004-08-12 11:07:07 +00:00
|
|
|
css::uno::Reference<css::ucb::XProgressHandler> m_xLogFile;
|
|
|
|
inline void logIntern( css::uno::Any const & status );
|
|
|
|
void fireModified();
|
|
|
|
|
|
|
|
css::uno::Reference<css::deployment::XPackageRegistry> m_xRegistry;
|
|
|
|
|
2006-10-12 13:08:58 +00:00
|
|
|
void initRegistryBackends();
|
2004-08-12 11:07:07 +00:00
|
|
|
void initActivationLayer(
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv );
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString detectMediaType(
|
2007-06-05 14:05:22 +00:00
|
|
|
::ucbhelper::Content const & ucbContent, bool throw_exc = true );
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString insertToActivationLayer(
|
2010-04-19 11:33:33 +02:00
|
|
|
css::uno::Sequence<css::beans::NamedValue> const & properties,
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & mediaType,
|
2007-06-05 14:05:22 +00:00
|
|
|
::ucbhelper::Content const & sourceContent,
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & title, ActivePackages::Data * dbData );
|
2006-10-04 15:54:26 +00:00
|
|
|
void insertToActivationLayerDB(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & id, ActivePackages::Data const & dbData );
|
2006-10-04 15:54:26 +00:00
|
|
|
|
2015-04-07 13:16:24 +02:00
|
|
|
static void deletePackageFromCache(
|
2006-10-04 15:54:26 +00:00
|
|
|
css::uno::Reference<css::deployment::XPackage> const & xPackage,
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & destFolder );
|
2006-10-04 15:54:26 +00:00
|
|
|
|
2010-05-04 12:37:01 +02:00
|
|
|
bool isInstalled(
|
|
|
|
css::uno::Reference<css::deployment::XPackage> const & package);
|
2004-08-12 11:07:07 +00:00
|
|
|
|
2010-05-17 10:40:52 +02:00
|
|
|
bool synchronizeRemovedExtensions(
|
2010-05-04 12:37:01 +02:00
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
|
2006-12-19 10:43:51 +00:00
|
|
|
|
2010-05-17 10:40:52 +02:00
|
|
|
bool synchronizeAddedExtensions(
|
2010-05-04 12:37:01 +02:00
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
|
2006-12-19 10:43:51 +00:00
|
|
|
|
2004-08-12 11:07:07 +00:00
|
|
|
class CmdEnvWrapperImpl
|
|
|
|
: public ::cppu::WeakImplHelper2< css::ucb::XCommandEnvironment,
|
|
|
|
css::ucb::XProgressHandler >
|
|
|
|
{
|
|
|
|
css::uno::Reference<css::ucb::XProgressHandler> m_xLogFile;
|
|
|
|
css::uno::Reference<css::ucb::XProgressHandler> m_xUserProgress;
|
|
|
|
css::uno::Reference<css::task::XInteractionHandler>
|
|
|
|
m_xUserInteractionHandler;
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~CmdEnvWrapperImpl();
|
|
|
|
CmdEnvWrapperImpl(
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment>
|
|
|
|
const & xUserCmdEnv,
|
|
|
|
css::uno::Reference<css::ucb::XProgressHandler> const & xLogFile );
|
|
|
|
|
|
|
|
// XCommandEnvironment
|
|
|
|
virtual css::uno::Reference<css::task::XInteractionHandler> SAL_CALL
|
2014-03-26 16:37:00 +01:00
|
|
|
getInteractionHandler() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
virtual css::uno::Reference<css::ucb::XProgressHandler> SAL_CALL
|
2014-03-26 16:37:00 +01:00
|
|
|
getProgressHandler() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
// XProgressHandler
|
|
|
|
virtual void SAL_CALL push( css::uno::Any const & Status )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
virtual void SAL_CALL update( css::uno::Any const & Status )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
|
|
|
virtual void SAL_CALL pop() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
protected:
|
|
|
|
inline void check();
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void SAL_CALL disposing() SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
virtual ~PackageManagerImpl();
|
|
|
|
inline PackageManagerImpl(
|
|
|
|
css::uno::Reference<css::uno::XComponentContext>
|
2013-04-07 12:06:47 +02:00
|
|
|
const & xComponentContext, OUString const & context )
|
2004-08-12 11:07:07 +00:00
|
|
|
: t_pm_helper( getMutex() ),
|
|
|
|
m_xComponentContext( xComponentContext ),
|
|
|
|
m_context( context ),
|
2010-05-04 12:37:01 +02:00
|
|
|
m_readOnly( true )
|
2004-08-12 11:07:07 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static css::uno::Reference<css::deployment::XPackageManager> create(
|
|
|
|
css::uno::Reference<css::uno::XComponentContext>
|
2013-04-07 12:06:47 +02:00
|
|
|
const & xComponentContext, OUString const & context );
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
// XComponent
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void SAL_CALL dispose() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
virtual void SAL_CALL addEventListener(
|
|
|
|
css::uno::Reference<css::lang::XEventListener> const & xListener )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
virtual void SAL_CALL removeEventListener(
|
|
|
|
css::uno::Reference<css::lang::XEventListener> const & xListener )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
// XModifyBroadcaster
|
|
|
|
virtual void SAL_CALL addModifyListener(
|
|
|
|
css::uno::Reference<css::util::XModifyListener> const & xListener )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
virtual void SAL_CALL removeModifyListener(
|
|
|
|
css::uno::Reference<css::util::XModifyListener> const & xListener )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
// XPackageManager
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual OUString SAL_CALL getContext()
|
2014-03-26 16:37:00 +01:00
|
|
|
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-11-09 13:07:46 +00:00
|
|
|
virtual css::uno::Sequence<
|
|
|
|
css::uno::Reference<css::deployment::XPackageTypeInfo> > SAL_CALL
|
2014-03-26 16:37:00 +01:00
|
|
|
getSupportedPackageTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-11-09 13:07:46 +00:00
|
|
|
|
2004-08-12 11:07:07 +00:00
|
|
|
virtual css::uno::Reference<css::task::XAbortChannel> SAL_CALL
|
2014-03-26 16:37:00 +01:00
|
|
|
createAbortChannel() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL addPackage(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & url,
|
2010-04-19 11:33:33 +02:00
|
|
|
css::uno::Sequence<css::beans::NamedValue> const & properties,
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & mediaType,
|
2004-08-12 11:07:07 +00:00
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
|
|
|
|
throw (css::deployment::DeploymentException,
|
|
|
|
css::ucb::CommandFailedException,
|
|
|
|
css::ucb::CommandAbortedException,
|
|
|
|
css::lang::IllegalArgumentException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
2010-05-04 12:37:01 +02:00
|
|
|
virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL importExtension(
|
|
|
|
css::uno::Reference<css::deployment::XPackage> const & extension,
|
2004-08-12 11:07:07 +00:00
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
2010-05-04 12:37:01 +02:00
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
|
|
|
|
throw (css::deployment::DeploymentException,
|
|
|
|
css::ucb::CommandFailedException,
|
|
|
|
css::ucb::CommandAbortedException,
|
|
|
|
css::lang::IllegalArgumentException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2006-07-13 16:05:48 +00:00
|
|
|
|
2004-08-12 11:07:07 +00:00
|
|
|
virtual void SAL_CALL removePackage(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & id, OUString const & fileName,
|
2004-08-12 11:07:07 +00:00
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
|
|
|
|
throw (css::deployment::DeploymentException,
|
|
|
|
css::ucb::CommandFailedException,
|
|
|
|
css::ucb::CommandAbortedException,
|
|
|
|
css::lang::IllegalArgumentException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString getDeployPath( ActivePackages::Data const & data );
|
2004-08-12 11:07:07 +00:00
|
|
|
css::uno::Reference<css::deployment::XPackage> SAL_CALL getDeployedPackage_(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & id, OUString const & fileName,
|
2007-01-18 14:00:22 +00:00
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv );
|
|
|
|
css::uno::Reference<css::deployment::XPackage> getDeployedPackage_(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & id, ActivePackages::Data const & data,
|
2004-08-12 11:07:07 +00:00
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
|
|
|
|
bool ignoreAlienPlatforms = false );
|
|
|
|
virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL
|
|
|
|
getDeployedPackage(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & id, OUString const & fileName,
|
2004-08-12 11:07:07 +00:00
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
|
|
|
|
throw (css::deployment::DeploymentException,
|
|
|
|
css::ucb::CommandFailedException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
css::uno::Sequence< css::uno::Reference<css::deployment::XPackage> >
|
|
|
|
getDeployedPackages_(
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv );
|
|
|
|
virtual css::uno::Sequence< css::uno::Reference<css::deployment::XPackage> >
|
|
|
|
SAL_CALL getDeployedPackages(
|
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
|
|
|
|
throw (css::deployment::DeploymentException,
|
|
|
|
css::ucb::CommandFailedException,
|
|
|
|
css::ucb::CommandAbortedException,
|
|
|
|
css::lang::IllegalArgumentException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2004-08-12 11:07:07 +00:00
|
|
|
|
|
|
|
virtual void SAL_CALL reinstallDeployedPackages(
|
2012-08-24 16:45:20 +02:00
|
|
|
sal_Bool force,
|
2004-08-12 11:07:07 +00:00
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
|
|
|
|
throw (css::deployment::DeploymentException,
|
|
|
|
css::ucb::CommandFailedException,
|
|
|
|
css::ucb::CommandAbortedException,
|
|
|
|
css::lang::IllegalArgumentException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2007-07-06 11:36:28 +00:00
|
|
|
|
|
|
|
virtual ::sal_Bool SAL_CALL isReadOnly( )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2010-05-04 12:37:01 +02:00
|
|
|
|
2010-05-17 10:40:52 +02:00
|
|
|
virtual ::sal_Bool SAL_CALL synchronize(
|
2010-05-04 12:37:01 +02:00
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
|
|
|
|
throw (css::deployment::DeploymentException,
|
2014-10-25 16:01:03 +01:00
|
|
|
css::ucb::ContentCreationException,
|
2010-05-04 12:37:01 +02:00
|
|
|
css::ucb::CommandFailedException,
|
|
|
|
css::ucb::CommandAbortedException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2010-05-04 12:37:01 +02:00
|
|
|
|
2010-04-19 11:33:33 +02:00
|
|
|
virtual css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> > SAL_CALL
|
|
|
|
getExtensionsWithUnacceptedLicenses(
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
|
|
|
|
throw (css::deployment::DeploymentException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2010-04-19 11:33:33 +02:00
|
|
|
|
|
|
|
virtual sal_Int32 SAL_CALL checkPrerequisites(
|
|
|
|
css::uno::Reference<css::deployment::XPackage> const & extension,
|
|
|
|
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
|
|
|
|
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
|
|
|
|
throw (css::deployment::DeploymentException,
|
|
|
|
css::ucb::CommandFailedException,
|
|
|
|
css::ucb::CommandAbortedException,
|
|
|
|
css::lang::IllegalArgumentException,
|
2014-03-26 16:37:00 +01:00
|
|
|
css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2010-04-19 11:33:33 +02:00
|
|
|
};
|
2004-08-12 11:07:07 +00:00
|
|
|
|
2014-02-25 18:19:04 +01:00
|
|
|
|
2004-08-12 11:07:07 +00:00
|
|
|
inline void PackageManagerImpl::check()
|
|
|
|
{
|
|
|
|
::osl::MutexGuard guard( getMutex() );
|
|
|
|
if (rBHelper.bInDispose || rBHelper.bDisposed)
|
|
|
|
throw css::lang::DisposedException(
|
2012-12-30 11:30:44 +01:00
|
|
|
"PackageManager instance has already been disposed!",
|
2004-08-12 11:07:07 +00:00
|
|
|
static_cast< ::cppu::OWeakObject * >(this) );
|
|
|
|
}
|
|
|
|
|
2014-02-25 18:19:04 +01:00
|
|
|
|
2004-08-12 11:07:07 +00:00
|
|
|
inline void PackageManagerImpl::logIntern( css::uno::Any const & status )
|
|
|
|
{
|
|
|
|
if (m_xLogFile.is())
|
|
|
|
m_xLogFile->update( status );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-10-27 13:11:31 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|