Eclipse JDT
Release 3.4

org.eclipse.jdt.ui.jarpackager
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:

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.

Since:
3.4
See Also:
JarPackageData

Method Summary
 void close()
          Called when building of the JAR finished.
 String getId()
          Returns the unique id of this builder
 IManifestProvider getManifestProvider()
          Returns the manifest provider to build the manifest
 void open(JarPackageData jarPackage, Shell shell, MultiStatus status)
          Called when building of the JAR starts
 void writeArchive(ZipFile archive, IProgressMonitor monitor)
          Add the given archive to the archive which is about to be build
 void writeFile(IFile resource, IPath destinationPath)
          Add the given resource to the archive at the given path
 

Method Detail

getId

public String getId()
Returns the unique id of this builder

Returns:
the unique id of this builder

getManifestProvider

public IManifestProvider getManifestProvider()
Returns the manifest provider to build the manifest

Returns:
the manifest provider to build the manifest

open

public void open(JarPackageData jarPackage,
                 Shell shell,
                 MultiStatus status)
          throws 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:
CoreException - thrown when the JAR could not be opened

writeFile

public void writeFile(IFile resource,
                      IPath destinationPath)
               throws 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:
CoreException - thrown when the file could not be written

writeArchive

public void writeArchive(ZipFile archive,
                         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

public void close()
           throws CoreException
Called when building of the JAR finished.

Throws:
CoreException - thrown when the JAR could not be closed

Eclipse JDT
Release 3.4

Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.