Processing Extensions

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 09:18, 8 June 2010 by Jl (Talk | contribs)

Jump to: navigation, search



(As of OOo 3.3)

Checking for modification during start-up

Every time OOo is started it needs to check if extensions were removed from or added to the shared or bundled repository. If this is the case, then the registration data of the repository must be updated accordingly and OOo is restarted.

The restart is particularly necessary when extensions are removed to avoid that parts of the extension are still accessible. For example, menu entries of an removed extension will only disappear after a restart. Similarly a service from an extension may already be running before the registration data is updated. Then the service will be available as long as OOo runs although the extension is removed. The reason for this is, that a shared extension is not immediately deleted from the hard disk when it is removed.

Because OOo checks for added or removed extensions at start-up, this must be very quick. To achieve this, OOo compares the modification time of extension folders of the repositories with the time of the most recently performed check. This time is “saved” in the file lastsynchronized in the registration data folder of the repositories. In fact, the modification time of the file is used rather then a value is written into the file. If the modification time of the extension folder is more recent, then the extension manager will check if extensions were added or removed and update its database accordingly. This is of course an implementation detail and may change at any time.

Adding

Adding a user extension

A user extension is extracted into a folder with a unique name which in turn is contained in the extensions folder. The additional folder with the unique name is necessary to make live deployment possible. When removing an extension, it is only marked as “unusable” and the extension is not deleted, because it may still be in use. If now the same extension is installed again in the same process, then it will be extracted to another folder with a unique name. This prevents a name clash with the folder name of the previously “removed” extension. The user can now repeat to remove and install the extension in the same process. This results in having the same extension multiple times in the extensions folder of the repository, but everyone is contained in a folder with a unique name. The folders of the “removed” extensions, as well as the folders which contain them, are only removed after running the extension manager after restarting OOo.

The extension database of repository is updated and the new active extension is determined.

Adding a shared extension

For the user who adds a shared extension, the extension is processed the same way as a user extension.

For all other users, the extension manager processes the extension the next time they start OOo. The extension database of repository is updated and the new active extension is determined.

Adding a bundled extension

A bundled extension is installed by the installation program of OOo. The folder of the extension, including all files contained therein, is copied into the extensions folder of the bundled repository. Only when a user starts OOo, then the extension manager processes the extension. The extension database of repository is updated and the new active extension is determined.

Removing

Removing a user extension

The entry in the extension database of the repository referring to this extension will be deleted and the active extension will be determined. The extension will be deleted when the user runs the extension manager after restarting OOo.

Removing a shared extension

The extension will be revoked if it was registered. To prevent other users from using the extension it is marked to be deleted. This is done by creating a tag file, the "extension removed file", next to the folder with the unique name. This way, the information that the extension was deleted can be accessed by all users. If this file does not exist and there is no entry in the extensions database, then it is assumed that the extension was added. The file will be deleted when the extension is deleted. The file also contains the name of the user who removed the extension. If the same user runs the extension manager after restarting OOo, then the extension, the unique folder, temp file and the "extensions removed file are deleted. Why it must be the same user shows the following scenario:

A user starts OOo and uses the extension. The extension will then be removed and OOo keeps running. Now a second user, who also has write access to the extensions folder, starts OOo. When the extension manager starts it would properly delete extensions which were previously removed. However in this case this would affect the office of the first user which still uses that extension. The same user cannot start another instance, because this is prevented by the lock file.

For all other users, the extension manager processes the extension the next time they start OOo. This includes the detection of the removed extensions. An extension is regarded as removed if:

  • The unique folder, tmp file, extension folder do not exist anymore.
  • There is a "extension removed file"
  • The extension exists but has a different identifier or version than the one which was previously at the same location. This may happen when the extension was updated, or a previous office update removed the extension and another with the same name was added in the latest office update.

The extension could also have the same file name. The entry in the extension database of the repository referring to this extension will be deleted and the active extension will be determined.

Removing a bundled extension

A bundled extension can only be removed by the set-up. The folder of the extension, including all files contained in it, is deleted from the extension folder of the bundled repository.

If a user starts OOo, then the extension manager processes the removed extension. This includes the detection of the removed extensions. An extension is regarded as removed if:

  • The extension folder do not exist anymore.
  • The extension exists but has a different identifier or version than the one which was previously at the same location.

The entry in the extension database of the repository referring to this extension will be deleted and the active extension will be determined.

Updating

An update consists of first removing the extension and then adding the new extension. That is, this is already covered by these two scenarios.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages