1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 04:55: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

@ -7,8 +7,8 @@
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
@ -35,23 +35,38 @@ import java.util.Iterator;
* to use statements of the form "ArchiveHandlerManager.getInstance().method". * to use statements of the form "ArchiveHandlerManager.getInstance().method".
* @author mjberger * @author mjberger
*/ */
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
protected static ArchiveHandlerManager _instance = new ArchiveHandlerManager(); protected static ArchiveHandlerManager _instance = new ArchiveHandlerManager();
// a mapping from Files to ISystemArchiveHandlers // a mapping from Files to ISystemArchiveHandlers
protected HashMap _handlers; protected HashMap _handlers;
// a mapping from Strings (file extensions) to Classes (the type of handler to use) // a mapping from Strings (file extensions) to Classes (the type of handler to use)
protected HashMap _handlerTypes; protected HashMap _handlerTypes;
/** /**
* @return The singleton instance of this class. * @return The singleton instance of this class.
*/ */
@ -59,7 +74,7 @@ public class ArchiveHandlerManager
{ {
return _instance; return _instance;
} }
public ArchiveHandlerManager() public ArchiveHandlerManager()
{ {
_handlers = new HashMap(); _handlers = new HashMap();
@ -72,18 +87,18 @@ public class ArchiveHandlerManager
* @param virtualpath The parent virtual object whose children this method is to return. To * @param virtualpath The parent virtual object whose children this method is to return. To
* get the top level virtualchildren in the archive, set virtualpath to "" or null. * get the top level virtualchildren in the archive, set virtualpath to "" or null.
* @return An array of VirtualChild objects representing the children of the virtual object * @return An array of VirtualChild objects representing the children of the virtual object
* in <code>file</code> referred to by <code>virtualpath</code>. If no class implementing * in <code>file</code> referred to by <code>virtualpath</code>. If no class implementing
* ISystemArchiveHandler can be found that corresponds to file, then this method returns null. * ISystemArchiveHandler can be found that corresponds to file, then this method returns null.
* If the virtual object has no children, this method also returns null. * If the virtual object has no children, this method also returns null.
* @throws IOException if there was a problem getting the registered handler for the * @throws IOException if there was a problem getting the registered handler for the
* file. This usually means the archive is corrupted. * file. This usually means the archive is corrupted.
*/ */
public VirtualChild[] getContents(File file, String virtualpath) throws IOException public VirtualChild[] getContents(File file, String virtualpath) throws IOException
{ {
if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$ if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$
ISystemArchiveHandler handler = getRegisteredHandler(file); ISystemArchiveHandler handler = getRegisteredHandler(file);
if (handler == null || !handler.exists()) throw new IOException(); if (handler == null || !handler.exists()) throw new IOException();
return handler.getVirtualChildren(virtualpath, null); return handler.getVirtualChildren(virtualpath, null);
} }
/** /**
@ -92,18 +107,18 @@ public class ArchiveHandlerManager
* @param virtualpath The parent virtual object whose children this method is to return. To * @param virtualpath The parent virtual object whose children this method is to return. To
* get the top level virtualchildren in the archive, set virtualpath to "" or null. * get the top level virtualchildren in the archive, set virtualpath to "" or null.
* @return An array of VirtualChild objects representing the children of the virtual object * @return An array of VirtualChild objects representing the children of the virtual object
* in <code>file</code> referred to by <code>virtualpath</code> that are themselves folders. * in <code>file</code> referred to by <code>virtualpath</code> that are themselves folders.
* If no class implementing ISystemArchiveHandler can be found that corresponds to file, then * If no class implementing ISystemArchiveHandler can be found that corresponds to file, then
* this method returns null. If the virtual object has no children, this method also returns null. * this method returns null. If the virtual object has no children, this method also returns null.
*/ */
public VirtualChild[] getFolderContents(File file, String virtualpath) public VirtualChild[] getFolderContents(File file, String virtualpath)
{ {
if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$ if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$
ISystemArchiveHandler handler = getRegisteredHandler(file); ISystemArchiveHandler handler = getRegisteredHandler(file);
if (handler == null) return null; if (handler == null) return null;
return handler.getVirtualChildFolders(virtualpath, null); return handler.getVirtualChildFolders(virtualpath, null);
} }
/** /**
* Tests whether a file is an known type of archive. * Tests whether a file is an known type of archive.
* @param file the file to test. * @param file the file to test.
@ -127,9 +142,9 @@ public class ArchiveHandlerManager
return false; return false;
} }
} }
} }
/** /**
* Tests whether a file is an known type of archive, based on the file name. * Tests whether a file is an known type of archive, based on the file name.
* @param filename the name of the file to test. * @param filename the name of the file to test.
@ -139,47 +154,47 @@ public class ArchiveHandlerManager
public boolean isRegisteredArchive(String filename) public boolean isRegisteredArchive(String filename)
{ {
return getRegisteredExtension(filename) == null?false:true; return getRegisteredExtension(filename) == null?false:true;
} }
/** /**
* 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)
{ {
String fileName = file.getName(); String fileName = file.getName();
return getRegisteredExtension(fileName); return getRegisteredExtension(fileName);
} }
/** /**
* 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)
{ {
fileName = fileName.toLowerCase(); fileName = fileName.toLowerCase();
Iterator itor = _handlerTypes.keySet().iterator(); Iterator itor = _handlerTypes.keySet().iterator();
while(itor.hasNext()) while(itor.hasNext())
{ {
String ext = ((String)itor.next()).toLowerCase(); String ext = ((String)itor.next()).toLowerCase();
if (fileName.endsWith(EXTENSION_SEPARATOR + ext)) if (fileName.endsWith(EXTENSION_SEPARATOR + ext))
{ {
return ext; return ext;
} }
} }
return null; return null;
} }
/** /**
* @param file the file whose extension we are computing. * @param file the file whose extension we are computing.
* @return the extension of <code>file</code>. "Extension" is * @return the extension of <code>file</code>. "Extension" is
* defined as any letters in the filename after the last ".". * defined as any letters in the filename after the last ".".
* Returns "" if there is no extension. * Returns "" if there is no extension.
* @deprecated Use {@link #getRegisteredExtension(File)} instead * @deprecated Use {@link #getRegisteredExtension(File)} instead
*/ */
@ -190,12 +205,12 @@ public class ArchiveHandlerManager
if (i == -1) return ""; //$NON-NLS-1$ if (i == -1) return ""; //$NON-NLS-1$
return filename.substring(i+1).toLowerCase(); return filename.substring(i+1).toLowerCase();
} }
/** /**
* @param filename the name of the file whose extension we are computing. * @param filename the name of the file whose extension we are computing.
* @return the extension of <code>filename</code>. "Extension" is * @return the extension of <code>filename</code>. "Extension" is
* defined as any letters in the filename after the last ".". * defined as any letters in the filename after the last ".".
* Returns "" if there is no extension. * Returns "" if there is no extension.
* * @deprecated Use {@link #getRegisteredExtension(String)} instead * * @deprecated Use {@link #getRegisteredExtension(String)} instead
*/ */
@ -205,7 +220,7 @@ public class ArchiveHandlerManager
if (i == -1) return ""; //$NON-NLS-1$ if (i == -1) return ""; //$NON-NLS-1$
return filename.substring(i+1).toLowerCase(); return filename.substring(i+1).toLowerCase();
} }
/** /**
* Given the absolute path to a virtual object, returns that object * Given the absolute path to a virtual object, returns that object
* as a VirtualChild. * as a VirtualChild.
@ -231,7 +246,7 @@ public class ArchiveHandlerManager
* Returns the registered handler for the File <code>file</code>. If * Returns the registered handler for the File <code>file</code>. If
* no handler exists for that file yet, create it. If the extension of * no handler exists for that file yet, create it. If the extension of
* <code>file</code> is not registered, then returns null. * <code>file</code> is not registered, then returns null.
*/ */
public ISystemArchiveHandler getRegisteredHandler(File file) public ISystemArchiveHandler getRegisteredHandler(File file)
{ {
ISystemArchiveHandler handler = null; ISystemArchiveHandler handler = null;
@ -239,10 +254,10 @@ public class ArchiveHandlerManager
{ {
handler = (ISystemArchiveHandler) _handlers.get(file); handler = (ISystemArchiveHandler) _handlers.get(file);
} }
if (handler != null && handler.exists()) if (handler != null && handler.exists())
{ {
return handler; return handler;
} }
else { else {
// find registered handler based on file's extension // find registered handler based on file's extension
@ -303,9 +318,9 @@ public class ArchiveHandlerManager
/** /**
* Registers an extension and a handler type. * Registers an extension and a handler type.
* @param ext The extension to register with the ArchiveHandlerManager * @param ext The extension to register with the ArchiveHandlerManager
* @param handlerType The class of handler to register with <code>ext</code>. * @param handlerType The class of handler to register with <code>ext</code>.
* Note that any class passed in must implement ISystemArchiveHandler. * Note that any class passed in must implement ISystemArchiveHandler.
* @return Whether or not the registration was successful. * @return Whether or not the registration was successful.
*/ */
public boolean setRegisteredHandler(String ext, Class handlerType) public boolean setRegisteredHandler(String ext, Class handlerType)
{ {
@ -317,7 +332,7 @@ public class ArchiveHandlerManager
} }
if (handlerImplementsISystemArchiveHandler(handlerType)) if (handlerImplementsISystemArchiveHandler(handlerType))
{ {
if (_handlerTypes.containsKey(ext)) _handlerTypes.remove(ext); if (_handlerTypes.containsKey(ext)) _handlerTypes.remove(ext);
_handlerTypes.put(ext, handlerType); _handlerTypes.put(ext, handlerType);
return true; return true;
} }
@ -350,7 +365,7 @@ public class ArchiveHandlerManager
} }
return ok; return ok;
} }
/** /**
* Returns whether or not handlerType or one of its superclasses implements ISystemArchiveHandler. * Returns whether or not handlerType or one of its superclasses implements ISystemArchiveHandler.
*/ */
@ -362,22 +377,22 @@ public class ArchiveHandlerManager
{ {
if (interfaces[i].getName().equals(ISystemArchiveHandler.class.getName())) okay = true; if (interfaces[i].getName().equals(ISystemArchiveHandler.class.getName())) okay = true;
} }
if (!okay) if (!okay)
{ {
Class superclass = handlerType.getSuperclass(); Class superclass = handlerType.getSuperclass();
if (superclass.getName().equals(Object.class.getName())) return false; if (superclass.getName().equals(Object.class.getName())) return false;
return handlerImplementsISystemArchiveHandler(superclass); return handlerImplementsISystemArchiveHandler(superclass);
} }
else return true; else return true;
} }
/** /**
* Removes the handler associated with <code>file</code>, freeing the file * Removes the handler associated with <code>file</code>, freeing the file
* to be used by other processes. * to be used by other processes.
*/ */
public void disposeOfRegisteredHandlerFor(File file) public void disposeOfRegisteredHandlerFor(File file)
{ {
_handlers.remove(file); _handlers.remove(file);
} }
/** /**
@ -390,7 +405,7 @@ public class ArchiveHandlerManager
{ {
return path.indexOf(VIRTUAL_CANONICAL_SEPARATOR) != -1; return path.indexOf(VIRTUAL_CANONICAL_SEPARATOR) != -1;
} }
/** /**
* Converts the virtual path given by <code>fullVirtualName</code> * Converts the virtual path given by <code>fullVirtualName</code>
* to the standard virtual form ('/' as separator, no leading or trailing '/'s) * to the standard virtual form ('/' as separator, no leading or trailing '/'s)
@ -400,7 +415,7 @@ public class ArchiveHandlerManager
public static String cleanUpVirtualPath(String fullVirtualName) public static String cleanUpVirtualPath(String fullVirtualName)
{ {
int j = fullVirtualName.indexOf(VIRTUAL_CANONICAL_SEPARATOR); int j = fullVirtualName.indexOf(VIRTUAL_CANONICAL_SEPARATOR);
if (j == -1) if (j == -1)
{ {
//fullVirtualName does not contains VIRTUAL_CANONICAL_SEPARATOR //fullVirtualName does not contains VIRTUAL_CANONICAL_SEPARATOR
//fullVirtualName could be the virtual path only, instead of the full path. //fullVirtualName could be the virtual path only, instead of the full path.
@ -410,7 +425,7 @@ public class ArchiveHandlerManager
//":". So for those two cases, we could just return the fullVirtualName //":". So for those two cases, we could just return the fullVirtualName
if (fullVirtualName.indexOf(":") != -1 || fullVirtualName.trim().startsWith("\\")) //$NON-NLS-1$ //$NON-NLS-2$ if (fullVirtualName.indexOf(":") != -1 || fullVirtualName.trim().startsWith("\\")) //$NON-NLS-1$ //$NON-NLS-2$
{ {
return fullVirtualName; return fullVirtualName;
} }
} }
String realPart = ""; //$NON-NLS-1$ String realPart = ""; //$NON-NLS-1$
@ -445,7 +460,7 @@ public class ArchiveHandlerManager
newPath = newPath.substring(0,i) + newPath.substring(i+1); newPath = newPath.substring(0,i) + newPath.substring(i+1);
i = newPath.indexOf("//"); //$NON-NLS-1$ i = newPath.indexOf("//"); //$NON-NLS-1$
} }
// get rid of any leading or trailing slashes // get rid of any leading or trailing slashes
if (j != -1 && newPath.startsWith("/")) newPath = newPath.substring(1); //$NON-NLS-1$ if (j != -1 && newPath.startsWith("/")) newPath = newPath.substring(1); //$NON-NLS-1$
if (newPath.endsWith("/")) newPath = newPath.substring(0, newPath.length() - 1); //$NON-NLS-1$ if (newPath.endsWith("/")) newPath = newPath.substring(0, newPath.length() - 1); //$NON-NLS-1$
@ -454,21 +469,21 @@ public class ArchiveHandlerManager
/** /**
* Disposes of all registered handlers. * Disposes of all registered handlers.
*/ */
public void dispose() public void dispose()
{ {
_handlers.clear(); _handlers.clear();
} }
public boolean createEmptyArchive(File newFile) public boolean createEmptyArchive(File newFile)
{ {
if (!isRegisteredArchive(newFile.getName())) if (!isRegisteredArchive(newFile.getName()))
{ {
System.out.println("Could not create new archive."); //$NON-NLS-1$ System.out.println("Could not create new archive."); //$NON-NLS-1$
System.out.println(newFile + " is not a registered type of archive."); //$NON-NLS-1$ System.out.println(newFile + " is not a registered type of archive."); //$NON-NLS-1$
return false; return false;
} }
if (newFile.exists()) if (newFile.exists())
{ {
if (!newFile.isFile()) if (!newFile.isFile())
@ -484,9 +499,9 @@ public class ArchiveHandlerManager
return false; return false;
} }
} }
try try
{ {
if (!newFile.createNewFile()) if (!newFile.createNewFile())
{ {
System.out.println("Could not create new archive."); //$NON-NLS-1$ System.out.println("Could not create new archive."); //$NON-NLS-1$
@ -500,11 +515,11 @@ public class ArchiveHandlerManager
System.out.println(e.getMessage()); System.out.println(e.getMessage());
return false; return false;
} }
ISystemArchiveHandler handler = getRegisteredHandler(newFile); ISystemArchiveHandler handler = getRegisteredHandler(newFile);
return handler.create(); return handler.create();
} }
/** /**
* Returns the extensions for archive types that have been registered * Returns the extensions for archive types that have been registered
* with the ArchiveHandlerManager. * with the ArchiveHandlerManager.
@ -519,14 +534,14 @@ public class ArchiveHandlerManager
} }
return extensions; return extensions;
} }
public String getComment(File archive) public String getComment(File archive)
{ {
ISystemArchiveHandler handler = getRegisteredHandler(archive); ISystemArchiveHandler handler = getRegisteredHandler(archive);
if (handler == null || !handler.exists()) return ""; //$NON-NLS-1$ if (handler == null || !handler.exists()) return ""; //$NON-NLS-1$
return handler.getArchiveComment(); return handler.getArchiveComment();
} }
public long getExpandedSize(File archive) public long getExpandedSize(File archive)
{ {
ISystemArchiveHandler handler = getRegisteredHandler(archive); ISystemArchiveHandler handler = getRegisteredHandler(archive);
@ -539,7 +554,7 @@ public class ArchiveHandlerManager
} }
return total; return total;
} }
/** /**
* Returns the classification for the entry in a archive with the given virtual path. * Returns the classification for the entry in a archive with the given virtual path.
* @param file the archive file. * @param file the archive file.
@ -547,20 +562,20 @@ public class ArchiveHandlerManager
* @return the classification for the virtual file. * @return the classification for the virtual file.
*/ */
public String getClassification(File file, String virtualPath) { public String getClassification(File file, String virtualPath) {
// if archive file is null, or if it does not exist, or if the virtual path // if archive file is null, or if it does not exist, or if the virtual path
// is null, then return null for the classification // is null, then return null for the classification
if (file == null || !file.exists()) { if (file == null || !file.exists()) {
return null; return null;
} }
// get archive handler // get archive handler
ISystemArchiveHandler handler = getRegisteredHandler(file); ISystemArchiveHandler handler = getRegisteredHandler(file);
if (handler == null || !handler.exists()) { if (handler == null || !handler.exists()) {
return null; return null;
} }
return handler.getClassification(virtualPath); return handler.getClassification(virtualPath);
} }
} }

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
@ -7,13 +7,13 @@
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* 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.
* <code>fullVirtualName</code> *
* @param fullVirtualName virtual path specifying the node to check
* @return the current timestamp (last modified) for the archive entry named
* <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,28 +392,34 @@ 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);
/** /**
* 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,124 +427,163 @@ 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);
/** /**
* 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

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

@ -7,28 +7,28 @@
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* 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
* tar file format. * tar file format.
*/ */
public class TarOutputStream extends OutputStream { public class TarOutputStream extends OutputStream {
private OutputStream out; private OutputStream out;
private boolean isClosed; private boolean isClosed;
private boolean entryOpen; private boolean entryOpen;
@ -48,26 +48,26 @@ public class TarOutputStream extends OutputStream {
* @see java.io.OutputStream#close() * @see java.io.OutputStream#close()
*/ */
public void close() throws IOException { public void close() throws IOException {
// if not already closed, then close the stream // if not already closed, then close the stream
// before closing though, write out a block of empty data // before closing though, write out a block of empty data
if (!isClosed) { if (!isClosed) {
byte[] dummy = new byte[ITarConstants.BLOCK_SIZE]; byte[] dummy = new byte[ITarConstants.BLOCK_SIZE];
out.write(dummy); out.write(dummy);
out.close(); out.close();
isClosed = true; isClosed = true;
} }
} }
/** /**
* Ensure that the stream is open. * Ensure that the stream is open.
* @throws IOException if the stream is closed. * @throws IOException if the stream is closed.
*/ */
private void ensureOpen() throws IOException { private void ensureOpen() throws IOException {
if (isClosed) { if (isClosed) {
throw new IOException("Stream closed"); //$NON-NLS-1$ throw new IOException("Stream closed"); //$NON-NLS-1$
} }
@ -81,54 +81,54 @@ public class TarOutputStream extends OutputStream {
out.write(b); out.write(b);
dataCount += 1; dataCount += 1;
} }
/** /**
* Begins writing a new tar entry, and positions the stream to the start of the entry data. * Begins writing a new tar entry, and positions the stream to the start of the entry data.
* Closes the current entry if still active. * Closes the current entry if still active.
* @throws IOException if an I/O occurs. * @throws IOException if an I/O occurs.
*/ */
public void putNextEntry(TarEntry entry) throws IOException { public void putNextEntry(TarEntry entry) throws IOException {
// previous entry open, so close it // previous entry open, so close it
if (entryOpen) { if (entryOpen) {
closeEntry(); closeEntry();
} }
// defer to the entry to write the entry fields // defer to the entry to write the entry fields
entry.writeFields(out); entry.writeFields(out);
// get the part of a block we need to fill // get the part of a block we need to fill
int diff = ITarConstants.BLOCK_SIZE - ITarConstants.HEADER_LENGTH; int diff = ITarConstants.BLOCK_SIZE - ITarConstants.HEADER_LENGTH;
// fill the block if we have used a part of it // fill the block if we have used a part of it
if (diff != 0) { if (diff != 0) {
byte[] dummy = new byte[diff]; byte[] dummy = new byte[diff];
out.write(dummy); out.write(dummy);
} }
// set data count to 0 // set data count to 0
dataCount = 0; dataCount = 0;
// indicate that entry is open // indicate that entry is open
entryOpen = true; entryOpen = true;
} }
/** /**
* Closes the current tar entry, and positions the stream for writing the next entry. * Closes the current tar entry, and positions the stream for writing the next entry.
* @throws IOException if an I/O error occurs. * @throws IOException if an I/O error occurs.
*/ */
public void closeEntry() throws IOException { public void closeEntry() throws IOException {
// get the part of a block // get the part of a block
int temp = (int)(dataCount % ITarConstants.BLOCK_SIZE); int temp = (int)(dataCount % ITarConstants.BLOCK_SIZE);
// fill the rest of the block with dummy data if we have filled part of a block // fill the rest of the block with dummy data if we have filled part of a block
if (temp != 0) { if (temp != 0) {
int diff = ITarConstants.BLOCK_SIZE - temp; int diff = ITarConstants.BLOCK_SIZE - temp;
byte[] dummy = new byte[diff]; byte[] dummy = new byte[diff];
out.write(dummy); out.write(dummy);
} }
// indicate that entry has been closed // indicate that entry has been closed
entryOpen = false; entryOpen = false;
} }

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
@ -7,12 +7,12 @@
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* 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;
@ -28,7 +28,7 @@ public interface ISystemProcessRemoteConstants
public static final int PROCESS_ATTRIBUTES_INDEX_TRACERPID = 5; public static final int PROCESS_ATTRIBUTES_INDEX_TRACERPID = 5;
public static final int PROCESS_ATTRIBUTES_INDEX_UID = 6; public static final int PROCESS_ATTRIBUTES_INDEX_UID = 6;
public static final int PROCESS_ATTRIBUTES_INDEX_USERNAME = 7; public static final int PROCESS_ATTRIBUTES_INDEX_USERNAME = 7;
public static final int PROCESS_ATTRIBUTES_INDEX_GID = 8; public static final int PROCESS_ATTRIBUTES_INDEX_GID = 8;
public static final int PROCESS_ATTRIBUTES_INDEX_VMSIZE = 9; public static final int PROCESS_ATTRIBUTES_INDEX_VMSIZE = 9;
public static final int PROCESS_ATTRIBUTES_INDEX_VMRSS = 10; public static final int PROCESS_ATTRIBUTES_INDEX_VMRSS = 10;
public static final int PROCESS_ATTRIBUTES_COUNT = 11; public static final int PROCESS_ATTRIBUTES_COUNT = 11;
@ -42,7 +42,7 @@ public interface ISystemProcessRemoteConstants
public static final char STATE_TRACED = 'T'; public static final char STATE_TRACED = 'T';
public static final char STATE_WAITING = 'D'; public static final char STATE_WAITING = 'D';
public static final char STATE_ZOMBIE = 'Z'; public static final char STATE_ZOMBIE = 'Z';
public static final char STATE_ZOS_SINGLE = '1'; public static final char STATE_ZOS_SINGLE = '1';
public static final char STATE_ZOS_MSGQRECEIVEWAIT = 'A'; public static final char STATE_ZOS_MSGQRECEIVEWAIT = 'A';
public static final char STATE_ZOS_MSGQSENDWAIT = 'B'; public static final char STATE_ZOS_MSGQSENDWAIT = 'B';
@ -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;
@ -109,8 +111,8 @@ public interface ISystemProcessRemoteConstants
public static final int STATE_ZOS_MVSWAIT_INDEX = 33; public static final int STATE_ZOS_MVSWAIT_INDEX = 33;
public static final int STATE_ZOS_ZOMBIE_INDEX = 34; public static final int STATE_ZOS_ZOMBIE_INDEX = 34;
public static final int STATE_ZOS_ENDING_INDEX = 35; public static final int STATE_ZOS_ENDING_INDEX = 35;
public static final char[] ALL_STATES = public static final char[] ALL_STATES =
{ {
STATE_ACTIVE, STATE_ACTIVE,
STATE_IDLE, STATE_IDLE,
@ -146,11 +148,11 @@ public interface ISystemProcessRemoteConstants
STATE_ZOS_WAITINGFORCHILD, STATE_ZOS_WAITINGFORCHILD,
STATE_ZOS_FORKING, STATE_ZOS_FORKING,
STATE_ZOS_MVSWAIT, STATE_ZOS_MVSWAIT,
STATE_ZOS_ZOMBIE STATE_ZOS_ZOMBIE
}; };
public static final String[] ALL_STATES_STR = public static final String[] ALL_STATES_STR =
{ {
"ASTATE_ACTIVE", //$NON-NLS-1$ "ASTATE_ACTIVE", //$NON-NLS-1$
"ISTATE_IDLE", //$NON-NLS-1$ "ISTATE_IDLE", //$NON-NLS-1$
"OSTATE_NONEXISTENT", //$NON-NLS-1$ "OSTATE_NONEXISTENT", //$NON-NLS-1$
@ -187,9 +189,9 @@ public interface ISystemProcessRemoteConstants
"YSTATE_ZOS_MVSWAIT", //$NON-NLS-1$ "YSTATE_ZOS_MVSWAIT", //$NON-NLS-1$
"ZSTATE_ZOS_ZOMBIE" //$NON-NLS-1$ "ZSTATE_ZOS_ZOMBIE" //$NON-NLS-1$
}; };
public static final String PROCESS_MINER_ERROR_NO_HANDLER = "No handler for this system type"; //$NON-NLS-1$ public static final String PROCESS_MINER_ERROR_NO_HANDLER = "No handler for this system type"; //$NON-NLS-1$
public static final String PROCESS_MINER_SUCCESS = "SUCCESS"; //$NON-NLS-1$ public static final String PROCESS_MINER_SUCCESS = "SUCCESS"; //$NON-NLS-1$
public static final String PROCESS_SIGNAL_TYPE_DEFAULT = "default"; //$NON-NLS-1$ public static final String PROCESS_SIGNAL_TYPE_DEFAULT = "default"; //$NON-NLS-1$
} }

View file

@ -7,8 +7,8 @@
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
@ -16,12 +16,13 @@
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary * Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
* Martin Oberhuber (Wind River) - [204710] Update Javadoc to mention that getUserHome() may return null * Martin Oberhuber (Wind River) - [204710] Update Javadoc to mention that getUserHome() may return null
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
* David McKnight (IBM) - [162195] new APIs for upload multi and download multi * David McKnight (IBM) - [162195] new APIs for upload multi and download multi
* David McKnight (IBM) - [209552] API changes to use multiple and getting rid of deprecated * David McKnight (IBM) - [209552] API changes to use multiple and getting rid of deprecated
* 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;
@ -39,7 +40,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
* A IFileService is an abstraction of a file service that runs over some sort of connection. * A IFileService is an abstraction of a file service that runs over some sort of connection.
* It can be shared among multiple instances of a subsystem. At some point this file * It can be shared among multiple instances of a subsystem. At some point this file
* service layer may become official API but for now it is experimental. Each * service layer may become official API but for now it is experimental. Each
* subsystem is currently responsible for layering an abstraction over whatever it * subsystem is currently responsible for layering an abstraction over whatever it
* wants to construct as a service. * wants to construct as a service.
* <p> * <p>
* This is a very bare bones definition. A real definition would probably have changed * This is a very bare bones definition. A real definition would probably have changed
@ -54,77 +55,90 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
* </p> * </p>
*/ */
public interface IFileService extends IService 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
* IFileService make use of this to determine what to query and what to
* return from the query.
* *
* 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
* 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
* IFileService make use of this to determine what to query and what to
* return from the query.
* *
* 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
* 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
* IFileService make use of this to determine what to query and what to
* return from the query.
* *
* 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
* 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;
/** /**
* Copy a file to the remote file system. The remote target is denoted by a * Copy a file to the remote file system. The remote target is denoted by a
* string representing the parent and a string representing the file. * string representing the parent and a string representing the file.
@ -135,11 +149,11 @@ public interface IFileService extends IService
* @param hostEncoding - the tgt encoding of the file (if text) * @param hostEncoding - the tgt encoding of the file (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 file was uploaded * @return true if the file was uploaded
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family. * Typically this would be one of those in the RemoteFileException family.
*/ */
public boolean upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException; public boolean upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Copy a file to the remote file system. The remote target is denoted by a * Copy a file to the remote file system. The remote target is denoted by a
* string representing the parent and a string representing the file. * string representing the parent and a string representing the file.
@ -151,7 +165,7 @@ public interface IFileService extends IService
* @param hostEncoding - the tgt encoding of the file (if text) * @param hostEncoding - the tgt encoding of the file (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 file was uploaded * @return true if the file was uploaded
* @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.
*/ */
@ -169,288 +183,336 @@ public interface IFileService extends IService
* @param hostEncodings - the tgt encodings of the files (if text) * @param hostEncodings - the tgt encodings of the files (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 uploaded * @return true if the files were uploaded
* @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;
/** /**
* Copy a file from the remote file system to the local system. * Copy a file from the remote file system to the local system.
* @param remoteParent - a String designating the remote parent. * @param remoteParent - a String designating the remote parent.
* @param remoteFile - a String designating the remote file residing in the parents. * @param remoteFile - a String designating the remote file residing in the parents.
* @param localFile - The file that is to be written. If the file exists it is * @param localFile - The file that is to be written. If the file exists it is
* overwritten. * overwritten.
* @param isBinary - indicates whether the file is text on binary * @param isBinary - indicates whether the file is text on binary
* @param hostEncoding - the encoding on the host (if text) * @param hostEncoding - the encoding 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 file was copied from the remote system. * @return true if the file was copied from the remote system.
* @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.
*/ */
public boolean download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException; public boolean download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* 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;
/** /**
* @param remoteParent - the name of the parent directory on the remote file * List the contents of a remote folder.
* system from which to retrieve the child list.
* @param fileFilter - a string that can be used to filter the children. Only
* those files matching the filter make it into the list. The interface
* does not dictate where the filtering occurs.
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the monitor for this potentially long running operation
* @return the list of host files.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
* *
* @param remoteParent - the name of the parent directory on the remote file
* system from which to retrieve the child list.
* @param fileFilter - a string that can be used to filter the children.
* Only those files matching the filter make it into the list.
* The interface does not dictate where the filtering occurs.
* @param fileType - indicates whether to query files, folders, both or some
* other type
* @param monitor the monitor for this potentially long running operation
* @return the list of host files.
* @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[] 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
* system from which to retrieve the collective child list.
* @param fileFilters - a set of strings that can be used to filter the children. Only
* those files matching the filter corresponding to it's remoteParent make it into the list. The interface
* does not dictate where the filtering occurs. For each remoteParent, 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
* @return the collective list of host files that reside in each of the remoteParents with it's corresponding filter.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
*/
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
* system from which to retrieve the collective child list.
* @param fileFilters - a set of strings that can be used to filter the children. Only
* those files matching the filter corresponding to it's remoteParent make it into the list. The interface
* does not dictate where the filtering occurs. For each remoteParent, there must be a corresponding
* fileFilter.
* @param fileType - 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
* @return the collective list of host files that reside in each of the remoteParents with it's corresponding filter.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
*/
public IHostFile[] listMultiple(String[] remoteParents, String[] fileFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* List the contents of multiple remote folders.
*
* @param remoteParents - the names of the parent directories on the remote
* file system from which to retrieve the collective child list.
* @param fileFilters - a set of strings that can be used to filter the
* children. Only those files matching the filter corresponding
* to it's remoteParent make it into the list. The interface does
* not dictate where the filtering occurs. For each remoteParent,
* 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 list of roots for this system * @return the collective list of host files that reside in each of the
* @return the list of host files. * remoteParents with it's corresponding filter.
* @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[] listMultiple(String[] remoteParents, String[] fileFilters, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException;
/**
* List the contents of multiple remote folders.
*
* @param remoteParents - the names of the parent directories on the remote
* file system from which to retrieve the collective child list.
* @param fileFilters - a set of strings that can be used to filter the
* children. Only those files matching the filter corresponding
* to it's remoteParent make it into the list. The interface does
* not dictate where the filtering occurs. For each remoteParent,
* 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
* @return the collective list of host files that reside in each of the
* remoteParents with it's corresponding filter.
* @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;
/**
* Get abstract remote file handles for the known remote file system roots.
*
* @param monitor the monitor for this potentially long running operation
* Return the list of roots for this system
* @return the list of host files.
* @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
*/ */
public IHostFile[] getRoots(IProgressMonitor monitor) throws SystemMessageException; public IHostFile[] getRoots(IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Return the user's home directory on this connection. * Return the user's home directory on this connection.
* *
* The resulting IHostFile object is just a handle, so there is no guarantee * The resulting IHostFile object is just a handle, so there is no guarantee
* that it refers to an existing file. * that it refers to an existing file.
* *
* This method may also return <code>null</code> if the home directory could * This method may also return <code>null</code> if the home directory could
* not be determined (for instance, because the connection is not yet connected). * not be determined (for instance, because the connection is not yet connected).
* In this case, clients are encouraged to query the home directory again once * In this case, clients are encouraged to query the home directory again once
* the connection is connected. * the connection is connected.
* *
* @return A handle to the current user's home directory, or <code>null</code> * @return A handle to the current user's home directory, or <code>null</code>
* if the home directory could not be determined. * if the home directory could not be determined.
*/ */
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
* @param monitor the progress monitor * @param monitor the progress monitor
* @return true if the file timestamp was changed successfully * @return true if the file timestamp was changed successfully
*/ */
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;
/** /**
* Gets the remote encoding. * Gets the remote encoding.
* @param monitor the progress monitor. * @param monitor the progress monitor.
@ -459,51 +521,65 @@ public interface IFileService extends IService
* @since 2.0 * @since 2.0
*/ */
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;
/** /**
* Indicates whether this file service supports code page conversion using * Indicates whether this file service supports code page conversion using
* the IFileServiceCodePageConverter mechanism. Certain extensions, such as * the IFileServiceCodePageConverter mechanism. Certain extensions, such as
* property pages for encoding conversion can determine whether or not to * property pages for encoding conversion can determine whether or not to
* 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;