mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-18 21:55:45 +02:00
[199854][api] Improve error reporting for archive handlers
This commit is contained in:
parent
4d5ee26ab3
commit
e869ef164d
18 changed files with 1663 additions and 1616 deletions
|
@ -16,6 +16,7 @@
|
|||
* David McKnight (IBM) [224906] [dstore] changes for getting properties and doing exit due to single-process capability
|
||||
* Noriaki Takatsu (IBM) [229146] [multithread] changes to stop Miner threads when clients disconnect
|
||||
* David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dstore.core.miners;
|
||||
|
@ -681,7 +682,7 @@ implements ISchemaExtender
|
|||
*
|
||||
* @param theCommand an instance of a command containing a tree of arguments
|
||||
*/
|
||||
public abstract DataElement handleCommand(DataElement theCommand);
|
||||
public abstract DataElement handleCommand(DataElement theCommand) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -14,6 +14,7 @@
|
|||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.dstore.universal.miners;
|
||||
|
@ -79,11 +80,11 @@ public class UniversalByteStreamHandler extends ByteStreamHandler
|
|||
String virtualFileName = fileName;
|
||||
|
||||
ArchiveHandlerManager mgr = ArchiveHandlerManager.getInstance();
|
||||
VirtualChild child = mgr.getVirtualObject(virtualFileName);
|
||||
ISystemArchiveHandler handler = child.getHandler();
|
||||
|
||||
try
|
||||
{
|
||||
VirtualChild child = mgr.getVirtualObject(virtualFileName);
|
||||
ISystemArchiveHandler handler = child.getHandler();
|
||||
File file = child.getExtractedFile();
|
||||
fileName = file.getAbsolutePath();
|
||||
|
||||
|
@ -128,21 +129,13 @@ public class UniversalByteStreamHandler extends ByteStreamHandler
|
|||
String filePath = virtualFileName.substring(0, virtualIndex);
|
||||
handler = mgr.getRegisteredHandler(new File(filePath));
|
||||
}
|
||||
boolean success = handler != null && handler.add(newFile, child.path, child.name, null);
|
||||
if (!success)
|
||||
{
|
||||
if (status == null) return;
|
||||
status.setAttribute(DE.A_VALUE, IClientServerConstants.FILEMSG_REMOTE_SAVE_FAILED);
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
_dataStore.refresh(status.getParent());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status == null) return;
|
||||
if (handler != null)
|
||||
handler.add(newFile, child.path, child.name, null);
|
||||
if (status == null)
|
||||
return;
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS);
|
||||
_dataStore.refresh(status.getParent());
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
_dataStore.trace(e);
|
||||
|
@ -188,20 +181,15 @@ public class UniversalByteStreamHandler extends ByteStreamHandler
|
|||
if (fileName != null)
|
||||
{
|
||||
String virtualFileName = fileName;
|
||||
|
||||
try
|
||||
{
|
||||
ArchiveHandlerManager mgr = ArchiveHandlerManager.getInstance();
|
||||
VirtualChild child = mgr.getVirtualObject(virtualFileName);
|
||||
if (!child.exists())
|
||||
{
|
||||
if (!child.exists()) {
|
||||
// System.out.println(virtualFileName + " does not exist.");
|
||||
return;
|
||||
}
|
||||
ISystemArchiveHandler handler = child.getHandler();
|
||||
|
||||
try
|
||||
{
|
||||
boolean success;
|
||||
|
||||
File file = child.getExtractedFile();
|
||||
fileName = file.getAbsolutePath();
|
||||
|
||||
|
@ -242,7 +230,9 @@ public class UniversalByteStreamHandler extends ByteStreamHandler
|
|||
String filePath = virtualFileName.substring(0, virtualIndex);
|
||||
handler = mgr.getRegisteredHandler(new File(filePath));
|
||||
}
|
||||
success = handler != null && handler.add(newFile, child.path, child.name, null);
|
||||
if (handler != null) {
|
||||
handler.add(newFile, child.path, child.name, null);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -318,25 +308,17 @@ public class UniversalByteStreamHandler extends ByteStreamHandler
|
|||
String filePath = virtualFileName.substring(0, virtualIndex);
|
||||
handler = mgr.getRegisteredHandler(new File(filePath));
|
||||
}
|
||||
success = handler != null && handler.add(newFile, child.path, child.name, null);
|
||||
|
||||
if (handler != null) {
|
||||
handler.add(newFile, child.path, child.name, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
if (status == null) return;
|
||||
status.setAttribute(DE.A_VALUE, IClientServerConstants.FILEMSG_REMOTE_SAVE_FAILED);
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
_dataStore.refresh(status.getParent());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status == null) return;
|
||||
if (status == null)
|
||||
return;
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS);
|
||||
_dataStore.refresh(status.getParent());
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
_dataStore.trace(e);
|
||||
if (status == null) return;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* David McKnight (IBM) [224906] [dstore] changes for getting properties and doing exit due to single-process capability
|
||||
* David McKnight (IBM) [225507] [api][breaking] RSE dstore API leaks non-API types
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.dstore.universal.miners;
|
||||
|
@ -76,6 +77,7 @@ import org.eclipse.rse.services.clientserver.archiveutils.SystemTgzHandler;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.SystemZipHandler;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
|
||||
import org.eclipse.rse.services.clientserver.java.ClassFileUtil;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
public class UniversalFileSystemMiner extends Miner {
|
||||
|
||||
|
@ -110,7 +112,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
/**
|
||||
* @see Miner#handleCommand(DataElement)
|
||||
*/
|
||||
public DataElement handleCommand(DataElement theElement) {
|
||||
public DataElement handleCommand(DataElement theElement) throws SystemMessageException {
|
||||
String name = getCommandName(theElement);
|
||||
|
||||
|
||||
|
@ -325,6 +327,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
*/
|
||||
public DataElement handleQueryAll(DataElement subject, DataElement attributes, DataElement status,
|
||||
String queryType, boolean caseSensitive)
|
||||
throws SystemMessageException
|
||||
{
|
||||
boolean isArchive = false;
|
||||
String fullName = subject.getValue();
|
||||
|
@ -448,7 +451,8 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
* Method to list the files for a given filter.
|
||||
*/
|
||||
public DataElement handleQueryFiles(DataElement subject, DataElement attributes,
|
||||
DataElement status, String queryType, boolean caseSensitive) {
|
||||
DataElement status, String queryType, boolean caseSensitive)
|
||||
throws SystemMessageException {
|
||||
|
||||
File fileobj = null;
|
||||
|
||||
|
@ -500,7 +504,8 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
* Method to list the folders for a given filter.
|
||||
*/
|
||||
public DataElement handleQueryFolders(DataElement subject, DataElement attributes,
|
||||
DataElement status, String queryType, boolean caseSensitive) {
|
||||
DataElement status, String queryType, boolean caseSensitive)
|
||||
throws SystemMessageException {
|
||||
if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)
|
||||
|| queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)
|
||||
|| queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) {
|
||||
|
@ -556,7 +561,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
/**
|
||||
* Method to list the roots.
|
||||
*/
|
||||
public DataElement handleQueryRoots(DataElement subject, DataElement status) {
|
||||
public DataElement handleQueryRoots(DataElement subject, DataElement status) throws SystemMessageException {
|
||||
// File fileobj = new File(subject.getName());
|
||||
new File(subject.getName());
|
||||
DataElement deObj = null;
|
||||
|
@ -779,7 +784,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
* Method to Retrieve properties of the file or folder.
|
||||
*/
|
||||
protected DataElement handleQueryBasicProperty(DataElement subject,
|
||||
DataElement status) {
|
||||
DataElement status) throws SystemMessageException {
|
||||
File fileobj = new File(subject.getAttribute(DE.A_VALUE)
|
||||
+ File.separatorChar + subject.getName());
|
||||
subject.setAttribute(DE.A_SOURCE, setProperties(fileobj));
|
||||
|
@ -820,7 +825,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
* Method to query existence of the file or folder.
|
||||
*/
|
||||
protected DataElement handleQueryExists(DataElement subject,
|
||||
DataElement status, String queryType) {
|
||||
DataElement status, String queryType) throws SystemMessageException {
|
||||
|
||||
File fileobj = null;
|
||||
if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)) {
|
||||
|
@ -873,7 +878,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
* Method to get remote object
|
||||
*/
|
||||
public DataElement handleQueryGetRemoteObject(DataElement subject,
|
||||
DataElement status, String queryType) {
|
||||
DataElement status, String queryType) throws SystemMessageException {
|
||||
File fileobj = null;
|
||||
boolean isVirtual = false;
|
||||
boolean isFilter = false;
|
||||
|
@ -1621,7 +1626,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
|
||||
|
||||
|
||||
public ISystemArchiveHandler getArchiveHandlerFor(String archivePath) {
|
||||
public ISystemArchiveHandler getArchiveHandlerFor(String archivePath) throws SystemMessageException {
|
||||
File file = new File(archivePath);
|
||||
return _archiveHandlerManager.getRegisteredHandler(file);
|
||||
}
|
||||
|
@ -1640,7 +1645,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
/**
|
||||
* Method to obtain the properties of file or folder.
|
||||
*/
|
||||
public String setProperties(File fileObj, boolean doArchiveProperties) {
|
||||
public String setProperties(File fileObj, boolean doArchiveProperties) throws SystemMessageException {
|
||||
String version = IServiceConstants.VERSION_1;
|
||||
StringBuffer buffer = new StringBuffer(500);
|
||||
long date = fileObj.lastModified();
|
||||
|
@ -1730,7 +1735,7 @@ public class UniversalFileSystemMiner extends Miner {
|
|||
return buffer.toString();
|
||||
}
|
||||
|
||||
public String setProperties(File fileObj) {
|
||||
public String setProperties(File fileObj) throws SystemMessageException {
|
||||
return setProperties(fileObj, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* Contributors:
|
||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
||||
|
@ -28,6 +29,7 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
public class CopyBatchThread extends CopyThread {
|
||||
|
||||
|
@ -40,11 +42,16 @@ public class CopyBatchThread extends CopyThread {
|
|||
public void run()
|
||||
{
|
||||
super.run();
|
||||
try {
|
||||
handleCopyBatch();
|
||||
} catch (SystemMessageException e) {
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
miner.statusDone(status);
|
||||
}
|
||||
_isDone = true;
|
||||
}
|
||||
|
||||
private DataElement handleCopyBatch()
|
||||
private DataElement handleCopyBatch() throws SystemMessageException
|
||||
{
|
||||
String targetType = targetFolder.getType();
|
||||
File tgtFolder = getFileFor(targetFolder);
|
||||
|
@ -58,12 +65,6 @@ public class CopyBatchThread extends CopyThread {
|
|||
ISystemArchiveHandler handler = miner.getArchiveHandlerFor(vpath.getContainingArchiveString());
|
||||
boolean result = true;
|
||||
|
||||
if (handler == null)
|
||||
{
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
return miner.statusDone(status);
|
||||
}
|
||||
|
||||
List nonDirectoryArrayList = new ArrayList();
|
||||
List nonDirectoryNamesArrayList = new ArrayList();
|
||||
|
||||
|
@ -116,8 +117,9 @@ public class CopyBatchThread extends CopyThread {
|
|||
//call ISystemArchiveHandler#add(File[] ...) to add them in batch.
|
||||
if (srcFile.isDirectory())
|
||||
{
|
||||
result = handler.add(srcFile, virtualContainer, srcName, systemOperationMonitor);
|
||||
if (!result) {
|
||||
try {
|
||||
handler.add(srcFile, virtualContainer, srcName, systemOperationMonitor);
|
||||
} catch (SystemMessageException e) {
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
if (isCancelled())
|
||||
{
|
||||
|
@ -127,6 +129,7 @@ public class CopyBatchThread extends CopyThread {
|
|||
{
|
||||
return miner.statusDone(status);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -141,7 +144,11 @@ public class CopyBatchThread extends CopyThread {
|
|||
File[] resultFiles = (File[])nonDirectoryArrayList.toArray(new File[nonDirectoryArrayList.size()]);
|
||||
String[] resultNames = (String[])nonDirectoryNamesArrayList.toArray(new String[nonDirectoryNamesArrayList.size()]);
|
||||
//we need to add those files into the archive file as well.
|
||||
result = handler.add(resultFiles, virtualContainer, resultNames, systemOperationMonitor);
|
||||
try {
|
||||
handler.add(resultFiles, virtualContainer, resultNames, systemOperationMonitor);
|
||||
} catch (SystemMessageException e) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result)
|
||||
|
@ -180,28 +187,24 @@ public class CopyBatchThread extends CopyThread {
|
|||
if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR))
|
||||
{
|
||||
// extract from an archive to folder
|
||||
try {
|
||||
AbsoluteVirtualPath svpath = miner.getAbsoluteVirtualPath(sourceFile);
|
||||
ISystemArchiveHandler shandler = miner.getArchiveHandlerFor(svpath.getContainingArchiveString());
|
||||
|
||||
if (shandler == null)
|
||||
{
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
return miner.statusDone(status);
|
||||
}
|
||||
|
||||
VirtualChild child = shandler.getVirtualFile(svpath.getVirtualPart(), systemOperationMonitor);
|
||||
|
||||
File parentDir = getFileFor(targetFolder);
|
||||
File destination = new File(parentDir, sourceFile.getName());
|
||||
|
||||
if (child.isDirectory)
|
||||
{
|
||||
if (child.isDirectory) {
|
||||
shandler.extractVirtualDirectory(svpath.getVirtualPart(), parentDir, destination, systemOperationMonitor);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
shandler.extractVirtualFile(svpath.getVirtualPart(), destination, systemOperationMonitor);
|
||||
}
|
||||
|
||||
} catch (SystemMessageException e) {
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
return miner.statusDone(status);
|
||||
}
|
||||
}
|
||||
else // source is regular file or folder
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* Contributors:
|
||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
||||
|
@ -27,6 +28,7 @@ import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
public class CopySingleThread extends CopyThread {
|
||||
|
||||
|
@ -42,11 +44,16 @@ public class CopySingleThread extends CopyThread {
|
|||
public void run()
|
||||
{
|
||||
super.run();
|
||||
try {
|
||||
handleCopy();
|
||||
} catch (SystemMessageException e) {
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
miner.statusDone(status);
|
||||
}
|
||||
_isDone = true;
|
||||
}
|
||||
|
||||
private DataElement handleCopy()
|
||||
private DataElement handleCopy() throws SystemMessageException
|
||||
{
|
||||
DataElement sourceFile = theElement;
|
||||
String newName = nameObj.getName();
|
||||
|
@ -120,14 +127,7 @@ public class CopySingleThread extends CopyThread {
|
|||
virtualContainer = vpath.getVirtualPart();
|
||||
}
|
||||
|
||||
boolean result = handler.add(srcFile, virtualContainer, newName, systemOperationMonitor);
|
||||
|
||||
if (result) {
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS);
|
||||
}
|
||||
else {
|
||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
}
|
||||
handler.add(srcFile, virtualContainer, newName, systemOperationMonitor);
|
||||
}
|
||||
else if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) {
|
||||
ISystemArchiveHandler shandler = null;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* Contributors:
|
||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
||||
|
@ -20,6 +21,7 @@ import java.io.File;
|
|||
import org.eclipse.dstore.core.model.DE;
|
||||
import org.eclipse.dstore.core.model.DataElement;
|
||||
import org.eclipse.dstore.core.model.DataStore;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
|
||||
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
||||
import org.eclipse.rse.dstore.universal.miners.UniversalFileSystemMiner;
|
||||
|
@ -29,7 +31,7 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
public class CreateFileThread extends SecuredThread implements ICancellableHandler {
|
||||
|
||||
|
@ -76,12 +78,16 @@ public class CreateFileThread extends SecuredThread implements ICancellableHandl
|
|||
public void run()
|
||||
{
|
||||
super.run();
|
||||
|
||||
try {
|
||||
handleCreateFile();
|
||||
} catch (SystemMessageException e) {
|
||||
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
_miner.statusDone(_status);
|
||||
}
|
||||
_isDone = true;
|
||||
}
|
||||
|
||||
private DataElement handleCreateFile()
|
||||
private DataElement handleCreateFile() throws SystemMessageException
|
||||
{
|
||||
boolean wasFilter = _queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR);
|
||||
if (_queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)) {
|
||||
|
@ -115,11 +121,9 @@ public class CreateFileThread extends SecuredThread implements ICancellableHandl
|
|||
try {
|
||||
boolean done = filename.createNewFile();
|
||||
if (ArchiveHandlerManager.getInstance().isArchive(filename)) {
|
||||
done = ArchiveHandlerManager.getInstance()
|
||||
ArchiveHandlerManager.getInstance()
|
||||
.createEmptyArchive(filename);
|
||||
if (done)
|
||||
_subject.setAttribute(DE.A_TYPE,
|
||||
IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR);
|
||||
_subject.setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR);
|
||||
} else {
|
||||
if (done)
|
||||
{
|
||||
|
@ -154,7 +158,7 @@ public class CreateFileThread extends SecuredThread implements ICancellableHandl
|
|||
}
|
||||
|
||||
public DataElement handleCreateVirtualFile(DataElement subject,
|
||||
DataElement status, String type) {
|
||||
DataElement status, String type) throws SystemMessageException {
|
||||
|
||||
AbsoluteVirtualPath vpath = null;
|
||||
if (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* Contributors:
|
||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
||||
|
@ -20,6 +21,7 @@ import java.io.File;
|
|||
import org.eclipse.dstore.core.model.DE;
|
||||
import org.eclipse.dstore.core.model.DataElement;
|
||||
import org.eclipse.dstore.core.model.DataStore;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
|
||||
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
||||
import org.eclipse.rse.dstore.universal.miners.UniversalFileSystemMiner;
|
||||
|
@ -29,7 +31,7 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
public class CreateFolderThread extends SecuredThread implements ICancellableHandler {
|
||||
|
||||
|
@ -76,11 +78,16 @@ public class CreateFolderThread extends SecuredThread implements ICancellableHan
|
|||
public void run()
|
||||
{
|
||||
super.run();
|
||||
try {
|
||||
handleCreateFile();
|
||||
} catch (SystemMessageException e) {
|
||||
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
_miner.statusDone(_status);
|
||||
}
|
||||
_isDone = true;
|
||||
}
|
||||
|
||||
private DataElement handleCreateFile()
|
||||
private DataElement handleCreateFile() throws SystemMessageException
|
||||
{
|
||||
if (_queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) {
|
||||
return handleCreateVirtualFolder(_subject, _status, _queryType);
|
||||
|
@ -144,7 +151,7 @@ public class CreateFolderThread extends SecuredThread implements ICancellableHan
|
|||
}
|
||||
|
||||
public DataElement handleCreateVirtualFolder(DataElement subject,
|
||||
DataElement status, String type) {
|
||||
DataElement status, String type) throws SystemMessageException {
|
||||
|
||||
AbsoluteVirtualPath vpath = null;
|
||||
if (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* Contributors:
|
||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
||||
|
@ -20,6 +21,7 @@ import java.io.File;
|
|||
import org.eclipse.dstore.core.model.DE;
|
||||
import org.eclipse.dstore.core.model.DataElement;
|
||||
import org.eclipse.dstore.core.model.DataStore;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
|
||||
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
||||
import org.eclipse.rse.dstore.universal.miners.UniversalFileSystemMiner;
|
||||
|
@ -29,7 +31,7 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
public class DeleteThread extends SecuredThread implements ICancellableHandler {
|
||||
|
||||
|
@ -76,18 +78,20 @@ public class DeleteThread extends SecuredThread implements ICancellableHandler {
|
|||
public void run()
|
||||
{
|
||||
super.run();
|
||||
if (_batch)
|
||||
{
|
||||
try {
|
||||
if (_batch) {
|
||||
handleDeleteBatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
handleDelete(_theElement, _status);
|
||||
}
|
||||
} catch (SystemMessageException e) {
|
||||
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
_miner.statusDone(_status);
|
||||
}
|
||||
_isDone = true;
|
||||
}
|
||||
|
||||
private DataElement handleDeleteBatch()
|
||||
private DataElement handleDeleteBatch() throws SystemMessageException
|
||||
{
|
||||
DataElement substatus = _dataStore.createObject(null, "status", "substatus"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
int numOfSources = _theElement.getNestedSize() - 2;
|
||||
|
@ -110,7 +114,7 @@ public class DeleteThread extends SecuredThread implements ICancellableHandler {
|
|||
_status.setAttribute(DE.A_SOURCE, substatus.getSource());
|
||||
return _miner.statusDone(_status);
|
||||
}
|
||||
private DataElement handleDelete(DataElement subject, DataElement thisStatus)
|
||||
private DataElement handleDelete(DataElement subject, DataElement thisStatus) throws SystemMessageException
|
||||
{
|
||||
|
||||
String type = subject.getType();
|
||||
|
@ -176,7 +180,7 @@ public class DeleteThread extends SecuredThread implements ICancellableHandler {
|
|||
}
|
||||
|
||||
public DataElement handleDeleteFromArchive(DataElement subject,
|
||||
DataElement status) {
|
||||
DataElement status) throws SystemMessageException {
|
||||
String type = subject.getType();
|
||||
DataElement deObj = null;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* Martin Oberhuber (Wind River) - [186640] Fix case sensitive issue comparing z/OS
|
||||
* Xuan Chen (IBM) - [191280] [dstore] Expand fails for folder "/folk" with 3361 children
|
||||
* Xuan Chen (IBM) - [215863]] NPE when Expanding Empty Zip File
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
@ -1042,7 +1043,7 @@ public class FileClassifier extends Thread
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
// TODO: log error
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
||||
|
@ -24,6 +25,7 @@ import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
|
|||
import org.eclipse.rse.services.clientserver.IServiceConstants;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
public class QueryThread extends SecuredThread implements ICancellableHandler {
|
||||
|
||||
|
@ -82,14 +84,18 @@ public class QueryThread extends SecuredThread implements ICancellableHandler {
|
|||
// These extra properties here might cause problems for older clients,
|
||||
// ie: a IndexOutOfBounds in UniversalFileImpl.
|
||||
|
||||
// DKM: defer this until later as it is bad for performacnes..
|
||||
// DKM: defer this until later as it is bad for performance...
|
||||
// I think we're doing the full query on an archive by instantiating a
|
||||
// handler
|
||||
boolean isArchive = false;//ArchiveHandlerManager.getInstance().isArchive(fileObj);
|
||||
|
||||
String comment;
|
||||
if (isArchive)
|
||||
try {
|
||||
comment = ArchiveHandlerManager.getInstance().getComment(fileObj);
|
||||
} catch (SystemMessageException e) {
|
||||
comment = " "; //$NON-NLS-1$
|
||||
}
|
||||
else
|
||||
comment = " "; //$NON-NLS-1$
|
||||
|
||||
|
@ -99,8 +105,11 @@ public class QueryThread extends SecuredThread implements ICancellableHandler {
|
|||
|
||||
long expandedSize;
|
||||
if (isArchive)
|
||||
expandedSize = ArchiveHandlerManager.getInstance().getExpandedSize(
|
||||
fileObj);
|
||||
try {
|
||||
expandedSize = ArchiveHandlerManager.getInstance().getExpandedSize(fileObj);
|
||||
} catch (SystemMessageException e) {
|
||||
expandedSize = 0;
|
||||
}
|
||||
else
|
||||
expandedSize = size;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* Contributors:
|
||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
||||
|
@ -20,6 +21,7 @@ import java.io.File;
|
|||
import org.eclipse.dstore.core.model.DE;
|
||||
import org.eclipse.dstore.core.model.DataElement;
|
||||
import org.eclipse.dstore.core.model.DataStore;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
|
||||
import org.eclipse.rse.dstore.universal.miners.UniversalFileSystemMiner;
|
||||
import org.eclipse.rse.dstore.universal.miners.UniversalServerUtilities;
|
||||
|
@ -28,7 +30,7 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
public class RenameThread extends SecuredThread implements ICancellableHandler {
|
||||
|
||||
|
@ -72,11 +74,16 @@ public class RenameThread extends SecuredThread implements ICancellableHandler {
|
|||
public void run()
|
||||
{
|
||||
super.run();
|
||||
try {
|
||||
handleRename();
|
||||
} catch (SystemMessageException e) {
|
||||
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||
_miner.statusDone(_status);
|
||||
}
|
||||
_isDone = true;
|
||||
}
|
||||
|
||||
private DataElement handleRename()
|
||||
private DataElement handleRename() throws SystemMessageException
|
||||
{
|
||||
File fileoldname = new File(_subject.getAttribute(DE.A_VALUE)
|
||||
+ File.separatorChar + _subject.getName());
|
||||
|
@ -91,10 +98,8 @@ public class RenameThread extends SecuredThread implements ICancellableHandler {
|
|||
ISystemArchiveHandler handler = archiveHandlerManager
|
||||
.getRegisteredHandler(new File(oldAbsPath
|
||||
.getContainingArchiveString()));
|
||||
boolean success = !(handler == null)
|
||||
&& handler.fullRename(oldAbsPath.getVirtualPart(),
|
||||
newAbsPath.getVirtualPart(), systemOperationMonitor);
|
||||
if (success && handler != null) {
|
||||
if (handler != null) {
|
||||
handler.fullRename(oldAbsPath.getVirtualPart(), newAbsPath.getVirtualPart(), systemOperationMonitor);
|
||||
_subject.setAttribute(DE.A_NAME, filerename.getName());
|
||||
_subject.setAttribute(DE.A_SOURCE, _miner.setProperties(handler
|
||||
.getVirtualFile(newAbsPath.getVirtualPart(), systemOperationMonitor)));
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
||||
* David McKnight (IBM) - [214378] canonical path not required - problem is in the client
|
||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||
|
@ -31,6 +32,7 @@ import java.util.HashSet;
|
|||
import org.eclipse.dstore.core.model.DE;
|
||||
import org.eclipse.dstore.core.model.DataElement;
|
||||
import org.eclipse.dstore.core.model.DataStore;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
import org.eclipse.dstore.core.util.StringCompare;
|
||||
import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
|
||||
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
||||
|
@ -41,11 +43,11 @@ import org.eclipse.rse.services.clientserver.SystemSearchString;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchFileNameMatcher;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchLineMatch;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatchLocator;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatcher;
|
||||
import org.eclipse.dstore.core.server.SecuredThread;
|
||||
|
||||
public class UniversalSearchHandler extends SecuredThread implements ICancellableHandler
|
||||
{
|
||||
|
@ -166,7 +168,7 @@ public class UniversalSearchHandler extends SecuredThread implements ICancellabl
|
|||
}
|
||||
}
|
||||
|
||||
protected void internalSearch(File theFile, int depth) {
|
||||
protected void internalSearch(File theFile, int depth) throws SystemMessageException {
|
||||
|
||||
// is it a directory?
|
||||
boolean isDirectory = theFile.isDirectory();
|
||||
|
@ -299,7 +301,7 @@ public class UniversalSearchHandler extends SecuredThread implements ICancellabl
|
|||
try {
|
||||
virtualchildren = ArchiveHandlerManager.getInstance().getContents(archive, virtualPath);
|
||||
}
|
||||
catch (IOException e) {
|
||||
catch (Exception e) {
|
||||
UniversalServerUtilities.logError(_miner.getName(), "Error occured trying to get the canonical file", e, _dataStore); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation and others. All rights reserved.
|
||||
* Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
|
@ -12,6 +12,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.clientserver;
|
||||
|
@ -26,6 +27,7 @@ import java.io.UnsupportedEncodingException;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.java.BasicClassFileParser;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -83,7 +85,7 @@ public class SystemFileClassifier {
|
|||
*/
|
||||
protected String classifyVirtual(String absolutePath) {
|
||||
|
||||
// create an abolute virtual path object
|
||||
// create an absolute virtual path object
|
||||
AbsoluteVirtualPath avp = new AbsoluteVirtualPath(absolutePath);
|
||||
|
||||
// get the path of the containing archive
|
||||
|
@ -96,7 +98,11 @@ public class SystemFileClassifier {
|
|||
File archiveFile = new File(archivePath);
|
||||
|
||||
// get classification of virtual file
|
||||
try {
|
||||
return ArchiveHandlerManager.getInstance().getClassification(archiveFile, virtualPath);
|
||||
} catch (SystemMessageException e) {
|
||||
return "file"; //FIXME check fallback //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
||||
* Xuan Chen (IBM) - [218491] ArchiveHandlerManager#cleanUpVirtualPath is messing up the file separators (with updated fix)
|
||||
* Johnson Ma (Wind River) - [195402] [api] add tar.gz archive support
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.clientserver.archiveutils;
|
||||
|
@ -27,6 +28,11 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.rse.internal.services.Activator;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemOperationFailedException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemUnsupportedOperationException;
|
||||
|
||||
/**
|
||||
* This class manages all the Archive Handlers that correspond to the archive file that the system
|
||||
* would like to deal with. It contains methods for registering handlers with file types, as well as
|
||||
|
@ -82,36 +88,51 @@ public class ArchiveHandlerManager
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the children of an object in the virtual file system.
|
||||
* Returns the children of an object in the virtual file system. Throws
|
||||
* SystemMessageException instead of IOException since RSE 3.0.
|
||||
*
|
||||
* @param file The archive in whose virtual file system the children reside.
|
||||
* @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.
|
||||
* @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
|
||||
* 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.
|
||||
* @throws IOException if there was a problem getting the registered handler for the
|
||||
* file. This usually means the archive is corrupted.
|
||||
* @param virtualpath The parent virtual object whose children this method
|
||||
* is to return. To get the top level virtual children in the archive,
|
||||
* set virtual path to "" or null.
|
||||
* @return An array of VirtualChild objects representing the children of the
|
||||
* virtual object in <code>file</code> referred to by
|
||||
* <code>virtual path</code>. 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.
|
||||
* @throws SystemMessageException in case of an error, e.g. there was a
|
||||
* problem getting the registered handler for the file. This usually
|
||||
* means the archive is corrupted.
|
||||
* @since 3.0
|
||||
*/
|
||||
public VirtualChild[] getContents(File file, String virtualpath) throws IOException
|
||||
public VirtualChild[] getContents(File file, String virtualpath) throws SystemMessageException
|
||||
{
|
||||
if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$
|
||||
ISystemArchiveHandler handler = getRegisteredHandler(file);
|
||||
if (handler == null || !handler.exists()) throw new IOException();
|
||||
if (handler == null || !handler.exists()) {
|
||||
throw new SystemUnsupportedOperationException(Activator.PLUGIN_ID, "No handler for " + file); //$NON-NLS-1$
|
||||
}
|
||||
return handler.getVirtualChildren(virtualpath, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the children of an object in the virtual file system that are folders.
|
||||
* Returns the children of an object in the virtual file system that are
|
||||
* folders.
|
||||
*
|
||||
* @param file The archive in whose virtual file system the children reside.
|
||||
* @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.
|
||||
* @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.
|
||||
* 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.
|
||||
* @param virtualpath The parent virtual object whose children this method
|
||||
* is to return. To get the top level virtual children in the archive,
|
||||
* set virtual path to "" or null.
|
||||
* @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. 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.
|
||||
* @throws SystemMessageException in case of an error
|
||||
* @since 3.0
|
||||
*/
|
||||
public VirtualChild[] getFolderContents(File file, String virtualpath)
|
||||
public VirtualChild[] getFolderContents(File file, String virtualpath) throws SystemMessageException
|
||||
{
|
||||
if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$
|
||||
ISystemArchiveHandler handler = getRegisteredHandler(file);
|
||||
|
@ -222,14 +243,18 @@ public class ArchiveHandlerManager
|
|||
}
|
||||
|
||||
/**
|
||||
* Given the absolute path to a virtual object, returns that object
|
||||
* as a VirtualChild.
|
||||
* @param fullyQualifiedName The absolute path to the object. Usually consists
|
||||
* of the fullyQualifiedName of the archive, followed by the virtual path separator
|
||||
* (defined in ArchiveHandlerManager.VIRTUAL_SEPARATOR) followed by the virtual path to
|
||||
* the object within the archive's virtual file system.
|
||||
* Given the absolute path to a virtual object, returns that object as a
|
||||
* VirtualChild.
|
||||
*
|
||||
* @param fullyQualifiedName The absolute path to the object. Usually
|
||||
* consists of the fullyQualifiedName of the archive, followed by the
|
||||
* virtual path separator (defined in
|
||||
* ArchiveHandlerManager.VIRTUAL_SEPARATOR) followed by the virtual
|
||||
* path to the object within the archive's virtual file system.
|
||||
* @throws SystemMessageException in case of an error
|
||||
* @since 3.0
|
||||
*/
|
||||
public VirtualChild getVirtualObject(String fullyQualifiedName)
|
||||
public VirtualChild getVirtualObject(String fullyQualifiedName) throws SystemMessageException
|
||||
{
|
||||
String cleanName = cleanUpVirtualPath(fullyQualifiedName);
|
||||
AbsoluteVirtualPath avp = new AbsoluteVirtualPath(cleanName);
|
||||
|
@ -243,11 +268,15 @@ public class ArchiveHandlerManager
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the registered handler for the File <code>file</code>. If
|
||||
* no handler exists for that file yet, create it. If the extension of
|
||||
* Returns the registered handler for the File <code>file</code>. If no
|
||||
* handler exists for that file yet, create it. If the extension of
|
||||
* <code>file</code> is not registered, then returns null.
|
||||
*
|
||||
* @throws SystemMessageException in case of an error instantiating the
|
||||
* handler
|
||||
* @since 3.0
|
||||
*/
|
||||
public ISystemArchiveHandler getRegisteredHandler(File file)
|
||||
public ISystemArchiveHandler getRegisteredHandler(File file) throws SystemMessageException
|
||||
{
|
||||
ISystemArchiveHandler handler = null;
|
||||
if (_handlers.containsKey(file))
|
||||
|
@ -279,17 +308,11 @@ public class ArchiveHandlerManager
|
|||
catch (InvocationTargetException e)
|
||||
{
|
||||
//Throwable target = e.getCause();
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
System.out.println("Could not instantiate handler for " + file.getName()); //$NON-NLS-1$
|
||||
return null;
|
||||
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "instantiate handler for " + file.getName(), e); //$NON-NLS-1$
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println(e.getMessage());
|
||||
System.out.println("Could not instantiate handler for " + file.getName()); //$NON-NLS-1$
|
||||
return null;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "instantiate handler for " + file.getName(), e); //$NON-NLS-1$
|
||||
}
|
||||
_handlers.put(file, handler);
|
||||
return handler;
|
||||
|
@ -475,28 +498,30 @@ public class ArchiveHandlerManager
|
|||
_handlers.clear();
|
||||
}
|
||||
|
||||
public boolean createEmptyArchive(File newFile)
|
||||
/**
|
||||
* Create an empty archive
|
||||
*
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public void createEmptyArchive(File newFile) throws SystemMessageException
|
||||
{
|
||||
if (!isRegisteredArchive(newFile.getName()))
|
||||
{
|
||||
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$
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Could not create new archive, because " //$NON-NLS-1$
|
||||
+ newFile + " is not a registered type of archive."); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (newFile.exists())
|
||||
{
|
||||
if (!newFile.isFile())
|
||||
{
|
||||
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||
System.out.println(newFile + " is not a file."); //$NON-NLS-1$
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Could not create new archive." //$NON-NLS-1$
|
||||
+ newFile + " is not a file."); //$NON-NLS-1$
|
||||
}
|
||||
if (!newFile.delete())
|
||||
{
|
||||
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||
System.out.println(newFile + " could not be deleted."); //$NON-NLS-1$
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Could not create new archive." //$NON-NLS-1$
|
||||
+ newFile + " could not be deleted."); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,20 +529,17 @@ public class ArchiveHandlerManager
|
|||
{
|
||||
if (!newFile.createNewFile())
|
||||
{
|
||||
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||
System.out.println(newFile + " could not be created."); //$NON-NLS-1$
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Could not create new archive." //$NON-NLS-1$
|
||||
+ newFile + " could not be created."); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||
System.out.println(e.getMessage());
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Could not create new archive: " + newFile, e); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
ISystemArchiveHandler handler = getRegisteredHandler(newFile);
|
||||
return handler.create();
|
||||
handler.create();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -535,14 +557,26 @@ public class ArchiveHandlerManager
|
|||
return extensions;
|
||||
}
|
||||
|
||||
public String getComment(File archive)
|
||||
/**
|
||||
* Get archive comment.
|
||||
*
|
||||
* @throws SystemMessageException in case of an error
|
||||
* @since 3.0
|
||||
*/
|
||||
public String getComment(File archive) throws SystemMessageException
|
||||
{
|
||||
ISystemArchiveHandler handler = getRegisteredHandler(archive);
|
||||
if (handler == null || !handler.exists()) return ""; //$NON-NLS-1$
|
||||
return handler.getArchiveComment();
|
||||
}
|
||||
|
||||
public long getExpandedSize(File archive)
|
||||
/**
|
||||
* Get total expanded size of an archive.
|
||||
*
|
||||
* @throws SystemMessageException in case of an error
|
||||
* @since 3.0
|
||||
*/
|
||||
public long getExpandedSize(File archive) throws SystemMessageException
|
||||
{
|
||||
ISystemArchiveHandler handler = getRegisteredHandler(archive);
|
||||
if (handler == null || !handler.exists()) return 0;
|
||||
|
@ -556,12 +590,15 @@ public class ArchiveHandlerManager
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 virtualPath the virtual path.
|
||||
* @return the classification for the virtual file.
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public String getClassification(File file, String virtualPath) {
|
||||
public String getClassification(File file, String virtualPath) throws SystemMessageException {
|
||||
|
||||
// if archive file is null, or if it does not exist, or if the virtual path
|
||||
// is null, then return null for the classification
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* Contributors:
|
||||
* Xuan Chen (IBM) - [160775][api][breaking] rename (at least within a zip) blocks UI thread
|
||||
* Martin Oberhuber (Wind River) - [cleanup] add API "since" tags to Archive Handler Javadoc
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.clientserver.archiveutils;
|
||||
|
@ -23,6 +24,7 @@ import java.io.InputStream;
|
|||
|
||||
import org.eclipse.rse.services.clientserver.ISystemFileTypes;
|
||||
import org.eclipse.rse.services.clientserver.ISystemOperationMonitor;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchLineMatch;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatcher;
|
||||
|
||||
|
@ -40,22 +42,25 @@ public interface ISystemArchiveHandler
|
|||
* (The archive could not exist before, in which case this would be a true
|
||||
* creation).
|
||||
*
|
||||
* @return Whether or not the blank archive was successfully created.
|
||||
* @throws SystemMessageException in case of an error
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean create();
|
||||
public void create() throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Return a flat list of entries in an archive.
|
||||
*
|
||||
* @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.
|
||||
* 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.
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public VirtualChild[] getVirtualChildrenList(ISystemOperationMonitor archiveOperationMonitor);
|
||||
public VirtualChild[] getVirtualChildrenList(ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Return a flat list of entries in an archive, whose full paths begin with
|
||||
|
@ -64,13 +69,14 @@ public interface ISystemArchiveHandler
|
|||
* @param parent full path of the parent
|
||||
* @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.
|
||||
* format, whose full paths begin with the String <code>parent</code>.
|
||||
* Returns an array of length 0 if there are no such entries.
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public VirtualChild[] getVirtualChildrenList(String parent, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public VirtualChild[] getVirtualChildrenList(String parent, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Return the children of a specified node in an archive.
|
||||
|
@ -78,14 +84,15 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName full virtual path of the parent
|
||||
* @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.
|
||||
* 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.
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public VirtualChild[] getVirtualChildren(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public VirtualChild[] getVirtualChildren(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Return those children of a specified node in an archive, which are
|
||||
|
@ -94,14 +101,16 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName full virtual path of the parent
|
||||
* @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.
|
||||
* 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.
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public VirtualChild[] getVirtualChildFolders(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public VirtualChild[] getVirtualChildFolders(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Return an archive node specified by a given virtual path.
|
||||
|
@ -109,14 +118,16 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName full virtual path of the object to retrieve
|
||||
* @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.
|
||||
* <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.
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public VirtualChild getVirtualFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public VirtualChild getVirtualFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Check whether a given virtual node exists in an archive.
|
||||
|
@ -124,12 +135,13 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName full virtual path of the object
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return Whether or not the virtual file or folder named
|
||||
* <code>fullVirtualName</code> exists in the archive
|
||||
* (physically).
|
||||
* <code>fullVirtualName</code> exists in the archive (physically).
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean exists(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public boolean exists(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Check if the archive handler implementation associated with this class
|
||||
|
@ -153,8 +165,10 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName virtual path specifying the node to check
|
||||
* @return the current timestamp (last modified) for the archive entry named
|
||||
* <code>fullVirtualName</code>
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
*/
|
||||
public long getTimeStampFor(String fullVirtualName);
|
||||
public long getTimeStampFor(String fullVirtualName) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Return the size for an archive node.
|
||||
|
@ -162,8 +176,10 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName virtual path specifying the node to check
|
||||
* @return the current size (uncompressed) for the entry in the archive
|
||||
* named <code>fullVirtualName</code>
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
*/
|
||||
public long getSizeFor(String fullVirtualName);
|
||||
public long getSizeFor(String fullVirtualName) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Extracts the virtual file named <code>fullVirtualName</code> from the
|
||||
|
@ -173,16 +189,16 @@ public interface ISystemArchiveHandler
|
|||
* archive.
|
||||
* @param destination The destination file for the extracted virtual file.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the extraction is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean extractVirtualFile(String fullVirtualName, File destination, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void extractVirtualFile(String fullVirtualName, File destination, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Extracts the virtual file named <code>fullVirtualName</code> from the
|
||||
* archive, placing the results in <code>destination</code>. Extracts to
|
||||
* the native encoding, but assumes that the source was archived using
|
||||
* archive, placing the results in <code>destination</code>. Extracts to the
|
||||
* native encoding, but assumes that the source was archived using
|
||||
* <code>sourceEncoding</code> if <code>isText</code> is true.
|
||||
*
|
||||
* @param fullVirtualName The full path and name of the virtual file in the
|
||||
|
@ -191,11 +207,12 @@ public interface ISystemArchiveHandler
|
|||
* @param sourceEncoding The encoding of the file in the archive.
|
||||
* @param isText Whether or not the virtual file is a text file.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the extraction is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean extractVirtualFile(String fullVirtualName, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void extractVirtualFile(String fullVirtualName, File destination, String sourceEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Extracts the directory <code>dir</code> (and its children) from the
|
||||
|
@ -206,11 +223,11 @@ public interface ISystemArchiveHandler
|
|||
* @param destinationParent A handle to the directory in which the extracted
|
||||
* directory will be placed as a subdirectory.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the extraction is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean extractVirtualDirectory(String dir, File destinationParent, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void extractVirtualDirectory(String dir, File destinationParent, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Extracts the directory <code>dir</code> (and its children) from the
|
||||
|
@ -225,11 +242,12 @@ public interface ISystemArchiveHandler
|
|||
* @param sourceEncoding The encoding of the files in the archive.
|
||||
* @param isText Whether or not the files in the directory are text files
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the extraction is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean extractVirtualDirectory(String dir, File destinationParent, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void extractVirtualDirectory(String dir, File destinationParent, String sourceEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Extracts the directory <code>dir</code> (and its children) from the
|
||||
|
@ -241,65 +259,66 @@ public interface ISystemArchiveHandler
|
|||
* @param destinationParent A handle to the directory in which the extracted
|
||||
* directory will be placed as a subdirectory.
|
||||
* @param destination A handle to the directory that will be created.
|
||||
* Whatever contents are in that directory will be replaced with
|
||||
* what is extracted from the archive.
|
||||
* Whatever contents are in that directory will be replaced with what
|
||||
* is extracted from the archive.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the extraction is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean extractVirtualDirectory(String dir, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void extractVirtualDirectory(String dir, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor)
|
||||
throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Extracts the directory <code>dir</code> (and its children) from the
|
||||
* archive and places the results in the directory
|
||||
* <code>destinationParent</code>. The results will be named
|
||||
* destination.getName() rather than <code>dir</code>'s name. Extracts to
|
||||
* the native encoding (if <code>isText</code>), but assumes 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 destinationParent A handle to the directory in which the extracted
|
||||
* directory will be placed as a subdirectory.
|
||||
* @param destination A handle to the directory that will be created.
|
||||
* Whatever contents are in that directory will be replaced with
|
||||
* what is extracted from the archive.
|
||||
* Whatever contents are in that directory will be replaced with what
|
||||
* is extracted from 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 archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the extraction is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean extractVirtualDirectory(String dir, File destinationParent, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void extractVirtualDirectory(String dir, File destinationParent, File destination, String sourceEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Compresses the file <code>file</code> and adds it to the archive,
|
||||
* 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 in the archive, create it. If <code>file</code> is a directory,
|
||||
* copy it and its contents into the archive, maintaining the tree
|
||||
* structure.
|
||||
* Compresses the file <code>file</code> and adds it to the archive, 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 in
|
||||
* the archive, 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 virtualPath the destination of the file
|
||||
* @param name the name of the result virtual file
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the addition is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* 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. 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 in the archive,
|
||||
* create it. If <code>file</code> is a directory, copy it and its
|
||||
* contents into the archive, maintaining the tree structure.
|
||||
* 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. 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 in the archive, 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 virtualPath the destination of the file
|
||||
|
@ -308,19 +327,20 @@ public interface ISystemArchiveHandler
|
|||
* @param targetEncoding the encoding of the result file
|
||||
* @param isText is the file a text file
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the addition is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @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 void add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Compresses the bytes in the InputStream <code>stream</code> and adds
|
||||
* them as an entry to the archive, saving them in the encoding specified by
|
||||
* <code>encoding</code> if <code>isText</code> is true, and 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 in
|
||||
* the archive, create it.
|
||||
* Compresses the bytes in the InputStream <code>stream</code> and adds them
|
||||
* as an entry to the archive, saving them in the encoding specified by
|
||||
* <code>encoding</code> if <code>isText</code> is true, and 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 in the
|
||||
* archive, create it.
|
||||
*
|
||||
* @param stream the InputStream to be added as an entry to the archive
|
||||
* @param virtualPath the destination of the stream
|
||||
|
@ -329,20 +349,21 @@ public interface ISystemArchiveHandler
|
|||
* @param targetEncoding the encoding of the result file
|
||||
* @param isText is the file a text file
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the addition is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @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 void add(InputStream stream, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* 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. 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 in the archive,
|
||||
* create it. If <code>file</code> is a directory, copy it and its
|
||||
* contents into the archive, maintaining the tree structure.
|
||||
* 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. 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 in the archive, 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 virtualPath the destination of the file
|
||||
|
@ -351,39 +372,39 @@ public interface ISystemArchiveHandler
|
|||
* @param targetEncoding the encoding of the result file
|
||||
* @param typeRegistery file transfer mode (binary or text) of this file
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the addition is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @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 void add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, ISystemFileTypes typeRegistery,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* A generalization of the add method. Compresses the array of files
|
||||
* <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 as the parameter <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.
|
||||
* <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 as the parameter <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 virtualPath the destination of the file
|
||||
* @param names the names of the result virtual files
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the addition is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* A generalization of the add method. Compresses the array of files
|
||||
* <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) specified by
|
||||
* <code>encodings</code>. Pass the names of the files as the parameter
|
||||
* <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.
|
||||
* <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) specified by <code>encodings</code>.
|
||||
* Pass the names of the files as the parameter <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 virtualPath the destination of the files
|
||||
|
@ -392,33 +413,34 @@ public interface ISystemArchiveHandler
|
|||
* @param targetEncodings the encoding of the result files
|
||||
* @param isText file transfer mode (binary or text) of the files
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the addition is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @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 void add(File[] files, String virtualPath, String[] names, String[] sourceEncodings, String[] targetEncodings, boolean[] isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Compress the file <code>file</code> and replace the virtual file
|
||||
* referred to by <code>fullVirtualName</code> with the compressed file.
|
||||
* Pass the name of the file as the parameter <code>name</code>.
|
||||
* Compress the file <code>file</code> and replace the virtual file referred
|
||||
* to by <code>fullVirtualName</code> with the compressed file. Pass the
|
||||
* name of the file as the parameter <code>name</code>.
|
||||
*
|
||||
* @param fullVirtualName the path of the file to be replaced
|
||||
* @param file the file to be added to the archive
|
||||
* @param name the name of the file
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the replacement is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean replace(String fullVirtualName, File file, String name, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void replace(String fullVirtualName, File file, String name, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Compress the InputStream <code>stream</code> and replace the virtual
|
||||
* file referred to by <code>fullVirtualName</code> with the compressed
|
||||
* stream. Pass the name of the new entry as the parameter <code>name</code>,
|
||||
* the encoding of the entry as <code>encoding</code> and whether or not
|
||||
* the entry <code>isText</code> or not.
|
||||
* Compress the InputStream <code>stream</code> and replace the virtual file
|
||||
* referred to by <code>fullVirtualName</code> with the compressed stream.
|
||||
* Pass the name of the new entry as the parameter <code>name</code>, the
|
||||
* encoding of the entry as <code>encoding</code> and whether or not the
|
||||
* entry <code>isText</code> or not.
|
||||
*
|
||||
* @param fullVirtualName the path of the file to be replaced
|
||||
* @param stream the InputStream to be added as an entry to the archive
|
||||
|
@ -427,11 +449,12 @@ public interface ISystemArchiveHandler
|
|||
* @param targetEncoding the encoding of the result file
|
||||
* @param isText is the file a text file
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the replacement is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @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 void replace(String fullVirtualName, InputStream stream, String name, String sourceEncoding, String targetEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Deletes the entry <code>fullVirtualName</code> from the archive, and
|
||||
|
@ -440,10 +463,13 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName the path of the file to be deleted
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the deletion is successful,
|
||||
* <code>false</code> otherwise
|
||||
* <code>false</code> if the file to delete was not found so this was a
|
||||
* successful no-op.
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Renames the entry <code>fullVirtualName</code> to the new name
|
||||
|
@ -452,25 +478,25 @@ public interface ISystemArchiveHandler
|
|||
*
|
||||
* @param fullVirtualName the path of the file to be renamed
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the rename is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Moves the entry <code>fullVirtualName</code> to the location specified
|
||||
* by <code>destinationVirtualPath</code>, while leaving the entry with
|
||||
* the same name as before.
|
||||
* Moves the entry <code>fullVirtualName</code> to the location specified by
|
||||
* <code>destinationVirtualPath</code>, while leaving the entry with the
|
||||
* same name as before.
|
||||
*
|
||||
* @param fullVirtualName the path of the file to be renamed
|
||||
* @param destinationVirtualPath the destination of the file to move to
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the move is successful, <code>false</code>
|
||||
* otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Replaces the full name and path of the entry <code>fullVirtualName</code>
|
||||
|
@ -479,11 +505,11 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName the path of the file to be renamed
|
||||
* @param newFullVirtualName the full path of the virtual file name
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the rename is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean fullRename(String fullVirtualName, String newFullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void fullRename(String fullVirtualName, String newFullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Extracts and returns the specified list of virtual files from the
|
||||
|
@ -493,9 +519,11 @@ public interface ISystemArchiveHandler
|
|||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return An array of handles to the extracted files. If fullNames has
|
||||
* length 0 then this method returns an array of length 0.
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Creates a new, empty folder in the archive. If parent folders do not
|
||||
|
@ -504,11 +532,11 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName The full name and path of the new folder within
|
||||
* the virtual file system.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the create operation is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Creates a new, empty file in the archive. If parent folders do not exist
|
||||
|
@ -517,11 +545,11 @@ public interface ISystemArchiveHandler
|
|||
* @param fullVirtualName The full name and path of the new file within the
|
||||
* virtual file system.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the create operation is successful,
|
||||
* <code>false</code> otherwise
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor);
|
||||
public void createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Get the archive-type specific standard name for the VirtualChild
|
||||
|
@ -542,17 +570,21 @@ public interface ISystemArchiveHandler
|
|||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return an array of match objects corresponding to lines where matches
|
||||
* were found. Returns an empty array if there are no results.
|
||||
* @throws SystemMessageException in case of an error,
|
||||
* or SystemOperationCancelledException in case of user cancellation
|
||||
* @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)
|
||||
throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Get the user-defined comment for a specific entry in the archive.
|
||||
*
|
||||
* @param fullVirtualName The entry who's comment is desired
|
||||
* @return the comment as a String or "" if there is none
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public String getCommentFor(String fullVirtualName);
|
||||
public String getCommentFor(String fullVirtualName) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Get the amount of space taken up by a specific entry in the archive when
|
||||
|
@ -561,31 +593,35 @@ public interface ISystemArchiveHandler
|
|||
*
|
||||
* @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 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).
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public long getCompressedSizeFor(String fullVirtualName);
|
||||
public long getCompressedSizeFor(String fullVirtualName) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Get the method used to compress a specific entry in the archive.
|
||||
*
|
||||
* @param fullVirtualName The entry who's compression method is desired
|
||||
* @return The compression method of the specified entry, or "" if none.
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public String getCompressionMethodFor(String fullVirtualName);
|
||||
public String getCompressionMethodFor(String fullVirtualName) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Get the comment associated with an archive.
|
||||
*
|
||||
* @return The comment associated with this archive, or "" if there is none.
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public String getArchiveComment();
|
||||
public String getArchiveComment() throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Get the classification for the entry with the given path.
|
||||
*
|
||||
* @param fullVirtualName the virtual name.
|
||||
* @return the classification.
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public String getClassification(String fullVirtualName);
|
||||
public String getClassification(String fullVirtualName) throws SystemMessageException;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* Xuan Chen (IBM) - [api] SystemTarHandler has inconsistent API
|
||||
* Johnson Ma (Wind River) - [195402][api] Add tar.gz archive support
|
||||
* Xuan Chen (IBM) - [224576] [api] Inconsistent boolean return values in SystemTarHandler API
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.clientserver.archiveutils;
|
||||
|
@ -46,12 +47,19 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.rse.internal.services.Activator;
|
||||
import org.eclipse.rse.internal.services.clientserver.archiveutils.ITarConstants;
|
||||
import org.eclipse.rse.internal.services.clientserver.archiveutils.SystemArchiveUtil;
|
||||
import org.eclipse.rse.services.clientserver.ISystemFileTypes;
|
||||
import org.eclipse.rse.services.clientserver.ISystemOperationMonitor;
|
||||
import org.eclipse.rse.services.clientserver.SystemReentrantMutex;
|
||||
import org.eclipse.rse.services.clientserver.java.BasicClassFileParser;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemLockTimeoutException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemOperationFailedException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemUnexpectedErrorException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemUnsupportedOperationException;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchLineMatch;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatchLocator;
|
||||
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatcher;
|
||||
|
@ -894,7 +902,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualFile(java.lang.String, java.io.File)
|
||||
*/
|
||||
public boolean extractVirtualFile(String fullVirtualName, File destination, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void extractVirtualFile(String fullVirtualName, File destination, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
TarEntry entry = null;
|
||||
|
||||
|
@ -922,14 +930,14 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
// the entry's last modified time
|
||||
destination.mkdirs();
|
||||
destination.setLastModified(entry.getModificationTime());
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
inStream = getTarFile().getInputStream(entry);
|
||||
|
||||
if (inStream == null) {
|
||||
destination.setLastModified(entry.getModificationTime());
|
||||
return false; // TODO: return true or false?
|
||||
throw new SystemUnexpectedErrorException(Activator.PLUGIN_ID);
|
||||
}
|
||||
//Need to make sure destination file exists.
|
||||
if (!destination.exists())
|
||||
|
@ -952,7 +960,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
// TODO: log error
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
finally {
|
||||
|
||||
|
@ -980,38 +988,37 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
releaseMutex(mutexLockStatus);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean extractVirtualDirectory(String fullVirtualName, File destinationParent, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
return extractVirtualDirectory(fullVirtualName, destinationParent, (File) null, archiveOperationMonitor);
|
||||
public void extractVirtualDirectory(String fullVirtualName, File destinationParent, ISystemOperationMonitor archiveOperationMonitor)
|
||||
throws SystemMessageException {
|
||||
extractVirtualDirectory(fullVirtualName, destinationParent, (File) null, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.io.File, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean extractVirtualDirectory(String fullVirtualName, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void extractVirtualDirectory(String fullVirtualName, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor)
|
||||
throws SystemMessageException {
|
||||
|
||||
// if the destination directory doesn't exist, create it
|
||||
if (!destinationParent.exists()) {
|
||||
|
||||
if (!destinationParent.mkdirs()) {
|
||||
// TODO: log error
|
||||
return false; // quit if we fail to create the destination directory
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Create folder " + destinationParent); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
// otherwise if the destination directory does exist, but is not a directory, then quit
|
||||
else if (!destinationParent.isDirectory()) {
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "No folder: " + destinationParent); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
|
||||
|
||||
int mutexLockStatus = SystemReentrantMutex.LOCK_STATUS_NOLOCK;
|
||||
try
|
||||
{
|
||||
|
@ -1024,7 +1031,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
VirtualChild dir = vfs.getEntry(fullVirtualName);
|
||||
|
||||
if (dir == null || !dir.isDirectory) {
|
||||
return false;
|
||||
throw new SystemUnexpectedErrorException(Activator.PLUGIN_ID);
|
||||
}
|
||||
|
||||
if (destination == null) {
|
||||
|
@ -1052,15 +1059,10 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
|
||||
// if the directory does not exist, try to create it
|
||||
if (!topDir.exists() && !topDir.mkdirs()) {
|
||||
// TODO: log error
|
||||
return false; // log error and quit if we fail to create the directory
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Create folder " + topDir); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
boolean returnCode = extractVirtualFile(fullVirtualName, topDir, archiveOperationMonitor);
|
||||
if (returnCode == false)
|
||||
{
|
||||
return returnCode;
|
||||
}
|
||||
extractVirtualFile(fullVirtualName, topDir, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
// get the children of this directory
|
||||
|
@ -1075,41 +1077,34 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
}
|
||||
File childFile = new File(childPath);
|
||||
|
||||
boolean returnCode = false;
|
||||
// if the child is a directory, then we need to extract it and its children
|
||||
if (tempChild.isDirectory) {
|
||||
|
||||
// and now extract its children
|
||||
returnCode = extractVirtualDirectory(tempChild.fullName, childFile, (File) null, archiveOperationMonitor);
|
||||
extractVirtualDirectory(tempChild.fullName, childFile, (File) null, archiveOperationMonitor);
|
||||
}
|
||||
// otherwise if the child is a file, simply extract it
|
||||
else {
|
||||
returnCode = extractVirtualFile(tempChild.fullName, childFile, archiveOperationMonitor);
|
||||
}
|
||||
if (returnCode == false)
|
||||
{
|
||||
return returnCode;
|
||||
extractVirtualFile(tempChild.fullName, childFile, archiveOperationMonitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
releaseMutex(mutexLockStatus);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File, java.lang.String, java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor ) {
|
||||
public void add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
|
||||
|
||||
int mutexLockStatus = SystemReentrantMutex.LOCK_STATUS_NOLOCK;
|
||||
|
@ -1123,18 +1118,16 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
// if it exists, call replace
|
||||
String fullVirtualName = getFullVirtualName(virtualPath, name);
|
||||
if (exists(fullVirtualName, archiveOperationMonitor)) {
|
||||
boolean returnCode = replace(fullVirtualName, file, name, archiveOperationMonitor);
|
||||
replace(fullVirtualName, file, name, archiveOperationMonitor);
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return returnCode;
|
||||
}
|
||||
else {
|
||||
File[] files = new File[1];
|
||||
files[0] = file;
|
||||
String[] names = new String[1];
|
||||
names[0] = name;
|
||||
boolean returnCode = add(files, virtualPath, names, archiveOperationMonitor);
|
||||
add(files, virtualPath, names, archiveOperationMonitor);
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1162,22 +1155,21 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
newNames[numOfChildren] = newNames[numOfChildren] + "/"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
boolean returnCode = add(sources, virtualPath, newNames, archiveOperationMonitor);
|
||||
add(sources, virtualPath, newNames, archiveOperationMonitor);
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
releaseMutex(mutexLockStatus);
|
||||
}
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return false;
|
||||
throw new SystemUnexpectedErrorException(Activator.PLUGIN_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1203,7 +1195,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File[], java.lang.String, java.lang.String[], org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
|
||||
int mutexLockStatus = SystemReentrantMutex.LOCK_STATUS_NOLOCK;
|
||||
File outputTempFile = null;
|
||||
|
@ -1225,7 +1217,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
|
||||
if (!files[i].exists() || !files[i].canRead()) {
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Cannot read: " + files[i]); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// if the entry already exists, then we should do a replace
|
||||
|
@ -1234,9 +1226,8 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
String fullVirtualName = getFullVirtualName(virtualPath, names[i]);
|
||||
if (exists(fullVirtualName, archiveOperationMonitor)) {
|
||||
|
||||
boolean returnCode = replace(fullVirtualName, files[i], names[i], archiveOperationMonitor);
|
||||
replace(fullVirtualName, files[i], names[i], archiveOperationMonitor);
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1252,13 +1243,13 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
boolean ok = createTar(children, outStream, (HashSet)null, archiveOperationMonitor);
|
||||
if (!ok)
|
||||
{
|
||||
//cancelled
|
||||
outStream.close();
|
||||
if (outputTempFile != null)
|
||||
{
|
||||
outputTempFile.delete();
|
||||
}
|
||||
return false;
|
||||
|
||||
throw new SystemOperationCancelledException();
|
||||
}
|
||||
}
|
||||
VirtualChild[] newEntriesAdded = new VirtualChild[numFiles];
|
||||
|
@ -1272,7 +1263,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
{
|
||||
outputTempFile.delete();
|
||||
}
|
||||
return false;
|
||||
throw new SystemOperationCancelledException();
|
||||
}
|
||||
String childVirtualPath = virtualPath + "/" + names[i]; //$NON-NLS-1$
|
||||
|
||||
|
@ -1303,7 +1294,6 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// close output stream
|
||||
if (outStream != null)
|
||||
{
|
||||
|
@ -1321,14 +1311,13 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
outputTempFile.delete();
|
||||
}
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
releaseMutex(mutexLockStatus);
|
||||
}
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1341,7 +1330,8 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* @param omitChildren the set of names for children that should be omitted
|
||||
* from the given array of virtual children.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the operation has been cancelled, <code>false</code> otherwise
|
||||
* @return <code>true</code> if the operation completes successfully, or
|
||||
* <code>false</code> if it has been cancelled.
|
||||
* @throws IOException if an I/O exception occurs.
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
|
@ -1661,26 +1651,25 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#replace(java.lang.String, java.io.File, java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean replace(String fullVirtualName, File file, String name, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void replace(String fullVirtualName, File file, String name, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
|
||||
// update our cache before accessing cache
|
||||
try {
|
||||
updateCache();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// TODO: log error
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
|
||||
if (!file.exists() && !file.canRead()) {
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Cannot read " + file); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
|
||||
// if the virtual file does not exist, we actually want to add
|
||||
if (!exists(fullVirtualName, archiveOperationMonitor)) {
|
||||
return add(file, fullVirtualName, name, archiveOperationMonitor);
|
||||
add(file, fullVirtualName, name, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -1707,8 +1696,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
{
|
||||
outputTempFile.delete();
|
||||
}
|
||||
return false;
|
||||
|
||||
throw new SystemOperationCancelledException();
|
||||
}
|
||||
|
||||
// now append the new file to the tar
|
||||
|
@ -1751,12 +1739,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
// replace the current tar file with the new one, and do not update cache since
|
||||
// we just did
|
||||
replaceFile(outputTempFile, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (IOException e) {
|
||||
// TODO: log error
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1764,7 +1749,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#delete(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor)
|
||||
public boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
|
||||
{
|
||||
boolean returnCode = doDelete(fullVirtualName, archiveOperationMonitor);
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
|
@ -1777,10 +1762,12 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
*
|
||||
* @param fullVirtualName virtual path identifying the object
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if successful, <code>false</code> otherwise
|
||||
* @return <code>true</code> if successful, <code>false</code> if the entry
|
||||
* to delete did not exist (so this was a successful no-op).
|
||||
* @throws SystemMessageException in case of an error
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
protected boolean doDelete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
protected boolean doDelete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
|
||||
File outputTempFile = null;
|
||||
int mutexLockStatus = SystemReentrantMutex.LOCK_STATUS_NOLOCK;
|
||||
|
@ -1831,8 +1818,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
{
|
||||
outputTempFile.delete();
|
||||
}
|
||||
return false;
|
||||
|
||||
throw new SystemOperationCancelledException();
|
||||
}
|
||||
|
||||
// delete the child from the cache (this will also delete its children if it
|
||||
|
@ -1845,53 +1831,48 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
// replace the current tar file with the new one, and do not update cache since
|
||||
// we just did
|
||||
replaceFile(outputTempFile, false);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
throw new SystemLockTimeoutException(Activator.PLUGIN_ID);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println(e.getMessage());
|
||||
System.out.println("Could not delete " + fullVirtualName); //$NON-NLS-1$
|
||||
if (!(outputTempFile == null)) outputTempFile.delete();
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Could not delete " + fullVirtualName, e); //$NON-NLS-1$
|
||||
}
|
||||
finally
|
||||
{
|
||||
releaseMutex(mutexLockStatus);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#rename(java.lang.String, java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||
|
||||
boolean resultCode = false;
|
||||
|
||||
// if the original does not have any separator, simply rename it.
|
||||
if (i == -1)
|
||||
{
|
||||
resultCode = fullRename(fullVirtualName, newName, archiveOperationMonitor);
|
||||
fullRename(fullVirtualName, newName, archiveOperationMonitor);
|
||||
}
|
||||
// otherwise, get the parent path and append the new name to it.
|
||||
else
|
||||
{
|
||||
String fullNewName = fullVirtualName.substring(0, i+1) + newName;
|
||||
resultCode = fullRename(fullVirtualName, fullNewName, archiveOperationMonitor);
|
||||
fullRename(fullVirtualName, fullNewName, archiveOperationMonitor);
|
||||
}
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#move(java.lang.String, java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
destinationVirtualPath = ArchiveHandlerManager.cleanUpVirtualPath(destinationVirtualPath);
|
||||
|
||||
|
@ -1899,12 +1880,12 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
|
||||
// if the original does not have any separator, simply append it to the destination path.
|
||||
if (i == -1) {
|
||||
return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName, archiveOperationMonitor); //$NON-NLS-1$
|
||||
fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName, archiveOperationMonitor); //$NON-NLS-1$
|
||||
}
|
||||
// otherwise, get the last segment (the name) and append that to the destination path.
|
||||
else {
|
||||
String name = fullVirtualName.substring(i);
|
||||
return fullRename(fullVirtualName, destinationVirtualPath + name, archiveOperationMonitor);
|
||||
fullRename(fullVirtualName, destinationVirtualPath + name, archiveOperationMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1912,7 +1893,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#fullRename(java.lang.String, java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean fullRename(String fullVirtualName, String newFullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void fullRename(String fullVirtualName, String newFullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
|
||||
int mutexLockStatus = SystemReentrantMutex.LOCK_STATUS_NOLOCK;
|
||||
File outputTempFile = null;
|
||||
|
@ -1929,10 +1910,9 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
|
||||
// if the virtual file to be renamed does not exist, then quit
|
||||
if (!child.exists()) {
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Not exists: " + child); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
// open a new temp file which will be our destination for the new tar file
|
||||
outputTempFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||
TarOutputStream outStream = getTarOutputStream(outputTempFile);
|
||||
|
@ -1999,8 +1979,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
{
|
||||
outputTempFile.delete();
|
||||
}
|
||||
return false;
|
||||
|
||||
throw new SystemOperationCancelledException();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2013,19 +1992,15 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
// probably be more efficient
|
||||
replaceFile(outputTempFile, true);
|
||||
updateTree(newOldNames);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
throw new SystemLockTimeoutException(Activator.PLUGIN_ID);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Could not rename " + fullVirtualName); //$NON-NLS-1$
|
||||
if (!(outputTempFile == null)) outputTempFile.delete();
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "Could not rename " + fullVirtualName, e); //$NON-NLS-1$
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -2041,10 +2016,11 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* file.
|
||||
* @param outStream the tar output stream to use.
|
||||
* @param renameMap a map containing associations between old names and new
|
||||
* names. Old names are the keys in the map, and the values are
|
||||
* the new names.
|
||||
* names. Old names are the keys in the map, and the values are the new
|
||||
* names.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the operation has been cancelled, <code>false</code> otherwise.
|
||||
* @return <code>true</code> if the operation completes successfully, or
|
||||
* <code>false</code> if it is cancelled by the user.
|
||||
* @throws IOException if an I/O exception occurs.
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
|
@ -2148,7 +2124,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getFiles(java.lang.String[], org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
|
||||
File[] files = new File[fullNames.length];
|
||||
|
||||
|
@ -2171,8 +2147,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
extractVirtualFile(fullNames[i], files[i], archiveOperationMonitor);
|
||||
}
|
||||
catch (IOException e) {
|
||||
// TODO: log error
|
||||
return null;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2183,23 +2158,27 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#createFolder(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
fullVirtualName = fullVirtualName + "/"; //$NON-NLS-1$
|
||||
boolean returnCode = createVirtualObject(fullVirtualName, archiveOperationMonitor);
|
||||
try {
|
||||
createVirtualObject(fullVirtualName, archiveOperationMonitor);
|
||||
} finally {
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#createFile(java.lang.String, org.eclipse.rse.services.clientserver.ISystemOperationMonitor)
|
||||
*/
|
||||
public boolean createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public void createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
boolean returnCode = createVirtualObject(fullVirtualName, archiveOperationMonitor);
|
||||
try {
|
||||
createVirtualObject(fullVirtualName, archiveOperationMonitor);
|
||||
} finally {
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2209,10 +2188,12 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* @param name the name of the virtual object.
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return <code>true</code> if the object was created successfully,
|
||||
* <code>false</code> otherwise.
|
||||
* <code>false</code> if the object already exists such that this is a
|
||||
* successful no-op, or if the operation is cancelled by the user.
|
||||
* @throws SystemMessageException in case of an error.
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
protected boolean createVirtualObject(String name, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
protected boolean createVirtualObject(String name, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
|
||||
File outputTempFile = null;
|
||||
TarOutputStream outStream = null;
|
||||
|
@ -2224,7 +2205,6 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
{
|
||||
updateCache();
|
||||
|
||||
|
||||
// if the object already exists, return false
|
||||
if (exists(name, archiveOperationMonitor)) {
|
||||
return false;
|
||||
|
@ -2247,8 +2227,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
{
|
||||
outputTempFile.delete();
|
||||
}
|
||||
return false;
|
||||
|
||||
throw new SystemOperationCancelledException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2265,12 +2244,11 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
// replace the current tar file with the new one, but do not update the cache
|
||||
// since we have already updated to the cache
|
||||
replaceFile(outputTempFile, false);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
throw new SystemLockTimeoutException(Activator.PLUGIN_ID);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// close output stream
|
||||
if (outStream != null)
|
||||
{
|
||||
|
@ -2287,13 +2265,13 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
{
|
||||
outputTempFile.delete();
|
||||
}
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
releaseMutex(mutexLockStatus);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2380,7 +2358,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#create()
|
||||
*/
|
||||
public boolean create() {
|
||||
public void create() throws SystemMessageException {
|
||||
|
||||
try {
|
||||
|
||||
|
@ -2397,13 +2375,12 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
modTimeDuringCache = file.lastModified();
|
||||
}
|
||||
catch (IOException e) {
|
||||
return false;
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public SystemSearchLineMatch[] search(String fullVirtualName, SystemSearchStringMatcher matcher, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
public SystemSearchLineMatch[] search(String fullVirtualName, SystemSearchStringMatcher matcher, ISystemOperationMonitor archiveOperationMonitor)
|
||||
throws SystemMessageException {
|
||||
// if the search string is empty or if it is "*", then return no matches
|
||||
// since it is a file search
|
||||
if (matcher.isSearchStringEmpty() || matcher.isSearchStringAsterisk()) {
|
||||
|
@ -2443,8 +2420,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
// TODO: log error
|
||||
return new SystemSearchLineMatch[0];
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2491,13 +2467,13 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* Compresses the file <code>file</code> and adds it to the archive,
|
||||
* saving it in the encoding specified by <code>encoding</code> if saving
|
||||
* in text mode. Places the file in the virtual directory
|
||||
* <code>virtualPath</code>. Pass the name as the parameter
|
||||
* <code>name</code>. If the virtual path does not exist in the archive,
|
||||
* create it. If <code>file</code> is a directory, copy it and its
|
||||
* contents into the archive, maintaining the tree structure.
|
||||
* Compresses the file <code>file</code> and adds it to the archive, saving
|
||||
* it in the encoding specified by <code>encoding</code> if saving in text
|
||||
* mode. Places the file in the virtual directory <code>virtualPath</code>.
|
||||
* Pass the name as the parameter <code>name</code>. If the virtual path
|
||||
* does not exist in the archive, 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 virtualPath the destination of the file
|
||||
|
@ -2505,59 +2481,62 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
* @param encoding the file encoding to use
|
||||
* @param registry the file type to use (text or binary)
|
||||
* @param archiveOperationMonitor the operation progress monitor
|
||||
* @return true if and only if the add was successful
|
||||
* @throws SystemMessageException in case of an error
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean add(File file, String virtualPath, String name,
|
||||
String encoding, ISystemFileTypes registry, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
return add(file, virtualPath, name, archiveOperationMonitor);
|
||||
public void add(File file, String virtualPath, String name, String encoding, ISystemFileTypes registry, ISystemOperationMonitor archiveOperationMonitor)
|
||||
throws SystemMessageException {
|
||||
add(file, virtualPath, name, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
|
||||
*/
|
||||
public boolean add(File file, String virtualPath, String name,
|
||||
String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
return add(file, virtualPath, name, archiveOperationMonitor);
|
||||
public void add(File file, String virtualPath, String name,
|
||||
String sourceEncoding, String targetEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
add(file, virtualPath, name, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#add(java.io.File[], java.lang.String, java.lang.String[], java.lang.String[], java.lang.String[], boolean[])
|
||||
*/
|
||||
public boolean add(File[] files, String virtualPath, String[] names,
|
||||
String[] sourceEncodings, String[] targetEncodings, boolean[] isTexts, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
return add(files, virtualPath, names, archiveOperationMonitor);
|
||||
public void add(File[] files, String virtualPath, String[] names,
|
||||
String[] sourceEncodings, String[] targetEncodings, boolean[] isTexts,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
add(files, virtualPath, names, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.io.File, java.lang.String, boolean)
|
||||
*/
|
||||
public boolean extractVirtualDirectory(String dir, File destinationParent,
|
||||
File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
return extractVirtualDirectory(dir, destinationParent, destination, archiveOperationMonitor);
|
||||
public void extractVirtualDirectory(String dir, File destinationParent,
|
||||
File destination, String sourceEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
extractVirtualDirectory(dir, destinationParent, destination, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualDirectory(java.lang.String, java.io.File, java.lang.String, boolean)
|
||||
*/
|
||||
public boolean extractVirtualDirectory(String dir, File destinationParent,
|
||||
String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
return extractVirtualDirectory(dir, destinationParent, archiveOperationMonitor);
|
||||
public void extractVirtualDirectory(String dir, File destinationParent, String sourceEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
extractVirtualDirectory(dir, destinationParent, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#extractVirtualFile(java.lang.String, java.io.File, java.lang.String, boolean)
|
||||
*/
|
||||
public boolean extractVirtualFile(String fullVirtualName, File destination,
|
||||
String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
return extractVirtualFile(fullVirtualName, destination, archiveOperationMonitor);
|
||||
public void extractVirtualFile(String fullVirtualName, File destination, String sourceEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
extractVirtualFile(fullVirtualName, destination, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler#getClassification(java.lang.String)
|
||||
*/
|
||||
public String getClassification(String fullVirtualName) {
|
||||
public String getClassification(String fullVirtualName) throws SystemMessageException {
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
|
||||
// default type
|
||||
|
@ -2612,18 +2591,19 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
return type;
|
||||
}
|
||||
|
||||
public boolean add(InputStream stream, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
public void add(InputStream stream, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
throw new SystemUnsupportedOperationException(Activator.PLUGIN_ID, "add"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public boolean add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, ISystemFileTypes typeRegistery, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
return add(file, virtualPath, name, archiveOperationMonitor);
|
||||
public void add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, ISystemFileTypes typeRegistery,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
add(file, virtualPath, name, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
public boolean replace(String fullVirtualName, InputStream stream, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
public void replace(String fullVirtualName, InputStream stream, String name, String sourceEncoding, String targetEncoding, boolean isText,
|
||||
ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException {
|
||||
throw new SystemUnsupportedOperationException(Activator.PLUGIN_ID, "replace"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -14,7 +14,8 @@
|
|||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancellation of archive operations
|
||||
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.clientserver.archiveutils;
|
||||
|
@ -22,13 +23,18 @@ package org.eclipse.rse.services.clientserver.archiveutils;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.rse.internal.services.Activator;
|
||||
import org.eclipse.rse.services.clientserver.ISystemOperationMonitor;
|
||||
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemOperationFailedException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemUnexpectedErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* @author mjberger
|
||||
* A simple structure for passing information about virtual files and folders.
|
||||
*
|
||||
* @author mjberger
|
||||
*/
|
||||
public final class VirtualChild {
|
||||
|
||||
|
@ -251,7 +257,7 @@ public final class VirtualChild {
|
|||
* timestamps on the cached and archived files do not match, the cached file is erased,
|
||||
* and reextracted from the archive.
|
||||
*/
|
||||
public File getExtractedFile()
|
||||
public File getExtractedFile() throws SystemMessageException
|
||||
{
|
||||
return getExtractedFile(SystemEncodingUtil.ENCODING_UTF_8, false, null);
|
||||
}
|
||||
|
@ -263,7 +269,7 @@ public final class VirtualChild {
|
|||
* timestamps on the cached and archived files do not match, the cached file is erased,
|
||||
* and reextracted from the archive.
|
||||
*/
|
||||
public File getExtractedFile(String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
|
||||
public File getExtractedFile(String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
|
||||
{
|
||||
File returnedFile = null;
|
||||
if (_extractedFile == null || _extractedFile.lastModified() != getTimeStamp())
|
||||
|
@ -307,8 +313,7 @@ public final class VirtualChild {
|
|||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.out.println("VirtualChild.getExtractedFile(): "); //$NON-NLS-1$
|
||||
System.out.println(e.getMessage());
|
||||
throw new SystemOperationFailedException(Activator.PLUGIN_ID, "VirtualChild.getExtractedFile()", e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,34 +336,38 @@ public final class VirtualChild {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the extracted file or directory represented by this VirtualChild from the archive,
|
||||
* and replaces the object referred to by <code>destination</code> with that extracted file or directory.
|
||||
* Note that the extracted file is cached after it is extracted once, but if the
|
||||
* timestamps on the cached and archived files do not match, the cached file is erased,
|
||||
* and reextracted from the archive.
|
||||
* <code>destination</code> is always overwritten with either what is cached, or
|
||||
* what is in the archive.
|
||||
* @return true if and only if the extraction succeeded.
|
||||
* Gets the extracted file or directory represented by this VirtualChild
|
||||
* from the archive, and replaces the object referred to by
|
||||
* <code>destination</code> with that extracted file or directory. Note that
|
||||
* the extracted file is cached after it is extracted once, but if the
|
||||
* timestamps on the cached and archived files do not match, the cached file
|
||||
* is erased, and reextracted from the archive. <code>destination</code> is
|
||||
* always overwritten with either what is cached, or what is in the archive.
|
||||
*
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public boolean getExtractedFile(File destination, ISystemOperationMonitor archiveOperationMonitor)
|
||||
public void getExtractedFile(File destination, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
|
||||
{
|
||||
return getExtractedFile(destination, SystemEncodingUtil.ENCODING_UTF_8, false, archiveOperationMonitor);
|
||||
getExtractedFile(destination, SystemEncodingUtil.ENCODING_UTF_8, false, archiveOperationMonitor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the extracted file or directory represented by this VirtualChild from the archive,
|
||||
* and replaces the object referred to by <code>destination</code> with that extracted file or directory.
|
||||
* Note that the extracted file is cached after it is extracted once, but if the
|
||||
* timestamps on the cached and archived files do not match, the cached file is erased,
|
||||
* and reextracted from the archive.
|
||||
* <code>destination</code> is always overwritten with either what is cached, or
|
||||
* what is in the archive.
|
||||
* @return true if and only if the extraction succeeded.
|
||||
* Gets the extracted file or directory represented by this VirtualChild
|
||||
* from the archive, and replaces the object referred to by
|
||||
* <code>destination</code> with that extracted file or directory. Note that
|
||||
* the extracted file is cached after it is extracted once, but if the
|
||||
* timestamps on the cached and archived files do not match, the cached file
|
||||
* is erased, and reextracted from the archive. <code>destination</code> is
|
||||
* always overwritten with either what is cached, or what is in the archive.
|
||||
*
|
||||
* @throws SystemMessageException in case of an error
|
||||
*/
|
||||
public boolean getExtractedFile(File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
|
||||
public void getExtractedFile(File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
|
||||
throws SystemMessageException
|
||||
{
|
||||
boolean success = true;
|
||||
if (_handler == null) return false;
|
||||
if (_handler == null)
|
||||
throw new SystemUnexpectedErrorException(Activator.PLUGIN_ID);
|
||||
if (_extractedFile == null ||
|
||||
_extractedFile.lastModified() != getTimeStamp() ||
|
||||
!destination.getAbsolutePath().equals(_extractedFile.getAbsolutePath())
|
||||
|
@ -366,26 +375,25 @@ public final class VirtualChild {
|
|||
{
|
||||
if (isDirectory)
|
||||
{
|
||||
success = _handler.extractVirtualDirectory(fullName, destination.getParentFile(), destination, sourceEncoding, isText, archiveOperationMonitor);
|
||||
_handler.extractVirtualDirectory(fullName, destination.getParentFile(), destination, sourceEncoding, isText, archiveOperationMonitor);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = _handler.extractVirtualFile(fullName, destination, sourceEncoding, isText, archiveOperationMonitor);
|
||||
_handler.extractVirtualFile(fullName, destination, sourceEncoding, isText, archiveOperationMonitor);
|
||||
}
|
||||
_extractedFile = destination;
|
||||
}
|
||||
//We only set the status of the archive operation montor to done if it is not been cancelled.
|
||||
//We only set the status of the archive operation monitor to done if it is not been cancelled.
|
||||
if (null != archiveOperationMonitor && !archiveOperationMonitor.isCancelled())
|
||||
{
|
||||
archiveOperationMonitor.setDone(true);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether or not this VirtualChild exists in the archive.
|
||||
*/
|
||||
public boolean exists()
|
||||
public boolean exists() throws SystemMessageException
|
||||
{
|
||||
if (_handler == null) return false;
|
||||
return _handler.exists(fullName, null);
|
||||
|
|
Loading…
Add table
Reference in a new issue