From 1464adb94f9e0639fa308f84f5825bab73b083ac Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Tue, 5 Feb 2008 18:33:54 +0000 Subject: [PATCH] [197036] - filter pools are now created only for the subsystem configurations used during connection creation ASSIGNED - bug 197036: All Filter Pools created on Clean Workspace https://bugs.eclipse.org/bugs/show_bug.cgi?id=197036 --- .../filters/ISystemFilterPoolManager.java | 21 +- .../src/org/eclipse/rse/core/model/IHost.java | 4 +- .../rse/core/model/ISystemProfile.java | 11 +- .../rse/core/model/ISystemProfileManager.java | 11 +- .../rse/core/model/ISystemRegistry.java | 92 +++-- .../core/subsystems/IServiceSubSystem.java | 35 +- .../subsystems/ISubSystemConfiguration.java | 30 +- .../core/filters/SystemFilterPoolManager.java | 340 ++++----------- .../SystemFilterPoolReferenceManager.java | 26 +- .../core/model/ISystemProfileOperation.java | 29 ++ .../internal/core/model/SystemProfile.java | 58 ++- .../core/model/SystemProfileManager.java | 272 +++++++----- .../SubSystemConfigurationProxy.java | 12 +- .../persistence/dom/RSEDOMImporter.java | 37 +- .../FileServiceSubSystem.java | 60 +-- .../RemoteFileSubSystemConfiguration.java | 8 +- .../ProcessServiceSubSystem.java | 42 +- .../ShellServiceSubSystem.java | 47 +-- .../SystemDisconnectAllSubSystemsAction.java | 3 +- ...SystemFilterWorkWithFilterPoolsDialog.java | 18 +- .../ui/view/SystemViewConnectionAdapter.java | 3 +- .../team/SystemTeamViewCategoryAdapter.java | 95 +++-- .../UI/org/eclipse/rse/ui/RSEUIPlugin.java | 37 +- .../rse/ui/internal/model/SystemRegistry.java | 387 +++++++++--------- .../rse/core/subsystems/SubSystem.java | 143 ++++++- .../subsystems/SubSystemConfiguration.java | 140 +++---- 26 files changed, 1008 insertions(+), 953 deletions(-) create mode 100644 rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/ISystemProfileOperation.java diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java index 460fcc39b70..a18ebb374a3 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * 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 @@ -12,7 +12,8 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * David Dykstal (IBM) - [197036] All filter pools created on clean workspace + * cleaned javadoc for renameSystemFilterPool *******************************************************************************/ package org.eclipse.rse.core.filters; @@ -237,19 +238,13 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { public boolean preTestRenameFilterPool(ISystemFilterPool pool) throws Exception; /** - * Rename a given filter pool. Dependending on the save policy, the - * appropriate file or folder on disk will also be renamed. - *

- * Does the following: + * Rename a filter pool. *

- * @param pool The filter pool object to physically rename + * @param pool The filter pool object to rename * @param newName The new name to give the pool */ public void renameSystemFilterPool(ISystemFilterPool pool, String newName) throws Exception; diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IHost.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IHost.java index bf58fcf69f4..10f2672b5b9 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IHost.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IHost.java @@ -13,6 +13,7 @@ * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [206742] Make SystemHostPool thread-safe + * David Dykstal (IBM) - [197036] cleaned javddoc for getConnectorServices() ********************************************************************************/ package org.eclipse.rse.core.model; @@ -261,8 +262,7 @@ public interface IHost extends IAdaptable, IRSEModelObject { void setOffline(boolean value); /** - * Returns all the connector services provided - * for this host + * Returns all the connector services currently configured for this host * @return the connector services */ IConnectorService[] getConnectorServices(); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java index 2b6cc58c01a..0ae70e62ef1 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java @@ -13,11 +13,12 @@ * Contributors: * David Dykstal (IBM) - 142806: refactoring persistence framework * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType + * David Dykstal (IBM) - [197036] removed createHost() shortcut (should use ISystemRegistry), + * cleaned javadoc for getFilterPools() ********************************************************************************/ package org.eclipse.rse.core.model; -import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.persistence.IRSEPersistenceProvider; @@ -46,12 +47,6 @@ public interface ISystemProfile extends IRSEModelObject { */ public ISystemProfileManager getProfileManager(); - /** - * Convenience method for create a new connection within this profile. - * Shortcut for {@link ISystemRegistry#createHost(IRSESystemType,String,String,String)} - */ - public IHost createHost(IRSESystemType systemType, String connectionName, String hostName, String description) throws Exception; - /** * @return The value of the Name attribute */ @@ -81,7 +76,7 @@ public interface ISystemProfile extends IRSEModelObject { public IHost[] getHosts(); /** - * Return all filter pools for this profile + * @return all existing filter pools for this profile. */ public ISystemFilterPool[] getFilterPools(); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfileManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfileManager.java index a3407c6aa52..641023bc7dd 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfileManager.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfileManager.java @@ -11,11 +11,13 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * David Dykstal (IBM) - [197036] added commitSystemProfile operation to interface ********************************************************************************/ package org.eclipse.rse.core.model; +import org.eclipse.core.runtime.IStatus; + /** * Manages a list of SystemProfile objects. System profiles * should be created, deleted, restored, activated, and deactivated though @@ -108,6 +110,13 @@ public interface ISystemProfileManager { * @return the new profile */ public ISystemProfile cloneSystemProfile(ISystemProfile profile, String newName); + + /** + * Commit a system profile + * @param profile the profile to commit + * @return a status object indicating the result of the commit + */ + public IStatus commitSystemProfile(ISystemProfile profile); /** * Get an indication of whether a profile is active or not. diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java index d4a51070009..0a319d29092 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java @@ -20,6 +20,8 @@ * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core * David McKnight (IBM) - [207100] adding ISystemRegistry.isRegisteredSystemRemoteChangeListener + * David Dykstal (IBM) - [197036] adding new createHost and getSubSystemConfigurationsBySYstemType which + * are able to delay the creation of subsystems. ********************************************************************************/ package org.eclipse.rse.core.model; @@ -99,11 +101,26 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie /** * Return all subsystem configurations which support the given system type. - * If the type is null, returns all. + * If the type is null, returns all subsystem confgurations. + * Fully equivalent to getSubSystemConfigurationsBySystemType(systemType, filterDuplicates, true) + * which is preferred since we do not want to load subsystem configurations unless necessary. * @param systemType system type to filter - * @param filterDuplicateServiceSubSystemConfigurations set false by default + * @param filterDuplicates if true and the subsystem configuration uses services then return only one + * subsystem configuration that supports this service. Which configuration is returned is undefined. + * @return an array of subsystem configurations meeting the criteria */ - public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicateServiceSubSystemConfigurations); + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicates); + + /** + * Return all subsystem configurations which support the given system type. + * If the type is null, returns all subsystem confgurations. + * @param systemType system type to filter + * @param filterDuplicates if true and the subsystem configuration uses services then return only one + * subsystem configuration that supports this service. Which configuration is returned is undefined. + * @param activate if true activate the respective configurations if not already active, if false return only those that are already active. + * @return an array of subsystem configurations meeting the criteria + */ + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicates, boolean activate); // ---------------------------------- // SYSTEMVIEWINPUTPROVIDER METHODS... @@ -211,59 +228,52 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie public void setSystemProfileActive(ISystemProfile profile, boolean makeActive); /** - * Return the list of connector services provided for the given host - * @param conn the host + * Return the list of connector services currently configured for the given host + * @param host the host * @return the list of connector services */ - public IConnectorService[] getConnectorServices(IHost conn); + public IConnectorService[] getConnectorServices(IHost host); // ---------------------------- // SUBSYSTEM METHODS... // ---------------------------- /** - * Return list of subsystem objects for a given connection. If the subsystems have - * not all been read into memory, this loads them up + * Return list of subsystem objects for a given host. + * @param host the host for which to return the subsystems that are currently known. + * @return an array of subsystem objects known to this host. */ - public ISubSystem[] getSubSystems(IHost conn); + public ISubSystem[] getSubSystems(IHost host); /** - * Return list of subsystem objects for a given connection. Use the force - * flag to indicate whether or not to restore from disk + * Return list of subsystem objects for a given connection. + * @param host the host for which to return the subsystems that are known. + * @param force if true, force the creation of subsystems for which the system type of this host is configured. + * Use this parameter with care since it can cause extensive initialization. + * @return the list of subsystems known to this host, possibly after the creation of subsystems. + * @deprecated Use {@link #getSubSystems(IHost)} instead, the "force" parameter is now ignored. */ - public ISubSystem[] getSubSystems(IHost conn, boolean force); + public ISubSystem[] getSubSystems(IHost host, boolean force); /** * Get those subsystems that are registered against a given connection, * which are an instance of the given interface class. - *

- * This method activates all subsystem configurations of the given - * host in order to support checking against the given interface. - * If lazy loading is desired, use {@link #getSubSystems(IHost, boolean)} - * with a boolean parameter false instead, and check against - * the class instance in client code. *

- * @param connection the connection to check + * @param host the connection to check * @param subsystemInterface the interface class to filter against * @return list of matching subsystems */ - public ISubSystem[] getSubsystems(IHost connection, Class subsystemInterface); + public ISubSystem[] getSubsystems(IHost host, Class subsystemInterface); /** * Get those subsystems that are registered against a given connection, * which are an instance of ServiceSubSystem for the given serviceType. - *

- * This method activates all subsystem configurations of the given - * host in order to support checking against the given interface. - * If lazy loading is desired, use {@link #getSubSystems(IHost, boolean)} - * with a boolean parameter false instead, and check against - * the class instance in client code. *

- * @param connection the connection to check + * @param host the host to check * @param serviceType the class of service to ask for * @return list of matching subsystems */ - public ISubSystem[] getServiceSubSystems(IHost connection, Class serviceType); + public ISubSystem[] getServiceSubSystems(IHost host, Class serviceType); /** * Resolve a subsystem from it's absolute name @@ -283,10 +293,10 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie /** * Return the absolute name for the specified host (connection) - * @param connection the host (aka connection) object to query + * @param host the host (aka connection) object to query * @return the absolute name of the host */ - public String getAbsoluteNameForConnection(IHost connection); + public String getAbsoluteNameForConnection(IHost host); /** * Get a list of subsystem objects for given connection, owned by a subsystem factory @@ -301,7 +311,7 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie * that are really needed. Then, use {@link ISubSystemConfiguration#getSubSystems(boolean)} * with a parameter true. */ - public ISubSystem[] getSubSystemsBySubSystemConfigurationCategory(String factoryCategory, IHost connection); + public ISubSystem[] getSubSystemsBySubSystemConfigurationCategory(String factoryCategory, IHost host); /** * Delete a subsystem object. This code finds the factory that owns it and @@ -507,6 +517,26 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie public IHost createHost(IRSESystemType systemType, String connectionName, String hostAddress, String description) throws Exception; /** + * Create a host object. The resulting host object is added to the list of existing host objects + * in the specified profile. + * + *

+ * @param profileName Name of the system profile to which the host is to be added. + * @param systemType system type of the new host. + * @param hostName unique host name within the profile. + * @param hostAddress ip name of host. + * @param description optional description of the connection. May be null. + * @param createSubSystems true to create subsystems for the host, false otherwise. + * @return IHost object, or null if it failed to create. This is typically because the hostName is not unique. Call getLastException() if necessary. + * @since 3.0 + */ + public IHost createHost(String profileName, IRSESystemType systemType, String hostName, String hostAddress, String description, boolean createSubSystems) throws Exception; + + /** * Update an existing host given the new information. * This method: *