1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 13:05:22 +02:00

[cleanup] add API "since" tags

This commit is contained in:
Martin Oberhuber 2008-03-28 13:08:44 +00:00
parent 946da798f3
commit 7ba4eede2a
10 changed files with 1855 additions and 1490 deletions

View file

@ -20,9 +20,15 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View file

@ -37,10 +37,25 @@ import java.util.Iterator;
*/ */
public class ArchiveHandlerManager public class ArchiveHandlerManager
{ {
// The string that separates the virtual part of an absolute path from the real part /**
* The string that separates the virtual part of an absolute path from the
* real part.
*/
public static final String VIRTUAL_SEPARATOR = "#virtual#/"; //$NON-NLS-1$ public static final String VIRTUAL_SEPARATOR = "#virtual#/"; //$NON-NLS-1$
public static final String VIRTUAL_CANONICAL_SEPARATOR = "#virtual#"; //$NON-NLS-1$ public static final String VIRTUAL_CANONICAL_SEPARATOR = "#virtual#"; //$NON-NLS-1$
/**
* Folder separator used in virtual paths inside the archive, i.e. after the
* VIRTUAL_SEPARATOR.
*
* @since org.eclipse.rse.services 3.0
*/
public static final String VIRTUAL_FOLDER_SEPARATOR = "/"; //$NON-NLS-1$ public static final String VIRTUAL_FOLDER_SEPARATOR = "/"; //$NON-NLS-1$
/**
* Character used to separate file extension from file name. This is used in
* order to recognize file patterns that should be treated as archives.
*
* @since org.eclipse.rse.services 3.0
*/
public static final String EXTENSION_SEPARATOR = "."; //$NON-NLS-1$ public static final String EXTENSION_SEPARATOR = "."; //$NON-NLS-1$
// the singleton instance // the singleton instance
@ -142,11 +157,11 @@ public class ArchiveHandlerManager
} }
/** /**
* check if the file extension is registered archive type. * Check if the file extension is registered archive type.
* notice here, the getExtension method does't work for name like fool.tar.gz * notice here, the getExtension method does't work for name like fool.tar.gz
* @param file the file to check * @param file the file to check
* @return registered extension or null * @return registered extension or null
* @since 3.0 * @since org.eclipse.rse.services 3.0
*/ */
protected String getRegisteredExtension(File file) protected String getRegisteredExtension(File file)
{ {
@ -158,7 +173,7 @@ public class ArchiveHandlerManager
* check if the file extension is registered archive type. * check if the file extension is registered archive type.
* @param fileName the file name to check * @param fileName the file name to check
* @return registered extension or null * @return registered extension or null
* @since 3.0 * @since org.eclipse.rse.services 3.0
*/ */
protected String getRegisteredExtension(String fileName) protected String getRegisteredExtension(String fileName)
{ {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2007 IBM Corporation and others. * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,8 +12,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * Xuan Chen (IBM) - [160775][api][breaking] rename (at least within a zip) blocks UI thread
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread * Martin Oberhuber (Wind River) - [cleanup] add API "since" tags to Archive Handler Javadoc
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.services.clientserver.archiveutils; package org.eclipse.rse.services.clientserver.archiveutils;
@ -28,205 +28,279 @@ import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatcher;
/** /**
* An interface that allows implementing classes to create their own handlers
* for various types of archive files, ie: zip, jar, tar, rpm.
*
* @author mjberger * @author mjberger
* An interface that allows implementing classes to create their own
* Handlers for various types of Archive files, ie: zip, jar, tar, rpm
*/ */
public interface ISystemArchiveHandler public interface ISystemArchiveHandler
{ {
/** /**
* Turns the archive that this handler represents into a new, empty archive. * Turns the archive that this handler represents into a new, empty archive.
* (The archive could not exist before, in which case this would be a true * (The archive could not exist before, in which case this would be a true
* creation). * creation).
* @return Whether or not the blank archive was successfuly created. *
* @return Whether or not the blank archive was successfully created.
*/ */
public boolean create(); public boolean create();
/** /**
* @return an array containing all the entries in the archive file * Return a flat list of entries in an archive.
* in a flat format, where the entries' filenames are prepended by *
* the path to the entry within the virtual file system. If there
* are no entries in the file, returns an array of size 0.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return an array containing all the entries in the archive file in a flat
* format, where the entries' filenames are prepended by the path to
* the entry within the virtual file system. If there are no entries
* in the file, returns an array of size 0.
*
* @since org.eclipse.rse.services 3.0
*/ */
public VirtualChild[] getVirtualChildrenList(ISystemOperationMonitor archiveOperationMonitor); public VirtualChild[] getVirtualChildrenList(ISystemOperationMonitor archiveOperationMonitor);
/** /**
* @return an array containing all the entries in the archive file * Return a flat list of entries in an archive, whose full paths begin with
* in a flat format, whose full paths begin with the String <code>parent</code>. * the given parent prefix.
* Returns an array of length 0 if there are no such entries. *
* @param parent full path of the parent * @param parent full path of the parent
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return an array containing all the entries in the archive file in a flat
* format, whose full paths begin with the String
* <code>parent</code>. Returns an array of length 0 if there are
* no such entries.
*
* @since org.eclipse.rse.services 3.0
*/ */
public VirtualChild[] getVirtualChildrenList(String parent, ISystemOperationMonitor archiveOperationMonitor); public VirtualChild[] getVirtualChildrenList(String parent, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* @return an array containing the virtual children of the virtual * Return the children of a specified node in an archive.
* directory named <code>fullVirtualName</code>. If <code>fullVirtualName</code> is "", *
* returns the top level in the virtual file system tree. If there are no
* values to return, returns null.
* @param fullVirtualName full virtual path of the parent * @param fullVirtualName full virtual path of the parent
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return an array containing the virtual children of the virtual directory
* named <code>fullVirtualName</code>. If
* <code>fullVirtualName</code> is "", returns the top level in
* the virtual file system tree. If there are no values to return,
* returns null.
*
* @since org.eclipse.rse.services 3.0
*/ */
public VirtualChild[] getVirtualChildren(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor); public VirtualChild[] getVirtualChildren(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* @return an array containing the virtual children of the virtual * Return those children of a specified node in an archive, which are
* directory named <code>fullVirtualName</code> that are themselves directories. * folders.
* If <code>fullVirtualName</code> is "", *
* returns the top level of directories in the virtual file system tree.
* If there are no values to return, returns null.
* @param fullVirtualName full virtual path of the parent * @param fullVirtualName full virtual path of the parent
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return an array containing the virtual children of the virtual directory
* named <code>fullVirtualName</code> that are themselves
* directories. If <code>fullVirtualName</code> is "", returns the
* top level of directories in the virtual file system tree. If
* there are no values to return, returns null.
*
* @since org.eclipse.rse.services 3.0
*/ */
public VirtualChild[] getVirtualChildFolders(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor); public VirtualChild[] getVirtualChildFolders(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* @return the virtual File or Folder referred to by <code>fullVirtualName</code>. * Return an archive node specified by a given virtual path.
* This method never returns null. In cases where the VirtualChild does not *
* physically exist in the archive, this method returns a new VirtualChild object
* whose exists() method returns false.
* @param fullVirtualName full virtual path of the object to retrieve * @param fullVirtualName full virtual path of the object to retrieve
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return the virtual File or Folder referred to by
* <code>fullVirtualName</code>. This method never returns null.
* In cases where the VirtualChild does not physically exist in the
* archive, this method returns a new VirtualChild object whose
* exists() method returns false.
*
* @since org.eclipse.rse.services 3.0
*/ */
public VirtualChild getVirtualFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor); public VirtualChild getVirtualFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* @return Whether or not the virtual file or folder named <code>fullVirtualName</code> * Check whether a given virtual node exists in an archive.
* exists in the archive (physically). *
* @param fullVirtualName full virtual path of the object * @param fullVirtualName full virtual path of the object
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return Whether or not the virtual file or folder named
* <code>fullVirtualName</code> exists in the archive
* (physically).
*
* @since org.eclipse.rse.services 3.0
*/ */
public boolean exists(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor); public boolean exists(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Check if the archive handler implementation associated with this class
* exists.
*
* @return Whether or not the handler exists. Usually false if the archive * @return Whether or not the handler exists. Usually false if the archive
* is corrupted or unreadable. * is corrupted or unreadable.
*/ */
public boolean exists(); public boolean exists();
/** /**
* Return the archive that this handler deals with.
*
* @return the archive that this handler deals with * @return the archive that this handler deals with
*/ */
public File getArchive(); public File getArchive();
/** /**
* @return the current timestamp (last modified) for the entry in the archive named * Return the timestamp for an archive node.
*
* @param fullVirtualName virtual path specifying the node to check
* @return the current timestamp (last modified) for the archive entry named
* <code>fullVirtualName</code> * <code>fullVirtualName</code>
*/ */
public long getTimeStampFor(String fullVirtualName); public long getTimeStampFor(String fullVirtualName);
/** /**
* @return the current size (uncompressed) for the entry in the archive named * Return the size for an archive node.
* <code>fullVirtualName</code> *
* @param fullVirtualName virtual path specifying the node to check
* @return the current size (uncompressed) for the entry in the archive
* named <code>fullVirtualName</code>
*/ */
public long getSizeFor(String fullVirtualName); public long getSizeFor(String fullVirtualName);
/** /**
* Extracts the virtual file named <code>fullVirtualName</code> from the archive, * Extracts the virtual file named <code>fullVirtualName</code> from the
* placing the results in <code>destination</code>. * archive, placing the results in <code>destination</code>.
* @param fullVirtualName The full path and name of the virtual file in the archive. *
* @param fullVirtualName The full path and name of the virtual file in the
* archive.
* @param destination The destination file for the extracted virtual file. * @param destination The destination file for the extracted virtual file.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true iff the extraction is successful * @return <code>true</code> if the extraction is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean extractVirtualFile(String fullVirtualName, File destination, ISystemOperationMonitor archiveOperationMonitor); public boolean extractVirtualFile(String fullVirtualName, File destination, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Extracts the virtual file named <code>fullVirtualName</code> from the archive, * Extracts the virtual file named <code>fullVirtualName</code> from the
* placing the results in <code>destination</code>. Extracts to the native encoding, but assumes * archive, placing the results in <code>destination</code>. Extracts to
* that the source was archived using <code>sourceEncoding</code> if <code>isText</code> is true. * the native encoding, but assumes that the source was archived using
* @param fullVirtualName The full path and name of the virtual file in the archive. * <code>sourceEncoding</code> if <code>isText</code> is true.
*
* @param fullVirtualName The full path and name of the virtual file in the
* archive.
* @param destination The destination file for the extracted virtual file. * @param destination The destination file for the extracted virtual file.
* @param sourceEncoding The encoding of the file in the archive. * @param sourceEncoding The encoding of the file in the archive.
* @param isText Whether or not the virtual file is a text file. * @param isText Whether or not the virtual file is a text file.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true iff the extraction is successful * @return <code>true</code> if the extraction is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean extractVirtualFile(String fullVirtualName, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor); public boolean extractVirtualFile(String fullVirtualName, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Extracts the directory <code>dir</code> (and its children) from * Extracts the directory <code>dir</code> (and its children) from the
* the archive and places the results in the directory <code>destinationParent</code>. * archive and places the results in the directory
* <code>destinationParent</code>.
*
* @param dir The full name of the virtual directory to extract * @param dir The full name of the virtual directory to extract
* @param destinationParent A handle to the directory in which the extracted * @param destinationParent A handle to the directory in which the extracted
* directory will be placed as a subdirectory. * directory will be placed as a subdirectory.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true iff the extraction is successful * @return <code>true</code> if the extraction is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean extractVirtualDirectory(String dir, File destinationParent, ISystemOperationMonitor archiveOperationMonitor); public boolean extractVirtualDirectory(String dir, File destinationParent, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Extracts the directory <code>dir</code> (and its children) from * Extracts the directory <code>dir</code> (and its children) from the
* the archive and places the results in the directory <code>destinationParent</code>. * archive and places the results in the directory
* Extracts to the native encoding (if <code>isText</code>), but assumes * <code>destinationParent</code>. Extracts to the native encoding (if
* that the source was archived using <code>sourceEncoding</code>. * <code>isText</code>), but assumes that the source was archived using
* <code>sourceEncoding</code>.
*
* @param dir The full name of the virtual directory to extract * @param dir The full name of the virtual directory to extract
* @param destinationParent A handle to the directory in which the extracted * @param destinationParent A handle to the directory in which the extracted
* directory will be placed as a subdirectory. * directory will be placed as a subdirectory.
* @param sourceEncoding The encoding of the files in the archive. * @param sourceEncoding The encoding of the files in the archive.
* @param isText Whether or not the files in the directory are text files * @param isText Whether or not the files in the directory are text files
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true iff the extraction is successful * @return <code>true</code> if the extraction is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean extractVirtualDirectory(String dir, File destinationParent, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor); public boolean extractVirtualDirectory(String dir, File destinationParent, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Extracts the directory <code>dir</code> (and its children) from * Extracts the directory <code>dir</code> (and its children) from the
* the archive and places the results in the directory <code>destinationParent</code>. * archive and places the results in the directory
* The results will be named destination.getName() rather than <code>dir</code>'s name. * <code>destinationParent</code>. The results will be named
* destination.getName() rather than <code>dir</code>'s name.
*
* @param dir The full name of the virtual directory to extract * @param dir The full name of the virtual directory to extract
* @param destinationParent A handle to the directory in which the extracted * @param destinationParent A handle to the directory in which the extracted
* directory will be placed as a subdirectory. * directory will be placed as a subdirectory.
* @param destination A handle to the directory that will be created. Whatever * @param destination A handle to the directory that will be created.
* contents are in that directory will be replaced with what is extracted from * Whatever contents are in that directory will be replaced with
* the archive. * what is extracted from the archive.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true iff the extraction is successful * @return <code>true</code> if the extraction is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean extractVirtualDirectory(String dir, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor); public boolean extractVirtualDirectory(String dir, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Extracts the directory <code>dir</code> (and its children) from * Extracts the directory <code>dir</code> (and its children) from the
* the archive and places the results in the directory <code>destinationParent</code>. * archive and places the results in the directory
* The results will be named destination.getName() rather than <code>dir</code>'s name. * <code>destinationParent</code>. The results will be named
* Extracts to the native encoding (if <code>isText</code>), but assumes * destination.getName() rather than <code>dir</code>'s name. Extracts to
* that the source was archived using <code>sourceEncoding</code>. * the native encoding (if <code>isText</code>), but assumes that the
* source was archived using <code>sourceEncoding</code>.
*
* @param dir The full name of the virtual directory to extract * @param dir The full name of the virtual directory to extract
* @param destinationParent A handle to the directory in which the extracted * @param destinationParent A handle to the directory in which the extracted
* directory will be placed as a subdirectory. * directory will be placed as a subdirectory.
* @param destination A handle to the directory that will be created. Whatever * @param destination A handle to the directory that will be created.
* contents are in that directory will be replaced with what is extracted from * Whatever contents are in that directory will be replaced with
* the archive. * what is extracted from the archive.
* @param sourceEncoding The encoding of the files in the archive. * @param sourceEncoding The encoding of the files in the archive.
* @param isText Whether or not the files to be extracted in the directory are all text files * @param isText Whether or not the files to be extracted in the directory
* are all text files
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true iff the extraction is successful * @return <code>true</code> if the extraction is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean extractVirtualDirectory(String dir, File destinationParent, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor); public boolean extractVirtualDirectory(String dir, File destinationParent, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Compresses the file <code>file</code> and adds it to the archive, * Compresses the file <code>file</code> and adds it to the archive,
* placing it in the virtual directory <code>virtualPath</code>. Pass the * placing it in the virtual directory <code>virtualPath</code>. Pass the
* name as the parameter <code>name</code>. If the virtual path does not exist * name as the parameter <code>name</code>. If the virtual path does not
* in the archive, create it. If <code>file</code> is a directory, copy it and * exist in the archive, create it. If <code>file</code> is a directory,
* its contents into the archive, maintaining the tree structure. * copy it and its contents into the archive, maintaining the tree
* structure.
*
* @param file the file to be added to the archive * @param file the file to be added to the archive
* @param virtualPath the destination of the file * @param virtualPath the destination of the file
* @param name the name of the result virtual file * @param name the name of the result virtual file
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the add was successful * @return <code>true</code> if the addition is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor); public boolean add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Compresses the file <code>file</code> and adds it to the archive, * Compresses the file <code>file</code> and adds it to the archive,
* saving it in the encoding specified by <code>encoding</code> if the isText is true. * saving it in the encoding specified by <code>encoding</code> if the
* placing it in the virtual directory <code>virtualPath</code>. Pass the * isText is true. placing it in the virtual directory
* name as the parameter <code>name</code>. If the virtual path does not exist * <code>virtualPath</code>. Pass the name as the parameter
* in the archive, create it. If <code>file</code> is a directory, copy it and * <code>name</code>. If the virtual path does not exist in the archive,
* its contents into the archive, maintaining the tree structure. * create it. If <code>file</code> is a directory, copy it and its
* contents into the archive, maintaining the tree structure.
*
* @param file the file to be added to the archive * @param file the file to be added to the archive
* @param virtualPath the destination of the file * @param virtualPath the destination of the file
* @param name the name of the result virtual file * @param name the name of the result virtual file
@ -234,16 +308,20 @@ public interface ISystemArchiveHandler
* @param targetEncoding the encoding of the result file * @param targetEncoding the encoding of the result file
* @param isText is the file a text file * @param isText is the file a text file
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the add was successful * @return <code>true</code> if the addition is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor); public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Compresses the bytes in the InputStream <code>stream</code> and adds them as an entry to the archive, * Compresses the bytes in the InputStream <code>stream</code> and adds
* saving them in the encoding specified by <code>encoding</code> if <code>isText</code> is true, and * them as an entry to the archive, saving them in the encoding specified by
* placing it in the virtual directory <code>virtualPath</code>. Pass the * <code>encoding</code> if <code>isText</code> is true, and placing it
* name as the parameter <code>name</code>. If the virtual path does not exist * in the virtual directory <code>virtualPath</code>. Pass the name as
* in the archive, create it. * the parameter <code>name</code>. If the virtual path does not exist in
* the archive, create it.
*
* @param stream the InputStream to be added as an entry to the archive * @param stream the InputStream to be added as an entry to the archive
* @param virtualPath the destination of the stream * @param virtualPath the destination of the stream
* @param name the name of the result virtual file * @param name the name of the result virtual file
@ -251,17 +329,21 @@ public interface ISystemArchiveHandler
* @param targetEncoding the encoding of the result file * @param targetEncoding the encoding of the result file
* @param isText is the file a text file * @param isText is the file a text file
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the add was successful * @return <code>true</code> if the addition is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean add(InputStream stream, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor); public boolean add(InputStream stream, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Compresses the file <code>file</code> and adds it to the archive, * Compresses the file <code>file</code> and adds it to the archive,
* saving it in the encoding specified by <code>encoding</code> if the isText is true. * saving it in the encoding specified by <code>encoding</code> if the
* placing it in the virtual directory <code>virtualPath</code>. Pass the * isText is true. placing it in the virtual directory
* name as the parameter <code>name</code>. If the virtual path does not exist * <code>virtualPath</code>. Pass the name as the parameter
* in the archive, create it. If <code>file</code> is a directory, copy it and * <code>name</code>. If the virtual path does not exist in the archive,
* its contents into the archive, maintaining the tree structure. * create it. If <code>file</code> is a directory, copy it and its
* contents into the archive, maintaining the tree structure.
*
* @param file the file to be added to the archive * @param file the file to be added to the archive
* @param virtualPath the destination of the file * @param virtualPath the destination of the file
* @param name the name of the result virtual file * @param name the name of the result virtual file
@ -269,31 +351,40 @@ public interface ISystemArchiveHandler
* @param targetEncoding the encoding of the result file * @param targetEncoding the encoding of the result file
* @param typeRegistery file transfer mode (binary or text) of this file * @param typeRegistery file transfer mode (binary or text) of this file
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the add was successful * @return <code>true</code> if the addition is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, ISystemFileTypes typeRegistery, ISystemOperationMonitor archiveOperationMonitor); public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, ISystemFileTypes typeRegistery, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* A generalization of the add method. * A generalization of the add method. Compresses the array of files
* Compresses the array of files <code>files</code> and adds each of them to the archive, placing them * <code>files</code> and adds each of them to the archive, placing them
* in the virtual directory <code>virtualPath</code>. Pass the names of the files * in the virtual directory <code>virtualPath</code>. Pass the names of
* as the parameter <code>names</code>, where <code>files[i]</code> has the name <code>names[i]</code>. * the files as the parameter <code>names</code>, where
* If the virtual path does not exist in the archive, create it. * <code>files[i]</code> has the name <code>names[i]</code>. If the
* virtual path does not exist in the archive, create it.
*
* @param files the list of files to be added to the archive * @param files the list of files to be added to the archive
* @param virtualPath the destination of the file * @param virtualPath the destination of the file
* @param names the names of the result virtual files * @param names the names of the result virtual files
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the add was successful * @return <code>true</code> if the addition is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor); public boolean add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* A generalization of the add method. * A generalization of the add method. Compresses the array of files
* Compresses the array of files <code>files</code> and adds each of them to the archive, placing them * <code>files</code> and adds each of them to the archive, placing them
* in the virtual directory <code>virtualPath</code>. Save the i'th file in the i'th encoding (if isText[i] is true) * in the virtual directory <code>virtualPath</code>. Save the i'th file
* specified by <code>encodings</code>. Pass the names of the files * in the i'th encoding (if isText[i] is true) specified by
* as the parameter <code>names</code>, where <code>files[i]</code> has the name <code>names[i]</code>. * <code>encodings</code>. Pass the names of the files as the parameter
* If the virtual path does not exist in the archive, create it. * <code>names</code>, where <code>files[i]</code> has the name
* <code>names[i]</code>. If the virtual path does not exist in the
* archive, create it.
*
* @param files the list of files to be added to the archive * @param files the list of files to be added to the archive
* @param virtualPath the destination of the files * @param virtualPath the destination of the files
* @param names the names of the result virtual files * @param names the names of the result virtual files
@ -301,7 +392,9 @@ public interface ISystemArchiveHandler
* @param targetEncodings the encoding of the result files * @param targetEncodings the encoding of the result files
* @param isText file transfer mode (binary or text) of the files * @param isText file transfer mode (binary or text) of the files
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the add was successful * @return <code>true</code> if the addition is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean add(File[] files, String virtualPath, String[] names, String[] sourceEncodings, String[] targetEncodings, boolean[] isText, ISystemOperationMonitor archiveOperationMonitor); public boolean add(File[] files, String virtualPath, String[] names, String[] sourceEncodings, String[] targetEncodings, boolean[] isText, ISystemOperationMonitor archiveOperationMonitor);
@ -309,20 +402,24 @@ public interface ISystemArchiveHandler
* Compress the file <code>file</code> and replace the virtual file * Compress the file <code>file</code> and replace the virtual file
* referred to by <code>fullVirtualName</code> with the compressed file. * referred to by <code>fullVirtualName</code> with the compressed file.
* Pass the name of the file as the parameter <code>name</code>. * Pass the name of the file as the parameter <code>name</code>.
*
* @param fullVirtualName the path of the file to be replaced * @param fullVirtualName the path of the file to be replaced
* @param file the file to be added to the archive * @param file the file to be added to the archive
* @param name the name of the file * @param name the name of the file
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the replace was successful * @return <code>true</code> if the replacement is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean replace(String fullVirtualName, File file, String name, ISystemOperationMonitor archiveOperationMonitor); public boolean replace(String fullVirtualName, File file, String name, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Compress the InputStream <code>stream</code> and replace the virtual file * Compress the InputStream <code>stream</code> and replace the virtual
* referred to by <code>fullVirtualName</code> with the compressed stream. * file referred to by <code>fullVirtualName</code> with the compressed
* Pass the name of the new entry as the parameter <code>name</code>, the * stream. Pass the name of the new entry as the parameter <code>name</code>,
* encoding of the entry as <code>encoding</code> and whether or not the entry * the encoding of the entry as <code>encoding</code> and whether or not
* <code>isText</code> or not. * the entry <code>isText</code> or not.
*
* @param fullVirtualName the path of the file to be replaced * @param fullVirtualName the path of the file to be replaced
* @param stream the InputStream to be added as an entry to the archive * @param stream the InputStream to be added as an entry to the archive
* @param name the name of the result virtual file * @param name the name of the result virtual file
@ -330,16 +427,21 @@ public interface ISystemArchiveHandler
* @param targetEncoding the encoding of the result file * @param targetEncoding the encoding of the result file
* @param isText is the file a text file * @param isText is the file a text file
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the replace was successful * @return <code>true</code> if the replacement is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean replace(String fullVirtualName, InputStream stream, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor); public boolean replace(String fullVirtualName, InputStream stream, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Deletes the entry <code>fullVirtualName</code> from the archive, and returns * Deletes the entry <code>fullVirtualName</code> from the archive, and
* whether or not the deletion was successful. * returns whether or not the deletion was successful.
*
* @param fullVirtualName the path of the file to be deleted * @param fullVirtualName the path of the file to be deleted
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the replace was successful * @return <code>true</code> if the deletion is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor); public boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
@ -347,107 +449,141 @@ public interface ISystemArchiveHandler
* Renames the entry <code>fullVirtualName</code> to the new name * Renames the entry <code>fullVirtualName</code> to the new name
* <code>newName</code> while still leaving the entry in the same virtual * <code>newName</code> while still leaving the entry in the same virtual
* directory. Returns true if and only if the rename was successful. * directory. Returns true if and only if the rename was successful.
*
* @param fullVirtualName the path of the file to be renamed * @param fullVirtualName the path of the file to be renamed
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the replace was successful * @return <code>true</code> if the rename is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor); public boolean rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Moves the entry <code>fullVirtualName</code> to the location * Moves the entry <code>fullVirtualName</code> to the location specified
* specified by <code>destinationVirtualPath</code>, while leaving the entry with * by <code>destinationVirtualPath</code>, while leaving the entry with
* the same name as before. * the same name as before.
*
* @param fullVirtualName the path of the file to be renamed * @param fullVirtualName the path of the file to be renamed
* @param destinationVirtualPath the destination of the file to move to * @param destinationVirtualPath the destination of the file to move to
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the replace was successful * @return <code>true</code> if the move is successful, <code>false</code>
* otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor); public boolean move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Replaces the full name and path of the entry <code>fullVirtualName</code> * Replaces the full name and path of the entry <code>fullVirtualName</code>
* with the new full name and path <code>newFullVirtualName</code>. * with the new full name and path <code>newFullVirtualName</code>.
*
* @param fullVirtualName the path of the file to be renamed * @param fullVirtualName the path of the file to be renamed
* @param newFullVirtualName the full path of the virtual file name * @param newFullVirtualName the full path of the virtual file name
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the replace was successful * @return <code>true</code> if the rename is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean fullRename(String fullVirtualName, String newFullVirtualName, ISystemOperationMonitor archiveOperationMonitor); public boolean fullRename(String fullVirtualName, String newFullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Extracts and returns the specified list of virtual files from the archive. * Extracts and returns the specified list of virtual files from the
* archive.
*
* @param fullNames The list of files to return * @param fullNames The list of files to return
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return An array of handles to the extracted files. If fullNames has length 0 * @return An array of handles to the extracted files. If fullNames has
* then this method returns an array of length 0. * length 0 then this method returns an array of length 0.
* @since org.eclipse.rse.services 3.0
*/ */
public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor); public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Creates a new, empty folder in the archive. If parent folders do not exist either, creates them. * Creates a new, empty folder in the archive. If parent folders do not
* @param fullVirtualName The full name and path of the new folder within the virtual file system. * exist either, creates them.
*
* @param fullVirtualName The full name and path of the new folder within
* the virtual file system.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return Whether or not the creation was successful. * @return <code>true</code> if the create operation is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor); public boolean createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Creates a new, empty file in the archive. If parent folders do not exist either, creates them. * Creates a new, empty file in the archive. If parent folders do not exist
* @param fullVirtualName The full name and path of the new file within the virtual file system. * either, creates them.
*
* @param fullVirtualName The full name and path of the new file within the
* virtual file system.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return Whether or not the creation was successful. * @return <code>true</code> if the create operation is successful,
* <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/ */
public boolean createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor); public boolean createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Gets the archive-type specific standard name for the VirtualChild * Get the archive-type specific standard name for the VirtualChild
* <code>vc</code>. For example, for Zips, if vc is a directory, then * <code>vc</code>. For example, for Zip archives, if vc is a directory,
* the standard name must end with a "/". * then the standard name must end with a "/".
*
* @param vc the archive node to use
* @return the standard name for the node
*/ */
public String getStandardName(VirtualChild vc); public String getStandardName(VirtualChild vc);
/** /**
* Searches for text within a virtual file in this archive. * Search for text within a virtual file in this archive. A good
* A good implementation will not actually extract the file to disk. * implementation will not actually extract the file to disk.
*
* @param fullVirtualName the virtual file to search. * @param fullVirtualName the virtual file to search.
* @param matcher the pattern matcher to use. * @param matcher the pattern matcher to use.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return an array of match objects corresponding to lines where matches were found. * @return an array of match objects corresponding to lines where matches
* Returns an empty array if there are no results. * were found. Returns an empty array if there are no results.
* @since org.eclipse.rse.services 3.0
*/ */
public SystemSearchLineMatch[] search(String fullVirtualName, SystemSearchStringMatcher matcher, ISystemOperationMonitor archiveOperationMonitor); public SystemSearchLineMatch[] search(String fullVirtualName, SystemSearchStringMatcher matcher, ISystemOperationMonitor archiveOperationMonitor);
/** /**
* Gets the user-defined comment for a specific entry in the archive. * Get the user-defined comment for a specific entry in the archive.
*
* @param fullVirtualName The entry who's comment is desired * @param fullVirtualName The entry who's comment is desired
* @return the comment as a String or "" if there is none * @return the comment as a String or "" if there is none
*/ */
public String getCommentFor(String fullVirtualName); public String getCommentFor(String fullVirtualName);
/** /**
* Gets the amount of space taken up by a specific entry in the archive * Get the amount of space taken up by a specific entry in the archive when
* when it is in compressed form. Compare with getSizeFor(String) which gets * it is in compressed form. Compare with getSizeFor(String) which gets the
* the size of the entry after it is decompressed. * size of the entry after it is decompressed.
*
* @param fullVirtualName The entry who's compressed size is desired * @param fullVirtualName The entry who's compressed size is desired
* @return the compressed size of the specified entry, or 0 if the entry is not * @return the compressed size of the specified entry, or 0 if the entry is
* found. If the archive is not a compression type (ie. tar), return the same as getSizeFor(String). * not found. If the archive is not a compression type (ie. tar),
* return the same as getSizeFor(String).
*/ */
public long getCompressedSizeFor(String fullVirtualName); public long getCompressedSizeFor(String fullVirtualName);
/** /**
* Gets the method used to compress a specific entry in the archive. * Get the method used to compress a specific entry in the archive.
*
* @param fullVirtualName The entry who's compression method is desired * @param fullVirtualName The entry who's compression method is desired
* @return The compression method of the specified entry, or "" if none. * @return The compression method of the specified entry, or "" if none.
*/ */
public String getCompressionMethodFor(String fullVirtualName); public String getCompressionMethodFor(String fullVirtualName);
/** /**
* Get the comment associated with an archive.
*
* @return The comment associated with this archive, or "" if there is none. * @return The comment associated with this archive, or "" if there is none.
*/ */
public String getArchiveComment(); public String getArchiveComment();
/** /**
* Returns the classification for the entry with the given path. * Get the classification for the entry with the given path.
*
* @param fullVirtualName the virtual name. * @param fullVirtualName the virtual name.
* @return the classification. * @return the classification.
*/ */

View file

@ -42,11 +42,11 @@ import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.eclipse.rse.internal.services.clientserver.archiveutils.ITarConstants; import org.eclipse.rse.internal.services.clientserver.archiveutils.ITarConstants;
import org.eclipse.rse.internal.services.clientserver.archiveutils.SystemArchiveUtil; import org.eclipse.rse.internal.services.clientserver.archiveutils.SystemArchiveUtil;
import org.eclipse.rse.internal.services.clientserver.archiveutils.TarOutputStream;
import org.eclipse.rse.services.clientserver.ISystemFileTypes; import org.eclipse.rse.services.clientserver.ISystemFileTypes;
import org.eclipse.rse.services.clientserver.ISystemOperationMonitor; import org.eclipse.rse.services.clientserver.ISystemOperationMonitor;
import org.eclipse.rse.services.clientserver.SystemReentrantMutex; import org.eclipse.rse.services.clientserver.SystemReentrantMutex;
@ -675,8 +675,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualChildrenList(ISystemOperationMonitor archiveOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualChildrenList(org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public VirtualChild[] getVirtualChildrenList(ISystemOperationMonitor archiveOperationMonitor) { public VirtualChild[] getVirtualChildrenList(ISystemOperationMonitor archiveOperationMonitor) {
@ -704,8 +705,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return children; return children;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualChildrenList(java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualChildrenList(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public VirtualChild[] getVirtualChildrenList(String parent, ISystemOperationMonitor archiveOperationMonitor) { public VirtualChild[] getVirtualChildrenList(String parent, ISystemOperationMonitor archiveOperationMonitor) {
parent = ArchiveHandlerManager.cleanUpVirtualPath(parent); parent = ArchiveHandlerManager.cleanUpVirtualPath(parent);
@ -742,8 +744,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return children; return children;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualChildren(java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualChildren(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public VirtualChild[] getVirtualChildren(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) { public VirtualChild[] getVirtualChildren(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
@ -759,8 +762,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return vfs.getChildren(fullVirtualName); return vfs.getChildren(fullVirtualName);
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualChildFolders(java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualChildFolders(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public VirtualChild[] getVirtualChildFolders(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) { public VirtualChild[] getVirtualChildFolders(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
@ -776,8 +780,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return vfs.getChildrenFolders(fullVirtualName); return vfs.getChildrenFolders(fullVirtualName);
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualFile(java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getVirtualFile(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public VirtualChild getVirtualFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) { public VirtualChild getVirtualFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
@ -806,8 +811,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return entry; return entry;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#exists(java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#exists(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean exists(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) { public boolean exists(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
@ -842,7 +848,8 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return file; return file;
} }
/** /*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getTimeStampFor(java.lang.String) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getTimeStampFor(java.lang.String)
*/ */
public long getTimeStampFor(String fullVirtualName) { public long getTimeStampFor(String fullVirtualName) {
@ -862,7 +869,8 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
} }
/** /*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getSizeFor(java.lang.String) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getSizeFor(java.lang.String)
*/ */
public long getSizeFor(String fullVirtualName) { public long getSizeFor(String fullVirtualName) {
@ -981,8 +989,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return extractVirtualDirectory(fullVirtualName, destinationParent, (File) null, archiveOperationMonitor); return extractVirtualDirectory(fullVirtualName, destinationParent, (File) null, archiveOperationMonitor);
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.io.File, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.io.File, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean extractVirtualDirectory(String fullVirtualName, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor) { public boolean extractVirtualDirectory(String fullVirtualName, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor) {
@ -1095,8 +1104,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return true; return true;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File, java.lang.String, java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File, java.lang.String, java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor ) { public boolean add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor ) {
virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath); virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
@ -1170,11 +1180,11 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
/** /**
* Helper method. . . populates <code>found</code> with a * Helper method. Populates given List <code>found</code> with a collapsed
* collapsed list of all nodes in the subtree * list of all nodes in the subtree of the file system rooted at
* of the file system rooted at <code>parent</code>. * <code>parent</code>.
*/ */
public void listAllFiles(File parent, Vector found) { public void listAllFiles(File parent, List found) {
File[] children = parent.listFiles(); File[] children = parent.listFiles();
@ -1188,8 +1198,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File[], java.lang.String, java.lang.String[], ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File[], java.lang.String, java.lang.String[], org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor) { public boolean add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor) {
@ -1320,13 +1331,18 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
/** /**
* Create a tar file from the given virtual child objects, using the given output stream and omitting * Create a tar file from the given virtual child objects, using the given
* the children in the given set. * output stream and omitting the children in the given set.
* @param children an array of virtual children from which to create a tar file. *
* @param children an array of virtual children from which to create a tar
* file.
* @param outStream the tar output stream to use. * @param outStream the tar output stream to use.
* @param omitChildren the set of names for children that should be omitted from the given array of virtual children. * @param omitChildren the set of names for children that should be omitted
* from the given array of virtual children.
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return <code>true</code> if the operation has been canceled, <code>false</code> otherwise
* @throws IOException if an I/O exception occurs. * @throws IOException if an I/O exception occurs.
* @since org.eclipse.rse.services 3.0
*/ */
protected boolean createTar(VirtualChild[] children, TarOutputStream outStream, HashSet omitChildren, ISystemOperationMonitor archiveOperationMonitor) throws IOException { protected boolean createTar(VirtualChild[] children, TarOutputStream outStream, HashSet omitChildren, ISystemOperationMonitor archiveOperationMonitor) throws IOException {
@ -1743,8 +1759,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#delete(java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#delete(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) public boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -1754,6 +1771,14 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
/**
* Delete a virtual object.
*
* @param fullVirtualName virtual path identifying the object
* @param archiveOperationMonitor the operation progress monitor
* @return <code>true</code> if successful, <code>false</code> otherwise
* @since org.eclipse.rse.services 3.0
*/
protected boolean doDelete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) { protected boolean doDelete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
File outputTempFile = null; File outputTempFile = null;
@ -1836,8 +1861,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return false; return false;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#rename(java.lang.String, java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#rename(java.lang.String, java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor) { public boolean rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor) {
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
@ -1860,8 +1886,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return resultCode; return resultCode;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#move(java.lang.String, java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#move(java.lang.String, java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor) { public boolean move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor) {
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
@ -2009,13 +2036,19 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
/** /**
* Creates a tar file from the given virtual child objects, using the given output stream and renaming entries * Creates a tar file from the given virtual child objects, using the given
* according to hash map entries. * output stream and renaming entries according to hash map entries.
* @param children an array of virtual children from which to create a tar file. *
* @param children an array of virtual children from which to create a tar
* file.
* @param outStream the tar output stream to use. * @param outStream the tar output stream to use.
* @param renameMap a map containing associations between old names and new names. Old names are the keys * @param renameMap a map containing associations between old names and new
* in the map, and the values are the new names. * names. Old names are the keys in the map, and the values are
* the new names.
* @param archiveOperationMonitor the operation progress monitor
* @return <code>true</code> if the operation has been canceled, <code>false</code> otherwise.
* @throws IOException if an I/O exception occurs. * @throws IOException if an I/O exception occurs.
* @since org.eclipse.rse.services 3.0
*/ */
protected boolean createTar(VirtualChild[] children, TarOutputStream outStream, HashMap renameMap, ISystemOperationMonitor archiveOperationMonitor) throws IOException { protected boolean createTar(VirtualChild[] children, TarOutputStream outStream, HashMap renameMap, ISystemOperationMonitor archiveOperationMonitor) throws IOException {
@ -2113,8 +2146,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return entry; return entry;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getFiles(java.lang.String[], ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getFiles(java.lang.String[], org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor) { public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor) {
@ -2147,8 +2181,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return files; return files;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#createFolder(java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#createFolder(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) { public boolean createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
@ -2158,8 +2193,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return returnCode; return returnCode;
} }
/** /*
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#createFile(java.lang.String, ISystemOperationMonitor) * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#createFile(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/ */
public boolean createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) { public boolean createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
@ -2169,10 +2205,14 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
/** /**
* Creates a virtual object that does not already exist in the virtual file system. * Creates a virtual object that does not already exist in the virtual file
* Creates an empty file in the tar file. * system. Creates an empty file in the tar file.
*
* @param name the name of the virtual object. * @param name the name of the virtual object.
* @return <code>true</code> if the object was created successfully, <code>false</code> otherwise. * @param archiveOperationMonitor the operation progress monitor
* @return <code>true</code> if the object was created successfully,
* <code>false</code> otherwise.
* @since org.eclipse.rse.services 3.0
*/ */
protected boolean createVirtualObject(String name, ISystemOperationMonitor archiveOperationMonitor) { protected boolean createVirtualObject(String name, ISystemOperationMonitor archiveOperationMonitor) {
@ -2325,7 +2365,8 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return newEntry; return newEntry;
} }
/** /*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getStandardName(org.eclipse.rse.services.clientserver.archiveutils.VirtualChild) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getStandardName(org.eclipse.rse.services.clientserver.archiveutils.VirtualChild)
*/ */
public String getStandardName(VirtualChild vc) { public String getStandardName(VirtualChild vc) {
@ -2337,7 +2378,8 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return vc.fullName; return vc.fullName;
} }
/** /*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#create() * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#create()
*/ */
public boolean create() { public boolean create() {
@ -2408,10 +2450,15 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#exists()
*/
public boolean exists() public boolean exists()
{ {
return true; return true;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getCommentFor(java.lang.String) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getCommentFor(java.lang.String)
*/ */
@ -2447,12 +2494,13 @@ public class SystemTarHandler implements ISystemArchiveHandler {
/** /**
* Compresses the file <code>file</code> and adds it to the archive, * Compresses the file <code>file</code> and adds it to the archive,
* saving it in the encoding specified by <code>encoding</code> if * saving it in the encoding specified by <code>encoding</code> if saving
* saving in text mode. * in text mode. Places the file in the virtual directory
* Places the file in the virtual directory <code>virtualPath</code>. Pass the * <code>virtualPath</code>. Pass the name as the parameter
* name as the parameter <code>name</code>. If the virtual path does not exist * <code>name</code>. If the virtual path does not exist in the archive,
* in the archive, create it. If <code>file</code> is a directory, copy it and * create it. If <code>file</code> is a directory, copy it and its
* its contents into the archive, maintaining the tree structure. * contents into the archive, maintaining the tree structure.
*
* @param file the file to be added to the archive * @param file the file to be added to the archive
* @param virtualPath the destination of the file * @param virtualPath the destination of the file
* @param name the name of the result virtual file * @param name the name of the result virtual file
@ -2460,6 +2508,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
* @param registry the file type to use (text or binary) * @param registry the file type to use (text or binary)
* @param archiveOperationMonitor the operation progress monitor * @param archiveOperationMonitor the operation progress monitor
* @return true if and only if the add was successful * @return true if and only if the add was successful
* @since org.eclipse.rse.services 3.0
*/ */
public boolean add(File file, String virtualPath, String name, public boolean add(File file, String virtualPath, String name,
String encoding, ISystemFileTypes registry, ISystemOperationMonitor archiveOperationMonitor) { String encoding, ISystemFileTypes registry, ISystemOperationMonitor archiveOperationMonitor) {
@ -2473,6 +2522,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) { String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
return add(file, virtualPath, name, archiveOperationMonitor); return add(file, virtualPath, name, archiveOperationMonitor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File[], java.lang.String, java.lang.String[], java.lang.String[], java.lang.String[], boolean[]) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File[], java.lang.String, java.lang.String[], java.lang.String[], java.lang.String[], boolean[])
*/ */
@ -2480,6 +2530,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
String[] sourceEncodings, String[] targetEncodings, boolean[] isTexts, ISystemOperationMonitor archiveOperationMonitor) { String[] sourceEncodings, String[] targetEncodings, boolean[] isTexts, ISystemOperationMonitor archiveOperationMonitor) {
return add(files, virtualPath, names, archiveOperationMonitor); return add(files, virtualPath, names, archiveOperationMonitor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.io.File, java.lang.String, boolean) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.io.File, java.lang.String, boolean)
*/ */
@ -2487,6 +2538,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) { File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
return extractVirtualDirectory(dir, destinationParent, destination, archiveOperationMonitor); return extractVirtualDirectory(dir, destinationParent, destination, archiveOperationMonitor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.lang.String, boolean) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.lang.String, boolean)
*/ */
@ -2494,6 +2546,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) { String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
return extractVirtualDirectory(dir, destinationParent, archiveOperationMonitor); return extractVirtualDirectory(dir, destinationParent, archiveOperationMonitor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualFile(java.lang.String, java.io.File, java.lang.String, boolean) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualFile(java.lang.String, java.io.File, java.lang.String, boolean)
*/ */
@ -2502,7 +2555,8 @@ public class SystemTarHandler implements ISystemArchiveHandler {
return extractVirtualFile(fullVirtualName, destination, archiveOperationMonitor); return extractVirtualFile(fullVirtualName, destination, archiveOperationMonitor);
} }
/** /*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getClassification(java.lang.String) * @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getClassification(java.lang.String)
*/ */
public String getClassification(String fullVirtualName) { public String getClassification(String fullVirtualName) {
@ -2613,12 +2667,13 @@ public class SystemTarHandler implements ISystemArchiveHandler {
} }
/** /**
* Get the tar output stream for a given file. * Get the tar output stream for a given file. This method can be overridden
* This method can be overridden by subclass to return compressed output steam if needed. * by subclass to return compressed output steam if needed.
*
* @param outputFile the output file to create stream * @param outputFile the output file to create stream
* @return OutputStream the output stream to write * @return OutputStream the output stream to write
* @throws FileNotFoundException when the output file doesn't exists * @throws FileNotFoundException when the output file doesn't exist
* @since 3.0 * @since org.eclipse.rse.services 3.0
*/ */
protected TarOutputStream getTarOutputStream(File outputFile) throws FileNotFoundException { protected TarOutputStream getTarOutputStream(File outputFile) throws FileNotFoundException {
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outputFile)); TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outputFile));

View file

@ -16,7 +16,6 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
import org.eclipse.rse.internal.services.clientserver.archiveutils.TarOutputStream;
import org.eclipse.rse.internal.services.clientserver.archiveutils.TgzFile; import org.eclipse.rse.internal.services.clientserver.archiveutils.TgzFile;
/** /**

View file

@ -15,13 +15,14 @@
* {Name} (company) - description of contribution. * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [192741] [Archives] Move a folder from within an Archive doesn't work if > 1 level deep * Xuan Chen (IBM) - [192741] [Archives] Move a folder from within an Archive doesn't work if > 1 level deep
* Xuan Chen (IBM) - [194293] [Local][Archives] Saving file second time in an Archive Errors * Xuan Chen (IBM) - [194293] [Local][Archives] Saving file second time in an Archive Errors
* Xuan Chen (IBM) - [181784] [archivehandlers] zipped text files have unexpected contents * Xuan Chen (IBM) - [181784] [Archives] zipped text files have unexpected contents
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* Xuan Chen (IBM) - [209828] Need to move the Create operation to a job. * Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
* Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy * Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when canceling copy
* Xuan Chen (IBM) - [214251] [archive] "Last Modified Time" changed for all virtual files/folders if rename/paste/delete of one virtual file. * Xuan Chen (IBM) - [214251] [archive] "Last Modified Time" changed for all virtual files/folders if rename/paste/delete of one virtual file.
* Xuan Chen (IBM) - [214786] [regression][archive]rename a virtual directory does not work properly * Xuan Chen (IBM) - [214786] [regression][archive]rename a virtual directory does not work properly
* Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy * Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when canceling copy
* Martin Oberhuber (Wind River) - [cleanup] Add API "since" tags
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.services.clientserver.archiveutils; package org.eclipse.rse.services.clientserver.archiveutils;
@ -56,8 +57,8 @@ import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatcher;
/** /**
* @author mjberger
* Implements an ISystemArchiveHandler for ZIP files. * Implements an ISystemArchiveHandler for ZIP files.
* @author mjberger
*/ */
public class SystemZipHandler implements ISystemArchiveHandler public class SystemZipHandler implements ISystemArchiveHandler
{ {
@ -104,6 +105,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
protected File _file; // The underlying file associated with this handler. protected File _file; // The underlying file associated with this handler.
protected long _vfsLastModified; // The timestamp of the file that the virtual file system reflects. protected long _vfsLastModified; // The timestamp of the file that the virtual file system reflects.
protected boolean _exists; // Whether or not the zipfile "exists" (in order to exist, must be uncorrupted too) protected boolean _exists; // Whether or not the zipfile "exists" (in order to exist, must be uncorrupted too)
/** @since org.eclipse.rse.services 3.0 */
protected SystemReentrantMutex _mutex; protected SystemReentrantMutex _mutex;
/** /**
@ -131,7 +133,6 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Builds the virtual file system tree out of the entries in * Builds the virtual file system tree out of the entries in
* the zipfile. * the zipfile.
*
*/ */
protected void buildTree() protected void buildTree()
{ {
@ -145,8 +146,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
} }
/** /**
* Update the virtual file system tree after rename operation * Update the virtual file system tree after rename operation.
* * @since org.eclipse.rse.services 3.0
*/ */
protected void updateTreeAfterRename(HashMap newOldName, VirtualChild[] renameList) protected void updateTreeAfterRename(HashMap newOldName, VirtualChild[] renameList)
{ {
@ -264,6 +265,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
* the virtual path of the parameter, we can deduce what the ancestors * the virtual path of the parameter, we can deduce what the ancestors
* of the leaves are, and populate the tree from there. * of the leaves are, and populate the tree from there.
* @param next The ZipEntry from which the branch will be built. * @param next The ZipEntry from which the branch will be built.
* @since org.eclipse.rse.services 3.0
*/ */
protected void fillBranchAfterRename(ZipEntry next, String oldName) protected void fillBranchAfterRename(ZipEntry next, String oldName)
{ {
@ -440,6 +442,9 @@ public class SystemZipHandler implements ISystemArchiveHandler
} }
/**
* @since org.eclipse.rse.services 3.0
*/
protected void populate(String key, VirtualChild value) protected void populate(String key, VirtualChild value)
{ {
// base case 1: key has been encountered before, finish recursing // base case 1: key has been encountered before, finish recursing
@ -496,6 +501,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Same as getVirtualChildrenList(), but you can choose whether * Same as getVirtualChildrenList(), but you can choose whether
* to leave the zip file open or closed upon return. * to leave the zip file open or closed upon return.
* @since org.eclipse.rse.services 3.0
*/ */
public VirtualChild[] getVirtualChildrenList(boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor) public VirtualChild[] getVirtualChildrenList(boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -553,6 +559,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Same as getVirtualChildrenList(String parent) but you can choose whether * Same as getVirtualChildrenList(String parent) but you can choose whether
* or not you want to leave the zipfile open after return. * or not you want to leave the zipfile open after return.
* @since org.eclipse.rse.services 3.0
*/ */
public VirtualChild[] getVirtualChildrenList(String parent, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor) public VirtualChild[] getVirtualChildrenList(String parent, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -808,6 +815,15 @@ public class SystemZipHandler implements ISystemArchiveHandler
return getSizeFor(fullVirtualName, true); return getSizeFor(fullVirtualName, true);
} }
/**
* Same as {@link #getSizeFor(String)} but allows to specify whether to
* close the zip file or not.
*
* @param fullVirtualName absolute virtual path to the node to inspect
* @param closeZipFile <code>true</code> if the zip file should be closed
* @return the uncompressed size of the node requested.
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getSizeFor(java.lang.String)
*/
public long getSizeFor(String fullVirtualName, boolean closeZipFile) public long getSizeFor(String fullVirtualName, boolean closeZipFile)
{ {
if (!_exists) return 0; if (!_exists) return 0;
@ -850,6 +866,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Same as extractVirtualFile(String fullVirtualName, File destination) but you can choose whether * Same as extractVirtualFile(String fullVirtualName, File destination) but you can choose whether
* or not you want to leave the zipfile open after return. * or not you want to leave the zipfile open after return.
* @since org.eclipse.rse.services 3.0
*/ */
public boolean extractVirtualFile(String fullVirtualName, File destination, boolean closeZipFile, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) public boolean extractVirtualFile(String fullVirtualName, File destination, boolean closeZipFile, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -967,6 +984,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
return extractVirtualDirectory(dir, destinationParent, destination, SystemEncodingUtil.ENCODING_UTF_8, false, archiveOperationMonitor); return extractVirtualDirectory(dir, destinationParent, destination, SystemEncodingUtil.ENCODING_UTF_8, false, archiveOperationMonitor);
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.io.File, java.lang.String, boolean, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/
public boolean extractVirtualDirectory(String dir, File destinationParent, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) public boolean extractVirtualDirectory(String dir, File destinationParent, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
{ {
if (!_exists) return false; if (!_exists) return false;
@ -1096,6 +1117,13 @@ public class SystemZipHandler implements ISystemArchiveHandler
return true; return true;
} }
/**
* Create an empty file, also creating parent folders if necessary.
*
* @param file An abstract file handle to create physically.
* @return <code>true</code> if successful, <code>false</code>
* otherwise.
*/
protected boolean createFile(File file) protected boolean createFile(File file)
{ {
try try
@ -1132,6 +1160,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
return add(file, virtualPath, name, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false, archiveOperationMonitor); return add(file, virtualPath, name, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false, archiveOperationMonitor);
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.InputStream, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/
public boolean add(InputStream stream, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) public boolean add(InputStream stream, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
{ {
if (!_exists) return false; if (!_exists) return false;
@ -1228,6 +1260,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
return add(files, virtualPath, names, encodings, encodings, isTexts, true, archiveOperationMonitor); return add(files, virtualPath, names, encodings, encodings, isTexts, true, archiveOperationMonitor);
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File[], java.lang.String, java.lang.String[], java.lang.String[], java.lang.String[], boolean[], org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/
public boolean add(File[] files, String virtualPath, String[] names, String[] sourceEncodings, String[] targetEncodings, boolean[] isText, ISystemOperationMonitor archiveOperationMonitor) public boolean add(File[] files, String virtualPath, String[] names, String[] sourceEncodings, String[] targetEncodings, boolean[] isText, ISystemOperationMonitor archiveOperationMonitor)
{ {
return add(files, virtualPath, names, sourceEncodings, targetEncodings, isText, true, archiveOperationMonitor); return add(files, virtualPath, names, sourceEncodings, targetEncodings, isText, true, archiveOperationMonitor);
@ -1237,6 +1273,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Same as add(File[] files, String virtualPath, String[] names, String[] encodings) but you can choose whether * Same as add(File[] files, String virtualPath, String[] names, String[] encodings) but you can choose whether
* or not you want to leave the zipfile open after return. * or not you want to leave the zipfile open after return.
* @since org.eclipse.rse.services 3.0
*/ */
public boolean add(File[] files, String virtualPath, String[] names, String[] sourceEncodings, String[] targetEncodings, boolean[] isText, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor) public boolean add(File[] files, String virtualPath, String[] names, String[] sourceEncodings, String[] targetEncodings, boolean[] isText, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -1347,9 +1384,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
} }
/** /**
* Helper method. . . populates <code>found</code> with a * Helper method. populates <code>found</code> with a collapsed list of
* collapsed list of all nodes in the subtree * all nodes in the subtree of the file system rooted at <code>parent</code>.
* of the file system rooted at <code>parent</code>. *
* @since org.eclipse.rse.services 3.0
*/ */
public static boolean listAllFiles(File parent, HashSet found, ISystemOperationMonitor archiveOperationMonitor) public static boolean listAllFiles(File parent, HashSet found, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -1391,6 +1429,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
* @param omitChildren The set of names of children to omit when creating * @param omitChildren The set of names of children to omit when creating
* the zipfile. Null or empty set if there are no omissions. * the zipfile. Null or empty set if there are no omissions.
* @throws IOException in case of a file I/O error * @throws IOException in case of a file I/O error
* @since org.eclipse.rse.services 3.0
*/ */
protected boolean recreateZipDeleteEntries(VirtualChild[] vcList, ZipOutputStream dest, HashSet omitChildren, ISystemOperationMonitor archiveOperationMonitor) throws IOException protected boolean recreateZipDeleteEntries(VirtualChild[] vcList, ZipOutputStream dest, HashSet omitChildren, ISystemOperationMonitor archiveOperationMonitor) throws IOException
{ {
@ -1449,6 +1488,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
* children are to be recreated * children are to be recreated
* @param names HashMap maps the full path of a virtual file to the entry in the archive file * @param names HashMap maps the full path of a virtual file to the entry in the archive file
* @throws IOException * @throws IOException
* @since org.eclipse.rse.services 3.0
*/ */
protected boolean recreateZipRenameEntries(VirtualChild[] vcList, ZipOutputStream dest, HashMap names, ISystemOperationMonitor archiveOperationMonitor) throws IOException protected boolean recreateZipRenameEntries(VirtualChild[] vcList, ZipOutputStream dest, HashMap names, ISystemOperationMonitor archiveOperationMonitor) throws IOException
{ {
@ -1652,6 +1692,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Same as delete(String fullVirtualName) but you can choose whether * Same as delete(String fullVirtualName) but you can choose whether
* or not you want to leave the zipfile open after return. * or not you want to leave the zipfile open after return.
* @since org.eclipse.rse.services 3.0
*/ */
public boolean delete(String fullVirtualName, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor) public boolean delete(String fullVirtualName, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -1783,6 +1824,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Same as replace(String fullVirtualName, File file, String name) but you can choose whether * Same as replace(String fullVirtualName, File file, String name) but you can choose whether
* or not you want to leave the zipfile open after return. * or not you want to leave the zipfile open after return.
* @since org.eclipse.rse.services 3.0
*/ */
public boolean replace(String fullVirtualName, File file, String name, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor) public boolean replace(String fullVirtualName, File file, String name, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -1861,6 +1903,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#replace(java.lang.String, java.io.InputStream, java.lang.String, java.lang.String, java.lang.String, boolean, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/
public boolean replace(String fullVirtualName, InputStream stream, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) public boolean replace(String fullVirtualName, InputStream stream, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
{ {
if (!_exists) return false; if (!_exists) return false;
@ -1938,6 +1984,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Same as fullRename(String fullVirtualName, String newFullVirtualName) but you can choose whether * Same as fullRename(String fullVirtualName, String newFullVirtualName) but you can choose whether
* or not you want to leave the zipfile open after return. * or not you want to leave the zipfile open after return.
* @since org.eclipse.rse.services 3.0
*/ */
public boolean fullRename(String fullVirtualName, String newFullVirtualName, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor) public boolean fullRename(String fullVirtualName, String newFullVirtualName, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -2146,6 +2193,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
* created will be a folder if and only if * created will be a folder if and only if
* <code>name</code> ends in a "/". * <code>name</code> ends in a "/".
* @return Whether the creation was successful or not. * @return Whether the creation was successful or not.
* @since org.eclipse.rse.services 3.0
*/ */
protected boolean createVirtualObject(String name, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor) protected boolean createVirtualObject(String name, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -2255,6 +2303,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
return new ZipEntry(name); return new ZipEntry(name);
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getStandardName(org.eclipse.rse.services.clientserver.archiveutils.VirtualChild)
*/
public String getStandardName(VirtualChild vc) public String getStandardName(VirtualChild vc)
{ {
if (vc.isDirectory) return vc.fullName + "/"; //$NON-NLS-1$ if (vc.isDirectory) return vc.fullName + "/"; //$NON-NLS-1$
@ -2300,6 +2352,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
* If the mod-times of the underlying zip file and the file used to * If the mod-times of the underlying zip file and the file used to
* create the virtualFS are different, update the virtualFS. * create the virtualFS are different, update the virtualFS.
* @return whether or not the op was successful. * @return whether or not the op was successful.
* @since org.eclipse.rse.services 3.0
*/ */
protected boolean updateVirtualFSIfNecessary(ISystemOperationMonitor archiveOperationMonitor) protected boolean updateVirtualFSIfNecessary(ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -2351,6 +2404,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
return entry; return entry;
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#create()
*/
public boolean create() public boolean create()
{ {
try try
@ -2386,6 +2443,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
return true; return true;
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#search(java.lang.String, org.eclipse.rse.services.clientserver.search.SystemSearchStringMatcher, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/
public SystemSearchLineMatch[] search(String fullVirtualName, SystemSearchStringMatcher matcher, ISystemOperationMonitor archiveOperationMonitor) public SystemSearchLineMatch[] search(String fullVirtualName, SystemSearchStringMatcher matcher, ISystemOperationMonitor archiveOperationMonitor)
{ {
@ -2444,6 +2505,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
} }
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#exists()
*/
public boolean exists() public boolean exists()
{ {
return _exists; return _exists;
@ -2555,6 +2620,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
} }
else return ""; //$NON-NLS-1$ else return ""; //$NON-NLS-1$
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.archiveutils.ISystemArchiveHandler#getArchiveComment() * @see org.eclipse.rse.core.archiveutils.ISystemArchiveHandler#getArchiveComment()
*/ */
@ -2643,6 +2709,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
return type; return type;
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.rse.services.clientserver.ISystemFileTypes, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/
public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, ISystemFileTypes registry, ISystemOperationMonitor archiveOperationMonitor) public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, ISystemFileTypes registry, ISystemOperationMonitor archiveOperationMonitor)
{ {
if (!_exists) if (!_exists)
@ -2721,6 +2791,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
} }
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
*/
public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
{ {
if (!_exists) if (!_exists)

View file

@ -12,16 +12,16 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [api] SystemTarHandler has inconsistent API * Xuan Chen (IBM) - [api] SystemTarHandler has inconsistent API
* Martin Oberhuber (Wind River) - [cleanup] Move from internal to fix API leakage
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.clientserver.archiveutils; package org.eclipse.rse.services.clientserver.archiveutils;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import org.eclipse.rse.services.clientserver.archiveutils.TarEntry; import org.eclipse.rse.internal.services.clientserver.archiveutils.ITarConstants;
/** /**
* This class implements an output stream filter for writing files in the * This class implements an output stream filter for writing files in the

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * Martin Oberhuber (Wind River) - [cleanup] add API "since" tags
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.services.clientserver.processes; package org.eclipse.rse.services.clientserver.processes;
@ -55,6 +55,7 @@ public interface ISystemProcessRemoteConstants
public static final char STATE_ZOS_SWAPPEDOUT = 'I'; public static final char STATE_ZOS_SWAPPEDOUT = 'I';
public static final char STATE_ZOS_PTHREADCREATED = 'J'; public static final char STATE_ZOS_PTHREADCREATED = 'J';
public static final char STATE_ZOS_OTHERKERNELWAIT = 'K'; public static final char STATE_ZOS_OTHERKERNELWAIT = 'K';
/** @since 3.0 renamed from STATE_ZOS_CANCELLED */
public static final char STATE_ZOS_CANCELED = 'L'; public static final char STATE_ZOS_CANCELED = 'L';
public static final char STATE_ZOS_MULTITHREAD = 'M'; public static final char STATE_ZOS_MULTITHREAD = 'M';
public static final char STATE_ZOS_MEDIUMWEIGHTTHREAD = 'N'; public static final char STATE_ZOS_MEDIUMWEIGHTTHREAD = 'N';
@ -94,6 +95,7 @@ public interface ISystemProcessRemoteConstants
public static final int STATE_ZOS_SWAPPEDOUT_INDEX = 18; public static final int STATE_ZOS_SWAPPEDOUT_INDEX = 18;
public static final int STATE_ZOS_PTHREADCREATED_INDEX = 19; public static final int STATE_ZOS_PTHREADCREATED_INDEX = 19;
public static final int STATE_ZOS_OTHERKERNELWAIT_INDEX = 20; public static final int STATE_ZOS_OTHERKERNELWAIT_INDEX = 20;
/** @since 3.0 renamed from STATE_ZOS_CANCELLED_INDEX */
public static final int STATE_ZOS_CANCELED_INDEX = 21; public static final int STATE_ZOS_CANCELED_INDEX = 21;
public static final int STATE_ZOS_MULTITHREAD_INDEX = 22; public static final int STATE_ZOS_MULTITHREAD_INDEX = 22;
public static final int STATE_ZOS_MEDIUMWEIGHTTHREAD_INDEX = 23; public static final int STATE_ZOS_MEDIUMWEIGHTTHREAD_INDEX = 23;

View file

@ -22,6 +22,7 @@
* David McKnight (IBM) - [210109] store constants in IFileService rather than IFileServiceConstants * David McKnight (IBM) - [210109] store constants in IFileService rather than IFileServiceConstants
* Kevin Doyle (IBM) - [208778] new API getOutputSteam for getting an output stream in append mode * Kevin Doyle (IBM) - [208778] new API getOutputSteam for getting an output stream in append mode
* David McKnight (IBM) - [209704] added supportsEncodingConversion() * David McKnight (IBM) - [209704] added supportsEncodingConversion()
* Martin Oberhuber (Wind River) - [cleanup] Fix API since tags
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.services.files; package org.eclipse.rse.services.files;
@ -57,71 +58,84 @@ public interface IFileService extends IService
{ {
/** /**
* Query constant (bit mask value 1) which indicates that a query should be * Query constant (bit mask value 1) which indicates that a query should be
* on files. The filter(s) passed into the list methods will produce a subset * on files. The filter(s) passed into the list methods will produce a
* of files matching the filter(s). * subset of files matching the filter(s).
* *
* This constant is passed into the IFileService list calls. Implementors of * This constant is passed into the IFileService list calls. Implementors of
* IFileService make use of this to determine what to query and what to return * IFileService make use of this to determine what to query and what to
* from the query. * return from the query.
* *
* @see IFileService#list(String,String,int,IProgressMonitor) * @see IFileService#list(String,String,int,IProgressMonitor)
* @see IFileService#listMultiple(String[],String[],int,IProgressMonitor) * @see IFileService#listMultiple(String[],String[],int,IProgressMonitor)
* @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor) * @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor)
*
* @since org.eclipse.rse.services 3.0
*/ */
public static final int FILE_TYPE_FILES = 0x1; public static final int FILE_TYPE_FILES = 0x1;
/** /**
* Query constant (bit mask value 2) which indicates that a query should be * Query constant (bit mask value 2) which indicates that a query should be
* on folders. The filter(s) passed into the list methods will produce a subset * on folders. The filter(s) passed into the list methods will produce a
* of folders matching the filter(s). * subset of folders matching the filter(s).
* *
* This constant is passed into the IFileService list calls. Implementors of * This constant is passed into the IFileService list calls. Implementors of
* IFileService make use of this to determine what to query and what to return * IFileService make use of this to determine what to query and what to
* from the query. * return from the query.
* *
* @see IFileService#list(String,String,int,IProgressMonitor) * @see IFileService#list(String,String,int,IProgressMonitor)
* @see IFileService#listMultiple(String[],String[],int,IProgressMonitor) * @see IFileService#listMultiple(String[],String[],int,IProgressMonitor)
* @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor) * @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor)
*
* @since org.eclipse.rse.services 3.0
*/ */
public static final int FILE_TYPE_FOLDERS = 0x2; public static final int FILE_TYPE_FOLDERS = 0x2;
/** /**
* Query constant (bit mask value 0) which indicates that a query should produce * Query constant (bit mask value 0) which indicates that a query should
* folders and files. The filter(s) passed into the list methods will produce a * produce folders and files. The filter(s) passed into the list methods
* subset of files matching the filter(s) and all the folders. * will produce a subset of files matching the filter(s) and all the
* Note that only files are filtered and all folders are returned when this is used. * folders. Note that only files are filtered and all folders are returned
* when this is used.
* *
* This constant is passed into the IFileService list calls. Implementors of * This constant is passed into the IFileService list calls. Implementors of
* IFileService make use of this to determine what to query and what to return * IFileService make use of this to determine what to query and what to
* from the query. * return from the query.
* *
* @see IFileService#list(String,String,int,IProgressMonitor) * @see IFileService#list(String,String,int,IProgressMonitor)
* @see IFileService#listMultiple(String[],String[],int,IProgressMonitor) * @see IFileService#listMultiple(String[],String[],int,IProgressMonitor)
* @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor) * @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor)
*
* @since org.eclipse.rse.services 3.0
*/ */
public static final int FILE_TYPE_FILES_AND_FOLDERS = 0x0; public static final int FILE_TYPE_FILES_AND_FOLDERS = 0x0;
/** /**
* Options constant (value 1 &lt;&lt;0) for specifying a stream * Options constant (value 1 &lt;&lt;0) for specifying a stream that will
* that will append data to a file. * append data to a file.
* *
* @see IFileService#getOutputStream(String, String, int, IProgressMonitor) * @see IFileService#getOutputStream(String, String, int, IProgressMonitor)
*
* @since org.eclipse.rse.services 3.0
*/ */
public static final int APPEND = 1 << 0; public static final int APPEND = 1 << 0;
/** /**
* Options constant (value 2 &lt;&lt;0) for specifying that a file * Options constant (value 2 &lt;&lt;0) for specifying that a file is Text
* is Text instead of the default Binary. * instead of the default Binary.
* *
* In Text mode, encoding conversions and line end conversions can be * In Text mode, encoding conversions and line end conversions can be
* performed on the stream. * performed on the stream.
* *
* @see IFileService#getOutputStream(String, String, int, IProgressMonitor) * @see IFileService#getOutputStream(String, String, int, IProgressMonitor)
*
* @since org.eclipse.rse.services 3.0
*/ */
public static final int TEXT_MODE = 2 << 0; public static final int TEXT_MODE = 2 << 0;
/** /**
* Options constant (value 0) to indicate that no bit options are set. * Options constant (value 0) to indicate that no bit options are set.
*
* @since org.eclipse.rse.services 3.0
*/ */
public static final int NONE = 0; public static final int NONE = 0;
@ -172,6 +186,8 @@ public interface IFileService extends IService
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the * Typically this would be one of those in the
* {@link RemoteFileException} family. * {@link RemoteFileException} family.
*
* @since org.eclipse.rse.services 3.0
*/ */
public boolean uploadMultiple(File[] localFiles, String[] remoteParents, String[] remoteFiles, boolean[] isBinary, String[] srcEncodings, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException; public boolean uploadMultiple(File[] localFiles, String[] remoteParents, String[] remoteFiles, boolean[] isBinary, String[] srcEncodings, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException;
@ -194,109 +210,136 @@ public interface IFileService extends IService
/** /**
* Copy files from the remote file system to the local system. * Copy files from the remote file system to the local system.
*
* @param remoteParents - string designating the remote parents. * @param remoteParents - string designating the remote parents.
* @param remoteFiles - Strings designating the remote files residing in the parents. * @param remoteFiles - Strings designating the remote files residing in the
* @param localFiles - The files that are to be written. If the files exists they are * parents.
* overwritten. * @param localFiles - The files that are to be written. If the files exists
* they are overwritten.
* @param isBinary - indicates whether the files are text on binary * @param isBinary - indicates whether the files are text on binary
* @param hostEncodings - the encodings on the host (if text) * @param hostEncodings - the encodings on the host (if text)
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @return true if the files were copied from the remote system. * @return true if the files were copied from the remote system.
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the * be one of those in the {@link RemoteFileException} family.
* {@link RemoteFileException} family. *
* @since org.eclipse.rse.services 3.0
*/ */
public boolean downloadMultiple(String[] remoteParents, String[] remoteFiles, File[] localFiles, boolean[] isBinary, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException; public boolean downloadMultiple(String[] remoteParents, String[] remoteFiles, File[] localFiles, boolean[] isBinary, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Get an abstract remote file handle for a specified path.
*
* @param remoteParent * @param remoteParent
* @param name * @param name
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @return the host file given the parent path and file name. * @return the host file given the parent path and file name. Must not
* Must not return <code>null</code>, non-existing files should be * return <code>null</code>, non-existing files should be
* reported with an IHostFile object where {@link IHostFile#exists()} * reported with an IHostFile object where
* returns <code>false</code>. * {@link IHostFile#exists()} returns <code>false</code>.
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public IHostFile getFile(String remoteParent, String name, IProgressMonitor monitor) throws SystemMessageException; public IHostFile getFile(String remoteParent, String name, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* List the contents of a remote folder.
*
* @param remoteParent - the name of the parent directory on the remote file * @param remoteParent - the name of the parent directory on the remote file
* system from which to retrieve the child list. * system from which to retrieve the child list.
* @param fileFilter - a string that can be used to filter the children. Only * @param fileFilter - a string that can be used to filter the children.
* those files matching the filter make it into the list. The interface * Only those files matching the filter make it into the list.
* does not dictate where the filtering occurs. * The interface does not dictate where the filtering occurs.
* @param fileType - indicates whether to query files, folders, both or some other type * @param fileType - indicates whether to query files, folders, both or some
* other type
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @return the list of host files. * @return the list of host files.
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
* *
* @since org.eclipse.rse.services 3.0
*/ */
public IHostFile[] list(String remoteParent, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException; public IHostFile[] list(String remoteParent, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Get multiple abstract remote file handles for an array of specified
* paths.
*
* @param remoteParents - the list of remote parents * @param remoteParents - the list of remote parents
* @param names - the list of file names * @param names - the list of file names
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @return the host files given the parent paths and file names. This is basically a batch version of getFile(). * @return the host files given the parent paths and file names. This is
* Must not return <code>null</code>, non-existing files should be * basically a batch version of getFile(). Must not return
* reported with an IHostFile object where {@link IHostFile#exists()} * <code>null</code>, non-existing files should be reported with
* returns <code>false</code>. * an IHostFile object where {@link IHostFile#exists()} returns
* @throws SystemMessageException if an error occurs. * <code>false</code>.
* Typically this would be one of those in the RemoteFileException family. * @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
*
* @since org.eclipse.rse.services 3.0
*/ */
public IHostFile[] getFileMultiple(String remoteParents[], String names[], IProgressMonitor monitor) throws SystemMessageException; public IHostFile[] getFileMultiple(String remoteParents[], String names[], IProgressMonitor monitor) throws SystemMessageException;
/** /**
* @param remoteParents - the names of the parent directories on the remote file * List the contents of multiple remote folders.
* system from which to retrieve the collective child list. *
* @param fileFilters - a set of strings that can be used to filter the children. Only * @param remoteParents - the names of the parent directories on the remote
* those files matching the filter corresponding to it's remoteParent make it into the list. The interface * file system from which to retrieve the collective child list.
* does not dictate where the filtering occurs. For each remoteParent, there must be a corresponding * @param fileFilters - a set of strings that can be used to filter the
* fileFilter. * children. Only those files matching the filter corresponding
* @param fileTypes - indicates whether to query files, folders, both or some other type. For * to it's remoteParent make it into the list. The interface does
* each remoteParent, there must be a corresponding fileType. * not dictate where the filtering occurs. For each remoteParent,
* For the default list of available file types see <code>IFileServiceContants</code> * there must be a corresponding fileFilter.
* @param fileTypes - indicates whether to query files, folders, both or
* some other type. For each remoteParent, there must be a
* corresponding fileType. For the default list of available file
* types see <code>IFileServiceContants</code>
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @return the collective list of host files that reside in each of the remoteParents with it's corresponding filter. * @return the collective list of host files that reside in each of the
* @throws SystemMessageException if an error occurs. * remoteParents with it's corresponding filter.
* Typically this would be one of those in the RemoteFileException family. * @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
*
* @since org.eclipse.rse.services 3.0
*/ */
public IHostFile[] listMultiple(String[] remoteParents, String[] fileFilters, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException; public IHostFile[] listMultiple(String[] remoteParents, String[] fileFilters, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* @param remoteParents - the names of the parent directories on the remote file * List the contents of multiple remote folders.
* system from which to retrieve the collective child list. *
* @param fileFilters - a set of strings that can be used to filter the children. Only * @param remoteParents - the names of the parent directories on the remote
* those files matching the filter corresponding to it's remoteParent make it into the list. The interface * file system from which to retrieve the collective child list.
* does not dictate where the filtering occurs. For each remoteParent, there must be a corresponding * @param fileFilters - a set of strings that can be used to filter the
* fileFilter. * children. Only those files matching the filter corresponding
* @param fileType - indicates whether to query files, folders, both or some other type. For * to it's remoteParent make it into the list. The interface does
* each remoteParent, there must be a corresponding fileType. * not dictate where the filtering occurs. For each remoteParent,
* For the default list of available file types see <code>IFileServiceContants</code> * there must be a corresponding fileFilter.
* @param fileType - indicates whether to query files, folders, both or some
* other type. All results will be of the specified type. For the
* default list of available file types see
* <code>IFileServiceContants</code>
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @return the collective list of host files that reside in each of the remoteParents with it's corresponding filter. * @return the collective list of host files that reside in each of the
* @throws SystemMessageException if an error occurs. * remoteParents with it's corresponding filter.
* Typically this would be one of those in the RemoteFileException family. * @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
*
* @since org.eclipse.rse.services 3.0
*/ */
public IHostFile[] listMultiple(String[] remoteParents, String[] fileFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException; public IHostFile[] listMultiple(String[] remoteParents, String[] fileFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Get abstract remote file handles for the known remote file system roots.
*
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* Return the list of roots for this system * Return the list of roots for this system
* @return the list of host files. * @return the list of host files.
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public IHostFile[] getRoots(IProgressMonitor monitor) throws SystemMessageException; public IHostFile[] getRoots(IProgressMonitor monitor) throws SystemMessageException;
@ -317,122 +360,138 @@ public interface IFileService extends IService
public IHostFile getUserHome(); public IHostFile getUserHome();
/** /**
* Create a file on the host * Create a file on the host.
*
* @param remoteParent the parent directory * @param remoteParent the parent directory
* @param fileName the name of the new file * @param fileName the name of the new file
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @return the newly created file * @return the newly created file
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public IHostFile createFile(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException; public IHostFile createFile(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Create a folder on the host * Create a folder on the host.
*
* @param remoteParent the parent directory * @param remoteParent the parent directory
* @param folderName the name of the new folder * @param folderName the name of the new folder
* @param monitor the progress monitor * @param monitor the progress monitor
* @return the newly created folder * @return the newly created folder
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public IHostFile createFolder(String remoteParent, String folderName, IProgressMonitor monitor) throws SystemMessageException; public IHostFile createFolder(String remoteParent, String folderName, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Deletes a file or folder on the host * Delete a file or folder on the host.
*
* @param remoteParent the folder containing the file to delete * @param remoteParent the folder containing the file to delete
* @param fileName the name of the file or folder to delete * @param fileName the name of the file or folder to delete
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true if successful * @return true if successful
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException; public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Deletes a set of files or folders on the host. Should throw an exception if some files and folders were deleted and others were not * Delete a set of files or folders on the host. Should throw an exception
* due to an exception during the operation. Without an exception thrown in such cases, views may not be refreshed correctly to account * if some files and folders were deleted and others were not due to an
* for deleted resources. * exception during the operation. Without an exception thrown in such
* cases, views may not be refreshed correctly to account for deleted
* resources.
*
* @param remoteParents the array of folders containing the files to delete * @param remoteParents the array of folders containing the files to delete
* @param fileNames the names of the files or folders to delete * @param fileNames the names of the files or folders to delete
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true iff all deletes are successful * @return <code>true</code> if all delete operations are successful,
* @throws SystemMessageException if an error occurs. * <code>false</code> otherwise.
* Typically this would be one of those in the RemoteFileException family. * @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
*/ */
public boolean deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException; public boolean deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Renames a file or folder on the host * Rename a file or folder on the host.
*
* @param remoteParent the folder containing the file to rename * @param remoteParent the folder containing the file to rename
* @param oldName the old name of the file or folder to rename * @param oldName the old name of the file or folder to rename
* @param newName the new name for the file * @param newName the new name for the file
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true if successful * @return true if successful
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public boolean rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException; public boolean rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Renames a file or folder on the host * Rename a file or folder on the host.
*
* @param remoteParent the folder containing the file to rename * @param remoteParent the folder containing the file to rename
* @param oldName the old name of the file or folder to rename * @param oldName the old name of the file or folder to rename
* @param newName the new name for the file * @param newName the new name for the file
* @param oldFile the file to update with the change * @param oldFile the file to update with the change
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true if successful * @return true if successful
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException; public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Move the file or folder specified * Move the file or folder specified to a different remote path.
*
* @param srcParent the folder containing the file or folder to move * @param srcParent the folder containing the file or folder to move
* @param srcName the new of the file or folder to move * @param srcName the new of the file or folder to move
* @param tgtParent the destination folder for the move * @param tgtParent the destination folder for the move
* @param tgtName the name of the moved file or folder * @param tgtName the name of the moved file or folder
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true if the file was moved * @return true if the file was moved
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public boolean move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException; public boolean move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Copy the file or folder to the specified destination * Copy the file or folder to the specified destination.
*
* @param srcParent the folder containing the file or folder to copy * @param srcParent the folder containing the file or folder to copy
* @param srcName the new of the file or folder to copy * @param srcName the new of the file or folder to copy
* @param tgtParent the destination folder for the copy * @param tgtParent the destination folder for the copy
* @param tgtName the name of the copied file or folder * @param tgtName the name of the copied file or folder
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true if the file was copied successfully * @return true if the file was copied successfully
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs. Typically this would
* Typically this would be one of those in the RemoteFileException family. * be one of those in the RemoteFileException family.
*/ */
public boolean copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException; public boolean copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Copy a set of files or folders to the specified destination * Copy a set of files or folders to the specified destination.
*
* @param srcParents the folders containing each file or folder to copy * @param srcParents the folders containing each file or folder to copy
* @param srcNames the names of the files or folders to copy * @param srcNames the names of the files or folders to copy
* @param tgtParent the destination folder for the copy * @param tgtParent the destination folder for the copy
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true if all files were copied * @return <code>true</code> if all files were copied, <code>false</code>
* @throws SystemMessageException if an error occurs. * or exception otherwise.
* Typically this would be one of those in the RemoteFileException family. * @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
*/ */
public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException; public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Indicates whether the file system is case sensitive * Indicates whether the file system is case sensitive.
*
* @return true if the file system has case sensitive file names * @return true if the file system has case sensitive file names
*/ */
public boolean isCaseSensitive(); public boolean isCaseSensitive();
/** /**
* Sets the last modified stamp of the file or folder with the specified timestamp * Set the last modified stamp of the file or folder with the specified
* timestamp.
*
* @param parent the parent path of the file to set * @param parent the parent path of the file to set
* @param name the name of the file to set * @param name the name of the file to set
* @param timestamp the new timestamp * @param timestamp the new timestamp
@ -442,12 +501,15 @@ public interface IFileService extends IService
public boolean setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor) throws SystemMessageException; public boolean setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Sets the readonly permission of the file or folder * Set the read-only permission of the specified file or folder.
*
* @param parent the parent path of the file to set * @param parent the parent path of the file to set
* @param name the name of the file to set * @param name the name of the file to set
* @param readOnly indicates whether to make the file readonly or read-write * @param readOnly indicates whether to make the file read-only or
* read-write
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true if the readonly permission was changed successfully, or the permission already was as desired * @return true if the read-only permission was changed successfully, or the
* permission already was as desired
*/ */
public boolean setReadOnly(String parent, String name, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException; public boolean setReadOnly(String parent, String name, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException;
@ -461,39 +523,51 @@ public interface IFileService extends IService
public String getEncoding(IProgressMonitor monitor) throws SystemMessageException; public String getEncoding(IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Gets the input stream to access the contents a remote file. Clients should close the input stream when done. * Get the input stream to access the contents a remote file. Clients should
* close the input stream when done.
*
* @param remoteParent the absolute path of the parent. * @param remoteParent the absolute path of the parent.
* @param remoteFile the name of the remote file. * @param remoteFile the name of the remote file.
* @param isBinary <code>true</code> if the file is a binary file, <code>false</code> otherwise. * @param isBinary <code>true</code> if the file is a binary file,
* <code>false</code> otherwise.
* @param monitor the progress monitor. * @param monitor the progress monitor.
* @return the input stream to access the contents of the remote file. * @return the input stream to access the contents of the remote file.
* @throws SystemMessageException if an error occurs. S * @throws SystemMessageException if an error occurs.
* @since 2.0 * @since org.eclipse.rse.services 2.0
*/ */
public InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException; public InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Gets the output stream to write to a remote file. Clients should close the output stream when done. * Get the output stream to write to a remote file. Clients should close the
* output stream when done.
*
* @param remoteParent the absolute path of the parent. * @param remoteParent the absolute path of the parent.
* @param remoteFile the name of the remote file. * @param remoteFile the name of the remote file.
* @param isBinary <code>true</code> if the file is a binary file, <code>false</code> otherwise. * @param isBinary <code>true</code> if the file is a binary file,
* <code>false</code> otherwise.
* @param monitor the progress monitor. * @param monitor the progress monitor.
* @return the input stream to access the contents of the remote file. * @return the input stream to access the contents of the remote file.
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs.
* @since 2.0 * @since org.eclipse.rse.services 2.0
* @deprecated Use {@link #getOutputStream(String, String, int, IProgressMonitor)} instead * @deprecated Use
* {@link #getOutputStream(String, String, int, IProgressMonitor)}
* instead
*/ */
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException; public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Gets the output stream to write/append to a remote file. Clients should close the output stream when done. * Get the output stream to write/append to a remote file. Clients should
* close the output stream when done.
*
* @param remoteParent the absolute path of the parent. * @param remoteParent the absolute path of the parent.
* @param remoteFile the name of the remote file. * @param remoteFile the name of the remote file.
* @param options bit wise or of option constants. Valid constants are {@link IFileService#APPEND}, {@link IFileService#TEXT_MODE}, and {@link IFileService#NONE} * @param options bit wise or of option constants. Valid constants are
* {@link IFileService#APPEND}, {@link IFileService#TEXT_MODE},
* and {@link IFileService#NONE}
* @param monitor the progress monitor. * @param monitor the progress monitor.
* @return the input stream to access the contents of the remote file. * @return the input stream to access the contents of the remote file.
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs.
* @since 3.0 * @since org.eclipse.rse.services 3.0
*/ */
public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException; public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException;
@ -504,6 +578,8 @@ public interface IFileService extends IService
* display or enable themselves based on result of this call. * display or enable themselves based on result of this call.
* *
* @return whether this service supports encoding conversion * @return whether this service supports encoding conversion
*
* @since org.eclipse.rse.services 3.0
*/ */
public boolean supportsEncodingConversion(); public boolean supportsEncodingConversion();
} }

View file

@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * Martin Oberhuber (Wind River) - [cleanup] Add API "since" tags
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.services.search; package org.eclipse.rse.services.search;
@ -30,6 +30,8 @@ public interface IHostSearchConstants {
/** /**
* Status indicating configuration has been canceled, 2. * Status indicating configuration has been canceled, 2.
*
* @since 3.0 this was renamed from CANCELLED in earlier versions
*/ */
public static final int CANCELED = 2; public static final int CANCELED = 2;