diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/IUniversalDataStoreConstants.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/IUniversalDataStoreConstants.java index f7fa597c56b..658d9b60310 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/IUniversalDataStoreConstants.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/IUniversalDataStoreConstants.java @@ -10,7 +10,7 @@ * component that contains this file: David McKnight, Kushal Munir, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * Martin Oberhuber (Wind River) - [183165] Do not implement constant interfaces * David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup @@ -35,28 +35,28 @@ public interface IUniversalDataStoreConstants /** * Universal Filesystem miner ID. Value = * "org.eclipse.rse.dstore.universal.miners.UniversalFileSystemMiner". - * + * * @since org.eclipse.rse.services.dstore 3.0 */ public static final String UNIVERSAL_FILESYSTEM_MINER_ID = "org.eclipse.rse.dstore.universal.miners.UniversalFileSystemMiner"; //$NON-NLS-1$ /** * Universal Command miner ID. Value = * "org.eclipse.rse.dstore.universal.miners.CommandMiner". - * + * * @since org.eclipse.rse.services.dstore 3.0 */ public static final String UNIVERSAL_COMMAND_MINER_ID = "org.eclipse.rse.dstore.universal.miners.CommandMiner"; //$NON-NLS-1$ /** * Universal Environment miner ID. Value = * "org.eclipse.rse.dstore.universal.miners.EnvironmentMiner". - * + * * @since org.eclipse.rse.services.dstore 3.0 */ public static final String UNIVERSAL_ENVIRONMENT_MINER_ID = "org.eclipse.rse.dstore.universal.miners.EnvironmentMiner"; //$NON-NLS-1$ /** * Universal Process miner ID. Value = * "org.eclipse.rse.dstore.universal.miners.UniversalProcessMiner". - * + * * @since org.eclipse.rse.services.dstore 3.0 */ public static final String UNIVERSAL_PROCESS_MINER_ID = "org.eclipse.rse.dstore.universal.miners.UniversalProcessMiner"; //$NON-NLS-1$ @@ -123,6 +123,7 @@ public interface IUniversalDataStoreConstants public static final String TYPE_QUALIFIED_CLASSNAME = "fullClassName"; //$NON-NLS-1$ // permissions commands + /** @since org.eclipse.rse.services.dstore 3.0 */ public static final String C_QUERY_FILE_PERMISSIONS = "C_QUERY_FILE_PERMISSIONS"; //$NON-NLS-1$ /** @since org.eclipse.rse.services.dstore 3.0 */ public static final String C_SET_FILE_PERMISSIONS = "C_SET_FILE_PERMISSIONS"; //$NON-NLS-1$ diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java index 9597c9919df..076b2aeb409 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java @@ -1601,6 +1601,9 @@ public class UniversalFileSystemMiner extends Miner { } + /** + * @since 3.0 made private method public + */ public AbsoluteVirtualPath getAbsoluteVirtualPath(DataElement subject) { StringBuffer path = new StringBuffer(subject.getAttribute(DE.A_VALUE)); if (ArchiveHandlerManager.getInstance().isArchive( diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/AbstractDStoreService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/AbstractDStoreService.java index 9f0bceabef0..2c78c478483 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/AbstractDStoreService.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/AbstractDStoreService.java @@ -44,6 +44,10 @@ public abstract class AbstractDStoreService extends AbstractService implements I protected Map _cmdDescriptorMap; protected DataElement _initializeStatus; + /** + * @since 3.0 got rid of ISystemMessageProvider argument + * @param dataStoreProvider + */ public AbstractDStoreService(IDataStoreProvider dataStoreProvider) { _dataStoreProvider = dataStoreProvider; @@ -148,6 +152,7 @@ public abstract class AbstractDStoreService extends AbstractService implements I return new DataElement[0]; } + /** @since 3.0 */ protected List dsQueryCommandMulti(DataElement[] subjects, String[] commands, IProgressMonitor monitor) { return dsQueryCommandMulti(subjects, null, commands, monitor); @@ -155,11 +160,13 @@ public abstract class AbstractDStoreService extends AbstractService implements I /** * Query multiple subjects in one shot + * * @param subjects the subjects to query * @param commands the query commands * @param argses arguments for the command - may be null * @param monitor the progress monitor * @return a list of DataElement[]s containing the results of each query + * @since 3.0 */ protected List dsQueryCommandMulti(DataElement[] subjects, ArrayList[] argses, String[] commands, IProgressMonitor monitor) { diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreStatusMonitor.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreStatusMonitor.java index 15e3b2aa03f..8ef2e9668ed 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreStatusMonitor.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreStatusMonitor.java @@ -7,12 +7,12 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: - * David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout + * David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout * David McKnight (IBM) - [190010] When status is "cancelled" the wait should complete * David McKnight (IBM) - [197480] eliminating UI dependencies * David McKnight (IBM) - [209593] [api] check for existing query to avoid duplicates @@ -39,7 +39,7 @@ import org.eclipse.dstore.extra.IDomainNotifier; * This utility class can be used to monitor the status of one more more status DataElements. * Only one instanceof of this class is required per DataStore for use in monitoring statuses. * This is intended to be used in place of StatusChangeListeners - * + * * *
* The following is one example of the use of the StatusMonitor. The code: *
@@ -53,31 +53,31 @@ public class DStoreStatusMonitor implements IDomainListener { protected boolean _networkDown = false; - + protected List _workingStatuses; protected List _cancelledStatuses; protected List _doneStatuses; - + protected DataStore _dataStore; - + /** * Construct a StatusChangeListener * * @param dataStore the dataStore associated with this monitor - */ - public DStoreStatusMonitor(DataStore dataStore) + */ + public DStoreStatusMonitor(DataStore dataStore) { _dataStore = dataStore; reInit(); } - - + + public void reInit() { - _networkDown = false; + _networkDown = false; _workingStatuses = new ArrayList(); _doneStatuses = new ArrayList(); _cancelledStatuses = new ArrayList(); @@ -89,12 +89,12 @@ public class DStoreStatusMonitor implements IDomainListener notifier.addDomainListener(this); }} } - + public DataStore getDataStore() { return _dataStore; } - + public void dispose() { _workingStatuses.clear(); @@ -102,11 +102,11 @@ public class DStoreStatusMonitor implements IDomainListener _cancelledStatuses.clear(); _dataStore.getDomainNotifier().removeDomainListener(this); } - + /** * @see IDomainListener#listeningTo(DomainEvent) */ - public boolean listeningTo(DomainEvent event) + public boolean listeningTo(DomainEvent event) { if (_workingStatuses.size() == 0) { @@ -118,16 +118,16 @@ public class DStoreStatusMonitor implements IDomainListener { return determineStatusDone(parent); } - + return false; } - + /** * @see IDomainListener#domainChanged(DomainEvent) */ - public void domainChanged(DomainEvent event) + public void domainChanged(DomainEvent event) { if (_workingStatuses.size() == 0) { @@ -145,23 +145,23 @@ public class DStoreStatusMonitor implements IDomainListener } } } - - + + /** * Determines whether the status is done. * @returntrue
if status done,false
otherwise. */ - public boolean determineStatusDone(DataElement status) - { + public boolean determineStatusDone(DataElement status) + { return status.getAttribute(DE.A_VALUE).equals("done") || //$NON-NLS-1$ status.getAttribute(DE.A_NAME).equals("done") ||//$NON-NLS-1$ status.getAttribute(DE.A_NAME).equals("cancelled"); //$NON-NLS-1$ } - + /** * @return true if the the monitor is passive. In this case it is false. */ - public boolean isPassiveCommunicationsListener() + public boolean isPassiveCommunicationsListener() { return false; } @@ -170,17 +170,17 @@ public class DStoreStatusMonitor implements IDomainListener * setDone(boolean) */ public synchronized void setDone(DataElement status) - { + { _workingStatuses.remove(status); - _doneStatuses.add(status); + _doneStatuses.add(status); } - - + + public synchronized void setCancelled(DataElement status) { _workingStatuses.remove(status); _cancelledStatuses.add(status); - + // send a cancel command if possible if (status != null) { @@ -195,14 +195,14 @@ public class DStoreStatusMonitor implements IDomainListener } } } - + public synchronized void setWorking(DataElement status) { _workingStatuses.add(status); } - - - public boolean wasCancelled(DataElement status) + + + public boolean wasCancelled(DataElement status) { if (_cancelledStatuses.contains(status)) { @@ -210,37 +210,37 @@ public class DStoreStatusMonitor implements IDomainListener } return false; } - + /** - * Test if the StatusChangeListener returned because the network connection to the + * Test if the StatusChangeListener returned because the network connection to the * remote system was broken. */ - public boolean isNetworkDown() + public boolean isNetworkDown() { return _networkDown; } - + public DataElement waitForUpdate(DataElement status) throws InterruptedException - { + { return waitForUpdate(status, null, 0); } - + public DataElement waitForUpdate(DataElement status, IProgressMonitor monitor) throws InterruptedException - { + { return waitForUpdate(status, monitor, 0); } - + public DataElement waitForUpdate(DataElement status, int wait) throws InterruptedException - { + { return waitForUpdate(status, null, wait); - } - + } + public synchronized DataElement waitForUpdate(DataElement status, IProgressMonitor monitor, int wait) throws InterruptedException - { + { if (_networkDown && status.getDataStore().isConnected()) { reInit(); @@ -250,41 +250,41 @@ public class DStoreStatusMonitor implements IDomainListener setDone(status); return status; } - + setWorking(status); - - // Prevent infinite looping by introducing a threshold for wait - int WaitThreshold = 50; + + // Prevent infinite looping by introducing a threshold for wait + int WaitThreshold = 50; if ( wait > 0 ) WaitThreshold = wait*10; // 1 second means 10 sleep(100ms) else if ( wait == -1 ) // force a diagnostic WaitThreshold = -1; - + int initialWaitThreshold = WaitThreshold; int nudges = 0; // nudges used for waking up server with slow connections // nudge up to 12 times before giving up - + { // Current thread is not UI thread while (_workingStatuses.contains(status)) { boolean statusDone = determineStatusDone(status); - if (statusDone) + if (statusDone) { setDone(status); } - else + else { if ((monitor != null) && (monitor.isCanceled())) { setCancelled(status); throw new InterruptedException(); - } - + } + waitForUpdate(); //Thread.sleep(200); - + if (WaitThreshold > 0) // update timer count if // threshold not reached --WaitThreshold; // decrement the timer count @@ -292,11 +292,11 @@ public class DStoreStatusMonitor implements IDomainListener if (WaitThreshold == 0) { wakeupServer(status); - + // no diagnostic factory but there is a timeout if (nudges >= 12) return status; // returning the undone status object - + nudges++; WaitThreshold = initialWaitThreshold; } @@ -306,21 +306,23 @@ public class DStoreStatusMonitor implements IDomainListener throw new InterruptedException(); } } - } + } } - + return status; } + - /** - * Returns the status of a running command for the specified cmd desciptor and subject. - * If there is no such command running, then null is returned. - * - * @param cmdDescriptor - * @param subject - * @return the status of the command. - */ + /** + * Returns the status of a running command for the specified cmd desciptor + * and subject. If there is no such command running, then null is returned. + * + * @param cmdDescriptor + * @param subject + * @return the status of the command. + * @since 3.0 + */ public DataElement getCommandStatus(DataElement cmdDescriptor, DataElement subject) { synchronized (_workingStatuses){ @@ -343,7 +345,7 @@ public class DStoreStatusMonitor implements IDomainListener if (status != null) { // token command to wake up update handler - DataElement cmdDescriptor = _dataStore.findCommandDescriptor(DataStoreSchema.C_NOTIFICATION); + DataElement cmdDescriptor = _dataStore.findCommandDescriptor(DataStoreSchema.C_NOTIFICATION); DataElement subject = status.getParent().get(0); if (cmdDescriptor != null) { @@ -360,7 +362,7 @@ public class DStoreStatusMonitor implements IDomainListener { try { - wait(200); + wait(200); } catch (InterruptedException e) { @@ -370,7 +372,7 @@ public class DStoreStatusMonitor implements IDomainListener return; } } - + /** * Causes all threads waiting for this class request to be filled * to wake up. @@ -379,6 +381,6 @@ public class DStoreStatusMonitor implements IDomainListener { notifyAll(); } - + } diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DownloadListener.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DownloadListener.java index 460ae57a256..b7ad58f3ae4 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DownloadListener.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DownloadListener.java @@ -1,18 +1,18 @@ /******************************************************************************** * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * + * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes - * David McKnight (IBM) - [162195] new APIs for upload multi and download multi + * David McKnight (IBM) - [162195] new APIs for upload multi and download multi * David McKnight (IBM) - [197480] eliminating UI dependencies * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind * Martin Oberhuber (Wind River) - [219952] Use MessageFormat for download progress message @@ -61,10 +61,10 @@ public class DownloadListener implements IDomainListener { System.out.println("Status is null!"); //$NON-NLS-1$ } - + _dataStore = _status.getDataStore(); _dataStore.getDomainNotifier().addDomainListener(this); - + _localFile = localFile; if (monitor != null) @@ -79,19 +79,21 @@ public class DownloadListener implements IDomainListener { updateDownloadState(); setDone(true); - } + } } - + + /** @since 3.0 */ public long getTotalLength() { return _totalLength; } - + public boolean isCancelled() { return _isCancelled; } - + + /** @since 3.0 */ public boolean isDone() { return _isDone; @@ -149,20 +151,20 @@ public class DownloadListener implements IDomainListener { //System.out.println(_status.getAttribute(DE.A_SOURCE)); _monitor.worked((int)delta); - + try { double percent = (currentLength * 1.0) / _totalLength; String str = MessageFormat.format( ServiceResources.DStore_Service_Percent_Complete_Message, new Object[] { - new Long(currentLength/1024), + new Long(currentLength/1024), new Long(_totalLength/1024), new Double(percent) }); - + _monitor.subTask(str); - + /* DKM - DO WE NEED THIS?!! while (_display != null && _display.readAndDispatch()) { //Process everything on event queue @@ -175,7 +177,7 @@ public class DownloadListener implements IDomainListener _totalBytesNotified = currentLength; } } - + if (!_status.getDataStore().getStatus().getName().equals("okay")) //$NON-NLS-1$ { _networkDown = true; @@ -199,7 +201,7 @@ public class DownloadListener implements IDomainListener /** - * + * */ public boolean wasCancelled() { @@ -225,7 +227,7 @@ public class DownloadListener implements IDomainListener * Wait for the the status DataElement to be refreshed * * @param wait threshold for starting diagnostic. Default is 60 seconds; a zero means to use the default. - * -1 means to force a timeout; mainly for testing purpose. + * -1 means to force a timeout; mainly for testing purpose. * * @return The status DataElement after it has been updated, or the user * has pressed cancel @@ -234,15 +236,15 @@ public class DownloadListener implements IDomainListener */ public DataElement waitForUpdate(int wait) throws InterruptedException { - // Prevent infinite looping by introducing a threshold for wait - - int WaitThreshold = 50; - + // Prevent infinite looping by introducing a threshold for wait + + int WaitThreshold = 50; + if (wait > 0) WaitThreshold = wait * 10; // 1 second means 10 sleep(100ms) else if (wait == -1) // force a diagnostic WaitThreshold = -1; - + int initialWaitTheshold = WaitThreshold; { // Current thread is not UI thread @@ -262,13 +264,13 @@ public class DownloadListener implements IDomainListener } if (getStatus().getAttribute(DE.A_NAME).equals("done")) //$NON-NLS-1$ { - setDone(true); + setDone(true); } else { Thread.sleep(100); updateDownloadState(); - + if (WaitThreshold > 0) // update timer count if { // threshold not reached @@ -285,14 +287,14 @@ public class DownloadListener implements IDomainListener } return _status; } - - + + private void wakeupServer(DataElement status) { if (status != null) - { + { // token command to wake up update handler - DataElement cmdDescriptor = _dataStore.findCommandDescriptor(DataStoreSchema.C_NOTIFICATION); + DataElement cmdDescriptor = _dataStore.findCommandDescriptor(DataStoreSchema.C_NOTIFICATION); DataElement subject = status.getParent().get(0); if (cmdDescriptor != null) { diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemInputStream.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemInputStream.java index 4121769dca5..46eaf6ba8a0 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemInputStream.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemInputStream.java @@ -1,13 +1,13 @@ /******************************************************************************** * Copyright (c) 2007 IBM Corporation. All rights reserved. * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * + * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer * component that contains this file: David McKnight. - * + * * Contributors: * David McKnight (IBM) - [207100] decorated input stream ********************************************************************************/ @@ -23,8 +23,10 @@ import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; /** - * Decorates an input stream that was created in the service layer. - * The purpose of this class is to notify download after the stream is closed. + * Decorates an input stream that was created in the service layer. The purpose + * of this class is to notify download after the stream is closed. + * + * @since 3.0 */ public class FileSubSystemInputStream extends InputStream { @@ -32,7 +34,7 @@ public class FileSubSystemInputStream extends InputStream { private String _remoteParent; private String _remoteFile; private IRemoteFileSubSystem _fs; - + public FileSubSystemInputStream(InputStream inStream, String remoteParent, String remoteFile, IRemoteFileSubSystem fs) { _inStream = inStream; @@ -40,18 +42,18 @@ public class FileSubSystemInputStream extends InputStream { _remoteFile = remoteFile; _fs = fs; } - + public int available() throws IOException { return _inStream.available(); } public void close() throws IOException { _inStream.close(); - + // notify that the file was uploaded ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, _remoteParent, _remoteFile, _fs)); + + sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, _remoteParent, _remoteFile, _fs)); } public synchronized void mark(int readlimit) { diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemOutputStream.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemOutputStream.java index 92b32537ce5..3d54eb9c3bb 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemOutputStream.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemOutputStream.java @@ -1,13 +1,13 @@ /******************************************************************************** * Copyright (c) 2007 IBM Corporation. All rights reserved. * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * + * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer * component that contains this file: David McKnight. - * + * * Contributors: * David McKnight (IBM) - [207100] decorated output stream ********************************************************************************/ @@ -23,9 +23,10 @@ import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; /** - * Decorates an output stream that was created in the service layer. - * The purpose of this class is to notify upload after the stream is closed. - * + * Decorates an output stream that was created in the service layer. The purpose + * of this class is to notify upload after the stream is closed. + * + * @since 3.0 */ public class FileSubSystemOutputStream extends OutputStream { @@ -33,8 +34,8 @@ public class FileSubSystemOutputStream extends OutputStream { private String _remoteParent; private String _remoteFile; private IRemoteFileSubSystem _fs; - - + + public FileSubSystemOutputStream(OutputStream outStream, String remoteParent, String remoteFile, IRemoteFileSubSystem fs) { _outStream = outStream; @@ -42,14 +43,14 @@ public class FileSubSystemOutputStream extends OutputStream { _remoteFile = remoteFile; _fs = fs; } - + public void close() throws IOException { _outStream.close(); - + // notify that the file was uploaded ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, _remoteParent, _remoteFile, _fs)); + + sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, _remoteParent, _remoteFile, _fs)); } public void flush() throws IOException { diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java index 540fe6c90f5..34123a35e94 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java @@ -108,6 +108,7 @@ public interface IRemoteFile extends IRemoteContainer, IRemotePropertyHolder, IS /** * Return the connection this remote file is from. + * @since 3.0 renamed getSystemConnection() to getHost() */ public IHost getHost(); diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java index dafb68f9017..c34f8f0348b 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java @@ -7,10 +7,10 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * David McKnight (IBM) - [173518] [refresh] Read only changes are not shown in RSE until the parent folder is refreshed @@ -56,14 +56,14 @@ import org.eclipse.rse.ui.SystemBasePlugin; import org.eclipse.swt.widgets.Display; /** - * A remote file represents a named file on a remote file system. This class + * A remote file represents a named file on a remote file system. This class * works with remote file names that do not include the preceding "" - * prefix. Such ultimately-qualified names are known as IRemoteFilePath names. + * prefix. Such ultimately-qualified names are known as IRemoteFilePath names. * * Base parent class that supplies all of the * functionality required by the IRemoteFile interface. *
- * This base functionality is possible because this is a + * This base functionality is possible because this is a * read-only representation of a remote file ... all actions * like delete and rename are handled by the subsystem. *
@@ -80,34 +80,34 @@ import org.eclipse.swt.widgets.Display; */ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable { - protected IRemoteFileContext _context; + protected IRemoteFileContext _context; protected String _label; protected Object remoteObj; protected IRemoteFile _parentFile; - + /* Archived file properties */ // DKM - let's get rid of these fields // - they should now be in IHostfile protected boolean isContainer = false; - + // master hash map protected HashMap _contents = new HashMap(); - + /* container properties */ protected boolean _isStale = true; - + // properties protected HashMap properties = new HashMap(); protected HashMap propertyStates = new HashMap(); - - + + /** * Constructor that takes a context object containing important information. * @param context An object holding contextual information about this object * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext - */ + */ public RemoteFile(IRemoteFileContext context) { this._context = context; @@ -117,13 +117,13 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable { // deduce active shell from display IRemoteFileSubSystem ss = context.getParentRemoteFileSubSystem(); - + if (Display.getCurrent() == null) { ss.connect(new NullProgressMonitor(), false); } else { ss.connect(false, null); } - } catch (Exception exc) {} + } catch (Exception exc) {} } @@ -135,17 +135,17 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable _context.setFilterString(filterString); } - + public void setLabel(String newLabel) { - _label = newLabel; + _label = newLabel; } - - + + // ------------------------------------------------------------------------ // GETTER METHODS. ALL FULLY IMPLEMENTED ASSUMING SETTERS HAVE BEEN CALLED. // ------------------------------------------------------------------------ - + /** * Return the context associated with this remote file */ @@ -153,7 +153,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable { return _context; } - + /** * Return the parent subsystem */ @@ -172,12 +172,12 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable else return ss.getParentRemoteFileSubSystemConfiguration(); } - + public void setParentRemoteFile(IRemoteFile parentFile) { this._parentFile = parentFile; } - + /** * Return the parent remote file object expanded to get this object, or null if no such parent */ @@ -189,18 +189,18 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable { return null; } - + IRemoteFile parentFile = null; - + // _context.getParentRemoteFile(); String pathOnly = getParentPath(); if (pathOnly != null) - { + { IRemoteFileSubSystem ss = _context.getParentRemoteFileSubSystem(); if (ss != null) { - IProgressMonitor monitor = new NullProgressMonitor(); + IProgressMonitor monitor = new NullProgressMonitor(); try { char sep = getSeparatorChar(); if (pathOnly.length() == 0) @@ -237,11 +237,11 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } /** * If this is a folder, it is possible that it is listed as part of a multiple filter string - * filter. In this case, when the folder is expanded, we want to filter the file names to - * show all the files that match any of the filter strings that have the same parent path. + * filter. In this case, when the folder is expanded, we want to filter the file names to + * show all the files that match any of the filter strings that have the same parent path. *
* This method supports that by returning all the filter strings in the filter which have the - * same parent path as was used to produce this file. + * same parent path as was used to produce this file. */ public RemoteFileFilterString[] getAllFilterStrings() { @@ -298,7 +298,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable public boolean isLink() { String classifyString = getClassification(); - + if (classifyString == null) { return false; @@ -307,14 +307,14 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable { return true; } - return false; + return false; } - - + + public boolean isExecutable() { String classifyString = getClassification(); - + if (classifyString == null) { return false; @@ -325,17 +325,19 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } return false; } - - + + public boolean isArchive() { File file = new File(getAbsolutePath()); return ArchiveHandlerManager.getInstance().isArchive(file); } - /** - * Return the connection this remote file is from. - */ + /** + * Return the connection this remote file is from. + * + * @since 3.0 renamed getSystemConnection() to getHost() + */ public IHost getHost() { IRemoteFileSubSystem ss = _context.getParentRemoteFileSubSystem(); @@ -344,7 +346,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable else return ss.getHost(); } - + /** * Get fully qualified connection and file name: connection:\path\file * Note the separator character between the profile name and the connection name is always '.' @@ -366,41 +368,41 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable { if (_label != null) { - return _label; + return _label; } - return getName(); + return getName(); } /** * @see IRemoteFile#isBinary() */ - public boolean isBinary() + public boolean isBinary() { if (isDirectory()) - return false; - else + return false; + else return RemoteFileUtility.getSystemFileTransferModeRegistry().isBinary(this); } - + /** * @see IRemoteFile#isText() */ - public boolean isText() + public boolean isText() { if (isDirectory()) - return false; - else + return false; + else return RemoteFileUtility.getSystemFileTransferModeRegistry().isText(this); } - - + + /** * @see IRemoteFile#getLastModifiedDate() */ - public Date getLastModifiedDate() + public Date getLastModifiedDate() { return new Date(getLastModified()); } @@ -420,14 +422,14 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return nameOnly.substring(idx+1); return null; // TODO - why null? } - + /** * Return the cached copy of this remote file. The returned IFile must be used for read-only * purposes since no locks are acquired on the remote file. - * + * * @return IFile The cached copy of this file if it exists AND it is upto date. null is returned if a local - * cached copy of this file is not available or the local cached copy is not upto date (last modified + * cached copy of this file is not available or the local cached copy is not upto date (last modified * timestamp comparison.) */ // FIXME - core and ui separate now (editor is ui) @@ -443,7 +445,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable // } // return null; // } - + // ----------------------- // HOUSEKEEPING METHODS... // ----------------------- @@ -451,7 +453,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable { return getName(); } - + /** * This is the method required by the IAdaptable interface. * Given an adapter class type, return an object castable to the type, or @@ -459,12 +461,12 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable *
* By default this returns Platform.getAdapterManager().getAdapter(this, adapterType); * This in turn results in the default subsystem adapter SystemViewSubSystemAdapter, - * in package org.eclipse.rse.ui.view. + * in package org.eclipse.rse.ui.view. */ public Object getAdapter(Class adapterType) { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } + return Platform.getAdapterManager().getAdapter(this, adapterType); + } // ------------------------------- // java.util.Comparable methods... @@ -481,10 +483,10 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable else if (!isDirectory() && otherFile.isDirectory()) return 1; // we are a file so we are more than a folder String comp1 = getName(); - + String comp2 = otherFile.getName(); if (comp2 == null) - comp2 = otherFile.getParentPath(); + comp2 = otherFile.getParentPath(); return comp1.toLowerCase().compareTo(comp2.toLowerCase()); } @@ -495,14 +497,14 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable public void setFile (Object obj) { remoteObj = obj; - } + } public Object getFile() { return remoteObj; } - - public boolean isAncestorOf(IRemoteFile file) + + public boolean isAncestorOf(IRemoteFile file) { String separator = this.getSeparator(); if (this instanceof IVirtualRemoteFile) separator = "/"; //$NON-NLS-1$ @@ -511,23 +513,23 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return file.getAbsolutePathPlusConnection().startsWith(this.getAbsolutePathPlusConnection() + separator); } - public boolean isDescendantOf(IRemoteFile file) + public boolean isDescendantOf(IRemoteFile file) { String separator = file.getSeparator(); if (this instanceof IVirtualRemoteFile) separator = "/"; //$NON-NLS-1$ if (file.isArchive()) separator = ArchiveHandlerManager.VIRTUAL_SEPARATOR; - + return this.getAbsolutePathPlusConnection().startsWith(file.getAbsolutePathPlusConnection() + separator); } - + /* * (non-Javadoc) * @see org.eclipse.rse.core.model.ISystemContainer#hasContents(org.eclipse.rse.core.model.ISystemContentsType) */ - public boolean hasContents(ISystemContentsType contentsType) + public boolean hasContents(ISystemContentsType contentsType) { boolean result = _contents.containsKey(contentsType); - + // KM: comment out this code to prevent us picking up wrong cache // KM: defect 45072 // if (!result) @@ -541,27 +543,27 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable // return hasContents(RemoteChildrenContentsType.getInstance()); // } // } - + return result; } - + /* * (non-Javadoc) * @see org.eclipse.rse.core.subsystems.IRemoteContainer#hasContents(org.eclipse.rse.core.model.ISystemContentsType, java.lang.String) */ public boolean hasContents(ISystemContentsType contentsType, String filter) { HashMap filters = (HashMap)(_contents.get(contentsType)); - + if (filters == null) { return false; } - + if (filter == null) { filter = "*"; //$NON-NLS-1$ } - + boolean result = containsFilterKey(filters, filter); - + // KM: comment out this code to prevent us picking up wrong cache // KM: defect 45072 // if (!result) @@ -575,10 +577,10 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable // return hasContents(RemoteChildrenContentsType.getInstance(), filter); // } // } - + return result; } - + protected boolean containsFilterKey(HashMap filters, String filter) { if (filters.containsKey(filter)) @@ -587,7 +589,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } else { - + Set keySet = filters.keySet(); Object[] keyArray = keySet.toArray(); for (int i = 0; i < keyArray.length; i++) @@ -609,33 +611,33 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } return false; } - + /* * (non-Javadoc) * @see org.eclipse.rse.core.model.ISystemContainer#getContents(org.eclipse.rse.core.model.ISystemContentsType) */ - public Object[] getContents(ISystemContentsType contentsType) + public Object[] getContents(ISystemContentsType contentsType) { return getContents(contentsType, "*"); //$NON-NLS-1$ - } - + } + private Object[] combine(Object[] set1, Object[] set2) { ArrayList result = new ArrayList(set1.length + set2.length); - + for (int i = 0; i < set1.length; i++) { result.add(set1[i]); } - + for (int j = 0; j < set2.length; j++) { result.add(set2[j]); } - + return result.toArray(new IRemoteFile[result.size()]); } - + /* private Object[] getFiles(Object[] filesAndFolders) { @@ -652,7 +654,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return results.toArray(); } */ - + private Object[] getFolders(Object[] filesAndFolders) { List results = new ArrayList(); @@ -668,17 +670,17 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return results.toArray(); } - + /* * (non-Javadoc) * @see org.eclipse.rse.core.subsystems.IRemoteContainer#getContents(org.eclipse.rse.core.model.ISystemContentsType, java.lang.String) */ - public Object[] getContents(ISystemContentsType contentsType, String filter) - { + public Object[] getContents(ISystemContentsType contentsType, String filter) + { HashMap filters = (HashMap)(_contents.get(contentsType)); - - if (filters == null || filters.isEmpty()) - { + + if (filters == null || filters.isEmpty()) + { if (contentsType == RemoteChildrenContentsType.getInstance()) { if (hasContents(RemoteFileChildrenContentsType.getInstance()) && hasContents(RemoteFolderChildrenContentsType.getInstance())) @@ -686,7 +688,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable // implies both files and folders Object[] folders = getContents(RemoteFolderChildrenContentsType.getInstance(), filter); Object[] files = getContents(RemoteFileChildrenContentsType.getInstance(), filter); - + return combine(folders, files); } } @@ -708,12 +710,12 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } return null; } - + if (filter == null) { filter = "*"; //$NON-NLS-1$ } - - if (filters.containsKey(filter)) + + if (filters.containsKey(filter)) { Object[] filterResults = (Object[])filters.get(filter); if (contentsType == RemoteChildrenContentsType.getInstance() || @@ -728,21 +730,21 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return filterResults; } } - + ArrayList calculatedResults = new ArrayList(); - + StringComparePatternMatcher fmatcher = new StringComparePatternMatcher(filter); - + // the filter may be a subset of existing filters Object[] keySet = filters.keySet().toArray(); - + for (int i = 0; i < keySet.length; i++) { - + String key = (String)keySet[i]; - + // KM: we need to match with the key to ensure that the filter is a subset StringComparePatternMatcher matcher = new StringComparePatternMatcher(key); - + if (matcher.stringMatches(filter)) { // get all children, i.e. the superset Object[] all = (Object[]) filters.get(key); @@ -754,7 +756,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable Object subContent = all[s]; if (!calculatedResults.contains(subContent)) { - + if (subContent instanceof IRemoteFile) { IRemoteFile temp = (IRemoteFile) subContent; @@ -788,17 +790,17 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } } } - + return calculatedResults.toArray(); - } + } /** - * Returns whether filter is for file types. + * Returns whether filter is for file types. * @param filter the filter. * @return
true
if filter is for file types,false
otherwise. */ private boolean isFilterForFileTypes(String filter) { - + if (filter.endsWith(",")) { //$NON-NLS-1$ return true; } @@ -806,11 +808,11 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return false; } } - + public void setIsContainer(boolean con) { isContainer = con; - } - + } + /* * Replace occurrences of cached object with new object */ @@ -834,39 +836,39 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } } } - - - + + + /* * (non-Javadoc) * @see org.eclipse.rse.core.subsystems.IRemoteContainer#setContents(org.eclipse.rse.core.model.ISystemContentsType, java.lang.String, java.lang.Object[]) */ public void setContents(ISystemContentsType contentsType, String filter, Object[] con) { - + if (filter == null) { filter = "*"; //$NON-NLS-1$ } - + // DKM - consider all containers so that we can tell if an empty one - // has been queried before (i.e. via IRemoteFile[0] as it's contents vs null) -// if (con != null && con.length > 0) + // has been queried before (i.e. via IRemoteFile[0] as it's contents vs null) +// if (con != null && con.length > 0) { isContainer = true; } - + HashMap filters = (HashMap)(_contents.get(contentsType)); - - if (filters == null) + + if (filters == null) { filters = new HashMap(); } - if (isContainer) - { + if (isContainer) + { filters.put(filter, con); _contents.put(contentsType, filters); - } - + } + // set parent folders if (isContainer && con != null) { @@ -884,33 +886,33 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable /** * @see org.eclipse.rse.core.subsystems.IRemoteContainer#isStale() */ - public boolean isStale() + public boolean isStale() { return _isStale || !exists(); } - - - + + + /** * @see org.eclipse.rse.core.subsystems.IRemoteContainer#markStale(boolean) */ - public void markStale(boolean isStale) + public void markStale(boolean isStale) { markStale(isStale, true); } - + /** * @see org.eclipse.rse.core.subsystems.IRemoteContainer#markStale(boolean) */ - public void markStale(boolean isStale, boolean clearCache) + public void markStale(boolean isStale, boolean clearCache) { _isStale = isStale; - - if (isStale && clearCache) - { - + + if (isStale && clearCache) + { + Iterator iter = _contents.keySet().iterator(); - + while (iter.hasNext()) { Object contentsType = iter.next(); if (contentsType instanceof ISystemContentsType) @@ -918,29 +920,29 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable if (!((ISystemContentsType)contentsType).isPersistent()) { HashMap filters = (HashMap)(_contents.get(contentsType)); - - if (filters != null) + + if (filters != null) { filters.clear(); } } } } - + if (_parentFile != null) { _parentFile.markStale(true, false); } - - + + } } - + public void copyContentsTo(IRemoteContainer target) { Iterator iter = _contents.keySet().iterator(); - - while (iter.hasNext()) + + while (iter.hasNext()) { Object contentsType = iter.next(); if (contentsType instanceof ISystemContentsType) @@ -949,12 +951,12 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable if (ct.isPersistent()) { HashMap filters = (HashMap)(_contents.get(ct)); - + Iterator fiter = filters.keySet().iterator(); - - while (fiter.hasNext()) + + while (fiter.hasNext()) { - Object filter = fiter.next(); + Object filter = fiter.next(); Object fcontents = filters.get(filter); if (fcontents != null && fcontents instanceof Object[]) { @@ -965,35 +967,35 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } } } - + /** * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#getProperties(java.lang.String[]) */ public Object[] getProperties(String[] keys) { - + Object[] values = new Object[keys.length]; - + for (int i = 0; i < keys.length; i++) { values[i] = properties.get(keys[i]); } - + return values; } - + /** * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#getProperty(java.lang.String) */ public Object getProperty(String key) { return properties.get(key); } - + /** * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#isPropertyStale(java.lang.String) */ public boolean isPropertyStale(String key) { - + Boolean b = (Boolean)(propertyStates.get(key)); - + if (b == null) { return false; } @@ -1001,36 +1003,36 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return b.booleanValue(); } } - + /** * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#markAllPropertiesStale() */ public void markAllPropertiesStale() { Iterator iter = propertyStates.keySet().iterator(); - + while (iter.hasNext()) { String key = (String)(iter.next()); markPropertyStale(key); } } - + /** * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#markPropertyStale(java.lang.String) */ public void markPropertyStale(String key) { propertyStates.put(key, Boolean.FALSE); } - + /** * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#setProperties(java.lang.String[], java.lang.Object[]) */ public void setProperties(String[] keys, Object[] values) { - + for (int i = 0; i < keys.length; i++) { setProperty(keys[i], values[i]); } } - + /** * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#setProperty(java.lang.String, java.lang.Object) */ @@ -1038,12 +1040,12 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable properties.put(key, value); propertyStates.put(key, Boolean.TRUE); } - + public String getComment() { return ""; //$NON-NLS-1$ } - + /* * (non-Javadoc) * @see ISchedulingRule#contains(ISchedulingRule) @@ -1064,14 +1066,14 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable if (rule instanceof IRemoteFile) { RemoteFile rf = (RemoteFile)rule; - return getHostName().equals(rf.getHostName()) && + return getHostName().equals(rf.getHostName()) && rf.getAbsolutePath().startsWith(getAbsolutePath()); } //if (!(rule instanceof RemoteFileSchedulingRule)) // return false; if (rule instanceof RemoteFileSchedulingRule) { - return getHostName().equals(((RemoteFileSchedulingRule) rule).getHostName()) && + return getHostName().equals(((RemoteFileSchedulingRule) rule).getHostName()) && ((RemoteFileSchedulingRule) rule).getAbsolutePath().startsWith(getAbsolutePath()); } return false; @@ -1080,17 +1082,17 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable /* (non-Javadoc) * @see ISchedulingRule#isConflicting(ISchedulingRule) */ - public boolean isConflicting(ISchedulingRule rule) - { + public boolean isConflicting(ISchedulingRule rule) + { if (rule instanceof RemoteFile) { String otherPath = ((RemoteFile)rule).getAbsolutePath(); String path = this.getAbsolutePath(); String otherHost = ((RemoteFile)rule).getHostName(); - return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path); + return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path); } else if (rule instanceof RemoteFileSchedulingRule) - { + { String otherPath = ((RemoteFileSchedulingRule) rule).getAbsolutePath(); String path = this.getAbsolutePath(); String otherHost = ((RemoteFileSchedulingRule) rule).getHostName(); @@ -1101,22 +1103,22 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return false; } } - + public boolean equals(Object otherObj) { if (otherObj instanceof RemoteFile) { RemoteFile other = (RemoteFile)otherObj; if (this == other) return true; - + String otherPath = other.getAbsolutePath(); String path = this.getAbsolutePath(); //String otherHost = other.getHostName(); - + String alias1 = this.getParentRemoteFileSubSystem().getHostAliasName(); String alias2 = other.getParentRemoteFileSubSystem().getHostAliasName(); - - //return getHostName().equals(otherHost) && path.equals(otherPath); + + //return getHostName().equals(otherHost) && path.equals(otherPath); return alias1.equals(alias2) && path.equals(otherPath); } else @@ -1124,27 +1126,27 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return false; } } - + public String getHostName() { return getHost().getHostName(); } - + private String getParentPathFor(String path) - { + { boolean isUnix = getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().isUnixStyle(); - + String separator = getSeparator(); - + if (isUnix && path.equals(separator)) { return null; // no parent of root } - - int lastSep = path.lastIndexOf(separator); - + + int lastSep = path.lastIndexOf(separator); + if (lastSep == 0) // root is the parent (on unix) { return separator; @@ -1158,7 +1160,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable return null; } } - + /** * Returns the encoding of the remote file. If a user specified value does not exist, then we check * it's ancestry for an encoding. Otherwise the encoding of the parent subsystem is returned. @@ -1168,7 +1170,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable String hostName = getParentRemoteFileSubSystem().getHost().getHostName(); String path = getAbsolutePath(); String encoding = RemoteFileEncodingManager.getInstance().getEncoding(hostName, path); - + // ask the parent folder if (encoding == null) { if (_parentFile != null) @@ -1177,22 +1179,22 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } else { - - // manually extra parents + + // manually extra parents String parentPath = getParentPathFor(path); while (parentPath != null && encoding == null) { encoding = RemoteFileEncodingManager.getInstance().getEncoding(hostName, parentPath); parentPath = getParentPathFor(parentPath); } - + if (encoding == null) // no encoding found - fall back to system { encoding = getParentRemoteFileSubSystem().getRemoteEncoding(); } } } - + return encoding; } /** @@ -1203,6 +1205,11 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable RemoteFileEncodingManager.getInstance().setEncoding(getHostName(), getAbsolutePath(), encoding); } + /** + * {@inheritDoc} + * + * @since 3.0 + */ public IHostFilePermissions getPermissions() { IHostFile hostFile = getHostFile(); if (hostFile instanceof IHostFilePermissionsContainer){ diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEmpty.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEmpty.java index 5869d55eb08..ab1720c8869 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEmpty.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEmpty.java @@ -7,10 +7,10 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal *******************************************************************************/ @@ -24,22 +24,25 @@ import org.eclipse.rse.services.files.IHostFilePermissions; /** * A "dummy" node to use as a place holder */ -public class RemoteFileEmpty extends RemoteFile +public class RemoteFileEmpty extends RemoteFile { /** * Constructor for RemoteFileEmpty */ - public RemoteFileEmpty() + public RemoteFileEmpty() { super(new RemoteFileContext(null,null,null)); } + /** + * @since 3.0 + */ public String getAbsolutePath() { return ""; //$NON-NLS-1$ } - + public String getName() { return "dummy"; //$NON-NLS-1$ diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileRoot.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileRoot.java index 4a660b67bf0..49ccd71bdf5 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileRoot.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileRoot.java @@ -7,10 +7,10 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal *******************************************************************************/ @@ -25,7 +25,7 @@ import org.eclipse.rse.services.files.IHostFilePermissions; * takes a root which should return a single IRemoteFile object in the initial * getChildren query. */ -public class RemoteFileRoot extends RemoteFile +public class RemoteFileRoot extends RemoteFile { private IRemoteFile rootFile; private IRemoteFile[] rootFiles; @@ -33,18 +33,18 @@ public class RemoteFileRoot extends RemoteFile /** * Constructor when root is known */ - public RemoteFileRoot(IRemoteFile rootFile) + public RemoteFileRoot(IRemoteFile rootFile) { super(new RemoteFileContext(null,null,null)); setRootFile(rootFile); } - + /** * Constructor when root is not known. * Client must call {@link #setRootFile(IRemoteFile)} before any * get.. calls in this class are actually used. */ - public RemoteFileRoot() + public RemoteFileRoot() { super(new RemoteFileContext(null,null,null)); } @@ -56,7 +56,7 @@ public class RemoteFileRoot extends RemoteFile { return rootFile; } - + /** * Reset the root file node */ @@ -74,12 +74,12 @@ public class RemoteFileRoot extends RemoteFile { return rootFiles; } - + public String getName() { return "dummy"; //$NON-NLS-1$ } - + public int compareTo(Object o) { // TODO Auto-generated method stub @@ -126,57 +126,60 @@ public class RemoteFileRoot extends RemoteFile { return false; } - + public boolean isHidden() { return false; } - + public boolean canRead() { return rootFile.canRead(); } - + public boolean canWrite() { return rootFile.canWrite(); } - + public boolean exists() { return rootFile.exists(); } - + public long getLastModified() { return rootFile.getLastModified(); } - + public long getLength() { return rootFile.getLength(); } - + public boolean showReadOnlyProperty() { return rootFile.showReadOnlyProperty(); } - + public String getClassification() { return rootFile.getClassification(); } - + + /** + * @since 3.0 + */ public String getAbsolutePath() { return rootFile.getAbsolutePath(); } - + public String getCanonicalPath() { return rootFile.getCanonicalPath(); } - + public IHostFile getHostFile() { return rootFile.getHostFile(); diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java index 52fb24a04cd..78ed5878029 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java @@ -881,11 +881,15 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi } - /** - * Return a list of all remote folders and files in the given folder. The list is not subsetted. + /** + * Return a list of all remote folders and files in the given folder. The + * list is not subsetted. + * * @param parents The parent folders to list folders and files in - * @param fileTypes - indicates whether to query files, folders, both or some other type + * @param fileTypes - indicates whether to query files, folders, both or + * some other type * @param monitor the progress monitor + * @since 3.0 */ public IRemoteFile[] listMultiple(IRemoteFile[] parents, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException { @@ -899,10 +903,14 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi } /** - * Return a list of all remote folders and files in the given folder. The list is not subsetted. + * Return a list of all remote folders and files in the given folder. The + * list is not subsetted. + * * @param parents The parent folders to list folders and files in - * @param fileType - indicates whether to query files, folders, both or some other type + * @param fileType - indicates whether to query files, folders, both or some + * other type * @param monitor the progress monitor + * @since 3.0 */ public IRemoteFile[] listMultiple(IRemoteFile[] parents, int fileType, IProgressMonitor monitor) throws SystemMessageException { @@ -916,9 +924,12 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi } /** - * Return a list of all remote folders and files in the given folder. The list is not subsetted. + * Return a list of all remote folders and files in the given folder. The + * list is not subsetted. + * * @param parent The parent folder to list folders and files in * @param monitor the progress monitor + * @since 3.0 renamed from listFoldersAndFiles() */ public IRemoteFile[] list(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException { @@ -926,10 +937,13 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi } /** - * Return a list of all remote folders and files in the given folder. The list is not subsetted. + * Return a list of all remote folders and files in the given folder. The + * list is not subsetted. + * * @param parent The parent folder to list folders and files in * @param fileType the type of file * @param monitor the monitor + * @since 3.0 using int fileType parameter */ public IRemoteFile[] list(IRemoteFile parent, int fileType, IProgressMonitor monitor) throws SystemMessageException { @@ -939,12 +953,15 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi /** * Return a list of remote folders and files in the given folder. *- * The files part of the list is subsetted by the given file name filter. It can be null for no subsetting. + * The files part of the list is subsetted by the given file name filter. It + * can be null for no subsetting. * * @param parent The parent folder to list folders and files in - * @param fileNameFilter The name pattern to subset the file list by, or null to return all files. + * @param fileNameFilter The name pattern to subset the file list by, or + * null to return all files. * @param fileType the type of file * @param monitor the monitor + * @since 3.0 using int fileType parameter */ public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException { @@ -1018,9 +1035,12 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi } /** - * Overrideable Override this method to provide optimized implementation - * Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it. + * Given a set of fully qualified file or folder names, return an + * ISystemResourceSet object for it. Overrideable Override this + * method to provide optimized implementation + * * @param folderOrFileNames Fully qualified folder or file names + * @since 3.0 */ public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames, IProgressMonitor monitor) throws SystemMessageException {