Interface MakePluginPackageService
- All Superinterfaces:
org.gvsig.tools.service.Service
This service is used to create a bundle that contains a package of plugin type. It supports just one package for every installer. It contains a method to set the plugin path and some methods to set the installer information.
It has also methods to load the installed plugins from a directory (if
exists) and methods to create the bundle file in an OutputStream.
A plugin package has the same structure of a standard package defined in
InstallerManager but it adds some new files. An example of the
structure of a bundle with a plugin package could be:
- bundle (compressed file)
- org.gvsig.plugin1-1_0_0-23 (compressed file)
- org.gvsig.plugin1
- package.info
- install.xml
- files
- gvSIG
- extensiones
- org.gvsig.plugin2
- file1
- file2
This structure has some extra files:
The usage of the ant script to copy files from other plugins is not recommended because it is possible that different installers overrides the same file. The suggestion it that one plugin has to have all the files that it needs to work inside the plugin and it never has to override some external files.
The implementations of this interface have to have a constructor with a File parameter that is the directory when the plugins are located. If the directory doens't exists the creation throws an exception.
- Author:
- Jorge Piera Llodrá
-
Method Summary
Modifier and TypeMethodDescriptionvoidcreatePackage(org.gvsig.installer.lib.api.PackageInfo packageInfo, OutputStream packageStream) It creates a package of a plugin.voidcreatePackageIndex(org.gvsig.installer.lib.api.PackageInfo packageInfo, OutputStream packageStream) It creates the index for a package of a plugin.voidcreatePackageSet(org.gvsig.installer.lib.api.PackageInfo packageInfo, OutputStream packageStream) It creates a package set with a single plugin package inside.booleanThis method returns the default ant script that will be used by some plugins to copy some external files in the installation process.org.gvsig.installer.lib.api.PackageInfo[]Returns the list of packages already installed in the application.getPluginFolder(org.gvsig.installer.lib.api.PackageInfo packageInfo) Returns the folder where a plugin is located.intIt returns the number of plugin packages that are installed in the folder that has been added using the constructor.org.gvsig.installer.lib.api.PackageInfogetPluginPackageInfo(int index) It returns an instance of anPackageInfoclass, that is a class that contains all the package information (name, version...).org.gvsig.installer.lib.api.PackageInfogetPluginPackageInfo(String code) It returns an instance of anPackageInfoclass, that is a class that contains all the package information (name, version...).voidpreparePackage(org.gvsig.installer.lib.api.PackageInfo packageInfo, File originalPackageFolder) Prepares and copies the needed files for the package.voidwritePackageInfo(org.gvsig.installer.lib.api.PackageInfo packageInfo, File folder) Writes a package info file with the information provided.voidwritePackageInfoForIndex(org.gvsig.installer.lib.api.PackageInfo packageInfo, File folder) Writes a package info file with the information provided.Methods inherited from interface org.gvsig.tools.service.Service
getManager
-
Method Details
-
createPackageSet
void createPackageSet(org.gvsig.installer.lib.api.PackageInfo packageInfo, OutputStream packageStream) throws MakePluginPackageServiceException It creates a package set with a single plugin package inside.- Parameters:
packageInfo- the information of the plugin that has to be included in the package setpackageStream- the stream where the the package set will be created- Throws:
MakePluginPackageServiceException- it is thrown when there is an exception creating the package set
-
createPackage
void createPackage(org.gvsig.installer.lib.api.PackageInfo packageInfo, OutputStream packageStream) throws MakePluginPackageServiceException It creates a package of a plugin.- Parameters:
packageInfo- the information of the plugin that has to be included in the packagepackageStream- the stream where the the package will be created- Throws:
MakePluginPackageServiceException- it is thrown when there is an exception creating the package
-
preparePackage
void preparePackage(org.gvsig.installer.lib.api.PackageInfo packageInfo, File originalPackageFolder) throws MakePluginPackageServiceException Prepares and copies the needed files for the package. It is used to copy the ant build file and the additional external files to be included in the package.- Parameters:
newPackageInfo- the information of the new plugin.originalPackageInfo- the information of the original plugin.- Throws:
MakePluginPackageServiceException- it is thrown when there is an exception preparing the package
-
createPackageIndex
void createPackageIndex(org.gvsig.installer.lib.api.PackageInfo packageInfo, OutputStream packageStream) throws MakePluginPackageServiceException It creates the index for a package of a plugin. This file may be used to be included in the main gvSIG remote index, or downloaded as it is.- Parameters:
packageInfo- the information of the plugin that has to be included in the package indexpackageStream- the stream where the the package index will be created- Throws:
MakePluginPackageServiceException- it is thrown when there is an exception creating the package
-
writePackageInfo
void writePackageInfo(org.gvsig.installer.lib.api.PackageInfo packageInfo, File folder) throws MakePluginPackageServiceException Writes a package info file with the information provided.- Parameters:
packageInfo- the package that has to be written into the filefolder- the folder where the file is to be created- Throws:
MakePluginPackageServiceException- it is thrown when there is an exception writing the file
-
writePackageInfoForIndex
void writePackageInfoForIndex(org.gvsig.installer.lib.api.PackageInfo packageInfo, File folder) throws MakePluginPackageServiceException Writes a package info file with the information provided.- Parameters:
packageInfo- the package that has to be written into the filefolder- the folder where the file is to be created- Throws:
MakePluginPackageServiceException- it is thrown when there is an exception writing the file
-
getPluginPackageCount
int getPluginPackageCount()It returns the number of plugin packages that are installed in the folder that has been added using the constructor. It can be used in an iteration process combined with thegetPluginPackageInfo(int)method to know all the installed plugins.- Returns:
- the number of plugins installed in a directory.
-
getPluginPackageInfo
org.gvsig.installer.lib.api.PackageInfo getPluginPackageInfo(int index) It returns an instance of anPackageInfoclass, that is a class that contains all the package information (name, version...).- Parameters:
index- the position of the plugin that has to be retrieved.- Returns:
- the installer information of a plugin package. Returns
nullif the package doesn't exist.
-
getPluginPackageInfo
It returns an instance of anPackageInfoclass, that is a class that contains all the package information (name, version...).- Parameters:
code- code of the plugin, defined in the package.info file like a property.- Returns:
- the installer information of a plugin package. Returns
nullif the package doesn't exist.
-
getDefaultAntScript
This method returns the default ant script that will be used by some plugins to copy some external files in the installation process.- Returns:
- a string that contains the standard ant script
- Throws:
MakePluginPackageServiceException- if there is a problem reading the file
-
getInstalledPackages
org.gvsig.installer.lib.api.PackageInfo[] getInstalledPackages() throws MakePluginPackageServiceExceptionReturns the list of packages already installed in the application.- Returns:
- the list of packages already installed in the application
- Throws:
MakePluginPackageServiceException- if there is an error getting the installed packages
-
getPluginFolder
File getPluginFolder(org.gvsig.installer.lib.api.PackageInfo packageInfo) throws MakePluginPackageServiceException Returns the folder where a plugin is located.- Parameters:
selectedPackageInfo- the info of theplugin to look for- Returns:
- the plugin's folder
- Throws:
MakePluginPackageServiceException- if there is an error locating the folder
-
deleteDir
- Parameters:
folder-- Returns:
-