public interface MakePluginPackageService extends 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.
Modifier and Type | Method and Description |
---|---|
void |
createPackage(PackageInfo packageInfo,
java.io.OutputStream packageStream)
It creates a package of a plugin.
|
void |
createPackageIndex(PackageInfo packageInfo,
java.io.OutputStream packageStream)
It creates the index for a package of a plugin.
|
void |
createPackageSet(PackageInfo packageInfo,
java.io.OutputStream packageStream)
It creates a package set with a single plugin package inside.
|
boolean |
deleteDir(java.io.File folder) |
java.lang.String |
getDefaultAntScript()
This method returns the default ant script that will be used by some
plugins to copy some external files in the installation process.
|
PackageInfo[] |
getInstalledPackages()
Returns the list of packages already installed in the application.
|
java.io.File |
getPluginFolder(PackageInfo packageInfo)
Returns the folder where a plugin is located.
|
int |
getPluginPackageCount()
It returns the number of plugin packages that are installed in the folder
that has been added using the constructor.
|
PackageInfo |
getPluginPackageInfo(int index)
It returns an instance of an
PackageInfo class, that is a class
that contains all the package information (name, version...). |
PackageInfo |
getPluginPackageInfo(java.lang.String code)
It returns an instance of an
PackageInfo class, that is a class
that contains all the package information (name, version...). |
void |
preparePackage(PackageInfo packageInfo,
java.io.File originalPackageFolder)
Prepares and copies the needed files for the package.
|
void |
writePackageInfo(PackageInfo packageInfo,
java.io.File folder)
Writes a package info file with the information provided.
|
void |
writePackageInfoForIndex(PackageInfo packageInfo,
java.io.File folder)
Writes a package info file with the information provided.
|
getManager
void createPackageSet(PackageInfo packageInfo, java.io.OutputStream packageStream) throws MakePluginPackageServiceException
packageInfo
- the information of the plugin that has to be included in the
package setpackageStream
- the stream where the the package set will be createdMakePluginPackageServiceException
- it is thrown when there is an exception creating the package
setvoid createPackage(PackageInfo packageInfo, java.io.OutputStream packageStream) throws MakePluginPackageServiceException
packageInfo
- the information of the plugin that has to be included in the
packagepackageStream
- the stream where the the package will be createdMakePluginPackageServiceException
- it is thrown when there is an exception creating the packagevoid preparePackage(PackageInfo packageInfo, java.io.File originalPackageFolder) throws MakePluginPackageServiceException
newPackageInfo
- the information of the new plugin.originalPackageInfo
- the information of the original plugin.MakePluginPackageServiceException
- it is thrown when there is an exception preparing the packagevoid createPackageIndex(PackageInfo packageInfo, java.io.OutputStream packageStream) throws MakePluginPackageServiceException
packageInfo
- the information of the plugin that has to be included in the
package indexpackageStream
- the stream where the the package index will be createdMakePluginPackageServiceException
- it is thrown when there is an exception creating the packagevoid writePackageInfo(PackageInfo packageInfo, java.io.File folder) throws MakePluginPackageServiceException
packageInfo
- the package that has to be written into the filefolder
- the folder where the file is to be createdMakePluginPackageServiceException
- it is thrown when there is an exception writing the filevoid writePackageInfoForIndex(PackageInfo packageInfo, java.io.File folder) throws MakePluginPackageServiceException
packageInfo
- the package that has to be written into the filefolder
- the folder where the file is to be createdMakePluginPackageServiceException
- it is thrown when there is an exception writing the fileint getPluginPackageCount()
getPluginPackageInfo(int)
method to
know all the installed plugins.PackageInfo getPluginPackageInfo(int index)
PackageInfo
class, that is a class
that contains all the package information (name, version...).index
- the position of the plugin that has to be retrieved.null
if the package doesn't exist.PackageInfo getPluginPackageInfo(java.lang.String code)
PackageInfo
class, that is a class
that contains all the package information (name, version...).code
- code of the plugin, defined in the package.info file
like a property.null
if the package doesn't exist.java.lang.String getDefaultAntScript() throws MakePluginPackageServiceException
MakePluginPackageServiceException
- if there is a problem reading the filePackageInfo[] getInstalledPackages() throws MakePluginPackageServiceException
MakePluginPackageServiceException
- if there is an error getting the installed packagesjava.io.File getPluginFolder(PackageInfo packageInfo) throws MakePluginPackageServiceException
selectedPackageInfo
- the info of theplugin to look forMakePluginPackageServiceException
- if there is an error locating the folderboolean deleteDir(java.io.File folder)
folder
-