Interface InstallerManager

All Superinterfaces:
org.gvsig.tools.service.Manager

public interface InstallerManager extends org.gvsig.tools.service.Manager

This manager is used to register and create the services that are used to manage the creation and the execution of installers. An installer is a file called bundle that is composed of a set packages.

A package has some information that is defined by the PackageInfo class and is composed of a set of attributes. One of these attributes, the type, denotes if the package is a plugin, theme, translation, etc.

In practice a bundle is just a compressed zip file that has a compressed zip file for every package to install. The structure of a bundle file with two packages of type plugin could be:

 - bundle (compressed file)
                - org.gvsig.plugin1-1_0_0-23 (compressed file)
                        - org.gvsig.plugin1
                                - package.info                          
        - org.gvsig.plugin2-2_0_1-35 (compressed file)
                - org.gvsig.plugin1
                        - package.info
 

bundle is the compressed file that contains a zip entry for every package to install. The name of the zip entry follows next pattern:

                [package code]-[version]-[build]
 

Every zip entry contains a main folder inside that contains all the package files that are used in the installation process. Depending of the type of packages, the information inside this folder can be different, but all the types of packages have to have the package.infofile that has all the package information. To see the package.info description see PackageInfo.

The services that offers this managers are basically two: the creation of bundles for just one package of plugin type and a service for the installation of packages from a bundle.

Author:
Jorge Piera Llodrá
  • Field Details

  • Method Details

    • registerMakePluginPackageService

      void registerMakePluginPackageService(Class<? extends MakePluginPackageService> clazz)
      It registers a class that implements the service for the creation of bundle that contains inside a package of type plugin. The registered class have to implement the MakePluginPackageService interface.
      Parameters:
      clazz - class that implements the MakePluginPackageService interface.
    • getMakePluginPackageService

      MakePluginPackageService getMakePluginPackageService() throws MakePluginPackageServiceException
      It creates and returns an object that is used to create a bundle that contains inside a package of type plugin. All the parameters are set using the MakePluginPackageService interface. *
      Returns:
      an object that is used to create a plugin installer
      Throws:
      MakePluginPackageServiceException
      MakePluginPackageServiceException - when there is a problem creating the service
    • getInstalledPackages

      org.gvsig.installer.lib.api.PackageInfo[] getInstalledPackages(File pluginsDirectory) throws MakePluginPackageServiceException
      Returns a list of package infos for the already installed plugins.
      Parameters:
      pluginsDirectory - where to look for the installed plugins
      Returns:
      the list of package infos for the already installed plugins
      Throws:
      MakePluginPackageServiceException - if there is an error loading the information of the installed plugins
    • getInstalledPackages

      org.gvsig.installer.lib.api.PackageInfo[] getInstalledPackages() throws MakePluginPackageServiceException
      Returns a list of package infos for the already installed plugins.
      Returns:
      the list of package infos for the already installed plugins
      Throws:
      MakePluginPackageServiceException - if there is an error loading the information of the installed plugins
    • getPackageSetNameFormat

      String getPackageSetNameFormat()
      Returns the package bundle file name format.

      The string has to use a suitable MessageFormat format, and the available field numbers are the ones defined in the BUNDLE_FILE_NAME_FIELDS interface.

      Returns:
      the package bundle file name format.
    • setPackageSetNameFormat

      void setPackageSetNameFormat(String packageBundleNameFormat)
      Sets the package bundle file name format.
      Parameters:
      packageBundleNameFormat - the package bundle file name format.
      See Also:
    • getPackageSetFileName

      String getPackageSetFileName(org.gvsig.installer.lib.api.PackageInfo info)
      Returns the name of the package set file for a given package info.
      Parameters:
      info - of the plugin
      Returns:
      the name of the package set file
    • getPackageFileName

      String getPackageFileName(org.gvsig.installer.lib.api.PackageInfo info)
      Returns the name of the package file for a given package info.
      Parameters:
      info - of the plugin
      Returns:
      the name of the package file
    • getPackageIndexFileName

      String getPackageIndexFileName(org.gvsig.installer.lib.api.PackageInfo info)
      Returns the name of the package index file for a given package info.
      Parameters:
      info - of the plugin
      Returns:
      the name of the package index file
    • registerInstallPackageService

      void registerInstallPackageService(Class<? extends InstallPackageService> clazz)
      It registers a class that implements the service for the installation of a package that is inside a bundle. This class has to implement the InstallPackageService interface.
      Parameters:
      clazz - class that implements the InstallPackageService interface.
    • getInstallPackageService

      InstallPackageService getInstallPackageService() throws InstallPackageServiceException
      It creates and returns an object that is used to install a package in gvSIG. All the parameters are set using the InstallPackageService interface.
      Returns:
      an object that is used to install the package.
      Throws:
      InstallPackageServiceException - when there is a problem creating the service.
    • getDefaultPackageFileExtension

      String getDefaultPackageFileExtension()
      Returns the default extensions of the package files.
      Returns:
      the default extensions of the package files
    • getDefaultPackageSetFileExtension

      String getDefaultPackageSetFileExtension()
      Returns the default extensions of the package set files.
      Returns:
      the default extensions of the package set files
    • getDefaultIndexSetFileExtension

      String getDefaultIndexSetFileExtension()
      Returns the default extensions of the index set files.
      Returns:
      the default extensions of the index set files
    • getOperatingSystem

      String getOperatingSystem()
      Return the OS code of the system
      Returns:
      os code of the system
    • getOperatingSystemFamily

      String getOperatingSystemFamily()
    • getOperatingSystemName

      String getOperatingSystemName()
    • getOperatingSystemVersion

      String getOperatingSystemVersion()
    • getArchitecture

      String getArchitecture()
      Returns the Architecture code of the system
      Returns:
      architecture code of the system
    • createDependency

      org.gvsig.installer.lib.api.Dependency createDependency()
      Create a empty dependency object.
      Returns:
      the dependency
    • createDependency

      org.gvsig.installer.lib.api.Dependency createDependency(org.gvsig.installer.lib.api.PackageInfo packageInfo)
      Create a dependency instance with the data of the package.
      Parameters:
      packageInfo -
      Returns:
      a dependency of the package
    • createDependenciesCalculator

      DependenciesCalculator createDependenciesCalculator(InstallPackageService installService)
      Create a dependencies calculator.
      Returns:
      the dependencias calculator
    • createVersion

      org.gvsig.installer.lib.api.Version createVersion()
      Create a version instance
      Returns:
      the version
    • createPackageInfo

      org.gvsig.installer.lib.api.PackageInfo createPackageInfo()
    • createPackageInfo

      org.gvsig.installer.lib.api.PackageInfo createPackageInfo(InputStream packegeinfo) throws org.gvsig.tools.exception.BaseException
      Create a PackageInfo and load contents from the specified InputStream using the default reader.
      Parameters:
      packegeinfo - as URL
      Returns:
      the created packageInfo
      Throws:
      IOException
      org.gvsig.tools.exception.BaseException
    • getDefaultPackageInfoWriter

      PackageInfoWriter getDefaultPackageInfoWriter()
    • getDefaultPackageInfoReader

      PackageInfoReader getDefaultPackageInfoReader()
    • createMakePackage

      MakePackageService createMakePackage(File packageFolder, org.gvsig.installer.lib.api.PackageInfo packageInfo)
    • setDownloadBaseURL

      void setDownloadBaseURL(URL url)
    • getDownloadBaseURL

      URL getDownloadBaseURL()
    • setVersion

      void setVersion(org.gvsig.installer.lib.api.Version version)
    • getVersionEx

      org.gvsig.installer.lib.api.Version getVersionEx()
    • setVersion

      void setVersion(String version)
      Parameters:
      version -
    • getVersion

      String getVersion()
      Returns:
    • getLocalAddonRepositories

      List<File> getLocalAddonRepositories()
      Gets a List of all the folders where there might be addons folders (addons repositories).
      Returns:
      list of repositories paths
    • getLocalAddonRepositories

      List<File> getLocalAddonRepositories(String type)
      Gets a List of all the folders where there might be addons folders for the specified type of packages (addons repositories).
      Returns:
      list of repositories paths
    • addLocalAddonRepository

      void addLocalAddonRepository(File path, String type)
      Adds an addon local repository location to the manager list, and register the type of addons for this repository.
      Parameters:
      path - of the repository
      type - of addons in this repository
    • addLocalAddonRepository

      void addLocalAddonRepository(File path)
    • getDefaultLocalRepositoryType

      String getDefaultLocalRepositoryType(File file)
      Retrieve the default type of addons for the file. Use the registry of local addon repositories to identify the type for this file.
      Parameters:
      file -
      Returns:
    • getAddonFolders

      List<File> getAddonFolders()
      Gets a List of all the addon folders. An addon folder is a folder inside any addon repository with a package.info file inside. (addons repositories).
      Returns:
      list of addon paths folders.
    • getAddonFolders

      List<File> getAddonFolders(String type)
      Gets a List of all the addon folders of a type of package. An addon folder is a folder inside any addon repository with a package.info file inside. (addons repositories).
      Returns:
      list of addon paths folders.
    • getAddonFolder

      File getAddonFolder(String code)
      Gets the folder of the addon with the code provided, or null if not found.
      Parameters:
      code - of the addon
      Returns:
      File of the folder of the addon.
    • setDefaultLocalAddonRepository

      void setDefaultLocalAddonRepository(File defaultAddonsRepository)
      The local addons folder where normally all addons are installed.
      Parameters:
      defaultAddonsRepository -
    • getDefaultLocalAddonRepository

      File getDefaultLocalAddonRepository()
      The local addons folder where normally all addons are installed.
      Returns:
      default addons repository folder.
    • getDefaultLocalAddonRepository

      File getDefaultLocalAddonRepository(String packageType, int access)
      Get the path to the default local repository for a type of package. Grant that the path has the access required, can be: ACCESS_READ ACCESS_WRITE If don't has a repository for this type of package or don't has the requiered access mode return null.
      Parameters:
      packageType - type of package for that ask the default path
      access - type of access to the repository.
      Returns:
      the path to the repository
    • getDefaultLocalAddonRepository

      File getDefaultLocalAddonRepository(String packageType)
      Get the path to the default local repository for a type of package. This is a utility method using by default ACCESS_READ to the reppository.
      Parameters:
      packageType - type of package for that ask the default path
      Returns:
      the path to the repository
    • setDefaultLocalAddonRepository

      void setDefaultLocalAddonRepository(File defaultAddonsRepository, String packageType)
      Set the path to the default local repository for a type of package
      Parameters:
      defaultAddonsRepository - path to the repository
      packageType - type of package in this repository path
    • getPublicKeys

      List<byte[]> getPublicKeys()
    • hasProviderToThisPackage

      boolean hasProviderToThisPackage(org.gvsig.installer.lib.api.PackageInfo packageInfo)
    • needAdminRights

      boolean needAdminRights()