1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Cleanup comments and interfaces.

Change-Id: Id7bb77b110963314b0daca143eab6a197a4201b0
Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
Greg Watson 2015-02-27 10:08:31 -05:00
parent 1ad2aeddd6
commit 6e5f7a97bd
7 changed files with 361 additions and 58 deletions

View file

@ -11,7 +11,7 @@
package org.eclipse.remote.core;
/**
* A connection type service for connectiont types that have automatic means of adding
* A connection type service for connection types that have automatic means of adding
* and removing services. For example, the Local connection type needs to be able
* to ensure the Local connection is created, or adapters to other target management
* systems may prefer to let those systems manage the connections.

View file

@ -16,7 +16,6 @@ import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.remote.core.exception.RemoteConnectionException;
/**
* A remote connection type manages a list of connections that implement the same services.
* Services may be registered on the individual connections, or at the connection type level
@ -28,11 +27,12 @@ import org.eclipse.remote.core.exception.RemoteConnectionException;
public interface IRemoteConnectionType {
/**
* The interface that is extend by services provided for this remote services implementation.
*
* @since 2.0
*/
interface Service {
IRemoteConnectionType getConnectionType();
interface Factory {
<T extends Service> T getService(IRemoteConnectionType connectionType, Class<T> service);
}
@ -84,9 +84,10 @@ public interface IRemoteConnectionType {
/**
* Get the service for this remote services implementation that implements the given interface.
*
* @param service the interface the required service must implements
* @param service
* the interface the required service must implements
* @return the desired service or null if there is no such service available
* @throws CoreException
* @throws CoreException
* @since 2.0
*/
<T extends Service> T getService(Class<T> service);
@ -94,7 +95,8 @@ public interface IRemoteConnectionType {
/**
* Does this connection type support the given service.
*
* @param service the service to be tested
* @param service
* the service to be tested
* @return true if this connection type supports this service
*/
<T extends Service> boolean hasService(Class<T> service);
@ -106,7 +108,7 @@ public interface IRemoteConnectionType {
* name of the connection (as returned by {@link IRemoteConnection#getName()})
* @return remote connection or null if no connection exists
*/
public IRemoteConnection getConnection(String name);
IRemoteConnection getConnection(String name);
/**
* Gets the remote connection corresponding to the supplied URI.
@ -117,14 +119,14 @@ public interface IRemoteConnectionType {
* is incorrect
* @since 4.0
*/
public IRemoteConnection getConnection(URI uri);
IRemoteConnection getConnection(URI uri);
/**
* Get all the connections for this service provider.
*
* @return connections that we know about
*/
public List<IRemoteConnection> getConnections();
List<IRemoteConnection> getConnections();
/**
* Creates a new remote connection named with supplied name. The connection attributes will be the default for the
@ -140,7 +142,7 @@ public interface IRemoteConnectionType {
* if connection creation failed
* @since 5.0
*/
public IRemoteConnectionWorkingCopy newConnection(String name) throws RemoteConnectionException;
IRemoteConnectionWorkingCopy newConnection(String name) throws RemoteConnectionException;
/**
* Remove a connection and all resources associated with it.
@ -150,6 +152,6 @@ public interface IRemoteConnectionType {
* @throws RemoteConnectionException
* if the connection could not be removed
*/
public void removeConnection(IRemoteConnection connection) throws RemoteConnectionException;
void removeConnection(IRemoteConnection connection) throws RemoteConnectionException;
}

View file

@ -26,7 +26,8 @@ public interface IRemoteServicesManager {
/**
* Get the connection type identified by the id
*
* @param id id of the connection type
* @param id
* id of the connection type
* @return connection type or null if the service can not be found
*/
IRemoteConnectionType getConnectionType(String id);
@ -35,9 +36,10 @@ public interface IRemoteServicesManager {
* Get the connection type that provides connections to locations identified by
* the URI.
*
* @param uri uri of locations to be accessed
* @param uri
* uri of locations to be accessed
* @return the connection type that can be used to access the locations
* or null if no connection type is available for the uri.
* or null if no connection type is available for the uri.
*/
IRemoteConnectionType getConnectionType(URI uri);
@ -49,16 +51,16 @@ public interface IRemoteServicesManager {
IRemoteConnectionType getLocalConnectionType();
/**
* Returns the list of all connection type including the local services.
* Returns the list of all connection types including the local services.
*
* @return all remote services
* @return all connection types
*/
List<IRemoteConnectionType> getAllConnectionTypes();
/**
* Returns the list of connection types except for the local services.
* Returns the list of connection types except for the local connection type.
*
* @return all remote services that are really remote
* @return all connection types that are really remote
*/
List<IRemoteConnectionType> getRemoteConnectionTypes();
@ -72,14 +74,16 @@ public interface IRemoteServicesManager {
/**
* Add a global connection change listener that receives events for all connections.
*
* @param listener global connection change listener to be added
* @param listener
* global connection change listener to be added
*/
void addRemoteConnectionChangeListener(IRemoteConnectionChangeListener listener);
/**
* Remove the global connection change listener.
*
* @param listener global connection change listener to be removed
* @param listener
* global connection change listener to be removed
*/
void removeRemoteConnectionChangeListener(IRemoteConnectionChangeListener listener);
@ -87,7 +91,8 @@ public interface IRemoteServicesManager {
* Used by connections and other components to notify the global connection
* change listeners of events.
*
* @param event connection change event
* @param event
* connection change event
*/
void fireRemoteConnectionChangeEvent(RemoteConnectionChangeEvent event);

View file

@ -40,7 +40,7 @@ public class RemoteConnection implements IRemoteConnection {
private final RemoteConnectionType connectionType;
private String name;
private Map<String, Object> servicesMap = new HashMap<>();
private final Map<String, Object> servicesMap = new HashMap<>();
private final List<IRemoteConnectionChangeListener> fListeners = new ArrayList<>();
@ -51,11 +51,21 @@ public class RemoteConnection implements IRemoteConnection {
this.name = name;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getConnectionType()
*/
@Override
public IRemoteConnectionType getConnectionType() {
return connectionType;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getService(java.lang.Class)
*/
@SuppressWarnings("unchecked")
@Override
public <T extends Service> T getService(Class<T> service) {
@ -71,11 +81,21 @@ public class RemoteConnection implements IRemoteConnection {
return (T) obj;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#hasService(java.lang.Class)
*/
@Override
public <T extends Service> boolean hasService(Class<T> service) {
return servicesMap.get(service.getName()) != null || connectionType.hasConnectionService(this, service);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getName()
*/
@Override
public String getName() {
return name;
@ -84,7 +104,8 @@ public class RemoteConnection implements IRemoteConnection {
/**
* Called from working copy when name has changed.
*
* @param name the new name
* @param name
* the new name
*/
void rename(String newName) throws ConnectionExistsException {
try {
@ -103,7 +124,7 @@ public class RemoteConnection implements IRemoteConnection {
} catch (BackingStoreException e) {
RemoteCorePlugin.log(e);
}
this.name = newName;
}
@ -115,11 +136,21 @@ public class RemoteConnection implements IRemoteConnection {
return connectionType.getSecurePreferencesNode().node(name);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getAttribute(java.lang.String)
*/
@Override
public String getAttribute(String key) {
return getPreferences().get(key, EMPTY_STRING);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getSecureAttribute(java.lang.String)
*/
@Override
public String getSecureAttribute(String key) {
try {
@ -130,11 +161,21 @@ public class RemoteConnection implements IRemoteConnection {
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getWorkingCopy()
*/
@Override
public IRemoteConnectionWorkingCopy getWorkingCopy() {
return new RemoteConnectionWorkingCopy(this);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getProperty(java.lang.String)
*/
@Override
public String getProperty(String key) {
IRemoteConnectionPropertyService propertyService = getService(IRemoteConnectionPropertyService.class);
@ -144,7 +185,12 @@ public class RemoteConnection implements IRemoteConnection {
return null;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#open(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void open(IProgressMonitor monitor) throws RemoteConnectionException {
IRemoteConnectionControlService controlService = getService(IRemoteConnectionControlService.class);
@ -153,6 +199,11 @@ public class RemoteConnection implements IRemoteConnection {
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#close()
*/
@Override
public void close() {
IRemoteConnectionControlService controlService = getService(IRemoteConnectionControlService.class);
@ -161,6 +212,11 @@ public class RemoteConnection implements IRemoteConnection {
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#isOpen()
*/
@Override
public boolean isOpen() {
IRemoteConnectionControlService controlService = getService(IRemoteConnectionControlService.class);
@ -171,17 +227,36 @@ public class RemoteConnection implements IRemoteConnection {
return true;
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.remote.core.IRemoteConnection#addConnectionChangeListener(org.eclipse.remote.core.IRemoteConnectionChangeListener
* )
*/
@Override
public void addConnectionChangeListener(IRemoteConnectionChangeListener listener) {
fListeners.add(listener);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.remote.core.IRemoteConnection#removeConnectionChangeListener(org.eclipse.remote.core.IRemoteConnectionChangeListener
* )
*/
@Override
public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener) {
fListeners.remove(listener);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#fireConnectionChangeEvent(int)
*/
@Override
public void fireConnectionChangeEvent(final int type) {
RemoteConnectionChangeEvent event = new RemoteConnectionChangeEvent(this, type);
@ -192,6 +267,11 @@ public class RemoteConnection implements IRemoteConnection {
connectionType.getRemoteServicesManager().fireRemoteConnectionChangeEvent(event);
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return name + " - " + connectionType.getName(); //$NON-NLS-1$

View file

@ -42,7 +42,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
private final Map<String, Object> serviceMap = new HashMap<>();
private final Map<String, IConfigurationElement> serviceDefinitionMap = new HashMap<>();
private final Map<String, RemoteConnection> connections = new HashMap<>();
public RemoteConnectionType(IConfigurationElement ce, RemoteServicesManager manager) {
@ -57,7 +57,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
} else {
capabilities = 0;
}
// load up existing connections
try {
for (String connectionName : getPreferenceNode().childrenNames()) {
@ -76,31 +76,61 @@ public class RemoteConnectionType implements IRemoteConnectionType {
return remoteServicesManager.getSecurePreferenceNode().node(id);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#getRemoteServicesManager()
*/
@Override
public IRemoteServicesManager getRemoteServicesManager() {
return remoteServicesManager;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#getId()
*/
@Override
public String getId() {
return id;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#getName()
*/
@Override
public String getName() {
return name;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#getScheme()
*/
@Override
public String getScheme() {
return scheme;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#getCapabilities()
*/
@Override
public int getCapabilities() {
return capabilities;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#getService(java.lang.Class)
*/
@Override
public <T extends Service> T getService(Class<T> service) {
String serviceName = service.getName();
@ -124,6 +154,11 @@ public class RemoteConnectionType implements IRemoteConnectionType {
return obj;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#hasService(java.lang.Class)
*/
@Override
public <T extends Service> boolean hasService(Class<T> service) {
String serviceName = service.getName();
@ -133,8 +168,10 @@ public class RemoteConnectionType implements IRemoteConnectionType {
/**
* Called from the connection to get a service object for that connection.
*
* @param connection the connection to which the service applies
* @param service the interface the service must implement
* @param connection
* the connection to which the service applies
* @param service
* the interface the service must implement
* @return the service object
* @throws CoreException
*/
@ -144,7 +181,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
IConfigurationElement ce = serviceDefinitionMap.get(service.getName());
if (ce != null) {
try {
IRemoteConnection.Service.Factory factory = (IRemoteConnection.Service.Factory) ce.createExecutableExtension("factory"); //$NON-NLS-1$
IRemoteConnection.Service.Factory factory = (IRemoteConnection.Service.Factory) ce
.createExecutableExtension("factory"); //$NON-NLS-1$
if (factory != null) {
return factory.getService(connection, service);
}
@ -164,7 +202,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
* Called from the remote service manager to register a service extension for
* this remote services implementation
*
* @param ce the extension element defining the service
* @param ce
* the extension element defining the service
*/
public void addService(IConfigurationElement ce) {
String service = ce.getAttribute("service"); //$NON-NLS-1$
@ -173,22 +212,31 @@ public class RemoteConnectionType implements IRemoteConnectionType {
/**
* Signal connection has been added.
*
* @since 2.0
*/
protected void connectionAdded(final IRemoteConnection connection) {
RemoteConnectionChangeEvent event = new RemoteConnectionChangeEvent(connection, RemoteConnectionChangeEvent.CONNECTION_ADDED);
RemoteConnectionChangeEvent event = new RemoteConnectionChangeEvent(connection,
RemoteConnectionChangeEvent.CONNECTION_ADDED);
remoteServicesManager.fireRemoteConnectionChangeEvent(event);
}
/**
* Signal a connnection is about to be removed.
*
* @since 2.0
*/
protected void connectionRemoved(final IRemoteConnection connection) {
RemoteConnectionChangeEvent event = new RemoteConnectionChangeEvent(connection, RemoteConnectionChangeEvent.CONNECTION_ADDED);
RemoteConnectionChangeEvent event = new RemoteConnectionChangeEvent(connection,
RemoteConnectionChangeEvent.CONNECTION_ADDED);
remoteServicesManager.fireRemoteConnectionChangeEvent(event);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#getConnection(java.lang.String)
*/
@Override
public IRemoteConnection getConnection(String name) {
return connections.get(name);
@ -200,21 +248,31 @@ public class RemoteConnectionType implements IRemoteConnectionType {
if (connection != null) {
return connection;
}
// If it's a file: scheme we must be the local connection type, just return our
// hopefully one connection, the Local connection.
if (uri.getScheme().equals("file") && !connections.isEmpty()) { //$NON-NLS-1$
return connections.values().iterator().next();
}
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#getConnections()
*/
@Override
public List<IRemoteConnection> getConnections() {
return new ArrayList<IRemoteConnection>(connections.values());
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#newConnection(java.lang.String)
*/
@Override
public IRemoteConnectionWorkingCopy newConnection(String name) throws RemoteConnectionException {
if (connections.containsKey(name)) {
@ -231,6 +289,11 @@ public class RemoteConnectionType implements IRemoteConnectionType {
connections.remove(name);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionType#removeConnection(org.eclipse.remote.core.IRemoteConnection)
*/
@Override
public void removeConnection(IRemoteConnection connection) throws RemoteConnectionException {
if (connection instanceof RemoteConnection) {

View file

@ -35,10 +35,10 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
private RemoteConnection original;
private RemoteConnectionType connectionType;
private String newName;
private Map<String, String> newAttributes = new HashMap<>();
private Map<String, String> newSecureAttributes = new HashMap<>();
private List<IRemoteConnectionChangeListener> newListeners = new ArrayList<>();
private final Map<String, String> newAttributes = new HashMap<>();
private final Map<String, String> newSecureAttributes = new HashMap<>();
private final List<IRemoteConnectionChangeListener> newListeners = new ArrayList<>();
/**
* New Connection.
*/
@ -53,7 +53,12 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
public RemoteConnectionWorkingCopy(RemoteConnection original) {
this.original = original;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getName()
*/
@Override
public String getName() {
if (newName != null) {
@ -65,6 +70,11 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setName(java.lang.String)
*/
@Override
public void setName(String name) {
// set if only if it's changed
@ -73,20 +83,30 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getAttribute(java.lang.String)
*/
@Override
public String getAttribute(String key) {
String value = newAttributes.get(key);
if (value != null) {
return value;
}
if (original != null) {
return original.getAttribute(key);
}
return RemoteConnection.EMPTY_STRING;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setAttribute(java.lang.String, java.lang.String)
*/
@Override
public void setAttribute(String key, String value) {
// set only if it's changed or value is null
@ -95,13 +115,18 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getSecureAttribute(java.lang.String)
*/
@Override
public String getSecureAttribute(String key) {
String value = newSecureAttributes.get(key);
if (value != null) {
return value;
}
if (original != null) {
return original.getSecureAttribute(key);
}
@ -109,6 +134,11 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
return RemoteConnection.EMPTY_STRING;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setSecureAttribute(java.lang.String, java.lang.String)
*/
@Override
public void setSecureAttribute(String key, String value) {
// set only if it's changed or value is null
@ -116,7 +146,14 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
newSecureAttributes.put(key, value);
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.remote.core.IRemoteConnection#addConnectionChangeListener(org.eclipse.remote.core.IRemoteConnectionChangeListener
* )
*/
@Override
public void addConnectionChangeListener(IRemoteConnectionChangeListener listener) {
if (original != null) {
@ -126,6 +163,13 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.remote.core.IRemoteConnection#removeConnectionChangeListener(org.eclipse.remote.core.IRemoteConnectionChangeListener
* )
*/
@Override
public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener) {
if (original != null) {
@ -135,6 +179,11 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#fireConnectionChangeEvent(int)
*/
@Override
public void fireConnectionChangeEvent(int type) {
if (original != null) {
@ -148,16 +197,31 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getConnectionType()
*/
@Override
public IRemoteConnectionType getConnectionType() {
return connectionType;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getWorkingCopy()
*/
@Override
public IRemoteConnectionWorkingCopy getWorkingCopy() {
return this;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getService(java.lang.Class)
*/
@Override
public <T extends Service> T getService(Class<T> service) {
if (original != null) {
@ -167,6 +231,11 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#hasService(java.lang.Class)
*/
@Override
public <T extends Service> boolean hasService(Class<T> service) {
if (original != null) {
@ -176,16 +245,31 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#getOriginal()
*/
@Override
public IRemoteConnection getOriginal() {
return original;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#isDirty()
*/
@Override
public boolean isDirty() {
return newName != null || !newAttributes.isEmpty() || !newSecureAttributes.isEmpty();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#save()
*/
@Override
public IRemoteConnection save() throws RemoteConnectionException {
if (newName != null && original != null) {
@ -244,39 +328,54 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
return original;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#open(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void open(IProgressMonitor monitor) throws RemoteConnectionException {
if (original != null) {
original.open(monitor);
} else {
IRemoteConnectionControlService controlService =
connectionType.getConnectionService(this, IRemoteConnectionControlService.class);
IRemoteConnectionControlService controlService = connectionType.getConnectionService(this,
IRemoteConnectionControlService.class);
if (controlService != null) {
controlService.open(monitor);
}
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#close()
*/
@Override
public void close() {
if (original != null) {
original.close();
} else {
IRemoteConnectionControlService controlService =
connectionType.getConnectionService(this, IRemoteConnectionControlService.class);
IRemoteConnectionControlService controlService = connectionType.getConnectionService(this,
IRemoteConnectionControlService.class);
if (controlService != null) {
controlService.close();
}
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#isOpen()
*/
@Override
public boolean isOpen() {
if (original != null) {
return original.isOpen();
} else {
IRemoteConnectionControlService controlService =
connectionType.getConnectionService(this, IRemoteConnectionControlService.class);
IRemoteConnectionControlService controlService = connectionType.getConnectionService(this,
IRemoteConnectionControlService.class);
if (controlService != null) {
return controlService.isOpen();
} else {
@ -285,13 +384,18 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteConnection#getProperty(java.lang.String)
*/
@Override
public String getProperty(String key) {
if (original != null) {
return original.getProperty(key);
} else {
IRemoteConnectionPropertyService propertyService =
connectionType.getConnectionService(this, IRemoteConnectionPropertyService.class);
IRemoteConnectionPropertyService propertyService = connectionType.getConnectionService(this,
IRemoteConnectionPropertyService.class);
if (propertyService != null) {
return propertyService.getProperty(key);
} else {

View file

@ -35,6 +35,7 @@ import org.osgi.service.prefs.Preferences;
/**
* The implementation for the remote services manager service.
*
*/
public class RemoteServicesManager implements IRemoteServicesManager {
@ -109,52 +110,88 @@ public class RemoteServicesManager implements IRemoteServicesManager {
return SecurePreferencesFactory.getDefault().node(RemoteCorePlugin.getUniqueIdentifier()).node("connections"); //$NON-NLS-1$
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#getConnectionType(java.lang.String)
*/
@Override
public IRemoteConnectionType getConnectionType(String id) {
init();
return connectionTypeMap.get(id);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#getConnectionType(java.net.URI)
*/
@Override
public IRemoteConnectionType getConnectionType(URI uri) {
init();
return schemeMap.get(uri.getScheme());
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#getLocalConnectionType()
*/
@Override
public IRemoteConnectionType getLocalConnectionType() {
return getConnectionType(LOCAL_SERVICES_ID);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#getAllConnectionTypes()
*/
@Override
public List<IRemoteConnectionType> getAllConnectionTypes() {
init();
return new ArrayList<IRemoteConnectionType>(connectionTypeMap.values());
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#getRemoteConnectionTypes()
*/
@Override
public List<IRemoteConnectionType> getRemoteConnectionTypes() {
init();
List<IRemoteConnectionType> services = new ArrayList<>(connectionTypeMap.values().size() - 1);
List<IRemoteConnectionType> connTypes = new ArrayList<>(connectionTypeMap.values().size() - 1);
IRemoteConnectionType localServices = getLocalConnectionType();
for (IRemoteConnectionType s : connectionTypeMap.values()) {
if (!s.equals(localServices)) {
services.add(s);
connTypes.add(s);
}
}
return services;
return connTypes;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#getAllRemoteConnections()
*/
@Override
public List<IRemoteConnection> getAllRemoteConnections() {
// TODO do this without getting the connection managers and force loading the plugins
List<IRemoteConnection> connections = new ArrayList<>();
for (IRemoteConnectionType services : getAllConnectionTypes()) {
connections.addAll(services.getConnections());
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
connections.addAll(connType.getConnections());
}
return connections;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#addRemoteConnectionChangeListener(org.eclipse.remote.core.
* IRemoteConnectionChangeListener)
*/
@Override
public void addRemoteConnectionChangeListener(IRemoteConnectionChangeListener listener) {
synchronized (listeners) {
@ -162,6 +199,12 @@ public class RemoteServicesManager implements IRemoteServicesManager {
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#removeRemoteConnectionChangeListener(org.eclipse.remote.core.
* IRemoteConnectionChangeListener)
*/
@Override
public void removeRemoteConnectionChangeListener(IRemoteConnectionChangeListener listener) {
synchronized (listeners) {
@ -169,6 +212,12 @@ public class RemoteServicesManager implements IRemoteServicesManager {
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.remote.core.IRemoteServicesManager#fireRemoteConnectionChangeEvent(org.eclipse.remote.core.
* RemoteConnectionChangeEvent)
*/
@Override
public void fireRemoteConnectionChangeEvent(RemoteConnectionChangeEvent event) {
List<IRemoteConnectionChangeListener> iListeners;