diff options
Diffstat (limited to 'rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore')
9 files changed, 0 insertions, 1159 deletions
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/Activator.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/Activator.java deleted file mode 100644 index 74a059e79..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/Activator.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - [180519][api] declaratively register adapter factories - ********************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - -import org.eclipse.rse.ui.SystemBasePlugin; -import org.osgi.framework.BundleContext; - - -/** - * The main plugin class to be used in the desktop. - */ -public class Activator extends SystemBasePlugin { - - //The shared instance. - private static Activator plugin; - - /** - * The constructor. - */ - public Activator() { - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - } - - /** - * Returns the shared instance. - */ - public static Activator getDefault() { - return plugin; - } - - protected void initializeImageRegistry() - { - // TODO Auto-generated method stub - } - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFile.java deleted file mode 100644 index 371932f23..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFile.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin - * Martin Oberhuber (Wind River) - [234726] Update IRemoteFile Javadocs - * David McKnight (IBM) - [246897] Wrong canonical path for a symbolic link - * David McKnight (IBM) - [308783] Value in Properties view remains "Pending..." - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - -import org.eclipse.dstore.core.model.DE; -import org.eclipse.dstore.core.model.DataElement; -import org.eclipse.dstore.core.model.DataStore; -import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants; -import org.eclipse.rse.internal.services.dstore.files.DStoreFileService; -import org.eclipse.rse.internal.services.dstore.files.DStoreHostFile; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.AbstractRemoteFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.ui.SystemBasePlugin; - -public class DStoreFile extends AbstractRemoteFile -{ - - private DStoreFileService getDStoreFileService() - { - FileServiceSubSystem ss = (FileServiceSubSystem)_context.getParentRemoteFileSubSystem(); - return (DStoreFileService)ss.getFileService(); - } - - public IRemoteFile getParentRemoteFile() - { - // because this can get called by eclipse from the main thread, and dstore can have problems with main-thread queries, - // this is overridden to provide a parent without doing the actual query - if (this._parentFile == null) - { - if (isRoot()) - { - return null; - } - - IRemoteFile parentFile = null; - - String pathOnly = getParentPath(); - if (pathOnly != null) - { - DStoreFileService fileService = getDStoreFileService(); - IRemoteFileSubSystem ss = _context.getParentRemoteFileSubSystem(); - if (ss != null) - { - - try { - char sep = getSeparatorChar(); - if (pathOnly.length() == 0) - { - return null; - } - else if (pathOnly.equals(getAbsolutePath())) - { - return null; - } - else if (pathOnly.length() == 1) - { - // parentFile is already null - //parentFile = null; - - IHostFile hostParent = fileService.getHostFile(pathOnly); - if (hostParent == null) - { - DataStore ds = _dstoreHostFile.getDataElement().getDataStore(); - DataElement element = ds.createObject(null, IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR, ""); //$NON-NLS-1$ - element.setAttribute(DE.A_VALUE, pathOnly); - - hostParent = new DStoreHostFile(element); - } - parentFile = new DStoreFile((FileServiceSubSystem)ss, _context, (IRemoteFile)null, (DStoreHostFile)hostParent); - } - else if (!(pathOnly.charAt(pathOnly.length()-1)==sep)) - { - DataStore ds = _dstoreHostFile.getDataElement().getDataStore(); - - IHostFile hostParent = fileService.getHostFile(pathOnly); - if (hostParent == null) - { - int nameSep = pathOnly.lastIndexOf(sep); - String parentName = pathOnly; - String parentPath = pathOnly; - if (nameSep > 0) - { - parentName = pathOnly.substring(nameSep + 1); - parentPath = pathOnly.substring(0, nameSep); - if (parentPath.endsWith(":")) //$NON-NLS-1$ - { - parentPath = parentPath + sep; - } - } - else - { - parentName = pathOnly.substring(nameSep + 1); - parentPath = "" + sep; //$NON-NLS-1$ - } - - DataElement element = ds.createObject(null, IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR, parentName); - element.setAttribute(DE.A_VALUE, parentPath); - - hostParent = new DStoreHostFile(element); - } - parentFile = new DStoreFile((FileServiceSubSystem)ss, _context, (IRemoteFile)null, (DStoreHostFile)hostParent); - //parentFile = ss.getRemoteFileObject(pathOnly+sep); - } - else - { - DataStore ds = _dstoreHostFile.getDataElement().getDataStore(); - - - IHostFile hostParent = fileService.getHostFile(pathOnly); - if (hostParent == null) - { - int nameSep = pathOnly.lastIndexOf(sep); - String parentName = pathOnly; - String parentPath = pathOnly; - if (nameSep > 0) - { - parentName = pathOnly.substring(nameSep + 1); - parentPath = pathOnly.substring(0, nameSep); - if (parentPath.endsWith(":")) //$NON-NLS-1$ - { - parentPath = parentPath + sep; - } - } - else - { - parentName = pathOnly.substring(nameSep + 1); - parentPath = "" + sep; //$NON-NLS-1$ - } - - DataElement element = ds.createObject(null, IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR, parentName); - element.setAttribute(DE.A_VALUE, parentPath); - hostParent = new DStoreHostFile(element); - } - parentFile = new DStoreFile((FileServiceSubSystem)ss, _context, (IRemoteFile)null, (DStoreHostFile)hostParent); - - //parentFile = ss.getRemoteFileObject(pathOnly); - } - } catch (Exception e) { - SystemBasePlugin.logError("RemoteFileImpl.getParentRemoteFile()", e); //$NON-NLS-1$ - } - } - } - else - { - } - this._parentFile = parentFile; - } - return this._parentFile; - } - - protected Object clone() throws CloneNotSupportedException { - // TODO Auto-generated method stub - return super.clone(); - } - - protected DStoreHostFile _dstoreHostFile; - public DStoreFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, DStoreHostFile hostFile) - { - super(ss,context, parent, hostFile); - _dstoreHostFile = hostFile; - } - - public void setHostFile(IHostFile hostFile) { - super.setHostFile(hostFile); - _dstoreHostFile = (DStoreHostFile)hostFile; - } - - public boolean isVirtual() - { - DataElement element = _dstoreHostFile.getDataElement(); - String type = element.getType(); - if ( - type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) || - type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) ) - { - return true; - } - return false; - } - - public String getCanonicalPath() - { - String classification = getClassification(); - if (classification != null && classification.startsWith("symbolic link")){ //$NON-NLS-1$ - // special path - use path in classification - int colonIndex = classification.indexOf(":"); - String canonicalPath = classification.substring(colonIndex + 1); - return canonicalPath; - } - return getAbsolutePath(); - } - - public String getClassification() - { - return _dstoreHostFile.getClassification(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileAdapter.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileAdapter.java deleted file mode 100644 index 0a3051301..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileAdapter.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems - * Martin Oberhuber (Wind River) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile - * David McKnight (IBM) - [244765] Invalid thread access during workbench termination - * David McKnight (IBM) - [255699] NPE when filter string doesn't return result in FileServiceSubSystem.list - * David McKnight (IBM) - [190805] [performance][dstore] Right-click > Disconnect on a dstore connection is slow and spawns many Jobs - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.rse.connectorservice.dstore.DStoreConnectorService; -import org.eclipse.rse.internal.services.dstore.files.DStoreHostFile; -import org.eclipse.rse.internal.services.dstore.files.DStoreVirtualHostFile; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.AbstractRemoteFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext; -import org.eclipse.rse.ui.SystemBasePlugin; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; - -public class DStoreFileAdapter implements IHostFileToRemoteFileAdapter -{ - private RemoteFilePropertyChangeListener _listener; - - private void registerFilePropertyChangeListener(FileServiceSubSystem ss) - { - if (_listener != null && _listener.isFinished()){ - _listener = null; - } - if (_listener == null) - { - DStoreConnectorService connectorService = (DStoreConnectorService)ss.getConnectorService(); - IWorkbench wb = PlatformUI.getWorkbench(); - if (!wb.isClosing()) { - Shell shell = SystemBasePlugin.getActiveWorkbenchShell(); - _listener = new RemoteFilePropertyChangeListener(shell, connectorService, connectorService.getDataStore(), ss); - } - } - } - - - public AbstractRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes) - { - registerFilePropertyChangeListener(ss); - - List results = new ArrayList(); - - for (int i = 0; i < nodes.length; i++) - { - DStoreHostFile node = (DStoreHostFile)nodes[i]; - - if (node != null){ - DStoreFile lfile = null; - - if (node instanceof DStoreVirtualHostFile) - { - lfile = new DStoreVirtualFile(ss, context, parent, (DStoreVirtualHostFile) node); - } - else - { - lfile = new DStoreFile(ss, context, parent, node); - } - - results.add(lfile); - ss.cacheRemoteFile(lfile); - } - } - - return (DStoreFile[]) results.toArray(new DStoreFile[results.size()]); - } - - - public AbstractRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node) - { - registerFilePropertyChangeListener(ss); - - DStoreFile file = null; - - if (node instanceof DStoreVirtualHostFile) - { - file = new DStoreVirtualFile(ss, context, parent, (DStoreVirtualHostFile)node); - } - else - { - file = new DStoreFile(ss, context, parent, (DStoreHostFile)node); - } - ss.cacheRemoteFile(file); - return file; - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileSubSystemSearchResultConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileSubSystemSearchResultConfiguration.java deleted file mode 100644 index b9d76d8a5..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileSubSystemSearchResultConfiguration.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API - * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem - * Kevin Doyle (IBM) - [190010] Added cancel() method that will call the search service to cancel - * David McKnight (IBM) - [190010] performance improvement to use caching for dstore search - * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems - * David McKnight (IBM) - [214378] [dstore] remote search doesn't display results sometimes - * David McKnight (IBM) - [261644] [dstore] remote search improvements - * David McKnight (IBM) - [356230] [dstore] remote search sometimes returns incomplete results in view - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.dstore.core.model.DataElement; -import org.eclipse.dstore.extra.DomainEvent; -import org.eclipse.rse.internal.services.dstore.files.DStoreHostFile; -import org.eclipse.rse.internal.services.dstore.search.DStoreSearchResultConfiguration; -import org.eclipse.rse.services.clientserver.SystemSearchString; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.services.search.IHostSearchConstants; -import org.eclipse.rse.services.search.IHostSearchResult; -import org.eclipse.rse.services.search.IHostSearchResultSet; -import org.eclipse.rse.services.search.ISearchService; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.OutputRefresh; -import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext; -import org.eclipse.rse.subsystems.files.core.subsystems.RemoteSearchResultsContentsType; -import org.eclipse.swt.widgets.Display; - -public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchResultConfiguration -{ - - - private FileServiceSubSystem _fileSubSystem; - private IRemoteFile _searchObject; - private List _convertedResults; - - public DStoreFileSubSystemSearchResultConfiguration(IHostSearchResultSet set, Object searchObject, SystemSearchString searchString, ISearchService searchService, IHostFileToRemoteFileAdapter fileAdapter) - { - super(set, searchObject, searchString, searchService); - _searchObject = (IRemoteFile)searchObject; - _fileSubSystem = (FileServiceSubSystem)_searchObject.getParentRemoteFileSubSystem(); - _convertedResults = new ArrayList(); - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#getResultsSize() - */ - public int getResultsSize() - { - DataElement status = getStatusObject(); - if (status != null) - { - return getStatusObject().getNestedSize(); - } - else - { - return 0; - } - } - - public Object[] getResults() - { - List results = getStatusObject().getNestedData(); - if (results != null) - { - if (results.size() > _convertedResults.size()) - { - for (int i = _convertedResults.size(); i < results.size(); i++) - { - DataElement fileNode = (DataElement)results.get(i); - if (fileNode != null && !fileNode.getType().equals("error")) //$NON-NLS-1$ - { - try - { - IHostFile hostFile = new DStoreHostFile(fileNode); - IRemoteFileContext context = _fileSubSystem.getTheDefaultContext(); - IRemoteFile remoteFile = _fileSubSystem.getHostFileToRemoteFileAdapter().convertToRemoteFile(_fileSubSystem, context, null, hostFile); - - List contained = fileNode.getNestedData(); - if (contained != null) - { - IHostSearchResult[] searchResults = new IHostSearchResult[contained.size()]; - // reset the parent of search results to the remote file - for (int c = 0; c < contained.size(); c++) - { - searchResults[c] = new DStoreSearchResult(this, remoteFile, (DataElement)contained.get(c), getSearchString()); - } - remoteFile.setContents(RemoteSearchResultsContentsType.getInstance(), getSearchString().getTextString(), searchResults); - } - _convertedResults.add(remoteFile); - } - catch (Exception e) - { - } - } - } - } - return _convertedResults.toArray(new IRemoteFile[_convertedResults.size()]); - } - else - { - return new IRemoteFile[0]; - } - - } - - public Object getSearchTarget() - { - try - { - return _fileSubSystem.getFileService().getFile(_searchObject.getParentPath(), _searchObject.getName(), null); - } - catch (Exception e) - { - - } - return null; - } - - public void domainChanged(DomainEvent e) - { - if (e.getParent() == _status){ - if (_status.getValue().equals("done")) //$NON-NLS-1$ - { - //setStatus(IHostSearchConstants.FINISHED); // moved to within DelayedDomainListenerRemover - // need to wait for the results though - DelayedDomainListenerRemover remover = new DelayedDomainListenerRemover(this, _status); - remover.start(); - OutputRefresh refresh = new OutputRefresh(this); - Display.getDefault().asyncExec(refresh); - } - else if (_status.getValue().equals("cancelled")) //$NON-NLS-1$ - { - setStatus(IHostSearchConstants.CANCELLED); - _status.getDataStore().getDomainNotifier().removeDomainListener(this); - OutputRefresh refresh = new OutputRefresh(this); - Display.getDefault().asyncExec(refresh); - } - } - } - - public void cancel() - { - if (getStatus() == IHostSearchConstants.RUNNING) - { - getSearchService().cancelSearch(this, new NullProgressMonitor()); - } - } - - private class DelayedDomainListenerRemover extends Thread - { - private DStoreFileSubSystemSearchResultConfiguration _config; - private DataElement _status; - public DelayedDomainListenerRemover(DStoreFileSubSystemSearchResultConfiguration config, DataElement status) - { - _status = status; - _config = config; - } - - public void run() - { - try - { - sleep(5000); - } - catch (Exception e) - { - } - _status.getDataStore().getDomainNotifier().removeDomainListener(_config); - _config.setStatus(IHostSearchConstants.FINISHED); - } - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreJavaLanguageUtility.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreJavaLanguageUtility.java deleted file mode 100644 index e1bc6a053..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreJavaLanguageUtility.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - -import org.eclipse.dstore.core.model.DE; -import org.eclipse.dstore.core.model.DataElement; -import org.eclipse.dstore.core.model.DataStore; -import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants; -import org.eclipse.rse.internal.services.dstore.files.DStoreHostFile; -import org.eclipse.rse.internal.subsystems.files.core.AbstractJavaLanguageUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.ui.SystemBasePlugin; - -/** - * This class is the Java language utility for universal. - */ -public class DStoreJavaLanguageUtility extends AbstractJavaLanguageUtility { - - /** - * Constructor. - * @param subsystem the subsystem with which the utility is associated. - * @param language the language. - */ - public DStoreJavaLanguageUtility(IRemoteFileSubSystem subsystem, String language) { - super(subsystem, language); - } - - /** - * The given remote file must be an instance of <code>DStoreFileImpl</code>. - * @see org.eclipse.rse.internal.subsystems.files.core.IJavaLanguageUtility#getQualifiedClassName(org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile) - */ - public String getQualifiedClassName(IRemoteFile remoteFile) { - - DStoreFile univFile = null; - - if (remoteFile instanceof DStoreFile) { - univFile = (DStoreFile)remoteFile; - } - else { - return null; - } - - DataElement deObj = ((DStoreHostFile)univFile.getHostFile()).getDataElement(); - - DataStore ds = deObj.getDataStore(); - DataElement queryCmd = ds.localDescriptorQuery(deObj.getDescriptor(), IUniversalDataStoreConstants.C_QUERY_QUALIFIED_CLASSNAME); - - if (queryCmd != null) { - DataElement status = ds.synchronizedCommand(queryCmd, deObj, true); - DataElement className = ds.find(status, DE.A_TYPE, IUniversalDataStoreConstants.TYPE_QUALIFIED_CLASSNAME, 1); - - if (className != null && !className.equals("null")) { //$NON-NLS-1$ - return className.getName(); - } - else { - SystemBasePlugin.logWarning("Qualified class name for " + remoteFile.getAbsolutePath() + " is null"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - return null; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreLanguageUtilityFactory.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreLanguageUtilityFactory.java deleted file mode 100644 index fa145af94..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreLanguageUtilityFactory.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.rse.internal.subsystems.files.core.AbstractLanguageUtilityFactory; -import org.eclipse.rse.subsystems.files.core.ILanguageUtility; -import org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - - -/** - * This is a singleton factory class associated each universal subsystem. - */ -public class DStoreLanguageUtilityFactory extends AbstractLanguageUtilityFactory { - - private static Map instances; - - /** - * Constructor. - * @param subsystem the universal subsystem with which this factory is associated. - */ - private DStoreLanguageUtilityFactory(IRemoteFileSubSystem subsystem) { - super(subsystem); - } - - /** - * Returns an instance for each subsystem. Note that there is just a singleton instance for - * each universal subsystem. - * @param subsystem the universal subsystem. - * @return the singleton instance associated with the subsystem. - */ - public static ILanguageUtilityFactory getInstance(IRemoteFileSubSystem subsystem) { - - // initialize map if needed - if (instances == null) { - instances = new HashMap(); - } - - // check if there is a factory for the subsystem already - ILanguageUtilityFactory factory = (ILanguageUtilityFactory)(instances.get(subsystem)); - - // if none, then create the factory, and store the factory for this subsystem - if (factory == null) { - factory = new DStoreLanguageUtilityFactory(subsystem); - instances.put(subsystem, factory); - } - - return factory; - } - - /** - * @see org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory#getUtility(java.lang.String) - */ - public ILanguageUtility getUtility(String language) { - - if (language.equals(ILanguageUtility.LANGUAGE_JAVA)) { - return new DStoreJavaLanguageUtility(getSubSystem(), language); - } - - return null; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreSearchResult.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreSearchResult.java deleted file mode 100644 index 0e00ee104..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreSearchResult.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - - - -import org.eclipse.dstore.core.model.DataElement; -import org.eclipse.rse.services.clientserver.SystemSearchString; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; -import org.eclipse.rse.subsystems.files.core.subsystems.RemoteSearchResult; - -/** - * Class for describing a line of command output on a - * universal system - */ -public class DStoreSearchResult extends RemoteSearchResult -{ - - - public int getLine() - { - String src=_element.getSource(); - int colonIndex = src.indexOf(':'); - if (colonIndex > 2) - { - String srcNum = src.substring(colonIndex + 1); - return Integer.parseInt(srcNum); - } - return 0; - } - - - private DataElement _element; - - public DStoreSearchResult(IHostSearchResultConfiguration configuration, Object parent, DataElement element, SystemSearchString searchString) - { - super(configuration, parent, searchString); - _element = element; - } - - - public String getText() - { - if (_element != null && !_element.isDeleted() && _element.getName() != null) - { - String name = _element.getName(); - setText(name); - return name; - } - else - { - return super.getText(); - } - } - - public void dispose() - { - _element.getDataStore().deleteObject(_element.getParent(), _element); - _element.getParent().removeNestedData(_element); - _element = null; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreVirtualFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreVirtualFile.java deleted file mode 100644 index 249f93ed4..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreVirtualFile.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - -import org.eclipse.rse.internal.services.dstore.files.DStoreVirtualHostFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext; -import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile; - -public class DStoreVirtualFile extends DStoreFile implements IVirtualRemoteFile -{ - - protected DStoreVirtualHostFile _node; - - public DStoreVirtualFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, DStoreVirtualHostFile hostFile) - { - super(ss, context, parent, hostFile); - _node = hostFile; - } - - public String getVirtualName() - { - return _node.getName(); - } - - public boolean isVirtualFolder() - { - return _node.isDirectory(); - } - - public boolean isVirtualFile() - { - return _node.isFile(); - } - - public long getCompressedSize() - { - return _node.getCompressedSize(); - } - - public String getCompressionMethod() - { - return _node.getCompressionMethod(); - } - - public double getCompressionRatio() - { - return _node.getCompressionRatio(); - } - - public long getExpandedSize() - { - return _node.getExpandedSize(); - } - - public String getComment() - { - return _node.getComment(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/RemoteFilePropertyChangeListener.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/RemoteFilePropertyChangeListener.java deleted file mode 100644 index db76b5de9..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/RemoteFilePropertyChangeListener.java +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * 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, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * David McKnight (IBM) - [190805] [performance][dstore] Right-click > Disconnect on a dstore connection is slow and spawns many Jobs - * David McKnight (IBM) - [318501] [dstore] decorator causing main thread queries - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.dstore; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.dstore.core.model.DE; -import org.eclipse.dstore.core.model.DataElement; -import org.eclipse.dstore.core.model.DataStore; -import org.eclipse.dstore.extra.DomainEvent; -import org.eclipse.dstore.extra.IDomainListener; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.events.ISystemResourceChangeEvents; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.CommunicationsEvent; -import org.eclipse.rse.core.subsystems.ICommunicationsListener; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.progress.UIJob; - - - -public class RemoteFilePropertyChangeListener implements IDomainListener, - ICommunicationsListener -{ - - protected DataStore dataStore; - - protected FileServiceSubSystem _fileSubSystem; - - protected Shell shell; - - protected ISystemRegistry _registry; - - protected IConnectorService system; - - protected boolean _networkDown = false; - - protected HashMap _decorateJobs; - - protected boolean _finished = false; - - public class DecorateJob extends UIJob - { - private DataElement[] _files; - private DStoreFile _parentFile; - private boolean _isDone = false; - public DecorateJob(DataElement[] files, DStoreFile parentFile) - { - super(SystemFileResources.RESID_JOB_DECORATEFILES_NAME); - _files= files; - _parentFile = parentFile; - } - - public boolean isDone() - { - return _isDone; - } - - public IStatus runInUIThread(IProgressMonitor monitor) - { - _isDone = false; - IRemoteFile[] children = new IRemoteFile[_files.length]; - try { - for (int i = 0; i < _files.length; i++) - { - DataElement file = _files[i]; - StringBuffer path = new StringBuffer(file.getAttribute(DE.A_VALUE)); - path.append(_fileSubSystem.getSeparatorChar()); - path.append(file.getName()); - - children[i] = _fileSubSystem.getCachedRemoteFile(path.toString()); - } - - _registry.fireEvent(new - org.eclipse.rse.core.events.SystemResourceChangeEvent(children, - ISystemResourceChangeEvents.EVENT_ICON_CHANGE, - _parentFile)); - } - catch (Exception e){} - - _isDone = true; - _decorateJobs.remove(_parentFile); - return Status.OK_STATUS; - } - - } - - public RemoteFilePropertyChangeListener(Shell shell, IConnectorService system, - DataStore dataStore, FileServiceSubSystem fileSS) - { - this.shell = shell; - this._fileSubSystem = fileSS; - - this.dataStore = dataStore; - this.system = system; - this._registry = RSECorePlugin.getTheSystemRegistry(); - system.addCommunicationsListener(this); - dataStore.getDomainNotifier().addDomainListener(this); - _decorateJobs = new HashMap(); - } - - public DataStore getDataStore() - { - return dataStore; - } - - /** - * @see IDomainListener#listeningTo(DomainEvent) - */ - public boolean listeningTo(DomainEvent event) - { - - DataElement parent = (DataElement) event.getParent(); - - if (dataStore == parent.getDataStore()) - { - String dataElementType = parent.getType(); - if (dataElementType != null && - (dataElementType - .equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR) || - dataElementType - .equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR)) - ) - { - return true; - } - else - { - return false; - } - } - - return false; - } - - public void finish() - { - dataStore.getDomainNotifier().removeDomainListener(this); - _finished = true; - } - - public boolean isFinished() - { - return _finished; - } - - /** - * @see IDomainListener#domainChanged(DomainEvent) - */ - public void domainChanged(DomainEvent event) - { - DataElement parent = (DataElement)event.getParent(); - - List children = parent.getNestedData(); - if (children != null) - { - - StringBuffer parentPath = new StringBuffer(parent.getAttribute(DE.A_VALUE)); - parentPath.append(_fileSubSystem.getSeparatorChar()); - parentPath.append(parent.getName()); - DStoreFile parentFile = (DStoreFile) _fileSubSystem.getCachedRemoteFile(parentPath.toString()); - - List toUpdate = new ArrayList(); - for (int i = 0; i < children.size(); i++) - { - - DataElement subject = (DataElement) children.get(i); - String type = subject.getType(); - if (type != null && - (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) || - type.equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR))) - - { - toUpdate.add(subject); - } - } - - if (!toUpdate.isEmpty()) - { - DecorateJob job = getDecorateJob(parentFile); - if (job == null) - { - job = new DecorateJob((DataElement[])toUpdate.toArray(new DataElement[toUpdate.size()]), parentFile); - job.setRule(parentFile); - putDecorateJob(parentFile, job); - job.schedule(1000); - } - - } - } - - } - - protected DecorateJob getDecorateJob(IRemoteFile file) - { - return (DecorateJob)_decorateJobs.get(file); - } - - protected void putDecorateJob(IRemoteFile file, DecorateJob job) - { - _decorateJobs.put(file, job); - } - - - - /** - * @see ICommunicationsListener#communicationsStateChange(CommunicationsEvent) - */ - public void communicationsStateChange(CommunicationsEvent e) - { - if (e.getState() == CommunicationsEvent.CONNECTION_ERROR) - { - _networkDown = true; - } - else if (e.getState() == CommunicationsEvent.BEFORE_DISCONNECT) - { - finish(); - } - } - - /** - * @see org.eclipse.rse.core.subsystems.ICommunicationsListener#isPassiveCommunicationsListener() - */ - public boolean isPassiveCommunicationsListener() - { - return false; - } - -} |