1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 15:15:25 +02:00

[235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile

This commit is contained in:
Martin Oberhuber 2008-06-03 16:41:12 +00:00
parent 966cbeff53
commit 1af6e4de5f
6 changed files with 106 additions and 102 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,23 +7,64 @@
*
* 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:
* {Name} (company) - description of contribution.
* Martin Oberhuber (Wind River) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile
*******************************************************************************/
package org.eclipse.rse.subsystems.files.core.subsystems;
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.servicesubsystem.IFileServiceSubSystemConfiguration;
/**
* Provider interface for implementers of RSE IFileService instances, by which
* they convert their internal service objects into objects suitable for the RSE
* file subsystem.
*
* Must be implemented and returned by overriding the
* {@link IFileServiceSubSystemConfiguration#getHostFileAdapter()} method in the
* contributed concrete file subsystem configuration.
*/
public interface IHostFileToRemoteFileAdapter
{
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes);
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node);
/**
* Convert a list of IHostFile objects from the file service into remote
* file objects. Used to return IRemoteFile[] before RSE 3.0, returns
* AbstractRemoteFile since RSE 3.0.
*
* @param ss The file service subsystem to which the remote files belong.
* @param context The context (connection, subsystem, filter) under which
* the files have been queried.
* @param parent The parent IRemoteFile below which the new nodes should
* appear. Can be <code>null</code> when converting root files.
* @param nodes IHostFile nodes from the file service
* @return an array of converted remote file objects.
*
* @since org.eclipse.rse.subsystems.files.core 3.0
*/
public AbstractRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes);
/**
* Convert a single IHostFile object from the file service into a remote
* file object. Used to return IRemoteFile before RSE 3.0, returns
* AbstractRemoteFile since RSE 3.0.
*
* @param ss The file service subsystem to which the remote files belong.
* @param context The context (connection, subsystem, filter) under which
* the files have been queried.
* @param parent The parent IRemoteFile below which the new nodes should
* appear. Can be <code>null</code> when converting root files.
* @param node IHostFile node from the file service
* @return converted remote file object.
*
* @since org.eclipse.rse.subsystems.files.core 3.0
*/
public AbstractRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node);
}

View file

@ -13,6 +13,7 @@
*
* 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
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.dstore;
@ -20,11 +21,11 @@ package org.eclipse.rse.internal.subsystems.files.dstore;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.dstore.core.model.DataElement;
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;
@ -47,7 +48,7 @@ public class DStoreFileAdapter implements IHostFileToRemoteFileAdapter
}
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
public AbstractRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
{
registerFilePropertyChangeListener(ss);
@ -57,7 +58,7 @@ public class DStoreFileAdapter implements IHostFileToRemoteFileAdapter
{
DStoreHostFile node = (DStoreHostFile)nodes[i];
IRemoteFile lfile = null;
DStoreFile lfile = null;
if (node instanceof DStoreVirtualHostFile)
{
@ -72,16 +73,15 @@ public class DStoreFileAdapter implements IHostFileToRemoteFileAdapter
ss.cacheRemoteFile(lfile);
}
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
return (DStoreFile[]) results.toArray(new DStoreFile[results.size()]);
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node)
public AbstractRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node)
{
registerFilePropertyChangeListener(ss);
IRemoteFile file = null;
DStoreFile file = null;
if (node instanceof DStoreVirtualHostFile)
{
@ -95,33 +95,4 @@ public class DStoreFileAdapter implements IHostFileToRemoteFileAdapter
return file;
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, String name, boolean isDirectory, boolean isRoot)
{
// TODO Auto-generated method stub
return null;
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, Object object)
{
registerFilePropertyChangeListener(ss);
if (object instanceof DataElement)
{
DStoreHostFile hostFile = new DStoreHostFile((DataElement)object);
IRemoteFile file = null;
{
file = new DStoreFile(ss, context, parent, hostFile);
}
ss.cacheRemoteFile(file);
return file;
}
else
{
return null;
}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,12 +7,13 @@
*
* 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) - [207178] changing list APIs for file service and subsystems
* Martin Oberhuber (Wind River) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.ftp.model;
@ -22,6 +23,7 @@ import java.util.List;
import org.eclipse.rse.internal.services.files.ftp.FTPHostFile;
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;
@ -30,36 +32,25 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
public class FTPFileAdapter implements IHostFileToRemoteFileAdapter
{
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
public AbstractRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
{
List results = new ArrayList();
for (int i = 0; i < nodes.length; i++)
for (int i = 0; i < nodes.length; i++)
{
FTPHostFile node = (FTPHostFile)nodes[i];
IRemoteFile ftpFile = new FTPRemoteFile(ss, context, parent, node);
FTPRemoteFile ftpFile = new FTPRemoteFile(ss, context, parent, node);
results.add(ftpFile);
ss.cacheRemoteFile(ftpFile);
}
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, String name, boolean isDirectory, boolean isRoot)
{
return null;
return (FTPRemoteFile[]) results.toArray(new FTPRemoteFile[results.size()]);
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node)
public AbstractRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node)
{
IRemoteFile file = new FTPRemoteFile(ss, context, parent, (FTPHostFile)node);
FTPRemoteFile file = new FTPRemoteFile(ss, context, parent, (FTPHostFile) node);
ss.cacheRemoteFile(file);
return file;
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, Object object)
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -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:
* {Name} (company) - description of contribution.
* Martin Oberhuber (Wind River) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.local.model;
@ -23,6 +23,7 @@ import java.util.List;
import org.eclipse.rse.internal.services.local.files.LocalHostFile;
import org.eclipse.rse.internal.services.local.files.LocalVirtualHostFile;
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;
@ -32,17 +33,17 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
public class LocalFileAdapter implements IHostFileToRemoteFileAdapter
{
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
public AbstractRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
{
if (nodes == null) return null;
List results = new ArrayList();
for (int i = 0; i < nodes.length; i++)
for (int i = 0; i < nodes.length; i++)
{
IHostFile child = nodes[i];
IRemoteFile lfile;
LocalFile lfile;
if (child instanceof LocalVirtualHostFile)
{
LocalVirtualHostFile node = (LocalVirtualHostFile)child;
@ -53,17 +54,17 @@ public class LocalFileAdapter implements IHostFileToRemoteFileAdapter
LocalHostFile node = (LocalHostFile)child;
lfile = new LocalFile(ss, context, parent, node);
}
results.add(lfile);
ss.cacheRemoteFile(lfile);
}
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
return (LocalFile[]) results.toArray(new LocalFile[results.size()]);
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node)
public AbstractRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node)
{
IRemoteFile file = null;
LocalFile file = null;
if (node instanceof LocalVirtualHostFile)
file = new LocalVirtualFile(ss, context, (LocalVirtualHostFile) node);
else file = new LocalFile(ss, context, parent, (LocalHostFile)node);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,12 +7,13 @@
*
* 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) - Adapted from FTPFileAdapter.
* Martin Oberhuber (Wind River) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.ssh;
@ -22,6 +23,7 @@ import java.util.List;
import org.eclipse.rse.internal.services.ssh.files.SftpHostFile;
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;
@ -29,26 +31,22 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
public class SftpFileAdapter implements IHostFileToRemoteFileAdapter {
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes) {
public AbstractRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes) {
List results = new ArrayList();
if (nodes!=null) {
for (int i = 0; i < nodes.length; i++) {
SftpHostFile node = (SftpHostFile)nodes[i];
IRemoteFile remoteFile = new SftpRemoteFile(ss, context, parent, node);
SftpRemoteFile remoteFile = new SftpRemoteFile(ss, context, parent, node);
results.add(remoteFile);
ss.cacheRemoteFile(remoteFile);
}
}
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
return (SftpRemoteFile[]) results.toArray(new SftpRemoteFile[results.size()]);
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, String name, boolean isDirectory, boolean isRoot) {
return null;
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node) {
IRemoteFile file = new SftpRemoteFile(ss, context, parent, (SftpHostFile)node);
public AbstractRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node) {
SftpRemoteFile file = new SftpRemoteFile(ss, context, parent, (SftpHostFile) node);
ss.cacheRemoteFile(file);
return file;
}

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Radoslav Gerganov - derived from SftpFileAdapter
* Martin Oberhuber (Wind River) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.wince;
@ -15,6 +16,7 @@ import java.util.List;
import org.eclipse.rse.internal.services.wince.files.WinCEHostFile;
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;
@ -23,27 +25,27 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
public class WinCEFileAdapter implements IHostFileToRemoteFileAdapter {
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss,
public AbstractRemoteFile convertToRemoteFile(FileServiceSubSystem ss,
IRemoteFileContext context, IRemoteFile parent, IHostFile node) {
IRemoteFile remoteFile = new WinCERemoteFile(ss, context, parent, (WinCEHostFile)node);
WinCERemoteFile remoteFile = new WinCERemoteFile(ss, context, parent, (WinCEHostFile) node);
ss.cacheRemoteFile(remoteFile);
return remoteFile;
}
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss,
public AbstractRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss,
IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes) {
List results = new ArrayList();
if (nodes != null) {
for (int i = 0 ; i < nodes.length ; i++) {
WinCEHostFile node = (WinCEHostFile) nodes[i];
IRemoteFile remoteFile = new WinCERemoteFile(ss, context, parent, node);
WinCERemoteFile remoteFile = new WinCERemoteFile(ss, context, parent, node);
results.add(remoteFile);
ss.cacheRemoteFile(remoteFile);
}
}
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
return (WinCERemoteFile[]) results.toArray(new WinCERemoteFile[results.size()]);
}
}