public class DefaultMakePluginPackageService extends Object implements MakePluginPackageService
Modifier and Type | Field and Description |
---|---|
static String |
ANT_FILE_NAME |
protected String |
antScript |
static String |
COPIED_FILES_DIRECTORY_NAME |
Constructor and Description |
---|
DefaultMakePluginPackageService(InstallerManager manager) |
Modifier and Type | Method and Description |
---|---|
void |
createPackage(PackageInfo packageInfo,
OutputStream packageStream)
It creates a package of a plugin.
|
void |
createPackageIndex(PackageInfo packageInfo,
OutputStream packageStream)
It creates the index for a package of a plugin.
|
void |
createPackageSet(PackageInfo packageInfo,
OutputStream packageStream)
It creates a package set with a single plugin package inside.
|
boolean |
deleteDir(File folder) |
static boolean |
deleteDirectory(File path) |
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.
|
Manager |
getManager()
Returns a reference to the
Manager which manages this server. |
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(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,
File originalPluginDir)
Prepares and copies the needed files for the package.
|
void |
writePackageInfo(PackageInfo packageInfo,
File folder)
Writes a package info file with the information provided.
|
void |
writePackageInfoForIndex(PackageInfo packageInfo,
File folder)
Writes a package info file with the information provided.
|
public static final String ANT_FILE_NAME
public static final String COPIED_FILES_DIRECTORY_NAME
protected String antScript
public DefaultMakePluginPackageService(InstallerManager manager) throws MakePluginPackageServiceException
public void createPackageSet(PackageInfo packageInfo, OutputStream packageStream) throws MakePluginPackageServiceException
MakePluginPackageService
createPackageSet
in interface MakePluginPackageService
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
setpublic void preparePackage(PackageInfo packageInfo, File originalPluginDir) throws MakePluginPackageServiceException
MakePluginPackageService
preparePackage
in interface MakePluginPackageService
MakePluginPackageServiceException
- it is thrown when there is an exception preparing the packagepublic void createPackage(PackageInfo packageInfo, OutputStream packageStream) throws MakePluginPackageServiceException
MakePluginPackageService
createPackage
in interface MakePluginPackageService
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 packagepublic void createPackageIndex(PackageInfo packageInfo, OutputStream packageStream) throws MakePluginPackageServiceException
MakePluginPackageService
createPackageIndex
in interface MakePluginPackageService
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 packagepublic void writePackageInfo(PackageInfo packageInfo, File folder) throws MakePluginPackageServiceException
MakePluginPackageService
writePackageInfo
in interface MakePluginPackageService
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 filepublic void writePackageInfoForIndex(PackageInfo packageInfo, File folder) throws MakePluginPackageServiceException
MakePluginPackageService
writePackageInfoForIndex
in interface MakePluginPackageService
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 filepublic static boolean deleteDirectory(File path)
public Manager getManager()
Service
Manager
which manages this server.getManager
in interface Service
Manager
public PackageInfo getPluginPackageInfo(int index)
MakePluginPackageService
PackageInfo
class, that is a class
that contains all the package information (name, version...).getPluginPackageInfo
in interface MakePluginPackageService
index
- the position of the plugin that has to be retrieved.null
if the package doesn't exist.public PackageInfo getPluginPackageInfo(String code)
MakePluginPackageService
PackageInfo
class, that is a class
that contains all the package information (name, version...).getPluginPackageInfo
in interface MakePluginPackageService
code
- code of the plugin, defined in the package.info file
like a property.null
if the package doesn't exist.public int getPluginPackageCount()
MakePluginPackageService
MakePluginPackageService.getPluginPackageInfo(int)
method to
know all the installed plugins.getPluginPackageCount
in interface MakePluginPackageService
public String getDefaultAntScript() throws MakePluginPackageServiceException
MakePluginPackageService
getDefaultAntScript
in interface MakePluginPackageService
MakePluginPackageServiceException
- if there is a problem reading the filepublic PackageInfo[] getInstalledPackages() throws MakePluginPackageServiceException
MakePluginPackageService
getInstalledPackages
in interface MakePluginPackageService
MakePluginPackageServiceException
- if there is an error getting the installed packagespublic File getPluginFolder(PackageInfo packageInfo) throws MakePluginPackageServiceException
MakePluginPackageService
getPluginFolder
in interface MakePluginPackageService
MakePluginPackageServiceException
- if there is an error locating the folderpublic boolean deleteDir(File folder)
deleteDir
in interface MakePluginPackageService