mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 15:45:25 +02:00
[210537] [api] removed Exception throwing from ISystemHostPool
This commit is contained in:
parent
7090a75b05
commit
7d080e18cd
3 changed files with 36 additions and 73 deletions
|
@ -1,5 +1,5 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
|
||||
* Copyright (c) 2002, 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 http://www.eclipse.org/legal/epl-v10.html
|
||||
|
@ -13,6 +13,7 @@
|
|||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
||||
* Martin Oberhuber (Wind River) - [210534] Remove ISystemHostPool.getHostList() and setName()
|
||||
* David Dykstal (IBM) - [210537] removed exception signalling from this interface, no longer needed
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.core.model;
|
||||
|
@ -71,9 +72,8 @@ public interface ISystemHostPool extends IRSEPersistableContainer {
|
|||
* @param hostName IP name or address of the host.
|
||||
* @return IHost object, or null if it failed to create
|
||||
* because the aliasName is not unique. All other errors throw an exception.
|
||||
* @throws Exception if something goes wrong creating the connection.
|
||||
*/
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName) throws Exception;
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName);
|
||||
|
||||
/**
|
||||
* Create a connection object, given all the possible attributes except default userId.
|
||||
|
@ -86,9 +86,8 @@ public interface ISystemHostPool extends IRSEPersistableContainer {
|
|||
* @param description optional description of the connection. Can be null.
|
||||
* @return IHost object, or <code>null</code> if it failed to create
|
||||
* because the aliasName is not unique. All other errors throw an exception.
|
||||
* @throws Exception if something goes wrong creating the connection.
|
||||
*/
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description) throws Exception;
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description);
|
||||
|
||||
/**
|
||||
* Create a connection object, given all the possible attributes.
|
||||
|
@ -102,11 +101,10 @@ public interface ISystemHostPool extends IRSEPersistableContainer {
|
|||
* @param defaultUserId userId to use as the default for the subsystems.
|
||||
* @param defaultUserIdLocation where to set the given default user Id. See IRSEUserIdConstants for values.
|
||||
* @return IHost object, or <code>null</code> if it failed to create
|
||||
* because the aliasName is not unique. All other errors throw an exception.
|
||||
* because the aliasName is not unique.
|
||||
* @see IRSEUserIdConstants
|
||||
* @throws Exception if something goes wrong creating the connection.
|
||||
*/
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) throws Exception;
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation);
|
||||
|
||||
/**
|
||||
* Update an existing connection given the new information.
|
||||
|
@ -125,9 +123,8 @@ public interface ISystemHostPool extends IRSEPersistableContainer {
|
|||
* @param defaultUserId userId to use as the default for the subsystems.
|
||||
* @param defaultUserIdLocation where to set the given default user Id from IRSEUserIdConstants.
|
||||
* @see IRSEUserIdConstants
|
||||
* @throws Exception if something goes wrong updating the connection.
|
||||
*/
|
||||
public void updateHost(IHost conn, IRSESystemType systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) throws Exception;
|
||||
public void updateHost(IHost conn, IRSESystemType systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation);
|
||||
|
||||
/**
|
||||
* Return a connection object, given its alias name.
|
||||
|
@ -185,9 +182,8 @@ public interface ISystemHostPool extends IRSEPersistableContainer {
|
|||
* The alias name is not checked for uniqueness. Clients are responsible
|
||||
* themselves for ensuring that no two connections with the same alias
|
||||
* name (compared case insensitive) are created.
|
||||
* @throws Exception if anything goes wrong renaming the connection.
|
||||
*/
|
||||
public void renameHost(IHost conn, String newName) throws Exception;
|
||||
public void renameHost(IHost conn, String newName);
|
||||
|
||||
/**
|
||||
* Return the zero-based position of a connection object within this host pool.
|
||||
|
@ -211,9 +207,8 @@ public interface ISystemHostPool extends IRSEPersistableContainer {
|
|||
* @param aliasName New, unique, alias name to give this connection. Clone will fail
|
||||
* (returning <code>null</code> as result) if this is not unique.
|
||||
* @return the cloned host, or <code>null</code> if the new alias name was not unique.
|
||||
* @throws Exception if anything goes wrong during cloning.
|
||||
*/
|
||||
public IHost cloneHost(ISystemHostPool targetPool, IHost conn, String aliasName) throws Exception;
|
||||
public IHost cloneHost(ISystemHostPool targetPool, IHost conn, String aliasName);
|
||||
|
||||
/**
|
||||
* Move existing connections a given number of positions in the same pool.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
|
||||
* Copyright (c) 2002, 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 http://www.eclipse.org/legal/epl-v10.html
|
||||
|
@ -20,6 +20,7 @@
|
|||
* Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
|
||||
* David Dykstal (IBM) - [176577] wrong enablement of "Move up/down" in connection context menu
|
||||
* Martin Oberhuber (Wind River) - [206742] Make SystemHostPool thread-safe
|
||||
* David Dykstal (IBM) - [210537] removed exception signalling from this class to match the interface
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.core.model;
|
||||
|
@ -93,22 +94,14 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
/**
|
||||
* Return (and create if necessary) the connection pool for a given system profile.
|
||||
* @param profile the profile to create a host pool for.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static ISystemHostPool getSystemHostPool(ISystemProfile profile)
|
||||
throws Exception
|
||||
{
|
||||
SystemHostPool pool = (SystemHostPool)pools.get(profile);
|
||||
if (pool == null)
|
||||
{
|
||||
pool = new SystemHostPool();
|
||||
pool.setName(profile.getName());
|
||||
try {
|
||||
//FIXME Class Javadocs say that SystemHostPool is not persisted, so this should be removed!
|
||||
//Or should we get the pool contents by restoring the profile instead?
|
||||
pool.restore(); // restore connections
|
||||
} catch (Exception exc) {
|
||||
}
|
||||
pools.put(profile, pool); // store this pool reference, keyed by profile object.
|
||||
}
|
||||
return pool;
|
||||
|
@ -183,7 +176,6 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
* @see org.eclipse.rse.core.model.ISystemHostPool#createHost(org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName)
|
||||
throws Exception
|
||||
{
|
||||
return createHost(systemType,aliasName,hostName,null,null,IRSEUserIdConstants.USERID_LOCATION_HOST);
|
||||
}
|
||||
|
@ -193,7 +185,6 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
* @see org.eclipse.rse.core.model.ISystemHostPool#createHost(org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description)
|
||||
throws Exception
|
||||
{
|
||||
return createHost(systemType,aliasName,hostName,description,null,IRSEUserIdConstants.USERID_LOCATION_HOST);
|
||||
}
|
||||
|
@ -203,8 +194,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
* @see org.eclipse.rse.core.model.ISystemHostPool#createHost(org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int)
|
||||
*/
|
||||
public IHost createHost(IRSESystemType systemType, String aliasName, String hostName,
|
||||
String description,String defaultUserId,int defaultUserIdLocation)
|
||||
throws Exception
|
||||
String description,String defaultUserId,int defaultUserIdLocation)
|
||||
{
|
||||
IHost conn = null;
|
||||
boolean exists = getHost(aliasName) != null;
|
||||
|
@ -212,32 +202,25 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
ISystemProfile profile = getSystemProfile();
|
||||
|
||||
// delegate the creation of the host object instance to the system type provider!!!
|
||||
if (systemType != null) {
|
||||
conn = systemType.createNewHostInstance(profile);
|
||||
}
|
||||
// Fallback to create host object instance here if failed by system type provider.
|
||||
assert conn != null;
|
||||
if (conn == null) conn = new Host(profile);
|
||||
|
||||
addHost(conn); // only record internally if saved successfully
|
||||
conn.setHostPool(this);
|
||||
conn.setAliasName(aliasName);
|
||||
conn.setSystemType(systemType);
|
||||
// if default userID is null, and location is in the connection we should retrieve it and use it as the initial value.
|
||||
if (defaultUserId == null && defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_HOST) {
|
||||
defaultUserId = conn.getDefaultUserId();
|
||||
}
|
||||
updateHost(conn, systemType, aliasName, hostName, description, defaultUserId, defaultUserIdLocation);
|
||||
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
ISystemProfile profile = getSystemProfile();
|
||||
|
||||
// delegate the creation of the host object instance to the system type provider!!!
|
||||
if (systemType != null) {
|
||||
conn = systemType.createNewHostInstance(profile);
|
||||
}
|
||||
// Fallback to create host object instance here if failed by system type provider.
|
||||
assert conn != null;
|
||||
if (conn == null) conn = new Host(profile);
|
||||
|
||||
addHost(conn); // only record internally if saved successfully
|
||||
conn.setHostPool(this);
|
||||
conn.setAliasName(aliasName);
|
||||
conn.setSystemType(systemType);
|
||||
// if default userID is null, and location is in the connection we should retrieve it and use it as the initial value.
|
||||
if (defaultUserId == null && defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_HOST) {
|
||||
defaultUserId = conn.getDefaultUserId();
|
||||
}
|
||||
updateHost(conn, systemType, aliasName, hostName, description, defaultUserId, defaultUserIdLocation);
|
||||
return conn;
|
||||
}
|
||||
|
||||
|
@ -248,7 +231,6 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
public void updateHost(IHost conn, IRSESystemType systemType,
|
||||
String aliasName, String hostName,
|
||||
String description,String defaultUserId, int defaultUserIdLocation)
|
||||
throws Exception
|
||||
{
|
||||
boolean aliasNameChanged = !aliasName.equalsIgnoreCase(conn.getAliasName());
|
||||
if (aliasNameChanged)
|
||||
|
@ -403,7 +385,6 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
* @see org.eclipse.rse.core.model.ISystemHostPool#renameHost(org.eclipse.rse.core.model.IHost, java.lang.String)
|
||||
*/
|
||||
public void renameHost(IHost conn, String newName)
|
||||
throws Exception
|
||||
{
|
||||
//must not change the alias name while a getHost() or orderHosts() is ongoing
|
||||
synchronized(connections) {
|
||||
|
@ -419,7 +400,6 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
* @see org.eclipse.rse.core.model.ISystemHostPool#cloneHost(org.eclipse.rse.core.model.ISystemHostPool, org.eclipse.rse.core.model.IHost, java.lang.String)
|
||||
*/
|
||||
public IHost cloneHost(ISystemHostPool targetPool, IHost conn, String aliasName)
|
||||
throws Exception
|
||||
{
|
||||
IHost copy =
|
||||
targetPool.createHost(conn.getSystemType(), aliasName,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
|
||||
* Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
|
@ -37,6 +37,7 @@
|
|||
* Martin Oberhuber (Wind River) - [194898] Avoid NPE when doing EVENT_REFRESH_REMOTE on a subsys without filters
|
||||
* David McKnight (IBM) - [207100] adding ISystemRegistry.isRegisteredSystemRemoteChangeListener
|
||||
* Martin Oberhuber (Wind River) - [206742] Make SystemHostPool thread-safe
|
||||
* David Dykstal (IBM) - [210537] removed exception handling for SystemHostPool, no longer needed
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.internal.model;
|
||||
|
@ -1333,24 +1334,11 @@ public class SystemRegistry implements ISystemRegistry
|
|||
/**
|
||||
* Return a connection pool given a profile
|
||||
*/
|
||||
private ISystemHostPool getHostPool(ISystemProfile profile)
|
||||
{
|
||||
lastException = null;
|
||||
try
|
||||
{
|
||||
return SystemHostPool.getSystemHostPool(profile);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SystemBasePlugin.logError("Exception in getConnectionPool for " + profile.getName(), exc); //$NON-NLS-1$
|
||||
lastException = exc;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
SystemBasePlugin.logError("Exception in getConnectionPool for " + profile.getName(), t); //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
private ISystemHostPool getHostPool(ISystemProfile profile) {
|
||||
ISystemHostPool result = SystemHostPool.getSystemHostPool(profile);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return connection pools for active profiles. One per.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue