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