Interface InstallerManager
- All Superinterfaces:
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á
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceSupported architecture default values.static interfaceSupported Java virtual machine version default values.static interfaceSupported operating system default values.static interfaceFields into the bundle file name message format.static interfacePackage state default values. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocalAddonRepository(File path) voidaddLocalAddonRepository(File path, String type) Adds an addon local repository location to the manager list, and register the type of addons for this repository.createDependenciesCalculator(InstallPackageService installService) Create a dependencies calculator.org.gvsig.installer.lib.api.DependencyCreate a empty dependency object.org.gvsig.installer.lib.api.DependencycreateDependency(org.gvsig.installer.lib.api.PackageInfo packageInfo) Create a dependency instance with the data of the package.createMakePackage(File packageFolder, org.gvsig.installer.lib.api.PackageInfo packageInfo) org.gvsig.installer.lib.api.PackageInfoorg.gvsig.installer.lib.api.PackageInfocreatePackageInfo(InputStream packegeinfo) Create a PackageInfo and load contents from the specified InputStream using the default reader.org.gvsig.installer.lib.api.VersionCreate a version instancegetAddonFolder(String code) Gets the folder of the addon with the code provided, or null if not found.Gets a List of all the addon folders.getAddonFolders(String type) Gets a List of all the addon folders of a type of package.Returns the Architecture code of the systemReturns the default extensions of the index set files.The local addons folder where normally all addons are installed.getDefaultLocalAddonRepository(String packageType) Get the path to the default local repository for a type of package.getDefaultLocalAddonRepository(String packageType, int access) Get the path to the default local repository for a type of package.Retrieve the default type of addons for the file.Returns the default extensions of the package files.Returns the default extensions of the package set files.org.gvsig.installer.lib.api.PackageInfo[]Returns a list of package infos for the already installed plugins.org.gvsig.installer.lib.api.PackageInfo[]getInstalledPackages(File pluginsDirectory) Returns a list of package infos for the already installed plugins.It creates and returns an object that is used to install a package in gvSIG.Gets a List of all the folders where there might be addons folders (addons repositories).Gets a List of all the folders where there might be addons folders for the specified type of packages (addons repositories).It creates and returns an object that is used to create a bundle that contains inside a package of type plugin.Return the OS code of the systemgetPackageFileName(org.gvsig.installer.lib.api.PackageInfo info) Returns the name of the package file for a given package info.getPackageIndexFileName(org.gvsig.installer.lib.api.PackageInfo info) Returns the name of the package index file for a given package info.getPackageSetFileName(org.gvsig.installer.lib.api.PackageInfo info) Returns the name of the package set file for a given package info.Returns the package bundle file name format.List<byte[]> org.gvsig.installer.lib.api.VersionbooleanhasProviderToThisPackage(org.gvsig.installer.lib.api.PackageInfo packageInfo) booleanvoidregisterInstallPackageService(Class<? extends InstallPackageService> clazz) It registers a class that implements the service for the installation of a package that is inside a bundle.voidregisterMakePluginPackageService(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.voidsetDefaultLocalAddonRepository(File defaultAddonsRepository) The local addons folder where normally all addons are installed.voidsetDefaultLocalAddonRepository(File defaultAddonsRepository, String packageType) Set the path to the default local repository for a type of packagevoidsetDownloadBaseURL(URL url) voidsetPackageSetNameFormat(String packageBundleNameFormat) Sets the package bundle file name format.voidsetVersion(String version) voidsetVersion(org.gvsig.installer.lib.api.Version version) Methods inherited from interface org.gvsig.tools.service.Manager
createServiceParameters, getService
-
Field Details
-
PACKAGE_INDEX_EXTENSION
- See Also:
-
PACKAGE_SET_EXTENSION
- See Also:
-
PACKAGE_EXTENSION
- See Also:
-
PACKAGE_INFO_FILE_NAME
- See Also:
-
ACCESS_READ
static final int ACCESS_READ- See Also:
-
ACCESS_WRITE
static final int ACCESS_WRITE- See Also:
-
-
Method Details
-
registerMakePluginPackageService
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 theMakePluginPackageServiceinterface.- Parameters:
clazz- class that implements theMakePluginPackageServiceinterface.
-
getMakePluginPackageService
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 theMakePluginPackageServiceinterface. *- Returns:
- an object that is used to create a plugin installer
- Throws:
MakePluginPackageServiceExceptionMakePluginPackageServiceException- 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 MakePluginPackageServiceExceptionReturns 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
MessageFormatformat, and the available field numbers are the ones defined in the BUNDLE_FILE_NAME_FIELDS interface.- Returns:
- the package bundle file name format.
-
setPackageSetNameFormat
Sets the package bundle file name format.- Parameters:
packageBundleNameFormat- the package bundle file name format.- See Also:
-
getPackageSetFileName
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
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
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
It registers a class that implements the service for the installation of a package that is inside a bundle. This class has to implement theInstallPackageServiceinterface.- Parameters:
clazz- class that implements theInstallPackageServiceinterface.
-
getInstallPackageService
It creates and returns an object that is used to install a package in gvSIG. All the parameters are set using theInstallPackageServiceinterface.- 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
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:
IOExceptionorg.gvsig.tools.exception.BaseException
-
getDefaultPackageInfoWriter
PackageInfoWriter getDefaultPackageInfoWriter() -
getDefaultPackageInfoReader
PackageInfoReader getDefaultPackageInfoReader() -
createMakePackage
MakePackageService createMakePackage(File packageFolder, org.gvsig.installer.lib.api.PackageInfo packageInfo) -
setDownloadBaseURL
-
getDownloadBaseURL
URL getDownloadBaseURL() -
setVersion
void setVersion(org.gvsig.installer.lib.api.Version version) -
getVersionEx
org.gvsig.installer.lib.api.Version getVersionEx() -
setVersion
- Parameters:
version-
-
getVersion
String getVersion()- Returns:
-
getLocalAddonRepositories
Gets a List of all the folders where there might be addons folders (addons repositories).- Returns:
- list of repositories paths
-
getLocalAddonRepositories
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
Adds an addon local repository location to the manager list, and register the type of addons for this repository.- Parameters:
path- of the repositorytype- of addons in this repository
-
addLocalAddonRepository
-
getDefaultLocalRepositoryType
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
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
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
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
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
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 pathaccess- type of access to the repository.- Returns:
- the path to the repository
-
getDefaultLocalAddonRepository
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
Set the path to the default local repository for a type of package- Parameters:
defaultAddonsRepository- path to the repositorypackageType- type of package in this repository path
-
getPublicKeys
List<byte[]> getPublicKeys() -
hasProviderToThisPackage
boolean hasProviderToThisPackage(org.gvsig.installer.lib.api.PackageInfo packageInfo) -
needAdminRights
boolean needAdminRights()
-