ooodev.adapter.deployment.package_manager_partial module

class ooodev.adapter.deployment.package_manager_partial.PackageManagerPartial(component, interface=com.sun.star.deployment.XPackageManager)[source]

Bases: object

Partial class for XPackageManager.

Parameters:
  • component (XPackageManager) –

  • interface (UnoInterface | None) –

__init__(component, interface=com.sun.star.deployment.XPackageManager)[source]

Constructor

Parameters:
  • component (XPackageManager) – UNO Component that implements com.sun.star.deployment.XPackageManager interface.

  • interface (UnoInterface, optional) – The interface to be validated. Defaults to XPackageManager.

Return type:

None

add_package(url, media_type, abort_channel, cmd_env, *properties)[source]

adds a UNO package.

The properties argument is currently only used to suppress the license information for shared extensions.

Raises:
  • DeploymentExceptionDeploymentException

  • com.sun.star.ucb.CommandFailedExceptionCommandFailedException

  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

XPackage

Parameters:
  • url (str) –

  • media_type (str) –

  • abort_channel (com.sun.star.task.XAbortChannel) –

  • cmd_env (com.sun.star.ucb.XCommandEnvironment) –

  • properties (com.sun.star.beans.NamedValue) –

check_prerequisites(extension, abort_channel, cmd_env)[source]

checks if the extension can be used.

The extension must be managed by this package manager, that is, it must be recorded in its database. The package manager calls XPackage.checkPrerequisites and updates its data base with the result. The result, which is from Prerequisites will be returned.

Raises:
  • DeploymentExceptionDeploymentException

  • com.sun.star.ucb.CommandFailedExceptionCommandFailedException

  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

int

Parameters:
  • extension (com.sun.star.deployment.XPackage) –

  • abort_channel (com.sun.star.task.XAbortChannel) –

  • cmd_env (com.sun.star.ucb.XCommandEnvironment) –

create_abort_channel()[source]

creates a command channel to be used to asynchronously abort a command.

Return type:

XAbortChannel

get_context()[source]

returns the underlying deployment context, that is, the name of the repository.

Return type:

str

get_deployed_package(identifier, file_name, cmd_env)[source]

gets a deployed package.

Raises:
  • DeploymentExceptionDeploymentException

  • com.sun.star.ucb.CommandFailedExceptionCommandFailedException

  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

XPackage

Parameters:
  • identifier (str) –

  • file_name (str) –

  • cmd_env (com.sun.star.ucb.XCommandEnvironment) –

get_deployed_packages(abort_channel, cmd_env)[source]

gets all currently deployed packages.

Raises:
  • DeploymentExceptionDeploymentException

  • com.sun.star.ucb.CommandFailedExceptionCommandFailedException

  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

Tuple[XPackage, ...]

Parameters:
  • abort_channel (com.sun.star.task.XAbortChannel) –

  • cmd_env (com.sun.star.ucb.XCommandEnvironment) –

get_extensions_with_unaccepted_licenses(cmd_env)[source]

returns all extensions which are currently not in use because the user did not accept the license.

The function will not return any object for the user repository, because a user extension will not be kept in the user repository if its license is declined. Only extensions which are registered at start-up of OOo, that is, shared and bundled extensions, can be returned.

Extensions which allow the license to be suppressed, that is, it does not need to be displayed, and which are installed with the corresponding option, are also not returned.

Raises:

DeploymentExceptionDeploymentException

Return type:

Tuple[XPackage, ...]

Parameters:

cmd_env (com.sun.star.ucb.XCommandEnvironment) –

get_supported_package_types()[source]

gets the supported XPackageTypeInfos.

Return type:

Tuple[XPackageTypeInfo, ...]

import_extension(extension, abort_channel, cmd_env)[source]

adds an extension.

This copies the extension. If it was from the same repository, which is represented by this XPackageManager interface, then nothing happens.

Raises:
  • DeploymentExceptionDeploymentException

  • com.sun.star.ucb.CommandFailedExceptionCommandFailedException

  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

XPackage

Parameters:
  • extension (com.sun.star.deployment.XPackage) –

  • abort_channel (com.sun.star.task.XAbortChannel) –

  • cmd_env (com.sun.star.ucb.XCommandEnvironment) –

is_read_only()[source]

indicates that this implementation cannot be used for tasks which require write access to the location where the extensions are installed.

Normally one would call a method and handle the exception if writing failed. However, a GUI interface may need to know beforehand if writing is allowed. For example, the Extension Manager dialog needs to enable / disable the Add button depending if the user has write permission. Only the XPackageManager implementation knows the location of the installed extensions. Therefore it is not possible to check “externally” for write permission.

Return type:

bool

reinstall_deployed_packages(force, abort_channel, cmd_env)[source]

Expert feature: erases the underlying registry cache and reinstalls all previously added packages.

Please keep in mind that all registration status get lost.

Please use this in case of suspected cache inconsistencies only.

Raises:
  • DeploymentExceptionDeploymentException

  • com.sun.star.ucb.CommandFailedExceptionCommandFailedException

  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

None

Parameters:
  • force (bool) –

  • abort_channel (com.sun.star.task.XAbortChannel) –

  • cmd_env (com.sun.star.ucb.XCommandEnvironment) –

remove_package(identifier, fileName, abort_channel, cmd_env)[source]

removes a UNO package.

Raises:
  • DeploymentExceptionDeploymentException

  • com.sun.star.ucb.CommandFailedExceptionCommandFailedException

  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

None

Parameters:
  • identifier (str) –

  • fileName (str) –

  • abort_channel (com.sun.star.task.XAbortChannel) –

  • cmd_env (com.sun.star.ucb.XCommandEnvironment) –

synchronize(abort_channel, cmd_env)[source]

synchronizes the extension database with the contents of the extensions folder.

Added extensions will be added to the database and removed extensions will be removed from the database.

Raises:
  • DeploymentExceptionDeploymentException

  • com.sun.star.ucb.ContentCreationExceptionContentCreationException

  • com.sun.star.ucb.CommandFailedExceptionCommandFailedException

  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

Return type:

bool

Parameters:
  • abort_channel (com.sun.star.task.XAbortChannel) –

  • cmd_env (com.sun.star.ucb.XCommandEnvironment) –