org.eclipse.jst.server.core
Class PublishUtil

java.lang.Object
  extended by org.eclipse.jst.server.core.PublishUtil

public final class PublishUtil
extends java.lang.Object

Utility class with an assortment of useful file methods.

This class provides all its functionality through static members. It is not intended to be subclassed or instantiated.

Note: Adopters should use the equivalent class in org.eclipse.wst.server.core.util instead. This class will eventually be deprecated.


Method Summary
static void copy(IModuleResource[] resources, IPath path)
          Deprecated. This method only returns a single error in the case of failure. Use publishFull() instead
static IStatus copyFile(java.io.InputStream in, java.lang.String to)
          Deprecated. Unused - will be removed.
static void createZipFile(IModuleResource[] resources, IPath zipPath)
          Creates a new zip file containing the given module resources.
static IStatus[] deleteDirectory(java.io.File dir, IProgressMonitor monitor)
          Utility method to recursively delete a directory.
static void handleDelta(int kind, IPath path, IModuleResourceDelta delta)
          Deprecated. This method only returns a single error in the case of failure. Use publishDelta() instead.
static IStatus[] publishDelta(IModuleResourceDelta[] delta, IPath path, IProgressMonitor monitor)
          Handle a delta publish.
static IStatus[] publishDelta(IModuleResourceDelta delta, IPath path, IProgressMonitor monitor)
          Handle a delta publish.
static IStatus[] publishFull(IModuleResource[] resources, IPath path, IProgressMonitor monitor)
          Publish the given module resources to the given path.
static IStatus[] publishSmart(IModuleResource[] resources, IPath path, IProgressMonitor monitor)
          Smart copy the given module resources to the given path.
static IStatus[] publishZip(IModuleResource[] resources, IPath path, IProgressMonitor monitor)
          Creates a new zip file containing the given module resources.
static void smartCopy(IModuleResource[] resources, IPath path, IProgressMonitor monitor)
          Deprecated. This method only returns a single error in the case of failure. Use publishSmart() instead.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyFile

public static IStatus copyFile(java.io.InputStream in,
                               java.lang.String to)
Deprecated. Unused - will be removed.

Copy a file from a to b. Closes the input stream after use.

Parameters:
in - java.io.InputStream
to - java.lang.String
Returns:
a status

smartCopy

public static void smartCopy(IModuleResource[] resources,
                             IPath path,
                             IProgressMonitor monitor)
                      throws CoreException
Deprecated. This method only returns a single error in the case of failure. Use publishSmart() instead.

Smart copy the given module resources to the given path.

Parameters:
resources -
path -
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Throws:
CoreException

handleDelta

public static void handleDelta(int kind,
                               IPath path,
                               IModuleResourceDelta delta)
                        throws CoreException
Deprecated. This method only returns a single error in the case of failure. Use publishDelta() instead.

Handle a delta publish.

Parameters:
kind -
path -
delta -
Throws:
CoreException

copy

public static void copy(IModuleResource[] resources,
                        IPath path)
                 throws CoreException
Deprecated. This method only returns a single error in the case of failure. Use publishFull() instead

Parameters:
resources -
path -
Throws:
CoreException

createZipFile

public static void createZipFile(IModuleResource[] resources,
                                 IPath zipPath)
                          throws CoreException
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 -
zipPath -
Throws:
CoreException

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 static 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

publishDelta

public static 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 static 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 static 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 static 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