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 String
Base directory of the module to compile.private static final String
The encoding for text files to read and write.private static final String
The string to replace by the final name.private static final String
The string to replace by the version number.private String
InMETA-INF/manifest.xml
, all occurrences of${project.build.finalName}
will be replaced by this value.private String
Directory where the output.oxt
file will be located.private String
The name for the.oxt
file to create, without the".oxt"
filename extension.private org.apache.maven.project.MavenProject
The Maven project running this plugin.(package private) static final String
The subdirectory (relative tobaseDirectory
) where the UNO files are expected.private static final String
Module to decompress.private String
Indescription.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 TypeMethodDescriptionboolean
Tests if a specified file should be included in a file list.private static void
copy
(File file, ZipOutputStream bundle) Copies the content of the specified binary file to the specified output stream.private void
copyFiltered
(File file, ZipOutputStream bundle, String name) Copies the content of the specified ASCII file to the specified output stream.private static void
copyInflated
(File file, ZipOutputStream bundle) Copies a JAR file in the given ZIP file, but without compression for the files inSIS_DATA
directory.void
execute()
Generates the.oxt
file from all.jar
files found in the target directory.private static long
Computes 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.xml
and*.rdb
files in that directory. -
outputDirectory
@Parameter(property="project.build.directory", required=true, readonly=true) private String outputDirectoryDirectory where the output.oxt
file 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.oxt
file 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:
accept
in 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.oxt
file from all.jar
files found in the target directory.- Specified by:
execute
in 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_DATA
directory.- 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
-