Interface IJarBuilder


public interface IJarBuilder
A JAR builder can be used to add elements to a JAR file which is about to be build.

The protocol defined by this interface is:

  • open is called
  • addFile and addJar is called multiple times
  • close is called

It is guaranteed that addFile and addJar is only called after open is called and before close is called. Other methods may be called any time.

Implementors must be prepared that an instance if the implementation is reused multiple times.

In order to provide backward compatibility for clients of IJarBuilder, extension interfaces are used to provide a means of evolution. The following extension interfaces exist:

  • IJarBuilderExtension since version 3.5 introducing the following functions:
    • Write a file to the JAR to build
Since:
3.4
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when building of the JAR finished.
    Returns the unique id of this builder
    Returns the manifest provider to build the manifest
    void
    open(JarPackageData jarPackage, org.eclipse.swt.widgets.Shell shell, org.eclipse.core.runtime.MultiStatus status)
    Called when building of the JAR starts
    void
    writeArchive(ZipFile archive, org.eclipse.core.runtime.IProgressMonitor monitor)
    Add the given archive to the archive which is about to be build
    void
    writeFile(org.eclipse.core.resources.IFile resource, org.eclipse.core.runtime.IPath destinationPath)
    Add the given resource to the archive at the given path
  • Method Details

    • getId

      String getId()
      Returns the unique id of this builder
      Returns:
      the unique id of this builder
    • getManifestProvider

      IManifestProvider getManifestProvider()
      Returns the manifest provider to build the manifest
      Returns:
      the manifest provider to build the manifest
    • open

      void open(JarPackageData jarPackage, org.eclipse.swt.widgets.Shell shell, org.eclipse.core.runtime.MultiStatus status) throws org.eclipse.core.runtime.CoreException
      Called when building of the JAR starts
      Parameters:
      jarPackage - the package to build
      shell - shell to show dialogs, null if no dialog must be shown
      status - a status to use to report status to the user
      Throws:
      org.eclipse.core.runtime.CoreException - thrown when the JAR could not be opened
    • writeFile

      void writeFile(org.eclipse.core.resources.IFile resource, org.eclipse.core.runtime.IPath destinationPath) throws org.eclipse.core.runtime.CoreException
      Add the given resource to the archive at the given path
      Parameters:
      resource - the file to be written
      destinationPath - the path for the file inside the archive
      Throws:
      org.eclipse.core.runtime.CoreException - thrown when the file could not be written
    • writeArchive

      void writeArchive(ZipFile archive, org.eclipse.core.runtime.IProgressMonitor monitor)
      Add the given archive to the archive which is about to be build
      Parameters:
      archive - the archive to add
      monitor - a monitor to report progress to
    • close

      void close() throws org.eclipse.core.runtime.CoreException
      Called when building of the JAR finished.
      Throws:
      org.eclipse.core.runtime.CoreException - thrown when the JAR could not be closed