Package org.apache.sis.internal.unopkg
Class UnoPkg
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.sis.internal.unopkg.UnoPkg
- All Implemented Interfaces:
FilenameFilter,org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="unopkg",
defaultPhase=PACKAGE,
requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
public final class UnoPkg
extends org.apache.maven.plugin.AbstractMojo
implements FilenameFilter
Creates an
.oxt package for OpenOffice.org addins.- Since:
- 0.8
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringBase directory of the module to compile.private static final StringThe encoding for text files to read and write.private static final StringThe string to replace by the final name.private static final StringThe string to replace by the version number.private StringInMETA-INF/manifest.xml, all occurrences of${project.build.finalName}will be replaced by this value.private StringDirectory where the output.oxtfile will be located.private StringThe name for the.oxtfile to create, without the".oxt"filename extension.private org.apache.maven.project.MavenProjectThe Maven project running this plugin.(package private) static final StringThe subdirectory (relative tobaseDirectory) where the UNO files are expected.private static final StringModule to decompress.private StringIndescription.xml, all occurrences of${project.version}will be replaced by this value.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if a specified file should be included in a file list.private static voidcopy(File file, ZipOutputStream bundle) Copies the content of the specified binary file to the specified output stream.private voidcopyFiltered(File file, ZipOutputStream bundle, String name) Copies the content of the specified ASCII file to the specified output stream.private static voidcopyInflated(File file, ZipOutputStream bundle) Copies a JAR file in the given ZIP file, but without compression for the files inSIS_DATAdirectory.voidexecute()Generates the.oxtfile from all.jarfiles found in the target directory.private static longComputes CRC32 for the given file.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
SOURCE_DIRECTORY
The subdirectory (relative tobaseDirectory) where the UNO files are expected.- See Also:
-
TO_INFLATE
Module to decompress. We inflate the "sis-embedded-data" module because Derby is much slower when using an embedded database in a compressed ZIP file compared to flat storage. Since the JAR files are distributed in a ZIP file anyway, inflating that file has little impact on the final ZIP file size.- See Also:
-
ENCODING
The encoding for text files to read and write.- See Also:
-
FILTERED_NAME
The string to replace by the final name.- See Also:
-
FILTERED_VERSION
The string to replace by the version number.- See Also:
-
baseDirectory
Base directory of the module to compile. The UNO files are expected in the"src/main/unopkg"subdirectory. The plugin will look for theMETA-INF/manifest.xmland*.rdbfiles in that directory. -
outputDirectory
@Parameter(property="project.build.directory", required=true, readonly=true) private String outputDirectoryDirectory where the output.oxtfile will be located. -
finalName
@Parameter(property="project.build.finalName", required=true, readonly=true) private String finalNameInMETA-INF/manifest.xml, all occurrences of${project.build.finalName}will be replaced by this value. -
version
Indescription.xml, all occurrences of${project.version}will be replaced by this value. -
oxtName
The name for the.oxtfile to create, without the".oxt"filename extension. -
project
@Parameter(property="project", required=true, readonly=true) private org.apache.maven.project.MavenProject projectThe Maven project running this plugin.
-
-
Constructor Details
-
UnoPkg
public UnoPkg()Invoked by reflection for creating the MOJO.
-
-
Method Details
-
accept
Tests if a specified file should be included in a file list.- Specified by:
acceptin interfaceFilenameFilter- Parameters:
directory- the directory in which the file was found.name- the name of the file.
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionGenerates the.oxtfile from all.jarfiles found in the target directory.- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Throws:
org.apache.maven.plugin.MojoExecutionException- if the plugin execution failed.
-
copy
Copies the content of the specified binary file to the specified output stream.- Parameters:
file- the regular file to copy inside the ZIP file.bundle- the ZIP file where to copy the given regular file.- Throws:
IOException
-
copyFiltered
Copies the content of the specified ASCII file to the specified output stream.- Parameters:
file- the regular file to copy inside the ZIP file.bundle- the ZIP file where to copy the given regular file.name- the ZIP entry name.- Throws:
IOException
-
copyInflated
Copies a JAR file in the given ZIP file, but without compression for the files inSIS_DATAdirectory.- Parameters:
file- the JAR file to copy.bundle- destination where to copy the JAR file.- Throws:
IOException
-
getCRC32
Computes CRC32 for the given file.- Throws:
IOException
-