org.eclipse.wst.server.core.util
Class PublishHelper

java.lang.Object
  extended by org.eclipse.wst.server.core.util.PublishHelper

public final class PublishHelper
extends java.lang.Object

Utility class with an assortment of useful publishing file methods.

Since:
3.0

Constructor Summary
PublishHelper(java.io.File tempDir)
          Create a new PublishHelper.
 
Method Summary
static IStatus[] deleteDirectory(java.io.File dir, IProgressMonitor monitor)
          Utility method to recursively delete a directory.
 IStatus[] publishDelta(IModuleResourceDelta[] delta, IPath path, IProgressMonitor monitor)
          Handle a delta publish.
 IStatus[] publishDelta(IModuleResourceDelta delta, IPath path, IProgressMonitor monitor)
          Handle a delta publish.
 IStatus[] publishFull(IModuleResource[] resources, IPath path, IProgressMonitor monitor)
          Publish the given module resources to the given path.
 IStatus[] publishSmart(IModuleResource[] resources, IPath path, IPath[] ignore, IProgressMonitor monitor)
          Smart copy the given module resources to the given path.
 IStatus[] publishSmart(IModuleResource[] resources, IPath path, IProgressMonitor monitor)
          Smart copy the given module resources to the given path.
 IStatus[] publishZip(IModuleResource[] resources, IPath path, IProgressMonitor monitor)
          Creates a new zip file containing the given module resources.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PublishHelper

public PublishHelper(java.io.File tempDir)
Create a new PublishHelper.

Parameters:
tempDir - a temporary directory to use during publishing, or null to use the default. If it does not exist, the folder will be created
Method Detail

deleteDirectory

public static IStatus[] deleteDirectory(java.io.File dir,
                                        IProgressMonitor monitor)
Utility method to recursively delete a directory.

Parameters:
dir - a directory
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a possibly-empty array of error and warning status

publishSmart

public IStatus[] publishSmart(IModuleResource[] resources,
                              IPath path,
                              IProgressMonitor monitor)
Smart copy the given module resources to the given path.

Parameters:
resources - an array of module resources
path - an external path to copy to
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a possibly-empty array of error and warning status

publishSmart

public IStatus[] publishSmart(IModuleResource[] resources,
                              IPath path,
                              IPath[] ignore,
                              IProgressMonitor monitor)
Smart copy the given module resources to the given path.

Parameters:
resources - an array of module resources
path - an external path to copy to
ignore - an array of paths relative to path to ignore, i.e. not delete or copy over
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a possibly-empty array of error and warning status

publishDelta

public IStatus[] publishDelta(IModuleResourceDelta[] delta,
                              IPath path,
                              IProgressMonitor monitor)
Handle a delta publish.

Parameters:
delta - a module resource delta
path - the path to publish to
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a possibly-empty array of error and warning status

publishDelta

public IStatus[] publishDelta(IModuleResourceDelta delta,
                              IPath path,
                              IProgressMonitor monitor)
Handle a delta publish.

Parameters:
delta - a module resource delta
path - the path to publish to
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a possibly-empty array of error and warning status

publishFull

public IStatus[] publishFull(IModuleResource[] resources,
                             IPath path,
                             IProgressMonitor monitor)
Publish the given module resources to the given path.

Parameters:
resources - an array of module resources
path - a path to publish to
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a possibly-empty array of error and warning status

publishZip

public IStatus[] publishZip(IModuleResource[] resources,
                            IPath path,
                            IProgressMonitor monitor)
Creates a new zip file containing the given module resources. Deletes the existing file (and doesn't create a new one) if resources is null or empty.

Parameters:
resources - an array of module resources
path - the path where the zip file should be created
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a possibly-empty array of error and warning status