diff options
Diffstat (limited to 'rse/plugins/org.eclipse.rse.core/src/org')
209 files changed, 0 insertions, 38258 deletions
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/AbstractRSESystemType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/AbstractRSESystemType.java deleted file mode 100644 index 073e03673..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/AbstractRSESystemType.java +++ /dev/null @@ -1,187 +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: - * Uwe Stieber (Wind River) - Dynamic system type provider extension. - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - * Martin Oberhuber (Wind River) - [186868] Fix IRSESystemType.testProperty() semantics - ********************************************************************************/ -package org.eclipse.rse.core; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.rse.core.model.Host; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemProfile; -import org.osgi.framework.Bundle; - -/** - * Abstract base class holding core functionality of a system type. - * - * Extenders must override {@link IRSESystemType#getSubsystemConfigurationIds()} - * according to their strategy of finding subsystem configuration id's that - * match their system type. - * - * Extenders may override any other method. - */ -public abstract class AbstractRSESystemType extends PlatformObject implements IRSESystemType { - - protected String id = null; - protected String name = null; - protected String label = null; - protected String description = null; - protected Bundle definingBundle = null; - protected Map properties; - - /** - * Default constructor. - * Only subclasses may call this if set the id, name, label, - * description and properties attributes themselves. - */ - protected AbstractRSESystemType() - { - super(); - } - - /** - * Constructor for an object representing a system type. - * @param id unique id of this system type. Must be system unique. - * @param name a name of this system type to be used for internal checks. - * @param label a user-visible label of this system type. - * May be <code>null</code> and falls back to the name in this case. - * @param description a user-visible description of this system type. - * May be <code>null</code> and falls back to the label in this case. - */ - public AbstractRSESystemType(String id, String name, String label, String description, Bundle definingBundle) - { - super(); - this.id = id; - this.name = name; - this.label = label == null ? name : label; - this.description = description == null ? "" : description; //$NON-NLS-1$ - this.definingBundle = definingBundle; - this.properties = new HashMap(); - } - - /** - * Checks whether two system types are the same. - * - * System types are considered the same if they have the same ID. - */ - public boolean equals(Object obj) { - if (obj instanceof IRSESystemType) { - return id.equals( ((IRSESystemType)obj).getId() ); - } - return false; - } - - /** - * Returns the hashCode for this system type. - * - * The hashCode is the hashCode of its ID. - */ - public int hashCode() { - return id.hashCode(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getId() - */ - public String getId() { - return id; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getLabel() - */ - public String getLabel() { - // For default RSE system types, the UI label is equal to the - // name. Therefore, fallback to the name if the label is not - // explicitly set. - if (label == null) return getName(); - return label; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getName() - */ - public String getName() { - return name; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getDescription() - */ - public String getDescription() { - return description; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getDefiningBundle() - */ - public Bundle getDefiningBundle() { - return definingBundle; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getProperty(java.lang.String) - */ - public String getProperty(String key) { - return (String) (properties.get(key)); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getProperty(java.lang.String, boolean) - */ - public boolean testProperty(String key, boolean expectedValue) { - Object val = properties.get(key); - if (val instanceof String) { - return Boolean.valueOf((String)val).booleanValue() == expectedValue; - } - return false; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#isLocal() - */ - public boolean isLocal() { - return IRSESystemType.SYSTEMTYPE_LOCAL_ID.equals(getId()) - || testProperty(IRSESystemType.PROPERTY_IS_LOCAL, true); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#isLocal() - */ - public boolean isWindows() { - return IRSESystemType.SYSTEMTYPE_WINDOWS_ID.equals(getId()) - || (isLocal() && System.getProperty("os.name").toLowerCase().startsWith("win")) //$NON-NLS-1$ //$NON-NLS-2$ - || testProperty(IRSESystemType.PROPERTY_IS_WINDOWS, true); - } - - public IHost createNewHostInstance(ISystemProfile profile) { - return new Host(profile); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return getLabel() + " (" + getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSECoreRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSECoreRegistry.java deleted file mode 100644 index c3de0597c..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSECoreRegistry.java +++ /dev/null @@ -1,56 +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: - * Uwe Stieber (Wind River) - Added system types provider extension. - *******************************************************************************/ -package org.eclipse.rse.core; - - -/** - * Interface for RSE core registry. Clients should use this interface as the starting point for querying and - * manipulating model objects in the RSE framework. - * - * This interface is not intended to be implemented by clients. - */ -public interface IRSECoreRegistry { - - public static final String PI_RSE_CORE = "org.eclipse.rse.core"; //$NON-NLS-1$ - public static final String PI_SYSTEM_TYPES = "systemTypes"; //$NON-NLS-1$ - public static final String PI_SYSTEM_TYPES_PROVIDER = "systemTypeProviders"; //$NON-NLS-1$ - - /** - * Returns all defined system types. - * - * @return an array of all defined system types. - */ - public IRSESystemType[] getSystemTypes(); - - /** - * Returns a system type object given the name. - * - * @param name the name of the system type - * @return the system type object with the given name, or <code>null</code> if none is found - * - * @deprecated Use {@link #getSystemTypeById(String)}. - */ - public IRSESystemType getSystemType(String name); - - /** - * Returns a system type object given by the id. - * - * @param systemTypeId The system type id. - * @return The system type object with the given id, or <code>null</code> if none is found - */ - public IRSESystemType getSystemTypeById(String systemTypeId); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEPreferenceNames.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEPreferenceNames.java deleted file mode 100644 index 4ac5156ef..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEPreferenceNames.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 - * - * Contributors: - * Kushal Munir (IBM) - Initial API and implementation. - * David Dykstal (IBM) - updated with comments, removed keys that are not to be used globally - ********************************************************************************/ -package org.eclipse.rse.core; - -/** - * These constants define the set of preference names that the RSE core uses. - */ - -/* - * Preference names that are API should be all capitals and have words separated - * by an underscore (that is, "public static final" style). - * Preferences that are not API should using "method name" style. - */ -public interface IRSEPreferenceNames { - - /** - * The key for the value that specifies that queries should be "deferred", that is, run - * when needed and in the background, as nodes are asked for their children. - * This value is not part of the API. - */ - public static final String USE_DEFERRED_QUERIES = "useDeferredQueries"; //$NON-NLS-1$ - - /** - * The key for the default system type. Used when a system type is needed but not declared - * when creating new connections (hosts) and for password determination. - * This value is not part of the API. - */ - public static final String SYSTEMTYPE = "systemtype"; //$NON-NLS-1$ - - /** - * The key for an hash table, encoded as a string, that contains user ids as values - * keyed by some key - usually a system type, a connection name, or a combination of - * a connection name and subsystem. - * This value is not part of the API. - */ - public static final String USERIDPERKEY = "useridperkey"; //$NON-NLS-1$ - - /** - * The key for the string containing the list of active user profiles in alphabetical order. - * As profiles are activated, deactivated, or renamed this string must be modified. - * This value is not part of the API. - */ - public static final String ACTIVEUSERPROFILES = "activeuserprofiles"; //$NON-NLS-1$ - - /** - * The key of the string containing the id of the default persistence provider. - * Value is "DEFAULT_PERSISTENCE_PROVIDER". - * This value is part of the API and may be used to customize products. - */ - public static final String DEFAULT_PERSISTENCE_PROVIDER = "DEFAULT_PERSISTENCE_PROVIDER"; //$NON-NLS-1$ - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemType.java deleted file mode 100644 index 4a89aebd9..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemType.java +++ /dev/null @@ -1,313 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2000, 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: - * Uwe Stieber (Wind River) - Extended system type -> subsystemConfiguration association. - * Martin Oberhuber (Wind River) - [185098] Provide constants for all well-known system types - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - ********************************************************************************/ - -package org.eclipse.rse.core; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.internal.core.model.SystemHostPool; -import org.osgi.framework.Bundle; - -/** - * Interface for a system type. Constants are defined for various system types. - * These constants are kept in sync with definitions in plugin.xml. - * <p> - * This interface is not intended to be implemented by clients. System type - * implementations must subclass {@link AbstractRSESystemType} rather than - * implementing this interface directly. - * </p> - */ -public interface IRSESystemType extends IAdaptable { - - /** - * Linux system type, "Linux". - * @deprecated Use {@link #SYSTEMTYPE_LINUX_ID}. - */ - public static final String SYSTEMTYPE_LINUX = "Linux"; //$NON-NLS-1$ - - /** - * Linux system type, "org.eclipse.rse.systemtype.linux". - */ - public static final String SYSTEMTYPE_LINUX_ID = "org.eclipse.rse.systemtype.linux"; //$NON-NLS-1$ - - /** - * Power Linux type, "Power Linux". - * @deprecated Use {@link #SYSTEMTYPE_POWER_LINUX_ID}. - */ - public static final String SYSTEMTYPE_POWER_LINUX = "Power Linux"; //$NON-NLS-1$ - - /** - * Power Linux type, "org.eclipse.rse.systemtype.linux.power". - */ - public static final String SYSTEMTYPE_POWER_LINUX_ID = "org.eclipse.rse.systemtype.linux.power"; //$NON-NLS-1$ - - /** - * Power Linux type, "zSeries Linux". - * @deprecated Use {@link #SYSTEMTYPE_ZSERIES_LINUX_ID}. - */ - public static final String SYSTEMTYPE_ZSERIES_LINUX = "zSeries Linux"; //$NON-NLS-1$ - - /** - * Power Linux type, "org.eclipse.rse.systemtype.linux.zseries". - */ - public static final String SYSTEMTYPE_ZSERIES_LINUX_ID = "org.eclipse.rse.systemtype.linux.zSeries"; //$NON-NLS-1$ - - /** - * Unix system type, "Unix". - * @deprecated Use {@link #SYSTEMTYPE_UNIX_ID}. - */ - public static final String SYSTEMTYPE_UNIX = "Unix"; //$NON-NLS-1$ - - /** - * Unix system type, "org.eclipse.rse.systemtype.unix". - */ - public static final String SYSTEMTYPE_UNIX_ID = "org.eclipse.rse.systemtype.unix"; //$NON-NLS-1$ - - /** - * AIX system type, "AIX". - * @deprecated Use {@link #SYSTEMTYPE_AIX_ID}. - */ - public static final String SYSTEMTYPE_AIX = "AIX"; //$NON-NLS-1$ - - /** - * AIX system type, "org.eclipse.rse.systemtype.aix". - */ - public static final String SYSTEMTYPE_AIX_ID = "org.eclipse.rse.systemtype.aix"; //$NON-NLS-1$ - - /** - * PASE system type, "PASE". - * @deprecated Use {@link #SYSTEMTYPE_PASE_ID}. - */ - public static final String SYSTEMTYPE_PASE = "PASE"; //$NON-NLS-1$ - - /** - * PASE system type, "org.eclipse.rse.systemtype.PASE". - */ - public static final String SYSTEMTYPE_PASE_ID = "org.eclipse.rse.systemtype.iseries.PASE"; //$NON-NLS-1$ - - /** - * iSeries system type, "iSeries". - * @deprecated Use {@link #SYSTEMTYPE_ISERIES_ID}. - */ - public static final String SYSTEMTYPE_ISERIES = "iSeries"; //$NON-NLS-1$ - - /** - * iSeries system type, "org.eclipse.rse.systemtype.iseries". - */ - public static final String SYSTEMTYPE_ISERIES_ID = "org.eclipse.rse.systemtype.iseries"; //$NON-NLS-1$ - - /** - * Local system type, "Local". - * @deprecated Use {@link #SYSTEMTYPE_LOCAL_ID}. - */ - public static final String SYSTEMTYPE_LOCAL = "Local"; //$NON-NLS-1$ - - /** - * Local system type, "org.eclipse.rse.systemtype.local". - */ - public static final String SYSTEMTYPE_LOCAL_ID = "org.eclipse.rse.systemtype.local"; //$NON-NLS-1$ - - /** - * z/OS system type, "z/OS". - * @deprecated Use {@link #SYSTEMTYPE_ZSERIES_ID}. - */ - public static final String SYSTEMTYPE_ZSERIES = "z/OS"; //$NON-NLS-1$ - - /** - * z/OS system type, "org.eclipse.rse.systemtype.zseries". - */ - public static final String SYSTEMTYPE_ZSERIES_ID = "org.eclipse.rse.systemtype.zseries"; //$NON-NLS-1$ - - /** - * Windows system type, "Windows". - * @deprecated Use {@link #SYSTEMTYPE_WINDOWS_ID}. - */ - public static final String SYSTEMTYPE_WINDOWS = "Windows"; //$NON-NLS-1$ - - /** Windows system type, "org.eclipse.rse.systemtype.windows". */ - public static final String SYSTEMTYPE_WINDOWS_ID = "org.eclipse.rse.systemtype.windows"; //$NON-NLS-1$ - - /** Discovery system type, "org.eclipse.rse.systemtype.discovery". */ - public static final String SYSTEMTYPE_DISCOVERY_ID = "org.eclipse.rse.systemtype.discovery"; //$NON-NLS-1$ - /** FTP Only system type, "org.eclipse.rse.systemtype.ftp". */ - public static final String SYSTEMTYPE_FTP_ONLY_ID = "org.eclipse.rse.systemtype.ftp"; //$NON-NLS-1$ - /** SSH Only system type, "org.eclipse.rse.systemtype.ssh". */ - public static final String SYSTEMTYPE_SSH_ONLY_ID = "org.eclipse.rse.systemtype.ssh"; //$NON-NLS-1$ - /** Telnet Only system type, "org.eclipse.rse.systemtype.telnet". */ - public static final String SYSTEMTYPE_TELNET_ONLY_ID = "org.eclipse.rse.systemtype.telnet"; //$NON-NLS-1$ - - /** - * System type Property Key (value: "isLocal") indicating whether - * a system type is declared in plugin.xml to refers to the local - * system. - * On a the local system, the following properties are expected: - * <ul> - * <li>Subsystem Queries are fast and safe.</li> - * <li>Files in the file system can be converted to java.io.File.</li> - * </ul> - * @see #testProperty(String, boolean) - */ - public static final String PROPERTY_IS_LOCAL = "isLocal"; //$NON-NLS-1$ - - /** - * System type Property Key (value: "isWindows") indicating whether - * a system type is declared in plugin.xml to refers to a Windows - * system. - * <p> - * This is an "aggregate" property consisting of several smaller - * properties like isCaseSensitive. In the future, we'll want more - * fine granular properties to check against. On a Windows system, - * the following properties are expected: - * <ul> - * <li>File system is not case sensitive</li> - * <li>File system has root drives</li> - * <li>Symbolic links are not supported</li> - * <li>"cmd" is used as the default shell, meaning that %envVar% refers to environment variables</li> - * <li>Path separator is backslash (\)</li> - * <li>Line end character is CRLF</li> - * <li>Valid characters in file names and paths as known on Windows</li> - * </ul> - * @see #testProperty(String, boolean) - */ - public static final String PROPERTY_IS_WINDOWS = "isWindows"; //$NON-NLS-1$ - - /** - * System type Property Key (value: "isCaseSensitive") indicating - * whether a given system type is in general case sensitive. - * @see #testProperty(String, boolean) - */ - public static final String PROPERTY_IS_CASE_SENSITIVE = "isCaseSensitive"; //$NON-NLS-1$ - - /** - * Returns the id of the system type. - * @return the id of the system type - */ - public String getId(); - - /** - * Returns the translatable label for use in the UI. - * - * @return The UI label or <code>null</code> if not set. - */ - public String getLabel(); - - /** - * Returns the name of the system type. - * @return the name of the system type - * - * @deprecated Use {@link #getId()} for accessing the unique id or {@link #getLabel()} for the UI label. - */ - public String getName(); - - /** - * Returns the description of the system type. - * @return the description of the system type - */ - public String getDescription(); - - /** - * Returns the property of this system type with the given key. - * <code>null</code> is returned if there is no such key/value pair. - * - * @param key the name of the property to return - * @return the value associated with the given key or <code>null</code> if none - */ - public String getProperty(String key); - - /** - * Tests whether the given boolean property matches the expected value - * for this system type. - * - * Clients can use their own properties with system types, but should - * use reverse DNS notation to qualify their property keys (e.g. - * <code>com.acme.isFoobarSystem</code>. Property keys without qualifying - * namespace are reserved for RSE internal use. - * - * @param key the name of the property to return - * @param expectedValue the expected boolean value of the property. - * @return <code>true</code> if the Property is set on the system type and - * matches the expected value. Returns <code>false</code> if the property - * is not set or does not match. - */ - public boolean testProperty(String key, boolean expectedValue); - - /** - * Tests whether the system type refers to the local system. - * This is a shortcut for - * <pre> - * getId().equals(SYSTEMTYPE_LOCAL_ID) || - * || testProperty(PROPERTY_IS_LOCAL, true) - * </pre> - * See {@link #PROPERTY_IS_LOCAL} for properties expected on - * a Local system. - * Extenders (contributors of custom system types) may override. - * @return true if the system type refers to the local system. - */ - public boolean isLocal(); - - /** - * Tests whether the system type refers to the Windows system. - * This is a shortcut for - * <pre> - * getId().equals(SYSTEMTYPE_WINDOWS_ID) - * || isLocal() && System.getProperty("os.name").toLowerCase().startsWith("win") - * || testProperty(PROPERTY_IS_WINDOWS, true) - * </pre> - * See {@link #PROPERTY_IS_WINDOWS} for properties expected on - * a Windows system. This is an "aggregate" property consisting - * of several smaller properties like isCaseSensitive. In the - * future, we'll want more fine granular properties to check against. - * Extenders (contributors of custom system types) may override. - * @return true if the system type refers to a Windows system. - */ - public boolean isWindows(); - - /** - * Returns the bundle which is responsible for the definition of this system type. - * Typically this is used as a base for searching for images and other files - * that are needed in presenting the system type. - * - * @return the bundle which defines this system type or <code>null</code> if none - */ - public Bundle getDefiningBundle(); - - /** - * Returns a list of fully qualified known subsystem configuration id's that - * this system type wants to be registered against. - * More subsystem configurations can be added through the <tt>subsystemConfigurations</tt> - * extension point. - * <p> - * <b>Note:</b> The list returned here does not imply that the corresponding - * subsystem configurations exist. The list contains only possibilites not, - * requirements. - * - * @return The list of subsystem configuration id's. May be empty, - * but never <code>null</code>. - */ - public String[] getSubsystemConfigurationIds(); - - /** - * Creates a new <code>IHost</code> object instance. This method is - * called from {@link SystemHostPool#createHost(IRSESystemType, String, String, String, String, int)}. - * - * @param profile The system profile to associate with the host. - * @return A new <code>IHost</code> object instance. - */ - public IHost createNewHostInstance(ISystemProfile profile); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemTypeConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemTypeConstants.java deleted file mode 100644 index 8d5c78568..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemTypeConstants.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006 IBM Corporation. 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 - * - * Contributors: - * Kushal Munir (IBM) - Initial API and implementation. - ********************************************************************************/ -package org.eclipse.rse.core; - -/** - * These constants define the set of properties that the UI expects to - * be available via <code>IRSESystemType.getProperty(String)</code>. - * - * @see org.eclipse.rse.core.IRSESystemType#getProperty(String) - */ -public interface IRSESystemTypeConstants { - - public static final String ICON = "icon"; //$NON-NLS-1$ - public static final String ICON_LIVE = "iconLive"; //$NON-NLS-1$ - public static final String ENABLE_OFFLINE = "enableOffline"; //$NON-NLS-1$ -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemTypeProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemTypeProvider.java deleted file mode 100644 index 8d7d86acc..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemTypeProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 Wind River Systems, Inc. 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 - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation. - ********************************************************************************/ -package org.eclipse.rse.core; - -import org.eclipse.rse.internal.core.RSECoreRegistry; - -/** - * Dynamic RSE system types provider interface. - * - * See also extension point <code>org.eclipse.rse.core.systemTypeProviders</code> - * - * Clients may implement this interface. - * - * @since RSE 2.0 - */ -public interface IRSESystemTypeProvider { - - /** - * Returns a list of possible RSE system types to register - * at initialization of the RSE core system. The method will - * be called only once for each provider from {@link RSECoreRegistry}. - * The list of the returned RSE system types will be checked - * for duplicates (via the system type id). Duplicates will - * be dropped. - * - * Returned system types should be subclasses of {@link AbstractRSESystemType}. - * - * @return The list of RSE system types to register or <code>null</code>. - */ - public IRSESystemType[] getSystemTypesForRegistration(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEUserIdConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEUserIdConstants.java deleted file mode 100644 index 00b3bed8a..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEUserIdConstants.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2000, 2006 IBM Corporation. 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.core; - -/** - * Constants for user id management. Used when specifying the scope of a user id when - * setting a user id. - */ -public interface IRSEUserIdConstants { - - /** - * Value 0. Location of user id has not yet been set. Used only as a return value. - */ - public static final int USERID_LOCATION_NOTSET = 0; - - /** - * Value 1. Location of user id is scoped to the connector service inside the host. - */ - public static final int USERID_LOCATION_CONNECTORSERVICE = 1; - - /** - * Value 2. Location of user id is scoped to the host, sometimes call "connection". - */ - public static final int USERID_LOCATION_HOST = 2; - - /** - * Value 3. Location of user id is scoped to system type. It will be the default - * for all hosts of this system type that do not have a specified user id assigned. - */ - public static final int USERID_LOCATION_DEFAULT_SYSTEMTYPE = 3; - - /** - * Value 4. Location of user id is scoped to workspace. - */ - public static final int USERID_LOCATION_DEFAULT_OVERALL = 4; - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/ISystemResourceListener.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/ISystemResourceListener.java deleted file mode 100644 index b10bbbe42..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/ISystemResourceListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 IBM Corporation. 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. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ -package org.eclipse.rse.core; - -import org.eclipse.core.resources.IResourceChangeListener; - -public interface ISystemResourceListener extends IResourceChangeListener -{ - public void ensureOnResourceEventListening(); - public void turnOffResourceEventListening(); - public void turnOnResourceEventListening(); - public void addResourceChangeListener(IResourceChangeListener l); - public void removeResourceChangeListener(IResourceChangeListener l); - - - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java deleted file mode 100644 index b523f44a4..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java +++ /dev/null @@ -1,654 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - moved from core package in the UI plugin - * - updated to use new RSEPreferencesManager - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - ********************************************************************************/ - -package org.eclipse.rse.core; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.model.SystemSignonInformation; -import org.eclipse.rse.internal.core.RSECoreMessages; - - -/** - * PasswordPersistenceManager manages the saving and retreiving of user ID / passwords - * to the Eclipse keyring for registered system types. - * - * @author yantzi - */ -public class PasswordPersistenceManager { - - // Keys used for using the Platform authorization methods - // The server url is generic so we can lookup all registered user IDs / passwords - // to display to the user in the password information preference page - private static final String SERVER_URL = "file://rse"; //$NON-NLS-1$ - - private static final String AUTH_SCHEME = ""; // no authorization scheme specified for apis //$NON-NLS-1$ - - // Add return codes - public static final int RC_OK = 0; - public static final int RC_ALREADY_EXISTS = 1; - public static final int RC_ERROR = -1; - - // Default System Type, on a lookup if the specified system type and hostname is not found - // then the call will automatically lookup the default system type and hostname - public static final IRSESystemType DEFAULT_SYSTEM_TYPE = new DefaultSystemType(); - - // Default user name - public static final String DEFAULT_USER_NAME = "DEFAULT_USER"; //$NON-NLS-1$ - - // New URL to store password map - private String newURL = null; - - /* - * Singleton instance - */ - private static PasswordPersistenceManager _instance; - - /* - * Instance variables - */ - private RegisteredSystemType[] systemTypes; - - /** - * Default System Type - */ - private static class DefaultSystemType extends AbstractRSESystemType implements IRSESystemType - { - private static final String DEFAULT_ID = "DEFAULT"; //$NON-NLS-1$ - private DefaultSystemType() { - super(DEFAULT_ID, DEFAULT_ID, RSECoreMessages.DefaultSystemType_Label, null, null); - } - public String getId() { - //TODO consider a space character at the beginning to ensure uniqueness - return DEFAULT_ID; - } - public String[] getSubsystemConfigurationIds() { - return null; - } - public Object getAdapter(Class adapter) { - return null; - } - } - - /** - * Inner class used for storing registered system types - */ - private class RegisteredSystemType - { - private IRSESystemType _systemType; - private boolean _userIDCaseSensitive; - - protected RegisteredSystemType(IRSESystemType systemType, boolean caseSensitive) - { - _systemType = systemType; - _userIDCaseSensitive = caseSensitive; - } - - /** - * Returns the system type. - * @return the system type. - */ - public IRSESystemType getSystemType() { - return _systemType; - } - - /** - * Returns whether the user ID is case sensitive. - * @return <code>true</code> if the user ID is case sensitive, <code>false</code> otherwise. - */ - public boolean isUserIDCaseSensitive() { - return _userIDCaseSensitive; - } - } - - /** - * Singleton so private constructor - */ - private PasswordPersistenceManager(){ - String userName = System.getProperty("user.name"); //$NON-NLS-1$ - - if (userName == null) { - userName = DEFAULT_USER_NAME; - } - - newURL = SERVER_URL + userName; - } - - /** - * Retrieve the singleton isntance of the PasswordPersistenceManger - */ - public static final synchronized PasswordPersistenceManager getInstance() - { - if (_instance == null) - { - _instance = new PasswordPersistenceManager(); - _instance.initExtensions(); - } - return _instance; - } - - /* - * initialization - * - read password file - * - load IPasswordEncryptionProvider instances - */ - private void initExtensions() - { - IRSESystemType[] sysTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes(); - systemTypes = new RegisteredSystemType[sysTypes.length]; - - for (int i = 0; i < sysTypes.length; i++) { - systemTypes[i] = new RegisteredSystemType(sysTypes[i], true); - } - } - - /** - * Remove the entry from the keyring that matches the systemtype, hostname and - * user ID from the SystemSignonInfo parameter. - */ - public void remove(SystemSignonInformation info) - { - remove(info.getSystemType(), info.getHostname(), info.getUserId()); - } - - /** - * Remove the entry from the keyring that matches the hostname, userid and - * system type parameters. - * @param systemtype the systemType - * @param hname the connection name - * @param userid the user id - */ - public void remove(IRSESystemType systemtype, String hname, String userid) - { - String hostname = hname;//RSEUIPlugin.getQualifiedHostName(hname); - // Convert userid to upper case if required - if (!isUserIDCaseSensitive(systemtype)) - { - userid = userid.toUpperCase(); - } - - Map passwords = getPasswordMap(systemtype); - - if (passwords != null) - { - if (removePassword(passwords, hostname, userid)) - { - savePasswordMap(systemtype.getId(), passwords); - } - } - else - { - // yantzi: RSE6.2 check for default system type entry with this hostname and user ID - if (!DEFAULT_SYSTEM_TYPE.equals(systemtype)) - { - remove(DEFAULT_SYSTEM_TYPE, hostname, userid); - } - } - } - - /** - * Check if a password entry exists for the specified system type, hostname - * and userid. - */ - public boolean passwordExists(IRSESystemType systemtype, String hostname, String userid) - { - - return passwordExists(systemtype, hostname, userid, true); - } - - /** - * Check if a password entry exists for the specified system type, hostname - * and userid. - * - * @param systemtype The system type to check for. - * @param hname The hostname to check for. - * @param userid The user ID to check for. - * @param checkDefault Whether or not to check for a default system type if the specified system type is not found. - */ - public boolean passwordExists(IRSESystemType systemtype, String hname, String userid, boolean checkDefault) - { - String hostname = hname;//RSEUIPlugin.getQualifiedHostName(hname); - return (find(systemtype, hostname, userid) != null); - } - - /** - * Add a new persisted password to the password database. This method assumes - * the encrypted password is already stored in the SystemSignonInformation - * parameter. - * - * @param info The signon information to store - * @param overwrite Whether to overwrite any existing entry - * - * @return - * RC_OK if the password was successfully stored - * RC_ALREADY_EXISTS if the password already exists and overwrite was false - */ - public int add(SystemSignonInformation info, boolean overwrite) - { - return add(info, overwrite, false); - } - - /** - * Add a new persisted password to the password database. This method assumes - * the encrypted password is already stored in the SystemSignonInformation - * parameter. - * - * @param info The signon information to store - * @param overwrite Whether to overwrite any existing entry - * @param updateDefault Whether or not to update the default entry for the specified hostname / user ID if one exists. - * - * @return - * RC_OK if the password was successfully stored - * RC_ALREADY_EXISTS if the password already exists and overwrite was false - */ - public int add(SystemSignonInformation info, boolean overwrite, boolean updateDefault) - { - IRSESystemType systemtype = info.getSystemType(); - - // Convert userid to upper case if required - if (!isUserIDCaseSensitive(systemtype)) - { - info.setUserId(info.getUserId().toUpperCase()); - } - - String hostname = info.getHostname(); - String userid = info.getUserId(); - Map passwords = getPasswordMap(systemtype); - String passwordKey = getPasswordKey(hostname, userid); - - if (passwords != null) - { - String password = getPassword(passwords, hostname, userid); - - if (password != null) - { - if (!overwrite) - { - return RC_ALREADY_EXISTS; - } - else - { - removePassword(passwords, hostname, userid); - } - } - else if (updateDefault) - { - // yantzi: 6.2, check if default exists for the specified hostname / user ID - Map defaultPasswords = getPasswordMap(DEFAULT_SYSTEM_TYPE); - if (defaultPasswords != null) - { - String defaultPassword = (String) defaultPasswords.get(passwordKey); - if (defaultPassword != null) - { - if (!overwrite) - { - return RC_ALREADY_EXISTS; - } - else - { - defaultPasswords.remove(passwordKey); - passwords = defaultPasswords; - systemtype = DEFAULT_SYSTEM_TYPE; - } - } - } - } - } - else - { - // password map did not exists yet so create a new one - passwords = new HashMap(5); - } - - passwords.put(passwordKey, info.getPassword()); - - savePasswordMap(systemtype.getId(), passwords); - - return RC_OK; - } - - - /* - * Retrieve the password map from the keyring for the specified system type - */ - private Map getPasswordMap(IRSESystemType systemType) - { - Map passwords = null; - String systemTypeId = systemType.getId(); - - try - { - URL serverURL = new URL(newURL); - passwords = Platform.getAuthorizationInfo(serverURL, systemTypeId, AUTH_SCHEME); - - // if no passwords found with new URL, check old URL - if (passwords == null) { - - URL oldServerURL1 = new URL(SERVER_URL + ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); - passwords = Platform.getAuthorizationInfo(oldServerURL1, systemTypeId, AUTH_SCHEME); - - // passwords found, so migrate to using new URL - if (passwords != null) { - savePasswordMap(systemTypeId, passwords); - } - // if still no passwords found, check with even older URL - else { - URL oldServerURL2 = new URL(SERVER_URL); - passwords = Platform.getAuthorizationInfo(oldServerURL2, systemTypeId, AUTH_SCHEME); - - // passwords found, so migrate to using new URL - if (passwords != null) { - savePasswordMap(systemTypeId, passwords); - } - } - } - } - catch (MalformedURLException e) { - RSECorePlugin.getDefault().getLogger().logError("PasswordPersistenceManager.getPasswordMap", e); //$NON-NLS-1$ - } - - return passwords; - } - - /* - * Retrieve the password map from the keyring for the specified system type - */ - private void savePasswordMap(String systemTypeId, Map passwords) - { - try - { - URL serverURL = new URL(newURL); - Platform.flushAuthorizationInfo(serverURL, systemTypeId, AUTH_SCHEME); - Platform.addAuthorizationInfo(serverURL, systemTypeId, AUTH_SCHEME, passwords); - } - catch (MalformedURLException e) { - RSECorePlugin.getDefault().getLogger().logError("PasswordPersistenceManager.savePasswordMap", e); //$NON-NLS-1$ - } - catch (CoreException e) { - RSECorePlugin.getDefault().getLogger().logError("PasswordPersistenceManager.savePasswordMap", e); //$NON-NLS-1$ - } - } - - /** - * Find the persisted password for the specified systemtype, hostname and userid. - */ - public SystemSignonInformation find(IRSESystemType systemtype, String hostname, String userid) - { - return find(systemtype, hostname, userid, true); - } - - - private boolean removePassword(Map passwords, String hostname, String userid) - { - boolean removed = false; - String password = null; - - String passwordKey = getPasswordKey(hostname, userid); - password =(String) passwords.get(passwordKey); - if (password != null) - { - passwords.remove(passwordKey); - removed = true; - } - else - { - String phostname = hostname.toUpperCase(); - - // DKM - fallback for different case uids, hostnames or qualified/unqualified hostnames - Iterator keys = passwords.keySet().iterator(); - while (keys.hasNext() && password == null) - { - String key = (String)keys.next(); - if (key.equalsIgnoreCase(passwordKey)) - { - password = (String) passwords.get(key); - } - else - { - String khostname = getHostnameFromPasswordKey(key).toUpperCase(); - String kuid = getUserIdFromPasswordKey(key); - if (kuid.equalsIgnoreCase(userid)) - { - // uid matches, check if hosts are the same - if (khostname.startsWith(phostname) || phostname.startsWith(khostname)) - { - String qkhost = RSECorePlugin.getQualifiedHostName(khostname); - String qphost = RSECorePlugin.getQualifiedHostName(phostname); - if (qkhost.equals(qphost)) - { - password = (String)passwords.get(key); - } - } - } - } - if (password != null) - { - passwords.remove(key); - removed = true; - - } - } - } - return removed; - - } - - private String getPassword(Map passwords, String hostname, String userid) - { - String password = null; - - String passwordKey = getPasswordKey(hostname, userid); - password =(String) passwords.get(passwordKey); - if (password != null) - return password; - - String phostname = hostname.toUpperCase(); - - // DKM - fallback for different case uids, hostnames or qualified/unqualified hostnames - Iterator keys = passwords.keySet().iterator(); - while (keys.hasNext() && password == null) - { - String key = (String)keys.next(); - if (key.equalsIgnoreCase(passwordKey)) - { - password = (String) passwords.get(key); - } - else - { - String khostname = getHostnameFromPasswordKey(key).toUpperCase(); - String kuid = getUserIdFromPasswordKey(key); - if (kuid.equalsIgnoreCase(userid)) - { - // uid matches, check if hosts are the same - if (khostname.startsWith(phostname) || phostname.startsWith(khostname)) - { - String qkhost = RSECorePlugin.getQualifiedHostName(khostname); - String qphost = RSECorePlugin.getQualifiedHostName(phostname); - if (qkhost.equals(qphost)) - { - password = (String)passwords.get(key); - } - } - } - } - } - - return password; - - } - - /** - * Find the persisted password for the specified systemtype, hostname and userid. - * - * @param systemtype The system type to check for. - * @param hname The hostname to check for. - * @param userid The user ID to check for. - * @param checkDefault Whether or not to check for a default system type if the specified system type is not found. - */ - public SystemSignonInformation find(IRSESystemType systemtype, String hname, String userid, boolean checkDefault) - { - String hostname = hname;//RSEUIPlugin.getQualifiedHostName(hname); - // Convert userid to upper case if required - if (!isUserIDCaseSensitive(systemtype) && userid != null) - { - userid = userid.toUpperCase(); - } - - Map passwords = getPasswordMap(systemtype); - - if (passwords != null) - { - String password = getPassword(passwords, hostname, userid); - - if (password != null) - { - return new SystemSignonInformation(hostname, userid, password, systemtype); - } - } - - // yantzi: RSE6.2 check for default system type entry with this hostname and user ID - if (checkDefault && !DEFAULT_SYSTEM_TYPE.equals(systemtype)) - { - return find(DEFAULT_SYSTEM_TYPE, hostname, userid, false); - } - - return null; - } - - /** - * Helper class for building the key to lookup the password for a specific - * userid and hostname in the Map - */ - private String getPasswordKey(String hname, String userid) - { - String hostname = hname;//RSEUIPlugin.getQualifiedHostName(hname); - StringBuffer buffer = new StringBuffer(hostname); - buffer.append("//"); //$NON-NLS-1$ - buffer.append(userid); - return buffer.toString(); - } - - private static String getHostnameFromPasswordKey(String passwordKey) - { - int sepIndex = passwordKey.indexOf("//"); //$NON-NLS-1$ - return passwordKey.substring(0,sepIndex); - } - - private static String getUserIdFromPasswordKey(String passwordKey) - { - int sepIndex = passwordKey.indexOf("//"); //$NON-NLS-1$ - return passwordKey.substring(sepIndex + 2, passwordKey.length()); - } - - /** - * Helper method for determining if system type uses case sensitive user IDs - */ - public boolean isUserIDCaseSensitive(IRSESystemType systemType) - { - // First find the correct provider - for (int i = 0; i < systemTypes.length; i++) - { - - if (systemTypes[i].getSystemType().equals(systemType)) - { - return systemTypes[i].isUserIDCaseSensitive(); - } - } - - //Not found: Default system type is case sensitive - return true; - } - - /** - * Retrieve the list of registered system types - */ - public IRSESystemType[] getRegisteredSystemTypes() - { - // yantzi: artemis 6.2, added default system type to list - IRSESystemType[] types = new IRSESystemType[systemTypes.length + 1]; - - types[0] = DEFAULT_SYSTEM_TYPE; - - for (int i = 0; i < systemTypes.length; i++) - { - types[i + 1] = systemTypes[i].getSystemType(); - } - - return types; - } - - /** - * Retrieve a list of the stored user IDs. - * - * @return List A list of the stored user IDs as SystemSignonInformation instances - * without the saved passwords. - */ - public List getSavedUserIDs() - { - List savedUserIDs = new ArrayList(); - Map passwords; - String key; - int separator; - - for (int i = 0; i < systemTypes.length; i++) - { - passwords = getPasswordMap(systemTypes[i].getSystemType()); - if (passwords != null) - { - Iterator keys = passwords.keySet().iterator(); - while (keys.hasNext()) - { - key = (String) keys.next(); - separator = key.indexOf("//"); //$NON-NLS-1$ - savedUserIDs.add(new SystemSignonInformation(key.substring(0, separator), // hostname - key.substring(separator + 2), // userid - systemTypes[i].getSystemType())); // system type - } - } - } - - // yantzi: RSE 6.2 Get DEFAULT system types too - passwords = getPasswordMap(DEFAULT_SYSTEM_TYPE); - if (passwords != null) - { - Iterator keys = passwords.keySet().iterator(); - while (keys.hasNext()) - { - key = (String) keys.next(); - separator = key.indexOf("//"); //$NON-NLS-1$ - savedUserIDs.add(new SystemSignonInformation(key.substring(0, separator), // hostname - key.substring(separator + 2), // userid - DEFAULT_SYSTEM_TYPE)); // system type - } - } - - return savedUserIDs; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java deleted file mode 100644 index 6c1633c33..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java +++ /dev/null @@ -1,305 +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: - * David Dykstal (IBM) - added utility method for finding qualifiedHostNames - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186525] Move keystoreProviders to core - * Martin Oberhuber (Wind River) - [181939] Deferred class loading for keystoreProviders - * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods - * Martin Oberhuber (Wind River) - [160293] NPE on startup when only Core feature is installed - ********************************************************************************/ -package org.eclipse.rse.core; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Arrays; -import java.util.Vector; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.rse.core.comm.SystemKeystoreProviderManager; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; -import org.eclipse.rse.internal.core.RSECoreRegistry; -import org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxy; -import org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxyComparator; -import org.eclipse.rse.internal.persistence.RSEPersistenceManager; -import org.eclipse.rse.logging.Logger; -import org.eclipse.rse.logging.LoggerFactory; -import org.eclipse.rse.persistence.IRSEPersistenceManager; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; - -/** - * RSECorePlugin provides the activation for the RSE core and acts as the primary - * registry for logging, persistence, and the main RSE service registries. - * It should not be extended by other classes. - */ -public class RSECorePlugin extends Plugin { - - /** - * Current release as a number (multiplied by 100). E.g. 300 is for release 3.0.0 - */ - public static final int CURRENT_RELEASE = 200; // updated to new release - - /** - * Current release as a string. - */ - public static final String CURRENT_RELEASE_NAME = "2.0.0"; //$NON-NLS-1$ - - private static RSECorePlugin plugin = null; // the singleton instance of this plugin - private Logger logger = null; - private ISystemRegistry _registry = null; - private IRSEPersistenceManager _persistenceManager = null; - private ISubSystemConfigurationProxy[] _subsystemConfigurations = null; - - /** - * Returns the singleton instance of RSECorePlugin. - * @return the singleton instance. - */ - public static RSECorePlugin getDefault() { - return plugin; - } - - /** - * A static convenience method - fully equivalent to - * <code>RSECorePlugin.getDefault().getPersistenceManager()</code>. - * @return the persistence manager currently in use for RSE - */ - public static IRSEPersistenceManager getThePersistenceManager() { - return getDefault().getPersistenceManager(); - } - - /** - * A static convenience method - fully equivalent to - * <code>RSECorePlugin.getDefault().getRegistry()</code>. - * @return the RSE Core Registry. - */ - public static IRSECoreRegistry getTheCoreRegistry() { - return getDefault().getCoreRegistry(); - } - - /** - * A static convenience method - fully equivalent to - * <code>RSECorePlugin.getDefault().getSystemRegistry()</code>. - * @return the RSE System Registry. - */ - public static ISystemRegistry getTheSystemRegistry() { - return getDefault().getSystemRegistry(); - } - - /** - * @return the IP host name of this machine - */ - public static String getLocalMachineName() { - String machineName = null; - try { - machineName = InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - getDefault().log(e); - } - return machineName; - } - - /** - * @return the local IP address of this machine - */ - public static String getLocalMachineIPAddress() { - String machineAddress = null; - try { - machineAddress = InetAddress.getLocalHost().getHostAddress(); - } catch (UnknownHostException e) { - getDefault().log(e); - } - return machineAddress; - } - - /** - * Returns a qualified host name given a potentially unqualified host name - */ - public static String getQualifiedHostName(String hostName) { - try { - InetAddress address = InetAddress.getByName(hostName); - return address.getCanonicalHostName(); - } catch (UnknownHostException exc) { - return hostName; - } - } - - /** - * The constructor. This may be called only by plugin activation. - */ - public RSECorePlugin() { - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - logger = LoggerFactory.getLogger(this); - registerKeystoreProviders(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - LoggerFactory.freeLogger(this); - logger = null; - plugin = null; - } - - /** - * @return the persistence manager used for persisting RSE profiles - */ - public IRSEPersistenceManager getPersistenceManager() { - if (_persistenceManager == null) { - _persistenceManager = new RSEPersistenceManager(_registry); - } - return _persistenceManager; - } - - /** - * Sets the system registry. This is the main registry that can be used by RSE components - * that require a user interface. This should be set only by RSE startup components and - * not by any external client. - * @param registry the implementation of ISystemRegistry that the core should remember. - */ - public void setSystemRegistry(ISystemRegistry registry) { - _registry = registry; - } - - /** - * Gets the system registry set by {@link #setSystemRegistry(ISystemRegistry)}. - * This registry is used to gain access to the basic services and components used in - * the RSE user interface. - * @return the RSE system registry - */ - public ISystemRegistry getSystemRegistry() { - return _registry; - } - - /** - * Returns the RSE core registry. Clients should use this method to get the registry which - * is the starting point for working with the RSE framework. It contains methods to access - * core services and components. It is distinct from, and more basic than, an implementation - * of ISystemRegistry. - * <p> - * This may return null if the registry has not yet been set. - * @return the RSE core registry. - */ - public IRSECoreRegistry getCoreRegistry() { - return RSECoreRegistry.getInstance(); - } - - /** - * Returns an instance of the logger being used by the core. All core services, or extensions to - * core services, should use this logger to log any messages. The RSE logger provides run-time - * filtering according to user preference and uses the platform's logging capabilities. RSE services - * should use this logger rather than a platform logger. The logger is defined at plugin start and - * should always be available. - * @return the instance of System#Logger used by the core RSE - */ - public Logger getLogger() { - return logger; - } - - /** - * Log an unexpected exception that occurs during the functioning of this class. - * @param t the exception to log - */ - private void log(Throwable t) { - getLogger().logError("Unexpected Exception", t); //$NON-NLS-1$ - } - - /** - * Register declared keystore providers. - */ - private void registerKeystoreProviders() - { - // Get reference to the plug-in registry - IExtensionRegistry registry = Platform.getExtensionRegistry(); - - // Get configured extenders - IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.core", "keystoreProviders"); //$NON-NLS-1$ //$NON-NLS-2$ - - for (int i = 0; i < systemTypeExtensions.length; i++) - { - // get the name space of the declaring extension - String nameSpace = systemTypeExtensions[i].getDeclaringExtension().getNamespaceIdentifier(); - String keystoreProviderType = systemTypeExtensions[i].getAttribute("class"); //$NON-NLS-1$ - - // use the name space to get the bundle - Bundle bundle = Platform.getBundle(nameSpace); - if (bundle.getState() != Bundle.UNINSTALLED) - { - SystemKeystoreProviderManager.getInstance().registerKeystoreProvider(bundle, keystoreProviderType); - } - } - } - - /** - * Return all elements that extend the org.eclipse.rse.core.subsystemConfigurations extension point - */ - private IConfigurationElement[] getSubSystemConfigurationPlugins() - { - // Get reference to the plug-in registry - IExtensionRegistry registry = Platform.getExtensionRegistry(); - // Get configured extenders - IConfigurationElement[] subsystemConfigurationExtensions = - registry.getConfigurationElementsFor("org.eclipse.rse.core","subsystemConfigurations"); //$NON-NLS-1$ //$NON-NLS-2$ - - return subsystemConfigurationExtensions; - } - - /** - * Return an array of SubSystemConfigurationProxy objects. - * These represent all extensions to our subsystemConfigurations extension point. - */ - public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxies() - { - if (_subsystemConfigurations != null) // added by PSC - return _subsystemConfigurations; - - IConfigurationElement[] factoryPlugins = getSubSystemConfigurationPlugins(); - if (factoryPlugins != null) - { - Vector v = new Vector(); - for (int idx=0; idx<factoryPlugins.length; idx++) - { - SubSystemConfigurationProxy ssf = - new SubSystemConfigurationProxy(factoryPlugins[idx]); - - v.addElement(ssf); - } - if (v.size() != 0) - { - _subsystemConfigurations = new ISubSystemConfigurationProxy[v.size()]; - for (int idx=0; idx<v.size(); idx++) - _subsystemConfigurations[idx] = (ISubSystemConfigurationProxy)v.elementAt(idx); - } - Arrays.sort(_subsystemConfigurations, new SubSystemConfigurationProxyComparator()); - } - - return _subsystemConfigurations; - } - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEPreferencesManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEPreferencesManager.java deleted file mode 100644 index 083a3d337..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEPreferencesManager.java +++ /dev/null @@ -1,456 +0,0 @@ -/******************************************************************************** - * Copyright (c) 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 - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - ********************************************************************************/ -package org.eclipse.rse.core; - -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.SortedSet; -import java.util.StringTokenizer; -import java.util.TreeSet; - -import org.eclipse.core.runtime.Preferences; - -public class RSEPreferencesManager { - - /** - * Used as a suffix when combined with the system type name to produce the key for the enabled value. - */ - private static final String ST_ENABLED = "systemType.enabled"; //$NON-NLS-1$ - /** - * Used as a suffix when combined with the system type name to produce the key for the default user id value. - */ - private static final String ST_DEFAULT_USERID = "systemType.defaultUserId"; //$NON-NLS-1$ - /** - * The default value for using deferred queries. Value is <code>true</code>. - */ - private static final boolean DEFAULT_USE_DEFERRED_QUERIES = true; - /** - * The default value for the name of the team profile. Value is "Team". - */ - private static final String DEFAULT_TEAMPROFILE = "Team"; //$NON-NLS-1$ - /** - * The default value for the list of active user profiles. Value is "Team". - */ - private static final String DEFAULT_ACTIVEUSERPROFILES = "Team"; //$NON-NLS-1$ - - /** - * @return the Hashtable where the key is a string identifying a particular object, and - * the value is the user ID for that object. - * @see #setUserId(String, String) - */ - private static Hashtable getUserIds() { - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - Hashtable userIds = null; - String value = store.getString(IRSEPreferenceNames.USERIDPERKEY); - if (value != null) { - userIds = parseString(value); - } else { - userIds = new Hashtable(); - } - return userIds; - } - - /** - * Store the user ids that are saved keyed by some key. - * @param userIds A Hashtable of userids. - * @see #setUserId(String, String) - */ - private static void setUserIds(Hashtable userIds) { - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - String userIdsString = makeString(userIds); - store.setValue(IRSEPreferenceNames.USERIDPERKEY, userIdsString); - savePreferences(); - } - - /** - * Retrieves a user id given a key. - * @param key the key from which to get the particular user id. - * @return user ID for the given key or null if the key was not found. - * @see #setUserId(String, String) - */ - public static String getUserId(String key) { - String uid = null; - Hashtable userIds = getUserIds(); - uid = (String) userIds.get(key); - return uid; - } - - /** - * Clears the user ID for the given key. - * @param key the key for the user id. - * @see #setUserId(String, String) - */ - public static void clearUserId(String key) { - Hashtable userIds = getUserIds(); - if (userIds.containsKey(key)) { - userIds.remove(key); - setUserIds(userIds); - } - } - - /** - * Sets the user Id for this key. - * The key typically designates a scope for this userid so that a hierarchy - * of user ids can be maintained for inheritance. - * For example, hosts have greater scope than subsystems. - * A key would typically be <profile-name>.<host-name>, - * or <profile-name>.<host-type>, - * or <profile-name>.<host-name>.<subsystem-name>. - * @param key the key used to find the userId - * @param userId the userId to retrieve by this key. - */ - public static void setUserId(String key, String userId) { - if ((key != null) && (userId != null)) { - Hashtable userIds = getUserIds(); - String storedUserId = (String) userIds.get(key); - if (storedUserId == null || !storedUserId.equals(userId)) { // don't bother updating if its already there - userIds.put(key, userId); - setUserIds(userIds); - } - } - } - - /** - * Gets the default user id for a given system type. - * @param systemType the systemtype for which to retrieve the default user id - * @return The default user id - */ - public static String getDefaultUserId(IRSESystemType systemType) { - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - String key = getSystemTypePreferencesKey(systemType, RSEPreferencesManager.ST_DEFAULT_USERID); - if (!store.contains(key)) { - store.setDefault(key, System.getProperty("user.name")); //$NON-NLS-1$ - } - String result = store.getString(key); - return result; - } - - /** - * Sets the default userId for the given system type. - * @param systemType the system type for which to set the default - * @param userId the default user id for this system type. - * This may be null to "unset" the default. - */ - public static void setDefaultUserId(IRSESystemType systemType, String userId) { - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - String key = getSystemTypePreferencesKey(systemType, RSEPreferencesManager.ST_DEFAULT_USERID); - store.setValue(key, userId); - savePreferences(); - } - - /** - * Gets the system type values table for editing. This is a synthesized preference - * that is handled as a single value. Rows are separated by semi-colons. - * Each row is of the format <systemTypeId>=<enabled>+<defaultUserId>; - * @return the table of system types formatted as a single string - */ - public static String getSystemTypeValues() { - IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes(); - StringBuffer buffer = new StringBuffer(100); - for (int i = 0; i < systemTypes.length; i++) { - IRSESystemType systemType = systemTypes[i]; - buffer.append(systemType.getId()); - buffer.append('='); - buffer.append(getIsSystemTypeEnabled(systemType)); - buffer.append('+'); - buffer.append(getDefaultUserId(systemType)); - buffer.append(';'); - } - String result = buffer.toString(); - return result; - } - - /** - * Sets the default user id and enabled state for all system types. - * @param systemTypeValues a tabled encoded as a string that contains - * entries for each system type. See {@link #getSystemTypeValues()} for the - * table format. - */ - public static void setSystemTypeValues(String systemTypeValues) { - IRSECoreRegistry registry = RSECorePlugin.getTheCoreRegistry(); - Hashtable table = parseString(systemTypeValues); - Enumeration e = table.keys(); - while (e.hasMoreElements()) { - String key = (String) e.nextElement(); - String compoundValue = (String) table.get(key); - String[] values = compoundValue.split("\\+"); //$NON-NLS-1$ - String isEnabled = values[0]; - String defaultUserId = values[1]; - IRSESystemType systemType = registry.getSystemTypeById(key); - setIsSystemTypeEnabled(systemType, isEnabled.equals("true")); //$NON-NLS-1$ - setDefaultUserId(systemType, defaultUserId); - } - } - - /** - * Sets if a system type is enabled. - * @param systemType the system type to be enabled on this machine. - * @param isEnabled the enabled state - */ - public static void setIsSystemTypeEnabled(IRSESystemType systemType, boolean isEnabled) { - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - String key = getSystemTypePreferencesKey(systemType, RSEPreferencesManager.ST_ENABLED); - if (!store.contains(key)) { - store.setDefault(key, true); - } - store.setValue(key, isEnabled); - savePreferences(); - } - - /** - * Gets the enabled state for a particular system type. - * @param systemType the system type - * @return the enabled state of that type - */ - public static boolean getIsSystemTypeEnabled(IRSESystemType systemType) { - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - String key = getSystemTypePreferencesKey(systemType, RSEPreferencesManager.ST_ENABLED); - if (!store.contains(key)) { - store.setDefault(key, true); - } - boolean result = store.getBoolean(key); - return result; - } - - private static String getSystemTypePreferencesKey(IRSESystemType systemType, String preference) { - String key = systemType.getId() + "." + preference; //$NON-NLS-1$ - return key; - } - - /** - * @return the names of the profiles the user has elected to make active. - */ - public static String[] getActiveProfiles() { - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - String value = store.getString(IRSEPreferenceNames.ACTIVEUSERPROFILES); - String[] result = parseStrings(value); - return result; - } - - /** - * Sets the names of the profiles the user has elected to make "active". - * The caller must also save the preferences when completing. - * @see SystemPreferencesManager#savePreferences() - * @param newProfileNames an array of profile names considered to be active. - */ - private static void setActiveProfiles(String[] newProfileNames) { - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - store.setValue(IRSEPreferenceNames.ACTIVEUSERPROFILES, makeString(newProfileNames)); - savePreferences(); - } - - /** - * Add a name to the active profile list. - * A name already in the list is not added again. - * The list remains sorted in the natural order. - * @param newName a new active profile name - */ - public static void addActiveProfile(String newName) { - SortedSet names = new TreeSet(Arrays.asList(getActiveProfiles())); - names.add(newName); - String[] newNames = new String[names.size()]; - names.toArray(newNames); - RSEPreferencesManager.setActiveProfiles(newNames); - savePreferences(); - } - - /** - * Delete one of the active profile names in the list of names stored in the registry. - * @param oldName the name of the profile to remove from the active profiles list. - */ - public static void deleteActiveProfile(String oldName) { - String[] names = getActiveProfiles(); - int matchPos = -1; - for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) { - if (names[idx].equalsIgnoreCase(oldName)) { - matchPos = idx; - names[idx] = null; - } - } - if (matchPos >= 0) { - RSEPreferencesManager.setActiveProfiles(names); - savePreferences(); - } - } - - /** - * @param profileName the name of the profile to search for in the list of active profiles. - * @return the zero-based position of a give profile name in the active list - */ - public static int getActiveProfilePosition(String profileName) { - String[] names = getActiveProfiles(); - int matchPos = -1; - for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) { - if (names[idx].equalsIgnoreCase(profileName)) matchPos = idx; - } - return matchPos; - } - - /** - * Renames one of the active profile names in the list of names stored in the registry. - * This is usually employed after renaming a profile to ensure that the active names - * list stays in synch with the actual profile names. The active state of the profiles - * cannot be kept in the profiles themselves since that can vary from workspace to workspace - * for profiles that are shared in a team. - * @param oldName the old name of the profile - * @param newName the new name of the profile - */ - public static void renameActiveProfile(String oldName, String newName) { - // update active profile name list - String[] names = getActiveProfiles(); - int matchPos = -1; - for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) { - if (names[idx].equalsIgnoreCase(oldName)) { - matchPos = idx; - names[idx] = newName; - } - } - if (matchPos >= 0) { - RSEPreferencesManager.setActiveProfiles(names); - savePreferences(); - } - } - - public static void initDefaults() { - String defaultProfileNames = RSEPreferencesManager.DEFAULT_ACTIVEUSERPROFILES; - String userProfileName = getDefaultPrivateSystemProfileName(); - defaultProfileNames += ";" + userProfileName; //$NON-NLS-1$ - Preferences store = RSECorePlugin.getDefault().getPluginPreferences(); - store.setDefault(IRSEPreferenceNames.ACTIVEUSERPROFILES, defaultProfileNames); - store.setDefault(IRSEPreferenceNames.USE_DEFERRED_QUERIES, RSEPreferencesManager.DEFAULT_USE_DEFERRED_QUERIES); - savePreferences(); - } - - /** - * Save the preference store. - */ - private static void savePreferences() { - RSECorePlugin.getDefault().savePluginPreferences(); - } - - /** - * @return The name of the default private system profile. This - * is typically the short name of the host machine or the name of the - * user account. - */ - public static String getDefaultPrivateSystemProfileName() { - String name = RSECorePlugin.getLocalMachineName(); - if (name != null) { - int i = name.indexOf('.'); - if (i > 0) { - name = name.substring(0, i); - } - } - if (name == null) { - name = System.getProperty("user.name"); //$NON-NLS-1$ - } - return name; - } - - /** - * @return the name of the default team system profile. - */ - public static String getDefaultTeamProfileName() { - String name = RSEPreferencesManager.DEFAULT_TEAMPROFILE; - return name; - } - - /** - * Convert table of key-value pairs into a single string. Each (name, value) pair is - * encoded as "name=value;" thus no keys or values in the string may - * contain semi-colons or equal signs. - * @param table a Hashtable to convert - * @return the string containing the converted table - */ - private static String makeString(Hashtable table) { - Enumeration keys = table.keys(); - StringBuffer sb = new StringBuffer(20 * table.size()); - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - String value = (String) table.get(key); - if ((value != null) && (value.length() > 0)) { - sb.append(key); - sb.append('='); - sb.append(value); - sb.append(';'); - } - } - return sb.toString(); - } - - /** - * Make a single string out of an array of strings. A semi-colon is - * used as a delimiter between the separate values. No value in the - * array can contain a semi-colon. - * @param values the array of strings to condense into a single one - * @return the condensed string - */ - private static String makeString(String[] values) { - StringBuffer allValues = new StringBuffer(20 * values.length); - for (int idx = 0; idx < values.length; idx++) { - if (values[idx] != null) { - if (idx > 0) { - allValues = allValues.append(';'); - } - allValues.append(values[idx]); - } - } - return allValues.toString(); - } - - /** - * Parse out list of multiple values into a string array per value. - * This is the inverse of the {@link #makeString(String[])} operation. - * @param allvalues the string holding the condensed value - * @return the reconstituted array of strings. - */ - private static String[] parseStrings(String allvalues) { - if (allvalues == null) return new String[0]; - String[] tokens = allvalues.split(";"); //$NON-NLS-1$ - return tokens; - } - - /** - * Parse out list of key-value pairs into a hashtable. This is the inverse of the - * {@link SystemPreferencesManager#makeString(Hashtable)} operation. - * @param allValues the string containing the key-value pairs. If empty or null returns - * and empty Hashtable. - * @return the reconstituted Hashtable - */ - private static Hashtable parseString(String allValues) { - Hashtable keyValues = new Hashtable(10); - if (allValues != null) { - StringTokenizer tokens = new StringTokenizer(allValues, "=;"); //$NON-NLS-1$ - int count = 0; - String token1 = null; - String token2 = null; - while (tokens.hasMoreTokens()) { - count++; - if ((count % 2) == 0) // even number - { - token2 = tokens.nextToken(); - keyValues.put(token1, token2); - } else - token1 = tokens.nextToken(); - } - } - return keyValues; - } - - /* - * Having this method private disables instance creation. - */ - private RSEPreferencesManager() { - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RemoteSystemsTempProjectNature.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RemoteSystemsTempProjectNature.java deleted file mode 100644 index 477629376..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RemoteSystemsTempProjectNature.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2003, 2007 IBM Corporation. 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.core; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.runtime.CoreException; - -/** - * A nature for the temporary project where we store files. - */ -public class RemoteSystemsTempProjectNature implements IProjectNature { - - - - /** - * @see org.eclipse.core.resources.IProjectNature#configure() - */ - public void configure() throws CoreException { - } - - /** - * @see org.eclipse.core.resources.IProjectNature#deconfigure() - */ - public void deconfigure() throws CoreException { - } - - /** - * @see org.eclipse.core.resources.IProjectNature#getProject() - */ - public IProject getProject() { - return null; - } - - /** - * @see org.eclipse.core.resources.IProjectNature#setProject(IProject) - */ - public void setProject(IProject project) { - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemRemoteObjectMatcher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemRemoteObjectMatcher.java deleted file mode 100644 index 3bc67dc03..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemRemoteObjectMatcher.java +++ /dev/null @@ -1,590 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2001, 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) - [175262] IHost.getSystemType() should return IRSESystemType - * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin - * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods - ********************************************************************************/ - -package org.eclipse.rse.core; -import java.util.StringTokenizer; -import java.util.Vector; - -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider; -import org.eclipse.rse.core.subsystems.ISubSystem; - - -/** - * This class encapsulates all the criteria required to identify a match on a remote - * system object, and the methods to determine if a given input meets that criteria. - * <ol> - * <li>subsystemconfigurationid. For scoping to remote objects for a given subsystem configuration - * <li>subsystemconfigurationCategory. For scoping to remote objects for a given subsystem configuration category. - * <li>systemTypes. For scoping to remote objects from systems of a given type, or semicolon-separated types. - * <li>category. For scoping to remote objects of a given type category - * <li>namefilter. For scoping to remote objects of a given name - * <li>typefilter. For scoping to remote objects of a given type - * <li>subtypefilter. For scoping to remote objects of a given subtype - * <li>subsubtypefilter. For scoping to remote objects of a given sub-subtype - * </ol> - * <p> - * The names given can be scalar or very simple generic (begin or end with an asterisk). - * Occasionally, as with iSeries objects types, an asterisk is a valid part of the - * name, as in *PGM. If "*PGM" is specified for the type filter, then it would match - * on other types too, like *SRVPGM. To solve this special case, users can specify - * the following to tell us that the asterisk is to be taken literally, versus as a - * leading or trailing wild card: - * <pre><code> - * "%%ast.PGM" or "%%ast;PGM" - * </code></pre> - * <p> - * The special symbol "%%ast." is resolved into an asterisk as part of the literal name. - * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider - */ -public class SystemRemoteObjectMatcher -{ - public static final String STAR_SYMBOL = "%ast."; //$NON-NLS-1$ - public static final String STAR_SYMBOL2 = "%ast;"; // really should have been this I think. //$NON-NLS-1$ - public static final int STAR_SYMBOL_LEN = 5; - private String categoryfilter, subsystemfilter,subsystemCategoryFilter, systypesfilter, namefilter,typefilter,subtypefilter,subsubtypefilter; - private String categoryfilterpart, subsystemfilterpart,subsystemCategoryFilterpart,namefilterpart,typefilterpart,subtypefilterpart,subsubtypefilterpart; - private boolean allSSFCategories = false; - private boolean allCategories = false; - private boolean allNames = false; - private boolean allTypes = false; - private boolean allSubTypes = false; - private boolean allSubSubTypes = false; - private boolean allSubSystems = false; - private boolean allSystemTypes = false; - - private boolean genericSSFCategoriesStart = false; - private boolean genericCategoriesStart = false; - private boolean genericNamesStart = false; - private boolean genericTypesStart = false; - private boolean genericSubTypesStart = false; - private boolean genericSubSubTypesStart = false; - private boolean genericSubSystemStart = false; - - private boolean genericSSFCategoriesEnd = false; - private boolean genericCategoriesEnd = false; - private boolean genericNamesEnd = false; - private boolean genericTypesEnd = false; - private boolean genericSubTypesEnd = false; - private boolean genericSubSubTypesEnd = false; - private boolean genericSubSystemEnd = false; - - /** - * Historical constructor that doesn't support "subsystemConfigurationCategory" or "systemTypes". - */ - public SystemRemoteObjectMatcher(String subsystemConfigurationId, String categoryFilter, - String nameFilter, String typeFilter, - String subtypeFilter, String subsubtypeFilter) - { - this(subsystemConfigurationId, null, categoryFilter, null, nameFilter, typeFilter, subtypeFilter, subsubtypeFilter); - } - /** - * Constructor that supports "subsystemConfigurationCategory" and "systemTypes". - */ - public SystemRemoteObjectMatcher(String subsystemConfigurationId, String subsystemConfigurationCategoryFilter, String categoryFilter, - String systemTypes, String nameFilter, String typeFilter, - String subtypeFilter, String subsubtypeFilter) - { - this.subsystemCategoryFilter = subsystemConfigurationCategoryFilter; - this.subsystemfilter = subsystemConfigurationId; - this.systypesfilter = systemTypes; - this.categoryfilter = categoryFilter; - this.namefilter = nameFilter; - this.typefilter = typeFilter; - this.subtypefilter = subtypeFilter; - this.subsubtypefilter = subsubtypeFilter; - - if ((systypesfilter == null) || (systypesfilter.length()==0)) - systypesfilter = "*"; //$NON-NLS-1$ - if ((subsystemCategoryFilter == null) || (subsystemCategoryFilter.length()==0)) - subsystemCategoryFilter = "*"; //$NON-NLS-1$ - if (categoryfilter == null) - categoryfilter = "*"; //$NON-NLS-1$ - if (namefilter == null) - namefilter = "*"; //$NON-NLS-1$ - if (typefilter == null) - typefilter = "*"; //$NON-NLS-1$ - if (subtypefilter == null) - subtypefilter = "*"; //$NON-NLS-1$ - if (subsubtypefilter == null) - subsubtypefilter = "*"; //$NON-NLS-1$ - if (subsystemfilter == null) - subsystemfilter = "*"; //$NON-NLS-1$ - - this.allSSFCategories = subsystemCategoryFilter.equals("*"); //$NON-NLS-1$ - this.allCategories = categoryfilter.equals("*"); //$NON-NLS-1$ - this.allSystemTypes = systypesfilter.equals("*"); //$NON-NLS-1$ - this.allNames = namefilter.equals("*"); //$NON-NLS-1$ - this.allTypes = typefilter.equals("*"); //$NON-NLS-1$ - this.allSubTypes = subtypefilter.equals("*"); //$NON-NLS-1$ - this.allSubSubTypes = subsubtypefilter.equals("*"); //$NON-NLS-1$ - this.allSubSystems = subsystemfilter.equals("*"); //$NON-NLS-1$ - - // -------------------------------------------------- - // determine if the name starts or ends with asterisk - // -------------------------------------------------- - this.genericSSFCategoriesStart = !allSSFCategories && startsWithAsterisk(subsystemCategoryFilter); - this.genericCategoriesStart = !allCategories && startsWithAsterisk(categoryfilter); - this.genericNamesStart = !allNames && startsWithAsterisk(namefilter); - this.genericTypesStart = !allTypes && startsWithAsterisk(typefilter); - this.genericSubTypesStart = !allSubTypes && startsWithAsterisk(subtypefilter); - this.genericSubSubTypesStart = !allSubSubTypes && startsWithAsterisk(subsubtypefilter); - this.genericSubSystemStart = !allSubSystems && startsWithAsterisk(subsystemfilter); - - this.genericSSFCategoriesEnd = !allSSFCategories && endsWithAsterisk(subsystemCategoryFilter); - this.genericCategoriesEnd = !allCategories && endsWithAsterisk(categoryfilter); - this.genericNamesEnd = !allNames && endsWithAsterisk(namefilter); - this.genericTypesEnd = !allTypes && endsWithAsterisk(typefilter); - this.genericSubTypesEnd = !allSubTypes && endsWithAsterisk(subtypefilter); - this.genericSubSubTypesEnd = !allSubSubTypes && endsWithAsterisk(subsubtypefilter); - this.genericSubSystemEnd = !allSubSystems && endsWithAsterisk(subsystemfilter); - - if (genericSSFCategoriesStart) - subsystemCategoryFilterpart = stripLeadingAsterisk(subsystemCategoryFilter); // strip off asterisk - if (genericCategoriesStart) - categoryfilterpart = stripLeadingAsterisk(categoryfilter); // strip off asterisk - if (genericNamesStart) - namefilterpart = stripLeadingAsterisk(namefilter); // strip off asterisk - if (genericTypesStart) - typefilterpart = stripLeadingAsterisk(typefilter); // strip off asterisk - if (genericSubTypesStart) - subtypefilterpart = stripLeadingAsterisk(subtypefilter); // strip off asterisk - if (genericSubSubTypesStart) - subsubtypefilterpart = stripLeadingAsterisk(subsubtypefilter); // strip off asterisk - if (genericSubSystemStart) - subsystemfilterpart = stripLeadingAsterisk(subsystemfilter); // strip off asterisk - - if (genericSSFCategoriesEnd) - subsystemCategoryFilterpart = stripTrailingAsterisk(subsystemCategoryFilter); // strip off asterisk - if (genericCategoriesEnd) - categoryfilterpart = stripTrailingAsterisk(categoryfilter); // strip off asterisk - if (genericNamesEnd) - namefilterpart = stripTrailingAsterisk(namefilter); // strip off asterisk - if (genericTypesEnd) - typefilterpart = stripTrailingAsterisk(typefilter); // strip off asterisk - if (genericSubTypesEnd) - subtypefilterpart = stripTrailingAsterisk(subtypefilter); // strip off asterisk - if (genericSubSubTypesEnd) - subsubtypefilterpart = stripTrailingAsterisk(subsubtypefilter);// strip off asterisk - if (genericSubSystemEnd) - subsystemfilterpart = stripTrailingAsterisk(subsystemfilter); // strip off asterisk - - // -------------------------------------------------- - // resolve '\*' escape characters - // -------------------------------------------------- - subsystemCategoryFilter = resolveSymbols(subsystemCategoryFilter); - categoryfilter = resolveSymbols(categoryfilter); - namefilter = resolveSymbols(namefilter); - typefilter = resolveSymbols(typefilter); - subtypefilter = resolveSymbols(subtypefilter); - subsubtypefilter = resolveSymbols(subsubtypefilter); - subsystemfilter = resolveSymbols(subsystemfilter); - } - - /** - * Helper method. - * Returns true if given name starts with an asterisk. - */ - protected boolean startsWithAsterisk(String name) - { - return name.startsWith("*"); //$NON-NLS-1$ - } - /** - * Helper method. - * Returns true if given name ends with an asterisk. - */ - protected boolean endsWithAsterisk(String name) - { - return name.endsWith("*"); //$NON-NLS-1$ - } - /** - * Helper method. - * Strips off the leading asterisk. - */ - protected String stripLeadingAsterisk(String name) - { - return resolveSymbols(name.substring(1)); - } - /** - * Helper method. - * Strips off the trailing asterisk. - */ - protected String stripTrailingAsterisk(String name) - { - return resolveSymbols(name.substring(0, name.length()-1)); - } - /** - * Occasionally, as with iSeries objects types, an asterisk is a valid part of the - * name, as in *PGM. If "*PGM" is specified for the type filter, then it would match - * on other types too, like *SRVPGM. To solve this special case, users can specify - * the following to tell us that the asterisk is to be taken literally, versus as a - * leading or trailing wild card:<br> - * <pre><code> - * "%%ast.PGM" or "%%ast;PGM" - * </code></pre> - * <p> - * The special symbol "%%ast." is resolved into an asterisk as part of the literal name. - */ - protected String resolveSymbols(String name) - { - // yantzi:5.1.2 workaround for eclipse bug 49312 - if (name.startsWith("%%ast.") || name.startsWith("%%ast;")) //$NON-NLS-1$ //$NON-NLS-2$ - { - // eclipse should have stripped the leading % off but doesn't because of this bug - name = name.substring(1); - } - - int symbolLength = STAR_SYMBOL_LEN; - int symbolIndex = name.indexOf(STAR_SYMBOL); - if (symbolIndex == -1) - symbolIndex = name.indexOf(STAR_SYMBOL2); - boolean hasSymbols = (symbolIndex != -1); - boolean hadSymbols = hasSymbols; - boolean debug = false; - if (hasSymbols && debug) - System.out.println("Before: " + name); //$NON-NLS-1$ - while (hasSymbols) - { - if (symbolIndex == 0) - { - // "&.abc" - if (name.length() > symbolLength) - name = "*" + name.substring(symbolLength); //$NON-NLS-1$ - // "&." - else - name = "*"; //$NON-NLS-1$ - } - else if ((symbolIndex+symbolLength) < name.length()) - { - // "abc&.def" - // "01234567890" - String part1 = name.substring(0,symbolIndex); // up to symbol - String part2 = name.substring(symbolIndex+symbolLength); // after symbol - name = part1 + "*" + part2; //$NON-NLS-1$ - } - else - { - // "abc&." - // "01234567" - String part1 = name.substring(0,symbolIndex); // up to symbol - name = part1 + "*"; //$NON-NLS-1$ - } - symbolIndex = name.indexOf(STAR_SYMBOL); - if (symbolIndex == -1) - symbolIndex = name.indexOf(STAR_SYMBOL2); - hasSymbols = (symbolIndex != -1); - } - if (hadSymbols && debug) - System.out.println("After: " + name); //$NON-NLS-1$ - return name; - } - - /** - * Getter method. - * Return what was specified for the <samp>subsystemconfigurationCategory</samp> xml attribute. - */ - public String getSubSystemConfigurationCategoryFilter() - { - return subsystemCategoryFilter; - } - /** - * Getter method. - * Return what was specified for the <samp>systemTypes</samp> xml attribute. - */ - public String getSystemTypesFilter() - { - return systypesfilter; - } - - /** - * Getter method. - * Return what was specified for the <samp>typecategoryfilter</samp> xml attribute. - */ - public String getCategoryFilter() - { - return categoryfilter; - } - /** - * Getter method. - * Return what was specified for the <samp>namefilter</samp> xml attribute. - */ - public String getNameFilter() - { - return namefilter; - } - /** - * Getter method. - * Return what was specified for the <samp>typefilter</samp> xml attribute. - */ - public String getTypeFilter() - { - return typefilter; - } - /** - * Getter method. - * Return what was specified for the <samp>subtypefilter</samp> xml attribute. - */ - public String getSubTypeFilter() - { - return subtypefilter; - } - /** - * Getter method. - * Return what was specified for the <samp>subsubtypefilter</samp> xml attribute. - */ - public String getSubSubTypeFilter() - { - return subsubtypefilter; - } - /** - * Getter method. - * Return what was specified for the <samp>subsystemconfigurationid</samp> xml attribute. - */ - public String getSubSystemConfigurationId() - { - return subsystemfilter; - } - - /** - * Given an ISystemRemoteElement, return true if that element - * meets this criteria. - */ - public boolean appliesTo(ISystemRemoteObjectMatchProvider adapter, Object element) - { - boolean applies = true; - // must match on all attributes to apply - - // ----------------------------------- - // check for match on subsystem filter - // ----------------------------------- - boolean subsystemMatch = true; - if (!allSubSystems) - { - String subsystem = adapter.getSubSystemConfigurationId(element); - if (subsystem == null) - subsystemMatch = false; - else if (!genericSubSystemStart && !genericSubSystemEnd) - subsystemMatch = subsystem.equals(subsystemfilter); - else if (genericSubSystemStart) - subsystemMatch = subsystem.endsWith(subsystemfilterpart); - else if (genericSubSystemEnd) - subsystemMatch = subsystem.startsWith(subsystemfilterpart); - } - if (!subsystemMatch) - return false; - - // ---------------------------------------------------- - // check for match on subsystem factory category filter - // ---------------------------------------------------- - boolean ssfCategoryMatch = true; - if (!allSSFCategories) - { - ISubSystem subsystem = adapter.getSubSystem(element); - if (subsystem == null) - ssfCategoryMatch = true; // should be false, but this was added late and I don't to regress anyting. - else - { - String ssfCategory = subsystem.getSubSystemConfiguration().getCategory(); - if (ssfCategory == null) - ssfCategory = ""; //$NON-NLS-1$ - if (!genericSSFCategoriesStart && !genericSSFCategoriesEnd) - ssfCategoryMatch = ssfCategory.equals(subsystemCategoryFilter); - else if (genericSSFCategoriesStart) - ssfCategoryMatch = ssfCategory.endsWith(subsystemCategoryFilterpart); - else if (genericSSFCategoriesEnd) - ssfCategoryMatch = ssfCategory.startsWith(subsystemCategoryFilterpart); - } - } - if (!ssfCategoryMatch) - return false; - - // ---------------------------------------------------- - // check for match on system types filter - // ---------------------------------------------------- - boolean systemTypesMatch = true; - if (!allSystemTypes) - { - ISubSystem subsystem = adapter.getSubSystem(element); - String[] values = tokenize(systypesfilter); - if (subsystem == null) - { - if (!(element instanceof IHost)) // should never happen for remote objects! - systemTypesMatch = false; - else - { - String connSysType = ((IHost)element).getSystemType().getName(); - systemTypesMatch = false; - for (int idx=0; !systemTypesMatch && (idx<values.length); idx++) - { - if (connSysType.equals(values[idx])) - systemTypesMatch = true; - } - } - } - else - { - systemTypesMatch = false; - for (int idx=0; !systemTypesMatch && (idx<values.length); idx++) - { - if (subsystem.getHost().getSystemType().getName().equals(values[idx])) - systemTypesMatch = true; - } - } - } - if (!systemTypesMatch) - return false; - - // ------------------------------ - // check for match on name filter - // ------------------------------ - boolean nameMatch = true; - - // default is case insensitive - boolean caseSensitive = false; - - // get subsystem - ISubSystem subsystem = adapter.getSubSystem(element); - - // find out whether system is case sensitive or not - if (subsystem != null) { - caseSensitive = subsystem.getSubSystemConfiguration().isCaseSensitive(); - } - - if (!allNames) - { - String name = adapter.getName(element); - String theNameFilter = namefilter; - String theNameFilterPart = namefilterpart; - - if (name == null) { - nameMatch = false; - } - - else { - - if (!caseSensitive) { - name = name.toLowerCase(); - theNameFilter = theNameFilter.toLowerCase(); - theNameFilterPart = theNameFilterPart.toLowerCase(); - } - - if (!genericNamesStart && !genericNamesEnd) - nameMatch = name.equals(theNameFilter); - else if (genericNamesStart) - nameMatch = name.endsWith(theNameFilterPart); - else if (genericNamesEnd) - nameMatch = name.startsWith(theNameFilterPart); - } - } - if (!nameMatch) - return false; - - // --------------------------------------- - // check for match on type category filter - // --------------------------------------- - boolean catMatch = true; - if (!allCategories) - { - String cat = adapter.getRemoteTypeCategory(element); - if (cat == null) - catMatch = false; - else if (!genericCategoriesStart && !genericCategoriesEnd) - catMatch = cat.equals(categoryfilter); - else if (genericCategoriesStart) - catMatch = cat.endsWith(categoryfilterpart); - else if (genericCategoriesEnd) - catMatch = cat.startsWith(categoryfilterpart); - } - if (!catMatch) - return false; - - // ------------------------------ - // check for match on type filter - // ------------------------------ - boolean typeMatch = true; - if (!allTypes) - { - String type = adapter.getRemoteType(element); - if (type == null) - typeMatch = false; - else if (!genericTypesStart && !genericTypesEnd) - typeMatch = type.equals(typefilter); - else if (genericTypesStart) - typeMatch = type.endsWith(typefilterpart); - else if (genericTypesEnd) - typeMatch = type.startsWith(typefilterpart); - } - if (!typeMatch) - return false; - - // --------------------------------- - // check for match on subtype filter - // --------------------------------- - boolean subtypeMatch = true; - if (!allSubTypes) - { - String subtype = adapter.getRemoteSubType(element); - if (subtype == null) - subtypeMatch = false; - else if (!genericSubTypesStart && !genericSubTypesEnd) - subtypeMatch = subtype.equals(subtypefilter); - else if (genericSubTypesStart) - subtypeMatch = subtype.endsWith(subtypefilterpart); - else if (genericSubTypesEnd) - subtypeMatch = subtype.startsWith(subtypefilterpart); - } - if (!subtypeMatch) - return false; - - // ------------------------------------- - // check for match on sub-subtype filter - // ------------------------------------- - boolean subsubtypeMatch = true; - if (!allSubSubTypes) - { - String subsubtype = adapter.getRemoteSubSubType(element); - if (subsubtype == null) - subsubtypeMatch = false; - else if (!genericSubSubTypesStart && !genericSubSubTypesEnd) - subsubtypeMatch = subsubtype.equals(subsubtypefilter); - else if (genericSubSubTypesStart) - subsubtypeMatch = subsubtype.endsWith(subsubtypefilterpart); - else if (genericSubSubTypesEnd) - subsubtypeMatch = subsubtype.startsWith(subsubtypefilterpart); - } - if (!subsubtypeMatch) - return false; - - return applies; - } - - /** - * Break given comma-delimited string into tokens - */ - private String[] tokenize(String input) - { - StringTokenizer tokens = new StringTokenizer(input,";"); //$NON-NLS-1$ - Vector v = new Vector(); - while (tokens.hasMoreTokens()) - v.addElement(tokens.nextToken()); - String[] stringArray = new String[v.size()]; - for (int idx=0; idx<v.size(); idx++) - stringArray[idx] = (String)v.elementAt(idx); - return stringArray; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceHelpers.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceHelpers.java deleted file mode 100644 index 23c02d0e2..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceHelpers.java +++ /dev/null @@ -1,775 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core; -import java.io.File; -import java.io.FileFilter; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Vector; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; - -/** - * A class with helper methods for working with the underlying Eclipse resources - * needed for filters, filter pools and filter pool managers. - */ -public class SystemResourceHelpers implements FileFilter -{ - - private static SystemResourceHelpers defaultInstance = null; - - //private SystemLogFile logFile = null; - - // variables to affect the list method for subsetting folder contents - private boolean filesOnly = false; - private boolean foldersOnly = false; - private String namePrefix = null; - private String nameSuffix = null; - - - /** - * Constructor - */ - public SystemResourceHelpers() - { - } - - /** - * Return common instance if unique instance not required. - */ - public static SystemResourceHelpers getResourceHelpers() - { - if (defaultInstance == null) - defaultInstance = new SystemResourceHelpers(); - return defaultInstance; - } - - // --------------------------- - // GENERIC RESOURCE METHODS... - // --------------------------- - - /** - * Method to delete a folder or file and absorb the exception - */ - public void deleteResource(IResource fileOrFolder) - { - try { - if (fileOrFolder instanceof IFile) - deleteFile((IFile)fileOrFolder); - else - deleteFolder((IFolder)fileOrFolder); - } catch (Exception exc) - { - logException("Exception deleting resource " + fileOrFolder.getName(), exc); //$NON-NLS-1$ - } - } - /** - * Method to rename a folder or file and absorb the exception - */ - public void renameResource(IResource fileOrFolder, String newName) - { - //System.out.println("inside renameResource for "+fileOrFolder.getFullPath() + ". newName = " + newName); - if (fileOrFolder.getName().equals(newName)) - { - //System.out.println("same name! "); - Exception exc = new Exception("Rename to same name: " + newName); //$NON-NLS-1$ - exc.fillInStackTrace(); - exc.printStackTrace(); - return; - } - try { - if (fileOrFolder instanceof IFile) - renameFile((IFile)fileOrFolder, newName); - else - renameFolder((IFolder)fileOrFolder, newName); - } catch (Exception exc) - { - logException("Exception rename resource " + fileOrFolder.getName() + " to " + newName, exc); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * Refresh a resource from disk. Turns off resource event listening to avoid recursion. - * Does a DEPTH_INFINITE refresh. - */ - public void refreshResource(IResource fileOrFolder) - { - SystemResourceManager.turnOffResourceEventListening(); - try - { - if (!fileOrFolder.getWorkspace().isTreeLocked()) - fileOrFolder.refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (Exception exc) {} - SystemResourceManager.turnOnResourceEventListening(); - } - /** - * Refresh a resource from disk. Turns off resource event listening to avoid recursion. - * Does a DEPTH_ZERO refresh, so children are not refreshed. Should be more efficient than - * deep refresh. - */ - public void refreshResourceShallow(IResource fileOrFolder) - { - SystemResourceManager.turnOffResourceEventListening(); - try - { - if (!fileOrFolder.getWorkspace().isTreeLocked()) - fileOrFolder.refreshLocal(IResource.DEPTH_ZERO, null); - } catch (Exception exc) {} - SystemResourceManager.turnOnResourceEventListening(); - } - - /** - * Test if a resource is in use, prior to attempting to rename or delete it. - * @return true if it is in use or read only, false if it is not. - */ - public static boolean testIfResourceInUse(IResource resource) - { - boolean inUse = resource.getResourceAttributes().isReadOnly() || !resource.isAccessible(); - if (!inUse) // keep testing.. - { - IPath localOSLocation = resource.getLocation(); - if (localOSLocation != null) - { - File osFile = new File(localOSLocation.toOSString()); - inUse = !osFile.canWrite(); - if (!inUse && (resource instanceof IFile)) - { - try { - //System.out.println("testing " + osFile.getAbsolutePath()); - FileWriter outFileStream = new FileWriter(osFile.getAbsolutePath(),true); - outFileStream.close(); - } - catch (IOException exc) - { - inUse = true; - //System.out.println("...file is locked!"); - } - } - } - } - //System.out.println("Testing in-use of resource " + resource.getName() + ": " + inUse); - return inUse; - } - - // -------------------------- - // FOLDER SPECIFIC METHODS... - // -------------------------- - - /** - * Create a folder, if it does not already exist. - */ - public IFolder getOrCreateFolder(IContainer parentFolder, String folderName) - { - /* - if (folderName.equals("Private")) - { - String msg = "Someone asked to create Private folder!"; - Exception e = new Exception(msg); - e.fillInStackTrace(); - RSEUIPlugin.logError(msg, e); - } - */ - IFolder folder = getFolder(parentFolder, folderName); - if (!exists(folder)) - createFolder(folder); - return folder; - } - /** - * Create a folder, if it does not already exist. - */ - public boolean ensureFolderExists(IFolder folder) - { - boolean ok = true; - if (!exists(folder)) - { - ok = createFolder(folder); - } - return ok; - } - - /** - * Get a folder whose parent is either a project or a folder - */ - public IFolder getFolder(IContainer parent, String folderName) - { - SystemResourceManager.turnOffResourceEventListening(); - IFolder folder = null; - if (parent instanceof IProject) - { - folder = ((IProject)parent).getFolder(folderName); - } - else - folder = ((IFolder)parent).getFolder(folderName); - SystemResourceManager.turnOnResourceEventListening(); - return folder; - } - /** - * Re-get a folder which has been renamed. - */ - public IFolder getRenamedFolder(IFolder oldFolder, String newFolderName) - { - SystemResourceManager.turnOffResourceEventListening(); - IFolder folder = null; - IContainer parent = oldFolder.getParent(); - if (parent instanceof IProject) - folder = ((IProject)parent).getFolder(newFolderName); - else - folder = ((IFolder)parent).getFolder(newFolderName); - SystemResourceManager.turnOnResourceEventListening(); - return folder; - } - - - /** - * Create new folder - */ - public boolean createFolder(IFolder folder) - { - boolean ok = true; - try - { - SystemResourceManager.turnOffResourceEventListening(); - folder.create(true,true,null); - SystemResourceManager.turnOnResourceEventListening(); - /* - if (folder.getName().equals("Private")) - { - String msg = "Someone asked to create Private folder!"; - Exception e = new Exception(msg); - e.fillInStackTrace(); - RSEUIPlugin.logError(msg, e); - } - */ - } catch (CoreException e) - { - SystemResourceManager.turnOnResourceEventListening(); - IStatus status = e.getStatus(); - if (status!=null) - { - int code = status.getCode(); - if (code != IResourceStatus.RESOURCE_EXISTS) - { - logException("error creating folder "+folder.getName(),e); //$NON-NLS-1$ - ok = false; - } - } - } - return ok; - } - - /** - * Delete a folder - */ - public boolean deleteFolder(IFolder folder) - throws Exception - { - // to ensure success, we force a refresh local action... - refreshResource(folder); - boolean existsInFileSystem = exists(folder); - if (!existsInFileSystem) - return true; - boolean existsInWorkSpace = folder.exists(); - if (existsInFileSystem && !existsInWorkSpace) - { - logMessage("...deleteFolder error: folder "+folder.getLocation().toOSString()+" exists in file system but not in workspace! Cannot delete it."); //$NON-NLS-1$ //$NON-NLS-2$ - existsInWorkSpace = folder.exists(); // for debugging. set breakpoint here - } - boolean ok = true; - //String name = folder.getName(); - SystemResourceManager.turnOffResourceEventListening(); - folder.delete(true,false,null); // force-yes, keep-history-no, no progress monitor - SystemResourceManager.turnOnResourceEventListening(); - return ok; - } - /** - * Rename a folder - */ - public boolean renameFolder(IFolder folder, String newName) - throws Exception - { - //System.out.println("inside renameFolder for "+folder.getFullPath() + ". exists? = " + folder.exists()); - if (!exists(folder)) - return true; - boolean ok = true; - IPath newPath = folder.getFullPath().removeLastSegments(1).append(newName); - //System.out.println("new path = " + newPath.toOSString()); - try { - SystemResourceManager.turnOffResourceEventListening(); - if (!newPath.toFile().exists()) - folder.move(newPath, true, false, null); - SystemResourceManager.turnOnResourceEventListening(); - //System.out.println("...path after move = " + folder.getFullPath().toOSString()); - } catch (Exception exc) - { - SystemResourceManager.turnOnResourceEventListening(); - //exc.printStackTrace(); - throw exc; - } - return ok; - } - /** - * Move a folder - */ - public boolean moveFolder(IFolder newParent, IFolder folder) - throws Exception - { - boolean ok = true; - if (!exists(folder)) - return true; - SystemResourceManager.turnOffResourceEventListening(); - folder.move(newParent.getFullPath().append(folder.getName()),true,false,null); - SystemResourceManager.turnOnResourceEventListening(); - return ok; - } - - /** - * Return the path of the given folder - */ - public String getFolderPath(IFolder folder) - { - return folder.getLocation().toOSString(); - } - - /** - * Return a list of child folders in the given container - * @param projectOrFolder The parent container to search. - * @return an array of IFolder objects - */ - public IFolder[] listFolders(IContainer projectOrFolder) - { - if (!projectOrFolder.exists()) - return (new IFolder[0]); - - SystemResourceManager.turnOffResourceEventListening(); - - Vector folders = new Vector(); - try - { - IResource[] members = projectOrFolder.members(); - if (members != null) - for (int idx=0; idx<members.length; idx++) - if (members[idx].getType() == IResource.FOLDER) - folders.addElement(members[idx]); - } catch (Exception exc) - { - logException("Error retrieving folder list",exc); //$NON-NLS-1$ - } - - SystemResourceManager.turnOnResourceEventListening(); - - return convertToFolderArray(folders); - } - - /** - * Return a list of child folders in the given container, - * which contain a file of the given name. - * @param projectOrFolder The parent container to search. - * @param fileName The name of the file which must exist - * in the folder in order to be included in the returned list - * @return an array of IFolder objects - */ - public IFolder[] listFolders(IContainer projectOrFolder, String fileName) - { - if (!exists(projectOrFolder)) - return (new IFolder[0]); - - SystemResourceManager.turnOffResourceEventListening(); - - Vector folders = new Vector(); - // to ensure we get everything, we force a refresh local action... - try { - refreshResource(projectOrFolder); - } catch (Exception exc) {} - try - { - // ok, now we can query the children... - IResource[] members = projectOrFolder.members(); - if (members != null) - { - for (int idx=0; idx<members.length; idx++) - { - if (members[idx].getType() == IResource.FOLDER) - { - if (exists(getFile((IFolder)members[idx], fileName))) - folders.addElement(members[idx]); - } - } - } - } catch (Exception exc) - { - logException("Error retrieving folder list",exc); //$NON-NLS-1$ - } - - SystemResourceManager.turnOnResourceEventListening(); - - return convertToFolderArray(folders); - } - - /** - * Return a list of names of folders in the given container - * @param folder The folder to query - * @param namePrefix Optional prefix all names should match. Can be null. - * @param nameSuffix Optional suffix all names should match. Can be null. - */ - public String[] listFolders(IFolder folder, String namePrefix, String nameSuffix) - { - setListValues(false, true, namePrefix, nameSuffix); - if (!folder.exists()) - { - return new String[0]; - } - - File dirFile = new File(folder.getLocation().toOSString()); - //String[] folders = dirFile.listFiles(this); - File[] fileObjs = dirFile.listFiles(this); - String[] folders = null; - if (fileObjs != null) - { - folders = new String[fileObjs.length]; - for (int idx=0; idx<folders.length; idx++) - folders[idx] = fileObjs[idx].getName(); - } - else - folders = new String[0]; - return folders; - } - - // ------------------------ - // FILE SPECIFIC METHODS... - // ------------------------ - - /** - * Get a file whose parent is either a project or a folder - */ - public IFile getFile(IContainer parent, String fileName) - { - IFile file = null; - - SystemResourceManager.turnOffResourceEventListening(); - - if (parent instanceof IProject) - file = ((IProject)parent).getFile(fileName); - else - file = ((IFolder)parent).getFile(fileName); - - SystemResourceManager.turnOnResourceEventListening(); - - return file; - } - /** - * Check if a file exists in the file system. - * For some reason, the exists() method of IFile cannot be trusted to - * report actual file system existence. - */ - public boolean fileExists(IFile file) - { - String fileLocation = file.getLocation().toOSString(); - //System.out.println("File name = "+file.getName()+" File location = " + fileLocation); - return (new File(fileLocation)).exists(); - } - - /** - * Delete a file - */ - public boolean deleteFile(IFile file) - throws Exception - { - SystemResourceManager.turnOffResourceEventListening(); - // to ensure success, we force a refresh local action... - try { - file.refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (Exception exc) {} - - boolean ok = true; - file.delete(true,false,null); // force-yes, keep-history-no, no progress monitor - SystemResourceManager.turnOnResourceEventListening(); - return ok; - } - /** - * Rename a file - * @param newName - the name name for the file, unqualified! - */ - public boolean renameFile(IFile file, String newName) - throws Exception - { - boolean ok = true; - IPath newPath = file.getFullPath().removeLastSegments(1).append(newName); - SystemResourceManager.turnOffResourceEventListening(); - // to ensure success, we force a refresh local action... - try { - file.refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (Exception exc) {} - try { - file.move(newPath, true, false, null); // path, force, keep-history, progress monitor - } catch (Exception exc) - { - SystemResourceManager.turnOnResourceEventListening(); - throw exc; - } - SystemResourceManager.turnOnResourceEventListening(); - return ok; - } - /** - * Move a file - */ - public boolean moveFile(IFolder newParent, IFile file) - throws Exception - { - boolean ok = true; - SystemResourceManager.turnOffResourceEventListening(); - // to ensure success, we force a refresh local action... - try { - file.refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (Exception exc) {} - try - { - file.move(newParent.getFullPath().append(file.getName()),true,false,null); - } catch (Exception exc) - { - SystemResourceManager.turnOnResourceEventListening(); - throw exc; - } - SystemResourceManager.turnOnResourceEventListening(); - return ok; - } - - /** - * Return the path of the given file - */ - public static String getFilePath(IFile file) - { - return file.getLocation().toOSString(); - } - - - - /** - * Return a list of child files in the given container - * @param projectOrFolder The parent container to search. - * @return an array of IFile objects - */ - public IFile[] listFiles(IContainer projectOrFolder) - { - if (!exists(projectOrFolder)) - return (new IFile[0]); - - SystemResourceManager.turnOffResourceEventListening(); - - Vector files = new Vector(); - // to ensure we get everything, we force a refresh local action... - try { - refreshResource(projectOrFolder); - } catch (Exception exc) {} - try - { - IResource[] members = projectOrFolder.members(); - if (members != null) - for (int idx=0; idx<members.length; idx++) - if (members[idx].getType() == IResource.FILE) - files.addElement(members[idx]); - } catch (Exception exc) - { - logException("Error retrieving file list",exc); //$NON-NLS-1$ - } - - SystemResourceManager.turnOnResourceEventListening(); - return convertToFileArray(files); - } - - /** - * Return a list of names of files in the given container - * @param folder The folder to query - * @param namePrefix Optional prefix all names should match. Can be null. - * @param nameSuffix Optional suffix all names should match. Can be null. - */ - public String[] listFiles(IFolder folder, String namePrefix, String nameSuffix) - { - setListValues(true, false, namePrefix, nameSuffix); - File dirFile = new File(folder.getLocation().toOSString()); - //String[] files = dirFile.list(this); - File[] fileObjs = dirFile.listFiles(this); - String[] files = null; - if (fileObjs != null) - { - files = new String[fileObjs.length]; - for (int idx=0; idx<files.length; idx++) - files[idx] = fileObjs[idx].getName(); - } - else - files = new String[0]; - return files; - } - - // ------------------------ - // UTILITY METHODS... - // ------------------------ - - /** - * Convert a vector of IFolder objects to an array of IFolder. - * Result is only null if input is null. - */ - public IFolder[] convertToFolderArray(Vector vector) - { - if (vector == null) - return null; - IFolder[] folders = new IFolder[vector.size()]; - for (int idx=0; idx<vector.size(); idx++) - folders[idx] = (IFolder)vector.elementAt(idx); - return folders; - } - /** - * Convert a vector of IFile objects to an array of IFile. - * Result is only null if input is null. - */ - public IFile[] convertToFileArray(Vector vector) - { - if (vector == null) - return null; - IFile[] files = new IFile[vector.size()]; - for (int idx=0; idx<vector.size(); idx++) - files[idx] = (IFile)vector.elementAt(idx); - return files; - } - - /** - * Convert a name array to a vector. If array is null or empty, an empty vector is returned. - */ - public Vector convertToVector(String[] array) - { - Vector v = new Vector(); - if (array != null) - for (int idx=0; idx<array.length; idx++) - v.addElement(array[idx]); - return v; - } - /** - * Convert a name array to a vector. As each name is copied - * to the vector, its prefix and suffix are stripped off. - * If array is null or empty, an empty vector is returned. - */ - public Vector convertToVectorAndStrip(String[] array, String namePrefix, String nameSuffix) - { - Vector v = new Vector(); - if (array != null) - for (int idx=0; idx<array.length; idx++) - { - String name = array[idx]; - if (namePrefix != null) - name = name.substring(namePrefix.length()); - if (nameSuffix != null) - name = name.substring(0,name.lastIndexOf(nameSuffix)); - v.addElement(name); - } - return v; - } - - // ------------------------ - // INTERNAL METHODS... - // ------------------------ - - /** - * Method to set variables to affect the folder content subsetting - */ - public void setListValues(boolean filesOnly, boolean foldersOnly, String namePrefix, String nameSuffix) - { - this.filesOnly = filesOnly; - this.foldersOnly = foldersOnly; - this.namePrefix = namePrefix; - this.nameSuffix = nameSuffix; - } - - /** - * Method required by FilenameFilter interface, used by java.io.File.list() - */ - //public boolean accept(File file, String name) - public boolean accept(File file) - { - boolean match = true; - if (filesOnly) - { - if (!file.isFile()) - return false; - } - else if (foldersOnly) - { - if (!file.isDirectory()) - return false; - } - String name = file.getName(); - if (nameSuffix != null) - { - if (!name.endsWith(nameSuffix)) - return false; - } - if (namePrefix != null) - { - if (!name.startsWith(namePrefix)) - return false; - } - return match; - } - - public void logMessage(String msg) - { - RSECorePlugin.getDefault().getLogger().logWarning(msg); - } - public void logException(String msg, Exception exc) - { - RSECorePlugin.getDefault().getLogger().logError(msg, exc); - } - - - /** - * For some reason the exists() method on IResource is fundamentally not reliable. - * Because of this, we resort to the looking ourselves at the file system. - */ - public boolean exists(IResource resource) - { - // DKM - doing a refresh while in a wizard causes stack overflow - // defect #57739 - // I think this is an unnecessary step since in most cases the resource will - // already exist. - if (resource.exists()) - { - return true; - } - - // it appears the serious reliability problems are due to out of synch problems. - // so, I have decided to do a refresh and see if that is cheaper than creating - // hundreds of these java.io.File objects for every touch of every resource... phil. 10/21/2002. - refreshResourceShallow(resource); - return resource.exists(); - /* - IPath localOSLocation = resource.getLocation(); - if (localOSLocation == null) - return true; // what else? - File osFile = new File(localOSLocation.toOSString()); - return osFile.exists(); - */ - } - - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceManager.java deleted file mode 100644 index 01a913cc1..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceManager.java +++ /dev/null @@ -1,428 +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: - * Dave McKnight (IBM) - [177155] Move from rse.ui/systems/org.eclipse.rse.core - * Martin Oberhuber (Wind River) - Re-add missing methods for user actions - * David Dykstal (IBM) - [189858] delayed the creation of the remote systems project - * removed unneeded first time logic and flags - * renamed createRemoteSystemsProjectInternal to ensureRemoteSystemsProject - * made ensureRemoteSystemsProject private instead of protected - * David Dykstal (IBM) - [186589] move user types, user actions, and compile commands - * API to the user actions plugin - * David Dykstal (IBM) - [191130] remove getRemoteSystemsProject() and getProfileFolder() - * as part of the work to removed the exception printed at startup. - ********************************************************************************/ - -package org.eclipse.rse.core; - -import java.io.File; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemHostPool; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.internal.core.RemoteSystemsProject; -import org.eclipse.rse.internal.core.SystemResourceConstants; - - -/** - * Static methods that manage the workbench resource tree for the remote systems project. - * All code in the framework uses this to access the file system for save/restore purposes. - * By limiting all access to one place, we simply changes should we decide to change the - * underlying file system map. - * <p> - * <b>Assumptions</b> - * <ul> - * <li>Each SystemConnectionPool object manages the connections for a given system profile - * <li>Each SystemFilterPoolManager object manages the filter pools for a given subsystem factory, - * for a given system profile! - * <li>Each SystemFilterPool object is an arbitrary named collection of filters all stored - * in one folder on disk with the same name as the pool. - * </ul> - * <p> - */ -public class SystemResourceManager implements SystemResourceConstants -{ - - private static IProject remoteSystemsProject = null; - private static IProject remoteSystemsTempFilesProject = null; - private static SystemResourceHelpers helpers = null; - - private static ISystemResourceListener _listener = null; - - /** - * Turn off event listening. Please call this before do anything that modifies resources and - * turn it on again after. - */ - public static void turnOffResourceEventListening() - { - if (_listener != null) - _listener.turnOffResourceEventListening(); - } - - /** - * Turn off event listening. Please call this after modifying resources. - */ - public static void turnOnResourceEventListening() - { - if (_listener != null) - _listener.turnOnResourceEventListening(); - } - /** - * Ensure event listening is on. Called at start of team synch action to be safe. - */ - public static void ensureOnResourceEventListening() - { - if (_listener != null) - _listener.ensureOnResourceEventListening(); - } - - /** - * Start event listening. Requests to turn on and off are ignored until this is called, - * which is at the appropriate point in the startup sequence. - */ - public static void startResourceEventListening(ISystemResourceListener listener) - { - _listener = listener; - listener.turnOnResourceEventListening(); - - - IWorkspace ws = remoteSystemsProject.getWorkspace(); - int eventMask = IResourceChangeEvent.POST_CHANGE; - - // add listener for global events ; - ws.addResourceChangeListener(listener, eventMask); - } - /** - * End event listening. Requests to turn on and off are ignored after this is called, - * which is at the appropriate point in the shutdown sequence. - */ - public static void endResourceEventListening() - { - if (_listener != null) - { - IWorkspace ws = remoteSystemsProject.getWorkspace(); - ws.removeResourceChangeListener(_listener); - _listener = null; - } - } - - /** - * Register a listener for resource change events on objects in our remote system project. - * No attempt is made to filter the events, they are simply passed on and the listener can - * decide if the event applies to them or not. - * <p> - * However, the event will only be fired if a change is made to that resource outside of the - * normal activities of the Remote Systems Framework, and only for resources within the - * Remote Systems Connection project. - */ - public static void addResourceChangeListener(IResourceChangeListener l) - { - if (_listener != null) - _listener.addResourceChangeListener(l); - } - /** - * Remove a listener for resource change events on an object in our remote system project. - */ - public static void removeResourceChangeListener(IResourceChangeListener l) - { - if (_listener != null) - _listener.removeResourceChangeListener(l); - } - -// /** -// * Get the default remote systems project. -// * If found but closed, this will open the project. -// * @return IProject handle of the project. Use exists() to test existence. -// * @deprecated use {@link #getRemoteSystemsProject(boolean)} instead. -// */ -// public static IProject getRemoteSystemsProject() -// { -// return getRemoteSystemsProject(true); -// } - - /** - * Get the default remote systems project. - * If found but closed, this will open the project. - * @param force if true force the creation of the project if not found. - * In any case, returns handle to the project. - * @return IProject handle of the project. Clients should use - * exists() or isAccessible() to test existence. - */ - public static IProject getRemoteSystemsProject(boolean force) { - if (remoteSystemsProject == null) { - remoteSystemsProject = ResourcesPlugin.getWorkspace().getRoot().getProject(RESOURCE_PROJECT_NAME); - } - if ((!remoteSystemsProject.exists() && force) || (remoteSystemsProject.exists() && !remoteSystemsProject.isOpen())) { - ensureRemoteSystemsProject(remoteSystemsProject); - } - return remoteSystemsProject; - } - - /** - * Get the default remote systems temp files project. - * @return IProject handle of the project. Use exists() to test existence. - */ - public static IProject getRemoteSystemsTempFilesProject() - { - if (remoteSystemsTempFilesProject == null) - { - remoteSystemsTempFilesProject = ResourcesPlugin.getWorkspace().getRoot().getProject(RESOURCE_TEMPFILES_PROJECT_NAME); - } - return remoteSystemsTempFilesProject; - } - /** - * Create a remote systems project, plus the core subfolders required. - * @param proj the handle for the remote systems project - * @return the IProject handle of the project (the argument) - */ - private static IProject ensureRemoteSystemsProject(IProject proj) - { - // Check first for the project to be closed. If yes, try to open it and if this fails, - // try to delete if first before failing here. The case is that the user removed the - // directory in the workspace and we must be able to recover from it. - // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=172437. - if (!proj.isOpen()) { - try { - proj.open(null); - } catch (Exception e) { - try { - proj.delete(false, true, null); - RSECorePlugin.getDefault().getLogger().logWarning("Removed stale remote systems project reference. Re-creating remote system project to recover."); //$NON-NLS-1$ - } catch (CoreException exc) { - // If the delete fails, the original opening error will be passed to the error log. - RSECorePlugin.getDefault().getLogger().logError("error opening remote systems project", e); //$NON-NLS-1$ - } - } - } - if (!proj.exists()) { - try { - proj.create(null); - proj.open(null); - IProjectDescription description = proj.getDescription(); - String newNatures[] = { RemoteSystemsProject.ID }; - description.setNatureIds(newNatures); - proj.setDescription(description, null); - } catch (Exception e) { - RSECorePlugin.getDefault().getLogger().logError("error creating remote systems project", e); //$NON-NLS-1$ - } - } - return proj; - } - - // -------------------------------------------- - // GET ALL EXISTING PROFILE NAMES OR FOLDERS... - // -------------------------------------------- - /** - * Each root folder of the project is assumed to be a profile, if it has a file named profile.xmi - */ - /* - public static IFolder[] getProfileFolders() - { - IProject proj = getRemoteSystemsProject(); - IFolder[] allFolders = getResourceHelpers().listFolders(proj); - //System.out.println("Inside getProfileFolders. allFolders.length = " + allFolders.length); - Vector v = new Vector(); - for (int idx=0; idx<allFolders.length; idx++) - { - String saveFileName = SystemProfileManager.getSaveFileName(allFolders[idx].getName()); - IFile saveFile = getResourceHelpers().getFile(allFolders[idx], saveFileName); - boolean saveFileExists = getResourceHelpers().fileExists(saveFile); - //System.out.println("...folderName = " + allFolders[idx].getName()); - //System.out.println("...saveFileName = " + saveFileName); - //System.out.println("...saveFile.exists() = " + saveFileExists); - if (saveFileExists) - v.addElement(allFolders[idx]); - } - return getResourceHelpers().convertToFolderArray(v); - } - */ - - /** - * Guess the profile names by itemizing all the root folders, and - * assuming any such folder that has a file in it named "profile.xmi" is - * indeed a profile whose name equals the folder name. - */ - /* - public static String[] deduceProfileNames() - { - IFolder[] folders = getProfileFolders(); - String[] names = new String[folders.length]; - for (int idx=0; idx<names.length; idx++) - names[idx] = folders[idx].getName(); - return names; - } - */ - - /** - * Get profiles folder for a given profile name - */ -// public static IFolder getProfileFolder(String profileName) -// { -// return getResourceHelpers().getOrCreateFolder(getRemoteSystemsProject(),profileName); -// } - - - // ------------------- - // FOLDER ACTIONS... - // ------------------- - - /** - * Rename a folder - */ - public static void renameFolder(IFolder folder, String newName) - { - getResourceHelpers().renameResource(folder, newName); - } - /** - * Delete a folder - */ - public static void deleteFolder(IFolder folder) - { - getResourceHelpers().deleteResource(folder); - } - - // ------------------- - // FILE ACTIONS... - // ------------------- - - /** - * Rename a file - */ - public static void renameFile(IFolder folder, String oldName, String newName) - { - getResourceHelpers().renameResource( - getResourceHelpers().getFile(folder,oldName), newName); - } - /** - * Delete a file - */ - public static void deleteFile(IFolder folder, String fileName) - { - getResourceHelpers().deleteResource( - getResourceHelpers().getFile(folder, fileName)); - } - - - // ------------------- - // GENERIC HELPERS... - // ------------------- - - /** - * Map a connection pool name to a profile name. - * Current algorith is that pool name equals profile name, but we use - * this method to allow flexibility in the future. - */ - public static String getProfileName(ISystemHostPool pool) - { - return pool.getName(); - } - - /** - * Map a filter pool manager name to a profile name - * Current algorith is that manager name equals profile name, but we use - * this method to allow flexibility in the future. - */ - public static String getProfileName(ISystemFilterPoolManager mgr) - { - return mgr.getName(); - } - - /** - * Map a filter pool name to a folder name - * Current algorith is that pool name equals folder name, but we use - * this method to allow flexibility in the future. - */ - public static String getFolderName(ISystemFilterPool pool) - { - return pool.getName(); - } - - /** - * Map a system connection object to a folder name - */ - public static String getFolderName(IHost conn) - { - return conn.getAliasName(); - } - - /** - * Map a subsystem factory object to a folder name - */ - public static String getFolderName(ISubSystemConfiguration ssFactory) - { - return ssFactory.getId(); // Should we use name instead?? Can we assume the name is unique? - } - - /** - * Given any folder, return its path as a string. - */ - public static String getFolderPath(IFolder folder) - { - return getResourceHelpers().getFolderPath(folder); - } - - /** - * Given any folder, return its path as a string, and an ending '\' - */ - public static String getFolderPathWithTerminator(IFolder folder) - { - return addPathTerminator(getResourceHelpers().getFolderPath(folder)); - } - - - /** - * Return singleton of resource helpers object - */ - protected static SystemResourceHelpers getResourceHelpers() - { - if (helpers == null) - { - helpers = SystemResourceHelpers.getResourceHelpers(); - //helpers.setLogFile(RSEUIPlugin.getDefault().getLogFile()); - } - return helpers; - } - - /** - * Ensure given path ends with path separator. - */ - public static String addPathTerminator(String path) - { - if (!path.endsWith(File.separator)) - path = path + File.separatorChar; - //else - // path = path; - return path; - } - - /** - * Test if a resource is in use, prior to attempting to rename or delete it. - * @return true if it is in use or read only, false if it is not. - */ - public static boolean testIfResourceInUse(IResource resource) - { - return SystemResourceHelpers.testIfResourceInUse(resource); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemTypeMatcher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemTypeMatcher.java deleted file mode 100644 index cce2e2fc8..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemTypeMatcher.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. 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 - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation. - *******************************************************************************/ -package org.eclipse.rse.core; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.regex.Pattern; - -/** - * Shared system type id list parser and matcher. Parses a given - * list of system type id's, separated by semicolon and possibly - * containing the wildcards '*' and '?. - */ -public final class SystemTypeMatcher { - private final class SystemTypeIdPattern { - private final Pattern pattern; - - /** - * Constructor. - */ - public SystemTypeIdPattern(Pattern pattern) { - assert pattern != null; - this.pattern = pattern; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.internal.subsystems.SubSystemConfigurationProxy.ISystemTypePattern#matches(org.eclipse.rse.core.IRSESystemType) - */ - public boolean matches(IRSESystemType systemType) { - assert systemType != null; - return pattern.matcher(systemType.getId()).matches(); - } - } - - // List of patterns to match. The order is preserved. - private final List patterns = new LinkedList(); - private boolean matchAllTypes = false; - - /** - * Constructor. - * - * @param declaredSystemTypeIds The list of declared system type ids. Might be <code>null</code>. - */ - public SystemTypeMatcher(String declaredSystemTypeIds) { - // Compile the list of patterns out of given lists of declared system types - if (declaredSystemTypeIds != null) { - String[] ids = declaredSystemTypeIds.split(";"); //$NON-NLS-1$ - if (ids != null && ids.length > 0) { - for (int i = 0; i < ids.length; i++) { - String id = ids[i].trim(); - if (id.equals("*")) { //$NON-NLS-1$ - matchAllTypes = true; - patterns.clear(); - return; - } else if(id.length()>0) { - SystemTypeIdPattern pattern = new SystemTypeIdPattern(Pattern.compile(makeRegex(id))); - patterns.add(pattern); - } - } - } - } - } - - private String makeRegex(String pattern) { - assert pattern != null; - String translated = pattern; - if (translated.indexOf('.') != -1) translated = translated.replaceAll("\\.", "\\."); //$NON-NLS-1$ //$NON-NLS-2$ - if (translated.indexOf('*') != -1) translated = translated.replaceAll("\\*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$ - if (translated.indexOf('?') != -1) translated = translated.replaceAll("\\?", "."); //$NON-NLS-1$ //$NON-NLS-2$ - return translated; - } - - /** - * @return true if this matcher supports all system types. - */ - public boolean supportsAllSystemTypes() { - return matchAllTypes; - } - - /** - * Checks if the specified system type is matched by this pattern. - */ - public boolean matches(IRSESystemType systemType) { - assert systemType != null; - if (matchAllTypes) return true; - Iterator iterator = patterns.iterator(); - while (iterator.hasNext()) { - SystemTypeIdPattern matcher = (SystemTypeIdPattern)iterator.next(); - if (matcher.matches(systemType)) return true; - } - return false; - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/comm/ISystemKeystoreProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/comm/ISystemKeystoreProvider.java deleted file mode 100644 index 269121780..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/comm/ISystemKeystoreProvider.java +++ /dev/null @@ -1,30 +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) - [186525] Move keystoreProviders to core - ********************************************************************************/ - -package org.eclipse.rse.core.comm; - -import java.util.List; - -/* - * Interface for the keystoreProviders extension point. - * Implementors must provide a keystore and it's password. - */ -public interface ISystemKeystoreProvider -{ - public String getKeyStorePassword(); - public String getKeyStorePath(); - public boolean importCertificates(List certificates, String systemName); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/comm/SystemKeystoreProviderManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/comm/SystemKeystoreProviderManager.java deleted file mode 100644 index f61ad8f89..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/comm/SystemKeystoreProviderManager.java +++ /dev/null @@ -1,160 +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) - [186525] Move keystoreProviders to core - * Martin Oberhuber (Wind River) - [181939] Deferred class loading for keystoreProviders - ********************************************************************************/ - -package org.eclipse.rse.core.comm; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.rse.core.RSECorePlugin; -import org.osgi.framework.Bundle; - -/** - * A Registry of keystore providers, with the ability to instantiate - * providers lazily when needed. - */ -public class SystemKeystoreProviderManager -{ - private static SystemKeystoreProviderManager _instance = new SystemKeystoreProviderManager(); - - private List _extensions; - - private static class ExtensionInfo { - public Bundle bundle; - public String className; - public ExtensionInfo(Bundle bundle, String className) { - this.bundle = bundle; - this.className = className; - } - } - - private SystemKeystoreProviderManager() - { - _extensions= new ArrayList(); - } - - /** - * Return the SystemKeystoreProviderManager Instance. - * @return the singleton instance. - */ - public static SystemKeystoreProviderManager getInstance() - { - return _instance; - } - - /** - * Register a keystore provider. - * @param ext keystore provider to register. - */ - public void registerKeystoreProvider(ISystemKeystoreProvider ext) - { - _extensions.add(ext); - } - - /** - * Register a keystore provider for deferred (lazy) loading. - * - * @param bundle the bundle that declares the extension. The bundle - * must be installed and will be activated lazily when trying - * to load the given class name. - * @param className fully qualified classname of the keystore provider - * declared in the given bundle. - */ - public void registerKeystoreProvider(Bundle bundle, String className) - { - _extensions.add(new ExtensionInfo(bundle, className)); - } - - public boolean hasProvider() - { - return !_extensions.isEmpty(); - } - - /** - * Return the keystore provider at the given index in the registry, - * or <code>null</code> if there is no provider at the given index - * or it cannot be loaded. - * @return An ISystemKeystoreProvider instance, or <code>null</code> - * if no provider is found at the given index. - */ - public ISystemKeystoreProvider getProviderAt(int idx) - { - if (idx >= 0 && idx < _extensions.size()) { - Object o = _extensions.get(idx); - if (o instanceof ISystemKeystoreProvider) { - return (ISystemKeystoreProvider)o; - } else if (o instanceof ExtensionInfo) { - ExtensionInfo info = (ExtensionInfo)o; - try { - Class keystoreProvider = info.bundle.loadClass(info.className); - ISystemKeystoreProvider extension = (ISystemKeystoreProvider)keystoreProvider.getConstructors()[0].newInstance(null); - _extensions.set(idx, extension); - return extension; - } catch(Exception e) { - RSECorePlugin.getDefault().getLog().log( - new Status(IStatus.ERROR, info.bundle.getSymbolicName(), -1, e.getMessage(), e)); - } - } - } - return null; - } - - /** - * Return the default keystore provider. - * The default provider is the one which was added last by the - * extension registry, and loads properly. - * @return An ISystemKeystoreProvider instance, or <code>null</code> - * if no provider is found at the given index. - */ - public ISystemKeystoreProvider getDefaultProvider() - { - int idx = _extensions.size()-1; - while (idx>=0) { - ISystemKeystoreProvider provider = getProviderAt(idx); - if (provider!=null) { - return provider; - } - _extensions.remove(idx); - idx--; - } - return null; - } - - /** - * Return an array of all registered keystore providers. - * The default provider is the one which was added last by the - * extension registry, and loads properly. - * @return An array of all registered keystore providers - * that load properly. - */ - public ISystemKeystoreProvider[] getProviders() - { - List providers = new ArrayList(); - for (int i = _extensions.size()-1; i>=0; i--) { - ISystemKeystoreProvider provider = getProviderAt(i); - if (provider!=null) { - providers.add(0, provider); - } else { - _extensions.remove(i); - } - } - ISystemKeystoreProvider[] result = (ISystemKeystoreProvider[])providers.toArray(new ISystemKeystoreProvider[providers.size()]); - return result; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeEvent.java deleted file mode 100644 index 289703060..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeEvent.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -/** - * A change event passed to you when listening for RSE model changes. - * Note these are post-events, sent after the fact. - */ -public interface ISystemModelChangeEvent { - /** - * Get the event type, such as {@link org.eclipse.rse.core.events.ISystemModelChangeEvents#SYSTEM_RESOURCE_ADDED}. - * @see org.eclipse.rse.core.events.ISystemModelChangeEvents - */ - public int getEventType(); - - /** - * Get the resource type, such as {@link org.eclipse.rse.core.events.ISystemModelChangeEvents#SYSTEM_RESOURCETYPE_CONNECTION}. - * @see org.eclipse.rse.core.events.ISystemModelChangeEvents - */ - public int getResourceType(); - - /** - * Get the resource that this event applies to - */ - public Object getResource(); - - /** - * Get the old name of the resource, in the event of a resource rename. Null for other event types. - */ - public String getOldName(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeEvents.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeEvents.java deleted file mode 100644 index 5b5a79421..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeEvents.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - * David Dykstal (IBM) - [186589] Move User Actions events to the user actions plugin - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -/** - * The event IDs sent when local resources in the RSE model change. - * You should monitor for these events in your view if you display any of the resource types listed here. - * <p> - * To monitor, implement interface {@link org.eclipse.rse.core.events.ISystemModelChangeListener} and - * call {@link org.eclipse.rse.core.model.ISystemRegistry#addSystemModelChangeListener(ISystemModelChangeListener)} - * and in your dispose method, call {@link org.eclipse.rse.core.model.ISystemRegistry#removeSystemModelChangeListener(ISystemModelChangeListener)}. - * <p> - * If you are interesting in firing model change events, see - * {@link org.eclipse.rse.core.model.ISystemRegistry#fireModelChangeEvent(int, int, Object, String)}. - * These events will typically be signalled in an implementation of ISystemRegistry. - */ -public interface ISystemModelChangeEvents { - - /** - * Event Type: a resource was added - */ - public static final int SYSTEM_RESOURCE_ADDED = 1; - - /** - * Event Type: a resource was removed - */ - public static final int SYSTEM_RESOURCE_REMOVED = 2; - - /** - * Event Type: a resource was changed - */ - public static final int SYSTEM_RESOURCE_CHANGED = 4; - - /** - * Event Type: a resource was renamed - */ - public static final int SYSTEM_RESOURCE_RENAMED = 8; - /** - * Event Type: a resource was reordered relative to its siblings - */ - public static final int SYSTEM_RESOURCE_REORDERED = 16; - - /** - * Event Type: all resource were reloaded from the workspace: you need to refresh your viewer! - * This is fired after the user selects the Reload RSE action in the Team view, after recieving files from the repository. - */ - public static final int SYSTEM_RESOURCE_ALL_RELOADED = 128; - - /** - * Resource Type: profile - */ - public static final int SYSTEM_RESOURCETYPE_PROFILE = 1; - /** - * Resource Type: connection - */ - public static final int SYSTEM_RESOURCETYPE_CONNECTION = 2; - /** - * Resource Type: subsystem - */ - public static final int SYSTEM_RESOURCETYPE_SUBSYSTEM = 4; - /** - * Resource Type: filter pool - */ - public static final int SYSTEM_RESOURCETYPE_FILTERPOOL = 8; - /** - * Resource Type: filter pool reference. These are what subsystems contain... references to filter pools. - */ - public static final int SYSTEM_RESOURCETYPE_FILTERPOOLREF = 16; - /** - * Resource Type: filter - */ - public static final int SYSTEM_RESOURCETYPE_FILTER = 32; -// /** -// * Resource Type: user action -// */ -// public static final int SYSTEM_RESOURCETYPE_USERACTION = 128; -// /** -// * Resource Type: named type, which are used in user actions -// */ -// public static final int SYSTEM_RESOURCETYPE_NAMEDTYPE = 256; -// /** -// * Resource Type: compile command -// */ -// public static final int SYSTEM_RESOURCETYPE_COMPILECMD = 512; - /** - * Resource Type: ALL. Used with SYSTEM_RESOURCE_ALL_RELOADED - */ - public static final int SYSTEM_RESOURCETYPE_ALL = 9999; -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeListener.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeListener.java deleted file mode 100644 index f998c4658..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemModelChangeListener.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -/** - * Interface that listeners interesting in changes to local resources in the RSE model - * implement, and subsequently register their interest, via SystemRegistry. - * <p> - * If you list any of the resource types defined in {@link org.eclipse.rse.core.events.ISystemModelChangeEvents} - * you should monitor by implementing this interface, and registering with the - * system registry via {@link org.eclipse.rse.core.model.ISystemRegistry#addSystemModelChangeListener(ISystemModelChangeListener)}. - * In your view's dispose method, you must also de-register by calling - * {@link org.eclipse.rse.core.model.ISystemRegistry#removeSystemModelChangeListener(ISystemModelChangeListener)}. - * <p> - * If you are interesting in firing model change events, see - * {@link org.eclipse.rse.core.model.ISystemRegistry#fireModelChangeEvent(int, int, Object, String)}. - */ -public interface ISystemModelChangeListener { - - /** - * This is the method in your class that will be called when a resource in the - * RSE model changes. You will be called after the resource is changed. - * @see ISystemModelChangeEvent - */ - public void systemModelResourceChanged(ISystemModelChangeEvent event); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeEvent.java deleted file mode 100644 index f3bf66746..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -/** - * Interface of event sent when a remote system preference changes. - * @see org.eclipse.rse.core.events.ISystemPreferenceChangeEvents - */ -public interface ISystemPreferenceChangeEvent { - - /** - * Returns the type of the event. - * @see org.eclipse.rse.core.events.ISystemPreferenceChangeEvents - * @return a type that is one of the constants in ISystemPreferenceChangeEvents. - */ - public int getType(); - - /** - * Set the type of the event. - * @see org.eclipse.rse.core.events.ISystemPreferenceChangeEvents - * @param type the type of the event. - */ - public void setType(int type); - - /** - * Get the old value of the Preference. - * For boolean will be a Boolean object. - * @return the old value of the Preference. - */ - public Object getOldValue(); - - /** - * Get the new value of the Preference. - * For boolean will be a Boolean object. - * @return the new value of the Preference. - */ - public Object getNewValue(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeEvents.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeEvents.java deleted file mode 100644 index d67bb212a..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeEvents.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -/** - * Interface of event ID constants for preferences changed - */ -public interface ISystemPreferenceChangeEvents { - /** - * The Show Filter Pools preference has changed - */ - public static final int EVENT_SHOWFILTERPOOLS = 5; - /** - * The Show Filter String preference has changed - */ - public static final int EVENT_SHOWFILTERSTRINGS = 10; - /** - * The Qualify Connection Names preference has changed - */ - public static final int EVENT_QUALIFYCONNECTIONNAMES = 15; - /** - * The Restore State preference has changed - */ - public static final int EVENT_RESTORESTATE = 20; - - /** - * A connection type has been enabled or disabled - */ - public static final int EVENT_ENABLED_CONNECTIONS_CHANGED = 25; - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeListener.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeListener.java deleted file mode 100644 index e2fe428c8..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemPreferenceChangeListener.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -import java.util.EventListener; - -/** - * Interface that listeners interesting in changes to remote - * system preferences can implement and subsequently register - * their interest in with the ISystemRegistry. - */ -public interface ISystemPreferenceChangeListener extends EventListener { - - /** - * This method will be called when a Preference changes. - * TODO document on which thread the event will be sent. - * @see ISystemPreferenceChangeEvent - * @param event the event being sent. - */ - public void systemPreferenceChanged(ISystemPreferenceChangeEvent event); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeEvent.java deleted file mode 100644 index 26411134e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -import org.eclipse.rse.core.subsystems.ISubSystem; - - -/** - * A change event passed to you when listening for remote resource changes. - * Note these are post-events, sent after the fact. - */ -public interface ISystemRemoteChangeEvent -{ - /** - * Get the event type, such as {@link org.eclipse.rse.core.events.ISystemRemoteChangeEvents#SYSTEM_REMOTE_RESOURCE_CREATED}. - * @see org.eclipse.rse.core.events.ISystemRemoteChangeEvents - * @return the event type. - */ - public int getEventType(); - - /** - * Get the resource that this event applies to. - * It must either be the binary object of the resource, or the absolute name of the resource. - * @return the resource that this event applies to. - */ - public Object getResource(); - - /** - * Get the parent remote object for the affected remote object. This is not always known, - * but when it is (ie, non null) then it can be used to refresh all expanded occurrences of that parent - * @return the parent remote object of the affected resource, - * or <code>null</code> if not applicable. - */ - public Object getResourceParent(); - - /** - * Get the old name of the resource, in the event of a resource rename. - * Null for other event types. - * @return the old name of the resource in case of a rename event, - * or <code>null</code> if not applicable. - */ - public String getOldName(); - - /** - * Get the subsystem in which this resource resides. - * This allows the search for impacts to be limited to subsystems - * of the same parent factory, and to connections with the same - * hostname as the subsystem's connection. - * @return the subsystem in which this resource resides. - */ - public ISubSystem getSubSystem(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeEvents.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeEvents.java deleted file mode 100644 index f17b4b9ce..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeEvents.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -/** - * The event IDs sent when remote resources in the model change - */ -public interface ISystemRemoteChangeEvents -{ - - /** - * Event Type: a remote resource was added - */ - public static final int SYSTEM_REMOTE_RESOURCE_CREATED = 1; - - /** - * Event Type: a remote resource was removed - */ - public static final int SYSTEM_REMOTE_RESOURCE_DELETED = 2; - - /** - * Event Type: a remote resource was changed - */ - public static final int SYSTEM_REMOTE_RESOURCE_CHANGED = 4; - - /** - * Event Type: a remote resource was renamed - */ - public static final int SYSTEM_REMOTE_RESOURCE_RENAMED = 8; - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeListener.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeListener.java deleted file mode 100644 index e96e721e6..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemRemoteChangeListener.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -/** - * Interface that listeners interesting in changes to remote resources - * implement, and subsequently register their interest, in via SystemRegistry. - */ -public interface ISystemRemoteChangeListener -{ - - /** - * This method will be called when a remote resource changes. - * You will be called after the resource is changed. - * TODO document on which thread the event will be sent. - * @param event the event. - */ - public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeEvent.java deleted file mode 100644 index f26bab95c..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeEvent.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core -s ********************************************************************************/ - -package org.eclipse.rse.core.events; - -/** - * Interface of event sent when a remote system resource changes. - * - * These events are mainly for internal use. BPs/ISVs should instead - * fire and monitor for {@link org.eclipse.rse.core.events.ISystemModelChangeEvent}. - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvents - */ -public interface ISystemResourceChangeEvent -{ - /** - * Returns an object identifying the source of this event. - * @see java.util.EventObject - * - * @return an object identifying the source of this event - */ - public Object getSource(); - - /** - * For multi-target events, return the array of source targets. - * @return array of source objects. - */ - public Object[] getMultiSource(); - - /** - * Returns the parent of the object source. - * Only guaranteed to be set for additions and deletions. - * - * @return an object identifying the parent of the source of this event, - * or <code>null</code> if not applicable. - */ - public Object getParent(); - - /** - * Set the parent object of this event. - * @param parent the parent object. - */ - public void setParent(Object parent); - - /** - * Returns the grandparent of the object source. - * Only guaranteed to be set for special case events, which have a - * special contract with the SystemView. - * - * @return an object identifying the grandparent of the source of this event - */ - public Object getGrandParent(); - - /** - * Return the position value for adding a new item. - * Used in ADD events. A negative number indicates an append operation. - * - * @return position to add the new item to. - */ - public int getPosition(); - - /** - * Set the position value for adding a new item. - * Used in ADD events. A negative number indicates an append operation. - * - * @param position zero-based position to insert the new item. - */ - public void setPosition(int position); - - /** - * For relative add events, return the previous node this is being added after. - * @return the previous node for adding a new node after. - */ - public Object getRelativePrevious(); - - /** - * For relative add events, set the previous node this is being added after. - * @param previousObject the object after which to add the new object. - */ - public void setRelativePrevious(Object previousObject); - - /** - * Returns the type of the event. - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvents - * @return a type that is one of the constants in ISystemResourceChangeEvents. - */ - public int getType(); - - /** - * Set the type of this event - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvents - * @param type a type that is one of the constants in ISystemResourceChangeEvents. - */ - public void setType(int type); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeEvents.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeEvents.java deleted file mode 100644 index 7c0bf28e6..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeEvents.java +++ /dev/null @@ -1,307 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier; - -/** - * Interface of event ID constants - */ -public interface ISystemResourceChangeEvents -{ - /** - * The event is specifically a filter reference add (filter added) - */ - public static final int EVENT_ADD_FILTER_REFERENCE = 10; - /** - * The event is specifically a filter reference rename (filter renamed) - */ - public static final int EVENT_RENAME_FILTER_REFERENCE = 15; - /** - * The event is specifically a filter reference delete (filter deleted) - */ - public static final int EVENT_DELETE_FILTER_REFERENCE = 20; - /** - * The event is specifically a filter reference change (filter strings changes) - */ - public static final int EVENT_CHANGE_FILTER_REFERENCE = 25; - /** - * The event is specifically a filter reference move (filters reordered) - */ - public static final int EVENT_MOVE_FILTER_REFERENCES = 30; - - /** - * The event is specifically a filter string reference add (filterstring added) - */ - public static final int EVENT_ADD_FILTERSTRING_REFERENCE = 41; - /** - * The event is specifically a filter string reference delete (filterstring deleted) - */ - public static final int EVENT_DELETE_FILTERSTRING_REFERENCE = 42; - /** - * The event is specifically a filter string reference change (filterstring changed) - */ - public static final int EVENT_CHANGE_FILTERSTRING_REFERENCE = 43; - /** - * The event is specifically a filter string reference move (filterstrings reordered) - */ - public static final int EVENT_MOVE_FILTERSTRING_REFERENCES = 44; - - /** - * The event is a resource add. - */ - public static final int EVENT_ADD = 50; - /** - * The event is a multi-resource add. - */ - public static final int EVENT_ADD_MANY = 51; - - /** - * The event is a resource add. The resource is added relative to the "previous" attribute . - */ - public static final int EVENT_ADD_RELATIVE = 53; - /* - * The event is a multi-resource add. The resources are added relative to the "previous" attribute - * - public static final int EVENT_ADD_MANY_RELATIVE = 54; - */ - - /** - * After an add, you wish to expand the parent to reveal and select the new child. - * This is a harmless operation if the parent was already expanded when EVENT_ADD was sent. - */ - public static final int EVENT_REVEAL_AND_SELECT = 52; - /** - * The event is a single resource deletion. - */ - public static final int EVENT_DELETE = 55; - /* - * The event is a single remote resource deletion. You need only set the source, not the parent - * - public static final int EVENT_DELETE_REMOTE = 56; */ - - /** - * The event is a multiple resource deletion. - */ - public static final int EVENT_DELETE_MANY = 60; - /* - * The event is a multiple resource deletion. You need only set the multisource, not the parent - * - public static final int EVENT_DELETE_REMOTE_MANY = 61; */ - - /** - * The event is a resource rename. - */ - public static final int EVENT_RENAME = 65; - /* - * The event is a remote resource rename. You need only set the source, not the parent - * - public static final int EVENT_RENAME_REMOTE = 66; */ - - /** - * The event is a resource move within the same children set - */ - //public static final int EVENT_MOVE = 70; - /** - * The event is a multiple resource move within the same children set - */ - public static final int EVENT_MOVE_MANY = 75; - /** - * The event is a resource change. This results in a shallow refresh: only direct children are refreshed. - */ - //public static final int EVENT_CHANGE = 80; - /** - * The event is an icon change event - */ - public static final int EVENT_ICON_CHANGE = 81; - - /** - * Refresh the single item passed in the "source" field of the event. - * - * All expanded sub-nodes are re-queried for their children, unexpanded - * nodes lose their children cache. Selection is not maintained by this - * event (use EVENT_REFRESH_REMOTE instead to maintain the selection). - */ - public static final int EVENT_REFRESH = 82; - - /** - * Refresh the items currently selected in the SystemView. - * - * All expanded sub-nodes are re-queried for their children, unexpanded nodes - * lose their children cache. After refreshing, selection of the currently selected - * elements is restored if possible (in case an absoluteName is available). - * - * In case any of the selected items is a leaf node, the parent of that - * leaf node is refreshed rather than the leaf node itself. In this particular - * case, a multiselect is not considered properly. - * - * The SystemScratchpadView also listens to this event and refreshes those - * elements that are selected in it. - * - * @deprecated obtain the selection yourself and do EVENT_REFRESH or EVENT_REFRESH_REMOTE - */ - public static final int EVENT_REFRESH_SELECTED = 83; - - /** - * Refresh the parent of the first item currently selected in the SystemView. - * - * This only refreshes the parent TreeItem of the first item in the selection. - * It does not consider multiselect, multiple occurrences of the Item under multiple - * filters, and does not maintain the current selection. - * - * @deprecated obtain the selection yourself and do EVENT_REFRESH or EVENT_REFRESH_REMOTE - */ - public static final int EVENT_REFRESH_SELECTED_PARENT = 84; - - /** - * Refresh the filter under which the first item currently selected in the - * SystemView is found. - * - * From the filter level, all expanded sub-nodes are re-queried - * for their children, unexpanded nodes lose their children cache. - * After refreshing, selection of the currently selected elements - * is restored if possible. Multiselect is not considered properly. - * - * @deprecated Refreshing a particular context(filter) only can lead - * to inconsistencies, so better obtain the selection yourself - * and do EVENT_REFRESH or EVENT_REFRESH_REMOTE - */ - public static final int EVENT_REFRESH_SELECTED_FILTER = 135; - - /** - * Refresh a remote object in the SystemView, given either the remote - * object or a string that will match on getAbsoluteName, and optionally - * (re)select a list of objects after refreshing. - * - * An object is considered remote if it has an adapter that implements - * {@link ISystemViewElementAdapter}, so it is possible to get the - * associated subsystem and absolute name. This method refreshes all - * occurrences of the remote object, even under multiple filters. - * The tricky part about remote objects is their actual memory object changes - * on each refresh, so to find one in the tree we must use something - * more permanent: hence the use of getAbsoluteName to find it. - * <p> - * You can optionally pass a child remote object, or string, or Vector of - * objects or strings, in the "parent" parameter of the event, and it/they - * will be selected after the refresh. When passing a string, it must be - * the result of {@link IRemoteObjectIdentifier#getAbsoluteName(Object)} - * on the adapter. - */ - public static final int EVENT_REFRESH_REMOTE = 85; - - /** - * The event is a resource property change. - */ - public static final int EVENT_PROPERTY_CHANGE = 86; - /** - * The event is a request to update the property sheet of whatever is currently selected. - */ - public static final int EVENT_PROPERTYSHEET_UPDATE = 87; - - /** - * The event is a resource property change that invalidates child nodes - * in the GUI (eg, hostname change means the expanded information should - * be collapsed) - */ - public static final int EVENT_MUST_COLLAPSE = 90; - /** - * The event is a full collapse of the RSE tree - * Pass "false" for the src value to prevent the memory flush, else - * pass any dummy value for the src to prevent crash, but it is ignored - */ - public static final int EVENT_COLLAPSE_ALL = 91; - /** - * The event is a collapse of the selected elements in the tree - * Pass any dummy value for the src to prevent crash, but it is ignored - */ - public static final int EVENT_COLLAPSE_SELECTED = 92; - /** - * The event is an expand of the selected elements in the tree - * Pass any dummy value for the src to prevent crash, but it is ignored - */ - public static final int EVENT_EXPAND_SELECTED = 93; - /** - * The event is a generic notification that the children have changed - * and must be refreshed. - */ - public static final int EVENT_CHANGE_CHILDREN = 95; - /** - * The event is simply to force selection of the given object. - */ - public static final int EVENT_SELECT = 100; - - /** - * Select one or more remote objects. - * - * The "src" parameter holds a remote object, or string, or Vector of - * objects or strings. When passing a string, it must be the result of - * {@link IRemoteObjectIdentifier#getAbsoluteName(Object)} - * on the adapter of the object. - * The "parent" parameter can optionally hold a model object that is - * the parent of the objects to be refreshed, in order to optimize searches. - */ - public static final int EVENT_SELECT_REMOTE = 101; - - /** - * The event is to both select and expand the given object. - */ - public static final int EVENT_SELECT_EXPAND = 105; - /** - * The event is to log a command that has been run - */ - public static final int EVENT_COMMAND_RUN = 110; - /** - * The event is to log a message from a command that has been run - */ - public static final int EVENT_COMMAND_MESSAGE = 115; - /** - * The event is to replace the children (similar to EVENT_ADD_MANY), it will - * expand also - */ - public static final int EVENT_REPLACE_CHILDREN = 120; - /** - * The event is to log a command that has been run - */ - public static final int EVENT_COMPILE_COMMAND_RUN = 125; - /** - * The event is to update the command history drop-down in the remote shell view - */ - public static final int EVENT_COMMAND_HISTORY_UPDATE = 130; - - /** - * The event is to update the remote shell view when a command is finished - * @deprecated use EVENT_COMMAND_SHELL_FINISHED - */ - public static final int EVENT_COMMAND_FINISHED = 140; - - /** - * The event is to update the remote shell view when a command is finished - */ - public static final int EVENT_COMMAND_SHELL_FINISHED = 140; - public static final int EVENT_COMMAND_SHELL_REMOVED = 141; - - /** - * The event is to update the search view when a search is finished - */ - public static final int EVENT_SEARCH_FINISHED = 150; - - /** - * Predefined event object for a property sheet update. - */ - public static final ISystemResourceChangeEvent PROPERTYSHEET_UPDATE_EVENT = - new SystemResourceChangeEvent("dummy",EVENT_PROPERTYSHEET_UPDATE,null); //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeListener.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeListener.java deleted file mode 100644 index 84777e2b5..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/ISystemResourceChangeListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; -import java.util.EventListener; - -/** - * Interface that listeners interesting in changes to remote - * system connections and subsystems can listen implement and - * subsequently register their interest in via SystemRegistry. - */ -public interface ISystemResourceChangeListener extends EventListener -{ - /** - * This is the method in your class that will be called when a - * system resource changes. - * @see ISystemResourceChangeEvent - */ - public void systemResourceChanged(ISystemResourceChangeEvent event); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/SystemRemoteChangeEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/SystemRemoteChangeEvent.java deleted file mode 100644 index ae44dd600..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/SystemRemoteChangeEvent.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; - -import org.eclipse.rse.core.subsystems.ISubSystem; - -/** - * For listeners interested in changes with remote resources. - * These events are designed to state what the change to the resource was, not to - * optimize those events for a GUI (eg, a delete event versus a refresh event) - */ -public class SystemRemoteChangeEvent implements ISystemRemoteChangeEvent -{ - private int eventType; - private Object resource, parent; - private String oldName; - private ISubSystem subsystem; - private Object originatingViewer; - - /** - * Constructor for non-rename event - * @param eventType - one of the constants from {@link org.eclipse.rse.core.events.ISystemRemoteChangeEvents} - * @param resource - the remote resource object, or absolute name of the resource as would be given by calling getAbsoluteName on its remote adapter - * @param resourceParent - the remote resource's parent object, or absolute name, if that is known. If it is non-null, this will aid in refreshing occurences of that parent. - * @param subsystem - the subsystem which contains this remote resource. This allows the search for impacts to be - * limited to subsystems of the same parent factory, and to connections with the same hostname as the subsystem's connection. - */ - public SystemRemoteChangeEvent(int eventType, Object resource, Object resourceParent, ISubSystem subsystem) - { - super(); - this.eventType = eventType; - this.resource = resource; - this.parent = resourceParent; - this.subsystem = subsystem; - } - - /** - * Constructor for a rename event. - * @param eventType - one of the constants from {@link org.eclipse.rse.core.events.ISystemRemoteChangeEvents} - * @param resource - the remote resource object, or absolute name of the resource as would be given by calling getAbsoluteName on its remote adapter - * @param resourceParent - the remote resource's parent object, or absolute name, if that is known. If it is non-null, this will aid in refreshing occurences of that parent. - * @param subsystem - the subsystem which contains this remote resource. This allows the search for impacts to be - * limited to subsystems of the same parent factory, and to connections with the same hostname as the subsystem's connection. - * @param oldName - on a rename operation, this is the absolute name of the resource prior to the rename - */ - public SystemRemoteChangeEvent(int eventType, Object resource, Object resourceParent, ISubSystem subsystem, String oldName) - { - this(eventType, resource, resourceParent, subsystem); - this.oldName = oldName; - } - - /** - * Constructor you shouldn't use unless you intend to call the setters - */ - public SystemRemoteChangeEvent() - { - } - - /** - * Reset the event type - */ - public void setEventType(int eventType) - { - this.eventType = eventType; - } - - /** - * Reset the resource - */ - public void setResource(Object resource) - { - this.resource = resource; - } - - /** - * Reset the resource's remote resource parent - */ - public void setResourceParent(Object resourceParent) - { - this.parent = resourceParent; - } - - /** - * Reset the subsystem - */ - public void setSubSystem(ISubSystem subsystem) - { - this.subsystem = subsystem; - } - - /** - * Reset the old name on a rename event - */ - public void setOldName(String oldName) - { - this.oldName = oldName; - } - - /** - * Get the event type, such as {@link org.eclipse.rse.core.events.ISystemRemoteChangeEvents#SYSTEM_REMOTE_RESOURCE_CREATED}. - * @see org.eclipse.rse.core.events.ISystemRemoteChangeEvents - */ - public int getEventType() - { - return eventType; - } - - /** - * Get the resource that this event applies to - * It must either be the binary object of the resource, or the absolute name of the resource. - */ - public Object getResource() - { - return resource; - } - - /** - * Get the parent remote object for the affected remote object. This is not always known, - * but when it is (ie, non null) then it can be used to refresh all expanded occurrences of that parent - */ - public Object getResourceParent() - { - return parent; - } - - /** - * Get the subsystem in which this resource resides. - * This allows the search for impacts to be limited to subsystems of the same parent factory, and to connections - * with the same hostname as the subsystem's connection. - */ - public ISubSystem getSubSystem() - { - return subsystem; - } - - /** - * Get the old name of the resource, in the event of a resource rename. Null for other event types. - */ - public String getOldName() - { - return oldName; - } - - /** - * Set the originating viewer. - * Only this viewer is candidate for updating the selection. Eg, on a - * create event, if this and the resource parent is set, the newly - * created object is selected after the parent's contents are refreshed, - * for the originating viewer. - */ - public void setOriginatingViewer(Object originatingViewer) { - this.originatingViewer = originatingViewer; - } - - /** - * Get the originating viewer from which this remote resource change event - * comes from. The combination of this, if non-null, plus the resource parent, - * allows viewers to decide whether to update the selection within the - * parent resource, after refreshing that resource. - */ - public Object getOriginatingViewer() { - return originatingViewer; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/SystemResourceChangeEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/SystemResourceChangeEvent.java deleted file mode 100644 index 24cef06c2..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/events/SystemResourceChangeEvent.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.events; -import java.util.EventObject; - -/** - * Event object sent to SystemResourceChangeListeners when a - * remote system object is created, changed, removed, etc. - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvents - */ -public class SystemResourceChangeEvent - extends EventObject - implements ISystemResourceChangeEvent -{ - private static final long serialVersionUID = 1; - private Object parent,grandparent, prevObj; - private Object[] multiSource; - private int type; - private int position = -1; - - /** - * Constructor for SystemResourceChangeEvent. - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvents - * @param source The object that was added,deleted,renamed,changed. - * @param type The type of event, one of ISystemChangeEvent constants. - * @param parent The parent of the object that was added or deleted. - */ - public SystemResourceChangeEvent(Object source, int type, Object parent) - { - super(source); - setType(type); - setParent(parent); - } - /** - * Constructor for SystemResourceChangeEvent when the source is multipe resources. - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvents - * @param source The array of objects that were added,deleted,renamed,changed. - * @param type The type of event, one of ISystemChangeEvent constants. - * @param parent The parent of the object that was added or deleted. - */ - public SystemResourceChangeEvent(Object[] source, int type, Object parent) - { - super(((source!=null) && (source.length>0)) ? source[0] : "nada"); // defect 42112 //$NON-NLS-1$ - this.multiSource = source; - this.type = type; - this.parent = parent; - } - - /** - * For multi-target events, return the array of source targets. - */ - public Object[] getMultiSource() - { - return multiSource; - } - - /** - * Return the parent of the object added or removed. - * @see ISystemResourceChangeEvent#getParent() - */ - public Object getParent() - { - return parent; - } - /** - * Set the parent - */ - public void setParent(Object parent) - { - this.parent = parent; - } - - /** - * Return the grand parent of the object added or removed. - * @see ISystemResourceChangeEvent#getParent() - */ - public Object getGrandParent() - { - return grandparent; - } - /** - * Set the grand parent of the object added or removed. - */ - public void setGrandParent(Object grandparent) - { - this.grandparent = grandparent; - } - /** - * Return the position value. Used in ADD events. - * @return position to add the new item to. A negative number indicates an append operation - */ - public int getPosition() - { - return position; - } - /** - * Set the position value. Used in ADD events. - * @param position zero-based position to insert the new item. A negative number indicates an append operation - */ - public void setPosition(int position) - { - this.position = position; - } - - /** - * Return the type of the event (add, change, remove, rename, change, property change). - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvents - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvent - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvent#getType() - */ - public int getType() - { - return type; - } - /** - * Set the type - * @see org.eclipse.rse.core.events.ISystemResourceChangeEvents - */ - public void setType(int type) - { - this.type = type; - } - - /** - * For relative add events, return the previous node this is being added after - */ - public Object getRelativePrevious() - { - return prevObj; - } - /** - * For relative add events, set the previous node this is being added after - */ - public void setRelativePrevious(Object previousObject) - { - this.prevObj = previousObject; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/IRSEFilterNamingPolicy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/IRSEFilterNamingPolicy.java deleted file mode 100644 index 58739c836..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/IRSEFilterNamingPolicy.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - - -/** - * Allows tool writers to specify the naming standards for the - * persistence files and folders involved with filters. - * <p> - * Note that not all methods will be used for all saving policies. - * <p> - * @see org.eclipse.rse.core.filters.SystemFilterNamingPolicy#getNamingPolicy() - */ -public interface IRSEFilterNamingPolicy { - /** - * Get the unqualified save file name for the given SystemFilterPoolManager object name. - * Do NOT include the extension, as .xmi will be added. - */ - public String getManagerSaveFileName(String managerName); - - /** - * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object name. - * Do NOT include the extension, as .xmi will be added. - */ - public String getReferenceManagerSaveFileName(String managerName); - - /** - * Get the unqualified save file name for the given SystemFilterPool object name. - * Do NOT include the extension, as .xmi will be added. - */ - public String getFilterPoolSaveFileName(String poolName); - - /** - * Get the file name prefix for all pool files. - * Used to deduce the saved pools by examining the file system - */ - public String getFilterPoolSaveFileNamePrefix(); - - /** - * Get the folder name for the given SystemFilterPool object name. - */ - public String getFilterPoolFolderName(String poolName); - - /** - * Get the folder name prefix for all pool folders. - * Used to deduce the saved pools by examining the file system - */ - public String getFilterPoolFolderNamePrefix(); - - /** - * Get the unqualified save file name for the given SystemFilter object name - * Do NOT include the extension, as .xmi will be added. - */ - public String getFilterSaveFileName(String filterName); - - /** - * Get the file name prefix for all filter files. - * Used to deduce the saved pools by examining the file system - */ - public String getFilterSaveFileNamePrefix(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java deleted file mode 100644 index d7ff35daa..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java +++ /dev/null @@ -1,706 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.core.filters; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.references.IRSEReferencedObject; - -/** - * A representation of the model object '<em><b>System Filter</b></em>'. - * A filter consists of filter strings and may be contained in a filter pool. - * Filter pools will be referenced by subsystems. - * Subsystems are responsible for interpreting the filters. Filters, in and - * of themselves, provide no interpretation of themselves when applied - * to the resources managed by a subsystem. - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isSupportsNestedFilters <em>Supports Nested Filters</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#getRelativeOrder <em>Relative Order</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isDefault <em>Default</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isPromptable <em>Promptable</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isSupportsDuplicateFilterStrings <em>Supports Duplicate Filter Strings</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isNonDeletable <em>Non Deletable</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isNonRenamable <em>Non Renamable</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isNonChangable <em>Non Changable</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isStringsNonChangable <em>Strings Non Changable</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#getRelease <em>Release</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#getNestedFilters <em>Nested Filters</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}</li> - * <li>{@link org.eclipse.rse.filters.ISystemFilter#getStrings <em>Strings</em>}</li> - * </ul> - * </p> - * - */ -/** - * @lastgen interface SystemFilterPool extends SystemReferencedObject, SystemFilterContainer {} - */ -public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContainer, IRSEModelObject { - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * This is the name of the filter. It may be present in the user interface and is also - * used to refer to the filter when it is persisted. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - */ - String getName(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * This is the name of the filter. It may be present in the user interface and is also - * used to refer to the filter when it is persisted. - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - */ - void setName(String value); - - /** - * Returns the value of the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * Filters may be further typed for use by subsystems. The type is also uninterpreted by the - * filter. The type may be used to select a parser/interpreter for the filter strings. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Type</em>' attribute. - * @see #setType(String) - */ - String getType(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getType <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * Filters may be further typed for use by subsystems. The type is also uninterpreted by the - * filter. The type may be used to select a parser/interpreter for the filter strings. - * <!-- end-user-doc --> - * @param value the new value of the '<em>Type</em>' attribute. - * @see #getType() - */ - void setType(String value); - - /** - * Returns the value of the '<em><b>Supports Nested Filters</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * Specifies whether filters may be nested or not. If nested the intent is to apply this filter - * to the results of the parent filter - further restricting the resources selected by the - * parent filter. However, it is up to the subsystem to interpret exactly what "nesting" means. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Supports Nested Filters</em>' attribute. - * @see #setSupportsNestedFilters(boolean) - */ - boolean isSupportsNestedFilters(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsNestedFilters <em>Supports Nested Filters</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * Specifies whether filters may be nested or not. If nested the intent is to apply this filter - * to the results of the parent filter - further restricting the resources selected by the - * parent filter. However, it is up to the subsystem to interpret exactly what "nesting" means. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Supports Nested Filters</em>' attribute. - * @see #isSupportsNestedFilters() - */ - void setSupportsNestedFilters(boolean value); - - /** - * Returns the value of the '<em><b>Relative Order</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Relative Order</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Relative Order</em>' attribute. - * @see #setRelativeOrder(int) - */ - int getRelativeOrder(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelativeOrder <em>Relative Order</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Relative Order</em>' attribute. - * @see #getRelativeOrder() - */ - void setRelativeOrder(int value); - - /** - * Returns the value of the '<em><b>Default</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Default</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Default</em>' attribute. - * @see #setDefault(boolean) - */ - boolean isDefault(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isDefault <em>Default</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Default</em>' attribute. - * @see #isDefault() - */ - void setDefault(boolean value); - - /** - * Returns the value of the '<em><b>Strings Case Sensitive</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that may be used by the subystems when interpreting the filter. Used - * to indicate whether or not comparisons involving the filter should be considered - * case sensitive. - * This attribute is optional and may be known (set) or unknown (unset). - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Strings Case Sensitive</em>' attribute. - * @see #isSetStringsCaseSensitive() - * @see #unsetStringsCaseSensitive() - * @see #setStringsCaseSensitive(boolean) - */ - boolean isStringsCaseSensitive(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that may be used by the subystems when interpreting the filter. Used - * to indicate whether or not comparisons involving the filter should be considered - * case sensitive. - * This attribute is optional and may be known (set) or unknown (unset). - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Strings Case Sensitive</em>' attribute. - * @see #isSetStringsCaseSensitive() - * @see #unsetStringsCaseSensitive() - * @see #isStringsCaseSensitive() - */ - void setStringsCaseSensitive(boolean value); - - /** - * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that may be used by the subystems when interpreting the filter. Used - * to indicate whether or not comparisons involving the filter should be considered - * case sensitive. - * This attribute is optional and may be known (set) or unknown (unset). - * </p> - * <!-- end-user-doc --> - * @see #isSetStringsCaseSensitive() - * @see #isStringsCaseSensitive() - * @see #setStringsCaseSensitive(boolean) - */ - void unsetStringsCaseSensitive(); - - /** - * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute is set. - * <!-- begin-user-doc --> - * <p> - * An attribute that may be used by the subystems when interpreting the filter. Used - * to indicate whether or not comparisons involving the filter should be considered - * case sensitive. - * This attribute is optional and may be known (set) or unknown (unset). - * </p> - * <!-- end-user-doc --> - * @return whether the value of the '<em>Strings Case Sensitive</em>' attribute is set. - * @see #unsetStringsCaseSensitive() - * @see #isStringsCaseSensitive() - * @see #setStringsCaseSensitive(boolean) - */ - boolean isSetStringsCaseSensitive(); - - /** - * Returns the value of the '<em><b>Promptable</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that may be used by the subystems when interpreting the filter. - * Typically used to indicate whether or not some sort of prompting is to occur when the - * filter is used. Typically used when applying a filter in the UI to indicate - * the start of a wizard or dialog. It may also have an effect on whether - * the state of the filter is saved when the workbench is shut down. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Promptable</em>' attribute. - * @see #setPromptable(boolean) - */ - boolean isPromptable(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isPromptable <em>Promptable</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that may be used by the subystems when interpreting the filter. - * Typically used to indicate whether or not some sort of prompting is to occur when the - * filter is used. Typically used when applying a filter in the UI to indicate - * the start of a wizard or dialog. It may also have an effect on whether - * the state of the filter is saved when the workbench is shut down. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Promptable</em>' attribute. - * @see #isPromptable() - */ - void setPromptable(boolean value); - - /** - * Returns the value of the '<em><b>Supports Duplicate Filter Strings</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * This attribute may be used by subsystems when interpreting the filter. - * Typically used when adding filter strings to the filter or as a hint when - * applying the filter to the resources understood by the subsystem. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Supports Duplicate Filter Strings</em>' attribute. - * @see #setSupportsDuplicateFilterStrings(boolean) - */ - boolean isSupportsDuplicateFilterStrings(); - - /** - * Does this support duplicate filter strings? - * A convenience method for {@link #isSupportsDuplicateFilterStrings()}. - */ - public boolean supportsDuplicateFilterStrings(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsDuplicateFilterStrings <em>Supports Duplicate Filter Strings</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * This attribute may be used by subsystems when interpreting the filter. - * Typically used when adding filter strings to the filter or as a hint when - * applying the filter to the resources understood by the subsystem. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Supports Duplicate Filter Strings</em>' attribute. - * @see #isSupportsDuplicateFilterStrings() - */ - void setSupportsDuplicateFilterStrings(boolean value); - - /** - * Returns the value of the '<em><b>Non Deletable</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that can be used when managing filters in filter pools. - * Some filters should not be deleted. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Non Deletable</em>' attribute. - * @see #setNonDeletable(boolean) - */ - boolean isNonDeletable(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonDeletable <em>Non Deletable</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that can be used when managing filters in filter pools. - * Some filters should not be deleted. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Non Deletable</em>' attribute. - * @see #isNonDeletable() - */ - void setNonDeletable(boolean value); - - /** - * Returns the value of the '<em><b>Non Renamable</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that can be used when managing filters in filter pools. - * Some filters should not be renamed. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Non Renamable</em>' attribute. - * @see #setNonRenamable(boolean) - */ - boolean isNonRenamable(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonRenamable <em>Non Renamable</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that can be used when managing filters in filter pools. - * Some filters should not be renamed. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Non Renamable</em>' attribute. - * @see #isNonRenamable() - */ - void setNonRenamable(boolean value); - - /** - * Returns the value of the '<em><b>Non Changable</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that can be used when managing filters in filter pools. - * Some filters should not be modifiable. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Non Changable</em>' attribute. - * @see #setNonChangable(boolean) - */ - boolean isNonChangable(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonChangable <em>Non Changable</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that can be used when managing filters in filter pools. - * Some filters should not be modifiable. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Non Changable</em>' attribute. - * @see #isNonChangable() - */ - void setNonChangable(boolean value); - - /** - * Returns the value of the '<em><b>Strings Non Changable</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that can be used when managing filters in filter pools. - * Some filters contain filter strings that should not be modifiable. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Strings Non Changable</em>' attribute. - * @see #setStringsNonChangable(boolean) - */ - boolean isStringsNonChangable(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsNonChangable <em>Strings Non Changable</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * An attribute that can be used when managing filters in filter pools. - * Some filters contain filter strings that should not be modifiable. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Strings Non Changable</em>' attribute. - * @see #isStringsNonChangable() - */ - void setStringsNonChangable(boolean value); - - /** - * Returns the value of the '<em><b>Release</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * This is an attribute specifying the release level of the - * filter. This will be persisted in the filter definition and - * can be used to migrate the internal form of the filter. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Release</em>' attribute. - * @see #setRelease(int) - */ - int getRelease(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelease <em>Release</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * This is an attribute specifying the release level of the - * filter. This will be persisted in the filter definition and - * can be used to migrate the internal form of the filter. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Release</em>' attribute. - * @see #getRelease() - */ - void setRelease(int value); - - /** - * Returns the value of the '<em><b>Single Filter String Only</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * This attribute specifies that the filter may contain only a single - * filter string. Used by a filter manager to ensure that the - * filter contains only one string. May, alternatively, be enforced - * by the filter implementation. - * </p><p> - * This attribute may be set or unset. If unset then this value must not be - * relied upon. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Single Filter String Only</em>' attribute. - * @see #isSetSingleFilterStringOnly() - * @see #unsetSingleFilterStringOnly() - * @see #setSingleFilterStringOnly(boolean) - */ - boolean isSingleFilterStringOnly(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <p> - * This attribute specifies that the filter may contain only a single - * filter string. Used by a filter manager to ensure that the - * filter contains only one string. May, alternatively, be enforced - * by the filter implementation. - * </p><p> - * This attribute may be set or unset. If unset then this value must not be - * relied upon. - * </p> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Single Filter String Only</em>' attribute. - * @see #isSetSingleFilterStringOnly() - * @see #unsetSingleFilterStringOnly() - * @see #isSingleFilterStringOnly() - */ - void setSingleFilterStringOnly(boolean value); - - /** - * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSetSingleFilterStringOnly() - * @see #isSingleFilterStringOnly() - * @see #setSingleFilterStringOnly(boolean) - */ - void unsetSingleFilterStringOnly(); - - /** - * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute is set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return whether the value of the '<em>Single Filter String Only</em>' attribute is set. - * @see #unsetSingleFilterStringOnly() - * @see #isSingleFilterStringOnly() - * @see #setSingleFilterStringOnly(boolean) - */ - boolean isSetSingleFilterStringOnly(); - - /** - * Returns the value of the '<em><b>Nested Filters</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilter}. - * It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}'. - * <!-- begin-user-doc --> - * <p> - * If this filter can contain child filters this will return the list of children. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Nested Filters</em>' containment reference list. - * @see org.eclipse.rse.core.filters.ISystemFilter#getParentFilter - */ - List getNestedFilters(); - - /** - * Returns the value of the '<em><b>Parent Filter</b></em>' container reference. - * It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters <em>Nested Filters</em>}'. - * <!-- begin-user-doc --> - * <p> - * If this filter can be nested inside another this will return the parent filter. Will be - * null if there is no parent. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Parent Filter</em>' container reference. - * @see #setParentFilter(ISystemFilter) - * @see org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters - */ - ISystemFilter getParentFilter(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}' container reference. - * <!-- begin-user-doc --> - * This is used by a filter manager to set the parent filter when one filter is nested inside another. - * <!-- end-user-doc --> - * @param value the new value of the '<em>Parent Filter</em>' container reference. - * @see #getParentFilter() - */ - void setParentFilter(ISystemFilter value); - - /** - * Returns the value of the '<em><b>Strings</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilterString}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the value of the '<em>Strings</em>' containment reference list. - */ - java.util.List getStrings(); - - /** - * @return the parent pool of this filter. For nested filters, this will walk up the parent chain - * until we find the pool. May return null if this is a simple filter that has no parent pool. - */ - public ISystemFilterPool getParentFilterPool(); - - /** - * Internal use method to set the parent filter pool. This should be invoked only by a filter manager - * or a filter pool manager when adding a filter to a filter pool. - * @param parentPool the filter pool that contains or will contain this filter. - */ - public void setParentFilterPool(ISystemFilterPool parentPool); - - /** - * Set this filter's filter strings by giving a Vector of String objects. - * This will construct the filter strings objects. - * @param strings the vector of String objects. - */ - public void setFilterStrings(Vector strings); - - /** - * Set this filter's filter strings by giving an array of String objects. - * This will construct the filter strings objects. - * @param strings the array of String objects. - */ - public void setFilterStrings(String[] strings); - - /** - * @return this filter's filter strings as a Vector of String objects - */ - public Vector getFilterStringsVector(); - - /** - * @return this filter's filter strings as a Vector of IFilterString objects - */ - public Vector getFilterStringObjectsVector(); - - /** - * @return this filter's filter strings as an array of String objects - */ - public String[] getFilterStrings(); - - /** - * @return this filter's filter string objects as an array of IFilterString objects - */ - public ISystemFilterString[] getSystemFilterStrings(); - - /** - * @return the number of filter strings this filter currently contains. - */ - public int getFilterStringCount(); - - /** - * @return a filter string given its string value. This will be null if there - * is no string matching the argument. - */ - public ISystemFilterString getSystemFilterString(String string); - - /** - * Append a new filter string to this filter's list of filter strings. - * This will construct a filter string object. - * @param newString the string to append - */ - public ISystemFilterString addFilterString(String newString); - - /** - * Insert a new filter string to this filter's list, at the given zero-based position. - * Thsi will construct a filter string object. - * @param newString the string from which to construct the filter string to be added. - * @param position the zero-based position at which to add the string. - */ - public ISystemFilterString addFilterString(String newString, int position); - - /** - * Update a new filter string's string value. - * The filter string need not belong to this filter. - * @param filterString the string update. - * @param newValue the new value of that string. - */ - public void updateFilterString(ISystemFilterString filterString, String newValue); - - /** - * Delete a filter string from this filter's list. - * @param oldString the string to remove - * @return the SystemFilterString object deleted, or null if not found - */ - public ISystemFilterString removeFilterString(String oldString); - - /** - * Remove a filter string from this filter's list, given its zero-based position - * @param position the position of the filter string. - * @return the SystemFilterString object deleted, or null if not found - */ - public ISystemFilterString removeFilterString(int position); - - /** - * Remove a filter string from this filter's list, given its SystemFilterString object. - * The specific filter string will be removed, based on object identity. - * @param filterString the filterString to be removed. - * @return true if the given string existed and hence was deleted. - */ - public boolean removeFilterString(ISystemFilterString filterString); - - /** - * Move a given filter string to a given zero-based location. This will - * do nothing if the argument is not a string already contained by this filter. - * @param pos the new position of this filter string - * @param filterString the filter string to move - */ - public void moveSystemFilterString(int pos, ISystemFilterString filterString); - - /** - * Copies a given filter string from this filter to another filter in this pool or another pool - * in this manager or another manager. Will do nothing if the filter string is not - * originally contained in this filter. - * @param targetFilter the filter to which to copy the filter string - * @param oldFilterString the filter string to copy - */ - public ISystemFilterString copySystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString); - - /** - * @return true if this filter is a nested filter or not. If not, its parent is the filter pool. - */ - public boolean isNested(); - - /** - * @return true if this a transient or simple filter that is not intended to be - * saved or part of the filter framework. It will have no manager or provider. - */ - public boolean isTransient(); - - /** - * Clones a given filter to the given target filter. - * All filter strings, and all nested filters, are copied. - * Typically used when copying a whole filter. - * @param targetFilter new filter into which all the data of this filter will be copied. - */ - public void clone(ISystemFilter targetFilter); - - /** - * @return the ISystemFilterContainer parent of this filter. This will be either - * an ISystemFilterPool or an ISystemFilter if this is a nested filter. - */ - public ISystemFilterContainer getParentFilterContainer(); - - /** - * @return the caller which instantiated the filter pool manager overseeing this filter framework instance. - * This will typically be a subsystem configuration. - */ - public ISystemFilterPoolManagerProvider getProvider(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainer.java deleted file mode 100644 index 21e5ddbbf..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainer.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import java.util.Vector; - -import org.eclipse.rse.core.model.IRSEPersistableContainer; - -/** - * Filter containers are any objects that contain filters. - * This includes filter pools and filters themselves. - */ -public interface ISystemFilterContainer extends IRSEPersistableContainer { - /** - * @return the filter pool manager managing this collection of filter pools and their filters. - */ - public ISystemFilterPoolManager getSystemFilterPoolManager(); - - /** - * @return The value of the StringsCaseSensitive attribute - * Are filters in this filter container case sensitive? - * If not set locally, queries the parent filter pool manager's atttribute. - */ - public boolean areStringsCaseSensitive(); - - /** - * Adds a new system filter to this container (SystemFilterPool or SystemFilter) and - * populates it with the filter strings created from the strings provided. - * Does nothing if this filter already exists in this container. - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - */ - public ISystemFilter createSystemFilter(String aliasName, Vector filterStrings); - - /** - * Adds given filter to the list without populating the filter strings. - * @param filter SystemFilter object to add - * @return true if added, false if a filter with this aliasname already existed. - */ - public boolean addSystemFilter(ISystemFilter filter); - - /** - * @return Vector of String objects: the names of existing filters in this container. - * Typically used by name validators for New and Rename actions to verify new name is unique. - */ - public Vector getSystemFilterNames(); - - /** - * @return a Vector of the ISystemFilter objects contained in this filter container. - */ - public Vector getSystemFiltersVector(); - - /** - * @return an array of the ISystemFilter objects contained in this filter container. - */ - public ISystemFilter[] getSystemFilters(); - - /** - * @return a system filter given its name. Will return null if no filter by this name is found. - */ - public ISystemFilter getSystemFilter(String filterName); - - /** - * @return the parent pool of this container. - * If this is itself a pool, returns "this". - * For a nested filter, returns the pool that is the ultimate parent of this filter. - */ - public ISystemFilterPool getSystemFilterPool(); - - /** - * @return how many filters are directly defined in this filter container. - */ - public int getSystemFilterCount(); - - /** - * Removes a given filter from the list. Will do nothing if the specified filter - * is not in this filter container. - * @param filter SystemFilter object to remove - */ - public void deleteSystemFilter(ISystemFilter filter); - - /** - * Renames a given filter in the list. The new name is assumed to be valid. - * Will perform the rename whether or not the filter is contained in this - * container. - * @param filter SystemFilter object to rename - * @param newName New name to assign it. - */ - public void renameSystemFilter(ISystemFilter filter, String newName); - - /** - * @return a given filter's zero-based location. Will return -1 if the filter - * is not present in this container. - */ - public int getSystemFilterPosition(ISystemFilter filter); - - /** - * Move a given filter to a given zero-based location. - * Does nothing if the filter is not in this container. - * @param pos the new position of the filter. - * @param filter the filter to move. - */ - public void moveSystemFilter(int pos, ISystemFilter filter); - - /** - * Updates a given filter. - * The filter need not be present in this container but will operate on - * any filter. - * @param filter SystemFilter object to update - * @param newName New name to assign it. Assumes unique checking already done. - * @param newStrings New strings to assign it. Replaces current strings. - */ - public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainerReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainerReference.java deleted file mode 100644 index d6af1e378..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainerReference.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import org.eclipse.rse.core.subsystems.ISubSystem; - -/** - * Both ISystemFilter and ISystemFilterPool may contain filters, so the - * common methods for filters are abstracted out in SystemFilterContainer, - * which both classes implement. - * Both ISystemFilterReference and ISystemFilterPoolReference hold references - * to ISystemFilterContainer objects. - * There are methods common to both classes, related to - * getting an array of references to the filters that are held by the referenced - * object. - * This interface captures those common methods, and both - * SystemFilterReference and SystemFilterPoolReference - * implement this interface and hence these methods. - */ -public interface ISystemFilterContainerReference { - /** - * @return the filter container object which is referenced. - */ - public ISystemFilterContainer getReferencedSystemFilterContainer(); - - /** - * Build and return an array of SystemFilterReference objects. - * Each object is created new. There is one for each of the filters - * in the reference SystemFilter or SystemFilterPool. - * For performance reasons, we will cache this array and only - * return a fresh one if something changes in the underlying - * filter list. - * @param subSystem the subsystem from which to get the filter references. - */ - public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem); - - /** - * Finds an existing filter in a particular subsystem. - * @param subSystem the subsystem in which to look for the filter reference. - * @param filter the filter for which to look. - * @return an existing reference to a given system filter. - * If no reference currently exists to this filter, returns null. - * @see #getSystemFilterReference(ISubSystem, ISystemFilter) - */ - public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter); - - /** - * Find or create a single filter refererence to a given filter. - * If there already is a reference to this filter, in this subsystem it will be returned. - * If not, a new reference is created and added at the end of the list of filter references. - * @param subSystem the subsystem in which to find or create the filter. - * @param filter the filter to for which to create a reference. - * @see #getExistingSystemFilterReference(ISubSystem, ISystemFilter) - */ - public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter); - - /** - * @return the name of the SystemFilter or SystemFilterPool that we reference. - */ - public String getName(); - - /** - * @return true if this container has filters. - */ - public boolean hasFilters(); - - /** - * @return the number of filters in the referenced container - */ - public int getFilterCount(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java deleted file mode 100644 index b08169a5f..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java +++ /dev/null @@ -1,342 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.references.IRSEPersistableReferencedObject; - -/** - * This interface represents a system filter pool, which is a means of - * grouping filters.<br> - * By default this is represented as a folder on disk, with each filter - * stored as a file in that folder. - */ -/** - * @lastgen interface SystemFilterPool extends SystemPersistableReferencedObject, SystemFilterContainer {} - */ -public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISystemFilterContainer, IRSEModelObject { - // external methods - /** - * Return the caller which instantiated the filter pool manager overseeing this filter framework instance - */ - public ISystemFilterPoolManagerProvider getProvider(); - - /** - * Set the naming policy used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - */ - public void setNamingPolicy(IRSEFilterNamingPolicy namingPolicy); - - /** - * Get the naming policy currently used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - */ - public IRSEFilterNamingPolicy getNamingPolicy(); - - /** - * Does this filter support nested filters? - */ - public boolean supportsNestedFilters(); - - /** - * Does this support duplicate filter strings? Calls mof-generated isSupportsDuplicateFilterStrings. - */ - public boolean supportsDuplicateFilterStrings(); - - /** - * @return The value of the StringsCaseSensitive attribute - * Are filter strings in this filter case sensitive? - * If not set locally, queries the parent filter pool manager's atttribute. - */ - public boolean isStringsCaseSensitive(); - - /** - * Set the filter pool manager. - */ - public void setSystemFilterPoolManager(ISystemFilterPoolManager mgr); - - /** - * Return the filter pool manager managing this collection of filter pools and their filters. - */ - public ISystemFilterPoolManager getSystemFilterPoolManager(); - - /** - * This is to set transient data that is queryable via getFilterPoolData - */ - public void setSystemFilterPoolData(Object data); - - /** - * Return transient data set via setFilterPoolData. - */ - public Object getSystemFilterPoolData(); - - /** - * Clone this filter pools' attributes and filters into another filter pool. - * Assumes the core attributes were already set when filter pool was created: - * <ul> - * <li>Name - * <li>Deletable - * <li>Supports nested filters - * <li>Manager - * </ul> - * Attributes we clone: - * <ul> - * <li>Data - * <li>Type - * <li>Default - * </ul> - */ - public void cloneSystemFilterPool(ISystemFilterPool targetPool) throws Exception; - - /** - * Copy a system filter to this or another filter pool. - */ - public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) throws Exception; - - /** - * Order filters according to user preferences. - * <p> - * While the framework has all the code necessary to arrange filters and save/restore - * that arrangement, you may choose to use preferences instead of this support. - * In this case, call this method and pass in the saved and sorted filter name list. - * <p> - * Called by someone after restore. - */ - public void orderSystemFilters(String[] names); - - /** - * Set the save file policy. See constants in SystemFilterConstants. One of: - * <ul> - * <li>SAVE_POLICY_ONE_FILE_PER_POOL - * <li>SAVE_POLICY_ONE_FILE_PER_FILTER - * </ul> - * This method is called by the SystemFilterPoolManager. - */ - public void setSavePolicy(int policy); - - public String getId(); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Name attribute - */ - String getName(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Name attribute - */ - void setName(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Type attribute - * Allows tools to have typed filter pools - */ - String getType(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Type attribute - */ - void setType(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the SupportsNestedFilters attribute - */ - boolean isSupportsNestedFilters(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the SupportsNestedFilters attribute - */ - void setSupportsNestedFilters(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Deletable attribute - */ - boolean isDeletable(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Deletable attribute - */ - void setDeletable(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Default attribute - * Is this a default vendor-supplied pool versus user-created pool - */ - boolean isDefault(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Default attribute - */ - void setDefault(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the StringsCaseSensitive attribute - */ - void setStringsCaseSensitive(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * Unsets the StringsCaseSensitive attribute - */ - void unsetStringsCaseSensitive(); - - /** - * @generated This field/method will be replaced during code generation - * @return <b>true</b> if the StringsCaseSensitive attribute has been set - */ - boolean isSetStringsCaseSensitive(); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Filters references - */ - java.util.List getFilters(); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the SupportsDuplicateFilterStrings attribute - */ - boolean isSupportsDuplicateFilterStrings(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the SupportsDuplicateFilterStrings attribute - */ - void setSupportsDuplicateFilterStrings(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Release attribute - * In what release was this created? Typically, will be the version and release - * times 10, as in 40 or 51. - */ - int getRelease(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Release attribute - */ - void setRelease(int value); - - /** - * Returns the value of the '<em><b>Single Filter String Only</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Single Filter String Only</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Single Filter String Only</em>' attribute. - * @see #isSetSingleFilterStringOnly() - * @see #unsetSingleFilterStringOnly() - * @see #setSingleFilterStringOnly(boolean) - */ - boolean isSingleFilterStringOnly(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Single Filter String Only</em>' attribute. - * @see #isSetSingleFilterStringOnly() - * @see #unsetSingleFilterStringOnly() - * @see #isSingleFilterStringOnly() - * @generated - */ - void setSingleFilterStringOnly(boolean value); - - /** - * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSetSingleFilterStringOnly() - * @see #isSingleFilterStringOnly() - * @see #setSingleFilterStringOnly(boolean) - * @generated - */ - void unsetSingleFilterStringOnly(); - - /** - * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute is set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return whether the value of the '<em>Single Filter String Only</em>' attribute is set. - * @see #unsetSingleFilterStringOnly() - * @see #isSingleFilterStringOnly() - * @see #setSingleFilterStringOnly(boolean) - * @generated - */ - boolean isSetSingleFilterStringOnly(); - - /** - * Returns the value of the '<em><b>Owning Parent Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Owning Parent Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Owning Parent Name</em>' attribute. - * @see #setOwningParentName(String) - */ - String getOwningParentName(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#getOwningParentName <em>Owning Parent Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Owning Parent Name</em>' attribute. - * @see #getOwningParentName() - * @generated - */ - void setOwningParentName(String value); - - /** - * Returns the value of the '<em><b>Non Renamable</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Non Renamable</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Non Renamable</em>' attribute. - * @see #setNonRenamable(boolean) - */ - boolean isNonRenamable(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isNonRenamable <em>Non Renamable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Non Renamable</em>' attribute. - * @see #isNonRenamable() - * @generated - */ - void setNonRenamable(boolean value); - -} 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 deleted file mode 100644 index 460fcc39b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java +++ /dev/null @@ -1,622 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import java.util.Vector; - -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemProfile; - -/** - * A filter pool manager manages filter pools. - * <p> - * Each filter pool that is managed becomes a folder on disk. - * <p> - * To create a filter pool manager instance, use the factory methods - * in SystemFilterPoolManagerImpl in the ...impl package. - * You must pass a folder that represents the anchor point for the - * pools managed by this manager instance. - * <p> - * Depending on your tools' needs, you have four choices about how - * the filter pools and filters are persisted to disk. The decision is - * made at the time you instantiate the pool manager and is one of the - * following constants from the {@link SystemFilterConstants} interface: - * <ul> - * <li>SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi - * <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool - * <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder - * <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool - * </ul> - * <p> - * With the policy of one file per pool, there are two possibilities regarding - * the folder structure: - * <ul> - * <li>Each pool gets its own subfolder, and the pool's xmi file goes in - * the pool's unique subfolder: SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - * <li>There are no subfolders per pool, all the xmi pool files go in the - * same folder as specified when creating this manager instance: - * SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - * </ul> - * <p> - * With the policy of one file per filter, each filter pool must have its own folder. - * <p> - * With an instantiated filter pool manager (most tools will only need - * one such instance), you now simply call its methods to work with - * filter pools. For example, use it to: - * <ul> - * <li>Restore all filter pools from disk - * <li>Save all, or individual, filter pools to disk - * <li>Get a list of existing filter pools - * <li>Create filter pools - * <li>Delete filter pools - * <li>Re-order filter pools - * <li>Clone filter pools - * <li>Rename filter pools - * <li>Save all, or individual, filter pools - * </ul> - * All the underlying file system work is handled for you. - * <p> - * Further, this is the front door for working with filters too. By forcing all - * filter related activity through a single point like this, we can ensure that - * all changes are saved to disk, and events are fired properly. - */ -/** - * @lastgen interface SystemFilterPoolManager {} - */ -public interface ISystemFilterPoolManager extends IRSEPersistableContainer { - // --------------------------------- - // ATTRIBUTE METHODS - // --------------------------------- - /** - * Return the caller which instantiated the filter pool manager - */ - public ISystemFilterPoolManagerProvider getProvider(); - - /** - * Return the owning profile for this provider - */ - public ISystemProfile getSystemProfile(); - - /** - * Set the caller instance which instantiated the filter pool manager. - * This is only recorded to enable getProvider from any filter framework object. - */ - public void setProvider(ISystemFilterPoolManagerProvider caller); - - /** - * This is to set transient data that is subsequently queryable. - */ - public void setSystemFilterPoolManagerData(Object data); - - /** - * Return transient data set via setFilterPoolDataManager. - */ - public Object getSystemFilterPoolManagerData(); - - /** - * Return the name of this manager. - * This matches the name of the folder, which is the parent of the individual filter pool folders. - */ - public String getName(); - - /** - * Set the name of this manager. - */ - public void setName(String name); - - /** - * Return attribute indicating if filter pools managed by this manager support nested filters. - */ - public boolean supportsNestedFilters(); - - /** - * Return attribute indicating if filters managed by this manager support nested duplicate filter strings. - */ - public boolean supportsDuplicateFilterStrings(); - - /** - * Set attribute indicating if filter pools managed by this manager support nested filters, by default. - */ - public void setSupportsNestedFilters(boolean supports); - - /** - * Set attribute indicating if filters managed by this manager support duplicate filter strings, by default. - */ - public void setSupportsDuplicateFilterStrings(boolean supports); - - /** - * @return The value of the StringsCaseSensitive attribute - * Are filter strings in this filter case sensitive? - */ - public boolean isStringsCaseSensitive(); - - /** - * @return The value of the StringsCaseSensitive attribute - * Are filter strings in this filter case sensitive? - * Same as isStringsCaseSensitive() - */ - public boolean areStringsCaseSensitive(); - - /** - * Return false if the instantiation of this filter pool manager resulting in a new manager versus a restoration - */ - public boolean wasRestored(); - - // --------------------------------- - // FILTER POOL METHODS - // --------------------------------- - /** - * Get array of filter pool names currently existing. - */ - public String[] getSystemFilterPoolNames(); - - /** - * Get vector of filter pool names currently existing. - */ - public Vector getSystemFilterPoolNamesVector(); - - /** - * Return array of SystemFilterPools managed by this manager. - */ - public ISystemFilterPool[] getSystemFilterPools(); - - /** - * Given a filter pool name, return that filter pool object. - * If not found, returns null. - */ - public ISystemFilterPool getSystemFilterPool(String name); - - /** - * Return the first pool that has the default attribute set to true. - * If none found, returns null. - */ - public ISystemFilterPool getFirstDefaultSystemFilterPool(); - - /** - * Create a new filter pool. - * Inherits the following attributes from this manager: - * <ul> - * <li>data ... the transient data to be associated with every filter pool and filter - * <li>supportsNestedFilters ... whether filters in the pool can themselves contain filters - * </ul> - * <p> - * If a pool of this name already exists, null will be returned. - * <p> - * Depending on the save policy, a new folder to hold the pool may be created. Its name will - * be derived from the pool name. - * <p> - * If the operation is successful, the pool will be saved to disk. - * <p> - * If this operation fails unexpectedly, an exception will be thrown. - */ - public ISystemFilterPool createSystemFilterPool(String name, boolean isDeletable) throws Exception; - - /** - * Delete a given filter pool. Dependending on the save policy, the - * appropriate file or folder on disk will also be deleted. - * <p> - * Does the following: - * <ul> - * <li>Removes all references - * <li>Removes pool object from in-memory model - * <li>Removes folder from disk for policies of one folder per pool - * <li>Removes file from disk for policy of one file per pool - * <li>Saves model to disk for policy of one file per manager - * <li>Invalidates in-memory caches - * <li>Calls back to inform caller of this event - * </ul> - * @param pool The filter pool object to physically delete - */ - public void deleteSystemFilterPool(ISystemFilterPool pool) throws Exception; - - /** - * Delete all existing filter pools. Call this when you are about to delete this manager, say. - */ - public void deleteAllSystemFilterPools(); - - /** - * Pre-test if we are going to run into any trouble renaming any of the files or folders - * used to persist a filter pool. - * @return true if everything seems ok, false if a file/folder is in use. - */ - 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. - * <p> - * Does the following: - * <ul> - * <li>Renames referencing objects - * <li>Renames pool object in the in-memory model - * <li>Renames folder on disk for policies of one folder per pool - * <li>Renames file on disk for policy of one file per pool - * <li>Saves model to disk for policy of one file per manager - * <li>Invalidates in-memory caches - * </ul> - * @param pool The filter pool object to physically rename - * @param newName The new name to give the pool - */ - public void renameSystemFilterPool(ISystemFilterPool pool, String newName) throws Exception; - - /** - * Copy the specified filter pool from this manager to this manager or another manager. - * <p> - * Does the following: - * <ul> - * <li>Clones all filters within the pool - * <li>Clones all filter strings within each filter - * <li>Asks target manager to save to disk - * <li>Calls back to target manager provider, unless callbacks are suspended - * </ul> - * @param targetMgr The target manager to copy our filter pool to. Can be this manager, but target pool name must be unique. - * @param pool The filter pool to copy - * @param newName The new name to give the copied pool - * @return the new copy of the copied system filter pool - */ - public ISystemFilterPool copySystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool pool, String newName) throws Exception; - - /** - * Copy all filter pools from this manager to another manager. - * <p> - * Does the following: - * <ul> - * <li>Clones all filter pools - * <li>Clones all filters within each pool - * <li>Clones all filter strings within each filter - * <li>Asks target manager to save to disk - * <li>Does not callback to caller to fire events, assumes caller doesn't want to know - * </ul> - * @param targetMgr The target manager to copy our filter pools to - */ - public void copySystemFilterPools(ISystemFilterPoolManager targetMgr) throws Exception; - - /** - * Move the specified filter pool from this manager to another manager. - * <p> - * Does the following: - * <ul> - * <li>Performs a {@link #copySystemFilterPool(ISystemFilterPoolManager, ISystemFilterPool, String) copySystemFilterPool} operation. - * <li>If copy is successful, updates all references to reference the new copy. - * <li>If copy is successful, deletes original filter pool in this manager - * <li>If this final delete fails, deletes the copied version and restore original references - * <li>Asks target manager to save to disk - * <li>Saves this manager to disk - * <li>Calls back to both targer manager provider and this manager provider, unless callbacks are suspended - * </ul> - * @param targetMgr The target manager to move our filter pool to. Cannot be this manager. - * @param oldPool The filter pool to move - * @param newName The new name to give the moved pool - * @return the new copy of the moved system filter pool - */ - public ISystemFilterPool moveSystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName) throws Exception; - - // --------------------------------- - // FILTER METHODS - // --------------------------------- - /** - * Creates a new system filter within the given filter container (either a filter pool, or - * a filter). This creates the filter, and then saves the filter pool. - * <p>Calls back to provider to inform of the event (filterEventFilterCreated) - * @param parent The parent which is either a SystemFilterPool or a SystemFilter - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - */ - public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings) throws Exception; - - /** - * Creates a new system filter that is typed. - * Same as {@link #createSystemFilter(ISystemFilterContainer, String, Vector)} but - * takes a filter type as an additional parameter. - * <p> - * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This - * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique - * actions per type, say. - * - * @param parent The parent which is either a SystemFilterPool or a SystemFilter - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - * @param type The type of this filter - */ - public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings, String type) throws Exception; - - /** - * Creates a new system filter that is typed and promptable - * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,Vector, String)} but - * takes a boolean indicating if it is promptable. - * <p> - * A promptable filter is one in which the user is prompted for information at expand time. - * There is no base filter framework support for this, but tools can query this attribute and - * do their own thing at expand time. - * - * @param parent The parent which is either a SystemFilterPool or a SystemFilter - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - * @param type The type of this filter - * @param promptable Pass true if this is a promptable filter - */ - public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings, String type, boolean promptable) throws Exception; - - /** - * Delete an existing system filter. - * Does the following: - * <ul> - * <li>Removes filter from its parent in memory. - * <li>If appropriate for the save policy, deletes the filter's file from disk. - * <li>Save the SystemFilterPool which direct or indirectly contains the filter. - * <li>Calls back to provider to inform of the event (filterEventFilterDelete) - * </ul> - */ - public boolean deleteSystemFilter(ISystemFilter filter) throws Exception; - - /** - * Renames a filter. This is better than filter.setName(String newName) as it - * saves the parent pool to disk. - * <p> - * Does the following: - * <ul> - * <li>Renames the object in the in-memory cache - * <li>If appropriate for the save policy, rename's the filter's file on disk. - * <li>Save parent filter pool's in-memory object to disk. - * <li>Calls back to provider to inform of the event (filterEventFilterRenamed) - * </ul> - */ - public void renameSystemFilter(ISystemFilter filter, String newName) throws Exception; - - /** - * Updates a filter. This is better than doing it directly as it saves it to disk. - * <p> - * Does the following: - * <ul> - * <li>Updates the object in the in-memory cache - * <li>Save parent filter pool's in-memory object to disk. - * <li>Calls back to provider to inform of the event (filterEventFilterUpdated). Will be two callbacks if the name is changed ((filterEventFilterRenamed) - * </ul> - */ - public void updateSystemFilter(ISystemFilter filter, String newName, String[] strings) throws Exception; - - /** - * Sets a filter's type. This is better than calling filter.setType(String) directly as it saves the filter to disk after. - * <p> - * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This - * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique - * actions per type, say. - * @param filter The parent which is either a SystemFilter - * @param newType The type of this filter - */ - public void setSystemFilterType(ISystemFilter filter, String newType) throws Exception; - - /** - * Copy a system filter to a pool in this or another filter manager. - */ - public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) throws Exception; - - /** - * Return the zero-based position of a SystemFilter object within its container - */ - public int getSystemFilterPosition(ISystemFilter filter); - - /** - * Move a system filter to a pool in this or another filter manager. - * Does this by first copying the filter, and only if successful, deleting the old copy. - */ - public ISystemFilter moveSystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) throws Exception; - - /** - * Move existing filters a given number of positions in the same container. - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.<p> - * <p> - * Does the following: - * <ul> - * <li>After the move, the pool containing the filter is saved to disk. - * <li>Calls back to provider to inform of the event (filterEventFiltersRePositioned) - * </ul> - * @param filters Array of SystemFilters to move. - * @param delta the amount by which to move the filters - */ - public void moveSystemFilters(ISystemFilter filters[], int delta) throws Exception; - - /** - * Order filters according to user preferences. - * <p> - * While the framework has all the code necessary to arrange filters and save/restore - * that arrangement, you may choose to use preferences instead of this support. - * In this case, call this method and pass in the saved and sorted filter name list. - * <p> - * Called by someone after restore. - */ - public void orderSystemFilters(ISystemFilterPool pool, String[] names) throws Exception; - - // ------------------------------- - // SYSTEM FILTER STRING METHODS... - // ------------------------------- - /** - * Append a new filter string to the given filter's list - * <p> - * Does the following: - * <ul> - * <li>Adds the filter string to the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringCreated) - * </ul> - */ - public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString) throws Exception; - - /** - * Insert a new filter string to the given filter's list, at the given zero-based position - * <p> - * Does the following: - * <ul> - * <li>Adds the filter string to the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringCreated) - * </ul> - */ - public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString, int position) throws Exception; - - /** - * Remove a filter string from this filter's list, given its SystemFilterString object. - * <p> - * Does the following: - * <ul> - * <li>Removes the filter string from the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringDeleted) - * </ul> - * @return true if the given string existed and hence was deleted. - */ - public boolean removeSystemFilterString(ISystemFilter filter, ISystemFilterString filterString) throws Exception; - - /** - * Delete a filter string from the given filter's list - * <p> - * Does the following: - * <ul> - * <li>Removes the filter string from the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringDeleted) - * </ul> - * @return true if given string was found and hence was deleted. - */ - public boolean removeSystemFilterString(ISystemFilter filter, String oldString) throws Exception; - - /** - * Remove a filter string from the given filter's list, given its zero-based position - * <p> - * Does the following: - * <ul> - * <li>Removes the filter string from the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringDeleted) - * </ul> - * @return true if a string existed at the given position and hence was deleted. - */ - public boolean removeSystemFilterString(ISystemFilter filter, int position) throws Exception; - - /** - * Update a filter string's string vale - * <p> - * Does the following: - * <ul> - * <li>Update the filter string in the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringUpdated) - * </ul> - */ - public void updateSystemFilterString(ISystemFilterString filterString, String newValue) throws Exception; - - /** - * Return the zero-based position of a SystemFilterString object within its filter - */ - public int getSystemFilterStringPosition(ISystemFilterString filterString); - - /** - * Copy a system filter string to a filter in this or another filter pool manager. - */ - public ISystemFilterString copySystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString) throws Exception; - - /** - * Move a system filter string to a filter in this or another filter pool manager. - * Does this by doing a copy operation, then if successful doing a delete operation. - */ - public ISystemFilterString moveSystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString) throws Exception; - - /** - * Move existing filter strings a given number of positions in the same filter - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.<p> - * <p> - * Does the following: - * <ul> - * <li>After the move, the filter pool containing the filter containing the filter strings is saved to disk. - * <li>Calls back to provider to inform of the event (filterEventFilterStringsRePositioned) - * </ul> - * @param filterStrings Array of SystemFilterStrings to move. - * @param delta the amount by which to move the filters - */ - public void moveSystemFilterStrings(ISystemFilterString filterStrings[], int delta) throws Exception; - - // ----------------------------------- - // SUSPEND/RESUME CALLBACKS METHODS... - // ----------------------------------- - /** - * Suspend callbacks to the provider - */ - public void suspendCallbacks(boolean suspend); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the SupportsNestedFilters attribute - */ - boolean isSupportsNestedFilters(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the StringsCaseSensitive attribute - */ - void setStringsCaseSensitive(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Pools references - */ - java.util.List getPools(); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the SupportsDuplicateFilterStrings attribute - */ - boolean isSupportsDuplicateFilterStrings(); - - /** - * @generated This field/method will be replaced during code generation - * Unsets the SupportsDuplicateFilterStrings attribute - */ - void unsetSupportsDuplicateFilterStrings(); - - /** - * @generated This field/method will be replaced during code generation - * @return <b>true</b> if the SupportsDuplicateFilterStrings attribute has been set - */ - boolean isSetSupportsDuplicateFilterStrings(); - - /** - * Returns the value of the '<em><b>Single Filter String Only</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Single Filter String Only</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Single Filter String Only</em>' attribute. - * @see #setSingleFilterStringOnly(boolean) - */ - boolean isSingleFilterStringOnly(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPoolManager#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Single Filter String Only</em>' attribute. - * @see #isSingleFilterStringOnly() - * @generated - */ - void setSingleFilterStringOnly(boolean value); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManagerProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManagerProvider.java deleted file mode 100644 index 8aeafcc7e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManagerProvider.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * An interface for classes that instantiate SystemFilterPoolManager objects. - * This is the "caller" and as is recorded and recoverable from any object within - * the filter framework. This enables callers to get back instances of themselves - * given any filter object. Important when enabling UI actions against user - * selected filter framework objects - * <p> - * Further, the goal is the allow all the filter framework UI actions to work - * independently, able to fully handle all actions without intervention on the - * provider's part. However, often the provider needs to be informed of all events - * in order to fire events to update its GUI. So this interface captures those - * callbacks that done to the provider for every interesting event. Should you - * not care about these, supply empty shells for these methods. - */ -public interface ISystemFilterPoolManagerProvider extends IAdaptable { - - /** - * Return the unique id for this provider - * @return the id - */ - public String getId(); - - /** - * Return the manager object for the given manager name. - */ - public ISystemFilterPoolManager getSystemFilterPoolManager(String managerName); - - /** - * Return all the manager objects this provider owns - */ - public ISystemFilterPoolManager[] getSystemFilterPoolManagers(); - - /** - * Return all the manager objects this provider owns, to which it wants - * to support referencing from the given filter reference manager. - * <p> - * Called by SystemFilterPoolReferenceManager. - */ - public ISystemFilterPoolManager[] getReferencableSystemFilterPoolManagers(ISystemFilterPoolReferenceManager refMgr); - - /** - * Last chance call, by a filter pool reference manager, when a reference to a filter - * pool is found but the referenced master filter pool is not found in those the reference - * manager by getSystemFilterPoolManagers(). - * <p> - * If this returns null, then this broken reference will be deleted - */ - public ISystemFilterPool getSystemFilterPoolForBrokenReference(ISystemFilterPoolReferenceManager callingRefenceMgr, String missingPoolMgrName, String missingPoolName); - - // --------------------- - // FILTER POOL EVENTS... - // --------------------- - /** - * A new filter pool has been created - */ - public void filterEventFilterPoolCreated(ISystemFilterPool newPool); - - /** - * A filter pool has been deleted - */ - public void filterEventFilterPoolDeleted(ISystemFilterPool oldPool); - - /** - * A filter pool has been renamed - */ - public void filterEventFilterPoolRenamed(ISystemFilterPool pool, String oldName); - - /** - * One or more filter pools have been re-ordered within their manager - */ - public void filterEventFilterPoolsRePositioned(ISystemFilterPool[] pools, int delta); - - // --------------------- - // FILTER EVENTS... - // --------------------- - /** - * A new filter has been created - */ - public void filterEventFilterCreated(ISystemFilter newFilter); - - /** - * A filter has been deleted - */ - public void filterEventFilterDeleted(ISystemFilter oldFilter); - - /** - * A filter has been renamed - */ - public void filterEventFilterRenamed(ISystemFilter filter, String oldName); - - /** - * A filter's strings have been updated - */ - public void filterEventFilterUpdated(ISystemFilter filter); - - /** - * One or more filters have been re-ordered within their pool or filter (if nested) - */ - public void filterEventFiltersRePositioned(ISystemFilter[] filters, int delta); - - // ----------------------- - // FILTER STRING EVENTS... - // ----------------------- - /** - * A new filter string has been created - */ - public void filterEventFilterStringCreated(ISystemFilterString newFilterString); - - /** - * A filter string has been deleted - */ - public void filterEventFilterStringDeleted(ISystemFilterString oldFilterString); - - /** - * A filter string has been updated - */ - public void filterEventFilterStringUpdated(ISystemFilterString filterString); - - /** - * One or more filters have been re-ordered within their filter - */ - public void filterEventFilterStringsRePositioned(ISystemFilterString[] filterStrings, int delta); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReference.java deleted file mode 100644 index 2f6f0fece..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReference.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.core.filters; - -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.references.IRSEPersistableReferencingObject; - -/** - * Interface implemented by references to filter pools. Filter pools are stored at the profile - * level, while subsystems contain references to one or more pools. A pool can be referenced - * by multiple connections. Pools don't go away until explicitly deleted by the user, regardless - * of their reference count. - */ -public interface ISystemFilterPoolReference extends IRSEPersistableReferencingObject, ISystemFilterContainerReference, IRSEModelObject { - /** - * @return the reference manager which is managing this filter pool reference - */ - public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager(); - - /** - * @return the object which instantiated the pool reference manager object. - * Makes it easy to get back to the point of origin, given any filter pool reference. - */ - public ISystemFilterPoolReferenceManagerProvider getProvider(); - - /** - * @return the simple name of the filter pool we reference. Not qualified by the manager name. - */ - public String getReferencedFilterPoolName(); - - /** - * @return name of the filter pool manager containing the pool we reference. - */ - public String getReferencedFilterPoolManagerName(); - - /** - * Reset the name of the filter pool we reference. - * Called on filter pool rename operations. - * @param newName the new name of the filer pool - */ - public void resetReferencedFilterPoolName(String newName); - - /** - * Set the filter pool that we reference. - * This should also call addReference(this) on that pool. - * @param pool the pool to which this reference refers. - */ - public void setReferenceToFilterPool(ISystemFilterPool pool); - - /** - * @return referenced filter pool object. - * This may be null if the reference is broken - * or is yet to be resolved. - */ - public ISystemFilterPool getReferencedFilterPool(); - - /** - * @return the fully qualified name that includes the name of the filter pool manager - */ - public String getFullName(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManager.java deleted file mode 100644 index d13be3772..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManager.java +++ /dev/null @@ -1,297 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import java.util.Vector; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager; -import org.eclipse.rse.core.subsystems.ISubSystem; - -/** - * This class manages a persistable list of objects each of which reference - * a filter pool. This class builds on the parent class SystemPersistableReferenceManager, - * offering convenience versions of the parent methods that are typed to the - * classes in the filters framework. - */ -/** - * @lastgen interface SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager {} - */ -public interface ISystemFilterPoolReferenceManager extends IRSEBasePersistableReferenceManager { - /** - * Get the object which instantiated this instance of the filter pool reference manager. - * This is also available from any filter reference framework object. - */ - public ISystemFilterPoolReferenceManagerProvider getProvider(); - - /** - * Set the object which instantiated this instance of the filter pool reference manager. - * This makes it available to retrieve from any filter reference framework object, - * via the ubiquitous getProvider interface method. - */ - public void setProvider(ISystemFilterPoolReferenceManagerProvider caller); - - /** - * Turn off callbacks to the provider until turned on again. - */ - public void setProviderEventNotification(boolean fireEvents); - - // ------------------------------------------------------------ - // Methods for setting and querying related filterpool manager - // ------------------------------------------------------------ - /* - * Set the managers of the master list of filter pools, from which - * objects in this list reference. - * NOW DELETED SO THAT WE DYNAMICALLY QUERY THIS LIST FROM THE - * ASSOCIATED SYSTEMFILTERPOOLMANAGER PROVIDER, SO IT IS ALWAYS UP - * TO DATE. psc. - */ - //public void setSystemFilterPoolManagers(SystemFilterPoolManager[] mgrs); - /** - * Set the associated master pool manager provider. Note the provider - * typically manages multiple pool managers and we manage references - * across those. - */ - public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider poolMgrProvider); - - /** - * Get the associated master pool manager provider. Note the provider - * typically manages multiple pool managers and we manage references - * across those. - */ - public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider(); - - /** - * Get the managers of the master list of filter pools, from which - * objects in this list reference. - */ - public ISystemFilterPoolManager[] getSystemFilterPoolManagers(); - - /** - * Get the managers of the master list of filter pools, from which - * objects in this list reference, but which are not in the list of - * managers our pool manager supplier gives us. That is, these are - * references to filter pools outside the expected list. - * @return null if no unmatched managers found, else an array of such managers. - */ - public ISystemFilterPoolManager[] getAdditionalSystemFilterPoolManagers(); - - /** - * Set the default manager of the master list of filter pools, from which - * objects in this list reference. - */ - public void setDefaultSystemFilterPoolManager(ISystemFilterPoolManager mgr); - - /** - * Get the default manager of the master list of filter pools, from which - * objects in this list reference. - */ - public ISystemFilterPoolManager getDefaultSystemFilterPoolManager(); - - // --------------------------------------------------- - // Methods that work on FilterPool referencing objects - // --------------------------------------------------- - /** - * Ask each referenced pool for its name, and update it. - * Called after the name of the pool or its manager changes. - */ - public void regenerateReferencedSystemFilterPoolNames(); - - /** - * Return array of SystemFilterPoolReference objects. - * Result will never be null, although it may be an array of length zero. - */ - public ISystemFilterPoolReference[] getSystemFilterPoolReferences(); - - /** - * In one shot, set the filter pool references - * <p> Calls back to inform provider - * @param filterPoolReferences of filter pool reference objects to set the list to. - * @param deReference true to first de-reference all objects in the existing list. - */ - public void setSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolReferences, boolean deReference); - - /** - * Add a filter pool referencing object to the list. - * @return the new count of referencing objects - */ - public int addSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference); - - /** - * Reset the filter pool a reference points to. Called on a move-filter-pool operation - */ - public void resetSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, ISystemFilterPool newPool); - - /** - * Remove a filter pool referencing object from the list. - * @param filterPoolReference the reference to remove - * @param deReference true if we want to dereference the referenced object (call removeReference on it) - * @return the new count of referencing objects - */ - public int removeSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, boolean deReference); - - /** - * Return count of referenced filter pools - */ - public int getSystemFilterPoolReferenceCount(); - - /** - * Return the zero-based position of a SystemFilterPoolReference object within this list - */ - public int getSystemFilterPoolReferencePosition(ISystemFilterPoolReference filterPoolRef); - - /** - * Move a given filter pool reference to a given zero-based location - * <p> Calls back to inform provider - */ - public void moveSystemFilterPoolReference(ISystemFilterPoolReference filterPoolRef, int pos); - - /** - * Move existing filter pool references a given number of positions. - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.<p> - * <p> Calls back to inform provider - * @param filterPoolRefs Array of SystemFilterPoolReferences to move. - * @param delta the amount by which to move the filter pool references. - */ - public void moveSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolRefs, int delta); - - // ---------------------------------------------- - // Methods that work on FilterPool master objects - // ---------------------------------------------- - /** - * Return array of filter pools currently referenced by this manager - * Result will never be null, although it may be an array of length zero. - */ - public ISystemFilterPool[] getReferencedSystemFilterPools(); - - /** - * Return true if the given filter pool has a referencing object in this list. - */ - public boolean isSystemFilterPoolReferenced(ISystemFilterPool filterPool); - - /** - * Given a filter pool, locate the referencing object for it and return it. - * @return the referencing object if found, else null - */ - public ISystemFilterPoolReference getReferenceToSystemFilterPool(ISystemFilterPool filterPool); - - /** - * Given a filter pool, create a referencing object and add it to the list. - * <p> Calls back to inform provider - * @return new filter pool reference - */ - public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool); - - /** - * Given a filter pool name, create a referencing object and add it to the list. - * This creates an unresolved reference to that filter pool. It will be resolved on first use. - * <p> Calls back to inform provider - * @param filterPoolName the name of the filter pool being referenced. - * @return new filter pool reference - */ - public ISystemFilterPoolReference addReferenceToSystemFilterPool(String filterPoolName); - - /** - * Given a filter pool, locate the referencing object for it and remove it from the list. - * <p> Calls back to inform provider - * @return the new count of referencing objects - */ - public int removeReferenceToSystemFilterPool(ISystemFilterPool filterPool); - - /** - * A reference filter pool has been renamed. Update our stored name... - * <p> Calls back to inform provider - */ - public void renameReferenceToSystemFilterPool(ISystemFilterPool pool); - - /** - * In one shot, set the filter pool references to new references to supplied filter pools. - * <p> Calls back to inform provider - * @param filterPools of filter pool objects to create references for - * @param deReference true to first de-reference all objects in the existing list. - */ - public void setSystemFilterPoolReferences(ISystemFilterPool[] filterPools, boolean deReference); - - // ------------------------- - // SPECIAL CASE METHODS - // ------------------------- - /** - * Create a single filter refererence to a given filter. Needed when a filter - * is added to a pool, and the GUI is not showing pools but rather all filters - * in all pool references. - */ - public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter); - - /** - * Concatenate all filter references from all filter pools we reference, into one - * big list. - */ - public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem); - - /** - * Given a filter reference, return its position within this reference manager - * when you think of all filter references from all filter pool references as - * being concatenated - */ - public int getSystemFilterReferencePosition(ISystemFilterReference filterRef); - - /** - * Given a filter, return its position within this reference manager - * when you think of all filter references from all filter pool references as - * being concatenated - */ - public int getSystemFilterReferencePosition(ISubSystem subSystem, ISystemFilter filter); - - // ------------------------- - // SAVE / RESTORE METHODS... - // ------------------------- - /** - * After restoring this from disk, there is only the referenced object name, - * not the referenced object pointer, for each referencing object. - * <p> - * This method is called after restore and for each restored object in the list must: - * <ol> - * <li>Do what is necessary to find the referenced object, and set the internal reference pointer. - * <li>Call addReference(this) on that object so it can maintain it's in-memory list - * of all referencing objects. - * <li>Set the important transient variables - * </ol> - * @param relatedPoolMgrProvider the creator of the filter pool managers that hold filter pools we reference - * @param provider the host of this reference manager, so you can later call getProvider - * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all - * were resolved. - */ - public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider, ISystemFilterPoolReferenceManagerProvider provider); - - /** - * Save all the filter pool references to disk. - * Use only if not doing your own saving, else override or set save policy to none. - */ - public void save() throws Exception; - - /** - * Return the folder that this manager is contained in. - */ - public IFolder getFolder(); - - /** - * Reset the folder that this manager is contained in. - */ - public void resetManagerFolder(IFolder newFolder); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManagerProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManagerProvider.java deleted file mode 100644 index b1dc5589b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManagerProvider.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -/** - * An interface for classes that instantiate SystemFilterPoolReferenceManager objects. - * This is the "caller" and as is recorded and recoverable from any object within - * the filter reference framework. This enables callers to get back instances of themselves - * given any filter reference object. Important when enabling UI actions against user - * selected filter reference framework objects - * <p> - * Further, the goal is the allow all the filter framework UI actions to work - * independently, able to fully handle all actions without intervention on the - * provider's part. However, often the provider needs to be informed of all events - * in order to fire events to update its GUI. So this interface captures those - * callbacks that done to the provider for every interesting event. Should you - * not care about these, supply empty shells for these methods. - */ -public interface ISystemFilterPoolReferenceManagerProvider { - /** - * Return the SystemFilterPoolReferenceManager object this provider holds/provides. - */ - public ISystemFilterPoolReferenceManager getSystemFilterPoolReferenceManager(); - - /** - * Return the owning filter pool that is unique to this provider - */ - public ISystemFilterPool getUniqueOwningSystemFilterPool(boolean createIfNotFound); - - // ------------------------------- - // FILTER POOL REFERENCE EVENTS... - // ------------------------------- - /** - * A new filter pool reference has been created - */ - public void filterEventFilterPoolReferenceCreated(ISystemFilterPoolReference newPoolRef); - - /** - * A filter pool reference has been deleted - */ - public void filterEventFilterPoolReferenceDeleted(ISystemFilterPoolReference filterPoolRef); - - /** - * A single filter pool reference has been reset to reference a new pool - */ - public void filterEventFilterPoolReferenceReset(ISystemFilterPoolReference filterPoolRef); - - /** - * All filter pool references has been reset - */ - public void filterEventFilterPoolReferencesReset(); - - /** - * A filter pool reference has been renamed (ie, its reference filter pool renamed) - */ - public void filterEventFilterPoolReferenceRenamed(ISystemFilterPoolReference poolRef, String oldName); - - /** - * One or more filter pool references have been re-ordered within their manager - */ - public void filterEventFilterPoolReferencesRePositioned(ISystemFilterPoolReference[] poolRefs, int delta); - - // ------------------------------- - // FILTER REFERENCE EVENTS... - // ------------------------------- - /** - * A new filter has been created. This is called when a filter pool reference is selected and a new filter - * is created, so that the provider can expand the selected filter pool reference and reveal the new filter - * within the selected pool reference. - * <p> - * Only the selected node should be expanded if not already. All other references to this pool will already - * have been informed of the new addition, and will have refreshed their children but not expanded them. - */ - public void filterEventFilterCreated(Object selectedObject, ISystemFilter newFilter); - - // --------------------------------- - // FILTER STRING REFERENCE EVENTS... - // --------------------------------- - /** - * A new filter string has been created. This is called when a filter reference is selected and a new filter - * string is created, so that the provider can expand the selected filter reference and reveal the new filter - * string within the selected filter reference. - * <p> - * Only the selected node should be expanded if not already. All other references to this filter will already - * have been informed of the new addition, and will have refreshed their children but not expanded them. - */ - public void filterEventFilterStringCreated(Object selectedObject, ISystemFilterString newFilterString); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolSelectionValidator.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolSelectionValidator.java deleted file mode 100644 index 974e74558..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolSelectionValidator.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import org.eclipse.rse.services.clientserver.messages.SystemMessage; - -/** - * An interface required if you wish to be called back by the - * system filter wizard, when the user selects a target filter pool. - */ -public interface ISystemFilterPoolSelectionValidator { - - /** - * Delimiter used to qualify filter names by filter pool name, when calling - * filter pool selection validator in new filter wizard. - */ - public static final String DELIMITER_FILTERPOOL_FILTER = "_____"; //$NON-NLS-1$ - - /** - * Validate the given selection. - * @param filterPool the user-selected filter pool - * @return null if no error, else a SystemMessage - */ - public SystemMessage validate(ISystemFilterPool filterPool); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolWrapper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolWrapper.java deleted file mode 100644 index a828e5f7c..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolWrapper.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -/** - * The system filter wizard allows callers to pass a list of wrapper objects - * for the user to select a filter pool. - */ -public interface ISystemFilterPoolWrapper { - - /** - * Get the name to display in the combo box for this wrapper - */ - public String getDisplayName(); - - /** - * Get the wrappered SystemFilterPool object - */ - public ISystemFilterPool getSystemFilterPool(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolWrapperInformation.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolWrapperInformation.java deleted file mode 100644 index 045d1f0a6..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolWrapperInformation.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -/** - * The system filter wizard allows callers to pass a list of wrapper objects - * for the user to select a filter pool. Effectively, this prompting for - * euphemisms to filter pools. This requires an array of wrapper objects, - * and requires replacement text for the pool prompt and tooltip text, and - * the verbiage above it. - * <p> - * This is all encapsulated in this interface. There is also a class offered - * that implements all this and is populated via setters. - */ -public interface ISystemFilterPoolWrapperInformation { - - /** - * Get the label - */ - public String getPromptLabel(); - - /** - * Get the tooltip - */ - public String getPromptTooltip(); - - public String getVerbiageLabel(); - - /** - * Get the list of wrappered filter pool objects to show in the combo. The wrappering allows - * each to be displayed with a different name in the list than just pool.getName() - */ - public ISystemFilterPoolWrapper[] getWrappers(); - - /** - * Get the wrapper to preselect in the list. - */ - public ISystemFilterPoolWrapper getPreSelectWrapper(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterReference.java deleted file mode 100644 index 37ce0c5c4..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterReference.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import org.eclipse.rse.core.model.ISystemContainer; -import org.eclipse.rse.core.model.ISystemContentsType; -import org.eclipse.rse.core.references.IRSEReferencingObject; -import org.eclipse.rse.core.subsystems.ISubSystem; - -/** - * Represents a shadow or reference to a system filter. - * Such references are only transient, not savable to disk. - */ -/** - * @lastgen interface SystemFilterReference extends SystemReferencingObject, SystemFilterContainerReference {} - */ -public interface ISystemFilterReference extends IRSEReferencingObject, ISystemFilterContainerReference, ISystemContainer { - /** - * Return the reference manager which is managing this filter reference - * framework object. - */ - public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager(); - - /** - * Return the object which instantiated the pool reference manager object. - * Makes it easy to get back to the point of origin, given any filter reference - * framework object - */ - public ISystemFilterPoolReferenceManagerProvider getProvider(); - - /** - * Gets the subsystem that contains this reference - * @return the subsystem - */ - public ISubSystem getSubSystem(); - - /** - * Sets the subsystem that contains this reference - * @param subSystem - */ - public void setSubSystem(ISubSystem subSystem); - - /** - * Return the filter to which we reference... - */ - public ISystemFilter getReferencedFilter(); - - /** - * Set the filter to which we reference... - */ - public void setReferencedFilter(ISystemFilter filter); - - /** - * Get the parent of this reference. - * It will be either a SystemFilterPoolReference, or - * a SystemFilterReference(if nested). - */ - public ISystemFilterContainerReference getParent(); - - /** - * Get parent or super parent filter pool reference. - */ - public ISystemFilterPoolReference getParentSystemFilterReferencePool(); - - // ------------------------------------------------- - // Methods for returning filter string references... - // ------------------------------------------------- - /** - * Return the number of filter strings in the referenced filter - */ - public int getSystemFilterStringCount(); - - /** - * Get the filter strings contained by this filter. But get references to each, - * not the masters. - */ - public ISystemFilterStringReference[] getSystemFilterStringReferences(); - - /** - * Create a single filter string refererence to a given filter string - */ - public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString); - - /* - * Sets the cached contents for this filter reference. If the filter changes or is refreshed, these cached - * items will be removed. - */ - public void setContents(ISystemContentsType type, Object[] cachedContents); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterSavePolicies.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterSavePolicies.java deleted file mode 100644 index 43981e3ce..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterSavePolicies.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -/** - * A save policy dictates how filter framework artifacts are persisted to disk. - */ -public interface ISystemFilterSavePolicies { - /** - * No saving. All save/restoring handled elsewhere. - */ - public static final int SAVE_POLICY_NONE = -1; - /** - * Save all filter pools and all filters in one file, with same name as the manager - */ - public static final int SAVE_POLICY_ONE_FILE_PER_MANAGER = 0; - /** - * Save all filters in each filter pool in one file per pool, with the same name as the pool. - * Each pool also has its own unique folder. - */ - public static final int SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL = 1; - /** - * Save all filters in each filter pool in one file per pool, with the same name as the pool - * All pool files go into the same folder. - */ - public static final int SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER = 2; - /** - * Save each filter in each filter pool in its own file, with the same name as the filter - */ - public static final int SAVE_POLICY_ONE_FILE_PER_FILTER = 3; - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStartHere.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStartHere.java deleted file mode 100644 index e6b9de5b0..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStartHere.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.core.filters; - -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.logging.Logger; - -public interface ISystemFilterStartHere { - - /** - * Factory method to return an instance populated with defaults. - * You can then simply override whatever is desired via setXXX methods. - */ - public IRSEFilterNamingPolicy createSystemFilterNamingPolicy(); - - /** - * Factory to create a filter pool manager, when you do NOT want it to worry about - * saving and restoring the filter data to disk. Rather, you will save and restore - * yourself. - * @param logger A logging object into which to log errors as they happen in the framework - * @param caller Objects which instantiate this class should implement the - * SystemFilterPoolManagerProvider interface, and pass "this" for this parameter. - * Given any filter framework object, it is possible to retrieve the caller's - * object via the getProvider method call. - * @param name the name of the filter pool manager. Not currently used but you may - * find a use for it. - * @param allowNestedFilters true if filters inside filter pools in this manager are - * to allow nested filters. This is the default, but can be overridden at the - * individual filter pool level. - */ - public ISystemFilterPoolManager createSystemFilterPoolManager(ISystemProfile profile, Logger logger, ISystemFilterPoolManagerProvider caller, String name, boolean allowNestedFilters); - - /** - * Create a SystemFilterPoolReferenceManager instance, when you do NOT want it - * to be saved and restored to its own file. Rather, you will save and restore it - * yourself. - * @param caller Objects which instantiate this class should implement the - * SystemFilterPoolReferenceManagerProvider interface, and pass "this" for this parameter. - * Given any filter framework object, it is possible to retrieve the caller's - * object via the getProvider method call. - * @param relatedPoolMgrProvider The creator of the managers that own the master list of filter pools that - * this manager will contain references to. - * @param name the name of the filter pool reference manager. This is not currently - * used, but you may find a use for it. - * @param namingPolicy the naming policy object which will return the name of that one file. - */ - public ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(ISystemFilterPoolReferenceManagerProvider caller, ISystemFilterPoolManagerProvider relatedPoolMgrProvider, - String name, IRSEFilterNamingPolicy namingPolicy); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterString.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterString.java deleted file mode 100644 index 5a973ad67..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterString.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.references.IRSEBaseReferencedObject; - -/** - * A filter string is a pattern used by the server-side code to know what to return to - * the client. A filter contains one or more filter strings. Basically, its nothing more - * than a string, and its up to each consumer to know what to do with it. Generally, - * a filter string edit pane is designed to prompt the user for the contents of the - * string in a domain-friendly way. - */ -public interface ISystemFilterString extends IRSEBaseReferencedObject, IAdaptable, IRSEModelObject { - /** - * Return the caller which instantiated the filter pool manager overseeing this filter framework instance - */ - public ISystemFilterPoolManagerProvider getProvider(); - - /** - * Return the filter pool manager managing this collection of filter pools and their filters and their filter strings. - */ - public ISystemFilterPoolManager getSystemFilterPoolManager(); - - /** - * Set the transient parent back-pointer. Called by framework at restore/create time. - */ - public void setParentSystemFilter(ISystemFilter filter); - - /** - * Get the parent filter that contains this filter string. - */ - public ISystemFilter getParentSystemFilter(); - - /** - * Clones this filter string's attributes into the given filter string - */ - public void clone(ISystemFilterString targetString); - - /** - * Is this filter string changable? Depends on mof attributes of parent filter - */ - public boolean isChangable(); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the String attribute - */ - String getString(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the String attribute - */ - void setString(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Type attribute - * Allows tools to have typed filter strings - */ - String getType(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Type attribute - */ - void setType(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Default attribute - * Is this a vendor-supplied filter string versus a user-defined filter string - */ - boolean isDefault(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Default attribute - */ - void setDefault(boolean value); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStringReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStringReference.java deleted file mode 100644 index 6948fd5d7..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStringReference.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import org.eclipse.rse.core.references.IRSEBaseReferencingObject; - -/** - * Represents a reference to a master filter string. - * Needed so GUI can show the same filter string multiple times. - * This is not modelled in MOF. - */ -public interface ISystemFilterStringReference extends IRSEBaseReferencingObject { - /** - * Return the reference manager which is managing this filter reference - * framework object. - */ - public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager(); - - /** - * Return the object which instantiated the pool reference manager object. - * Makes it easy to get back to the point of origin, given any filter reference - * framework object - */ - public ISystemFilterPoolReferenceManagerProvider getProvider(); - - /** - * Get the master filter string - */ - public ISystemFilterString getReferencedFilterString(); - - /** - * Get the referenced filter that contains this filter string reference. - */ - public ISystemFilterReference getParent(); - - /** - * Get the actual filter that contain the actual filter string we reference - */ - public ISystemFilter getParentSystemFilter(); - - /** - * Same as getReferencedFilterString().getString() - */ - public String getString(); -} //SystemFilterStringReference diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterNamingPolicy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterNamingPolicy.java deleted file mode 100644 index 348516847..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterNamingPolicy.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - - -/** - * A naming policy so tool writers can override defaults used when - * saving filter data to disk. - * <p> - * Subclass this and override what you wish to change. - */ -public class SystemFilterNamingPolicy implements IRSEFilterNamingPolicy { - - protected String managerFileNamePrefix; - protected String poolFolderNamePrefix; - protected String poolFolderNameSuffix; - protected String poolFileNamePrefix; - protected String filterFileNamePrefix; - protected String referenceManagerFileNamePrefix; - /** - * Default prefix for filter pool manager persisted file: "filterPools_" - */ - public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER = "filterPools_"; //$NON-NLS-1$ - /** - * Default prefix for filter pool reference manager persisted file: "filterPoolRefs_" - */ - public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER = "filterPoolRefs_"; //$NON-NLS-1$ - /** - * Default prefix for filter pool persisted file: "filterPool_" - */ - public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOL = "filterPool_"; //$NON-NLS-1$ - /** - * Default prefix for filter persisted file: "filter_" - */ - public static final String DEFAULT_FILENAME_PREFIX_FILTER = "filter_"; //$NON-NLS-1$ - /** - * Default prefix for filter pool folder: "FilterPool_" - */ - public static final String DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL = "FilterPool_"; //$NON-NLS-1$ - - /** - * Factory method to return an instance populated with defaults. - * Can then simply override whatever is desired. - */ - public static IRSEFilterNamingPolicy getNamingPolicy() { - return new SystemFilterNamingPolicy(); - } - - /** - * Constructor for SystemFilterNamingPolicyImpl - */ - public SystemFilterNamingPolicy() { - super(); - } - - /** - * Get the unqualified save file name for the given SystemFilterPoolManager object. - * Do NOT include the extension, as .xmi will be added. - * <p> - * Returns "filterPools_"+managerName by default. - */ - public String getManagerSaveFileName(String managerName) { - return DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER + managerName; - } - - /** - * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object. - * Do NOT include the extension, as .xmi will be added. - * <p> - * Returns "filterPoolRefs_"+managerName by default. - */ - public String getReferenceManagerSaveFileName(String managerName) { - return DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER + managerName; - } - - /** - * Get the unqualified save file name for the given SystemFilterPool object. - * Do NOT include the extension, as .xmi will be added. - * <p> - * Returns getFilterPoolSaveFileNamePrefix()+poolName by default. - */ - public String getFilterPoolSaveFileName(String poolName) { - return getFilterPoolSaveFileNamePrefix() + poolName; - } - - /** - * Get the file name prefix for all pool files. - * Used to deduce the saved pools by examining the file system - * <p> - * By default returns "filterPool_" - */ - public String getFilterPoolSaveFileNamePrefix() { - return DEFAULT_FILENAME_PREFIX_FILTERPOOL; - } - - /** - * Get the folder name for the given SystemFilterPool object. - * <p> - * Returns getFilterPoolFolderNamePrefix()+poolName by default. - */ - public String getFilterPoolFolderName(String poolName) { - return getFilterPoolFolderNamePrefix() + poolName; - } - - /** - * Get the folder name prefix for all pool folders. - * Used to deduce the saved pools by examining the file system - * <p> - * By default returns "FilterPool_" - */ - public String getFilterPoolFolderNamePrefix() { - return DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL; - } - - /** - * Get the unqualified save file name for the given SystemFilter object. - * Do NOT include the extension, as .xmi will be added. - * <p> - * Returns getFilterSaveFileNamePrefix()+filterName by default. - */ - public String getFilterSaveFileName(String filterName) { - return getFilterSaveFileNamePrefix() + filterName; - } - - /** - * Get the file name prefix for all filter files. - * Used to deduce the saved filters by examining the file system - * <p> - * Returns "Filter_" by default. - */ - public String getFilterSaveFileNamePrefix() { - return DEFAULT_FILENAME_PREFIX_FILTER; - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterReference.java deleted file mode 100644 index 4d3409819..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterReference.java +++ /dev/null @@ -1,497 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. 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 Dykstal (IBM) - 142806: refactoring persistence framework - ********************************************************************************/ - -package org.eclipse.rse.core.filters; -import java.util.HashMap; -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemContainer; -import org.eclipse.rse.core.model.ISystemContentsType; -import org.eclipse.rse.core.references.IRSEBaseReferencedObject; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.internal.core.filters.SystemFilterContainerReferenceCommonMethods; -import org.eclipse.rse.internal.core.filters.SystemFilterStringReference; -import org.eclipse.rse.internal.references.SystemReferencingObject; - - - -/** - * Represents a shadow or reference to a system filter. - * Such references are only transient, not savable to disk. - * All major function is inherited. - * <p> - * SystemFilter references typically exist for only one reason: - * <ol> - * <li>As a simple shadow to enable a unique object in a GUI tree. For example, - * if it is possible for the same filter to show up in different places in - * the tree, then we must create shadows for each place it shows up. - * </ol> - */ -/** - * @lastgen class SystemFilterReferenceImpl extends SystemReferencingObjectImpl implements IAdaptable, SystemFilterReference, SystemReferencingObject {} - */ -public class SystemFilterReference extends SystemReferencingObject implements IAdaptable, ISystemFilterReference -{ - private SystemFilterContainerReferenceCommonMethods containerHelper = null; - private ISystemFilterContainerReference parent = null; - private ISystemFilter referencedFilter = null; - private ISystemFilterStringReference[] referencedFilterStrings = null; - protected boolean persistent; - protected boolean isStale; -// protected Object[] cachedContents; - protected ISubSystem _subSystem; - - protected HashMap cachedContents; - - public static final boolean PERSISTENT_YES = true; - public static final boolean PERSISTENT_NO = false; - /** - * Constructor. Typically called by MOF. - */ - protected SystemFilterReference() - { - super(); - containerHelper = new SystemFilterContainerReferenceCommonMethods(this); - persistent = true; - isStale = true; - cachedContents = new HashMap(); - } - /** - * Create a new instance of this class. - * @param parent The SystemFilterReference or SystemFilterPoolReference object that we are a child of. - * @param filter The master object to be referenced. - * @param persistent Whether we should formally register our reference with the target filter or not. - */ - public static ISystemFilterReference createSystemFilterReference(ISubSystem subSystem, - ISystemFilterContainerReference parent, - ISystemFilter filter, - boolean persistent) - { - //SystemFilterReferenceImpl newRef = (SystemFilterReferenceImpl)SystemFilterImpl.initMOF().createSystemFilterReference(); - SystemFilterReference newRef = new SystemFilterReference(); // more efficient? - newRef.persistent = persistent; - newRef.setSubSystem(subSystem); - newRef.setParent(parent); - newRef.setReferencedFilter(filter); - filter.addReference(newRef); - return newRef; - } - - /** - * Gets the subsystem that contains this reference - * @return the subsystem - */ - public ISubSystem getSubSystem() - { - return _subSystem; - } - - /** - * Sets the subsystem that contains this reference - * @param subSystem - */ - public void setSubSystem(ISubSystem subSystem) - { - _subSystem = subSystem; - } - - /** - * Return the reference manager which is managing this filter reference - * framework object. - */ - public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() - { - ISystemFilterPoolReference pool = getParentSystemFilterReferencePool(); - if (pool != null) - return pool.getFilterPoolReferenceManager(); - else - return null; - } - - /** - * Return the object which instantiated the pool reference manager object. - * Makes it easy to get back to the point of origin, given any filter reference - * framework object - */ - public ISystemFilterPoolReferenceManagerProvider getProvider() - { - ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); - if (mgr != null) - { - ISystemFilterPoolReferenceManagerProvider provider = mgr.getProvider(); - if (provider == null) - { - provider = getSubSystem(); - } - return provider; - } - else - return null; - } - - - /** - * If this is a reference to a nested filter, the parent is the - * reference to the nested filter's parent. Else, it is the - * reference to the parent filter pool - */ - public void setParent(ISystemFilterContainerReference parent) - { - this.parent = parent; - } - /** - * The parent will either by a SystemFilterPoolReference or - * a SystemFilterReference. - */ - public ISystemFilterContainerReference getParent() - { - return parent; - } - - /** - * Return the filter to which we reference... - */ - public ISystemFilter getReferencedFilter() - { - return persistent ? (ISystemFilter)super.getReferencedObject() : referencedFilter; - } - /** - * Set the filter to which we reference... - */ - public void setReferencedFilter(ISystemFilter filter) - { - if (persistent) - super.setReferencedObject(filter); - else - referencedFilter = filter; - } - - /** - * If this is a reference to a nested filter, the parent is the - * reference to the nested filter's parent. Else, it is the - * reference to the parent filter pool - */ - public ISystemFilterPoolReference getParentSystemFilterReferencePool() - { - if (parent instanceof ISystemFilterPoolReference) - return (ISystemFilterPoolReference)parent; - else - return ((ISystemFilterReference)parent).getParentSystemFilterReferencePool(); - } - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - // ------------------------------------------------------------- - // Methods common with SystemFilterPoolReferenceImpl, and hence - // abstracted out into SystemFilterContainerReference... - // ------------------------------------------------------------- - /** - * Return the object to which we hold a reference. This is either - * SystemFilter or SystemFilterPool. Since both implement - * SystemFilterContainer, that is what we return. - * <p> - * Of course, this is a generic method, and in our case it is always - * true that we only hold a SystemFilter. Hence, this is the same - * as calling getReferenceFilter and casting the result. - */ - public ISystemFilterContainer getReferencedSystemFilterContainer() - { - return getReferencedFilter(); - } - /** - * Build and return an array of SystemFilterReference objects. - * Each object is created new. There is one for each of the filters - * in the reference SystemFilter or SystemFilterPool. - * For performance reasons, we will cache this array and only - * return a fresh one if something changes in the underlying - * filter list. - */ - public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) - { - return containerHelper.getSystemFilterReferences(subSystem); - } - /** - * Create a single filter refererence to a given filter. - * If there already is a reference to this filter, it is returned. - * If not, a new reference is created and appended to the end of the existing filter reference array. - * @see #getExistingSystemFilterReference(ISubSystem, ISystemFilter) - */ - public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) - { - //return containerHelper.generateFilterReference(filter); - return containerHelper.generateAndRecordFilterReference(subSystem, filter); - } - /** - * Return an existing reference to a given system filter. - * If no reference currently exists to this filter, returns null. - * @see #getSystemFilterReference(ISubSystem, ISystemFilter) - */ - public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) - { - return containerHelper.getExistingSystemFilterReference(subSystem, filter); - } - - /** - * Return true if the referenced pool or filter has filters. - */ - public boolean hasFilters() - { - return containerHelper.hasFilters(); - } - - /** - * Return count of the number of filters in the referenced pool or filter - */ - public int getFilterCount() - { - return containerHelper.getFilterCount(); - } - - /** - * Return the name of the SystemFilter or SystemFilterPool that we reference. - * For such objects this is what we show in the GUI. - */ - public String getName() - { - ISystemFilter filter = getReferencedFilter(); - if (filter != null) - return filter.getName(); - else - return ""; //$NON-NLS-1$ - } - - /** - * Override of Object method. Turn this filter in an outputable string - */ - public String toString() - { - return getName(); - } - - // ------------------------------------------------- - // Methods for returning filter string references... - // ------------------------------------------------- - /** - * Return the number of filter strings in the referenced filter - */ - public int getSystemFilterStringCount() - { - int count = 0; - ISystemFilter referencedFilter = getReferencedFilter(); - if (referencedFilter != null) - count = referencedFilter.getFilterStringCount(); - return count; - } - /** - * Get the filter strings contained by this filter. But get references to each, - * not the masters. - */ - public ISystemFilterStringReference[] getSystemFilterStringReferences() - { - // These reference objects are built on the fly, each time, rather than - // maintaining a persisted list of such references. The reason - // is we do no at this time allow users to subset the master list - // of strings maintained by a filter. Hence, we always simply - // return a complete list. However, to save memory we try to only - // re-gen the list if something has changed. - java.util.List mofList = getReferencedFilter().getStrings(); - boolean needToReGen = compareFilterStrings(mofList); - if (needToReGen) - referencedFilterStrings = generateFilterStringReferences(mofList); - return referencedFilterStrings; - } - - /** - * Create a single filter string refererence to a given filter string - */ - public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString) - { - return new SystemFilterStringReference(this, filterString); - } - - - /** - * To save memory, we try to only regenerate the referenced filter list - * if something has changed. - */ - private boolean compareFilterStrings(java.util.List newFilterStrings) - { - boolean mustReGen = false; - if (newFilterStrings == null) - { - if (referencedFilterStrings != null) - return true; - else - return false; - } - else if (referencedFilterStrings == null) - { - return true; // newFilterStrings != null && referencedFilterStrings == null - } - // both old and new are non-null - if (newFilterStrings.size() != referencedFilterStrings.length) - return true; - Iterator i = newFilterStrings.iterator(); - for (int idx=0; !mustReGen && (idx<referencedFilterStrings.length); idx++) - { - ISystemFilterString newFilterString = (ISystemFilterString)i.next(); - if (!(referencedFilterStrings[idx].getReferencedFilterString().equals(newFilterString))) - mustReGen = true; - } - return mustReGen; - } - - /** - * To save the memory of an intermediate array, we create the filter string references - * directly from the MOF model... - */ - private ISystemFilterStringReference[] generateFilterStringReferences(java.util.List newFilterStrings) - { - if (newFilterStrings == null) - return null; - ISystemFilterStringReference[] refs = new ISystemFilterStringReference[newFilterStrings.size()]; - Iterator i = newFilterStrings.iterator(); - int idx = 0; - while (i.hasNext()) - { - refs[idx++] = getSystemFilterStringReference((ISystemFilterString)i.next()); - } - return refs; - } - - - // ----------------------------------- - // IRSEReferencingObject methods... - // ----------------------------------- - - /** - * Set the object to which we reference. Override of inherited - */ - public void setReferencedObject(IRSEBaseReferencedObject obj) - { - setReferencedFilter((ISystemFilter)obj); - } - /** - * Get the object which we reference. Override of inherited - */ - public IRSEBaseReferencedObject getReferencedObject() - { - return getReferencedFilter(); - } - /** - * Fastpath to getReferencedObject().removeReference(this). - * @return new reference count of master object - */ - public int removeReference() - { - int count = 0; - if (persistent) - super.removeReference(); - setReferencedFilter(null); - return count; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.ISystemContainer#hasContents(org.eclipse.rse.model.ISystemContentsType) - */ - public boolean hasContents(ISystemContentsType contentsType) - { - if (cachedContents.containsKey(contentsType)) - { - return true; - } - return false; - } - /* (non-Javadoc) - * @see org.eclipse.rse.model.ISystemContainer#getContents(org.eclipse.rse.model.ISystemContentsType) - */ - public Object[] getContents(ISystemContentsType contentsType) - { - return (Object[])cachedContents.get(contentsType); - } - - public void setContents(ISystemContentsType type, Object[] cachedContents) - { - this.cachedContents.put(type, cachedContents); - - isStale = false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.ISystemContainer#isStale() - */ - public boolean isStale() - { - return isStale; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.ISystemContainer#markStale(boolean) - */ - public void markStale(boolean isStale) - { - markStale(isStale, true); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.ISystemContainer#markStale(boolean) - */ - public void markStale(boolean isStale, boolean clearCache) - { - this.isStale = isStale; - if (clearCache && isStale) - { - Iterator iterator = cachedContents.values().iterator(); - while (iterator.hasNext()) - { - Object[] arr = (Object[])iterator.next(); - for (int i = 0; i < arr.length; i++) - { - Object obj = arr[i]; - if (obj instanceof ISystemContainer) - { - ((ISystemContainer)obj).markStale(true); - } - } - } - cachedContents.clear(); - } - } - - public boolean commit() - { - return false; - } - - public IRSEPersistableContainer getPersistableParent() { - return null; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - return IRSEPersistableContainer.NO_CHILDREN; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterSimple.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterSimple.java deleted file mode 100644 index b39522df8..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterSimple.java +++ /dev/null @@ -1,505 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; -import java.util.HashMap; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.rse.core.model.ISystemContainer; -import org.eclipse.rse.core.model.ISystemContentsType; -import org.eclipse.rse.internal.core.filters.ISystemFilterConstants; -import org.eclipse.rse.internal.core.filters.SystemFilter; - - -/** - * A lightweight override of the full-fledged persistable implementation of SystemFilter. - * This class replaces the heavy-weight MOF implementations with simple non-MOF - * implementations. - * <p> - * This flavour of SystemFilter implementation is for those cases where a simple in-memory - * SystemFilter is needed temporarily, perhaps to populate a GUI widget say, and the filter - * does not need to be savable/restorable. As a result there is no mof, and no need for a - * parent SystemFilterPool or SystemFilterPoolManager. The class is small, simple and - * directly instantiable. - * <p> - * This simple implementation does <i>not</i> support: - * <ul> - * <li>Saving or restoring from disk - * <li>SystemFilterStrings ... only Strings are used for the filter strings - * <li>Nested filters - * <li>Parent filter pool - * <li>The attributes relativeOrder, promptable and default - * </ul> - */ -public class SystemFilterSimple extends SystemFilter implements ISystemContainer -{ - - private String name = null; - private String type = ISystemFilterConstants.DEFAULT_TYPE; - private boolean caseSensitive = false; - private boolean promptable = false; - private Object parent; - // the following are inherited... - //private String[] filterStringArray = null; - //private SystemFilterString[] filterStringObjectArray = null; - //private Vector filterStringVector = null; - protected boolean isStale; - protected HashMap cachedContents; - - /** - * Constructor for SystemFilterSimpleImpl - */ - public SystemFilterSimple(String name) - { - //super(); - this.name = name; - filterStringVector = new Vector(); - isStale = true; - cachedContents = new HashMap(); - } - - protected void invalidateCache() - { - filterStringArray = null; - filterStringObjectArray = null; - //filterStringVector = null; - } - - /** - * Return true if this a transient or simple filter that is only created temporary "on the fly" - * and not intended to be saved or part of the filter framework. Eg it has no manager or provider. - * <p> - * We always return true - */ - public boolean isTransient() - { - return true; - } - - /** - * Clones a given filter to the given target filter. - * All filter strings, and all nested filters, are copied. - * @param targetFilter new filter into which we copy all our data - */ - public void clone(ISystemFilter targetFilter) - { - super.clone(targetFilter); - // hmm, due to polymorphism, we should not have to do anything here! - // well, except for this: - targetFilter.setFilterStrings(getFilterStringsVector()); - } - - // ------------------------------------------------------- - // New methods to simplify life. Often a simple filter - // contains a single filter string so these methods - // make it easier to set/get that filter string - // ------------------------------------------------------- - /** - * Set the single filter string - */ - public void setFilterString(String filterString) - { - filterStringVector.clear(); - filterStringVector.addElement(filterString); - invalidateCache(); - } - /** - * Get the single filter string. - * Returns null if setFilterString has not been called. - */ - public String getFilterString() - { - if (filterStringVector.size() == 0) - return null; - else - return (String)filterStringVector.elementAt(0); - } - - /** - * Set the parent. Since we don't have any filter manager, we need - * some way to store context info for the adapter. Use this. - */ - public void setParent(Object parent) - { - this.parent = parent; - } - - /** - * Get the parent as set in setParent(Object) - */ - public Object getParent() - { - return parent; - } - - // ------------------------------------------------------- - // Functional methods overridden to do something simple... - // ------------------------------------------------------- - - /** - * Set the filter's name - */ - public void setName(String name) - { - this.name = name; - } - /** - * Get the filter's name - */ - public String getName() - { - return name; - } - /** - * Set the filter's type - */ - public void setType(String type) - { - this.type = type; - } - /** - * Get the filter's type - */ - public String getType() - { - return type; - } - /** - * Specify if filter strings in this filter are case sensitive. - * Default is false. - * @param value The new value of the StringsCaseSensitive attribute - */ - public void setStringsCaseSensitive(boolean value) - { - this.caseSensitive = value; - } - - /** - * Are filter strings in this filter case sensitive? - */ - public boolean isStringsCaseSensitive() - { - return caseSensitive; - } - /** - * Are filter strings in this filter case sensitive? - */ - public boolean areStringsCaseSensitive() - { - return caseSensitive; - } - - /** - * Is this a special filter that prompts the user when it is expanded? - */ - public void setPromptable(boolean promptable) - { - this.promptable = promptable; - } - /** - * Is this a special filter that prompts the user when it is expanded? - */ - public boolean isPromptable() - { - return promptable; - } - - /** - * Return filter strings as an array of String objects. - */ - public String[] getFilterStrings() - { - if (filterStringArray == null) - { - filterStringArray = new String[filterStringVector.size()]; - for (int idx=0; idx<filterStringArray.length; idx++) - filterStringArray[idx] = (String)filterStringVector.elementAt(idx); - } - return filterStringArray; - } - /** - * Return filter strings as a Vector of String objects - */ - public Vector getFilterStringsVector() - { - return filterStringVector; - } - /** - * Return how many filter strings are defined in this filter. - */ - public int getFilterStringCount() - { - return filterStringVector.size(); - } - /** - * Set all the filter strings for this filter. - * @param newStrings Vector of String objects - */ - public void setFilterStrings(Vector newStrings) - { - filterStringVector.clear(); - for (int idx=0; idx<newStrings.size(); idx++) - { - filterStringVector.addElement(newStrings.elementAt(idx)); - } - invalidateCache(); - } - /** - * Set all the filter strings for this filter. - * @param newStrings array of String objects - */ - public void setFilterStrings(String newStrings[]) - { - filterStringVector.clear(); - for (int idx=0; idx<newStrings.length; idx++) - { - filterStringVector.addElement(newStrings[idx]); - } - invalidateCache(); - } - /** - * Append a new filter string to this filter's list. - * Returns null. - */ - public ISystemFilterString addFilterString(String newString) - { - filterStringVector.addElement(newString); - invalidateCache(); - return null; - } - /** - * Insert a new filter string to this filter's list, at the given zero-based position. - * Returns null. - */ - public ISystemFilterString addFilterString(String newString, int position) - { - filterStringVector.insertElementAt(newString,position); - invalidateCache(); - return null; - } - - /** - * Delete a filter string from this filter's list. - * Returns null. - */ - public ISystemFilterString removeFilterString(String oldString) - { - filterStringVector.removeElement(oldString); - invalidateCache(); - return null; - } - - /** - * Remove a filter string from this filter's list, given its zero-based position - * @return the SystemFilterString object deleted, or null if not found - */ - public ISystemFilterString removeFilterString(int position) - { - filterStringVector.removeElementAt(position); - invalidateCache(); - return null; - } - /** - * Return the children of this filter. - * This is the same as getFilterStrings() - */ - public Object[] getChildren() - { - return getFilterStrings(); - } - /** - * Returns true if this filter has any filter strings - */ - public boolean hasChildren() - { - return (filterStringVector.size() > 0); - } - - // ------------------------------------------------------- - // Non-applicable methods overridden to do nothing... - // ------------------------------------------------------- - - /** - * Get this filter's filter string objects as an array. - * We return null, as we don't support SystemFilterString objects, - * just String objects. - */ - public ISystemFilterString[] getSystemFilterStrings() - { - return null; - } - - /** - * Overridden to do nothing - */ - public void setSupportsNestedFilters(boolean value) {} - /** - * Does this support nested filters? No. Not for simple filtes. - */ - public boolean supportsNestedFilters() {return false;} - /** - * Return true if this filter is a nested filter or not. - * Overridden to return false; - */ - public boolean isNested() { return false; } - /** - * Update a new filter string's string value. - * Overridden to do nothing. - */ - public void updateFilterString(ISystemFilterString filterString, String newValue) {} - /** - * Remove a filter string from this filter's list, given its SystemFilterString object. - * Overridden to do nothing - */ - public boolean removeFilterString(ISystemFilterString filterString) {return false;} - /** - * Move a given filter string to a given zero-based location. - * Overridden to do nothing - */ - public void moveSystemFilterString(int pos, ISystemFilterString filterString) {} - /** - * Overridden to do nothing - */ - public void setRelativeOrder(int value) {} - - /** - * Overridden to return -1 - */ - public int getRelativeOrder() { return -1; } - /** - * Overridden to do nothing - */ - public void setDefault(boolean value) {} - /** - * Overridden to return false - */ - public boolean isDefault() {return false; } - /** - * Overridden to do nothing - */ - public void setParentFilter(ISystemFilter l) {} - /** - * Overridden to return null - */ - public ISystemFilter getParentFilter() {return null;} - /** - * Overridden to return null - */ - public Vector getSystemFilterNames() {return null;} - /** - * Overridden to return null - */ - public java.util.List getNestedFilters() {return null;} - /** - * Overridden to return null - */ - public Vector getSystemFiltersVector() {return null;} - /** - * Overridden to return null - */ - public ISystemFilter[] getSystemFilters() {return null;} - /** - * Overridden to return 0 - */ - public int getSystemFilterCount() {return 0;} - /** - * Overridden to return null - */ - public java.util.List getStrings() {return null;} - /** - * Overridden to return null - */ - public ISystemFilter getSystemFilter(String aliasName) {return null;} - /** - * Overridden to return null - */ - public ISystemFilterPoolManagerProvider getProvider() {return null;} - /** - * Overridden to return null - */ - public ISystemFilterPoolManager getSystemFilterPoolManager() {return null;} - /** - * Overridden to return null - */ - public IFile getSaveFile() {return null;} - /** - * Overridden to return null - */ - public String getSaveFileName() {return null;} - /** - * Overridden to do nothing - */ - public void save() throws Exception {} - - /** - * Cache contents of a certain type. - * @param type the contents type. - * @param cachedContents the contents to cache. - */ - public void setContents(ISystemContentsType type, Object[] cachedContents) { - this.cachedContents.put(type, cachedContents); - isStale = false; - } - - /** - * @see org.eclipse.rse.core.model.ISystemContainer#getContents(org.eclipse.rse.core.model.ISystemContentsType) - */ - public Object[] getContents(ISystemContentsType contentsType) { - return (Object[])cachedContents.get(contentsType); - } - - /** - * @see org.eclipse.rse.core.model.ISystemContainer#hasContents(org.eclipse.rse.core.model.ISystemContentsType) - */ - public boolean hasContents(ISystemContentsType contentsType) { - - if (cachedContents.containsKey(contentsType)) { - return true; - } - - return false; - } - - /** - * @see org.eclipse.rse.core.model.ISystemContainer#isStale() - */ - public boolean isStale() { - return isStale; - } - - /** - * @see org.eclipse.rse.core.model.ISystemContainer#markStale(boolean) - */ - public void markStale(boolean isStale) - { - markStale(isStale, true); - } - - /** - * @see org.eclipse.rse.core.model.ISystemContainer#markStale(boolean) - */ - public void markStale(boolean isStale, boolean clearCache) - { - this.isStale = isStale; - if (clearCache) - { - cachedContents.clear(); - } - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/AbstractSystemResourceSet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/AbstractSystemResourceSet.java deleted file mode 100644 index 06b93d412..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/AbstractSystemResourceSet.java +++ /dev/null @@ -1,122 +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.core.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.rse.services.clientserver.messages.SystemMessage; - -/** - * The common abstract implementation of a ISystemResourceSet. Extenders - * can use this to inherit the basic implementations. - * - */ -public class AbstractSystemResourceSet implements ISystemResourceSet { - private List _resourceSet; - private SystemMessage _message; - private long _byteSize; - - public AbstractSystemResourceSet() { - _resourceSet = new ArrayList(); - } - - public AbstractSystemResourceSet(Object[] set) { - _resourceSet = new ArrayList(); - if (set != null) { - for (int i = 0; i < set.length; i++) { - addResource(set[i]); - } - } - } - - public AbstractSystemResourceSet(List set) { - _resourceSet = set; - } - - public int size() { - return _resourceSet.size(); - } - - public Object get(String absoluteName) { - for (int i = 0; i < _resourceSet.size(); i++) { - String path = pathFor(_resourceSet.get(i)); - if (path.equals(absoluteName)) { - return _resourceSet.get(i); - } - } - return null; - } - - public Object get(int index) { - return _resourceSet.get(index); - } - - public List getResourceSet() { - return _resourceSet; - } - - public void addResource(Object src) { - _resourceSet.add(src); - } - - public void removeResource(Object src) { - _resourceSet.remove(src); - } - - public String pathFor(Object resource) { - return resource.toString(); - } - - public String toString() { - StringBuffer buf = new StringBuffer(); - for (int i = 0; i < _resourceSet.size(); i++) { - Object resource = _resourceSet.get(i); - buf.append(pathFor(resource)); - if (i < _resourceSet.size()) { - buf.append(", "); //$NON-NLS-1$ - } - buf.append('\n'); - } - return buf.toString(); - } - - public void setMessage(SystemMessage message) { - _message = message; - } - - public SystemMessage getMessage() { - return _message; - } - - public boolean hasMessage() { - return _message != null; - } - - public boolean hasByteSize() { - return (_byteSize > 0); - } - - public long byteSize() { - return _byteSize; - } - - public void setByteSize(long byteSize) { - _byteSize = byteSize; - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/DummyHost.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/DummyHost.java deleted file mode 100644 index 7ba21e65b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/DummyHost.java +++ /dev/null @@ -1,262 +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) - [175262] IHost.getSystemType() should return IRSESystemType - * David Dykstal (IBM) - 142806: refactoring persistence framework - ********************************************************************************/ - -package org.eclipse.rse.core.model; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystem; - -public class DummyHost extends PlatformObject implements IHost -{ - protected String _hostName; - protected IRSESystemType _systemType; - - /** - * Constructor. - * @param hostName name of the dummy host - * @param systemType sytem type. May be <code>null</code>. - */ - public DummyHost(String hostName, IRSESystemType systemType) - { - _hostName = hostName; - _systemType = systemType; - } - public ISystemProfile getSystemProfile() - { - return null; - } - - public String getSystemProfileName() - { - return null; - } - - public void setHostPool(ISystemHostPool pool) - { - //Auto-generated method stub - } - - public ISystemHostPool getHostPool() - { - return null; - } - - public ISubSystem[] getSubSystems() - { - return null; - } - - - - public String getLocalDefaultUserId() - { - return null; - } - - public void clearLocalDefaultUserId() - { - //Auto-generated method stub - } - - public void deletingHost() - { - //Auto-generated method stub - } - - public void renamingSystemProfile(String oldName, String newName) - { - //Auto-generated method stub - } - - public boolean getForceUserIdToUpperCase() - { - return false; - } - - public boolean compareUserIds(String userId1, String userId2) - { - return false; - } - - public IRSESystemType getSystemType() - { - return _systemType; - } - - public void setSystemType(IRSESystemType value) - { - //Auto-generated method stub - } - - public String getAliasName() - { - return null; - } - - public void setAliasName(String value) - { - //Auto-generated method stub - } - - public String getHostName() - { - return _hostName; - } - - public void setHostName(String value) - { - //Auto-generated method stub - } - - public String getDescription() - { - return null; - } - - public void setDescription(String value) - { - //Auto-generated method stub - } - - public String getDefaultUserId() - { - return null; - } - - public void setDefaultUserId(String value) - { - //Auto-generated method stub - } - - public boolean isPromptable() - { - return false; - } - - public void setPromptable(boolean value) - { - //Auto-generated method stub - } - - public boolean isOffline() - { - return false; - } - - public void setOffline(boolean value) - { - //Auto-generated method stub - } - - public IConnectorService[] getConnectorServices() - { - return null; - } - - public String getName() - { - return null; - } - - public IPropertySet[] getPropertySets() - { - return null; - } - - public IPropertySet getPropertySet(String name) - { - return null; - } - - public IPropertySet createPropertySet(String name, String description) - { - return null; - } - - public IPropertySet createPropertySet(String name) - { - return null; - } - - - public boolean addPropertySet(IPropertySet set) - { - return false; - } - - public boolean addPropertySets(IPropertySet[] sets) - { - return false; - } - - public boolean removePropertySet(String name) - { - return false; - } - - public boolean isDirty() - { - return false; - } - - public void setDirty(boolean flag) - { - } - - public boolean commit() - { - return false; - } - - public boolean wasRestored() - { - return false; - } - - public void setWasRestored(boolean flag) - { - } - - public IRSEPersistableContainer getPersistableParent() { - return null; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - return IRSEPersistableContainer.NO_CHILDREN; - } - - public boolean isTainted() { - return false; - } - - public void beginRestore() { - } - - public void endRestore() { - } - - public void setTainted(boolean flag) { - } - - public String getDefaultEncoding(boolean checkRemote) { - return null; - } - - public void setDefaultEncoding(String encoding, boolean fromRemote) { - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Host.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Host.java deleted file mode 100644 index 0aca424a3..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Host.java +++ /dev/null @@ -1,589 +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: - * David Dykstal (IBM) - using new API from RSECorePlugin, RSEPreferencesManager - * - moved SystemsPreferencesManager to a new plugin - * Uwe Stieber (Wind River) - Dynamic system type provider extensions. - * - Moved to package org.eclipse.rse.model for being extendable. - * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.RSEPreferencesManager; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystem; - -/** - * Default implementation of the <code>IHost</code> interface. - * <p> - * Dynamic system type providers may extend this implementation - * if needed. - */ -public class Host extends RSEModelObject implements IHost { - - private boolean ucId = true; - private boolean userIdCaseSensitive = true; - private ISystemHostPool pool; - protected String previousUserIdKey; - - private static final String ENCODING_PROPERTY_SET = "EncodingPropertySet"; //$NON-NLS-1$ - private static final String ENCODING_REMOTE_PROPERTY_KEY = "EncodingRemotePropertyKey"; //$NON-NLS-1$ - private static final String ENCODING_NON_REMOTE_PROPERTY_KEY = "EncodingNonRemotePropertyKey"; //$NON-NLS-1$ - - /** - * The system type which is associated to this <code>IHost</code> object. - */ - private IRSESystemType systemType = null; - - /** - * The alias name of this <code>IHost</code> object. - */ - private String aliasName = null; - - /** - * The host name of the target which is associated to this <code>IHost</code> object. - */ - private String hostName = null; - - /** - * The description of this <code>IHost</code> object. - */ - private String description = null; - - /** - * The default user id to use to login to the target host. - */ - private String defaultUserId = null; - - /** - * Prompt for user id and password. - */ - private boolean promptable = false; - - /** - * Offline mode. - */ - private boolean offline = false; - - /** - * The system profile associated with this <code>IHost</code> object. - */ - private ISystemProfile _profile; - - /** - * Constructor - */ - public Host(ISystemProfile profile) { - super(); - _profile = profile; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#setHostPool(org.eclipse.rse.core.model.ISystemHostPool) - */ - public void setHostPool(ISystemHostPool pool) { - this.pool = pool; - previousUserIdKey = getPreferencesKey(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getHostPool() - */ - public ISystemHostPool getHostPool() { - return pool; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getConnectorServices() - */ - public IConnectorService[] getConnectorServices() { - return RSECorePlugin.getTheSystemRegistry().getConnectorServices(this); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getSubSystems() - */ - public ISubSystem[] getSubSystems() { - return RSECorePlugin.getTheSystemRegistry().getSubSystems(this); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#deletingHost() - */ - public void deletingHost() { - String oldUserId = null; - if (previousUserIdKey != null) oldUserId = getLocalDefaultUserId(previousUserIdKey); - // if the userId attribute held a preference store key of the form profileName.connectionName, - // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same - // value (the actual user id) the old keyed entry held. - if (oldUserId != null) { - RSEPreferencesManager.clearUserId(previousUserIdKey); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#renamingSystemProfile(java.lang.String, java.lang.String) - */ - public void renamingSystemProfile(String oldName, String newName) { - String userIdValue = null; - if (previousUserIdKey != null) userIdValue = getLocalDefaultUserId(previousUserIdKey); - // if the userId attribute held a preference store key of the form profileName.connectionName, - // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same - // value (the actual user id) the old keyed entry held. - String newKey = getPreferencesKey(newName, getAliasName()); - if ((userIdValue != null) && (userIdValue.length() > 0)) { - RSEPreferencesManager.clearUserId(previousUserIdKey); - RSEPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key - } - previousUserIdKey = newKey; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getSystemProfile() - */ - public ISystemProfile getSystemProfile() { - return _profile; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getSystemProfileName() - */ - public String getSystemProfileName() { - if (pool == null) - return null; - else { - ISystemProfile profile = pool.getSystemProfile(); - if (profile != null) - return profile.getName(); - else return null; - } - } - - /** - * Intercept of setAliasName so we can potentially rename the default-user-id key - * for the preferences store. That key is profileName.connectionAliasName so is - * affected when the alias name changes. - */ - public void setAliasName(String newName) { - String userIdValue = null; - if (previousUserIdKey != null) userIdValue = getLocalDefaultUserId(previousUserIdKey); - this.setAliasNameGen(newName); // update mof-modelled attribute - // if the userId attribute held a preference store key of the form profileName.connectionAliasName, - // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same - // value (the actual user id) the old keyed entry held. - String newKey = getPreferencesKey(getSystemProfileName(), newName); - if ((userIdValue != null) && (userIdValue.length() > 0)) { - RSEPreferencesManager.clearUserId(previousUserIdKey); - RSEPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key - } - previousUserIdKey = newKey; - } - - /** - * Intercept of setSystemType so we can decide if the user ID is case sensitive - */ - public void setSystemType(IRSESystemType systemType) { - // defect 43219 - if (systemType != null) { - //FIXME MOB this should be in IRSESystemType.isForceUC() / IRSESystemType.isUIDCaseSensitive() - String systemTypeId = systemType.getId(); - boolean forceUC = systemTypeId.equals(IRSESystemType.SYSTEMTYPE_ISERIES_ID); - boolean caseSensitiveUID = systemTypeId.equals(IRSESystemType.SYSTEMTYPE_UNIX_ID) || systemTypeId.equals(IRSESystemType.SYSTEMTYPE_LINUX_ID) - || (systemType.isLocal() && !systemType.isWindows()); - setForceUserIdToUpperCase(forceUC); - setUserIdCaseSensitive(caseSensitiveUID); - } - this.setSystemTypeGen(systemType); - } - - /** - * Intercept of setHostName so we can force it to uppercase. - * IPv4 host names are case insensitive. Much data is stored using the host - * name as part of the key. Therefore, the host name is capitalized here so that - * these comparisons work naturally. - * However, this must be done using the US locale since IPv4 host names - * use can be compared using this locale. See RFC1035. - */ - public void setHostName(String name) { - if (name != null) { - name = name.toUpperCase(Locale.US); - } - this.setHostNameGen(name); - } - - /** - * Intercept of setDefaultUserId so we can force it to uppercase. - * Also, we do not store the user Id per se in the attribute, but rather - * we store it in the preference with a key name unique to this connection. - * We store that key name in this attribute. However, this is all transparent to - * the caller. - */ - public void setDefaultUserId(String newId) { - if ((newId != null) && ucId) newId = newId.toUpperCase(); - - if ((newId == null) || (newId.length() == 0)) // a "clear" request? - { - clearLocalDefaultUserId(); - } - else { - String key = getPreferencesKey(); - if (key != null) { - RSEPreferencesManager.setUserId(key, newId); - } - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getDefaultUserId() - */ - public String getDefaultUserId() { - String uid = getLocalDefaultUserId(); - if ((uid == null) || (uid.length() == 0)) { - uid = RSEPreferencesManager.getUserId(getSystemType().getId()); // resolve from preferences - if ((uid != null) && ucId) uid = uid.toUpperCase(); - } - return uid; - } - - /** - * Return the local default user Id without resolving up the food chain. - * @see #getDefaultUserId() - */ - protected static String getLocalDefaultUserId(String key) { - String uid = null; - if ((key != null) && (key.length() > 0)) { - uid = RSEPreferencesManager.getUserId(key); // resolve from preferences - } - return uid; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getLocalDefaultUserId() - */ - public String getLocalDefaultUserId() { - return getLocalDefaultUserId(getPreferencesKey()); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#clearLocalDefaultUserId() - */ - public void clearLocalDefaultUserId() { - if (previousUserIdKey != null) RSEPreferencesManager.clearUserId(previousUserIdKey); - } - - /** - * Helper method to compute a unique name for a given subsystem instance - */ - protected String getPreferencesKey() { - if ((getSystemProfileName() == null) || (getAliasName() == null)) return null; - return getPreferencesKey(getSystemProfileName()); - } - - /** - * Helper method to compute a unique name for a given subsystem instance, given a profile name - */ - protected String getPreferencesKey(String profileName) { - String connectionName = getAliasName(); - if (connectionName == null) return null; - return getPreferencesKey(profileName, connectionName); - } - - /** - * Helper method to compute a unique name for a given subsystem instance, given a profile name and connection name - */ - protected String getPreferencesKey(String profileName, String connectionName) { - return profileName + "." + connectionName; //$NON-NLS-1$ - } - - /** - * Call this with false to turn off the default behaviour of forcing the default userId to uppercase. - */ - public void setForceUserIdToUpperCase(boolean force) { - this.ucId = force; - } - - /** - * Call this to turn off the default behaviour of considering case when comparing userIds - */ - public void setUserIdCaseSensitive(boolean caseSensitive) { - this.userIdCaseSensitive = caseSensitive; - } - - /** - * Call this to query whether the default userId is to be uppercased. - */ - public boolean getForceUserIdToUpperCase() { - return ucId; - } - - /** - * Call this to query whether the default userId is case sensitive - */ - public boolean getUserIdCaseSensitive() { - return userIdCaseSensitive; - } - - /** - * Call this to compare two userIds taking case sensitivity - */ - public boolean compareUserIds(String userId1, String userId2) { - if (userId1 == null) userId1 = ""; //$NON-NLS-1$ - if (userId2 == null) userId2 = ""; //$NON-NLS-1$ - if (userIdCaseSensitive) - return userId1.equals(userId2); - else return userId1.equalsIgnoreCase(userId2); - } - - public String toString() { - if (getAliasName() == null) { - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (systemType: "); //$NON-NLS-1$ - result.append(systemType); - result.append(", aliasName: "); //$NON-NLS-1$ - result.append(aliasName); - result.append(", hostName: "); //$NON-NLS-1$ - result.append(hostName); - result.append(", description: "); //$NON-NLS-1$ - result.append(description); - result.append(", defaultUserId: "); //$NON-NLS-1$ - result.append(defaultUserId); - result.append(", promptable: "); //$NON-NLS-1$ - result.append(promptable); - result.append(", offline: "); //$NON-NLS-1$ - result.append(offline); - result.append(')'); - return result.toString(); - } - - return getAliasName(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapterType) { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getSystemType() - */ - public IRSESystemType getSystemType() { - return systemType; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEModelObject#getName() - */ - public String getName() { - return getAliasName(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getAliasName() - */ - public String getAliasName() { - return aliasName; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getHostName() - */ - public String getHostName() { - return hostName; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.RSEModelObject#getDescription() - */ - public String getDescription() { - return description; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#setDescription(java.lang.String) - */ - public void setDescription(String newDescription) { - setDirty(!compareStrings(description, newDescription)); - description = newDescription; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#isPromptable() - */ - public boolean isPromptable() { - return promptable; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#setPromptable(boolean) - */ - public void setPromptable(boolean newPromptable) { - setDirty(promptable != newPromptable); - promptable = newPromptable; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#isOffline() - */ - public boolean isOffline() { - return offline; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#setOffline(boolean) - */ - public void setOffline(boolean newOffline) { - setDirty(offline != newOffline); - offline = newOffline; - } - - private void setSystemTypeGen(IRSESystemType newSystemType) { - setDirty( systemType==null ? (newSystemType==null) : !systemType.equals(newSystemType) ); - systemType = newSystemType; - } - - private void setAliasNameGen(String newAliasName) { - setDirty(!compareStrings(aliasName, newAliasName)); - aliasName = newAliasName; - } - - private void setHostNameGen(String newHostName) { - setDirty(!compareStrings(hostName, newHostName)); - hostName = newHostName; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#commit() - */ - public boolean commit() { - ISystemProfile profile = getSystemProfile(); - boolean result = profile.commit(); - return result; - } - - public IRSEPersistableContainer getPersistableParent() { - return _profile; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - List children = new ArrayList(10); - children.addAll(Arrays.asList(getPropertySets())); - children.addAll(Arrays.asList(getConnectorServices())); - IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()]; - children.toArray(result); - return result; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#getDefaultEncoding(boolean) - */ - public String getDefaultEncoding(boolean fromRemote) { - - IPropertySet encPropertySet = getPropertySet(ENCODING_PROPERTY_SET); - - if (encPropertySet == null) { - return null; - } - else { - String nonRemoteEncoding = encPropertySet.getPropertyValue(ENCODING_NON_REMOTE_PROPERTY_KEY); - - if (nonRemoteEncoding != null) { - return nonRemoteEncoding; - } - else { - - if (!fromRemote) { - return null; - } - else { - String remoteEncoding = encPropertySet.getPropertyValue(ENCODING_REMOTE_PROPERTY_KEY); - return remoteEncoding; - } - } - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.IHost#setDefaultEncoding(java.lang.String, boolean) - */ - public void setDefaultEncoding(String encoding, boolean fromRemote) { - - IPropertySet encPropertySet = getPropertySet(ENCODING_PROPERTY_SET); - - if (encPropertySet == null) { - encPropertySet = createPropertySet(ENCODING_PROPERTY_SET); - } - - if (encPropertySet != null) { - - if (encoding != null) { - - if (!fromRemote) { - encPropertySet.addProperty(ENCODING_NON_REMOTE_PROPERTY_KEY, encoding); - } - else { - encPropertySet.addProperty(ENCODING_REMOTE_PROPERTY_KEY, encoding); - } - } - else { - - if (!fromRemote) { - encPropertySet.removeProperty(ENCODING_NON_REMOTE_PROPERTY_KEY); - } - else { - encPropertySet.removeProperty(ENCODING_REMOTE_PROPERTY_KEY); - } - } - } - - commit(); - } -}
\ No newline at end of file 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 deleted file mode 100644 index 37b8b676d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IHost.java +++ /dev/null @@ -1,262 +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) - [175262] IHost.getSystemType() should return IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystem; - -/** - * Interface for Host (SystemConnection) objects. - * - * An IHost holds information identifying a remote system. It also logically contains - * ISubSystem objects, although this containment is achievable programmatically versus via - * object oriented containment. - */ -public interface IHost extends IAdaptable, IRSEModelObject { - - /** - * Return the system profile that owns this connection - * @return the profile which contains this host - */ - public ISystemProfile getSystemProfile(); - - /** - * Return the name of the system profile that owns this connection - * FIXME Check how this is different from getSystemProfile().getName() - */ - public String getSystemProfileName(); - - /** - * Set the parent connection pool this is owned by. - * Connection pools are internal management objects, one per profile. - */ - public void setHostPool(ISystemHostPool pool); - - /** - * Set the parent connection pool this is owned by. - * Connection pools are internal management objects, one per profile. - */ - public ISystemHostPool getHostPool(); - - /** - * Return the subsystem instances under this connection. - * Just a shortcut to {@link org.eclipse.rse.core.model.ISystemRegistry#getSubSystems(IHost)} - */ - public ISubSystem[] getSubSystems(); - - /** - * Return the local default user Id without resolving up the food chain. - * @see #getDefaultUserId() - */ - public String getLocalDefaultUserId(); - - /** - * Clear the local default user Id so next query will return the value from - * the preference store. - * <p> - * Same as calling setDefaultUserId(null) - * @see #setDefaultUserId(String) - */ - public void clearLocalDefaultUserId(); - - /** - * Notification method called when this connection is being deleted. - * Allows doing pre-death cleanup in overriders. - * <p> - * What we need to do is delete our entry in the preference store for our default userId. - */ - public void deletingHost(); - - /** - * Notification method called when this connection's profile is being renamed. - * Allows doing pre-death cleanup in overriders. - * <p> - * What we need to do is rename our entry in the preference store for our default userId. - */ - public void renamingSystemProfile(String oldName, String newName); - - /** - * Query whether the default userId is to be uppercased. - * @return <code>true</code> if the user id is to be uppercased. - */ - public boolean getForceUserIdToUpperCase(); - - /** - * Compare two userIds taking case sensitivity into account. - * @param userId1 first id to compare - * @param userId2 second id to compare - */ - public boolean compareUserIds(String userId1, String userId2); - - /** - * Get the system type. - * @return The value of the SystemType attribute - */ - public IRSESystemType getSystemType(); - - /** - * Set the system type. - * @param value The new value of the SystemType attribute - */ - public void setSystemType(IRSESystemType value); - - /** - * Get the unique user-visible connection name. - * This is a key that is unique per connection pool. - * @return The value of the AliasName attribute - */ - public String getAliasName(); - - /** - * Set the unique user-visible connection name. - * This needs to be a key that is unique per connection pool. - * @param value The new value of the AliasName attribute - */ - public void setAliasName(String value); - - /** - * Get the host name or IP address. - * @return The value of the HostName attribute - */ - public String getHostName(); - - /** - * Set the host name or IP address. - * @param value The new value of the HostName attribute - */ - public void setHostName(String value); - - /** - * Return the description of this host. - * @return The value of the Description attribute - */ - public String getDescription(); - - /** - * Set the description of this host. - * @param value The new value of the Description attribute - */ - public void setDescription(String value); - - /** - * Return the default user Id for this host. - * - * Note that we don't store it directly in an attribute, as we don't want - * the team to share it. The actual user Id is stored in the preference - * store keyed by this connection's unique name (profile.connName) instead, - * and that key is stored in this attribute. - * <p> - * Further, it is possible that there is no default user id. If so, this - * method will go to the preference store and will try to get the default user - * Id per this connection's system type. - * <p> - * This is all transparent to the caller though. - * <p> - * @return The value of the DefaultUserId attribute - */ - public String getDefaultUserId(); - - /** - * Intercept of setDefaultUserId so we can force it to uppercase. - * Also, we do not store the user Id per se in the attribute, but rather - * we store it in the preference with a key name unique to this connection. - * We store that key name in this attribute. However, this is all transparent to - * the caller. - * @param value The new value of the DefaultUserId attribute - */ - public void setDefaultUserId(String value); - - /** - * Check if this host is promptable. - * @return The value of the Promptable attribute - */ - boolean isPromptable(); - - /** - * Returns the default encoding of the host. - * <p> - * If fromRemote is <code>false</code>, returns an encoding preference - * specified locally without querying the remote system (for example, - * an encoding set by a user). - * If fromRemote is <code>true</code>, it first checks to see if there is - * a local "overriding" encoding set by the client without querying the - * remote system, and if such a "local" encoding preference does not exist, - * returns the encoding that was set by the client by querying a remote system. - * </p> - * @param fromRemote <code>false</code> to get the encoding that was - * obtained by the client by not querying the remote system, - * <code>true</code> to also check the encoding, if needed, that was - * set by the client after querying a remote system. - * @return the default encoding of the host, or <code>null</code> if - * no encoding was set. - * @see #setDefaultEncoding(String, boolean) - */ - public String getDefaultEncoding(boolean fromRemote); - - /** - * Set the default encoding of the host. - * <p> - * This method can only be called when no subsystem is connected. - * The client has to obtain the encoding either by querying the - * remote system, or by some other means (for example, set by a user). - * </p> - * @param encoding the encoding of the host, or <code>null</code> - * to erase the current encoding. - * @param fromRemote <code>true</code> if the encoding is set by the - * client after querying the remote system, or <code>false</code> - * otherwise (e.g. setting a local user preference). - * @see #getDefaultEncoding(boolean) - */ - public void setDefaultEncoding(String encoding, boolean fromRemote); - - /** - * Set the promptable attribute. - * @param value The new value of the Promptable attribute - */ - void setPromptable(boolean value); - - /** - * Returns the value of the '<em><b>Offline</b></em>' attribute. - * <p> - * Query if this connection is offline or not. - * If so, there is no live connection. Subsystems - * decide how much to enable while offline. - * It is up to each subsystem to honor this flag. - * </p> - * @return the value of the '<em>Offline</em>' attribute. - * @see #setOffline(boolean) - */ - boolean isOffline(); - - /** - * Specify if this connection is offline or not. - * It is up to each subsystem to honor this flag. - * - * @param value the new value of the '<em>Offline</em>' attribute. - * @see #isOffline() - */ - void setOffline(boolean value); - - /** - * Returns all the connector services provided - * for this host - * @return the connector services - */ - IConnectorService[] getConnectorServices(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ILabeledObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ILabeledObject.java deleted file mode 100644 index 2b8f86ad3..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ILabeledObject.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************** - * Copyright (c) 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 - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -/** - * This interface provides a means of extending RSE model objects and property sets - * with labels that can be used for display purposes. - * The persistence characteristics of labels are left to the implementing - * objects. - */ -public interface ILabeledObject { - - /** - * @return the display label for the object. If this has not - * previously been set, this can return the name of object or - * some other generated or constant label. It may return null - * if no label can be determined. - */ - public String getLabel(); - - /** - * @param label A display label for this object. - */ - public void setLabel(String label); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IProperty.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IProperty.java deleted file mode 100644 index 44053aa52..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IProperty.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - added javadoc - * David Dykstal (IBM) - [150939] added read-only attribute - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -/** - * Properties are contained in property sets ({@link IPropertySet}) and may be associated with objects that - * implement {@link IPropertySetContainer}. These would typically be model objects. - * Properties also have a type (see {@link IPropertyType}). - * @see IRSEModelObject - */ -public interface IProperty { - - /** - * @return the name of the property. - */ - public String getKey(); - - /** - * Sets the displayable label of the property. - * @param label the label for this property. - */ - public void setLabel(String label); - - /** - * @return the displayable label of this property - */ - public String getLabel(); - - /** - * Sets the value of this property. - * May raise a runtime exception if the new value of the property is - * not compatible with its type. - * @param value the new value for this property. - */ - public void setValue(String value); - - /** - * @return the value of this property - */ - public String getValue(); - - /** - * Sets the type of this property. - * May raise an runtime exception if the value of the property is not compatible - * with the new type. - * @param type - */ - public void setType(IPropertyType type); - - /** - * @return the type of this property - */ - public IPropertyType getType(); - - /** - * Sets the "enabled" presentation attribute of this property. - * This is an attribute that can be used to drive the presentation of this - * property and does not otherwise affect how this property can be used. - * Properties are enabled by default. - * @param flag true if the property is to be enabled. - */ - public void setEnabled(boolean flag); - - /** - * Retrieves the "enabled" presentation attribute of this property. - * This is an attribute that can be used to drive the presentation of this - * property and does not otherwise affect how this property can be used. - * @return true if the property is enabled. - */ - public boolean isEnabled(); - - /** - * Sets the "read-only" presentation attribute of this property. - * This is an attribute that can be used to drive the presentation of this - * property and does not otherwise affect how this property can be used. - * Properties are read-write by default. - * @param flag true if the property is to be read-only. - */ - public void setReadOnly(boolean flag); - - /** - * Retrieves the "read-only" presentation attribute of this property. - * This is an attribute that can be used to drive the presentation of this - * property and does not otherwise affect how this property can be used. - * @return true if the property is read-only. - */ - public boolean isReadOnly(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySet.java deleted file mode 100644 index b2e1e37d7..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySet.java +++ /dev/null @@ -1,175 +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) - Added Javadoc. - *******************************************************************************/ - -package org.eclipse.rse.core.model; - -import java.util.Map; - -/** - * A Property Set stores key/value pairs, where the keys - * are Strings and the values are an {@link IProperty}, - * of a type declared by an {@link IPropertyType}. - * - * The Property Set is identified by a name. - * By default, the type of each property is of type String, and - * in fact each value can be retrieved in String representation. - * - * The key <code>"description"</code> is reserved for internal - * use, to store the description of the Property set. - */ -public interface IPropertySet { - /** - * The key used to store the description of the Property Set. - * This is no longer used and should not be referenced except for - * compatibility reasons. - */ - public static final String DESCRIPTION_KEY = "description"; //$NON-NLS-1$ - - /** - * Return the name of this Property Set. - * @return String name of the Property Set. - */ - public String getName(); - - /** - * Return the description of this Property Set. - * - * Note that in order to set the description, you need to call - * <code>addProperty(IPropertySet.DESCRIPTION_KEY, "Description");</code> - * - * @return Description of the Property Set, - * or <code>null</code> in case no description has been set. - */ - public String getDescription(); - - /** - * Sets the description property of the property set. - * Fully equivalent to - * <code>addProperty(IPropertySet.DESCRIPTION_KEY, description);</code> - * @param description the string describing this property set. - */ - public void setDescription(String description); - - /** - * Return the {@link IProperty} associated with the given key. - * - * If the key is not in the set, <code>null</code> is returned. - * - * @param key String key for Property - * @return requested Property, - * or <code>null</code> if the key is not found in the set. - */ - public IProperty getProperty(String key); - - /** - * Return the String representation of a Property. - * - * Provided that the key is found in the set, this is a shortcut - * for getProperty(key).getValue(). If the key is not in the set, - * <code>null</code> is returned. - * - * @param key String key for Property - * @return String value of requested Property, - * or <code>null</code> if the key is not found in the set. - */ - public String getPropertyValue(String key); - - /** - * Return the list of Property Keys in this Set. - * - * Provided that the Set has a description, the - * @link{DESCRIPTION_KEY} key will also be in the list. - * The interface defines no particular ordering for the - * keys. - * - * @return String array of Property keys. - */ - public String[] getPropertyKeys(); - - /** - * Return the type of the property identified by the given key. - * - * @param key String key for Property - * @return Type of requested Property, - * or <code>null</code> if the key is not found in the set. - */ - public IPropertyType getPropertyType(String key); - - /** - * Set the name of this Property Set. - * @param name the name to set. Must not be <code>null</code> - */ - public void setName(String name); - - /** - * Set all the Properties of this set. - * - * @param map a Map of String to {@link IProperty} associations. - */ - public void setProperties(Map map); - - /** - * Add a Property with String value to the set. - * - * In case a Property already exist for the given key, it will be overwritten - * by the new value, note that this will <b>not</b> change the Property's type, - * so if the key identifies an integer Property but you set it to String value - * "foo" the resulting Property Set will be inconsistent. - * - * If the Property does not yet exist in the set, a new key will be added and - * the new Property will be of type "String". - * - * @param key Key to add - * @param value Value to add - * @return The added Property - */ - public IProperty addProperty(String key, String value); - - /** - * Add a typed Property to the set. - * - * In case a Property already exists for the given key, it will be - * removed and replaced by the new one. - * - * @param key Key to add - * @param value Value to add - * @param type Type of the Property to add - * @return The added Property - */ - public IProperty addProperty(String key, String value, IPropertyType type); - - /** - * Remove a Property from the set. - * - * @param key The key to remove - * @return <code>true</code> if the Property has been removed, - * or <code>false</code> if the key has not been part of the set. - */ - public boolean removeProperty(String key); - - /** - * Sets the container of this property set. Used to notify the - * container of a change in a property. - * @param container - */ - public void setContainer(IPropertySetContainer container); - - /** - * @return the container of this property set or null if there is no container. - */ - public IPropertySetContainer getContainer(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySetContainer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySetContainer.java deleted file mode 100644 index d532c8761..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySetContainer.java +++ /dev/null @@ -1,85 +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.core.model; - -/** - * A property set container is capable of containing property sets. This interface allows for the - * addition, retrieval, and deletion of property sets from the container. A property set may have only - * one container. - */ -public interface IPropertySetContainer { - - /** - * Retrieves an array all property sets known to this container. It will return an empty array if this - * container has property sets. The order of these property sets is not dictated by the interface. - * @return an array of property sets. - */ - public IPropertySet[] getPropertySets(); - - /** - * Retrieves a particular property set by its name. - * @param name the name of the property set. - * @return the named property set or null if one by that name does not exist. - */ - public IPropertySet getPropertySet(String name); - - /** - * Creates a new property set of a particular name in this container. - * If one already exists - * by this name it is replaced with a new empty property set. - * @param name the name of the property set. - * @return The property set. - */ - public IPropertySet createPropertySet(String name); - - /** - * Creates a new property set of a particular name and description in this container. - * If one already exists - * by this name it is replaced with a new empty property set. - * @param name the name of the property set. - * @param description the description (usually already localized) for this property set. - * @return the newly created property set. - */ - public IPropertySet createPropertySet(String name, String description); - - /** - * Adds an existing property set to this container. If the property set already has a container - * it is removed from that container and added to this one. If this container already - * has a property set by this name, this one replaces it. - * @param set the property set to be added. - * @return true if the property set was added. - */ - public boolean addPropertySet(IPropertySet set); - - /** - * Adds a number of existing property sets to this container. - * @param sets the sets to be added - * @return true if all property sets were added. - * @see #addPropertySet(IPropertySet) - */ - public boolean addPropertySets(IPropertySet[] sets); - - /** - * Removes a particular property set from this container. - * @param name the name of the property set to be removed - * @return true if the property set was removed; - * false if a property set was not removed, usually if it does not exist in the container. - */ - public boolean removePropertySet(String name); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertyType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertyType.java deleted file mode 100644 index 7d44e472f..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertyType.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - added javadoc - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -/** - * Property types are used to type instances of {@link IProperty}. - */ -public interface IPropertyType { - - public static final int TYPE_STRING = 0; - public static final int TYPE_INTEGER = 1; - public static final int TYPE_ENUM = 2; - public static final int TYPE_BOOLEAN = 3; - - /** - * @return true if the property is of TYPE_STRING - */ - public boolean isString(); - - /** - * @return true if the property is of TYPE_INTEGER - */ - public boolean isInteger(); - - /** - * @return true if the property is of TYPE_ENUM - */ - public boolean isEnum(); - - /** - * @return true if the property is of TYPE_BOOLEAN - */ - public boolean isBoolean(); - - /** - * @return the integer value of the property type - */ - public int getType(); - - /** - * @return the array of values that comprise the enumeration - */ - public String[] getEnumValues(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSECallback.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSECallback.java deleted file mode 100644 index 0b7caf2cb..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSECallback.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 IBM Corporation. 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. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ -package org.eclipse.rse.core.model; - -import org.eclipse.core.runtime.IStatus; - -public interface IRSECallback { - - public void done(IStatus status, Object result); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSEModelObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSEModelObject.java deleted file mode 100644 index d2ab3e355..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSEModelObject.java +++ /dev/null @@ -1,25 +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.core.model; - - -public interface IRSEModelObject extends IPropertySetContainer, IRSEPersistableContainer { - String getName(); - - String getDescription(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSEPersistableContainer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSEPersistableContainer.java deleted file mode 100644 index 9477e13f3..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSEPersistableContainer.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - adding new persistence support - * David Dykstal (IBM) - 142806: refactoring persistence framework - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -/** - * This is the interface for all objects that contain persistent data. - * The objects themselves may not have a persistent form, but can lie in the - * persistence hierarchy and be reconstructed when the persistent form is restored. - * An example of this is the SytemFilterPoolManager, which is itself not persisted, but - * has this interface since it can be reconstructed from its ordering and exists - * in the parent chain from SystemFilterPool to SystemProfile. - */ -public interface IRSEPersistableContainer { - - /** - * A constant indicating the presence of no children for a given container. - * This can be used when implementing {@link #getPersistableChildren()}. - * The value is an empty array. - */ - public static final IRSEPersistableContainer[] NO_CHILDREN = new IRSEPersistableContainer[0]; - - /** - * Request a persistence manager to persist this object. - * @return true if the object was persisted. - */ - public boolean commit(); - - /** - * An object was restored if it originated from a persistent form. - * @return true if the object was created from its persistent form, - * false if the object has never been persisted. - */ - public boolean wasRestored(); - - /** - * Sets the restored state of the object. Only persistence managers - * should do this. Persistable objects should be initially created with - * this as false and the persistence manager set this to true. - * This attribute is "sticky" in the face of most property changes. - * It should be set false if the object is renamed or re-parented. - * @param flag true if the object was restored. - */ - public void setWasRestored(boolean flag); - - /** - * An object is dirty if a change has been made to it that requires - * it to be persisted. - * @return true if the object is dirty - */ - public boolean isDirty(); - - /** - * <p>An object is dirty if a change has been made to it that requires - * it to be persisted. Objects should usually mark themselves dirty - * when a persistable change is made. However, there may be a need - * to mark related objects dirty as well. - * <p>Persistable changes are: - * <ul> - * <li>Any modification of a persistable attribute</li> - * <li>A rename</li> - * <li>A deletion of a child object</li> - * <li>A reordering of the list of child objects</li> - * <li>The addition of a child object</li> - * </ul> - * <p>A rename may also cause a parent to be marked dirty if the - * parent refers to the child by name. - * <p>Setting this value to false should be done only in the persistence - * manager after the object has been written to the DOM. - * <p>Marking an object as dirty must cause it and all of its ancestors - * in the persistence hierarchy to be marked as tainted. - * @param flag true if the object must be persisted. - */ - public void setDirty(boolean flag); - - /** - * An object is tainted if it contains an object that is dirty - * somewhere in its containment hierarchy. - * @return true if the object is tainted. - */ - public boolean isTainted(); - - /** - * Sets the tainted attribute for this object. This should set to - * true only by child objects when they have been marked dirty or tainted. - * Setting this to true will cause all parent objects in the containment - * hierarchy to be marked tainted. - * It should be set to false only by a persistence manager when the - * object has been committed. - * @param flag the tainted state of the object. - */ - public void setTainted(boolean flag); - - /** - * Retrieve the parent of this object in the persistence containment hierarchy. - * This is related to, but not necessarily the same as, the model hierarchy. - * @return the parent persistent object. This is null if there is no parent. - */ - public IRSEPersistableContainer getPersistableParent(); - - /** - * Retrieves the children of this object in the persistence containment hierarchy. - * This is related to, but not necessarily the same as, the model hierarchy. - * @return the array of persistent children in the order they are to be stored in the - * persistent form. This is an empty array if there are no children. - * See {@link #NO_CHILDREN}. - */ - public IRSEPersistableContainer[] getPersistableChildren(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISubSystemConfigurationCategories.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISubSystemConfigurationCategories.java deleted file mode 100644 index 3dd33e511..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISubSystemConfigurationCategories.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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.core.model; - -/** - * Constants for pre-defined subsystem factory categories. - * Use these in calls to {@link org.eclipse.rse.core.model.ISystemRegistry#getHostsBySubSystemConfigurationCategory(String)}. - */ -public interface ISubSystemConfigurationCategories { - /** - * Job subsystems - */ - public static final String SUBSYSTEM_CATEGORY_JOBS = "jobs"; //$NON-NLS-1$ - /** - * File subsystems - */ - public static final String SUBSYSTEM_CATEGORY_FILES = "files"; //$NON-NLS-1$ - /** - * Command subsystems - */ - public static final String SUBSYSTEM_CATEGORY_CMDS = "commands"; //$NON-NLS-1$ - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemContainer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemContainer.java deleted file mode 100644 index 991cbdc86..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemContainer.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core.model; - -/** - * @author dmcknigh - */ -public interface ISystemContainer { - - /** - * Returns whether the object has contents of a particular type. - * @param contentsType type of contents - * @return <code>true</code> if the object has contents, <code>false</code> otherwise. - */ - public boolean hasContents(ISystemContentsType contentsType); - - /** - * Returns all the contents of the object (combining results of all filters - * @param contentsType type of contents - * @return an array of contents. - */ - public Object[] getContents(ISystemContentsType contentsType); - - /** - * Indicates whether the cached object is stale - * @return whether the container is stale - */ - public boolean isStale(); - - /** - * Marks the object as stale or not - * @param isStale whether the object is to be marked stale or not - */ - public void markStale(boolean isStale); - - /** - * Marks the object as stale or not - * @param isStale whether the object is to be marked stale or not - * @param clearCache indicates whether or not to clear the cache - */ - public void markStale(boolean isStale, boolean clearCache); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemContentsType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemContentsType.java deleted file mode 100644 index e88a02d4a..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemContentsType.java +++ /dev/null @@ -1,36 +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.core.model; - -/* - * Common interface for representing different contents types of - * artifacts that can be stored in an IRemoteContainer - */ -public interface ISystemContentsType { - /* - * Indicates the type of this contents - */ - public String getType(); - - /* - * Indicates whether or not the contents - * can be flushed or not when a container becomes - * stale. - */ - public boolean isPersistent(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemHostPool.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemHostPool.java deleted file mode 100644 index 390aba770..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemHostPool.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import java.util.List; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.IRSEUserIdConstants; - - -// -/** - * A list of connections. - */ -/** - * @lastgen interface SystemConnectionPool {} - */ - -public interface ISystemHostPool extends IRSEPersistableContainer { - - /** - * Return the system profile that owns this connection pool - */ - public ISystemProfile getSystemProfile(); - - /** - * Rename this connection pool. - */ - public void renameHostPool(String newName); - - /** - * Return array of connections in this pool - */ - public IHost[] getHosts(); - - /** - * Create a connection object, given only the minimal information. - * <p> - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU. - * @param systemType system type matching one of the system types - * defined via the systemTypes extension point. - * @param aliasName unique connection name. - * @param hostName ip name of host. - * @return SystemConnection object, or null if it failed to create - * because the aliasName is not unique. All other errors throw an exception. - */ - public IHost createHost(IRSESystemType systemType, String aliasName, String hostName) throws Exception; - - /** - * Create a connection object, given all the possible attributes except default userId. - * <p> - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU. - * @param systemType system type matching one of the system types - * defined via the systemTypes extension point. - * @param aliasName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @return SystemConnection object, or null if it failed to create - * because the aliasName is not unique. All other errors throw an exception. - */ - public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description) throws Exception; - - /** - * Create a connection object, given all the possible attributes. - * <p> - * The new connection is added to the list and saved to disk. - * @param systemType system type matching one of the system types - * defined via the systemTypes extension point. - * @param aliasName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @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 SystemConnection object, or null if it failed to create - * because the aliasName is not unique. All other errors throw an exception. - * @see IRSEUserIdConstants - */ - public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) throws Exception; - - /** - * Update an existing connection given the new information. - * This method: - * <ul> - * <li>calls the setXXX methods on the given connection object, updating the information in it. - * <li>saves the connection to disk (renaming its folder if needed) - * </ul> - * <p> - * @param conn SystemConnection to be updated - * @param systemType system type matching one of the system types - * defined via the systemType extension point. - * @param aliasName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @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 - */ - public void updateHost(IHost conn, IRSESystemType systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) throws Exception; - - /** - * Return a connection given its name. - */ - public IHost getHost(String aliasName); - - /** - * Return the connection at the given zero-based offset - */ - public IHost getHost(int pos); - - /** - * Add a new connection to the list. - */ - public boolean addHost(IHost conn); - - /** - * Removes a given connection from the list and deletes it from disk. - * <p> - * This will: - * <ul> - * <li>Delete the connection in memory - * <li>Delete the underlying folder - * </ul> - * <p> - * @param conn SystemConnection object to remove - */ - public void deleteHost(IHost conn); - - /** - * Renames a given connection in the list. - * This will: - * <ul> - * <li>Rename the profile in memory - * <li>Rename the underlying folder - * <li>Update the user preferences if this profile is currently active. - * </ul> - * @param conn SystemConnection object to rename - * @param newName The new name to give that connection. - */ - public void renameHost(IHost conn, String newName) throws Exception; - - /** - * Return the zero-based position of a SystemConnection object within its profile. - */ - public int getHostPosition(IHost conn); - - /** - * Return the number of SystemConnection objects within this pool. - */ - public int getHostCount(); - - /** - * Duplicates a given connection in this list within this list or another list. - * @param targetPool The SystemConnectionPool to hold the copied connection. Can equal this connection, as long as alias name is unique - * @param conn SystemConnection object (within our pool) to clone - * @param aliasName New, unique, alias name to give this connection. Clone will fail if this is not unique. - */ - public IHost cloneHost(ISystemHostPool targetPool, IHost conn, String aliasName) throws Exception; - - /** - * Move existing connections a given number of positions in the same pool. - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.<p> - * <ul> - * <li>After the move, the pool containing the moved connection is saved to disk. - * <li>The connection's alias name must be unique in pool. - * </ul> - * <b>TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?</b> - * @param conns Array of SystemConnections to move. - * @param delta the amount by which to move the hosts within this pool - */ - public void moveHosts(IHost conns[], int delta); - - /** - * Order connections according to user preferences. - * Called after restore. - */ - public void orderHosts(String[] names); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Name attribute - */ - String getName(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Name attribute - */ - void setName(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Connections references - */ - List getHostList(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemMessageObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemMessageObject.java deleted file mode 100644 index 3c5aa011d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemMessageObject.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.model; - -/** - * This interface represents a message we wish to display as child node in the tree view. - */ -public interface ISystemMessageObject { - /** - * 0. An error occurred. - */ - public static final int MSGTYPE_ERROR = 0; - /** - * 1. User canceled - */ - public static final int MSGTYPE_CANCEL = 1; - /** - * 3. Informational text - */ - public static final int MSGTYPE_INFO = 2; - /** - * 4. Empty list. Eg "Nothing meets subset criteria" - */ - public static final int MSGTYPE_EMPTY = 3; - /** - * 5. Object created successfully. - */ - public static final int MSGTYPE_OBJECTCREATED = 4; - - /** - * Return the message text shown for the label. - * The translated text is pre-determined from the message type. - */ - public String getMessage(); - - /** - * Return the type of message: - * <ul> - * <li>{@link #MSGTYPE_ERROR} - * <li>{@link #MSGTYPE_CANCEL} - * <li>{@link #MSGTYPE_INFO} - * <li>{@link #MSGTYPE_EMPTY} - * <li>{@link #MSGTYPE_OBJECTCREATED} - * </ul> - */ - public int getType(); - - /** - * Return the parent object in the tree. That is, what was expanded to produce this message - */ - public Object getParent(); - - /** - * isTransient determines if the message should be removed from the - * tree when the parent item in the tree is collapsed. - * - * @return true if the item should be removed, false if it should not - */ - public boolean isTransient(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemNewConnectionWizardPage.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemNewConnectionWizardPage.java deleted file mode 100644 index c7630371f..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemNewConnectionWizardPage.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.model; - -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; - -/** - * Interface that all subsystem factory supplied pages contributed to the New Connection wizard - * must implement. - * @see org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage - * @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewConnectionWizardPages(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard) - */ -public interface ISystemNewConnectionWizardPage { - - /** - * This is called when the users presses Finish. All that should be done here is validation - * of the input, returning true if all is ok and the finish can proceed. - */ - public boolean performFinish(); - - /** - * This is called frequently by the framework to decide whether to enable the Finish and - * Next buttons. - * <p> - * Return true if the page is complete and has no errors - */ - public boolean isPageComplete(); - - /** - * Return the subsystem factory that supplied this page - */ - public ISubSystemConfiguration getSubSystemConfiguration(); -} 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 deleted file mode 100644 index 2b6cc58c0..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -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; - -/** - * A system profile holds definitions for hosts - * (connections), filter pools, filters, and filter strings. - * It is the unit of persistence for those definitions. Individual - * hosts and filter pool definitions always reside in a profile and the profile - * itself is the entity that is saved and restored. - * <p> - * Profiles may be active or inactive. An active profile contributes its - * definitions to RSE. When made inactive, it those definition are no longer - * available for use. - * <p> - */ -public interface ISystemProfile extends IRSEModelObject { - - /** - * Set the in-memory pointer back to the parent system profile manager - */ - public void setProfileManager(ISystemProfileManager mgr); - - /** - * Get the in-memory pointer back to the parent system profile manager - */ - 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 - */ - String getName(); - - /** - * @param value The new value of the Name attribute - */ - void setName(String value); - - /** - * @return The value of the DefaultPrivate attribute - * Is this profile created automatically, and is it the profile - * that is unique for this developer? - */ - boolean isDefaultPrivate(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the DefaultPrivate attribute - */ - void setDefaultPrivate(boolean value); - - /** - * Return all connections for this profile - */ - public IHost[] getHosts(); - - /** - * Return all filter pools for this profile - */ - public ISystemFilterPool[] getFilterPools(); - - /** - * Return all filter pools for this profile, scoped by a given subsystem factory - */ - public ISystemFilterPool[] getFilterPools(ISubSystemConfiguration ssf); - - /** - * Return true if this profile is currently active. - * An active profile is one that whose connections and filter pools are available - * for use by RSE. A profile may be loaded but be inactive. - * The active state of a profile is remembered from session to session. - */ - public boolean isActive(); - - /** - * Activates or deactivates a profile. If the profile is already in the - * requested state, this will do nothing. - * @param flag true to activate the profile, false to deactivate it. - * @see ISystemProfile#isActive() - */ - public void setActive(boolean flag); - - /** - * Each profile is persisted by a persistence provider. This returns the instance of the - * persistence provider used for this profile. New profiles will use the default persistence - * provider unless one is set by some other means. - * @return The persistence provider used for saving and restoring this profile. - */ - public IRSEPersistenceProvider getPersistenceProvider(); - - /** - * Sets the persistence provider for the use of this profile. If this is not called then - * this profile will be persisted by the default persistence provider. This will typically - * be set by either a persistence persistence provider when restoring a profile or by a migration - * utility when converting profiles from one form to another. - * @param provider the persistence provider to use when saving this profile. - */ - public void setPersistenceProvider(IRSEPersistenceProvider provider); -}
\ No newline at end of file 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 deleted file mode 100644 index a3407c6aa..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfileManager.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. 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.core.model; - -/** - * Manages a list of SystemProfile objects. System profiles - * should be created, deleted, restored, activated, and deactivated though - * this interface if event processing is not desired. If events are necessary - * then the system registry should be used. - */ -public interface ISystemProfileManager { - - /** - * Create a new profile with the given name, and add to the list. - * The name must be unique within the existing list. - * <p> - * @param name What to name this profile - * @param makeActive true if this profile is to be added to the active profile list. - * @return new profile, or null if name not unique. - */ - public ISystemProfile createSystemProfile(String name, boolean makeActive); - - /** - * Toggle an existing profile's state between active and inactive - * @param profile the profile to (in)activate - * @param makeActive the state to make this profile - */ - public void makeSystemProfileActive(ISystemProfile profile, boolean makeActive); - - /** - * @return an array of all existing profiles. This is guaranteed to contain the - * default private profile. - */ - public ISystemProfile[] getSystemProfiles(); - - /** - * @return the number of profiles known to this manager. - */ - public int getSize(); - - /** - * @return an array of all existing profile names. - */ - public String[] getSystemProfileNames(); - - /** - * Get a profile given its name. - * @param name the name of the profile - * @return the profile - */ - public ISystemProfile getSystemProfile(String name); - - /** - * @return the profiles identified via preferences as the active profiles... - */ - public ISystemProfile[] getActiveSystemProfiles(); - - /** - * @return the profile names currently selected by the user as his "active" profiles - */ - public String[] getActiveSystemProfileNames(); - - /** - * @return the default private profile created at first touch. - * Will return null if it has been renamed. - */ - public ISystemProfile getDefaultPrivateSystemProfile(); - - /** - * @return the default team profile created at first touch. - * Will return null if it has been renamed. - */ - public ISystemProfile getDefaultTeamSystemProfile(); - - /** - * Rename the given profile. - * @param profile the profile to rename - * @param newName the new profile name - */ - public void renameSystemProfile(ISystemProfile profile, String newName); - - /** - * Delete the given profile - * @param profile the name of the profile to delete. - * @param persist true if the deletion is meant to be persisted as well, false if the deletion is just in the - * model. - */ - public void deleteSystemProfile(ISystemProfile profile, boolean persist); - - /** - * Clone the given profile - * @param profile the profile to clone - * @param newName the name of the new profile - * @return the new profile - */ - public ISystemProfile cloneSystemProfile(ISystemProfile profile, String newName); - - /** - * Get an indication of whether a profile is active or not. - * @param profileName the name of the profile to test - * @return true if the given profile is active - * @see ISystemProfile#isActive() - */ - public boolean isSystemProfileActive(String profileName); - - /** - * Adds a system profile to this profile manager. - * @param profile The system profile to add. - */ - public void addSystemProfile(ISystemProfile profile); - -} 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 deleted file mode 100644 index 03f428d5e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java +++ /dev/null @@ -1,853 +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) - [168975] Move RSE Events API to Core - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * Martin Oberhuber (Wind River) - [189123] Prepare ISystemRegistry for move into non-UI - * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods - * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.events.ISystemModelChangeEvent; -import org.eclipse.rse.core.events.ISystemModelChangeListener; -import org.eclipse.rse.core.events.ISystemPreferenceChangeEvent; -import org.eclipse.rse.core.events.ISystemPreferenceChangeListener; -import org.eclipse.rse.core.events.ISystemRemoteChangeEvent; -import org.eclipse.rse.core.events.ISystemRemoteChangeListener; -import org.eclipse.rse.core.events.ISystemResourceChangeEvent; -import org.eclipse.rse.core.events.ISystemResourceChangeListener; -import org.eclipse.rse.core.filters.ISystemFilterStartHere; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; -import org.eclipse.rse.internal.core.RSECoreRegistry; - -/** - * Registry or front door for all remote system connections. - * There is a singleton of the class implementation of this interface. - * To get it, call the {@link org.eclipse.rse.core.RSECorePlugin#getTheSystemRegistry()}. - * <p> - * The idea here is that connections are grouped by system profile. At any - * time, there is a user-specified number of profiles "active" and connections - * from each active profile are worked with. - * </p> - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ -public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemViewInputProvider { - - /** - * Get the SystemFilterStartHere singleton instance. - * @return the SystemFilterStartHere singleton instance. - */ - public ISystemFilterStartHere getSystemFilterStartHere(); - - // ---------------------------- - // SUBSYSTEM FACTORY METHODS... - // ---------------------------- - - /** - * Public method to retrieve list of subsystem factory proxies registered by extension points. - */ - public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxies(); - - /** - * Return all subsystem factory proxies matching a subsystem factory category. - * @see ISubSystemConfigurationCategories - */ - public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxiesByCategory(String factoryCategory); - - /** - * Return all subsystem factories. - * - * Be careful when you call this, as it activates all subsystem configurations. - * @deprecated use {@link #getSubSystemConfigurationProxies()} and filter the - * list of needed subsystem configurations in order to activate only those - * that are really needed. - */ - public ISubSystemConfiguration[] getSubSystemConfigurations(); - - /** - * Return the subsystem configuration, given its plugin.xml-declared id. - */ - public ISubSystemConfiguration getSubSystemConfiguration(String id); - - /** - * Return all subsystem factories which support the given system type. - * If the type is null, returns all. - * @param systemType system type to filter - * @param filterDuplicateServiceSubSystemFactories set false by default - */ - public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicateServiceSubSystemFactories); - - // ---------------------------------- - // SYSTEMVIEWINPUTPROVIDER METHODS... - // ---------------------------------- - - /** - * This method is called by the connection adapter when the user expands - * a connection. This method must return the child objects to show for that - * connection. - * @param selectedConnection the connection undergoing expansion - * @return the list of objects under the connection - */ - public Object[] getConnectionChildren(IHost selectedConnection); - - /** - * This method is called by the connection adapter when deciding to show a plus-sign - * or not beside a connection. - * @param selectedConnection the connection being shown in the viewer - * @return true if this connection has children to be shown. - */ - public boolean hasConnectionChildren(IHost selectedConnection); - - // ---------------------------- - // USER PREFERENCE METHODS... - // ---------------------------- - /** - * Are connection names to be qualified by profile name? - */ - public boolean getQualifiedHostNames(); - - /** - * Set if connection names are to be qualified by profile name - */ - public void setQualifiedHostNames(boolean set); - - /** - * Reflect the user changing the preference for showing filter pools. - */ - public void setShowFilterPools(boolean show); - - /* - * Reflect the user changing the preference for showing filter strings. - * - public void setShowFilterStrings(boolean show); - */ - /** - * Reflect the user changing the preference for showing new connection prompt - */ - public void setShowNewHostPrompt(boolean show); - - // ---------------------------- - // PROFILE METHODS... - // ---------------------------- - /** - * Return singleton profile manager - */ - public ISystemProfileManager getSystemProfileManager(); - - /** - * Return the profiles currently selected by the user as his "active" profiles - * @see ISystemProfileManager#getActiveSystemProfiles() - */ - public ISystemProfile[] getActiveSystemProfiles(); - - /** - * Get a SystemProfile given its name - */ - public ISystemProfile getSystemProfile(String profileName); - - /** - * Create a SystemProfile given its name and whether or not to make it active - */ - public ISystemProfile createSystemProfile(String profileName, boolean makeActive) throws Exception; - - /** - * Copy a SystemProfile. All connections connection data is copied. - * @param profile Source profile to copy - * @param newName Unique name to give copied profile - * @param makeActive whether to make the copied profile active or not - * @param monitor Progress monitor to reflect each step of the operation - * @return new SystemProfile object - */ - public ISystemProfile copySystemProfile(ISystemProfile profile, String newName, boolean makeActive, IProgressMonitor monitor) throws Exception; - - /** - * Rename a SystemProfile. Rename is propagated to all subsystem factories so - * they can rename their filter pool managers and whatever else is required. - */ - public void renameSystemProfile(ISystemProfile profile, String newName) throws Exception; - - /** - * Delete a SystemProfile. Prior to physically deleting the profile, we delete all - * the connections it has, all the subsystems they have. - * <p> - * As well, all the filter pools for this profile are deleted, and subsequently any - * cross references from subsystems in connections in other profiles are removed. - * <p> - * A delete event is fired for every connection deleted. - */ - public void deleteSystemProfile(ISystemProfile profile) throws Exception; - - /** - * Make or unmake the given profile active - */ - 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 - */ - public IConnectorService[] getConnectorServices(IHost conn); - - // ---------------------------- - // 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 - */ - public ISubSystem[] getSubSystems(IHost conn); - - /** - * Return list of subsystem objects for a given connection. Use the force - * flag to indicate whether or not to restore from disk - */ - public ISubSystem[] getSubSystems(IHost conn, boolean force); - - /** - * Get those subsystems that are registered against a given connection, - * which are an instance of the given interface class. - * <p> - * 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 <code>false</code> instead, and check against - * the class instance in client code. - * </p> - * @param connection the connection to check - * @param subsystemInterface the interface class to filter against - * @return list of matching subsystems - */ - public ISubSystem[] getSubsystems(IHost connection, Class subsystemInterface); - - /** - * Get those subsystems that are registered against a given connection, - * which are an instance of ServiceSubSystem for the given serviceType. - * <p> - * 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 <code>false</code> instead, and check against - * the class instance in client code. - * </p> - * @param connection the connection to check - * @param serviceType the class of service to ask for - * @return list of matching subsystems - */ - public ISubSystem[] getServiceSubSystems(IHost connection, Class serviceType); - - /** - * Resolve a subsystem from it's absolute name - * - * @param absoluteSubSystemName the name of the subsystem - * - * @return the subsystem - */ - public ISubSystem getSubSystem(String absoluteSubSystemName); - - /** - * Return the absolute name for the specified subsystem - * @param subsystem the subsystem to query - * @return the absolute name of the subsystem - */ - public String getAbsoluteNameForSubSystem(ISubSystem subsystem); - - /** - * Return the absolute name for the specified host (connection) - * @param connection the host (aka connection) object to query - * @return the absolute name of the host - */ - public String getAbsoluteNameForConnection(IHost connection); - - /** - * Get a list of subsystem objects for given connection, owned by a subsystem factory - * that is of the given category. Array will never be null but may be length zero. - * <p> - * This looks for a match on the "category" of the subsystem factory's xml declaration - * in its plugin.xml file. - * - * @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories - * @deprecated use {@link #getSubSystemConfigurationProxiesByCategory(String)} - * and instantiate only those subsystem configurations from the proxy - * that are really needed. Then, use {@link ISubSystemConfiguration#getSubSystems(boolean)} - * with a parameter true. - */ - public ISubSystem[] getSubSystemsBySubSystemConfigurationCategory(String factoryCategory, IHost connection); - - /** - * Delete a subsystem object. This code finds the factory that owns it and - * delegates the request to that factory. - */ - public boolean deleteSubSystem(ISubSystem subsystem); - - // ---------------------------- - // CONNECTION METHODS... - // ---------------------------- - /** - * Return the first connection to localhost we can find. While we always create a default one in - * the user's profile, it is possible that this profile is not active or the connection was deleted. - * However, since any connection to localHost will usually do, we just search all active profiles - * until we find one, and return it. <br> - * If no localhost connection is found, this will return null. If one is needed, it can be created - * easily by calling {@link #createLocalHost(ISystemProfile, String, String)}. - */ - public IHost getLocalHost(); - - /** - * Return all connections in all active profiles. - */ - public IHost[] getHosts(); - - /** - * Return all connections in a given profile. - */ - public IHost[] getHostsByProfile(ISystemProfile profile); - - /** - * Return all connections for which there exists one or more - * subsystems owned by a given subsystem configuration. - * @see #getSubSystemConfiguration(String) - */ - public IHost[] getHostsBySubSystemConfiguration(ISubSystemConfiguration config); - - /** - * Return all connections for which there exists one or more - * subsystems owned by any a given subsystem configuration - * that is of the given category. - * <p> - * This looks for a match on the "category" of the subsystem - * configuration's xml declaration in its plugin.xml file. - * Thus, it is efficient as it need not bring to life a - * subsystem configuration just to test its parent class type. - * - * @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories - */ - public IHost[] getHostsBySubSystemConfigurationCategory(String factoryCategory); - - /** - * Returns all connections for all active profiles, for the given system type. - * If the specified system type is null, an empty array is returned. - * In order to get an IRSESystemType, use - * <code>RSECorePlugin.getTheCoreRegistry().{@link RSECoreRegistry#getSystemTypeById(String) getSystemTypeById(String)}</code> - * - * @param systemType The system type instance. - * @return The list of connections or an empty array. - */ - public IHost[] getHostsBySystemType(IRSESystemType systemType); - - /** - * Return all connections for all active profiles, for the given system types. - * - * In order to get an IRSESystemType, use - * <code>RSECorePlugin.getTheCoreRegistry().{@link RSECoreRegistry#getSystemTypeById(String) getSystemTypeById(String)}</code> - */ - public IHost[] getHostsBySystemTypes(IRSESystemType[] systemTypes); - - /** - * Return a SystemConnection object given a system profile containing it, - * and a connection name uniquely identifying it. - */ - public IHost getHost(ISystemProfile profile, String connectionName); - - /** - * Return the zero-based position of a SystemConnection object within - * its profile. - */ - public int getHostPosition(IHost conn); - - /** - * Return the number of SystemConnection objects within the given profile. - */ - public int getHostCount(ISystemProfile profile); - - /** - * Return the number of SystemConnection objects within the given - * connection's owning profile. - */ - public int getHostCountWithinProfile(IHost conn); - - /** - * Return the number of SystemConnection objects within all active - * profiles. - */ - public int getHostCount(); - - /** - * Return a vector of previously-used connection names in the given profile. - * @return Vector of String objects. - */ - public Vector getHostAliasNames(ISystemProfile profile); - - /** - * Return a vector of previously-used connection names in all active profiles. - */ - public Vector getHostAliasNamesForAllActiveProfiles(); - - /** - * Return array of previously specified host names for a given system type. - * After careful consideration, it is decided that if the system type is null, - * then no host names should be returned. Previously all for all types were returned. - */ - public String[] getHostNames(IRSESystemType systemType); - - /** - * Convenience method to create a local connection, as it often that one is needed - * for access to the local file system. - * @param profile - the profile to create this connection in. If null is passed, we first - * try to find the default private profile and use it, else we take the first active profile. - * @param name - the name to give this profile. Must be unique and non-null. - * @param userId - the user ID to use as the default for the subsystems. Can be null. - */ - public IHost createLocalHost(ISystemProfile profile, String name, String userId); - - /** - * Create a host object, sometimes called a "connection", - * given the containing profile and given all the possible attributes. - * The profile is then scheduled to be persisted. - * <p> - * This method: - * <ul> - * <li>creates and saves a new connection within the given profile - * <li>calls all subsystem factories to give them a chance to create a subsystem instance - * <li>fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners - * </ul> - * <p> - * @param profileName Name of the system profile the connection is to be added to. - * @param systemType system type matching one of the system types - * defined via the systemTypes extension point. - * @param connectionName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @param defaultUserId userId to use as the default for the subsystems. - * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.IRSEUserIdConstants} - * that tells us where to store the user Id - * @param newConnectionWizardPages when called from the New Connection wizard this is union of the list of additional - * wizard pages supplied by the subsystem factories that pertain to the specified system type. Else null. - * @return SystemConnection object, or null if it failed to create. This is typically - * because the connectionName is not unique. Call getLastException() if necessary. - */ - public IHost createHost(String profileName, IRSESystemType systemType, String connectionName, String hostName, String description, String defaultUserId, int defaultUserIdLocation, - ISystemNewConnectionWizardPage[] newConnectionWizardPages) throws Exception; - - /** - * Create a connection object. This is a simplified version - * <p> - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN - * THE PROFILE YOU SPECIFY. THE PROFILE IS ALSO SAVED TO DISK. - * <p> - * This method: - * <ul> - * <li>creates and saves a new connection within the given profile - * <li>calls all subsystem factories to give them a chance to create a subsystem instance - * <li>fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners - * </ul> - * <p> - * @param profileName Name of the system profile the connection is to be added to. - * @param systemType system type matching one of the system types - * defined via the systemTypes extension point. - * @param connectionName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @return SystemConnection object, or null if it failed to create. This is typically - * because the connectionName is not unique. Call getLastException() if necessary. - */ - public IHost createHost(String profileName, IRSESystemType systemType, String connectionName, String hostName, String description) throws Exception; - - /** - * Create a connection object. This is a very simplified version that defaults to the user's - * private profile, or the first active profile if there is no private profile. - * <p> - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN - * THE DEFAULT PRIVATE PROFILE, WHICH IS SAVED TO DISK. - * <p> - * This method: - * <ul> - * <li>creates and saves a new connection within the given profile - * <li>calls all subsystem factories to give them a chance to create a subsystem instance - * <li>fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners - * </ul> - * <p> - * @param systemType system type matching one of the system types - * defined via the systemTypes extension point. - * @param connectionName unique connection name. - * @param hostAddress ip name of host. - * @param description optional description of the connection. Can be null. - * @return SystemConnection object, or null if it failed to create. This is typically - * because the connectionName is not unique. Call getLastException() if necessary. - */ - public IHost createHost(IRSESystemType systemType, String connectionName, String hostAddress, String description) throws Exception; - - /** - * Update an existing host given the new information. - * This method: - * <ul> - * <li>calls the setXXX methods on the given host object, updating the information in it. - * <li>save the host's host pool to disk - * <li>fires an ISystemResourceChangeEvent event of type EVENT_CHANGE to all registered listeners - * <li>if the system type or host name is changed, calls disconnect on each associated subsystem. - * We must do this because a host name changes fundamentally affects the connection, - * rendering any information currently displayed under - * that host obsolete. - * </ul> - * <p> - * @param host the host to be updated - * @param systemType system type matching one of the system types - * defined via the systemTypes extension point. - * @param connectionName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the host. Can be null. - * @param defaultUserId userId to use as the default for the subsystems under this host. - * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.IRSEUserIdConstants} - * that tells us where to set the user Id - */ - public void updateHost(IHost host, IRSESystemType systemType, String connectionName, - String hostName, String description, - String defaultUserId, int defaultUserIdLocation); - - /** - * Creates subsystems for a given host and subsystem configurations. - * @param host the host. - * @param configurations the subsystem configurations. - * @return the array of subsystems corresponding to the array of given configurations. - * @since 2.0 - */ - public ISubSystem[] createSubSystems(IHost host, ISubSystemConfiguration[] configurations); - - /** - * Update the workoffline mode for a connection. - * - * @param conn SystemConnection to change - * @param offline true if connection should be set offline, false if it should be set online - */ - public void setHostOffline(IHost conn, boolean offline); - - /** - * Delete an existing connection. - * <p> - * Lots to do here: - * <ul> - * <li>Delete all subsystem objects for this connection, including their file's on disk. - * <li>Delete the connection from memory. - * <li>Delete the connection's folder from disk. - * </ul> - * Assumption: firing the delete event is done elsewhere. Specifically, the doDelete method of SystemView. - */ - public void deleteHost(IHost conn); - - /** - * Renames an existing connection. - * <p> - * Lots to do here: - * <ul> - * <li>Reset the conn name for all subsystem objects for this connection - * <li>Rename the connection in memory. - * <li>Rename the connection's folder on disk. - * </ul> - * Assumption: firing the rename event is done elsewhere. Specifically, the doRename method of SystemView. - */ - public void renameHost(IHost conn, String newName) throws Exception; - - /** - * Move existing connections a given number of positions in the same profile. - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.<p> - * <ul> - * <li>After the move, the pool containing the moved connection is saved to disk. - * <li>The connection's name must be unique in pool. - * <li>Fires a single ISystemResourceChangeEvent event of type EVENT_MOVE, if the pool is the private pool. - * </ul> - * @param conns Array of SystemConnections to move. - * @param delta new zero-based position for the connection - */ - public void moveHosts(String profileName, IHost conns[], int delta); - - /** - * Copy a SystemConnection. All subsystems are copied, and all connection data is copied. - * @param conn The connection to copy - * @param targetProfile What profile to copy into - * @param newName Unique name to give copied profile - * @param monitor Progress monitor to reflect each step of the operation - * @return new SystemConnection object - */ - public IHost copyHost(IHost conn, ISystemProfile targetProfile, String newName, IProgressMonitor monitor) throws Exception; - - /** - * Move a SystemConnection to another profile. - * All subsystems are moved, and all connection data is moved. - * This is actually accomplished by doing a copy operation first, - * and if successful deleting the original. - * @param conn The connection to move - * @param targetProfile What profile to move into - * @param newName Unique name to give copied profile. Typically this is the same as the original name, but - * will be different on name collisions - * @param monitor Progress monitor to reflect each step of the operation - * @return new SystemConnection object - */ - public IHost moveHost(IHost conn, ISystemProfile targetProfile, String newName, IProgressMonitor monitor) throws Exception; - - /** - * Return true if any subsystem supports connecting. - * @param conn the connection. - * @return <code>true</code> if any subsystem supports connecting, <code>false</code> otherwise. - */ - public boolean isAnySubSystemSupportsConnect(IHost conn); - - /** - * Return true if any of the subsystems for the given connection are - * currently connected. - */ - public boolean isAnySubSystemConnected(IHost conn); - - /** - * Return true if all of the subsystems for the given connection are - * currently connected. - */ - public boolean areAllSubSystemsConnected(IHost conn); - - /** - * Disconnect all subsystems for the given connection, if they are - * currently connected. - */ - public void disconnectAllSubSystems(IHost conn); - - /** - * Inform the world when the connection status changes for a subsystem - * within a connection. - * Update properties for the subsystem and its connection. - */ - public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected); - - /** - * Inform the world when the connection status changes for a subsystem - * within a connection. - * Update properties for the subsystem and its connection. - */ - public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected, boolean collapseTree); - - // ---------------------------- - // RESOURCE EVENT METHODS... - // ---------------------------- - - /** - * Register your interest in being told when a system resource such as a connection is changed. - */ - public void addSystemResourceChangeListener(ISystemResourceChangeListener l); - - /** - * De-Register your interest in being told when a system resource such as a connection is changed. - */ - public void removeSystemResourceChangeListener(ISystemResourceChangeListener l); - - /** - * Query if the ISystemResourceChangeListener is already listening for SystemResourceChange events - */ - public boolean isRegisteredSystemResourceChangeListener(ISystemResourceChangeListener l); - - /** - * Notify all listeners of a change to a system resource such as a connection. - * You would not normally call this as the methods in this class call it when appropriate. - */ - public void fireEvent(ISystemResourceChangeEvent event); - - /** - * Notify a specific listener of a change to a system resource such as a connection. - */ - public void fireEvent(ISystemResourceChangeListener l, ISystemResourceChangeEvent event); - - // ---------------------------- - // MODEL RESOURCE EVENT METHODS... - // ---------------------------- - - /** - * Register your interest in being told when an RSE model resource is changed. - * These are model events, not GUI-optimized events. - */ - public void addSystemModelChangeListener(ISystemModelChangeListener l); - - /** - * De-Register your interest in being told when an RSE model resource is changed. - */ - public void removeSystemModelChangeListener(ISystemModelChangeListener l); - - /** - * Notify all listeners of a change to a system model resource such as a connection. - * You would not normally call this as the methods in this class call it when appropriate. - */ - public void fireEvent(ISystemModelChangeEvent event); - - /** - * Notify all listeners of a change to a system model resource such as a connection. - * This one takes the information needed and creates the event for you. - */ - public void fireModelChangeEvent(int eventType, int resourceType, Object resource, String oldName); - - /** - * Notify a specific listener of a change to a system model resource such as a connection. - */ - public void fireEvent(ISystemModelChangeListener l, ISystemModelChangeEvent event); - - // -------------------------------- - // REMOTE RESOURCE EVENT METHODS... - // -------------------------------- - - /** - * Register your interest in being told when a remote resource is changed. - * These are model events, not GUI-optimized events. - */ - public void addSystemRemoteChangeListener(ISystemRemoteChangeListener l); - - /** - * De-Register your interest in being told when a remote resource is changed. - */ - public void removeSystemRemoteChangeListener(ISystemRemoteChangeListener l); - - /** - * Notify all listeners of a change to a remote resource such as a file. - * You would not normally call this as the methods in this class call it when appropriate. - */ - public void fireEvent(ISystemRemoteChangeEvent event); - - /** - * Notify all listeners of a change to a remote resource such as a file. - * This one takes the information needed and creates the event for you. - * @param eventType - one of the constants from {@link org.eclipse.rse.core.events.ISystemRemoteChangeEvents} - * @param resource - the remote resource object, or absolute name of the resource as would be given by calling getAbsoluteName on its remote adapter - * @param resourceParent - the remote resource's parent object, or absolute name, if that is known. If it is non-null, this will aid in refreshing occurences of that parent. - * @param subsystem - the subsystem which contains this remote resource. This allows the search for impacts to be - * limited to subsystems of the same parent factory, and to connections with the same hostname as the subsystem's connection. - * @param oldName - on a rename operation, this is the absolute name of the resource prior to the rename - */ - public void fireRemoteResourceChangeEvent(int eventType, Object resource, Object resourceParent, ISubSystem subsystem, String oldName); - - /** - * Notify all listeners of a change to a remote resource such as a file. - * This one takes the information needed and creates the event for you. - * @param eventType - one of the constants from {@link org.eclipse.rse.core.events.ISystemRemoteChangeEvents} - * @param resource - the remote resource object, or absolute name of the resource as would be given by calling getAbsoluteName on its remote adapter - * @param resourceParent - the remote resource's parent object, or absolute name, if that is known. If it is non-null, this will aid in refreshing occurences of that parent. - * @param subsystem - the subsystem which contains this remote resource. This allows the search for impacts to be - * limited to subsystems of the same parent factory, and to connections with the same hostname as the subsystem's connection. - * @param oldName - on a rename operation, this is the absolute name of the resource prior to the rename - * @param originatingViewer - optional. If set, this gives the viewer a clue that it should select the affected resource after refreshing its parent. - * This saves sending a separate event to reveal and select the new created resource on a create event, for example. - */ - public void fireRemoteResourceChangeEvent(int eventType, Object resource, Object resourceParent, ISubSystem subsystem, String oldName, Object originatingViewer); - - /** - * Notify a specific listener of a change to a remote resource such as a file. - */ - public void fireEvent(ISystemRemoteChangeListener l, ISystemRemoteChangeEvent event); - - // ---------------------------- - // PREFERENCE EVENT METHODS... - // ---------------------------- - - /** - * Register your interest in being told when a system preference changes - */ - public void addSystemPreferenceChangeListener(ISystemPreferenceChangeListener l); - - /** - * De-Register your interest in being told when a system preference changes - */ - public void removeSystemPreferenceChangeListener(ISystemPreferenceChangeListener l); - - /** - * Notify all listeners of a change to a system preference - * You would not normally call this as the methods in this class call it when appropriate. - */ - public void fireEvent(ISystemPreferenceChangeEvent event); - - /** - * Notify a specific listener of a change to a system preference - */ - public void fireEvent(ISystemPreferenceChangeListener l, ISystemPreferenceChangeEvent event); - - // ---------------------------- - // MISCELLANEOUS METHODS... - // ---------------------------- - - /** - * Returns filter references associated with this resource under the subsystem - */ - public List findFilterReferencesFor(Object resource, ISubSystem subsystem); - - /** - * Returns filter references associated with this resource under the subsystem - */ - public List findFilterReferencesFor(Object resource, ISubSystem subsystem, boolean onlyCached); - - /** - * Marks all filters for this subsystem as stale to prevent caching - * @param subsystem - */ - public void invalidateFiltersFor(ISubSystem subsystem); - - /** - * Marks all filters for this subsystem the contain resourceParent as stale to prevent caching - * @param resourceParent - * @param subsystem - */ - public void invalidateFiltersFor(Object resourceParent, ISubSystem subsystem); - - /** - * Return last exception object caught in any method, or null if no exception. - * This has the side effect of clearing the last exception. - */ - public Exception getLastException(); - - // ---------------------------- - // SAVE / RESTORE METHODS... - // ---------------------------- - - /** - * Save everything! - */ - public boolean save(); - - /** - * Save specific connection pool - * @return true if saved ok, false if error encountered. If false, call getLastException(). - */ - public boolean saveHostPool(ISystemHostPool pool); - - /** - * Save specific connection - * @return true if saved ok, false if error encountered. If false, call getLastException(). - */ - public boolean saveHost(IHost conn); - - /** - * Restore all connections within active profiles - * @return true if restored ok, false if error encountered. If false, call getLastException(). - */ - public boolean restore(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemResourceSet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemResourceSet.java deleted file mode 100644 index 95e84a376..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemResourceSet.java +++ /dev/null @@ -1,96 +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.core.model; - -import java.util.List; - -import org.eclipse.rse.services.clientserver.messages.SystemMessage; - - -/** - * This interface is refers to a collection of any type of resources. The resources - * may be remote RSE resources, or local workspace resources. - * - */ -public interface ISystemResourceSet { - - /** - * Returns the number of resources in the set - * @return the number of resources in the set - */ - public int size(); - - /** - * Returns the resource in the set with the specified absoluteName - * @param absoluteName the path of the resource to return - * @return the resource - */ - public Object get(String absoluteName); - - /** - * Returns the path of a specified resource. This is the same path - * that is used be the get(absoluteName) method to retrieve the object - * @param obj the resource to return the path for - * @return the path of the resource - */ - public String pathFor(Object obj); - - /** - * Returns the resource at the specified index - * @param index the index of the resource to return - * @return the resource - */ - public Object get(int index); - - /** - * Returns the set of resources as a List - * @return the set of resources as a List - */ - public List getResourceSet(); - - /** - * Returns a message if a problem occurs when using this resource set - * @return the message - */ - public SystemMessage getMessage(); - - /** - * Indicates whether a message was set corresponding to this resource set - * during an operation against it. - * @return true if there is a message - */ - public boolean hasMessage(); - - /** - * Indicates whether the set of resources has a size in bytes greater than zero - * @return true if there are more than 0 bytes in this set - */ - public boolean hasByteSize(); - - /** - * Returns the total number of bytes in this collection of resources - * @return the number of bytes - */ - public long byteSize(); - - /** - * Sets the total number of bytes in this collection of resources - * @param byteSize the number of bytes - */ - public void setByteSize(long byteSize); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemViewInputProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemViewInputProvider.java deleted file mode 100644 index fea9a90ad..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemViewInputProvider.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [186773] split SystemRegistryUI from SystemRegistry implementation - * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core from org.eclipse.rse.ui.view - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * Abstraction for any object that wishes to be a roots-provider for the SystemView tree viewer. - */ -public interface ISystemViewInputProvider extends IAdaptable { - - /** - * @return the children objects to constitute the root elements in the system view tree - */ - public Object[] getSystemViewRoots(); - - /** - * @return true if {@link #getSystemViewRoots()} will return a non-empty list - */ - public boolean hasSystemViewRoots(); - - /** - * @return true if we are listing connections or not, so we know whether we are interested in - * connection-add events - */ - public boolean showingConnections(); - - /** - * This method is called by the connection adapter when the user expands - * a connection. This method must return the child objects to show for that - * connection. - * @param selectedConnection the connection undergoing expansion - * @return the list of objects under the connection - */ - public Object[] getConnectionChildren(IHost selectedConnection); - - /** - * This method is called by the connection adapter when deciding to show a plus-sign - * or not beside a connection. - * @param selectedConnection the connection being shown in the viewer - * @return true if this connection has children to be shown. - */ - public boolean hasConnectionChildren(IHost selectedConnection); - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapterType); - - /** - * Set the shell in case it is needed for anything. - * The label and content provider will call this. - * @param shell an {@link org.eclipse.swt.widgets.Shell shell} object, - * being used by the viewer using this provider - */ - public void setShell(Object shell); - - /** - * @return the {@link org.eclipse.swt.widgets.Shell shell} of the viewer - * we are currently associated with. - * @deprecated use other methods for getting the active workbench shell, - * e.g. {@link org.eclipse.rse.ui.RSEUIPlugin#getActiveWorkbenchShell()} - */ - public Object getShell(); - - /** - * Set the viewer in case it is needed for anything. - * The label and content provider will call this. - * @param viewer the {@link org.eclipse.jface.viewers.Viewer viewer} - * that uses this provider - */ - public void setViewer(Object viewer); - - /** - * Return the viewer we are currently associated with - * @return the {@link org.eclipse.jface.viewers.Viewer viewer} - * we are currently associated with - * @deprecated use other methods for getting the active viewer. - */ - public Object getViewer(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Property.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Property.java deleted file mode 100644 index 54d5d73bf..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Property.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - added javadoc - * David Dykstal (IBM) - [150939] added read-only attribute - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import java.util.Observable; - -public class Property extends Observable implements IProperty { - - private String _name; - private String _label; - private String _value; - private IPropertyType _type; - private boolean _isEnabled = true; - private boolean _isReadOnly = false; - - public Property(IProperty property) { - _name = property.getKey(); - _label = property.getLabel(); - _value = property.getValue(); - _type = property.getType(); - _isEnabled = property.isEnabled(); - touch(); - } - - public Property(String name, String value, IPropertyType type, boolean isEnabled) { - _name = name; - _value = value; - _type = type; - _isEnabled = isEnabled; - touch(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#getKey() - */ - public String getKey() { - return _name; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#setLabel(java.lang.String) - */ - public void setLabel(String label) { - if (!stringsAreEqual(_label, label)) { - _label = label; - touch(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#getLabel() - */ - public String getLabel() { - if (_label == null) { - return _name; - } - return _label; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#setValue(java.lang.String) - */ - public void setValue(String value) { - if (!stringsAreEqual(_value, value)) { - _value = value; - touch(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#getValue() - */ - public String getValue() { - return _value; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#setType(org.eclipse.rse.core.model.IPropertyType) - */ - public void setType(IPropertyType type) { - if (_type != type) { - _type = type; - touch(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#getType() - */ - public IPropertyType getType() { - return _type; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#setEnabled(boolean) - */ - public void setEnabled(boolean flag) { - if (_isEnabled != flag) { - _isEnabled = flag; - touch(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#isEnabled() - */ - public boolean isEnabled() { - return _isEnabled; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#setReadOnly(boolean) - */ - public void setReadOnly(boolean flag) { - if (_isReadOnly != flag) { - _isReadOnly = flag; - touch(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IProperty#isReadOnly() - */ - public boolean isReadOnly() { - return _isReadOnly; - } - - private boolean stringsAreEqual(String s1, String s2) { - if (s1 == s2) return true; - if (s1 == null) return false; - return s1.equals(s2); - } - - private void touch() { - setChanged(); - notifyObservers(); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertyList.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertyList.java deleted file mode 100644 index d0302cb3e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertyList.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.core.model; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * A property list is an ordered property set. As items are added and removed their arrival order is - * maintained. - */ -public class PropertyList extends PropertySet { - - private List _keys = new ArrayList(10); - - public PropertyList(String name) { - super(name); - } - - public IProperty addProperty(String key, IProperty property) { - _keys.remove(key); - _keys.add(key); - return super.addProperty(key, property); - } - - public IProperty addProperty(String key, String value) { - _keys.remove(key); - _keys.add(key); - return super.addProperty(key, value); - } - - public IProperty addProperty(String key, String value, IPropertyType type) { - _keys.remove(key); - _keys.add(key); - return super.addProperty(key, value, type); - } - - public String[] getPropertyKeys() { - return (String[]) _keys.toArray(new String[_keys.size()]); - } - - public boolean removeProperty(String key) { - _keys.remove(key); - return super.removeProperty(key); - } - - public void setProperties(Map map) { - _keys.clear(); - _keys.addAll(map.keySet()); - super.setProperties(map); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java deleted file mode 100644 index 6dba0224a..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java +++ /dev/null @@ -1,207 +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) - Added Javadoc. - *******************************************************************************/ - -package org.eclipse.rse.core.model; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Observable; -import java.util.Observer; -import java.util.Set; - -/** - * A Hashmap based implementation of the {@link IPropertySet} interface. - * - * Not thread-safe since the underlying {@link java.util.HashMap} is - * not thread-safe. - */ -public class PropertySet extends RSEPersistableObject implements IPropertySet, ILabeledObject, Observer { - - private String _name; - private String _label = null; - private String _description = null; - private Map _properties; - private IPropertySetContainer _container = null; - - protected static IPropertyType _defaultType = PropertyType.getStringPropertyType(); - - /** - * Construct a new PropertySet based on an existing one (i.e. clone it). - * @param propertySet existing Property Set to clone - */ - public PropertySet(IPropertySet propertySet) { - _name = propertySet.getName(); - _description = propertySet.getDescription(); - _properties = new HashMap(); - if (propertySet instanceof ILabeledObject) { - ILabeledObject p = (ILabeledObject) propertySet; - _label = p.getLabel(); - } - - String[] keys = propertySet.getPropertyKeys(); - for (int i = 0; i < keys.length; i++) { - String key = keys[i]; - IProperty property = propertySet.getProperty(key); - addProperty(key, new Property(property)); - } - setDirty(true); - } - - /** - * Construct a new empty PropertySet. - * @param name of the new PropertySet - */ - public PropertySet(String name) { - _name = name; - _properties = new HashMap(); - setDirty(true); - } - - public String getName() { - return _name; - } - - public String getLabel() { - if (_label != null) return _label; - return _name; - } - - public void setLabel(String label) { - _label = label; - setDirty(true); - } - - public String getDescription() { - return _description; - } - - public void setDescription(String description) { - _description = description; - setDirty(true); - } - - public String[] getPropertyKeys() { - Set set = _properties.keySet(); - return (String[]) set.toArray(new String[set.size()]); - } - - public void setName(String name) { - _name = name; - setDirty(true); - } - - public void setProperties(Map map) { - _properties = new HashMap(map.size()); - for (Iterator z = map.keySet().iterator(); z.hasNext();) { - String key = (String) z.next(); - Object value = map.get(key); - if (value instanceof IProperty) { - addProperty(key, (IProperty)value); - } else if (value instanceof String) { - addProperty(key, (String)value); - } - } - } - - /** - * Add a typed Property to the set. - * - * In case a Property already exists for the given key, it will be overwritten. - * - * @param key Key to add - * @param property The Property to add - * @return The added Property - */ - public IProperty addProperty(String key, IProperty property) { - _properties.put(key, property); - setDirty(true); - return property; - } - - public IProperty addProperty(String key, String value) { - IProperty property = getProperty(key); - if (property != null) { - //FIXME should throw a NumberFormatException or similar, - //if the value does not fit the type of the existing property. - property.setValue(value); - } else { - property = addProperty(key, value, _defaultType); - } - return property; - } - - public IProperty addProperty(String key, String value, IPropertyType type) { - IProperty property = new Property(key, value, type, true); - return addProperty(key, property); - } - - public boolean removeProperty(String key) { - Object value = _properties.remove(key); - if (value == null) return false; - setDirty(true); - return true; - } - - public IProperty getProperty(String key) { - return (IProperty) _properties.get(key); - } - - public String getPropertyValue(String key) { - IProperty property = getProperty(key); - if (property != null) { - return property.getValue(); - } - return null; - } - - public IPropertyType getPropertyType(String key) { - IProperty property = getProperty(key); - if (property != null) { - return property.getType(); - } - return null; - } - - public boolean commit() { - return getPersistableParent().commit(); - } - - public IRSEPersistableContainer[] getPersistableChildren() { - return IRSEPersistableContainer.NO_CHILDREN; - } - - public IRSEPersistableContainer getPersistableParent() { - IRSEPersistableContainer result = null; - if (_container instanceof IRSEPersistableContainer) { - result = (IRSEPersistableContainer) _container; - } - return result; - } - - public void setContainer(IPropertySetContainer container) { - _container = container; - } - - public IPropertySetContainer getContainer() { - return _container; - } - - public void update(Observable o, Object arg) { - setDirty(true); - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySetContainer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySetContainer.java deleted file mode 100644 index 02d5b396b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySetContainer.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - 142806: refactoring persistence framework - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -public abstract class PropertySetContainer extends RSEPersistableObject implements IPropertySetContainer { - private Map _propertySets; - - public PropertySetContainer() { - _propertySets = new HashMap(); - } - - public IPropertySet[] getPropertySets() { - List sets = new ArrayList(); - Iterator iter = _propertySets.values().iterator(); - while (iter.hasNext()) { - sets.add(iter.next()); - } - return (IPropertySet[]) sets.toArray(new IPropertySet[sets.size()]); - } - - public IPropertySet getPropertySet(String name) { - return (IPropertySet) _propertySets.get(name); - } - - public IPropertySet createPropertySet(String name, String description) { - IPropertySet newSet = new PropertySet(name); - newSet.setDescription(description); - newSet.setContainer(this); - _propertySets.put(name, newSet); - return newSet; - } - - public IPropertySet createPropertySet(String name) { - IPropertySet newSet = new PropertySet(name); - newSet.setContainer(this); - _propertySets.put(name, newSet); - return newSet; - } - - public boolean addPropertySet(IPropertySet set) { - IPropertySetContainer old = set.getContainer(); - if (old != null) { - old.removePropertySet(set.getName()); - } - set.setContainer(this); - _propertySets.put(set.getName(), set); - return true; - } - - public boolean addPropertySets(IPropertySet[] sets) { - for (int i = 0; i < sets.length; i++) { - addPropertySet(sets[i]); - } - return true; - } - - public boolean removePropertySet(String name) { - return _propertySets.remove(name) != null; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertyType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertyType.java deleted file mode 100644 index eb2da157b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertyType.java +++ /dev/null @@ -1,163 +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: - * David Dykstal (IBM) - added javadoc, minor changes - *******************************************************************************/ - -package org.eclipse.rse.core.model; - -/** - * The standard implementation of {@link IPropertyType}. - * The constructors are private. - * Use the static factory methods to return instances. - */ -public class PropertyType implements IPropertyType { - - private int _type = 0; - private String[] _enumValues; - - private static final String ENUMERATION_STR = "enumeration:"; //$NON-NLS-1$ - - private static IPropertyType _booleanPropertyType = new PropertyType(TYPE_BOOLEAN); - private static IPropertyType _integerPropertyType = new PropertyType(TYPE_INTEGER); - private static IPropertyType _stringPropertyType = new PropertyType(TYPE_STRING); - - private PropertyType(int type) { - _type = type; - } - - /** - * Returns an instance of boolean property type. - * @return IPropertyType - */ - public static IPropertyType getBooleanPropertyType() { - return _booleanPropertyType; - } - - /** - * Returns an instance of integer property type. - * @return IPropertyType - */ - public static IPropertyType getIntegerPropertyType() { - return _integerPropertyType; - } - - /** - * Returns an instance of string property type. - * @return IPropertyType - */ - public static IPropertyType getStringPropertyType() { - return _stringPropertyType; - } - - /** - * Returns an instance of enum property type. - * @param values String[] array of allowed enumerator values. - * @return IPropertyType - */ - public static IPropertyType getEnumPropertyType(String[] values) { - PropertyType type = new PropertyType(TYPE_ENUM); - type._enumValues = values; - return type; - } - - /** - * Returns an instance of property type based on the String specification. - * This is the reverse of PropertyType.toString(). - * @return IPropertyType instance based on String specification. - */ - public static IPropertyType fromString(String typeStr) { - if (typeStr.equals(String.class.toString())) { - return getStringPropertyType(); - } else if (typeStr.equals(Integer.class.toString())) { - return getIntegerPropertyType(); - } else if (typeStr.startsWith(ENUMERATION_STR)) { - String subString = typeStr.substring(ENUMERATION_STR.length()); - String[] enumValues = subString.split(","); //$NON-NLS-1$ - return getEnumPropertyType(enumValues); - } else if (typeStr.equals(Boolean.class.toString())) { - return getBooleanPropertyType(); - } else { - return getStringPropertyType(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertyType#getType() - */ - public int getType() { - return _type; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertyType#isString() - */ - public boolean isString() { - return _type == TYPE_STRING; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertyType#isInteger() - */ - public boolean isInteger() { - return _type == TYPE_INTEGER; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertyType#isEnum() - */ - public boolean isEnum() { - return _type == TYPE_ENUM; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertyType#isBoolean() - */ - public boolean isBoolean() { - return _type == TYPE_BOOLEAN; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertyType#getEnumValues() - */ - public String[] getEnumValues() { - return _enumValues; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - if (isString()) { - return String.class.getName(); - } else if (isInteger()) { - return Integer.class.getName(); - } else if (isEnum()) { - StringBuffer buf = new StringBuffer(); - buf.append(ENUMERATION_STR); - String[] enumValues = getEnumValues(); - for (int i = 0; i < enumValues.length; i++) { - buf.append(enumValues[i]); - if (i + 1 < enumValues.length) { - buf.append(","); //$NON-NLS-1$ - } - } - return buf.toString(); - } else if (isBoolean()) { - return Boolean.class.getName(); - } - return super.toString(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java deleted file mode 100644 index e3d4754b7..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java +++ /dev/null @@ -1,34 +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: - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import org.eclipse.rse.internal.core.RSECoreMessages; - -/** - * Provides common support for local RSE model objects - * Extenders inherit property set support - * @author dmcknigh - * - */ -public abstract class RSEModelObject extends PropertySetContainer implements IRSEModelObject { - - public String getDescription() { - return RSECoreMessages.RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelOperation.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelOperation.java deleted file mode 100644 index 8734c6284..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelOperation.java +++ /dev/null @@ -1,138 +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: - * David Dykstal (IBM) - initial API and implementation - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.logging.Logger; -import org.eclipse.rse.persistence.IRSEPersistenceManager; - -/** - * Provides a transaction boundary for RSE model operations. All operations that - * modify model objects should be done within an RSEModelOperation. These operations - * may be nested. Changes made to the model will be persisted when the outermost - * operation of a particular thread is exited. - * <p> - * The usage idiom is to create an anonymous subclass of this class just prior to - * use, overriding the {@link #execute()} method, and then invoke the {@link #run()} method. - * <pre> - * RSEModelOperation m = new RSEModelOperation() { - * public void execute() { - * ... do work here ... - * } - * }; - * m.run(); - * </pre> - * <p> - * under development - provisional - * @since RSE 2.0 - */ -public abstract class RSEModelOperation { - - private static Map threads = new HashMap(); - - /** - * Checks the current thread to see if there is a model transaction in progress. - * Should be used inside model objects prior to a change to a persistent property. - */ - public static void check() { - if (getDepth() == 0) { - Logger logger = RSECorePlugin.getDefault().getLogger(); - logger.logInfo("not inside transaction"); //$NON-NLS-1$ - } - } - - /** - * @return the depth of the nesting for transactions in the current thread - */ - private static int getDepth() { - Thread myThread = Thread.currentThread(); - if (threads.get(myThread) == null) { - threads.put(myThread, new Integer(0)); - } - int depth = ((Integer) threads.get(myThread)).intValue(); - return depth; - } - - /** - * Begins a transaction. - */ - private static void beginTransaction() { - } - - /** - * Ends a transaction. Schedules all changed profiles for save. - */ - private static void endTransaction() { - IRSEPersistenceManager persistenceManager = RSECorePlugin.getThePersistenceManager(); - persistenceManager.commitProfiles(5000); - } - - /** - * Enters a new nested level of operation. - */ - private static void enterLevel() { - int depth = getDepth(); - try { - if (depth == 0) { - beginTransaction(); - } - } finally { - Thread myThread = Thread.currentThread(); - threads.put(myThread, new Integer(depth + 1)); - } - } - - /** - * Leaves the current nesting level. If leaving the outermost nesting level then - * ends the transaction. - */ - private static void leaveLevel() { - int depth = getDepth(); - try { - if (depth == 1) { - endTransaction(); - } - } finally { - Thread myThread = Thread.currentThread(); - threads.put(myThread, new Integer(depth - 1)); - } - } - - /** - * Create a new operation scoped to the current thread. - */ - public RSEModelOperation() { - } - - /** - * Perform the work of this operation. This is where the work of modifying several model - * properties or objects can be done. - */ - public abstract void execute(); - - /** - * Runs this operation. This will cause the {@link #execute()} method to be invoked inside - * a transaction boundary. - */ - public void run() { - enterLevel(); - try { - execute(); - } finally { - leaveLevel(); - } - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEPersistableObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEPersistableObject.java deleted file mode 100644 index 12250efb3..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEPersistableObject.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.core.model; - -public abstract class RSEPersistableObject implements IRSEPersistableContainer { - - private boolean _isDirty = false; - private boolean _wasRestored = false; - private boolean _isTainted = false; - - public RSEPersistableObject() { - super(); - } - - public final boolean isDirty() { - return _isDirty; - } - - public final void setDirty(boolean flag) { - _isDirty = flag; - setTainted(flag); - } - - public final boolean wasRestored() { - return _wasRestored; - } - - public final void setWasRestored(boolean flag) { - _wasRestored = flag; - } - - public final boolean isTainted() { - return _isTainted; - } - - public final void setTainted(boolean flag) { - boolean taintParent = flag && !_isTainted; - _isTainted = flag; - if (taintParent) { - IRSEPersistableContainer parent = getPersistableParent(); - if (parent != null) { - parent.setTainted(true); - } - } - } - - /** - * Does a null-aware string comparison. Two strings that are - * <code>null</code> will compare equal. Otherwise the result is - * the same as s1.equals(s2), if s1 is not null. - * @param s1 The first string to compare - * @param s2 the second string - * @return true if the strings are equal or both null. - */ - protected boolean compareStrings(String s1, String s2) { - if (s1 == s2) return true; - if (s1 == null) return false; - return s1.equals(s2); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemChildrenContentsType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemChildrenContentsType.java deleted file mode 100644 index 2e944054d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemChildrenContentsType.java +++ /dev/null @@ -1,45 +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.core.model; - -/** - * Represents contents that are children of a container - */ -public class SystemChildrenContentsType implements ISystemContentsType { - public static String CONTENTS_TYPE_CHILDREN = "contents_children"; //$NON-NLS-1$ - public static SystemChildrenContentsType _instance = new SystemChildrenContentsType(); - - public static SystemChildrenContentsType getInstance() { - return _instance; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.IRemoteContentsType#getType() - */ - public String getType() { - return CONTENTS_TYPE_CHILDREN; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.IRemoteContentsType#isPersistent() - */ - public boolean isPersistent() { - return false; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemEscapeCharHelper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemEscapeCharHelper.java deleted file mode 100644 index ae75d02ba..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemEscapeCharHelper.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -public class SystemEscapeCharHelper { - - private static char ESCAPE_CHAR = '#'; - - private char changedChars[]; - private int escapeStringLength; - - /** - * Constructor. - * @param chars array of chars to be escaped. - */ - public SystemEscapeCharHelper (char[] chars) - { - changedChars = new char[chars.length+1]; - - for (int i = 0; i < chars.length; i++) - { - changedChars[i]=chars[i]; - } - - // add the escape character itself so that it itself can be escaped - changedChars[chars.length]=ESCAPE_CHAR; - - escapeStringLength = 4; - - } - - public String getStringForFileName(String name) - { - String fileName = name; - - int i = 0; - while (i < fileName.length()) - { - for (int j = 0; j < changedChars.length; j++) - { - if (fileName.charAt(i) == changedChars[j]) - { - if ((fileName.length()-1) >= i) - { - fileName = fileName.substring(0, i) + escapeString(changedChars[j]) + fileName.substring(i+1); - } - else - { - fileName = fileName.substring(0, i) + escapeString(changedChars[j]); - } - i = i + escapeStringLength-1; - } - } - i++; - } - - return fileName; - - } - - public String getStringFromFileName(String fileName) - { - String name = fileName; - - int i = 0; - while (i < name.length()) - { - if (name.charAt(i) == ESCAPE_CHAR) - { - if ((name.length()-2) >= i) - { - name = name.substring(0, i) + originalString(name.substring(i+1, i+escapeStringLength)) + name.substring(i+escapeStringLength); - } - else - { - name = name.substring(0, i) + originalString(name.substring(i+1)); - } - } - i++; - } - - return name; - } - - private String escapeString(char c) - { - /* for (int i = 0; i < changedChars.length; i++) - { - if (changedChars[i]== c) - { - return ""+ESCAPE_CHAR+i; - } - } - return ""+c; - */ - - int intValue = c; - String returnStr=""+ESCAPE_CHAR; //$NON-NLS-1$ - - if (intValue < 10) - returnStr = returnStr+"00"; //$NON-NLS-1$ - else if (intValue < 100) - returnStr = returnStr+"0"; //$NON-NLS-1$ - - return returnStr + intValue; - - } - - private String originalString(String s) - { - // return ""+changedChars[Integer.parseInt(s)]; - - char c = (char)Integer.parseInt(s); - - return ""+c; //$NON-NLS-1$ - } - - - -/* TEST HARNESS */ -/* public static void main(String[] args) - { - try { - char [] charArray = new char[1]; - - charArray[0]='\''; - SystemEscapeCharHelper helper = new -SystemEscapeCharHelper(charArray); - - System.out.println(">>>>>start>>>>>"); - - - String[] strings = {"'hello_world'", "'", "'abc'", "bca", "ca'_'b"}; - for (int i = 0; i < strings.length; i++) - { - String escaped = helper.getStringForFileName(strings[i]); - - System.out.println("escaped:"+escaped+":"); - - String unescaped = helper.getStringFromFileName(escaped); - - System.out.println("unescaped:"+unescaped+":"); - System.out.println("***"); - } - System.out.println("*****end*****"); - - - } catch (Exception e){ - System.out.println(""+e.toString()); - -// try{ -// System.in.read(); -// }catch(Exception ex) -// { -// } - - } -// try{ -// System.in.read(); -// }catch(Exception e) -// {} -}*/ -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemFilterStringContentsType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemFilterStringContentsType.java deleted file mode 100644 index 54af84a23..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemFilterStringContentsType.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core.model; - -/** - * Represents contents that are children of a container - */ -public class SystemFilterStringContentsType implements ISystemContentsType { - public static String CONTENTS_TYPE_CHILDREN_PARENTS = "contents_children_parents"; //$NON-NLS-1$ - public static SystemFilterStringContentsType _instance = new SystemFilterStringContentsType(); - - public static SystemFilterStringContentsType getInstance() { - return _instance; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.IRemoteContentsType#getType() - */ - public String getType() { - return CONTENTS_TYPE_CHILDREN_PARENTS; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.IRemoteContentsType#isPersistent() - */ - public boolean isPersistent() { - return false; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemMessageObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemMessageObject.java deleted file mode 100644 index bddc86739..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemMessageObject.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.model; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; - -/** - * This class captures a message we wish to display as child node in the tree view. - */ -public class SystemMessageObject implements ISystemMessageObject, IAdaptable, Comparable { - - SystemMessage systemMessage; - protected String message; - protected int type; - protected Object parent; - - /** - * Constructor when using SystemMessage - * @param msgObj The system message from which to retrieve text to show in the tree viewer - * @param type The message severity, dictating the icon. - * @param parent The parent node of this within the tree view - * @see org.eclipse.rse.core.model.ISystemMessageObject - */ - public SystemMessageObject(SystemMessage msgObj, int type, Object parent) { - this.systemMessage = msgObj; - this.message = msgObj.getLevelOneText(); - this.type = type; - this.parent = parent; - } - - /** - * Get the message to display in the tree viewer - */ - public String getMessage() { - return message; - } - - /** - * Message type. - * @see org.eclipse.rse.core.model.ISystemMessageObject - */ - public int getType() { - return type; - } - - /** - * Get the parent object (within tree view) - */ - public Object getParent() { - return parent; - } - - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - */ - public Object getAdapter(Class adapterType) { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - /** - * @see ISystemMessageObject#isTransient() - */ - public boolean isTransient() { - return true; - } - - /** - * Return the SystemMessage for this SystemMessageObject. - */ - public SystemMessage getSystemMessage() { - return systemMessage; - } - - /** - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - public int compareTo(Object o) { - ISystemMessageObject other = (ISystemMessageObject) o; - return getMessage().compareTo(other.getMessage()); - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemRemoteResourceSet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemRemoteResourceSet.java deleted file mode 100644 index f313d97b1..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemRemoteResourceSet.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2004, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.model; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter; - - -public class SystemRemoteResourceSet extends AbstractSystemResourceSet -{ - private ISubSystem _subSystem; - private ISystemDragDropAdapter _adapter; - - public SystemRemoteResourceSet(ISubSystem subSystem) - { - super(); - _subSystem = subSystem; - } - - public SystemRemoteResourceSet(ISubSystem subSystem, ISystemDragDropAdapter adapter) - { - super(); - _subSystem = subSystem; - _adapter = adapter; - } - - public SystemRemoteResourceSet(ISubSystem subSystem, ISystemDragDropAdapter adapter, Object[] objects) - { - super(objects); - _subSystem = subSystem; - _adapter = adapter; - } - - public SystemRemoteResourceSet(ISubSystem subSystem, ISystemDragDropAdapter adapter, List objects) - { - super(objects); - _subSystem = subSystem; - _adapter = adapter; - } - - public SystemRemoteResourceSet(ISubSystem subSystem, Object[] objects) - { - super(objects); - _subSystem = subSystem; - } - - public SystemRemoteResourceSet(ISubSystem subSystem, List objects) - { - super(objects); - _subSystem = subSystem; - } - - public ISystemDragDropAdapter getAdapter() - { - return _adapter; - } - - public ISubSystem getSubSystem() - { - return _subSystem; - } - - public String pathFor(Object resource) - { - if (_adapter == null) - { - _adapter = (ISystemDragDropAdapter)((IAdaptable)resource).getAdapter(ISystemDragDropAdapter.class); - } - - return _adapter.getAbsoluteName(resource); - } - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemSignonInformation.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemSignonInformation.java deleted file mode 100644 index e6db159b2..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemSignonInformation.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.core.model; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.subsystems.ICredentials; - -/** - * This class encapsulates the signon information required for a remote system. This class - * must be secure and never disclose the password for the remote system in its unencrypted form. - * However the encrypted form of the password is not considered secret information and can be - * accessed by anyone. - */ -public final class SystemSignonInformation implements ICredentials { - - private IRSESystemType _systemType; - private String _hostname; - private String _userId; - private String _password; - - /** - * Default no-arg constructor - */ - public SystemSignonInformation() { - } - - /** - * Constructor for SystemSignonInformation. - */ - public SystemSignonInformation(String hostname, String userid, IRSESystemType systemType) { - _hostname = hostname;//RSEUIPlugin.getQualifiedHostName(hostname).toUpperCase(); - _userId = userid; - _systemType = systemType; - } - - /** - * Constructor for SystemSignonInformation. - */ - public SystemSignonInformation(String hostname, String userid, String password, IRSESystemType systemType) { - _hostname = hostname;//RSEUIPlugin.getQualifiedHostName(hostname).toUpperCase(); - _userId = userid; - _password = password; - _systemType = systemType; - } - - /** - * Returns the hostname of the remote system - * @return String - */ - public String getHostname() { - return _hostname; - } - - /** - * Returns the systemType of the remote system. - * @return the systemType object. - */ - public IRSESystemType getSystemType() { - return _systemType; - } - - /** - * Returns the userid for the remote system - * @return the user ID. - */ - public String getUserId() { - return _userId; - } - - /** - * Return the password for the remote system - */ - public String getPassword() { - return _password; - } - - /** - * Sets the password for the remote system - */ - public void setPassword(String string) { - _password = string; - } - - /** - * Sets the hostname. - * @param hostname The hostname to set - */ - public void setHostname(String hostname) { - _hostname = hostname;//RSEUIPlugin.getQualifiedHostName(hostname).toUpperCase(); - } - - /** - * Sets the systemType. - * @param systemType The systemType to set - */ - public void setSystemType(IRSESystemType systemType) { - _systemType = systemType; - } - - /** - * Sets the userid. - * @param userId The userid to set - */ - public void setUserId(String userId) { - _userId = userId; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemStartHere.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemStartHere.java deleted file mode 100644 index 365aa2a39..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemStartHere.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods - ********************************************************************************/ - -package org.eclipse.rse.core.model; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.internal.core.model.SystemProfileManager; - - -/** - * It all begins RIGHT HERE! - */ -public class SystemStartHere -{ - /** - * STEP 1. Get system registry singleton - * <p> - * SAME AS: <code>RSECorePlugin.getSystemRegistry</code> - */ - public static ISystemRegistry getSystemRegistry() - { - return RSECorePlugin.getTheSystemRegistry(); - } - - /** - * STEP 2a. Get connections for all system types - * <p> - * SAME AS: <code>getSystemRegistry().getConnections()</code> - * @see #getConnectionsBySystemType(String) - */ - public static IHost[] getConnections() - { - return getSystemRegistry().getHosts(); - } - - /** - * STEP 2b. Get all connections for the given system type. - * <p> - * SAME AS: <code>getSystemRegistry().getConnectionsBySystemType(systemType)</code> - * @param systemType One of the system types defined via system type extension point: - * <ul> - * <li>"org.eclipse.rse.systemtype.iseries" ({@link IRSESystemType#SYSTEMTYPE_ISERIES_ID}) - * <li>"org.eclipse.rse.systemtype.windows" ({@link IRSESystemType#SYSTEMTYPE_WINDOWS_ID}) - * <li>"org.eclipse.rse.systemtype.zseries" ({@link IRSESystemType#SYSTEMTYPE_ZSERIES_ID}) - * <li>"org.eclipse.rse.systemtype.unix" ({@link IRSESystemType#SYSTEMTYPE_UNIX_ID}) - * <li>"org.eclipse.rse.systemtype.linux" ({@link IRSESystemType#SYSTEMTYPE_LINUX_ID}) - * <li>"org.eclipse.rse.systemtype.aix" ({@link IRSESystemType#SYSTEMTYPE_AIX_ID}) - * <li>"org.eclipse.rse.systemtype.local" ({@link IRSESystemType#SYSTEMTYPE_LOCAL_ID}) - * <li>"org.eclipse.rse.systemtype.ftp" ({@link IRSESystemType#SYSTEMTYPE_FTP_ID}) - * <li>"org.eclipse.rse.systemtype.ssh" ({@link IRSESystemType#SYSTEMTYPE_SSH_ID}) - * <li>"org.eclipse.rse.systemtype.telnet" ({@link IRSESystemType#SYSTEMTYPE_TELNET_ID}) - * </ul> - * @see org.eclipse.rse.core.IRSESystemType - * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySystemType(String) - * - */ - public static IHost[] getConnectionsBySystemType(String systemTypeId) - { - IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(systemTypeId); - return getSystemRegistry().getHostsBySystemType(systemType); - } - - /** - * STEP 2c. Get all connections for your subsystem configuration - * <p> - * SAME AS: <code>getSystemRegistry().getConnectionsBySubSystemConfiguration(subsystemConfiguration)</code> - * @param subsystemConfiguration A subsystem configuration object. - * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySubSystemConfiguration(ISubSystemConfiguration) - * @see #getConnectionsBySubSystemConfiguration(String) - */ - public static IHost[] getConnectionsBySubSystemConfiguration(ISubSystemConfiguration subsystemConfiguration) - { - return getSystemRegistry().getHostsBySubSystemConfiguration(subsystemConfiguration); - } - /** - * STEP 2d. Get all connections for your subsystem configuration, identified by subsystemConfigurationId. - * <p> - * SAME AS: <code>getSystemRegistry().getConnectionsBySubSystemConfiguration(getSubSystemConfiguration(subsystemConfigurationId))</code> - * @param subsystemConfigurationId The id of the subsystem configuration as given in its plugin.xml id attribute for the subsystemConfigurations extension point - * @see #getSubSystemConfiguration(String) - * @see #getConnectionsBySubSystemConfiguration(ISubSystemConfiguration) - */ - public static IHost[] getConnectionsBySubSystemConfiguration(String subsystemConfigurationId) - { - return getSystemRegistry().getHostsBySubSystemConfiguration(getSubSystemConfiguration(subsystemConfigurationId)); - } - - /** - * STEP 3a. Get all subsystems for all connections for your subsystem configuration, identified by subsystemConfigurationId. - * <p> - * SAME AS: <code>getSystemRegistry().getSubSystems(subsystemConfigurationId)</code> - * @param subsystemConfigurationId The subsystem configuration id as given in its plugin.xml id attribute for the subsystemConfigurations extension point - * @see ISystemRegistry#getSubSystemConfiguration(String) - * @see ISubSystemConfiguration#getSubSystems(boolean) - * @see ISubSystemConfiguration#getId() - */ - public static ISubSystem[] getSubSystems(String subsystemConfigurationId) - { - ISystemRegistry sr = getSystemRegistry(); - ISubSystemConfiguration config = sr.getSubSystemConfiguration(subsystemConfigurationId); - if (config == null) - return (new ISubSystem[0]); - return config.getSubSystems(true); - } - /** - * STEP 3b. Get all subsystems for the given connection for your subsystem configuration, identified by subsystemConfigurationId. - * <p> - * SAME AS: <code>getSystemRegistry().getSubSystems(subsystemConfigurationId, connection)</code> - * @param subsystemConfigurationId The subsystem configuration id as given in its plugin.xml id attribute for the subsystemConfigurations extension point - * @param connection The connection object you wish to get the subsystems for. Typically there is only one subsystem per object. - * @see ISystemRegistry#getSubSystemConfiguration(String) - * @see ISubSystemConfiguration#getSubSystems(IHost, boolean) - */ - public static ISubSystem[] getSubSystems(String subsystemConfigurationId, IHost connection) - { - ISystemRegistry sr = getSystemRegistry(); - ISubSystemConfiguration config = sr.getSubSystemConfiguration(subsystemConfigurationId); - if (config == null) - return (new ISubSystem[0]); - return config.getSubSystems(connection, true); - } - /** - * STEP 3c. Same as {@link #getSubSystems(String,IHost)} by used when you know - * the subsystem configuration only supports a single subsystem per connection. - * @param subsystemConfigurationId The subsystem configuration id as given in its plugin.xml id attribute for the subsystemConfigurations extension point - * @param connection The connection object you wish to get the subsystems for. Typically there is only one subsystem per object. - * @see #getSubSystems(String, IHost) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getId() - */ - public static ISubSystem getSubSystem(String subsystemConfigurationId, IHost connection) - { - ISubSystem[] subsystems = getSubSystems(subsystemConfigurationId, connection); - if ((subsystems == null) || (subsystems.length==0)) - return null; - else - return subsystems[0]; - } - - - - // ---------------------------- - // MISCELLANEOUS: - // ---------------------------- - /** - * Miscallenous Helper. Return the subsystem configuration object for the given subsystemConfigurationId. - * <p> - * SAME AS: <code>getSystemRegistry().getSubSystemConfiguration(subsystemConfigurationId)</code> - * @param subsystemConfigurationId The id of the subsystem configuration as given in its plugin.xml id attribute for the subsystemConfigurations extension point - */ - public static ISubSystemConfiguration getSubSystemConfiguration(String subsystemConfigurationId) - { - return getSystemRegistry().getSubSystemConfiguration(subsystemConfigurationId); - } - - /** - * Miscellaneous Helper. Return singleton profile manager - * SAME AS: <code>getSystemRegistry().getSystemProfileManager()</code> - */ - public static ISystemProfileManager getSystemProfileManager() - { - return SystemProfileManager.getDefault(); - } - - /** - * Return all active profiles. - * <p> - * A team might have many profiles, at least one per developer. - * However, typically only one or two are activated at a time, and - * we only return connections for those which are active. - * <p> - * SAME AS: <code>getSystemRegistry().getActiveSystemProfiles()</code> - */ - public static ISystemProfile[] getActiveSystemProfiles() - { - return getSystemRegistry().getActiveSystemProfiles(); - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemWorkspaceResourceSet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemWorkspaceResourceSet.java deleted file mode 100644 index 9dfd60c0e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemWorkspaceResourceSet.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core.model; - -import java.util.List; - -import org.eclipse.core.resources.IResource; - -public class SystemWorkspaceResourceSet extends AbstractSystemResourceSet { - - public SystemWorkspaceResourceSet() { - super(); - } - - public SystemWorkspaceResourceSet(List resources) { - super(resources); - } - - public SystemWorkspaceResourceSet(IResource[] resources) { - super(resources); - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferenceManager.java deleted file mode 100644 index 78c35fdf6..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferenceManager.java +++ /dev/null @@ -1,184 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.references; - -import org.eclipse.core.resources.IFolder; - -/** - * A class for managing a list of shadow objects that reference master objects. - * <p> - * Sometimes we have a master list of objects, and we let the user select - * a subset of that list and we wish to persist that users selections. To - * accomplish this, in your Rose model, follow these steps: - * <ol> - * <li>Include the references package from the SystemReferences .cat file - * <li>Ensure the class for the master objects subclass SystemPersistableReferencedObject, - * or implement IRSEPersistableReferencedObject. - * <b>YOU MUST OVERRIDE getReferenceName() IN SYSTEMPERSISTABLEREFERENCEDOBJECT!</b> - * <li>Create a class subclassing SystemPersistableReferencingObject to hold a reference - * to the master object. This will hold a transient pointer, and a persistable - * name, of the master object. The name must be sufficient to be able to re-create - * the pointer upon restoration from disk. When you set the pointer via the - * setReferencedObject method, it will automatically extract the name of that - * object (by calling its getReferenceName method) and store it in the mof-modelled - * attribute of the SystemPersistableReferencingObject class. - * <li>Create a class subclassing this class (SystemPersistableReferenceManager) - * to manage the list of referencing objects. Each time you instantiate a reference - * object, add it to the referencingObjects list managed by this class. - * <b>YOU MUST OVERRIDE resolveReferencesAfterRestore() IN SYSTEMPERSISTABLEREFERENCEMANAGERIMPL!</b> - * </ol> - * <p> - * Once you have an instantiated and populated instance of this class, you can either - * choose to save it to disk in its own file (save/restore methods are supplied for this) - * or you can simply choose to store it as part of your own class via your own save - * and restore methods. If using MOF, and the containment of the manager class is modelled in - * your own containing class, this will happen automatically when you use mof to save - * your containing class instance. - */ -/** - * @lastgen interface SystemPersistableReferenceManager {} - */ - -public interface IRSEBasePersistableReferenceManager { - - /** - * Return an array of the referencing objects currently being managed. - * @return array of the referencing objects currently in this list. - */ - public IRSEBasePersistableReferencingObject[] getReferencingObjects(); - - /** - * Set in one shot the list of referencing objects. Replaces current list. - * @param objects An array of referencing objects which is to become the new list. - * @param deReference true to first de-reference all objects in the existing list. - */ - public void setReferencingObjects(IRSEBasePersistableReferencingObject[] objects, boolean deReference); - - /** - * Add a referencing object to the managed list. - * @return new count of referenced objects being managed. - */ - public int addReferencingObject(IRSEBasePersistableReferencingObject object); - - /** - * Remove a referencing object from the managed list. - * <p>Does NOT call removeReference on the master referenced object. - * @return new count of referenced objects being managed. - */ - public int removeReferencingObject(IRSEBasePersistableReferencingObject object); - - /** - * Remove and dereferences a referencing object from the managed list. - * <p>DOES call removeReference on the master referenced object. - * @return new count of referenced objects being managed. - */ - public int removeAndDeReferenceReferencingObject(IRSEBasePersistableReferencingObject object); - - /** - * Remove all objects from the list. - * <p>Does NOT call removeReference on the master referenced objects. - */ - public void removeAllReferencingObjects(); - - /** - * Remove and dereference all objects from the list. - * <p>DOES call removeReference on the master referenced objects. - */ - public void removeAndDeReferenceAllReferencingObjects(); - - /** - * Return how many referencing objects are currently in the list. - * @return current count of referenced objects being managed. - */ - public int getReferencingObjectCount(); - - /** - * Return the zero-based position of the given referencing object within the list. - * Does a memory address comparison (==) to find the object. - * @param object The referencing object to find position of. - * @return zero-based position within the list. If not found, returns -1 - */ - public int getReferencingObjectPosition(IRSEBasePersistableReferencingObject object); - - /** - * Move the given referencing object to a new zero-based position in the list. - * @param newPosition New zero-based position - * @param object The referencing object to move - */ - public void moveReferencingObjectPosition(int newPosition, IRSEBasePersistableReferencingObject object); - - /** - * Return true if the given referencable object is indeed referenced by a referencing object - * in the current list. This is done by comparing the reference names of each, not the - * in-memory pointers. - * @param object The referencable object to which to search for a referencing object within this list - * @return true if found in list, false otherwise. - */ - public boolean isReferenced(IRSEBasePersistableReferencedObject object); - - /** - * Search list of referencing objects to see if one of them references the given referencable object. - * This is done by comparing the reference names of each, not the in-memory pointers. - * @param object The referencable object to which to search for a referencing object within this list - * @return the referencing object within this list which references the given referencable object, or - * null if no reference found. - */ - public IRSEBasePersistableReferencingObject getReferencedObject(IRSEBasePersistableReferencedObject object); - - /** - * Attempt to save contents of manager to disk. Only call if not doing your own save from - * your own model that uses a subclass of this. - * @param folder The folder in which to save the manager. - * @param fileName The unqualified file name to save to. Should include extension, such as .xmi - */ - public void save(IFolder folder, String fileName) throws Exception; - - /** - * After restoring this from disk, there is only the referenced object name, - * not the referenced object pointer, for each referencing object. - * <p> - * This method is called after restore and for each restored object in the list must: - * <ol> - * <li>Do what is necessary to find the referenced object, and set the internal reference pointer. - * <li>Call addReference(this) on that object so it can maintain it's in-memory list - * of all referencing objects. - * </ol> - * @return true if resolved successfully. False if some references were not found and - * hence those referencing objects removed from the restored list. - */ - public boolean resolveReferencesAfterRestore(); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Name attribute - */ - String getName(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Name attribute - */ - void setName(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of ReferencingObjectList references - */ - java.util.List getReferencingObjectList(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferencedObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferencedObject.java deleted file mode 100644 index 8c5c225cd..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferencedObject.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.core.references; - -/** - * Referenced objects are objects that have shadow objects (referencing objects) of them. - * Typically, references are created to enable a UI which does not allow the same - * real object to appear multiple times. In these cases, a unique reference object - * is created for each unique instance of the real object. - * <p> - * The parent interface IRSEReferencedObject captures the simple set of methods - * an object that supports such a real object implement. - * <p> - * This interface specializes that for the case of real objects that support references - * that must be persisted. - * Typically, we build the references in memory at runtime to satisfy the UI. - * However, occassionally we build the list of references for a more permanent reason, - * such as when we let a user choose a subset from a master list. - * <p> - * When we persist such a reference, we can't persist the memory reference to the master - * object. Instead, we persist the unique name of that object, and upon restoring - * from disk we then resolve that into a runtime reference to a real memory object. - * <p> - * This interface supplies the method to allow a referencing object to - * query that unique name or key from this real object. - */ -public interface IRSEBasePersistableReferencedObject extends IRSEBaseReferencedObject { - - /** - * @return the unique name or key of this master object to record in the referencing object. - */ - public String getReferenceName(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferencingObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferencingObject.java deleted file mode 100644 index a3d4bf88c..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBasePersistableReferencingObject.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.references; - -/** - * Referencing objects are shadows of real objects. Typically, shadows are created - * to enable a GUI which does not allow the same real object to appear multiple times. - * In these cases, a unique shadow object is created for each unique instance of the - * real object. - * <p> - * The parent interface ISystemReferencingObject captures the simple set of methods - * such a shadow must implement. - * <p> - * This interface specializes that for the case of references that must be persisted. - * Typically, we build the references in memory at runtime just to satisfy the GUI. - * However, occassionally we build the list of references for a more permanent reason, - * such as when we let a user choose a subset from a master list. - * <p> - * When we persist such a reference, we can't persist the memory reference to the master - * object. Instead, we persist the unique name or key of that object, and upon restoring - * from disk we then resolve that into a runtime reference to a real memory object. - * <p> - * This interface captures the methods to set and query that name or key. - */ -public interface IRSEBasePersistableReferencingObject extends IRSEBaseReferencingObject { - /** - * Set the object to which we reference. This is an overload of the parent - * interface method of the same name. This one takes an object of which we - * can query its unique name for the purpose of saving that to disk. - */ - public void setReferencedObject(IRSEBasePersistableReferencedObject obj); - - /** - * Query the unique name or key of the object we are referencing. - */ - public String getReferencedObjectName(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBaseReferencedObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBaseReferencedObject.java deleted file mode 100644 index cee97fc87..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBaseReferencedObject.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.core.references; - -/** - * Interface that any master object that is referenced must implement. - */ -public interface IRSEBaseReferencedObject { - /** - * Add a reference, increment reference count, return new count - * @param ref the referencing object from which this object will now be referenced. - * @return new count of how many referencing objects reference this object. - */ - public int addReference(IRSEBaseReferencingObject ref); - - /** - * Remove a reference, decrement reference count, return new count - * @param ref the referencing object from which this object is no longer referenced. - * @return new count of how many referencing objects reference this object. - */ - public int removeReference(IRSEBaseReferencingObject ref); - - /** - * @return a count of how many referencing objects reference this object. - */ - public int getReferenceCount(); - - /** - * Clear the list of referenced objects. - */ - public void removeAllReferences(); - - /** - * @return a list of all referencing objects of this object - */ - public IRSEBaseReferencingObject[] getReferencingObjects(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBaseReferencingObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBaseReferencingObject.java deleted file mode 100644 index f70e5698d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEBaseReferencingObject.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.references; - -/** - * Referencing objects are shadows of real objects. Typically, shadows are created - * to enable a GUI which does not allow the same real object to appear multiple times. - * In these cases, a unique shadow object is created for each unique instance of the - * real object. - * <p> - * This interface captures the simple set of methods such a shadow must implement. - */ -public interface IRSEBaseReferencingObject { - /** - * Set the object to which we reference - * @param obj the object to reference - */ - public void setReferencedObject(IRSEBaseReferencedObject obj); - - /** - * @return the object which we reference - */ - public IRSEBaseReferencedObject getReferencedObject(); - - /** - * Fastpath to getReferencedObject().removeReference(this). - * @return new reference count of master object - */ - public int removeReference(); - - /** - * @param broken true if this reference is currently broken/unresolved - */ - public void setReferenceBroken(boolean broken); - - /** - * @return true if this reference is currently broken/unresolved - */ - public boolean isReferenceBroken(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEPersistableReferencedObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEPersistableReferencedObject.java deleted file mode 100644 index 39d1e0d65..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEPersistableReferencedObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.core.references; - -/** - * This is an object that can have shadow (reference) objects, which simply - * point to this object, and a copy of this object's unique name or key (for storing on disk). - */ - -public interface IRSEPersistableReferencedObject extends IRSEReferencedObject, IRSEBasePersistableReferencedObject { - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEPersistableReferencingObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEPersistableReferencingObject.java deleted file mode 100644 index a227de7a2..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEPersistableReferencingObject.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.references; - -/** - * A simple class that implements IRSEPersistableReferencingObject. - * This is an object that is a shadow (reference) of a real master object - * (IRSEPersistableReferencedObject). - * <p> - * Objects of this class contain a pointer (in memory) to the master object, - * and a copy of this object's unique name or key (for storing on disk). - * <p> - * Only the name is saved to disk, and after restoring from disk, that name - * is used to set the actual object reference. - * <p> - * The intention is that in your Rose model, your class extends this class. - * Do this for any shadow/reference class which you want to persist. Use - * a subclass of SystemPersistableReferenceManager to manage a list of these, - * and manage the saving/restoring of that list. - * <p> - * <b>YOU MUST OVERRIDE resolveReferencesAfterRestore IN YOUR REFERENCE MANAGER SUBCLASS</b> - */ -/** - * @lastgen interface SystemPersistableReferencingObject extends SystemReferencingObject {} - */ - -public interface IRSEPersistableReferencingObject extends IRSEReferencingObject, IRSEBasePersistableReferencingObject { - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the ReferencedObjectName attribute - */ - String getReferencedObjectName(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the ReferencedObjectName attribute - */ - void setReferencedObjectName(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The ParentReferenceManager reference - */ - IRSEBasePersistableReferenceManager getParentReferenceManager(); - - /** - * @generated This field/method will be replaced during code generation - * @param l The new value of the ParentReferenceManager reference - */ - void setParentReferenceManager(IRSEBasePersistableReferenceManager value); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEReferencedObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEReferencedObject.java deleted file mode 100644 index 5f1f1c098..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEReferencedObject.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.core.references; - -/** - * An interface to encapsulate the operations required of an object which - * supports references to it by other objects (IRSEReferencingObject). - * This type of class needs to support maintaining an in-memory list of - * all who reference it so that list can be following on delete and - * rename operations. - * <p> - * These references are not persistent. Persistent references are managed - * by the subtype IRSEPersistableReferencedObject. - */ - -public interface IRSEReferencedObject extends IRSEBaseReferencedObject { - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEReferencingObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEReferencingObject.java deleted file mode 100644 index 1f5a708c0..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/references/IRSEReferencingObject.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.references; - -/** - * A class to encapsulate the operations required of an object which - * is merely a reference to another object, something we call a shadow. - * Such shadows are needed to support a GUI which displays the same - * object in multiple places. To enable that, it is necessary not to - * use the same physical object in each UI representation as the UI - * will only know how to update/refresh the first one it finds. - * <p> - * These references are not persistent. Persistent references are managed - * by the subclass SystemPersistableReferencingObject. - */ -/** - * @lastgen interface SystemReferencingObject {} - */ - -public interface IRSEReferencingObject extends IRSEBaseReferencingObject { - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractConnectorService.java deleted file mode 100644 index 421d5d549..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractConnectorService.java +++ /dev/null @@ -1,480 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [185750] Remove IConnectorService.getHostType() - * David Dykstal (IBM) - [189483] fix spelling in initialize/uninitialize method signatures - ********************************************************************************/ -package org.eclipse.rse.core.subsystems; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.RSEModelObject; - -/** - * This is a base class to make it easier to create connector services. - * <p> - * An {@link org.eclipse.rse.core.subsystems.IConnectorService} object - * is returned from a subsystem object via getConnectorService(), and - * it is used to maintain the connection to a particular set of subsystems. - * <p> - * This class implements the protocol for much of the - * standard bookkeeping for connector services including - * server launchers (if none are required), event handling, - * hosts, ports, addresses, descriptions, and registered subsystems. - * Subclasses must concern themselves with actually authenticating and connecting. - */ -public abstract class AbstractConnectorService extends RSEModelObject implements IConnectorService { - - private Vector commListeners = new Vector(5); - private ISubSystem _primarySubSystem = null; - private List _registeredSubSystems = new ArrayList(); - private IHost _host; - private String _description; - private String _name; - private int _port; - private boolean _usingSSL; - - /** - * Construct a new connector service. This should be called during the construction - * of any subclasses. - * @param name The name of the connector service. - * @param description A description of the connector service. - * @param host The host associated with this connector service. A host may have multiple - * connector services. - * @param port The port associated with this connector service if this connector service - * is IP based. If not IP based this can be used for some other purpose. - */ - public AbstractConnectorService(String name, String description, IHost host, int port) { - _name = name; - _description = description; - _host = host; - _port = port; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#isServerLaunchTypeEnabled(org.eclipse.rse.core.subsystems.ISubSystem, org.eclipse.rse.core.subsystems.ServerLaunchType) - */ - public final boolean isServerLaunchTypeEnabled(ISubSystem subsystem, ServerLaunchType serverLaunchType) { - IServerLauncher sl = getRemoteServerLauncher(); - if (sl instanceof RemoteServerLauncher) { - RemoteServerLauncher isl = (RemoteServerLauncher) sl; - return isl.isEnabledServerLaunchType(serverLaunchType); - } else - return subsystem.getSubSystemConfiguration().supportsServerLaunchType(serverLaunchType); - } - - /** - * @return null, may be overriden - * @see IConnectorService#getRemoteServerLauncher() - */ - public IServerLauncher getRemoteServerLauncher() { - return null; - } - - /** - * @return false, may be overridden - * @see IConnectorService#supportsRemoteServerLaunching() - */ - public boolean supportsRemoteServerLaunching() { - return false; - } - - /** - * @return false, may be overridden - * @see IConnectorService#supportsServerLaunchProperties() - */ - public boolean supportsServerLaunchProperties() { - return false; - } - - /** - * @return null, may be overridden - * @see IConnectorService#getRemoteServerLauncherProperties() - */ - public IServerLauncherProperties getRemoteServerLauncherProperties() { - return null; - } - - /** - * Do nothing, may be overridden - * @param newRemoteServerLauncher the server launcher properties - * @see IConnectorService#setRemoteServerLauncherProperties(IServerLauncherProperties) - */ - public void setRemoteServerLauncherProperties(IServerLauncherProperties newRemoteServerLauncher) { - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#hasRemoteServerLauncherProperties() - */ - public final boolean hasRemoteServerLauncherProperties() { - return getRemoteServerLauncherProperties() != null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#addCommunicationsListener(org.eclipse.rse.core.subsystems.ICommunicationsListener) - */ - public final void addCommunicationsListener(ICommunicationsListener listener) { - if (!commListeners.contains(listener)) { - commListeners.add(listener); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#removeCommunicationsListener(org.eclipse.rse.core.subsystems.ICommunicationsListener) - */ - public final void removeCommunicationsListener(ICommunicationsListener listener) { - commListeners.remove(listener); - } - - /** - * Fires the communication event mentioned in the eventType. - * @param eventType the communications event to fire. - */ - final protected void fireCommunicationsEvent(int eventType) { - CommunicationsEvent e = new CommunicationsEvent(this, eventType); - Object[] items = commListeners.toArray(); - for (int loop=0; loop < items.length; loop++) { - ((ICommunicationsListener) items[loop]).communicationsStateChange(e); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getHost() - */ - public final IHost getHost() { - return _host; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setHost(org.eclipse.rse.core.model.IHost) - */ - public final void setHost(IHost host) { - _host = host; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.RSEModelObject#getDescription() - */ - public final String getDescription() { - return _description; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEModelObject#getName() - */ - public final String getName() { - return _name; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setPort(int) - */ - public final void setPort(int port) { - if (port != _port) - { - _port = port; - setDirty(true); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getPort() - */ - public final int getPort() { - return _port; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getPrimarySubSystem() - */ - public final ISubSystem getPrimarySubSystem() { - if (_primarySubSystem == null) - { - if (_registeredSubSystems.size() == 0) - { - - } - else - { - ISubSystem ss = (ISubSystem)_registeredSubSystems.get(0); - _primarySubSystem = ss.getPrimarySubSystem(); - } - } - return _primarySubSystem; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#registerSubSystem(org.eclipse.rse.core.subsystems.ISubSystem) - */ - public final void registerSubSystem(ISubSystem ss) { - if (!_registeredSubSystems.contains(ss)) - { - _registeredSubSystems.add(ss); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#deregisterSubSystem(org.eclipse.rse.core.subsystems.ISubSystem) - */ - public final void deregisterSubSystem(ISubSystem ss) { - _registeredSubSystems.remove(ss); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#commit() - */ - public final boolean commit() { - return getHost().commit(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#getPersistableParent() - */ - public final IRSEPersistableContainer getPersistableParent() { - return _host; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - List children = new ArrayList(20); - IServerLauncherProperties launcherProperties = getRemoteServerLauncherProperties(); - if (launcherProperties != null) { - children.add(getRemoteServerLauncherProperties()); - } - children.addAll(_registeredSubSystems); - children.addAll(Arrays.asList(getPropertySets())); - IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()]; - children.toArray(result); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getHostName() - */ - public final String getHostName() { - return getHost().getHostName(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getVersionReleaseModification() - */ - public String getVersionReleaseModification() { - return ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getSubSystems() - */ - public final ISubSystem[] getSubSystems() { - return (ISubSystem[])_registeredSubSystems.toArray(new ISubSystem[_registeredSubSystems.size()]); - } - - /** - * Initialize any subsystems just after connecting to the host. - * @param monitor a progress monitor to report progress of initialization. - */ - protected final void initializeSubSystems(IProgressMonitor monitor) { - for (int i = 0; i < _registeredSubSystems.size(); i++) - { - ISubSystem ss = (ISubSystem)_registeredSubSystems.get(i); - ss.initializeSubSystem(monitor); - } - } - - /** - * Uninitialize any subsystem just after disconnecting from the host. - * @param monitor a progress monitor used to track uninitialization progress. - */ - protected final void uninitializeSubSystems(IProgressMonitor monitor) { - for (int i = 0; i < _registeredSubSystems.size(); i++) - { - ISubSystem ss = (ISubSystem)_registeredSubSystems.get(i); - ss.uninitializeSubSystem(monitor); - } - } - - /** - * Send the event to notify listeners of a disconnection. - * Used by the framework and should - * usually not be invoked by concrete subclasses. - */ - protected final void notifyDisconnection() { - // Fire comm event to signal state changed - if (!isConnected()) fireCommunicationsEvent(CommunicationsEvent.AFTER_DISCONNECT); - } - - /** - * Send the event to notify listeners of a connection. - * Used by the framework and should - * usually not be invoked by concrete subclasses. - */ - protected final void notifyConnection() { - if (isConnected()) fireCommunicationsEvent(CommunicationsEvent.AFTER_CONNECT); - } - - /** - * Send the event to notify listeners of a connection establishment error. - * Used by the framework and should - * usually not be invoked by concrete subclasses. - */ - protected final void notifyError() { - fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#isUsingSSL() - */ - public final boolean isUsingSSL() { - return _usingSSL; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setIsUsingSSL(boolean) - */ - public final void setIsUsingSSL(boolean flag) { - if (_usingSSL != flag) - { - _usingSSL = flag; - setDirty(true); - } - } - - /** - * Returns the temp directory of the remote system for the current user, - * if available. This implementation returns the empty string. - * @return an empty string - * @see IConnectorService#getTempDirectory() - */ - public String getTempDirectory() { - return ""; //$NON-NLS-1$ - } - - /** - * Returns the home directory of the remote system for the current user, - * if available. This implementation returns the empty string. - * @return an empty string - * @see IConnectorService#getHomeDirectory() - */ - public String getHomeDirectory() { - return ""; //$NON-NLS-1$ - } - - /** - * Reset the connector service state if a connector service is redefined - * or disconnected. - * Each subsystem needs to be informed so it can clear out any expansions. - * This implementation does nothing. - * Implementations should override and call {@link #reset()} - * if there is internal state to reset. - * @see IConnectorService#reset() - */ - public void reset() { - } - - /** - * This implementation returns the connector service's port property. - * Override if appropriate. - * <br> This is called by the default implementation of - * {@link #connect(IProgressMonitor)}, - * if #supportsServerLaunchProperties() is true. - * @return the port used for connecting to the target - */ - protected int getConnectPort() { - return getPort(); - } - - /** - * Connects to the target system. - * Calls {@link #internalConnect(IProgressMonitor)} - * @param monitor a monitor for progress monitoring and cancelation. - * @throws Exception if the connect fails - */ - public final void connect(IProgressMonitor monitor) throws Exception { - preConnect(); - internalConnect(monitor); - initializeSubSystems(monitor); - postConnect(); - } - - /** - * Disconnects from the target system. - * Calls {@link #internalDisconnect(IProgressMonitor)} - * and {@link #postDisconnect()} - * @throws Exception if the disconnect fails - */ - public final void disconnect(IProgressMonitor monitor) throws Exception { - preDisconnect(); - internalDisconnect(monitor); - uninitializeSubSystems(monitor); - postDisconnect(); - } - - /** - * Performs the actual connection to the target system. - * @param monitor for cancellation and progress reporting - * @throws Exception if connection does not succeed - */ - protected abstract void internalConnect(IProgressMonitor monitor) throws Exception; - - /** - * Performs the actual disconnection from the target system. - * @param monitor for cancellation and progress reporting - * @throws Exception if disconnection does not succeed - */ - protected abstract void internalDisconnect(IProgressMonitor monitor) throws Exception; - - /** - * Performs any cleanup required after disconnecting. - * This implementation does nothing. - * May be overridden. - * If overridden, invoke via super. - */ - protected void postDisconnect() { - } - - /** - * Performs any tasks required immediately prior to disconnecting. - * This implementation does nothing. - * May be overridden. - * If overridden, invoke via super. - */ - protected void preDisconnect() { - } - - /** - * Performs any tasks required immediately prior to connecting. - * This implementation does nothing. - * May be overridden. - * If overridden, invoke via super. - */ - protected void preConnect() { - } - - /** - * Performs any tasks required immediately after connecting. - * This implementation does nothing. - * May be overridden. - * If overridden, invoke via super. - */ - protected void postConnect() { - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractConnectorServiceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractConnectorServiceManager.java deleted file mode 100644 index e6e3be15c..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractConnectorServiceManager.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2003, 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) - [177523] Unify singleton getter methods - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; -import java.util.Hashtable; -import java.util.Set; - -import org.eclipse.rse.core.model.DummyHost; -import org.eclipse.rse.core.model.IHost; - - -/** - * This class is only needed if you need/want to support multiple - * subsystems and want them to share a single {@link org.eclipse.rse.core.subsystems.IConnectorService IConnectorService} object per - * system connection. This is the base system manager implementation - * that returns the same IConnectorService object for all subsystems in the - * same system connection, which implement a given interface. - * <p> - * For this to work all your subsystem classes that wish to share the - * same IConnectorService object must implement a common interface of your choosing. - * <p> - * Another benefit of using this class or a subclass of it, is that whenever - * the user changes the core properties for a single subsystem (port, userId) - * then this manager is used to cascade that to all other subsystems in this - * connection which share that same common interface. This means the user can change - * these properties in any one subsystem, and they are changed in all related - * subsystems magically. This is necessary because while these properties are - * persisted in the subsystem object, they really belong to the IConnectorService object, - * so when multiple subsystems share an IConnectorService object, changes to these properties - * in one subsystem need to be cascaded to the other subsystems. - * <p> - * Because you only need a singleton of these class, the constructor is protected. - * <p> - * Your subclass <b>must supply</b> a singleton factory method like the following:</p> - * <pre><code> - * public static MyConnectorServiceManager <b>getInstance</b>() - * { - * if (inst == null) - * inst = new MyConnectorServiceManager(); - * return inst; - * } - * </code></pre> - */ -public abstract class AbstractConnectorServiceManager implements IConnectorServiceManager -{ - - - // we maintain a hashtable of hashtables. The first is keyed by SystemConnection. - // The hashtable for each connection, maintains a list of IConnectorService objects keyed by - // a unique interface class object supplied by the subclasses. - private Hashtable systemConnectionRegistry = new Hashtable(); - - /** - * Protected constructor to ensure not instantiated this way. - * Use subclass-supplied static singleton factory method getInstance() instead. - */ - protected AbstractConnectorServiceManager() - { - } - - public void setConnectorService(IHost host, Class commonSSinterface, IConnectorService connectorService) - { - Hashtable connHT = (Hashtable)systemConnectionRegistry.get(host); - if (connHT == null) - { - connHT = new Hashtable(); - systemConnectionRegistry.put(host, connHT); - } - // replaces any previous service here - connHT.put(commonSSinterface, connectorService); - } - - public IConnectorService getConnectorService(IHost host, Class commonSSinterface) - { - Hashtable connHT = (Hashtable)systemConnectionRegistry.get(host); - if (connHT == null) - { - if (!(host instanceof DummyHost)) - { - connHT = findConnHTForDummyHost(host); - } - if (connHT == null) - { - connHT = new Hashtable(); - systemConnectionRegistry.put(host, connHT); - } - } - IConnectorService systemObject = (IConnectorService)connHT.get(commonSSinterface); - if (systemObject == null) - { - systemObject = createConnectorService(host); - connHT.put(commonSSinterface, systemObject); - } - else - { - IHost currentHost = systemObject.getHost(); - if (currentHost instanceof DummyHost && host != currentHost) - { - systemObject.setHost(host); - } - } - - return systemObject; - } - - protected Hashtable findConnHTForDummyHost(IHost newHost) - { - Set keyset = systemConnectionRegistry.keySet(); - Object[] keys = keyset.toArray(); - for (int i = 0; i < keys.length; i++) - { - Object key = keys[i]; - if (key instanceof DummyHost) - { - IHost host = (IHost)key; - if (host.getHostName().equals(newHost.getHostName())) - { - Hashtable table = (Hashtable)systemConnectionRegistry.remove(host); - systemConnectionRegistry.put(newHost, table); - return table; - } - } - } - return null; - } - - /** - * Return the actual IConnectorService object. Must be overridden by subclass. - */ - public abstract IConnectorService createConnectorService(IHost host); - - /** - * Given another subsystem, return true if that subsystem shares a single IConnectorService object - * with this one. You must override this to return true if you recognize that subsystem - * as one of your own. You are guaranteed the other subsystem will be from the same - * SystemConnection as this one. - * <p> - * You can't assume a SystemConnection will only have subsystems that you created, - * so you should only return true if it implements your interface or you know it is an - * instance of your subsystem class. - * <p> - * This should simply return (otherSubSystem instanceof interface) where interface is - * the same one returned from getSubSystemCommonInterface. - */ - public abstract boolean sharesSystem(ISubSystem otherSubSystem); - - /** - * For all subsystems in a particular SystemConnection, we need to know which - * ones are to share a single IConnectorService object. To do this, we need a key which - * is canonical for all subsystems in a given connection. This can be anything, - * but is typically a unique interface that all subsystems supported a shared - * IConnectorService object implement. - * <p> - * Whatever is returned from here is used as the key into a hashtable to find the - * singleton IConnectorService object in getSystemObject. - * <p> - * @param subsystem - rarely used, but if you support multiple common interfaces then this will help you - * decide which one to return. - * @return a common, yet unique to you, interface that all your subsystems implement. - */ - public abstract Class getSubSystemCommonInterface(ISubSystem subsystem); - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractCredentialsProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractCredentialsProvider.java deleted file mode 100644 index e6659f17b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractCredentialsProvider.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 IBM Corporation. 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 - * - * Contributors: - * David Dykstal (IBM) - 168977: refactoring IConnectorService - ********************************************************************************/ -package org.eclipse.rse.core.subsystems; - -/** - * The {@link AbstractCredentialsProvider} provides the base - * implementation of the {@link ICredentialsProvider} - * interface. It remembers the connector service and suppression - * state for the provider. - * <p> - * This class is meant to be subclassed. - */ -public abstract class AbstractCredentialsProvider implements ICredentialsProvider { - - private IConnectorService connectorService = null; - private boolean suppressed = false; - - /** - * Create a credentials provider for a particular connector service. - * Subclasses should implement their own constuctors but invoke this constructor - * in them. - * @param connectorService the associatated connector service. - */ - public AbstractCredentialsProvider(IConnectorService connectorService) { - this.connectorService = connectorService; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ICredentialsProvider#getConnectorService() - */ - public final IConnectorService getConnectorService() { - return connectorService; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ICredentialsProvider#isSuppressed() - */ - public final boolean isSuppressed() { - return suppressed; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ICredentialsProvider#setSuppressed(boolean) - */ - public final void setSuppressed(boolean suppressed) { - this.suppressed = suppressed; - } - - /** - * @return true if the associated connector service supports user ids. - */ - protected final boolean supportsUserId() { - return connectorService.supportsUserId(); - } - - /** - * @return true if the associated connector service requires a user id. - */ - protected final boolean requiresUserId() { - return connectorService.requiresUserId(); - } - - /** - * @return true if the associated connector service supports a password. - */ - protected final boolean supportsPassword() { - return connectorService.supportsPassword(); - } - - /** - * @return true if the associated connector service requires a password. - */ - protected final boolean requiresPassword() { - return connectorService.requiresPassword(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java deleted file mode 100644 index 21b0cae43..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java +++ /dev/null @@ -1,787 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 IBM Corporation. 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. - * - * Contributors: - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [185750] Remove IConnectorService.getHostType() - ********************************************************************************/ -package org.eclipse.rse.core.subsystems; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.IRSEPersistableContainer; - -public abstract class AbstractDelegatingConnectorService implements IDelegatingConnectorService -{ - - protected IHost _host; - - /** - * Creates a new delegating connector service for a particular host. - * Should be invoked from the constructor for any concrete subclasses. - * @param host The host associated with this connector service. - */ - public AbstractDelegatingConnectorService(IHost host) - { - _host = host; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IDelegatingConnectorService#getRealConnectorService() - */ - public abstract IConnectorService getRealConnectorService(); - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#addCommunicationsListener(org.eclipse.rse.core.subsystems.ICommunicationsListener) - */ - public void addCommunicationsListener(ICommunicationsListener listener) - { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.addCommunicationsListener(listener); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertySetContainer#addPropertySet(org.eclipse.rse.core.model.IPropertySet) - */ - public boolean addPropertySet(IPropertySet set) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.addPropertySet(set); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertySetContainer#addPropertySets(org.eclipse.rse.core.model.IPropertySet[]) - */ - public boolean addPropertySets(IPropertySet[] sets) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.addPropertySets(sets); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#clearPassword(boolean, boolean) - */ - public void clearPassword(boolean clearDiskCache, boolean propagate) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.clearPassword(clearDiskCache, propagate); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#clearCredentials() - */ - public void clearCredentials() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.clearCredentials(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#commit() - */ - public boolean commit() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.commit(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#connect(org.eclipse.core.runtime.IProgressMonitor) - */ - public void connect(IProgressMonitor monitor) throws Exception { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.connect(monitor); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertySetContainer#createPropertySet(java.lang.String) - */ - public IPropertySet createPropertySet(String name) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.createPropertySet(name); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertySetContainer#createPropertySet(java.lang.String, java.lang.String) - */ - public IPropertySet createPropertySet(String name, String description) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.createPropertySet(name, description); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#deregisterSubSystem(org.eclipse.rse.core.subsystems.ISubSystem) - */ - public void deregisterSubSystem(ISubSystem ss) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.deregisterSubSystem(ss); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#disconnect(org.eclipse.core.runtime.IProgressMonitor) - */ - public void disconnect(IProgressMonitor monitor) throws Exception { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.disconnect(monitor); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEModelObject#getDescription() - */ - public String getDescription() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getDescription(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getHomeDirectory() - */ - public String getHomeDirectory() - { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getHomeDirectory(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getHost() - */ - public IHost getHost() - { - return _host; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getHostName() - */ - public String getHostName() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getHostName(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEModelObject#getName() - */ - public String getName() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getName(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getPort() - */ - public int getPort() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getPort(); - } - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getPrimarySubSystem() - */ - public ISubSystem getPrimarySubSystem() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getPrimarySubSystem(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertySetContainer#getPropertySet(java.lang.String) - */ - public IPropertySet getPropertySet(String name) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getPropertySet(name); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertySetContainer#getPropertySets() - */ - public IPropertySet[] getPropertySets() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getPropertySets(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getRemoteServerLauncher() - */ - public IServerLauncher getRemoteServerLauncher() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getRemoteServerLauncher(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getRemoteServerLauncherProperties() - */ - public IServerLauncherProperties getRemoteServerLauncherProperties() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getRemoteServerLauncherProperties(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getSubSystems() - */ - public ISubSystem[] getSubSystems() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getSubSystems(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getTempDirectory() - */ - public String getTempDirectory() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getTempDirectory(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getUserId() - */ - public String getUserId() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getUserId(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#getVersionReleaseModification() - */ - public String getVersionReleaseModification() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getVersionReleaseModification(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#hasPassword(boolean) - */ - public boolean hasPassword(boolean onDisk) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.hasPassword(onDisk); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#hasRemoteServerLauncherProperties() - */ - public boolean hasRemoteServerLauncherProperties() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.hasRemoteServerLauncherProperties(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#inheritsCredentials() - */ - public boolean inheritsCredentials() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.inheritsCredentials(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#isConnected() - */ - public boolean isConnected() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.isConnected(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#isDirty() - */ - public boolean isDirty() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.isDirty(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#isServerLaunchTypeEnabled(org.eclipse.rse.core.subsystems.ISubSystem, org.eclipse.rse.core.subsystems.ServerLaunchType) - */ - public boolean isServerLaunchTypeEnabled(ISubSystem subsystem, - ServerLaunchType serverLaunchType) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.isServerLaunchTypeEnabled(subsystem, serverLaunchType); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#isSuppressed() - */ - public boolean isSuppressed() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.isSuppressed(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#isUsingSSL() - */ - public boolean isUsingSSL() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.isUsingSSL(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean) - */ - public void acquireCredentials(boolean forcePrompt) - throws InterruptedException { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.acquireCredentials(forcePrompt); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#registerSubSystem(org.eclipse.rse.core.subsystems.ISubSystem) - */ - public void registerSubSystem(ISubSystem ss) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.registerSubSystem(ss); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#removeCommunicationsListener(org.eclipse.rse.core.subsystems.ICommunicationsListener) - */ - public void removeCommunicationsListener(ICommunicationsListener listener) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.removeCommunicationsListener(listener); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IPropertySetContainer#removePropertySet(java.lang.String) - */ - public boolean removePropertySet(String name) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.removePropertySet(name); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#reset() - */ - public void reset() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.reset(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#setDirty(boolean) - */ - public void setDirty(boolean flag) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setDirty(flag); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setHost(org.eclipse.rse.core.model.IHost) - */ - public void setHost(IHost host) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setHost(host); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setIsUsingSSL(boolean) - */ - public void setIsUsingSSL(boolean flag) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setIsUsingSSL(flag); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setPassword(java.lang.String, java.lang.String, boolean, boolean) - */ - public void setPassword(String matchingUserId, String password, - boolean persist, boolean propagate) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setPassword(matchingUserId, password, persist, propagate); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setPort(int) - */ - public void setPort(int port) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setPort(port); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setRemoteServerLauncherProperties(org.eclipse.rse.core.subsystems.IServerLauncherProperties) - */ - public void setRemoteServerLauncherProperties( - IServerLauncherProperties value) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setRemoteServerLauncherProperties(value); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setSuppressed(boolean) - */ - public void setSuppressed(boolean suppressSignonPrompt) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setSuppressed(suppressSignonPrompt); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setUserId(java.lang.String) - */ - public void setUserId(String userId) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setUserId(userId); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#setWasRestored(boolean) - */ - public void setWasRestored(boolean flag) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setWasRestored(flag); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#sharesCredentials() - */ - public boolean sharesCredentials() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.sharesCredentials(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#supportsPassword() - */ - public boolean supportsPassword() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.supportsPassword(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#supportsRemoteServerLaunching() - */ - public boolean supportsRemoteServerLaunching() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.supportsRemoteServerLaunching(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#supportsServerLaunchProperties() - */ - public boolean supportsServerLaunchProperties() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.supportsServerLaunchProperties(); - } - return false; - } - - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#supportsUserId() - */ - public boolean supportsUserId() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.supportsUserId(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#saveUserId() - */ - public void saveUserId() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.saveUserId(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#removeUserId() - */ - public void removeUserId() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.removeUserId(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#savePassword() - */ - public void savePassword() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.savePassword(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#removePassword() - */ - public void removePassword() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.removePassword(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#wasRestored() - */ - public boolean wasRestored() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.wasRestored(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#requiresPassword() - */ - public boolean requiresPassword() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.requiresPassword(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#requiresUserId() - */ - public boolean requiresUserId() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.requiresUserId(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#isTainted() - */ - public boolean isTainted() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.isTainted(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#setTainted(boolean) - */ - public void setTainted(boolean flag) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setTainted(flag); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#getPersistableParent() - */ - public IRSEPersistableContainer getPersistableParent() { - return getHost(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#getPersistableChildren() - */ - public IRSEPersistableContainer[] getPersistableChildren() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.getPersistableChildren(); - } - return IRSEPersistableContainer.NO_CHILDREN; - } - - - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractResource.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractResource.java deleted file mode 100644 index 4e7045001..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractResource.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.core.subsystems; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; - - -/** - * This class can be used as the base class for model objects that represent - * remote resources returned from the subsystem via resolveFilterStrings. Its - * advantages are: - * <ul> - * <li>It already implements IAdaptable. - * <li>It already maintains the reference to the owning subsystem, which simplifies action processing. - * </ul> - */ -public abstract class AbstractResource implements IAdaptable -{ - private ISubSystem parentSubSystem; - - /** - * Default constructor - */ - public AbstractResource(ISubSystem parentSubSystem) - { - super(); - this.parentSubSystem = parentSubSystem; - } - /** - * Constructor. - * @see #setSubSystem(ISubSystem) - */ - public AbstractResource() - { - super(); - } - - /** - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) - */ - public Object getAdapter(Class adapter) - { - return Platform.getAdapterManager().getAdapter(this, adapter); - } - - /** - * Returns the parent SubSystem which produced this remote resource. - * @return SubSystem - */ - public ISubSystem getSubSystem() - { - return parentSubSystem; - } - - /** - * Resets the parent SubSystem. - * @param parentSubSystem The parentSubSystem to set - */ - public void setSubSystem(ISubSystem parentSubSystem) - { - this.parentSubSystem = parentSubSystem; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java deleted file mode 100644 index 7f3a2e5cd..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java +++ /dev/null @@ -1,306 +0,0 @@ -/******************************************************************************** - * Copyright (c) 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 - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation from AbstractConnectorService. - * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - ********************************************************************************/ -package org.eclipse.rse.core.subsystems; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.IRSEUserIdConstants; -import org.eclipse.rse.core.PasswordPersistenceManager; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.SystemSignonInformation; - -/** - * An authenticating connector service understands the concept of credentials - * (see {@link ICredentials}) - * and possibly the concepts of user id and password. It contains a - * credentials provider ({@link ICredentialsProvider}) and provides a - * framework under which authentication can take place during connections. - */ -public abstract class AuthenticatingConnectorService extends AbstractConnectorService { - - protected ICredentialsProvider credentialsProvider = null; - - /** - * Constructs an authenticating connector service. - * @param name The name of the connector service - * @param description The description of the connector service - * @param host The host associated with this connector service - * @param port The port this connector service will use when connecting if it uses IP. - */ - public AuthenticatingConnectorService(String name, String description, IHost host, int port) { - super(name, description, host, port); - } - - /** - * Obtains the user id, if it understand the concept of user id, from - * its credentials provider. - * @see org.eclipse.rse.core.subsystems.IConnectorService#getUserId() - * @return the user id or null if not available or not supported. - */ - public final String getUserId() { - return credentialsProvider.getUserId(); - } - - /** - * Sets the default user id for use by the credentials provider. - * @see org.eclipse.rse.core.subsystems.IConnectorService#setUserId(java.lang.String) - * @param newId the id to be used by the credentials provider. - */ - public final void setUserId(String newId) { - String oldUserId = credentialsProvider.getUserId(); - if (oldUserId == null || !oldUserId.equals(newId)) { - credentialsProvider.setUserId(newId); - saveUserId(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#saveUserId() - */ - public final void saveUserId() { - String userId = credentialsProvider.getUserId(); - updateDefaultUserId(getPrimarySubSystem(), userId); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#removeUserId() - */ - public final void removeUserId() { - updateDefaultUserId(getPrimarySubSystem(), null); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#clearPassword(boolean, boolean) - */ - public final void clearPassword(boolean persist, boolean propagate) { - credentialsProvider.clearPassword(); - if (persist) { - removePassword(); - } - if (sharesCredentials() && propagate) { - String userId = credentialsProvider.getUserId(); - clearPasswordForOtherSystemsInConnection(userId, false); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#hasPassword(boolean) - */ - public final boolean hasPassword(boolean onDisk) { - ICredentials credentials = credentialsProvider.getCredentials(); - boolean cached = (credentials != null && credentials.getPassword() != null); - if (!cached && onDisk) { - IRSESystemType systemType = getHost().getSystemType(); - String hostName = getHostName(); - String userId = getUserId(); - if (userId != null) { - return PasswordPersistenceManager.getInstance().passwordExists(systemType, hostName, getUserId()); - } - } - return cached; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setPassword(java.lang.String, java.lang.String, boolean, boolean) - */ - public final void setPassword(String userId, String password, boolean persist, boolean propagate) { - if (getPrimarySubSystem().forceUserIdToUpperCase()) { - userId = userId.toUpperCase(); - } - String myUserId = credentialsProvider.getUserId(); - IHost host = getHost(); - if (host.compareUserIds(userId, myUserId)) { - credentialsProvider.setPassword(password); - } - if (sharesCredentials() && propagate) { - updatePasswordForOtherSystemsInConnection(userId, password, persist); - } - if (persist) { - savePassword(); - } else { - removePassword(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#savePassword() - */ - public final void savePassword() { - ICredentials credentials = credentialsProvider.getCredentials(); - if (credentials instanceof SystemSignonInformation) { - SystemSignonInformation signonInformation = (SystemSignonInformation) credentials; - PasswordPersistenceManager.getInstance().add(signonInformation, true, true); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#removePassword() - */ - public final void removePassword() { - IRSESystemType systemType = getHost().getSystemType(); - String hostName = getHostName(); - String userId = credentialsProvider.getUserId(); - PasswordPersistenceManager.getInstance().remove(systemType, hostName, userId); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#postDisconnect() - */ - protected final void postDisconnect() { - clearPassword(false, true); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#isSuppressed() - */ - public final boolean isSuppressed() { - return credentialsProvider.isSuppressed(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#setSuppressed(boolean) - */ - public final void setSuppressed(boolean suppressed) { - credentialsProvider.setSuppressed(suppressed); - } - - /** - * Acquires the credentials by delegating the request to the - * credentials provider. - * @param reacquire if true will cause the credentials to be reobtained if necessary. - * @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean) - */ - public final void acquireCredentials(boolean reacquire) throws InterruptedException { - credentialsProvider.acquireCredentials(reacquire); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#clearCredentials() - */ - public final void clearCredentials() { - credentialsProvider.clearCredentials(); - setDirty(true); - } - - private void updatePasswordForOtherSystemsInConnection(String uid, String password, boolean persist) { - IHost connection = getPrimarySubSystem().getHost(); - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISubSystem[] subsystems = registry.getSubSystems(connection); - List uniqueSystems = new ArrayList(); - for (int i = 0; i < subsystems.length; i++) { - IConnectorService cs = subsystems[i].getConnectorService(); - if (cs != this && cs.inheritsCredentials()) { - if (!uniqueSystems.contains(cs)) { - uniqueSystems.add(cs); - } - } - } - for (int s = 0; s < uniqueSystems.size(); s++) { - IConnectorService system = (IConnectorService) uniqueSystems.get(s); - if (!system.isConnected() && !system.hasPassword(false)) { - if (system.getPrimarySubSystem().forceUserIdToUpperCase()) { - uid = uid.toUpperCase(); - password = password.toUpperCase(); - } - system.setPassword(uid, password, false, false); - } - } - } - - private void clearPasswordForOtherSystemsInConnection(String uid, boolean persist) { - if (uid != null) { - IHost connection = getHost(); - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISubSystem[] subsystems = registry.getSubSystems(connection); - List uniqueSystems = new ArrayList(); - for (int i = 0; i < subsystems.length; i++) { - IConnectorService system = subsystems[i].getConnectorService(); - if (system != this && system.inheritsCredentials()) { - if (!uniqueSystems.contains(system)) { - uniqueSystems.add(system); - } - } - } - for (int s = 0; s < uniqueSystems.size(); s++) { - IConnectorService system = (IConnectorService) uniqueSystems.get(s); - if (system.hasPassword(persist)) { - system.clearPassword(persist, false); - } - } - } - } - - /** - * Change the default user Id value in the SubSystem if it is non-null, else - * update it in the Connection object - */ - private void updateDefaultUserId(ISubSystem subsystem, String userId) { - String ssLocalUserId = subsystem.getLocalUserId(); - if (ssLocalUserId != null) { - ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration(); - ssc.updateSubSystem(subsystem, true, userId, false, 0); - } else { - int whereToUpdate = IRSEUserIdConstants.USERID_LOCATION_HOST; - IHost host = subsystem.getHost(); - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - sr.updateHost(host, host.getSystemType(), host.getAliasName(), host.getHostName(), host.getDescription(), userId, whereToUpdate); - } - } - - /** - * Returns true if this connector service can share it's credentials - * with other connector services in this host. - * This implementation will always return true. - * Override if necessary. - * @return true - * @see IConnectorService#sharesCredentials() - */ - public boolean sharesCredentials() { - return true; - } - - /** - * Returns true if this connector service can inherit the credentials of - * other connector services in this host. - * This implementation always returns true. - * Override if necessary. - * @return true - * @see IConnectorService#inheritsCredentials() - */ - public boolean inheritsCredentials() { - return true; - } - - /** - * Sets the credentials provider used by this connector service. - * This should be invoked once immediately during the construction of the - * connector service. - * @param credentialsProvider the credentials provider to be used - * by this connector service. - */ - protected final void setCredentialsProvider(ICredentialsProvider credentialsProvider) { - this.credentialsProvider = credentialsProvider; - } - - /** - * @return the credentials provider that is being used by this connector service. - */ - protected final ICredentialsProvider getCredentialsProvider() { - return credentialsProvider; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/BasicConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/BasicConnectorService.java deleted file mode 100644 index 765977de6..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/BasicConnectorService.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. 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 Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - ********************************************************************************/ -package org.eclipse.rse.core.subsystems; - -import org.eclipse.rse.core.model.IHost; - -/** - * A basic connector service is one that does not require any type of - * authentication to connect to its target system. - * Since this is the case, many of the methods of - * {@link IConnectorService} are implemented only in skeletal form. - */ -public abstract class BasicConnectorService extends AbstractConnectorService { - - /** - * Constructs a basic connector service. - * @param name The name of the connector service - * @param description The description of the connector service - * @param host the host associated with this connector service - * @param port the port used by this connector service, if IP based - */ - public BasicConnectorService(String name, String description, IHost host, int port) { - super(name, description, host, port); - } - - /** - * Indicates if this connector service understands passwords. - * This implementation always returns false. - * Override if necessary. - * @return false - * @see org.eclipse.rse.core.subsystems.IConnectorService#supportsPassword() - */ - public boolean supportsPassword() { - return false; - } - - /** - * Indicates if this connector service requires passwords. - * This implementation always returns false. - * Override if necessary. - * @return false - * @see org.eclipse.rse.core.subsystems.IConnectorService#requiresPassword() - */ - public boolean requiresPassword() { - return false; - } - - /** - * Indicates if this connector service understands user ids. - * This implementation always returns false. - * Override if necessary. - * @return false - * @see org.eclipse.rse.core.subsystems.IConnectorService#supportsUserId() - */ - public boolean supportsUserId() { - return false; - } - - /** - * Indicates if this connector service requires a user id. - * This implementation always returns false. - * Override if necessary. - * @return false - * @see org.eclipse.rse.core.subsystems.IConnectorService#requiresUserId() - */ - public boolean requiresUserId() { - return false; - } - - /** - * Acquires credentials. - * This implmentation does nothing. - * @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean) - */ - public void acquireCredentials(boolean refresh) throws InterruptedException { - } - - /** - * Clears credentials. - * This implementation does nothing. - * @see org.eclipse.rse.core.subsystems.IConnectorService#clearCredentials() - */ - public void clearCredentials() { - } - - /** - * Clears a password. - * This implementation does nothing. - * @see org.eclipse.rse.core.subsystems.IConnectorService#clearPassword(boolean, boolean) - */ - public void clearPassword(boolean persist, boolean propagate) { - } - - /** - * Gets the user id. - * This implementation returns null. - * @return null - * @see org.eclipse.rse.core.subsystems.IConnectorService#getUserId() - */ - public String getUserId() { - return null; - } - - /** - * Indicates the presence of a password. - * This implementation returns false. - * @param onDisk true if checking for a persistent form of a password - * @return false - * @see org.eclipse.rse.core.subsystems.IConnectorService#hasPassword(boolean) - */ - public boolean hasPassword(boolean onDisk) { - return false; - } - - /** - * Indicates if this connector service can inherit its credentials from others. - * This implementation returns false. - * @return false - * @see org.eclipse.rse.core.subsystems.IConnectorService#inheritsCredentials() - */ - public boolean inheritsCredentials() { - return false; - } - - /** - * Indicates if this connector service is currently being suppressed. - * This implementation returns false. - * @return false - * @see org.eclipse.rse.core.subsystems.IConnectorService#isSuppressed() - */ - public boolean isSuppressed() { - return false; - } - - /** - * Removes the persistent form of a password. - * This implementation does nothing. - * @see org.eclipse.rse.core.subsystems.IConnectorService#removePassword() - */ - public void removePassword() { - } - - /** - * Removes the persistent form of the default user id. - * This implementation does nothing. - * @see org.eclipse.rse.core.subsystems.IConnectorService#removeUserId() - */ - public void removeUserId() { - } - - /** - * Saves the remembered password persistently. - * This implementation does nothing. - * @see org.eclipse.rse.core.subsystems.IConnectorService#savePassword() - */ - public void savePassword() { - } - - /** - * Saves the remembered user id persistently. - * This implementation does nothing. - * @see org.eclipse.rse.core.subsystems.IConnectorService#saveUserId() - */ - public void saveUserId() { - } - - /** - * Sets the password for a particular user id and optionally persists it. - * This implemenation does nothing. - * @param matchingUserId the user id to set the password for - * @param password the password to set. - * @param persist true if this is to be persisted. - * @param propagate true if this password should be propagated to other - * connector services. - * @see org.eclipse.rse.core.subsystems.IConnectorService#setPassword(java.lang.String, java.lang.String, boolean, boolean) - */ - public void setPassword(String matchingUserId, String password, boolean persist, boolean propagate) { - } - - /** - * Indicates if credentials are shared with other connector services. - * This implementation returns false. - * @see org.eclipse.rse.core.subsystems.IConnectorService#sharesCredentials() - */ - public boolean sharesCredentials() { - return false; - } - - /** - * Sets the suppressed state of this connector service. - * This implementation does nothing. - * @param suppress true if this connector service should be suppressed. - * @see org.eclipse.rse.core.subsystems.IConnectorService#setSuppressed(boolean) - */ - public void setSuppressed(boolean suppress) { - } - - /** - * Sets the user id for this connector service. - * This implementation does nothing. - * @param userId the user id to set for this service. - * @see org.eclipse.rse.core.subsystems.IConnectorService#setUserId(java.lang.String) - */ - public void setUserId(String userId) { - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/CommunicationsEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/CommunicationsEvent.java deleted file mode 100644 index 3bcb61227..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/CommunicationsEvent.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.subsystems; - -public class CommunicationsEvent { - - // Communications event types - public static final int BEFORE_CONNECT = 1; - public static final int AFTER_CONNECT = 2; - public static final int BEFORE_DISCONNECT = 3; - public static final int AFTER_DISCONNECT = 4; - public static final int CONNECTION_ERROR = 5; - - private IConnectorService system; - private int state; - - public CommunicationsEvent(IConnectorService system, int state) { - this.system = system; - this.state = state; - } - - public int getState() { - return state; - } - - public IConnectorService getSystem() { - return system; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICacheManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICacheManager.java deleted file mode 100644 index be6ac4235..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICacheManager.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.subsystems; - -/** - * Interface for a cache manager that can optionally associated with a SubSystem. - */ -public interface ICacheManager { - - /** - * This flag is set if the Remote System Explorer is restoring a remote object - * from a memento. This gives the subsystem the option to restore from the cache - * instead of connecting to the remote system. - * - * @param restore true if the RSE is currently restoring a remote object associated - * with this cache manager from a memento, otherwise false. - */ - public void setRestoreFromMemento(boolean restore); - - /** - * Check if the Remote System Explorer is restoring a remote object - * from a memento. - * - * @return true if the RSE is currently restoring a remote object associated - * with this cache manager from a memento, otherwise false. - */ - public boolean isRestoreFromMemento(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICommunicationsListener.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICommunicationsListener.java deleted file mode 100644 index 7c1328671..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICommunicationsListener.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.subsystems; - -/** - * ICommunicationsListener - listen to communication events - * @see CommunicationsEvent - */ -public interface ICommunicationsListener { - - /** - * This method is invoked whenever the communications state is invoked - * immediately before and after the state of the communications changes. - * The state field in CommunicationsEvent determines which state - * change is about to or has occured. - */ - public void communicationsStateChange(CommunicationsEvent e); - - /** - * This method determines if the communications listener is a passive or - * active listener. Typically a passive listener registers with the communications - * system and responds to events as they occur. An active listener typically - * registeres with the communications system only for the duration of the task (i.e. - * user editing a file, or outstanding communications request.) - * - * The user will be prompted on a disconnect if there are any active communication - * listeners registered. - * - * @return false if the communications listener is an active listener, true if the - * communications listener is a passive listener. - */ - public boolean isPassiveCommunicationsListener(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorService.java deleted file mode 100644 index bb841c8e1..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorService.java +++ /dev/null @@ -1,382 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 168977: refactoring IConnectorService - * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType - * Martin Oberhuber (Wind River) - [185750] Remove IConnectorService.getHostType() - * Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect() - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; - -/** - * A connector service provides the means of establishing a connection from - * a subsystem (or a number of subsystems) to a target system (a host). - * <p> - * A connector service manages a live connection to a remote system, with - * operations for connecting and disconnecting, and storing information - * typically cached from a subsystem: credentials (such as a userId/password), - * port, etc. - * <p> - * The SubSystem interface includes a method, getConnectorService(), - * which returns an instance of an object that implements this interface - * for that subsystem. - * <p> - * A single connector service object can be unique to a subsystem instance, but - * it can also be shared across multiple subsystems in a single host if those - * subsystems share a physical connection to the remote system. - * This sharing is done using implementers of {@link IConnectorServiceManager} - * which are returned by another getter method in SubSystem. - */ -public interface IConnectorService extends IRSEModelObject { - - /** - * @return the primary subsystem object this connector service is associated - * with. This is usually the subsystem that first established this - * connector service. - */ - public ISubSystem getPrimarySubSystem(); - - /** - * Return all the subsystems that use this connector service - * @return the subsystems that use this service - */ - public ISubSystem[] getSubSystems(); - - /** - * Adds a subsystem to this connector service. Does nothing if the - * subsystem is already known to this connector service. - * @param ss a subsystem that is using this connector service. - */ - public void registerSubSystem(ISubSystem ss); - - /** - * Deregister the subsystem. Does nothing if the subsystem is not present. - * @param ss the subsystem to remove from this connector service. - */ - public void deregisterSubSystem(ISubSystem ss); - - /** - * @return true if currently connected. - */ - public boolean isConnected(); - - /** - * Connects to the remote system. - * @param monitor a monitor for tracking the progress and canceling a connect - * operation. - * @throws Exception an exception of there is a failure to connect. - * Typically, this will be a {@link SystemMessageException}. - */ - public void connect(IProgressMonitor monitor) throws Exception; - - /** - * Disconnects from the remote system. - * @param monitor a monitor for tracking the progress and canceling a disconnect - * operation. - * @throws Exception an exception of the disconnect fails. - * Typically, this will be a {@link SystemMessageException}. - */ - public void disconnect(IProgressMonitor monitor) throws Exception; - - /** - * Reset after some fundamental change, such as a hostname change. - * Clear any memory of the current connection. - */ - public void reset(); - - /** - * @return the version, release, modification of the remote system, - * if connected, if applicable, and if available. Return null if - * this information is not available. - */ - public String getVersionReleaseModification(); - - /** - * @return the home directory of the remote system for the current user, - * if available. - */ - public String getHomeDirectory(); - - /** - * @return the temporary directory of the remote system for the current user, - * if available. - */ - public String getTempDirectory(); - - /** - * Sets the host used by this connector service. - * @param host - */ - public void setHost(IHost host); - - /** - * @return the host used by this connector service. - */ - public IHost getHost(); - - /** - * @return the host name for the connection associated with this - * connector service. - */ - public String getHostName(); - - /** - * @return the port for this connector service. Usually only used for - * IP based connections. - */ - public int getPort(); - - /** - * Set the port for this connector. Usually only used by IP based - * connections. - * @param port the IP port used by this connector service. - */ - public void setPort(int port); - - /** - * @return true if this connector service will attempt to - * use SSL when establishing its connection. - */ - public boolean isUsingSSL(); - - /** - * @param flag true if the connector service should attempt to use SSL when - * establishing the connection. - */ - public void setIsUsingSSL(boolean flag); - - /** - * Reports if this connector service can use a user identifier. - * Typically used to indicate if a login dialog needs to be presented when connecting. - * @return true if and only if the connector service can use a user id. - */ - public boolean supportsUserId(); - - /** - * Determines if this connector service understand the concept of a password. - * @return true if the connector service can use a password, - * false if a password is irrelevant. - */ - public boolean supportsPassword(); - - /** - * @return the user id that will be used by this connector when - * establishing its connection. - */ - public String getUserId(); - - /** - * Set the user id this connector service will use when establishing its - * connection. - * @param userId the user id string for this connector service. - */ - public void setUserId(String userId); - - /** - * Causes the user id known to the connector service, if any, to be - * persisted. - */ - public void saveUserId(); - - /** - * Causes the persisted (default) user id known to this - * connector service, if any, to be forgotten. - */ - public void removeUserId(); - - /** - * Sets the password used by this connector service. - * Can be used if the connector service acquires a password by some external - * means. - * @param matchingUserId The user id to be associated with this password. - * @param password the password - * @param persist true if the password is to be persisted for later use. - * @param propagate true if this password should be propagated to related connector services. - */ - public void setPassword(String matchingUserId, String password, boolean persist, boolean propagate); - - /** - * Causes the password known to this connector service, if any, to be - * persisted. - */ - public void savePassword(); - - /** - * Causes the persisted password known to this connector service, if any, to - * be forgotten. - */ - public void removePassword(); - - /** - * Clear password held by this service and optionally - * clear its persistent form. - * Called when user uses the property dialog to - * change his userId. - * @param persist if true, clears the persistent form of the password - * @param propagate true if this password should be cleared in related connector services. - */ - public void clearPassword(boolean persist, boolean propagate); - - /** - * @param persistent also check for the persistent form of the password. - * @return true if a password is currently known to this connector service. - */ - public boolean hasPassword(boolean persistent); - - /** - * Returns true if this system can inherit the credentials of - * from the other connector services in this host. - * @return true if it can inherit the credentials, false otherwise - */ - public boolean inheritsCredentials(); - - /** - * Return true if this system can share it's credentials - * with other connector services in this host. - * @return true if it can share the credentials - */ - public boolean sharesCredentials(); - - /** - * Clears the credentials held by this service. - * Should be called if there is a change to any part of the credentials - * expected by any using subsystem. - */ - public void clearCredentials(); - - /** - * Acquire the credentials for this connector service. - * Acquisition may be temporarily suppressed - * by using the {@link #setSuppressed(boolean)}. - * <p> - * Implementations may retain a remembered credentials or - * use this acquire the credentials using some implementation defined means. - * <p> - * Throws InterruptedException if acquisition of the - * credentials is canceled or is being suppressed. - * @param refresh if true will force the connector service to discard - * any remembered value and reacquire the credentials. - */ - public void acquireCredentials(boolean refresh) throws InterruptedException; - - /** - * @return true if the acquisition of credentials is being suppressed. - */ - public boolean isSuppressed(); - - /** - * Suppresses the acquisition of a credentials by the connector service. - * Causes {@link #acquireCredentials(boolean)} to immediately - * throw an InterruptedException. - * <p> - * The intent is to allow tool writers to prevent multiple - * attempts to acquire credentials during a set period of time. - * <b>It is the responsibility of the caller to set this value - * back to false when the tool no longer needs to suppress - * acquisition credentials.</b> - * - * @param suppress <code>true</code> if acquisition is to be suppressed. - * <code>false</code> if acquisition is to be allowed. - */ - public void setSuppressed(boolean suppress); - - /** - * Register a communications listener. These listeners will be informed - * of connect and disconnect events. - * @param listener a listener for the communications event. - */ - public void addCommunicationsListener(ICommunicationsListener listener); - - /** - * Remove a communications listener. - * @param listener a listener for the communications event. - */ - public void removeCommunicationsListener(ICommunicationsListener listener); - - /** - * This methods returns the enablement state of a server launch type. - * If {@link RemoteServerLauncher#enableServerLaunchType(ServerLaunchType, boolean)} has not been - * called for this server launch type, then it is enabled by default. - * @param subsystem the subystem for which this may be enabled. - * @param serverLaunchType the type to check for enabledment. - * @return true if the connector service supports server launching and - * this launch type is enabled. - * @see org.eclipse.rse.core.subsystems.ServerLaunchType - */ - public boolean isServerLaunchTypeEnabled(ISubSystem subsystem, ServerLaunchType serverLaunchType); - - /** - * Gets the properties associated with a remote server launcher. - * These may be null. - * This an optional object containing - * properties used to launch the remote server that - * communicates with this client. - * @return the properties of the server launcher - */ - IServerLauncherProperties getRemoteServerLauncherProperties(); - - /** - * Set the properties for the remote server launcher - * This is an object containing - * properties used to launch a remote server that - * communicates with this client. - * @param value the new value of the '<em>Remote Server Launcher</em>' containment reference. - */ - void setRemoteServerLauncherProperties(IServerLauncherProperties value); - - /** - * @return true if the connector service has server launcher properties. - */ - boolean hasRemoteServerLauncherProperties(); - - /** - * @return true if the connector service supports the concept of remote - * server launch properties. - * This will always return false {@link #supportsRemoteServerLaunching()} - * is false. - */ - boolean supportsServerLaunchProperties(); - - /** - * @return true if the connector service supports the concept of remote - * server launching. - */ - boolean supportsRemoteServerLaunching(); - - /** - * @return the server launcher. Will be null unless - * {@link #supportsRemoteServerLaunching()} is true. - */ - IServerLauncher getRemoteServerLauncher(); - - /** - * Test if this connector service requires a password. - * @return true if this connector service supports passwords and - * requires a password to connect to its target system. - */ - boolean requiresPassword(); - - /** - * Test if this connector service requires a user id. - * @return true if this connector service understands the concept of a - * user id and requires one to connect to its target system. - */ - boolean requiresUserId(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorServiceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorServiceManager.java deleted file mode 100644 index fdb554724..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorServiceManager.java +++ /dev/null @@ -1,26 +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.core.subsystems; - -import org.eclipse.rse.core.model.IHost; - -public interface IConnectorServiceManager { - IConnectorService getConnectorService(IHost host, Class commonSSinterface); - - void setConnectorService(IHost host, Class commonSSinterface, IConnectorService connectorService); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICredentials.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICredentials.java deleted file mode 100644 index 7c5d58918..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICredentials.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 IBM Corporation. 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: - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - ********************************************************************************/ -package org.eclipse.rse.core.subsystems; - -public interface ICredentials { - - String getPassword(); - - String getUserId(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICredentialsProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICredentialsProvider.java deleted file mode 100644 index c0d541294..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ICredentialsProvider.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 IBM Corporation. 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: - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - ********************************************************************************/ -package org.eclipse.rse.core.subsystems; - -import org.eclipse.rse.services.clientserver.messages.SystemMessage; - -/** - * A credentials provider provides credentials to a connector service. - * Every authenticating connector service has its own credentials provider, - * usually created when that connector service is created. - * <p> - * Credentials will usually consist of a user id and password - * but may be something else in which case implementers are free - * change the user id and password methods to something that makes - * sense for their case. - * <p> - * A provider may be in a suppressed state, in which case it will - * prohibit the acquisition of credentials. - * @see ICredentials - * @see IConnectorService - * @see AuthenticatingConnectorService - */ -public interface ICredentialsProvider { - - /** - * Causes the provider to create a set of credentials for use by a - * connector service in order to connect to a target host system. - * This may be done by presenting a dialog or by retrieving remembered - * values. - * @param reacquire true if the provider should refresh any remembered - * credentials. Typically used to force the showing of a dialog containing - * remembered credentials. - * @throws InterruptedException if the acquisition of credentials is - * canceled by the user, if the provider is in suppressed state, - * a resource (such as the workbench) not being available, - * or interrupted by some other means. - */ - void acquireCredentials(boolean reacquire) throws InterruptedException; - - /** - * The connector service using this provider may find the credentials provided - * are incorrector or expired. This method asks the provider to repair those - * credentials. This would typically be used to present a dialog asking for the reentry of - * an expired password. - * @param message the message indicating the nature of the damage that must - * be repaired. For example, indicating expiration of a password. - * @throws InterruptedException if the repair is canceled for some reason. This could - * include the inability of a credentials provider to open a dialog or a dialog being - * canceled. - */ - void repairCredentials(SystemMessage message)throws InterruptedException; - - /** - * Clears the credentials known by this credentials provider. This will - * cause a reacquistion of all compoenents of the credentials at the next - * acquire. If credentials consist of a user id and password then both of those - * are cleared. - * Does not clear any persistently remembered values. - */ - void clearCredentials(); - - /** - * Retrieves the credentials known to this credentials provider. Does not - * cause the credentials to be acquired. May be used after {@link #acquireCredentials(boolean)} - * to retrieve credentials. - * @return the credentials that have previously been acquired or repaired. - * May be null if no credentials have yet been acquired. - */ - ICredentials getCredentials(); - - /** - * If the credentials include a password or equivalent then clears only that - * that portion of the credentials. If the credentials do not include a password - * then the implementation may somehow invalidate the credentials so that - * they will be reacquired at the next acquisition. - */ - void clearPassword(); - - /** - * If the credentials include a password or equivalent then set that password - * to the new value. - * If the credentials do not include a password then - * the implementation may ignore this. - * @param password the new value of the password in the credentials held by this provider - */ - void setPassword(String password); - - /** - * If the credentials include a user id then set that user id to the new value. - * If the credentials do not include a user id then this is implementation - * defined. - * @param userId the user id to place into the credentials held by this provider - */ - void setUserId(String userId); - - /** - * If the credentials include a user id then retrieve that user id. - * If the credentials do not currently contain a user id then a default user id - * related to the connector service may be obtained. - * If the credentials do not support a user id then this should return null. - * @return the userid of the credentials held by this provider - */ - String getUserId(); - - /** - * Retrieves the suppression state of the provider. - * Acquisition may be suppressed for a period of time after a previous attempt. - * This is to provide client control of the acquisition policy. - * If true then {@link #acquireCredentials(boolean)} will immediately cancel when invoked. - * @return true if the provider is suppressed. - */ - boolean isSuppressed(); - - /** - * Sets the suppressed state of the provider. - * Acquisition may be suppressed for a period of time after a previous attempt. - * This is to provide client control of the acquisition policy. - * If true then {@link #acquireCredentials(boolean)} will immediately cancel when invoked. - * @param suppressed true if the provider is to be suppressed. - */ - void setSuppressed(boolean suppressed); - - /** - * Retrieves the connector service associated with this provider. Each provider - * has its own connector service. All authenticating connector services have their - * own provider. - * @return the connector service associated with this provider - */ - IConnectorService getConnectorService(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IDelegatingConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IDelegatingConnectorService.java deleted file mode 100644 index 1b2b89e78..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IDelegatingConnectorService.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 IBM Corporation. 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. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ -package org.eclipse.rse.core.subsystems; - -/** - * A delegating connector service forwards all requests for infomation - * to another connector service. - */ -public interface IDelegatingConnectorService extends IConnectorService -{ - /** - * @return the connector service that this connector service will - * forward requests to. - */ - public IConnectorService getRealConnectorService(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IFileConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IFileConstants.java deleted file mode 100644 index 8a651ef81..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IFileConstants.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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.core.subsystems; - -/** - * Constants used in the remote file system support - */ -public interface IFileConstants { - - // --------------------------------------- - // UNIX FILE SYSTEM ATTRIBUTE CONSTANTS... - // --------------------------------------- - /** - * Unix-style folder-name separator as a string: "/" - */ - public static String SEPARATOR_UNIX = "/"; //$NON-NLS-1$ - /** - * Unix-style folder-name separator as a char: '/' - */ - public static char SEPARATOR_CHAR_UNIX = '/'; - /** - * Unix-style path separator as a string: ":" - */ - public static String PATH_SEPARATOR_UNIX = ":"; //$NON-NLS-1$ - /** - * Unix-style path separator as a char: ':' - */ - public static char PATH_SEPARATOR_CHAR_UNIX = ':'; - /** - * Unix-style line separator as a byte array: 10 - */ - public static final byte[] LINE_SEPARATOR_BYTE_ARRAY_UNIX = { 10 }; - - // ------------------------------------------ - // WINDOWS FILE SYSTEM ATTRIBUTE CONSTANTS... - // ------------------------------------------ - /** - * Windows-style folder-name separator as a string: "\" - */ - public static String SEPARATOR_WINDOWS = "\\"; //$NON-NLS-1$ - /** - * Windows-style folder-name separator as a char: '\' - */ - public static char SEPARATOR_CHAR_WINDOWS = '\\'; - /** - * Windows-style path separator as a string: ";" - */ - public static String PATH_SEPARATOR_WINDOWS = ";"; //$NON-NLS-1$ - /** - * Windows-style path separator as a char: ';' - */ - public static char PATH_SEPARATOR_CHAR_WINDOWS = ';'; - /** - * Windows-style line separator as a byte array: 13 and 10 respectively - */ - public static final byte[] LINE_SEPARATOR_BYTE_ARRAY_WINDOWS = { 13, 10 }; -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteContainer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteContainer.java deleted file mode 100644 index 4dfd357be..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteContainer.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core.subsystems; - -import org.eclipse.rse.core.model.ISystemContainer; -import org.eclipse.rse.core.model.ISystemContentsType; - -/** - * @author dmcknigh - */ -public interface IRemoteContainer extends ISystemContainer { - - /** - * Returns whether the object has contents of a particular type associated with the specified filter string. - * @param contentsType type of contents - * @param filter criteria for contained contents - * @return <code>true</code> if the object has contents, <code>false</code> otherwise. - */ - public boolean hasContents(ISystemContentsType contentsType, String filter); - - /** - * Returns the contents of the object. - * @param contentsType type of contents - * @param filter criteria for contained contents. - * @return an array of contents. - */ - public Object[] getContents(ISystemContentsType contentsType, String filter); - - /* - * Replace occurrences of cached object with new object - */ - public void replaceContent(Object oldObject, Object newObject); - - /** - * Sets the contents of this object that match a particular filter - * @param contentsType type of contents - * @param filter matching criteria for the contained objects - * @param con the contained objects that match the filter - */ - public void setContents(ISystemContentsType contentsType, String filter, Object[] con); - - /** - * Copies the persistable contents from this one to another one - * @param container the container to copy contents to - */ - public void copyContentsTo(IRemoteContainer container); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteLineReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteLineReference.java deleted file mode 100644 index 989b9d584..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteLineReference.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.subsystems; - -/** - * This interface represents an object that can be used to jump into line in source - */ -public interface IRemoteLineReference { - - /** - * Gets the path to the file that this output references if it references any. It may return null if - * no such association exists. This may be used to jump to an editor from a view which displays - * this - * - * @return the path of the referenced file if there is one - */ - public String getAbsolutePath(); - - /** - * Gets the line number within a file that this references if it references any. By default - * it should return 0. If no file association exists, it also returns 0. This may be used to jump into - * a location within an editor from a view which displays remote output. - * - * @return the line number within a referenced file if there is one. - */ - public int getLine(); - - /** - * Get the start offset in a line corresponding to this reference. -1 indicates there is no offset - * @return the offset - */ - public int getCharStart(); - - /** - * Get the end offset in a line corresponding to this reference. -1 indicates there is no offset - * @return the offset - */ - public int getCharEnd(); - - /** - * Get the object that contains this object. - * - * @return the parent object - */ - public Object getParent(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteObjectIdentifier.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteObjectIdentifier.java deleted file mode 100644 index 22f1e5030..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteObjectIdentifier.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [182454] improve getAbsoluteName() documentation - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import org.eclipse.rse.services.search.IHostSearchResult; - -/** - * Interface that remote objects must implement in order to be - * identifiable for drag and drop, clipboard support, and finding - * multiple occurrences of the same remote object in different - * contexts in the SystemView. - * <p> - * This is the functional opposite of {@link IRemoteObjectResolver}. - * </p> - * - * @see IRemoteObjectIdentifier - */ -public interface IRemoteObjectIdentifier { - - /** - * Return a String ID for the given remote object, that is unique - * within the subsystem. - * <p> - * This must be implemented by subsystem element adapters in order to - * marshal a reference to the remote object for drag and drop, and - * clipboard support. It is also used for uniquely identifying - * objects with changing properties in the SystemView. This method - * is the functional opposite of - * {@link IRemoteObjectResolver#getObjectWithAbsoluteName(String)}. - * </p><p> - * The unique ID for an object must remain the same over the entire - * lifetime of that object, such that it can always be identified. - * When an object is renamed, it should be removed from the views - * with the old ID and then re-added with the new ID. This is - * especially important for the SystemView, where the String ID - * is used for finding multiple occurrences of the same remote - * resource in different contexts during refresh events. In this - * case, the String ID can be used to find the remote object even - * if its hashCode changes due to updated properties. - * So even if a subsystem does not support drag and drop, or - * clipboard operations, it does need to return unique IDs for - * its object to support refresh in the SystemView. - * </p><p> - * Because each subsystem maintains its own objects, it is the - * responsibility of the subsystem and its adapters to come up - * with a mapping that is unique for the subsystem. Some subsystems - * use fully qualified path names, while others may use other methods. - * Extenders just need to ensure that objects of different type (such - * as filters, actual resources or error messages) all have different - * IDs within the subsystem, and the corresponding - * {@link IRemoteObjectResolver#getObjectWithAbsoluteName(String)} - * method actually finds the object by the given ID. Other subsystems - * do not need to be considered. - * </p> - * <p><strong>Uniqueness and Multiple Contexts</strong><br/> - * The RSE SystemView allows the same remote object to be displayed - * in multiple different contexts, i.e. under multiple different - * filters. In this case, each occurrence of the same object must - * return the same absolute name. For the reverse mapping, however, - * it is up to the subsystem whether its {@link IRemoteObjectResolver} - * returns only one internal model object for the given identifier, - * or multiple context objects which all refer to the same remote - * object but also hold context information. - * </p> - * <p><strong>Examples</strong><br/> - * In the File Subsystem, a fully qualified pathname is used to - * uniquely identify remote objects. For other kinds of objects - * maintained by the same subsystem, the following schemes are used: - * <ul> - * <li>The subsystem itself is identified as<br/> - * subsystemID ::= (profileName).(connectionName).(subsystemName)<br/> - * - see SystemViewSubSystemAdapter</li> - * <li>Filter Pool References are identified as<br/> - * filterPoolID ::= (subsystemID).(poolManagerName).(poolReferenceName)<br/> - * - see SystemViewFilterPoolReferenceAdapter</li> - * <li>Filter References are identified as <br/> - * filterRefID ::= (filterPoolID).(filterName)<br/> - * - see SystemViewFilterReferenceAdapter</li> - * <li>Search Results are identified by the - * {@link IHostSearchResult#SEARCH_RESULT_DELIMITER} - * embedded in the ID.</li> - * </ul> - * All these IDs for internal elements like the subsystem itself - * or the filters start with a profile name which must not contain - * any of the / \ or : characters. Fully qualified path names, on - * the other hand, always start with a / or \ character (UNIX style - * paths, Windows UNC paths) or have a : character on the second - * position (Windows drive letters). The SEARCH_RESULT_DELIMITER - * is ":SEARCH" which cannot be part of a valid filename. - * Therefore, this naming scheme is guaranteed to be unique. - * </p> - * @see IRemoteObjectResolver#getObjectWithAbsoluteName(String) - * - * @param object the remote element to be identified. - * @return a String uniquely identifying the remote object within the subsystem. - * Must not return <code>null</code>. - */ - public String getAbsoluteName(Object object); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteObjectResolver.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteObjectResolver.java deleted file mode 100644 index e592d61ae..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteObjectResolver.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [182454] improve getAbsoluteName() documentation - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; - -/** - * Interface for resolving an object in a subsystem from a unique ID. - * This is the functional opposite of {@link IRemoteObjectIdentifier}. - * - * @see IRemoteObjectIdentifier - */ -public interface IRemoteObjectResolver { - - /** - * Return the remote object that corresponds to the specified unique ID. - * <p> - * This must be implemented by subsystems in order to find remote objects - * for drag and drop, clipboard, and other object retrieval mechanisms - * in support of remote objects. It is the functional opposite of - * {@link IRemoteObjectIdentifier#getAbsoluteName(Object)}. - * </p><p> - * Because each subsystem maintains it's own objects, it is the - * responsibility of the subsystem to determine how an ID (or key) - * for a given object maps to the real object. Subsystems also need - * to ensure that objects of different type (such as filters, actual - * resources or error messages) all have different IDs. See - * {@link IRemoteObjectIdentifier#getAbsoluteName(Object)} for an - * example. - * </p><p> - * In case a cached copy of remote object is available locally, - * this method will <strong>not</strong> contact the remote side - * in order to check whether the cached copy is up-to-date. - * Clients are responsible themselves for refreshing the remote - * object when they think it is necessary. - * </p><p> - * In case a cached local copy is not available, the remote system - * may be contacted to retrieve the remote object. In this case, - * this call may be a long-running operation and may throw an - * exception. Note, however, that since keys used as IDs are - * generated by a remote object adapter that implements - * {@link IRemoteObjectIdentifier}, a cached copy of the remote - * object will typically be in memory from generating the key. - * A notable exception to this case is when the system view is - * restored to its previous state during startup. - * </p> - * <p><strong>Uniqueness and Multiple Contexts</strong><br/> - * The RSE SystemView allows the same remote object to be displayed - * in multiple different contexts, i.e. under multiple different - * filters. In this case, each occurrence of the same object must - * return the same absolute name. For the reverse mapping, however, - * this method may return only one context object even though - * multiple different ones are shown in the SystemView. - * </p> - * @see IRemoteObjectIdentifier#getAbsoluteName(Object) - * - * @param key the unique id of the remote object. - * Must not be <code>null</code>. - * @return the remote object instance, or <code>null</code> if no - * object is found with the given id. - * @throws Exception in case an error occurs contacting the remote - * system while retrieving the requested remote object. - * Extenders are encouraged to throw {@link SystemMessageException} - * in order to support good user feedback in case of errors. - * Since exceptions should only occur while retrieving new - * remote objects during startup, clients are typically allowed - * to ignore these exceptions and treat them as if the remote - * object were simply not there. - */ - public Object getObjectWithAbsoluteName(String key) throws Exception; -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemotePropertyHolder.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemotePropertyHolder.java deleted file mode 100644 index 3ed6ff2e1..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemotePropertyHolder.java +++ /dev/null @@ -1,71 +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.core.subsystems; - -/** - * This interface should be implemented by any remote artifact - * that contains remote properties and (optionally) caches them. - */ -public interface IRemotePropertyHolder { - - /** - * Returns the value of the property with the given key. - * @param key the property key. - * @return the value of the property. - */ - public Object getProperty(String key); - - /** - * Returns the value of the properties with the given keys. - * @param keys the property keys. - * @return the correspoding values of the properties. - */ - public Object[] getProperties(String[] keys); - - /** - * Sets the value of the property with the given key. - * @param key the property key. - * @param value the value of the property. - */ - public void setProperty(String key, Object value); - - /** - * Sets the values of the properties with the given keys. - * @param keys the property keys. - * @param values the corresponding values of the properties. - */ - public void setProperties(String[] keys, Object[] values); - - /** - * Returns whether the property with the given key is stale. - * @param key the property key. - * @return <code>true</code> if the property is stale, <code>false</code> otherwise. - */ - public boolean isPropertyStale(String key); - - /** - * Marks the property with the given key as stale. - * @param key the property key. - */ - public void markPropertyStale(String key); - - /** - * Marks all properties as stale. - */ - public void markAllPropertiesStale(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteServerLauncher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteServerLauncher.java deleted file mode 100644 index d059f755b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteServerLauncher.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core.subsystems; - -/** - * This is the implementation of {@link IServerLauncherProperties}. It basically allows for numerous types - * of server connecting, as identified in {@link org.eclipse.rse.core.subsystems.ServerLaunchType}. It - * also captures the attributes needed to support these. - * <p> - * A server launcher is responsible for starting the server-side code needed for this client subsystem to - * access remote resources on the remote system. It starts the server half of the client/server code needed - * for this subsystem. It is consulted in the default implementation of connect() in IConnectorService, and the - * manages the properties in the Remote Server Launcher property page. - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.rse.core.subsystems.IRemoteServerLauncher#getServerLaunchType <em>Server Launch Type</em>}</li> - * <li>{@link org.eclipse.rse.core.subsystems.IRemoteServerLauncher#getRexecPort <em>Rexec Port</em>}</li> - * <li>{@link org.eclipse.rse.core.subsystems.IRemoteServerLauncher#getDaemonPort <em>Daemon Port</em>}</li> - * <li>{@link org.eclipse.rse.core.subsystems.IRemoteServerLauncher#getServerPath <em>Server Path</em>}</li> - * <li>{@link org.eclipse.rse.core.subsystems.IRemoteServerLauncher#getServerScript <em>Server Script</em>}</li> - * </ul> - */ -public interface IRemoteServerLauncher extends IServerLauncherProperties { - - /** - * Returns the value of the '<em><b>Server Launch Type</b></em>' attribute. - * The literals are from the enumeration {@link org.eclipse.rse.core.subsystems.ServerLaunchType}. - * <!-- begin-user-doc --> - * <p> - * This is the means by which to start the server-side code, as specified by the user, typically. - * It is one of the constants in the enumeration class {@link org.eclipse.rse.core.subsystems.ServerLaunchType} - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Server Launch Type</em>' attribute. - * @see org.eclipse.rse.core.subsystems.ServerLaunchType - * @see #setServerLaunchType(ServerLaunchType) - * @model unsettable="true" - * @generated - */ - ServerLaunchType getServerLaunchType(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.subsystems.IRemoteServerLauncher#getServerLaunchType <em>Server Launch Type</em>}' attribute. - * <!-- begin-user-doc --> - * This is the means by which to start the server-side code, as specified by the user, typically. - * It is one of the constants in the enumeration class {@link org.eclipse.rse.core.subsystems.ServerLaunchType} - * <!-- end-user-doc --> - * @param value the new value of the '<em>Server Launch Type</em>' attribute. - * @see org.eclipse.rse.core.subsystems.ServerLaunchType - * @see #getServerLaunchType() - * @generated - */ - void setServerLaunchType(ServerLaunchType value); - - /** - * Returns the value of the '<em><b>Rexec Port</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Rexec Port</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Rexec Port</em>' attribute. - * @see #setRexecPort(int) - * @model - * @generated - */ - int getRexecPort(); - - /** - * Set the REXEC port value, as an int - */ - public void setRexecPort(int newRexecPort); - - /** - * Sets whether or not to auto-detect SSL - */ - public void setAutoDetectSSL(boolean auto); - - boolean getAutoDetectSSL(); - - int getDaemonPort(); - - /** - * Set the DAEMON port value, as an int - */ - public void setDaemonPort(int newDaemonPort); - - /** - * Returns the value of the '<em><b>Server Path</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * The path where the server lives on the remote system. Used by at least the REXEC server launch type. - * Will be null if not set. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Server Path</em>' attribute. - * @see #setServerPath(String) - */ - String getServerPath(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.subsystems.IRemoteServerLauncher#getServerPath <em>Server Path</em>}' attribute. - * <!-- begin-user-doc --> - * Set the path where the server lives on the remote system. Used by at least the REXEC server launch type. - * <!-- end-user-doc --> - * @param value the new value of the '<em>Server Path</em>' attribute. - * @see #getServerPath() - * @generated - */ - void setServerPath(String value); - - /** - * Returns the value of the '<em><b>Server Script</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * The script to run on the remote system, to start the server code. - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Server Script</em>' attribute. - * @see #setServerScript(String) - */ - String getServerScript(); - - /** - * Sets the value of the '{@link org.eclipse.rse.core.subsystems.IRemoteServerLauncher#getServerScript <em>Server Script</em>}' attribute. - * <!-- begin-user-doc --> - * The script to run on the remote system, to start the server code. - * <!-- end-user-doc --> - * @param value the new value of the '<em>Server Script</em>' attribute. - * @see #getServerScript() - * @generated - */ - void setServerScript(String value); - - /** - * Call this method to identify specific server launch types that are not to be permitted. - * This will disable these types in the property page, effectively preventing the user from - * specifying it. Note this is a transient property, so you should call it each time as part - * of restoring your subsystem. - * <p> - * You normally do not call this! Rather, your subsystem factory class will override - * {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}. - * However, this method is needed by ISVs that re-use predefined subsystem factories, - * and merely supply their own IConnectorService object via the "systemClass" attribute of the - * subsystemConfigurations extension point. They don't call this method directly actually, but - * rather {@link AbstractConnectorService#enableServerLaunchType(SubSystem, ServerLaunchType, boolean)}, - * which in turn calls this. - * - * @see org.eclipse.rse.core.subsystems.ServerLaunchType - */ - // public void enableServerLaunchType(ServerLaunchType serverLaunchType, boolean enable); - /** - * This methods returns the enablement state per server launch type. - * If {@link #setServerLaunchType(ServerLaunchType)} has not been - * called for this server launch type, then we defer to the subsystem factory's - * method: - * {@link org.eclipse.rse.core.subsystems.ISubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}. - * @see org.eclipse.rse.core.subsystems.ServerLaunchType - */ - public boolean isEnabledServerLaunchType(ServerLaunchType serverLaunchType); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteSystemEnvVar.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteSystemEnvVar.java deleted file mode 100644 index 7dee38bcd..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IRemoteSystemEnvVar.java +++ /dev/null @@ -1,76 +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.core.subsystems; - -// - -/** - * @lastgen interface RemoteSystemEnvVar {} - */ - -public interface IRemoteSystemEnvVar { - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "(c) Copyright IBM Corporation 2002, 2004."; //$NON-NLS-1$ - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Name attribute - * The name of the environment variable to set at connect time - */ - String getName(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Name attribute - */ - void setName(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Value attribute - * The value to set this environment variable to at connect time - */ - String getValue(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Value attribute - */ - void setValue(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the AdditionalAttributes attribute - * Additional attributes that may need to be persisted per environment variable. - * @deprecated - */ - String getAdditionalAttributes(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the AdditionalAttributes attribute - * @deprecated - */ - void setAdditionalAttributes(String value); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServerLauncher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServerLauncher.java deleted file mode 100644 index f1ebc60ed..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServerLauncher.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [186128] Move IProgressMonitor last in all API - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.model.SystemSignonInformation; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; - -/** - * This interface captures the abstract lifecyle for launching the remote server, - * and subsequently connecting to it. - * @see org.eclipse.rse.core.subsystems.IServerLauncherProperties - */ -public interface IServerLauncher { - - /** - * Set the remote system signon information - */ - public void setSignonInformation(SystemSignonInformation info); - - /** - * Get the remote system signon information, as set in - * {@link #setSignonInformation(SystemSignonInformation)} - */ - public SystemSignonInformation getSignonInformation(); - - /** - * Set the object which contains the user-specified properties that - * are used by this launcher - */ - public void setServerLauncherProperties(IServerLauncherProperties propertyInfo); - - /** - * Get the object which contians the user-specified properties that are - * used by this launcher. As set in {@link #setServerLauncherProperties(IServerLauncherProperties)}. - */ - public IServerLauncherProperties getServerLauncherProperties(); - - /** - * Determine if the remote server needs to be launched or not. - * Generally is always false. - * @return true if the remote server is already launched, false if it needs to be. - */ - public boolean isLaunched(); - - /** - * Launch the remote server. Some subclasses may not need this step, - * if the server is already running. - * @see #getErrorMessage() - * @param monitor - a monitor for showing progress - * @return an object. Up to each implementor how to interpret. - */ - public Object launch(IProgressMonitor monitor) throws Exception; - - /** - * Determine if we are connected to the remote server or not. - * @return true if we are connected, false otherwise. - */ - public boolean isConnected(); - - /** - * Connect to the remote server. - * @param connectPort the port to use for launching the server - * @param monitor a monitor for showing progress - * @see #getErrorMessage() - * @return Anything you want. - */ - public Object connect(int connectPort, IProgressMonitor monitor) throws Exception; - - /** - * Disconnect from the remote server - * @see #getErrorMessage() - */ - public void disconnect() throws Exception; - - /** - * Returns the host error message if there was a problem connecting to the host. - * If there was no problem, this returns null - * - * @return the error message. - */ - public SystemMessage getErrorMessage(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServerLauncherProperties.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServerLauncherProperties.java deleted file mode 100644 index c9470595f..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServerLauncherProperties.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core.subsystems; - -import org.eclipse.rse.core.model.IRSEModelObject; - -/** - * Implement this interface to provide peristable properties for server launching - * All properties to be persisted to be are stored and restored from associated - * IPropertySets - * - */ -public interface IServerLauncherProperties extends IRSEModelObject { - - public IServerLauncherProperties cloneServerLauncher(IServerLauncherProperties newOne); - - /** - * Returns the connector service - * @return the connector service - */ - public IConnectorService getConnectorService(); - - /** - * Update cached values based on IPropertySets - * - */ - public void restoreFromProperties(); - - /** - * Store cached values based on IPropertySets - * - */ - public void saveToProperties(); - -} // ServerLauncher diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServiceSubSystem.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServiceSubSystem.java deleted file mode 100644 index 88a8a8bad..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServiceSubSystem.java +++ /dev/null @@ -1,24 +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.core.subsystems; - -public interface IServiceSubSystem extends ISubSystem { - public Class getServiceType(); - - public void switchServiceFactory(IServiceSubSystemConfiguration factory); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServiceSubSystemConfiguration.java deleted file mode 100644 index cf27341e3..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IServiceSubSystemConfiguration.java +++ /dev/null @@ -1,39 +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.core.subsystems; - -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.services.IService; - -/** - * This is the interface for the class that is for subsystem-providers who desire not to use MOF. - * - * @lastgen interface DefaultSubSystemConfiguration extends SubSystemConfiguration {} - */ -public interface IServiceSubSystemConfiguration extends ISubSystemConfiguration { - public IConnectorService getConnectorService(IHost host); - - public void setConnectorService(IHost host, IConnectorService connectorService); - - public Class getServiceType(); - - public Class getServiceImplType(); - - public IService getService(IHost host); - -} //DefaultSubSystemConfiguration diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystem.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystem.java deleted file mode 100644 index 6eeefbe4e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystem.java +++ /dev/null @@ -1,622 +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) - [182454] improve getAbsoluteName() documentation - * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API - * Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect() - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.IRSECallback; -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; - -/** - * Interface implemented by SubSystem objects. - * - * While connections contain information to identify a particular remote - * system, it is the subsystem objects within a connection that contain - * information unique to a particular tool for that remote system, such as - * the port the tool uses and the user ID for making the connection. - * There are a set of default properties, but these can be extended by - * subsystem providers, by extending SubSystem. - */ -public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, IRemoteObjectResolver, ISchedulingRule, IRSEModelObject { - // ------------------------------------- - // Shortcut and helper methods... - // ------------------------------------- - /** - * Return the parent subsystem factory that owns this subsystem. - */ - public ISubSystemConfiguration getSubSystemConfiguration(); - - /** - * Set the parent subsystem factory that owns this subsystem. - */ - public void setSubSystemConfiguration(ISubSystemConfiguration ssf); - - /** - * Set the parent connection that owns this subsystem. - */ - public void setHost(IHost conn); - - /** - * Set the connector service for this subsystem - * @param connectorService - */ - public void setConnectorService(IConnectorService connectorService); - - /** - * Return the system profile object this subsystem is associated with. - * @see #getName() - */ - public ISystemProfile getSystemProfile(); - - /** - * Return the connection object this subsystem is associated with. - */ - public IHost getHost(); - - /** - * Called on each subsystem associated with a particular {@link IConnectorService} after it connects. - * @param monitor A progress monitor supporting progress reporting and cancellation. - */ - public void initializeSubSystem(IProgressMonitor monitor); - - /** - * Called on each subsystem associated with a particular {@link IConnectorService} after it disconnects - * @param monitor A progress monitor supporting progress reporting and cancellation. - */ - public void uninitializeSubSystem(IProgressMonitor monitor); - - /** - * @return true if this subsystem's properties should take precedence over other subsystems that share the same IConnectorService - */ - public boolean isPrimarySubSystem(); - - /** - * Return the primary subsystem associated with this subsystem's IConnectorService - */ - public ISubSystem getPrimarySubSystem(); - - /** - * @return The name of the connection that owns this. Same as getSystemConnection().getAliasName() - */ - public String getHostAliasName(); - - /** - * @return The value of the profile that owns the connection that owns this subsystem. Fastpath. - */ - public String getSystemProfileName(); - - /** - * Private method called when the parent profile is being renamed, so - * the subsystem can do any cleanup it needs to. Called after the profile is actually renamed. - */ - public void renamingProfile(String oldName, String newName); - - /** - * Private method called when the parent connection is being renamed, so - * the subsystem can do any cleanup it needs to. - */ - public void renamingConnection(String newName); - - /** - * Private method called when the parent connection is being deleted, so - * the subsystem can do any pre-death cleanup it needs to. - */ - public void deletingConnection(); - - /** - * This is a helper method you can call when performing actions that must be certain there - * is a connection. If there is no connection it will attempt to connect, and if that fails - * will throw a SystemMessageException you can easily display to the user by using a method - * in it. - */ - public void checkIsConnected() throws SystemMessageException; - - // --------------------------------------------------- - // Methods for business partners to add their own - // persisted attributes to the subsystem object... - // --------------------------------------------------- - - /** - * For business partners defining their own subsystems. - * This method allows an attribute to be persisted in this - * subsystem, given the following information: - * <ul> - * <li>Vendor name. This name should uniquely differentiate one - * vendor's attributes from anothers. - * <li>Attribute name. The name of the attribute to set. - * <li>attribute value. The value to give the named attribute. It must - * be resolved into a string to use this. Eg, for boolean use - * something like "true" or "false". To clear the attribute - * value pass null for the value. - * </ul> - * <b>Warning</b> do not use any of the following characters in any of - * given parameters, or it will cause problems with parsing: - * <ul> - * <li>Pound sign ('#') - * <li>Three underscores ("___") - * <li>Three equals signs ("===") - * <li>Three semicolons (";;;") - * </ul> - * @deprecated Subsystems can now take named property sets. These should be used instead. - * See {@link IPropertySet} - */ - public void setVendorAttribute(String vendorName, String attributeName, String attributeValue); - - /** - * For business partners defining their own subsystems. - * This method allows retrieval of a persisted attribute in this - * subsystem, given the following information: - * <ul> - * <li>Vendor name. This name should uniquely differentiate one - * vendor's attributes from anothers. - * <li>Attribute name. The name of the attribute whose value is being queried. - * </ul> - * @return value of the attribute being queried, or null if not found - * @deprecated Subsystems can now take named property sets. These should be used instead. - * See {@link IPropertySet} - */ - public String getVendorAttribute(String vendorName, String attributeName); - - // ------------------------------------- - // Context and attributue information... - // ------------------------------------- - - /** - * Return true if userId and password should be forced to uppercase. - * Shortcut to calling same method in parent SubSystemConfiguration. - */ - public boolean forceUserIdToUpperCase(); - - /** - * Alternative to getUserId when we don't want to resolve it from parent connection. - * This is used when showing the properties. - * <p> - * Unlike getUserId() this one does not defer to the connection's default user Id if - * the subsystem's userId attribute is null. - * <p> - * To set the local user Id, simply call setUserId(String id). To clear it, call - * {@link #clearLocalUserId()}. - * <p> - * @see IHost#getDefaultUserId() - * @see #clearLocalUserId() - * @see #getUserId() - */ - public String getLocalUserId(); - - /** - * Called to clear the local user Id such that subsequent requests to getUserId() will - * return the parent connection's default user Id. Sets the user Id attribute for this - * subsystem to null. - * <p> - * @see IHost#getDefaultUserId() - * @see #getUserId() - * @see #getLocalUserId() - */ - public void clearLocalUserId(); - - /** - * Return the children for this subsystem. - * This is used to populate the Remote System View explorer. - * <p> - * By default, if the parent subsystem factory supports filters, then - * we return getSystemFilterPoolReferencesArray. If filters are not - * supported (supportsFilters() returns false from factory) then we - * return null. In this case you should override this. - */ - public Object[] getChildren(); - - /** - * Return true if this subsystem has children objects to - * be displayed in the Remote System View explorer. - */ - public boolean hasChildren(); - - /** - * Return true if the given filter lists the contents of the given remote object. - * For example, if given a folder, return true if any of the filter strings in this filter - * lists the contents of that folder. Used in impact analysis when a remote object is - * created, deleted, renamed, copied or moved, so as to establish which filters need to be - * refreshed or collapsed (if the folder is deleted, say). - * <p> - * The default algorithm calls doesFilterStringListContentsOf for each filter string. - */ - public boolean doesFilterListContentsOf(ISystemFilter filter, String remoteObjectAbsoluteName); - - /** - * Return true if the given filter string lists the contents of the given remote object. - * For example, if given a folder, return true if the given filter string - * lists the contents of that folder. Used in impact analysis when a remote object is - * created, deleted, renamed, copied or moved, so as to establish which filters need to be - * refreshed or collapsed (if the folder is deleted, say). - */ - public boolean doesFilterStringListContentsOf(ISystemFilterString filterString, String remoteObjectAbsoluteName); - - /** - * Return true if the given remote object name will pass the filtering criteria for any of - * the filter strings in this filter. - */ - public boolean doesFilterMatch(ISystemFilter filter, String remoteObjectAbsoluteName); - - /** - * Return true if the given remote object name will pass the filtering criteria for the - * given filter string in this filter. - */ - public boolean doesFilterStringMatch(String filterString, String remoteObjectAbsoluteName, boolean caseSensitive); - - // ------------------------- - // Filter Pool References... - // ------------------------- - /** - * Return the system filter pool reference manager, as per the - * interface SystemFilterPoolReferenceManagerProvider - */ - public ISystemFilterPoolReferenceManager getSystemFilterPoolReferenceManager(); - - /** - * @return The value of the Name attribute - */ - public String getName(); - - /** - * @param value The new value of the Name attribute - */ - public void setName(String value); - - /** - * Returns the value of this subsystem's user id if it is not null. If it - * is null, it returns the parent connection object's default user Id. - * <p> - * In fact, we now don't store the user Id in the subsystem object itself, but rather store it in the - * user preferences, so that such things are not shared among the team on a synchronize operation. - * This is transparent to callers of this method however, as this method resolves from the preferences. - * - * @see IHost#getDefaultUserId() - * @see #getLocalUserId() - * @see #clearLocalUserId() - * @return The value of the UserId attribute - */ - public String getUserId(); - - /** - * @return The value of the ConfigurationId attribute - * Ties this subsystem to its owning subsystem configuration, via the - * id key string of the configuration. - */ - public String getConfigurationId(); - - /** - * @param value The new value of the ConfigurationId attribute - */ - public void setConfigurationId(String value); - - // --------------------------------------------------- - // The following methods relate to the live connection - // --------------------------------------------------- - /** - * Return the IConnectorService object that represents the live connection for this system. - */ - public IConnectorService getConnectorService(); - - /** - * Check if the SubSystem supports caching. - */ - public boolean supportsCaching(); - - /** - * Return the CacheManager for this subsystem. If the SubSystem returns true for - * supportsCaching() then it must return a valid CacheManager, otherwise it is free - * to return null. - * - * @see #supportsCaching() - */ - public ICacheManager getCacheManager(); - - /** - * Return true if this subsystem is currently connected to its remote system. - */ - public boolean isConnected(); - - /** - * Return true if the last attempt to connect this subsystem to its remote system failed. - */ - public boolean isConnectionError(); - - /** - * Sets whether the last attempt to connect this subsystem to its remote system failed. - */ - public void setConnectionError(boolean error); - - /** - * Return true if this subsystem is currently being used in "offline" mode. Not necessarily supported - * by all subsystems in which case this will always return false. - */ - public boolean isOffline(); - - /** - * Connect to the remote system. - * Does not force a prompt for a password. Works from UI or non-UI thread. - * - * @deprecated use {@link #connect(IProgressMonitor, boolean)} from background - * thread, or {@link #connect(boolean, IRSECallback) from UI thread. - * @throws Exception an exception if there is a failure to connect. - * Typically, this will be a {@link SystemMessageException}. - */ - public void connect() throws Exception; - - /** - * Synchronously connect to the remote system. - * - * Clients are expected to call this method on a background - * thread with an existing progress monitor. A signon prompt - * may optionally be forced even if the password is cached - * in memory or on disk. - * - * The framework will take care of switching to the UI thread - * for requesting a password from the user if necessary. - * - * @param monitor the progress monitor. Must not be <code>null</code>. - * @param forcePrompt forces the prompt dialog to be displayed - * even if the password is currently in memory. - * @throws Exception an exception if there is a failure to connect. - * Typically, this will be a {@link SystemMessageException}. - */ - public void connect(IProgressMonitor monitor, boolean forcePrompt) throws Exception; - - /** - * Asynchronously connect to the remote system, optionally forcing a signon prompt - * even if the password is cached in memory or on disk. - * <p/> - * This method must be called on the UI Thread! An Eclipse background job with a - * progress monitor will be created automatically. If the optional callback is - * given, it will be called when the connect is complete. - * You do not need to override this, as it does the progress monitor reporting - * for you. - * <p/> - * Override internalConnect if you want, but by default it calls - * <code>getConnectorService().connect(IProgressMonitor)</code>. - * - * @param forcePrompt forces the prompt dialog even if the password is in mem - * @param callback to call after connect is complete. - * May be <code>null</code>. - * @throws Exception an exception if there is a failure to connect. - * Typically, this will be a {@link SystemMessageException}. - */ - public void connect(boolean forcePrompt, IRSECallback callback) throws Exception; - - /** - * Disconnect from the remote system. - * In addition to calling getSystem().disconnect(),this must fire an - * event to collapse the expanded nodes in the tree under this node. - */ - public void disconnect() throws Exception; - - /** - * Disconnect from the remote system. - * In addition to calling getSystem().disconnect(),this may fire an - * event to collapse the expanded nodes in the tree under this node - * depending on the value of collapseTree. - */ - public void disconnect(boolean collapseTree) throws Exception; - - /** - * Resolve an absolute filter string. This is only applicable if the subsystem - * factory reports true for supportsFilters(). - * <p> - * When a user expands a filter containing filter strings, this method is - * invoked for each filter string. - * <p> - * The resulting objects are displayed in the remote system view tree. They - * can be anything, but at a minimum must support IAdaptable in order to - * drive the property sheet. You can just defer the getAdapter request to - * the platform's Adapter manager if desired. - * <p> - * You should supply an adapter class for the returned object's class, - * to render objects in the Remote System Explorer view. It will uses a - * label and content provider that defers all requests to the adapter, - * which it gets by querying the platform's adapter manager for the object - * type. Be sure to register your adapter factory. - * - * @param filterString filter pattern for objects to return. - * @param monitor the process monitor associated with this operation - * @return Array of objects that are the result of this filter string - */ - public Object[] resolveFilterString(String filterString, IProgressMonitor monitor) throws Exception; - - /** - * Resolve multiple absolute filter strings. This is only applicable if the subsystem - * factory reports true for supportsFilters(). - * <p> - * This is the same as {@link #resolveFilterString(String)} but takes an array of - * filter strings versus a single filter string. - * - * @param filterStrings array of filter patterns for objects to return. - * @param monitor the process monitor associated with this operation - * - * @return Array of objects that are the result of this filter string - */ - public Object[] resolveFilterStrings(String[] filterStrings, IProgressMonitor monitor) throws Exception; - - /** - * Resolve a relative filter string. This is only applicable if the subsystem - * factory reports true for supportsFilters(). - * <p> - * When a user expands an object that came from a previous filter string expansion, - * (such as expanding a folder), this method is invoked to get the children of - * that object. The user can choose to expand all, or choose a pre-defined - * relative filter string to subset/filter the children. In either case, the - * relative filter string is passed in as well as the to-be-expanded parent object. - * <p> - * The resulting objects are displayed in the remote system view tree. They - * can be anything, but at a minimum must support IAdaptable in order to - * drive the property sheet. You can just defer the getAdapter request to - * the platform's Adapter manager if desired. - * <p> - * You should supply an adapter class for the returned object's class, - * to render objects in the Remote System Explorer view. It will uses a - * label and content provider that defers all requests to the adapter, - * which it gets by querying the platform's adapter manager for the object - * type. Be sure to register your adapter factory. - * - * @param parent Object that is being expanded. - * @param filterString filter pattern for children of parent. - * @param monitor the process monitor associated with this operation - * - * @return Array of objects that are the result of this filter string - */ - public Object[] resolveFilterString(Object parent, String filterString, IProgressMonitor monitor) throws Exception; - - /* - * Execute a remote command. This is only applicable if the subsystem factory reports - * true for supportsCommands(). - * @param command Command to be executed remotely. - * @param Shell parent shell used to show error message. Null means you will handle showing the error message. - * @param Object context context of a command (i.e. working directory). Null is valid and means to use the default context. - * @return Array of objects that are the result of running this command. Typically, these - * are messages logged by the command. - * - public Object[] runCommand(String command, Shell shell, Object context) - throws Exception; - - /* - * Provide list of executed commands on subsystem.This is only applicable if the subsystem factory reports - * true for supportsCommands(). - * - public String[] getExecutedCommands(); - */ - - /** - * Set a remote property. Subsystems interpret as they wish. Eg, this might be to set - * a remote environment variable. This is only applicable if the subsystem factory reports - * true for supportsProperties(). - * @param subject Identifies which object to get the properties of - * @param key Identifies property to set - * @param value Value to set property to - * @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation. - * - * @deprecated this shouldn't be used - */ - public Object setProperty(Object subject, String key, String value) throws Exception; - - /** - * Get a remote property. Subsystems interpret as they wish. Eg, this might be to get - * a remote environment variable. This is only applicable if the subsystem factory reports - * true for supportsProperties(). - * @param subject Identifies which object to get the properties of - * @param key Identifies property to get value of - * @return String The value of the requested key. - * - * @deprecated this shouldn't be used - */ - public String getProperty(Object subject, String key) throws Exception; - - /** - * Set multiple remote properties. Subsystems interpret as they wish. Eg, this might be to set - * a number of remote environment variables. This is only applicable if the subsystem factory reports - * true for supportsProperties(). - * @param subject Identifies which object to get the properties of - * @param keys Identifies the properties to set - * @param values Values to set properties to. One to one mapping to keys by index number - * @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation. - * - * @deprecated this shouldn't be used - */ - public Object setProperties(Object subject, String[] keys, String[] values) throws Exception; - - /** - * Get a remote property. Subsystems interpret as they wish. Eg, this might be to get - * a remote environment variable. This is only applicable if the subsystem factory reports - * true for supportsProperties(). - * @param subject Identifies which object to get the properties of - * @param keys Identifies properties to get value of - * @return The values of the requested keys. - * - * @deprecated this shouldn't be used - */ - public String[] getProperties(Object subject, String[] keys) throws Exception; - - /** - * <i>Generated persistent property method</i><br> - * Return true if this subsystem is to be hidden so it doesn't show in the Remote Systems - * view when a connection is expanded. If so, this subsystem is for programmatic use only, - * or is exposed in alternative view. Such is the case for command subsystems, for example. - * @generated This field/method will be replaced during code generation - * @return The value of the Hidden attribute - */ - boolean isHidden(); - - /** - * <i>Generated persistent property method</i><br> - * Specify true if this subsystem is to be hidden so it doesn't show in the Remote Systems - * view when a connection is expanded. If so, this subsystem is for programmatic use only, - * or is exposed in alternative view. Such is the case for command subsystems, for example. - * @generated This field/method will be replaced during code generation - * @param value The new value of the Hidden attribute - */ - void setHidden(boolean value); - - /** - * <i>Generated persistent property method</i><br> - * Return the object that manages the list of - * filter pools referenced by this subsystem. - * @generated This field/method will be replaced during code generation - * @return The FilterPoolReferenceManager reference - */ - ISystemFilterPoolReferenceManager getFilterPoolReferenceManager(); - - /** - * <i>Generated persistent property method</i><br> - * Set the object that manages the list of - * filter pools referenced by this subsystem. This is called by the subsystem factory - * when creating or restoring subsystems. - * @generated This field/method will be replaced during code generation - * @param l The new value of the FilterPoolReferenceManager reference - */ - void setFilterPoolReferenceManager(ISystemFilterPoolReferenceManager value); - - /** - * Returns the parent object associated with a filter reference. It's up to the - * subsystem implementation to decide what "parent object" means for a filter reference. - * @param filterRef the filter reference to determine a target object from. - * @return An object representing the parent - */ - Object getTargetForFilter(ISystemFilterReference filterRef); - - //// ------------------------------------- - // // GUI methods - // // ------------------------------------- - // /** - // * Return the single property page to show in the tabbed notebook for the - // * for SubSystem property of the parent Connection. Return null if no - // * page is to be contributed for this. You are limited to a single page, - // * so you may have to compress. It is recommended you prompt for the port - // * if applicable since the common base subsystem property page is not shown - // * To help with this you can use the SystemPortPrompt widget. - // */ - // public PropertyPage getPropertyPage(Composite parent); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java deleted file mode 100644 index 33d32c196..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java +++ /dev/null @@ -1,622 +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: - * David Dykstal (IBM) - 168870: move core function from UI to core - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util - * Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage; -import org.eclipse.rse.core.model.ISystemProfile; - -public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvider, IRSEPersistableContainer { - // --------------------------------- - // CONSTANTS... - // --------------------------------- - public static final boolean FORCE_INTO_MEMORY = true; - public static final boolean LAZILY = false; - - /** - * Reset for a full refresh from disk, such as after a team synch. - */ - public void reset(); - - /** - * Retrieves all the filter pool managers for all the profiles, active or not. - * This allows cross references from - * one subsystem in one profile to filter pools in any other profile. - */ - public ISystemFilterPoolManager[] getAllSystemFilterPoolManagers(); - - // --------------------------------- - // CRITICAL METHODS... - // --------------------------------- - /** - * Return true if the subsystem supports more than one filter string - * <p>RETURNS true BY DEFAULT - */ - public boolean supportsMultiStringFilters(); - - /** - * Return true if the subsystem supports the exporting of filter strings from it's filters - * <p>RETURNS true BY DEFAULT - */ - public boolean supportsFilterStringExport(); - - /** - * Return true if subsystem instances from this factory support connect and disconnect actions - * <p>Returns true in default implementation. - */ - public boolean supportsSubSystemConnect(); - - /** - * Return true (default) or false to indicate if subsystems of this factory support user-editable - * port numbers. - * <p>Returns true in default implementation. - */ - public boolean isPortEditable(); - - /** - * Return true if subsystem instances from this factory support remote command execution - * <p>Returns false in default implementation, and is usually only true for command subsystems. - */ - public boolean supportsCommands(); - - /** - * Return true if subsystem instances from this factory support getting and setting properties - * <p>Returns false in default implementation, and not actually used yet. - */ - public boolean supportsProperties(); - - /** - * Required method for subsystem factory child classes. Return true if you support filters, false otherwise. - * If you support filters, then some housekeeping will be done for you automatically. Specifically, they - * will be saved and restored for you automatically. - * <p>Returns true in default implementation. - */ - public boolean supportsFilters(); - - /** - * Indicates whether the subsystem supports displaying children under - * its filters. By default, this will return true, but if filters that can't - * be expanded are desired, this can be overridden to return false. - */ - public boolean supportsFilterChildren(); - - /** - * Required method for subsystem factory child classes. Return true if you filter caching. - * If you support filter caching, then the views will always check the in-memory cache for - * filter results before attempting a query. - * <p>Returns true in default implementation. - */ - public boolean supportsFilterCaching(); - - /** - * Required method for subsystem factory child classes. Return true if you support filters, and you support - * multiple filter strings per filter. Return false to restrict the user to one string per filter. - * <p>Returns true in default implementation. - */ - public boolean supportsMultipleFilterStrings(); - - /** - * Required method for subsystem factory child classes if returning true from supportsFilters. - * Return true if you support filters within filters, false otherwise. - * <p>Returns false in default implementation. - */ - public boolean supportsNestedFilters(); - - /** - * Return true if you support quick filters. These allow the user to subset a remote system object at - * the time they expand it in the remote system explorer tree view. - * <p> - * Not supported yet - */ - public boolean supportsQuickFilters(); - - /** - * Return true if filters of this subsystem factory support dropping into. - */ - public boolean supportsDropInFilters(); - - /** - * Return true if deferred queries are supported. - * - * Deferred queries work such that when a filter or element - * children query is made, a WorkbenchJob is started to - * perform the query in a background thread. The query can - * take time to complete, but a negative side-effect of this - * is that it will always take time to complete. - * - * Alternative models can use asynchronous calls to populate - * their model with data from the remote side, and refresh - * the views when new data is in the model. Such subsystem - * configurations should return <code>false</code> here. - * - * The default implementation returns <code>true</code>, indicating - * that deferred queries are supported for filters, and delegates - * the check for model elements to the ISystemViewElementAdapter. - * - * @return <code>true</code> if deferred queries are supported. - */ - public boolean supportsDeferredQueries(); - - /** - * Return true if filters of this subsystem factory provide a custom implementation of drop support. - * By default, the filter reference adapter treats a drop on a filter as an update to the list of filter - * strings for a filter. For things like files, it is more desirable to treat the drop as a physical - * resource copy, so in that case, custom drop makes sense. - * - * By default this returns false. - */ - public boolean providesCustomDropInFilters(); - - /** - * Return true if you support user-defined actions for the remote system objects returned from expansion of - * subsystems created by this subsystem factory - * <p>Returns false in default implementation. - */ - public boolean supportsUserDefinedActions(); - - /** - * Return true if you support compile actions for the remote system objects returned from expansion of - * subsystems created by this subsystem factory. - * <p>Returns false in default implementation. - */ - public boolean supportsCompileActions(); - - /** - * Return true if you support user-defined/managed named file types - * <p>Returns false in default implementation. - */ - public boolean supportsFileTypes(); - - /** - * Tell us if this subsystem factory supports targets, which are destinations for - * pushes and builds. Normally only true for file system factories. - */ - public boolean supportsTargets(); - - /** - * Tell us if this subsystem factory supports server launch properties, which allow the user - * to configure how the server-side code for these subsystems are started. There is a Server - * Launch Setting property page, with a pluggable composite, where users can configure these - * properties. - * <br> By default we return false here. This is overridden in UniversalFileSubSystemConfiguration though. - */ - public boolean supportsServerLaunchProperties(IHost host); - - /** - * If {@link #supportsServerLaunchProperties(IHost)} returns true, this method may be called by - * the server launcher to decide if a given remote server launch type is supported or not. - * <br> We return true by default. - * @see org.eclipse.rse.core.subsystems.ServerLaunchType - */ - public boolean supportsServerLaunchType(ServerLaunchType serverLaunchType); - - /** - * Tell us if filter strings are case sensitive. - * <p>Returns false in default implementation. - */ - public boolean isCaseSensitive(); - - // --------------------------------- - // USER-PREFERENCE METHODS... - // --------------------------------- - /** - * If we support filters, should we show filter pools in the remote system explorer? - * Typically retrieved from user preferences. - */ - public boolean showFilterPools(); - - /* - * If we support filters, should we show filter strings in the remote system explorer? - * Typically retrieved from user preferences. - * - public boolean showFilterStrings(); - */ - /** - * If we support filters, should we show filter pools in the remote system explorer? - * This is to set it after the user changes it in the user preferences. It may require - * refreshing the current view. - */ - public void setShowFilterPools(boolean show); - - /* - * If we support filters, should we show filter strings in the remote system explorer? - * This is to set it after the user changes it in the user preferences. It may require - * refreshing the current view. - * - public void setShowFilterStrings(boolean show); - */ - - // --------------------------------- - // PROXY METHODS. USED INTERNALLY... - // --------------------------------- - /** - * Private method called by RSEUIPlugin - */ - public void setSubSystemConfigurationProxy(ISubSystemConfigurationProxy proxy); - - /** - * Private method - */ - public ISubSystemConfigurationProxy getSubSystemConfigurationProxy(); - - // --------------------------------- - // FACTORY ATTRIBUTE METHODS... - // --------------------------------- - /** - * Return vendor of this factory. - * This comes from the xml "vendor" attribute of the extension point. - */ - public String getVendor(); - - /** - * Return name of this factory. Matches value in name attribute in extension point xml - */ - public String getName(); - - /** - * Return description of this factory. Comes from translated description string in extension point xml - */ - public String getDescription(); - - /** - * Return unique id of this factory. Matches value in id attribute in extension point xml - */ - public String getId(); - - /** - * Return the category this subsystem factory subscribes to. - * @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories - */ - public String getCategory(); - - /** - * Return the system types this subsystem factory supports. - */ - public IRSESystemType[] getSystemTypes(); - - // --------------------------------- - // PROFILE METHODS... - // --------------------------------- - /** - * Called by SystemRegistry when we are about to delete a profile. - * <p> - * Our only mission is to delete the filter pool associated with it, - * because the registry has already called deleteSubSystemsByConnection - * for every subsystem of every connection owned by this profile. - */ - public void deletingSystemProfile(ISystemProfile profile); - - /** - * Called by SystemRegistry when we have toggled the active-status of a profile - */ - public void changingSystemProfileActiveStatus(ISystemProfile profile, boolean newStatus); - - /** - * Get owning profile object given a filter pool object - */ - public ISystemProfile getSystemProfile(ISystemFilterPool pool); - - /** - * Callback method called after renaming a subsystem profile. - * <p> - * This is called by SystemRegistry's renameSystemProfile method - * after it is complete, , in order to allow the subsystem configuration - * perform any required cleanup. For instance, subsystem configurations - * must ensure that they update their filter pool manager names - * (and their folders). - * </p><p> - * Must be called AFTER changing the profile's name!! - * </p> - * @param oldProfileName the old profile name. - * @param newProfileName the new profile name. - */ - public void renameSubSystemProfile(String oldProfileName, String newProfileName); - - - // --------------------------------- - // SUBSYSTEM METHODS... - // --------------------------------- - - /** - * Called by SystemRegistry's renameSystemProfile method to ensure we update our - * subsystem names within each subsystem. - * <p> - * This is called AFTER changing the profile's name!! - */ - public void renameSubSystemProfile(ISubSystem ss, String oldProfileName, String newProfileName); - - /** - * Called by SystemRegistry's renameSystemProfile method to pre-test if we are going to run into errors on a - * profile rename, due to file or folder in use. - */ - public void preTestRenameSubSystemProfile(String oldProfileName) throws Exception; - - /** - * Called by SystemRegistry's renameConnection method to ensure we update our - * connection names within each subsystem. - * <p> - * Must be called prior to changing the connection's name!! - */ - public void renameSubSystemsByConnection(IHost conn, String newConnectionName); - - /** - * Called by SystemRegistry's deleteConnection method to ensure we delete all our - * subsystems for a given connection. - */ - public void deleteSubSystemsByConnection(IHost conn); - - /** - * Creates a new subsystem instance that is associated with the given connection object. - * SystemRegistryImpl calls this when a new connection is created, and appliesToSystemType returns true. - * @param conn The connection to create a subsystem for - * @param creatingConnection true if we are creating a connection, false if just creating - * another subsystem for an existing connection. - * @param yourNewConnectionWizardPages The wizard pages you supplied to the New Connection wizard, via the - * {@link org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter#getNewConnectionWizardPages(ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)} - * method or null if you didn't override this method. - */ - public ISubSystem createSubSystem(IHost conn, boolean creatingConnection, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages); - - // used in the case where newsubsystems are added after a connection exists - public ISubSystem createSubSystemAfterTheFact(IHost conn); - - public ISubSystem createSubSystemInternal(IHost conn); - - /** - * Find or create a connector service for this host - */ - public IConnectorService getConnectorService(IHost host); - - /** - * Overridable entry for child classes to contribute a server launcher instance - * for a given subsystem. - * <p> - * Create an instance of ServerLauncher, and add it to the given subsystem. - * When a subsystem is created, and {@link #supportsServerLaunchProperties(IHost)} - * returns true, this method is called to create the server launcher instance - * associated with the subsystem. The default implementation is to create an - * instance of {@link IRemoteServerLauncher}, but override to create your own - * ServerLauncher instance if you have your own class. - */ - public IServerLauncherProperties createServerLauncher(IConnectorService connectorService); - - /** - * Updates user-editable attributes of an existing subsystem instance. - * These attributes typically affect the live connection, so the subsystem will be forced to - * disconnect. - * <p> - * The subsystem will be saved to disk. - * @param subsystem target of the update action - * @param updateUserId true if we are updating the userId, else false to ignore userId - * @param userId new local user Id. Ignored if updateUserId is false - * @param updatePort true if we are updating the port, else false to ignore port - * @param port new local port value. Ignored if updatePort is false - */ - public void updateSubSystem(ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port); - - /** - * Update the port for the given subsystem instance. - */ - public void setSubSystemPort(ISubSystem subsystem, int port); - - /** - * Update the user ID for the given subsystem instance. - */ - public void setSubSystemUserId(ISubSystem subsystem, String userId); - - /** - * Returns true if this factory allows users to delete instances of subsystem objects. - * Would only be true if users are allowed to create multiple instances of subsystem objects - * per connection. - */ - public boolean isSubSystemsDeletable(); - - /** - * Deletes a given subsystem instance from the list maintained by this factory. - * SystemRegistryImpl calls this when the user selects to delete a subsystem object, - * or delete the parent connection this subsystem is associated with. - * In former case, this is only called if the factory supports user-deletable subsystems. - */ - public boolean deleteSubSystem(ISubSystem subsystem); - - /** - * Clone a given subsystem into the given connection. - * Called when user does a copy-connection action. - * @param oldSubsystem The subsystem to be cloned - * @param newConnection The connection into which to create and clone the old subsystem - * @param copyProfileOperation Pass true if this is an profile-copy operation versus a connection-copy operation - * @return New subsystem within the new connection - */ - public ISubSystem cloneSubSystem(ISubSystem oldSubsystem, IHost newConnection, boolean copyProfileOperation) throws Exception; - - /** - * Returns a list of subsystem objects existing for the given connection. - * @param conn System connection to retrieve subsystems for - * @param force true if we should force all the subsystems to be restored from disk if not already - */ - public ISubSystem[] getSubSystems(IHost conn, boolean force); - - /** - * Returns a list of all subsystem objects for all connections. - */ - public ISubSystem[] getSubSystems(boolean force); - - /** - * Renames a subsystem. This is better than ss.setName(String newName) as it saves the subsystem to disk. - */ - public void renameSubSystem(ISubSystem subsystem, String newName); - - /** - * Disconnect all subsystems currently connected. - * Called by shutdown() of RSEUIPlugin. - */ - public void disconnectAllSubSystems() throws Exception; - - // --------------------------------- - // FILTER POOL METHODS... - // --------------------------------- - /** - * Get the filter pool manager for the given profile - */ - public ISystemFilterPoolManager getFilterPoolManager(ISystemProfile profile); - - /** - * Copy the filter pool manager and return a new one. Called during profile-copy operations. - * Will also copy all of the filter pools and their respective data. - */ - public ISystemFilterPoolManager copyFilterPoolManager(ISystemProfile oldProfile, ISystemProfile newProfile) throws Exception; - - /** - * Given a subsystem, return the first (hopefully only) default pool for this - * subsystem's profile. - */ - public ISystemFilterPool getDefaultSystemFilterPool(ISubSystem subsys); - - /** - * Test if any filter pools in the given profile are referenced by other profiles, - * which are active. - * <p> - * Called when user tries to make a profile inactive. We prevent this if there exists - * active references. - * @param profile The profile being tested - * @return An array of the active subsystems which reference filter pools in this profile, - * or null if none are found. - */ - public ISubSystem[] testForActiveReferences(ISystemProfile profile); - - // --------------------------------- - // FILTER METHODS - // --------------------------------- - /** - * Return the translated string to show in the property sheet for the type property when a filter is selected. - */ - public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter); - - /** - * Return true if we should show the refresh action in the popup for the given element. - */ - public boolean showRefreshOnFilter(); - - /** - * Return true if we should show the show in table action in the popup for the given element. - */ - public boolean showGenericShowInTableOnFilter(); - - /** - * Given a filter, decide whether to show the Filter Strings property page - * for this filter. Default is true. - */ - public boolean showChangeFilterStringsPropertyPage(ISystemFilter filter); - - /** - * Determines whether this factory is responsible for the creation of subsytems of the specified type - * Subsystem factories should override this to indicate which subsystems they support. - * - * @param subSystemType type of subsystem - * @return whether this factory is for the specified subsystemtype - */ - public boolean isFactoryFor(Class subSystemType); - - // --------------------------------- - // FILTER REFERENCE METHODS - // --------------------------------- - - // --------------------------------- - // STATE METHODS... - // --------------------------------- - /** - * Called by adapters prior to asking for actions, in case the connection of the currently selected - * object is required by the action. - */ - public void setConnection(IHost connection); - - /** - * Called by adapters prior to asking for actions. For cases when current selection is needed. - */ - public void setCurrentSelection(Object[] selection); - - // --------------------------------- - // SAVE METHODS... - // --------------------------------- - /** - * Saves absolutely everything to disk. This is called as a safety - * measure when the workbench shuts down. - * <p> - * Totally handled for you! - * <p> - * Calls saveSubSystems() and saveFilterPools() - * <p> - * Exceptions are swallowed since we cannot deal with them on shutdown anyway! - */ - public boolean commit(); - - /** - * Save one subsystem to disk. - * Called by each subsystem when their data changes. - */ - public void saveSubSystem(ISubSystem subsys) throws Exception; - - /** - * <i><b>Private</b>. Do not call or use.</i><br> - * @generated This field/method will be replaced during code generation - * @return The list of SubSystemList references - */ - java.util.List getSubSystemList(); - - /** - * <i><b>Private</b>. Do not call or use.</i><br> - * @generated This field/method will be replaced during code generation - * @return The list of FilterPoolManagerList references - */ - java.util.List getFilterPoolManagerList(); - - public ISystemFilterPool getDefaultFilterPool(ISystemProfile profile, String oldProfileName); - - public ISystemProfile getSystemProfile(String name); - - public void renameFilterPoolManager(ISystemProfile profile); - - // /** - // * Return the validator for the userId. - // * A default is supplied. - // * Note this is only used for the subsystem's properties, so will not - // * be used by the connection's default. Thus, is only of limited value. - // * <p> - // * This must be castable to ICellEditorValidator for the property sheet support. - // */ - // public ISystemValidator getUserIdValidator(); - // /** - // * Return the validator for the password which is prompted for at runtime. - // * No default is supplied. - // */ - // public ISystemValidator getPasswordValidator(); - // /** - // * Return the validator for the port. - // * A default is supplied. - // * This must be castable to ICellEditorValidator for the property sheet support. - // */ - // public ISystemValidator getPortValidator(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java deleted file mode 100644 index ac6a7fc83..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 168870: move core function from UI to core - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import java.net.URL; - -import org.eclipse.rse.core.IRSESystemType; -import org.osgi.framework.Bundle; - -/** - * Interface to SubSystemConfigurationExtension class - * Internal use, not likely you will ever need to use it or access it directly. - */ -public interface ISubSystemConfigurationProxy { - - /** - * Return value of the <samp>id</samp> xml attribute. - * Return unique id of this configuration. - */ - public String getId(); - - /** - * Return value of the <samp>name</samp> xml attribute. - * Return name of this factory. Matches value in name attribute in extension point xml - */ - public String getName(); - - /** - * Return value of the <samp>description</samp> xml attribute. - * Return description of this factory. Matches value in description attribute in extension point xml - */ - public String getDescription(); - - /** - * Returns the bundle which have declared the subsystem - * configuration associated with this proxy. - * - * @return The declaring bundle. - */ - public Bundle getDeclaringBundle(); - - /** - * Return value of the <samp>systemTypeIds</samp> xml attribute. - * Return the system type ids this subsystem configuration supports. - */ - public String getDeclaredSystemTypeIds(); - - /** - * Returns the list of system types the subsystem configuration is supporting. - * The list is combined from the list of currently registered system types cleaned - * up by the ones not matching the declared system type ids. - * - * @return The list of supported system types or an empty list. - */ - public IRSESystemType[] getSystemTypes(); - - /** - * Return true if this factory supports all system types - */ - public boolean supportsAllSystemTypes(); - - /** - * Return value of the <samp>vendor</samp> xml attribute. - * Return vendor of this configuration. - */ - public String getVendor(); - - /** - * Return value of the <samp>category</samp> xml attribute. - * Return the category this subsystem configuration subscribes to. - * @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories - */ - public String getCategory(); - - /** - * Return true if the subsystem factory has been instantiated yet - */ - public boolean isSubSystemConfigurationActive(); - - /** - * Returns the priority of the subsystem configuration. - */ - public int getPriority(); - - /** - * Return the subsystem factory singleton instance. Will instantiate if not already. - */ - public ISubSystemConfiguration getSubSystemConfiguration(); - - // /** - // * Return an instance of the IConnectorService class identified by the "systemClass" attribute - // * of this subsystemConfigurations extension point. Note each call to this method returns a - // * new instance of the class, or null if no "systemClass" attribute was specified. - // */ - // public IConnectorService getSystemObject(); - - /** - * Test if the given system type matches one or more of the - * <samp>systemTypes</samp> attribute of this extension. - */ - public boolean appliesToSystemType(IRSESystemType type); - - /** - * Reset for a full refresh from disk, such as after a team synch. - */ - public void reset(); - - /** - * After a reset, restore from disk - */ - public void restore(); - - /** - * @return the URL of the image associated with this subsystem in its non-connected state. - */ - public URL getImageLocation(); - - /** - * @return the URL of the image associated with this subsystem in its connected state. - */ - public URL getLiveImageLocation(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemPropertiesWizardPage.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemPropertiesWizardPage.java deleted file mode 100644 index 3585995ad..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemPropertiesWizardPage.java +++ /dev/null @@ -1,23 +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) - [190231] Moved from rse.ui.wizards to core.subsystems - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - - -public interface ISubSystemPropertiesWizardPage -{ - public boolean applyValues(ISubSystem ss); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISystemDragDropAdapter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISystemDragDropAdapter.java deleted file mode 100644 index 7cd562ea9..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISystemDragDropAdapter.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.model.ISystemResourceSet; -import org.eclipse.rse.core.model.SystemRemoteResourceSet; - -public interface ISystemDragDropAdapter extends IRemoteObjectIdentifier -{ - - // ------------------------------------------ - // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION... - // ------------------------------------------ - /** - * Return true if this object can be copied to another location via drag and drop, or clipboard copy. - */ - public boolean canDrag(Object element); - - /** - * Return true if these objects can be copied to another location via drag and drop, or clipboard copy. - */ - public boolean canDrag(SystemRemoteResourceSet elements); - - /** - * Perform the drag on the given object. - * @param element the object to copy - * @param sameSystemType indication of whether the source and target reside on the same type of system - * @param monitor the progress monitor - * @return a temporary local copy of the object that was copied - */ - public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor); - - - /** - * Perform the drag on the given objects. - * @param set the set of objects to copy - * @param monitor the progress monitor - * @return a set of temporary files of the object that was copied - */ - public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor); - - /** - * Return true if another object can be copied into this object - * @param element the target of a drop operation - * @return whether this object may be dropped on - */ - public boolean canDrop(Object element); - - /** - * Perform drop from the "from" object to the "to" object - * @param from the source object for the drop - * @param to the target object for the drop - * @param sameSystemType indication of whether the source and target reside of the same type of system - * @param sameSystem indication of whether the source and target are on the same system - * @param srcType the type of object to be dropped. - * @param monitor the progress monitor - * @return the new copy of the object that was dropped - */ - public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor); - - /** - * Perform drop from the "fromSet" of objects to the "to" object - * @param fromSet the source objects for the drop - * @param to the target object for the drop - * @param sameSystemType indication of whether the source and target reside of the same type of system - * @param sameSystem indication of whether the source and target are on the same system - * @param srcType the type of objects to be dropped - * @param monitor the progress monitor - * - * @return the set of new objects created from the drop - */ - public ISystemResourceSet doDrop(ISystemResourceSet fromSet, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor); - - - /** - * Return true if it is valid for the src object to be dropped in the target - * @param src the object to drop - * @param target the object which src is dropped in - * @param sameSystem whether this is the same system - * @return whether this is a valid operation - */ - public boolean validateDrop(Object src, Object target, boolean sameSystem); - - /** - * Return true if it is valid for the src objects to be dropped in the target - * @param srcSet set of resources to drop on the target - * @param target the object which src is dropped in - * @param sameSystem whether this is the same system - * @return whether this is a valid operation - */ - public boolean validateDrop(ISystemResourceSet srcSet, Object target, boolean sameSystem); - - /** - * Get the subsystem that corresponds to this object if one exists. - */ - public ISubSystem getSubSystem(Object element); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISystemRemoteObjectMatchProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISystemRemoteObjectMatchProvider.java deleted file mode 100644 index b1b539b0f..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISystemRemoteObjectMatchProvider.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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.core.subsystems; - -/** - * This interface is designed to allow remote property pages to be registered - * against specific remote system objects of specific name, type or subtype. - */ -public interface ISystemRemoteObjectMatchProvider extends IRemoteObjectIdentifier { - - /** - * Return the name of this object, which may be different than - * the display text ({@link #getText(Object)}). - * <p> - * The unqualified name is used for checking uniqueness during rename - * operations. - * </p> - * @param element the element for which to return the internal name. - * @return a String representing the internal name of the given element. - */ - public String getName(Object element); - - /** - * Return the source type of the selected object. - * <p> - * Typically, this only makes sense for compilable source members. - * For non-compilable remote objects, this typically just returns null. - * </p> - * @return the sourcetype id of this remote object, - * or <code>null</code> if not applicable. - */ - public String getRemoteSourceType(Object element); - - /** - * Return a value for the sub-subtype property for this object. - * <p> - * Not all object types support a sub-subtype, so returning null is ok. - * The value must not be translated, so that property pages registered - * via xml can subset by it. - * </p> - * @return the subsubtype id of this remote object for filtering. - * May return <code>null</code>. - */ - public String getRemoteSubSubType(Object element); - - /** - * Return a value for the subtype property for this object. - * <p> - * Not all object types support a subtype, so returning null is ok. - * The value must not be translated, so that property pages registered - * via xml can subset by it. - * </p> - * @return the subtype id of this remote object for filtering. - * May return <code>null</code>. - */ - public String getRemoteSubType(Object element); - - /** - * Return a value for the type property for this object. - * <p> - * The value must not be translated, so that property pages registered - * via xml can subset by it. - * </p> - * @return the type id of this remote object for filtering. - */ - public String getRemoteType(Object element); - - /** - * Return a value for the type category property for this object. - * <p> - * The value must not be translated, so that property pages registered - * via xml can subset by it. - * </p> - * @return the category id of this remote object for filtering. - */ - public String getRemoteTypeCategory(Object element); - - /** - * Return the subsystem that is responsible for getting this remote object. - * <p> - * When used together with getAbsoluteName, allows for unique - * identification of this object. - * </p> - * @return the subsystem owning this remote object. - * Must not return <code>null</code>. - */ - public ISubSystem getSubSystem(Object element); - - /** - * Return the subsystem factory id that owns this remote object. - * <p> - * The value must not be translated, so that property pages registered - * via xml can subset by it. - * </p> - * @return the ID of the subsystem configuration that created - * the subsystem which owns this remote object. - */ - public String getSubSystemConfigurationId(Object element); - - /** - * Return the label for this object. - * @see #getName(Object) - * @param element the element for which to return the internal name. - * @return a String representing the UI visible label of the given element. - */ - public String getText(Object element); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteChildrenContentsType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteChildrenContentsType.java deleted file mode 100644 index 6f196670b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteChildrenContentsType.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core.subsystems; - -import org.eclipse.rse.core.model.ISystemContentsType; - -/** - * Represents contents that are children of a container - */ -public class RemoteChildrenContentsType implements ISystemContentsType { - public static String CONTENTS_TYPE_CHILDREN = "contents_children"; //$NON-NLS-1$ - public static RemoteChildrenContentsType _instance = new RemoteChildrenContentsType(); - - public static RemoteChildrenContentsType getInstance() { - return _instance; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.IRemoteContentsType#getType() - */ - public String getType() { - return CONTENTS_TYPE_CHILDREN; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.model.IRemoteContentsType#isPersistent() - */ - public boolean isPersistent() { - return false; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java deleted file mode 100644 index b85880515..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java +++ /dev/null @@ -1,488 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2004, 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: - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.rse.core.model.ILabeledObject; -import org.eclipse.rse.core.model.IProperty; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.IPropertyType; -import org.eclipse.rse.core.model.PropertyType; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.internal.core.subsystems.ServerLauncher; - - -/** - * <!-- begin-user-doc --> - * This subclass of {@link IServerLauncherProperties} is for use by some dstore-based subsystems, although - * is possibly of value to vendors as well. The dstore-based subsystems use server code - * written in Java, on top of the datastore technology. You can read about this in the - * developer guide for Remote System Explorer. The bottom line, however, is we offer the - * user a number of ways to start that remote server from the client, as well to connect - * to it if it is already running. This class encapsulates the properties to support that. - * <p> - * Create instances via {@link ISubSystemConfiguration#createServerLauncher(IConnectorService)} - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.rse.core.subsystems.RemoteServerLauncher#getServerLaunchType <em>Server Launch Type</em>}</li> - * <li>{@link org.eclipse.rse.core.subsystems.RemoteServerLauncher#getRexecPort <em>Rexec Port</em>}</li> - * <li>{@link org.eclipse.rse.core.subsystems.RemoteServerLauncher#getDaemonPort <em>Daemon Port</em>}</li> - * <li>{@link org.eclipse.rse.core.subsystems.RemoteServerLauncher#getServerPath <em>Server Path</em>}</li> - * <li>{@link org.eclipse.rse.core.subsystems.RemoteServerLauncher#getServerScript <em>Server Script</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class RemoteServerLauncher extends ServerLauncher implements IRemoteServerLauncher -{ - - protected static final ServerLaunchType SERVER_LAUNCH_TYPE_EDEFAULT = ServerLaunchType.DAEMON_LITERAL; - - // property set keys - protected final String PROPERTY_SET_NAME = "Launcher Properties"; //$NON-NLS-1$ - private final String PROPERTY_SET_LABEL = RSECoreMessages.RESID_PROPERTYSET_LAUNCHER_PROPERTIES; - - protected final String KEY_DAEMON_PORT = "daemon.port"; //$NON-NLS-1$ - protected final String KEY_REXEC_PORT = "rexec.port"; //$NON-NLS-1$ - protected final String KEY_SERVER_LAUNCH_TYPE_NAME = "server.launch.type.name"; //$NON-NLS-1$ - protected final String KEY_SERVER_PATH = "server.path"; //$NON-NLS-1$ - protected final String KEY_SERVER_SCRIPT = "server.script"; //$NON-NLS-1$ - protected final String KEY_AUTODETECT_SSL = "autodetect.ssl"; //$NON-NLS-1$ - - - protected ServerLaunchType _serverLaunchType = SERVER_LAUNCH_TYPE_EDEFAULT; - - protected boolean _hasSetServerLaunchType = false; - - protected static final int REXEC_PORT_EDEFAULT = 512; - - protected int _rexecPort = REXEC_PORT_EDEFAULT; - - protected static final int DAEMON_PORT_EDEFAULT = 4035; - - protected int _daemonPort = DAEMON_PORT_EDEFAULT; - - protected static final String SERVER_PATH_EDEFAULT = null; - - protected String _serverPath = SERVER_PATH_EDEFAULT; - - protected static final String SERVER_SCRIPT_EDEFAULT = null; - - protected String _serverScript = SERVER_SCRIPT_EDEFAULT; - - protected static final String REMOTE_ATTRIBUTES_EDEFAULT = null; - - protected static final String RESTRICTED_TYPES_EDEFAULT = null; - - protected static final boolean AUTODETECT_SSL_EDEFAULT = true; - - protected boolean _autoDetectSSL = AUTODETECT_SSL_EDEFAULT; - - protected IPropertyType _serverLauncherEnumType; - - public RemoteServerLauncher(String name, IConnectorService connectorService) - { - super(name, connectorService); - } - - public IPropertyType getServerLauncherPropertyType() - { - if (_serverLauncherEnumType == null) - { - // for persistence - List values = Arrays.asList(getSupportedLauncherEnumTypes()); - // DKM - only need supported types - /// ServerLaunchType.VALUES; - - String[] enumValues = new String[values.size()]; - for (int i = 0; i < values.size(); i++) - { - ServerLaunchType type = (ServerLaunchType)values.get(i); - enumValues[i] = type.getName(); - } - _serverLauncherEnumType = PropertyType.getEnumPropertyType(enumValues); - } - return _serverLauncherEnumType; - } - - protected ServerLaunchType[] getSupportedLauncherEnumTypes() - { - return new ServerLaunchType[] - { - ServerLaunchType.DAEMON_LITERAL, - ServerLaunchType.REXEC_LITERAL, - ServerLaunchType.RUNNING_LITERAL - }; - } - - public void restoreFromProperties() - { - IPropertySet set = getPropertySet(PROPERTY_SET_NAME); - if (set != null) - { - try - { - if (set instanceof ILabeledObject) { - ILabeledObject ps = (ILabeledObject) set; - ps.setLabel(PROPERTY_SET_LABEL); - } - IProperty launchTypeProperty = set.getProperty(KEY_SERVER_LAUNCH_TYPE_NAME); - launchTypeProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); - String launchTypeName = launchTypeProperty.getValue(); - _serverLaunchType = ServerLaunchType.get(launchTypeName); - - IProperty daemonPortProperty = set.getProperty(KEY_DAEMON_PORT); - boolean daemon = _serverLaunchType == null || _serverLaunchType.getType() == ServerLaunchType.DAEMON; - daemonPortProperty.setEnabled(daemon); - daemonPortProperty.setLabel(RSECoreMessages.RESID_CONNECTION_DAEMON_PORT_LABEL); - - _daemonPort = Integer.parseInt(daemonPortProperty.getValue()); - - IProperty autoDetectProperty = set.getProperty(KEY_AUTODETECT_SSL); - if (autoDetectProperty != null) - { - boolean autoDetect = _serverLaunchType == null || _serverLaunchType.getType() == ServerLaunchType.REXEC; - autoDetectProperty.setEnabled(autoDetect); - autoDetectProperty.setLabel(RSECoreMessages.RESID_SUBSYSTEM_AUTODETECT_LABEL); - - _autoDetectSSL = Boolean.getBoolean(autoDetectProperty.getValue()); - } - - boolean usingRexec = _serverLaunchType != null && _serverLaunchType.getType() == ServerLaunchType.REXEC; - IProperty rexecPortProperty = set.getProperty(KEY_REXEC_PORT); - rexecPortProperty.setEnabled(usingRexec); - rexecPortProperty.setLabel(RSECoreMessages.RESID_CONNECTION_PORT_LABEL); - - _rexecPort = Integer.parseInt(rexecPortProperty.getValue()); - - IProperty serverPathProperty = set.getProperty(KEY_SERVER_PATH); - serverPathProperty.setEnabled(usingRexec); - serverPathProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_PATH); - _serverPath = serverPathProperty.getValue(); - - IProperty serverScriptProperty = set.getProperty(KEY_SERVER_SCRIPT); - serverScriptProperty.setEnabled(usingRexec); - serverScriptProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_INVOCATION); - _serverScript = serverScriptProperty.getValue(); - - _hasSetServerLaunchType = true; - - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } - - public void saveToProperties() - { - IPropertySet set = getPropertySet(PROPERTY_SET_NAME); - if (set == null) - { - set = createPropertySet(PROPERTY_SET_NAME, getDescription()); - if (set instanceof ILabeledObject) { - ((ILabeledObject)set).setLabel(PROPERTY_SET_LABEL); - } - } - - if (_serverLaunchType == null) - _serverLaunchType = ServerLaunchType.get(ServerLaunchType.DAEMON); - IProperty launchTypeProperty = set.addProperty(KEY_SERVER_LAUNCH_TYPE_NAME, _serverLaunchType.getName(), getServerLauncherPropertyType()); - launchTypeProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); - - IProperty daemonPortProperty = set.addProperty(KEY_DAEMON_PORT, ""+_daemonPort, PropertyType.getIntegerPropertyType()); //$NON-NLS-1$ - daemonPortProperty.setEnabled(_serverLaunchType.getType() == ServerLaunchType.DAEMON); - daemonPortProperty.setLabel(RSECoreMessages.RESID_CONNECTION_DAEMON_PORT_LABEL); - - IProperty rexecPortProperty = set.addProperty(KEY_REXEC_PORT, ""+_rexecPort, PropertyType.getIntegerPropertyType()); //$NON-NLS-1$ - boolean usingRexec = _serverLaunchType.getType() == ServerLaunchType.REXEC; - rexecPortProperty.setEnabled(usingRexec); - rexecPortProperty.setLabel(RSECoreMessages.RESID_CONNECTION_PORT_LABEL); - - IProperty autoDetectSSLProperty = set.addProperty(KEY_AUTODETECT_SSL, ""+_autoDetectSSL, PropertyType.getBooleanPropertyType()); //$NON-NLS-1$ - autoDetectSSLProperty.setEnabled(usingRexec); - autoDetectSSLProperty.setLabel(RSECoreMessages.RESID_SUBSYSTEM_AUTODETECT_LABEL); - - IProperty serverPathProperty = set.addProperty(KEY_SERVER_PATH, ""+_serverPath); //$NON-NLS-1$ - serverPathProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_PATH); - serverPathProperty.setEnabled(usingRexec); - - IProperty serverScriptProperty = set.addProperty(KEY_SERVER_SCRIPT, ""+_serverScript); //$NON-NLS-1$ - serverScriptProperty.setEnabled(usingRexec); - serverScriptProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_INVOCATION); - } - - - /** - * Clone the contents of this server launcher into the given server launcher - * <i>Your sublcass must override this if you add additional attributes! Be sure - * to call super.cloneServerLauncher(newOne) first.</i> - * @return the given new server launcher, for convenience. - */ - public IServerLauncherProperties cloneServerLauncher(IServerLauncherProperties newOne) - { - super.cloneServerLauncher(newOne); - IRemoteServerLauncher remoteNewOne = (IRemoteServerLauncher)newOne; - remoteNewOne.addPropertySets(getPropertySets()); - remoteNewOne.setDaemonPort(getDaemonPort()); - remoteNewOne.setRexecPort(getRexecPort()); - remoteNewOne.setServerLaunchType(getServerLaunchTypeGen()); - remoteNewOne.setServerPath(getServerPath()); - remoteNewOne.setServerScript(getServerScript()); - remoteNewOne.setAutoDetectSSL(getAutoDetectSSL()); - return remoteNewOne; - } - - /** - * <!-- begin-user-doc --> - * This is the means by which to start the server-side code, as specified by the user, typically. - * <!-- end-user-doc --> - */ - public ServerLaunchType getServerLaunchType() - { - if (!isSetServerLaunchType()) - { - if (isEnabledServerLaunchType(ServerLaunchType.DAEMON_LITERAL)) - return ServerLaunchType.DAEMON_LITERAL; - else if (isEnabledServerLaunchType(ServerLaunchType.REXEC_LITERAL)) - return ServerLaunchType.REXEC_LITERAL; - else if (isEnabledServerLaunchType(ServerLaunchType.RUNNING_LITERAL)) - return ServerLaunchType.RUNNING_LITERAL; - else if (isEnabledServerLaunchType(ServerLaunchType.TELNET_LITERAL)) - return ServerLaunchType.TELNET_LITERAL; - else if (isEnabledServerLaunchType(ServerLaunchType.SSH_LITERAL)) - return ServerLaunchType.SSH_LITERAL; - else if (isEnabledServerLaunchType(ServerLaunchType.FTP_LITERAL)) - return ServerLaunchType.FTP_LITERAL; - else - return ServerLaunchType.HTTP_LITERAL; - } - return _serverLaunchType; - } - /** - * <!-- begin-user-doc --> - * Generated. Do not call or use. - * <!-- end-user-doc --> - * @generated - */ - public ServerLaunchType getServerLaunchTypeGen() - { - return _serverLaunchType; - } - - /** - * <!-- begin-user-doc --> - * This is the means by which to start the server-side code, as specified by the user, typically. - * It is one of the constants in the enumeration class {@link org.eclipse.rse.core.subsystems.ServerLaunchType} - * <!-- end-user-doc --> - * @generated - */ - public void setServerLaunchType(ServerLaunchType newServerLaunchType) - { - ServerLaunchType oldServerLaunchType = _serverLaunchType; - if (oldServerLaunchType != newServerLaunchType) - { - _serverLaunchType = newServerLaunchType == null ? SERVER_LAUNCH_TYPE_EDEFAULT : newServerLaunchType; - _hasSetServerLaunchType = true; - setDirty(true); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSetServerLaunchType() - { - return _hasSetServerLaunchType; - } - - /** - * Return the port used for the REXEC option, as an Integer - */ - public int getRexecPort() - { - return _rexecPort; - } - /** - * Set the REXEC port value, as an int - */ - public void setRexecPort(int newRexecPort) - { - if (newRexecPort != _rexecPort) - { - _rexecPort = newRexecPort; - setDirty(true); - } - } - - /** - * Return the whether or not to auto-detect SSL - */ - public boolean getAutoDetectSSL() - { - return _autoDetectSSL; - } - /** - * Sets whether or not to auto-detect SSL - */ - public void setAutoDetectSSL(boolean auto) - { - if (auto != _autoDetectSSL) - { - _autoDetectSSL = auto; - setDirty(true); - } - } - - /** - * Return the port used for the DAEMON option, as an Integer - */ - public int getDaemonPort() - { - return _daemonPort; - } - /** - * Set the DAEMON port value, as an int - */ - public void setDaemonPort(int newDaemonPort) - { - if (_daemonPort != newDaemonPort) - { - _daemonPort = newDaemonPort; - setDirty(true); - } - } - - /** - * <!-- begin-user-doc --> - * The path where the server lives on the remote system. Used by at least the REXEC server launch type. - * Will be null if not set. - * <!-- end-user-doc --> - */ - public String getServerPath() - { - String serverPath = _serverPath; - if ((serverPath == null) || (serverPath.length() == 0)) - { - serverPath = RemoteServerLauncherConstants.DEFAULT_REXEC_PATH; - } - return serverPath; - } - /** - * <!-- begin-user-doc --> - * The path where the server lives on the remote system. Used by at least the REXEC server launch type. - * <!-- end-user-doc --> - * @generated - */ - public void setServerPath(String newServerPath) - { - String oldServerPath = _serverPath; - if (oldServerPath == null || !oldServerPath.equals(newServerPath)) - { - _serverPath = newServerPath; - setDirty(true); - } - } - - /** - * <!-- begin-user-doc --> - * The script to run on the remote system, to start the server code. - * <!-- end-user-doc --> - */ - public String getServerScript() - { - String serverScript = _serverScript; - - if ((serverScript == null) || (serverScript.length() == 0)) - { - serverScript = "server." + getConnectorService().getHost().getSystemType().getName().toLowerCase(); //$NON-NLS-1$ - } - - return serverScript; - } - - - public void setServerScript(String newServerScript) - { - String oldServerScript = _serverScript; - if (oldServerScript != newServerScript) - { - _serverScript = newServerScript; - setDirty(true); - } - } - - /** - * This methods returns the enablement state per server launch type. - * If {@link #enableServerLaunchType(ServerLaunchType,boolean)} has not been - * called for this server launch type, then we defer to the subsystem factory's - * method: - * {@link ISubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}. - * @see org.eclipse.rse.core.subsystems.ServerLaunchType - */ - public boolean isEnabledServerLaunchType(ServerLaunchType serverLaunchType) - { - IPropertySet set = getPropertySet("restrictedTypes"); //$NON-NLS-1$ - if (set != null) - { - String value = set.getPropertyValue(serverLaunchType.getName()); - if (value != null) - { - return value.equals("true"); //$NON-NLS-1$ - } - } - - ISubSystem primarySS = getConnectorService().getPrimarySubSystem(); - if (primarySS != null) - { - return primarySS.getSubSystemConfiguration().supportsServerLaunchType(serverLaunchType); - - } - return true; - } - - - - - /** - * @deprecated - */ - public void setRestrictedType(String attributeName, String attributeValue) - { - IPropertySet set = getPropertySet("restrictedTypes"); //$NON-NLS-1$ - if (set == null) - { - set = createPropertySet("restrictedTypes", getDescription()); //$NON-NLS-1$ - } - set.addProperty(attributeName, attributeValue); - } - - public void enableServerLaunchType(ServerLaunchType serverLaunchType, boolean enable) { - // TODO Auto-generated method stubS - - } - -} //RemoteServerLauncherImpl
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncherConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncherConstants.java deleted file mode 100644 index bd403025c..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncherConstants.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - ********************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -/** - * This interface defines constants for the Remote Server Launcher. - */ -public interface RemoteServerLauncherConstants -{ - - /** - * Default daemon port, 4035. - */ - public static final int DEFAULT_DAEMON_PORT = 4035; - - /** - * Default REXEC port, 512. - */ - public static final int DEFAULT_REXEC_PORT = 512; - - /** - * Default REXEC path, "/opt/rseserver/". - */ - public static final String DEFAULT_REXEC_PATH = "/opt/rseserver/"; //$NON-NLS-1$ - - /** - * Linux REXEC script command, "perl ./server.pl". - */ - public static final String LINUX_REXEC_SCRIPT = "sh -c \"PATH=/opt/j2sdk1.4.2/bin:$PATH; export PATH; perl ./server.pl\""; //$NON-NLS-1$ - - /** - * Unix REXEC script command, "./server.sh". - */ - public static final String UNIX_REXEC_SCRIPT = "sh -c \"PATH=/opt/j2sdk1.4.2/bin:$PATH; export PATH; sh server.sh\""; //$NON-NLS-1$ - - /** - * Default REXEC script command. TIt is equivalent to <code>LINUX_REXEC_SCRIPT</code>. - */ - public static final String DEFAULT_REXEC_SCRIPT = LINUX_REXEC_SCRIPT; -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ServerLaunchType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ServerLaunchType.java deleted file mode 100644 index 396d09edd..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ServerLaunchType.java +++ /dev/null @@ -1,275 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core.subsystems; - -import java.util.Arrays; -import java.util.List; - -public final class ServerLaunchType { - /** - * The '<em><b>Daemon</b></em>' literal value. - * <!-- begin-user-doc --> - * The server code is to be launched by calling a daemon that is listening on a port. - * <!-- end-user-doc --> - * @see #DAEMON_LITERAL - * @model name="Daemon" - * @generated - * @ordered - */ - public static final int DAEMON = 0; - - /** - * The '<em><b>Rexec</b></em>' literal value. - * <!-- begin-user-doc --> - * The server code is to be launched using REXEC - * <!-- end-user-doc --> - * @see #REXEC_LITERAL - * @model name="Rexec" - * @generated - * @ordered - */ - public static final int REXEC = 1; - - /** - * The '<em><b>Running</b></em>' literal value. - * <!-- begin-user-doc --> - * The server code is to already running, and doesn't need to be launched. - * <!-- end-user-doc --> - * @see #RUNNING_LITERAL - * @model name="Running" - * @generated - * @ordered - */ - public static final int RUNNING = 2; - - /** - * The '<em><b>Telnet</b></em>' literal value. - * <!-- begin-user-doc --> - * The server code is to be launched using TELNET. - * <!-- end-user-doc --> - * @see #TELNET_LITERAL - * @model name="Telnet" - * @generated - * @ordered - */ - public static final int TELNET = 3; - - /** - * The '<em><b>SSH</b></em>' literal value. - * <!-- begin-user-doc --> - * The server code is to be launched using SSH. - * <!-- end-user-doc --> - * @see #SSH_LITERAL - * @model - * @generated - * @ordered - */ - public static final int SSH = 4; - - /** - * The '<em><b>FTP</b></em>' literal value. - * <!-- begin-user-doc --> - * The server code is to be launched using FTP - * <!-- end-user-doc --> - * @see #FTP_LITERAL - * @model - * @generated - * @ordered - */ - public static final int FTP = 5; - - /** - * The '<em><b>HTTP</b></em>' literal value. - * <!-- begin-user-doc --> - * The server code is to be launched using HTTP - * <!-- end-user-doc --> - * @see #HTTP_LITERAL - * @model - * @generated - * @ordered - */ - public static final int HTTP = 6; - - /** - * The '<em><b>Daemon</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * The server code is to be launched by calling a daemon that is listening on a port. - * </p> - * <!-- end-user-doc --> - * @see #DAEMON - * @generated - * @ordered - */ - public static final ServerLaunchType DAEMON_LITERAL = new ServerLaunchType(DAEMON, "Daemon"); //$NON-NLS-1$ - - /** - * The '<em><b>Rexec</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * The server code is to be launched using REXEC - * </p> - * <!-- end-user-doc --> - * @see #REXEC - * @generated - * @ordered - */ - public static final ServerLaunchType REXEC_LITERAL = new ServerLaunchType(REXEC, "Rexec"); //$NON-NLS-1$ - - /** - * The '<em><b>Running</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * The server code is to already running, and doesn't need to be launched. - * </p> - * <!-- end-user-doc --> - * @see #RUNNING - * @generated - * @ordered - */ - public static final ServerLaunchType RUNNING_LITERAL = new ServerLaunchType(RUNNING, "Running"); //$NON-NLS-1$ - - /** - * The '<em><b>Telnet</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * The server code is to be launched using TELNET. - * </p> - * <!-- end-user-doc --> - * @see #TELNET - * @generated - * @ordered - */ - public static final ServerLaunchType TELNET_LITERAL = new ServerLaunchType(TELNET, "Telnet"); //$NON-NLS-1$ - - /** - * The '<em><b>SSH</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>SSH</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #SSH - * @generated - * @ordered - */ - public static final ServerLaunchType SSH_LITERAL = new ServerLaunchType(SSH, "SSH"); //$NON-NLS-1$ - - /** - * The '<em><b>FTP</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * The server code is to be launched using FTP - * </p> - * <!-- end-user-doc --> - * @see #FTP - * @generated - * @ordered - */ - public static final ServerLaunchType FTP_LITERAL = new ServerLaunchType(FTP, "FTP"); //$NON-NLS-1$ - - /** - * The '<em><b>HTTP</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * The server code is to be launched using HTTP - * </p> - * <!-- end-user-doc --> - * @see #HTTP - * @generated - * @ordered - */ - public static final ServerLaunchType HTTP_LITERAL = new ServerLaunchType(HTTP, "HTTP"); //$NON-NLS-1$ - - /** - * An array of all the '<em><b>Server Launch Type</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final ServerLaunchType[] VALUES_ARRAY = new ServerLaunchType[] { DAEMON_LITERAL, REXEC_LITERAL, RUNNING_LITERAL, TELNET_LITERAL, SSH_LITERAL, FTP_LITERAL, HTTP_LITERAL, }; - - private String _name; - private int _value; - - /** - * A public read-only list of all the '<em><b>Server Launch Type</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List VALUES = Arrays.asList(VALUES_ARRAY); - - /** - * Returns the '<em><b>Server Launch Type</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static ServerLaunchType get(String name) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - ServerLaunchType result = VALUES_ARRAY[i]; - if (result.getName().equals(name)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Server Launch Type</b></em>' literal with the specified value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static ServerLaunchType get(int value) { - switch (value) { - case DAEMON: - return DAEMON_LITERAL; - case REXEC: - return REXEC_LITERAL; - case RUNNING: - return RUNNING_LITERAL; - case TELNET: - return TELNET_LITERAL; - case SSH: - return SSH_LITERAL; - case FTP: - return FTP_LITERAL; - case HTTP: - return HTTP_LITERAL; - } - return null; - } - - public String getName() { - return _name; - } - - public int getType() { - return _value; - } - - private ServerLaunchType(int value, String name) { - _name = name; - _value = value; - - } - -} //ServerLaunchType diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemFilterNamingPolicy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemFilterNamingPolicy.java deleted file mode 100644 index 7256d1fee..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemFilterNamingPolicy.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.subsystems; - -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; -import org.eclipse.rse.core.filters.SystemFilterNamingPolicy; - -/** - * A filter naming policy is responsible for returning the save file names for - * a given filter framework object. - * This policy implements our naming policy for the filter files in the - * remote systems project. - */ -public class SubSystemFilterNamingPolicy extends SystemFilterNamingPolicy implements IRSEFilterNamingPolicy { - - /** - * Constructor for SubSystemFilterNamingPolicy - */ - public SubSystemFilterNamingPolicy() { - super(); - } - - /** - * Get the unqualified save file name for the given SystemFilterPoolManager object. - * Do NOT include the extension, as .xmi will be added. - * <p> - * Returns "filterPools_"+managerName by default. - */ - public String getManagerSaveFileName(String managerName) { - return super.getManagerSaveFileName(managerName); - } - - /** - * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object. - * Do NOT include the extension, as .xmi will be added. - * <p> - * Returns "filterPoolRefs_"+managerName by default. - */ - public String getReferenceManagerSaveFileName(String managerName) { - return super.getReferenceManagerSaveFileName(managerName); - } - - /** - * Get the unqualified save file name for the given SystemFilterPool object. - * Do NOT include the extension, as .xmi will be added. - * <p> - * Returns getFilterPoolSaveFileNamePrefix()+poolName by default. - */ - public String getFilterPoolSaveFileName(String poolName) { - return super.getFilterPoolSaveFileName(poolName); - } - - /** - * Get the file name prefix for all pool files. - * Used to deduce the saved pools by examining the file system - * <p> - * By default returns "filterPool_" - */ - public String getFilterPoolSaveFileNamePrefix() { - return super.getFilterPoolSaveFileNamePrefix(); - } - - /** - * Get the folder name for the given SystemFilterPool object. - * <p> - * Returns getFilterPoolFolderNamePrefix()+poolName by default. - */ - public String getFilterPoolFolderName(String poolName) { - return super.getFilterPoolFolderName(poolName); - } - - /** - * Get the folder name prefix for all pool folders. - * Used to deduce the saved pools by examining the file system - * <p> - * By default returns "FilterPool_" - */ - public String getFilterPoolFolderNamePrefix() { - return super.getFilterPoolFolderNamePrefix(); - } - - /** - * Get the unqualified save file name for the given SystemFilter object. - * Do NOT include the extension, as .xmi will be added. - * <p> - * Returns getFilterSaveFileNamePrefix()+filterName by default. - */ - public String getFilterSaveFileName(String filterName) { - return super.getFilterSaveFileName(filterName); - } - - /** - * Get the file name prefix for all filter files. - * Used to deduce the saved filters by examining the file system - * <p> - * Returns "Filter_" by default. - */ - public String getFilterSaveFileNamePrefix() { - return super.getFilterSaveFileNamePrefix(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemHelpers.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemHelpers.java deleted file mode 100644 index 9c68d1f4d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemHelpers.java +++ /dev/null @@ -1,114 +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.core.subsystems; - -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterContainer; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.model.ISystemProfile; - -/** - * Static helper methods - */ -public class SubSystemHelpers -{ - - /** - * Give a filter pool reference, return parent subsystem - * Returns this: <pre><code>(SubSystem)poolReference.getProvider()</pre></code>. - */ - public static ISubSystem getParentSubSystem(ISystemFilterPoolReference poolReference) - { - return (ISubSystem)poolReference.getProvider(); - } - - - - - - /** - * Give a filter pool, return parent subsystem factory - */ - public static ISubSystemConfiguration getParentSubSystemConfiguration(ISystemFilterPool pool) - { - return (ISubSystemConfiguration)pool.getProvider(); - } - - /** - * Give a filter, return parent subsystem factory - */ - public static ISubSystemConfiguration getParentSubSystemConfiguration(ISystemFilter filter) - { - return (ISubSystemConfiguration)filter.getProvider(); - } - - /** - * Give a filter pool or filter, return parent subsystem factory - */ - public static ISubSystemConfiguration getParentSubSystemConfiguration(ISystemFilterContainer container) - { - if (container instanceof ISystemFilterPool) - return getParentSubSystemConfiguration((ISystemFilterPool)container); - else - return getParentSubSystemConfiguration((ISystemFilter)container); - } - - - /** - * Give a filter pool reference, return parent subsystem factory - */ - public static ISubSystemConfiguration getParentSubSystemConfiguration(ISystemFilterPoolReference poolRef) - { - ISystemFilterPool pool = poolRef.getReferencedFilterPool(); - if (pool != null) - return getParentSubSystemConfiguration(pool); - else - return null; - } - - /** - * Give a filter reference, return parent subsystem factory - */ - public static ISubSystemConfiguration getParentSubSystemConfiguration(ISystemFilterReference filterRef) - { - ISystemFilter filter = filterRef.getReferencedFilter(); - if (filter != null) - return getParentSubSystemConfiguration(filter); - else - return null; - } - - /** - * Give a filter pool, return its parent filter pool manager - */ - public static ISystemFilterPoolManager getParentSystemFilterPoolManager(ISystemFilterPool pool) - { - return pool.getSystemFilterPoolManager(); - } - /** - * Give a filter pool, return its parent profile - */ - public static ISystemProfile getParentSystemProfile(ISystemFilterPool pool) - { - return getParentSubSystemConfiguration(pool).getSystemProfile(pool); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/IRemoteSystemsProject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/IRemoteSystemsProject.java deleted file mode 100644 index bee32284c..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/IRemoteSystemsProject.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2000, 2007 IBM Corporation. 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.core; - -import org.eclipse.core.resources.IProject; - -/** - * Therei is exactly one remote systems project. It is created by the plugin if it does - * not exist already. It is never created by the user. - * <p> - */ -public interface IRemoteSystemsProject -{ - /** - * Returns the <code>IProject</code> on which this <code>IJavaProject</code> - * was created. This is handle-only method. - */ - IProject getProject(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java deleted file mode 100644 index a96792edd..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java +++ /dev/null @@ -1,56 +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 - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - * Martin Oberhuber (Wind River) - [184095] combined RSEModelResources and persistence.Messages into this file - ********************************************************************************/ -package org.eclipse.rse.internal.core; - -import org.eclipse.osgi.util.NLS; - -public class RSECoreMessages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.rse.internal.core.messages"; //$NON-NLS-1$ - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, RSECoreMessages.class); - } - - // Model - public static String RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION; - public static String RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION; - public static String RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION; - public static String RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION; - public static String RESID_MODELOBJECTS_PROFILE_DESCRIPTION; - public static String RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION; - public static String RESID_MODELOBJECTS_FILTER_DESCRIPTION; - public static String RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION; - - public static String RESID_PROP_SERVERLAUNCHER_MEANS_LABEL; - public static String RESID_PROP_SERVERLAUNCHER_PATH; - public static String RESID_PROP_SERVERLAUNCHER_INVOCATION; - public static String RESID_CONNECTION_DAEMON_PORT_LABEL; - public static String RESID_CONNECTION_PORT_LABEL; - public static String RESID_SUBSYSTEM_AUTODETECT_LABEL; - - public static String RESID_PROPERTYSET_REMOTE_SERVER_LAUNCHER; - public static String RESID_PROPERTYSET_LAUNCHER_PROPERTIES; - - // Persistence - public static String PropertyFileProvider_LoadingTaskName; - public static String PropertyFileProvider_SavingTaskName; - public static String PropertyFileProvider_UnexpectedException; - public static String RSEPersistenceManager_DeleteProfileJobName; - public static String SaveRSEDOMJob_SavingProfileJobName; - public static String SerializingProvider_UnexpectedException; - - // Password Persistence Manager - public static String DefaultSystemType_Label; - - private RSECoreMessages() { - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreRegistry.java deleted file mode 100644 index 7a4fa21ba..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreRegistry.java +++ /dev/null @@ -1,209 +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: - * Uwe Stieber (Wind River) - Added system types provider extension. - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - ********************************************************************************/ -package org.eclipse.rse.internal.core; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.IRSECoreRegistry; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.IRSESystemTypeProvider; -import org.eclipse.rse.core.RSECorePlugin; - -/** - * Singleton class representing the RSE core registry. - */ -public class RSECoreRegistry implements IRSECoreRegistry { - - // the singleton instance - private static RSECoreRegistry instance = null; - - // state variables - private boolean hasReadSystemTypes; - - // model objects - private IRSESystemType[] systemTypes; - - // Cache for accessed system type either by id or by name. Avoids to - // re-iterate over all registered ones each call again. - private final Map accessedSystemTypeCache = new HashMap(); - - // constants - private static final String ELEMENT_SYTEM_TYPE = "systemType"; //$NON-NLS-1$ - - /** - * Constructor. - */ - private RSECoreRegistry() { - super(); - } - - /** - * Returns the singleton instance of the registry. - * @return the singleton instance - */ - public static final RSECoreRegistry getInstance() { - - if (instance == null) { - instance = new RSECoreRegistry(); - } - - return instance; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSECoreRegistry#getSystemTypes() - */ - public IRSESystemType[] getSystemTypes() { - - if (!hasReadSystemTypes) { - systemTypes = readSystemTypes(); - hasReadSystemTypes = true; - } - - return systemTypes; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSECoreRegistry#getSystemTypeById(java.lang.String) - */ - public IRSESystemType getSystemTypeById(String systemTypeId) { - if (systemTypeId != null) { - IRSESystemType systemType = (IRSESystemType)accessedSystemTypeCache.get(systemTypeId); - if (systemType == null) { - // We have to re-lookup the system type - IRSESystemType[] types = getSystemTypes(); - for (int i = 0; i < types.length && systemType == null; i++) { - if (types[i].getId().equals(systemTypeId)) { - systemType = types[i]; - } - } - if (systemType != null) accessedSystemTypeCache.put(systemTypeId, systemType); - } - return systemType; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSECoreRegistry#getSystemType(java.lang.String) - */ - public IRSESystemType getSystemType(String name) { - if (name != null) { - IRSESystemType systemType = (IRSESystemType)accessedSystemTypeCache.get(name); - if (systemType == null) { - // We have to re-lookup the system type - IRSESystemType[] types = getSystemTypes(); - for (int i = 0; i < types.length && systemType == null; i++) { - if (types[i].getName().equals(name)) { - systemType = types[i]; - } - } - if (systemType != null) accessedSystemTypeCache.put(name, systemType); - } - return systemType; - } - - return null; - } - - /** - * Reads system types from the extension point registry and returns the defined system types. - * - * @return An array of system types that have been defined. - */ - private IRSESystemType[] readSystemTypes() { - List types = new LinkedList(); - List typeIds = new ArrayList(); - accessedSystemTypeCache.clear(); - - IExtensionRegistry registry = Platform.getExtensionRegistry(); - - // First we take the direct system type contributions via extension point - IConfigurationElement[] elements = registry.getConfigurationElementsFor(PI_RSE_CORE, PI_SYSTEM_TYPES); - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - - if (element.getName().equals(ELEMENT_SYTEM_TYPE)) { - IRSESystemType type = new RSESystemType(element); - if (!typeIds.contains(type.getId())) { - types.add(type); - typeIds.add(type.getId()); - - // Build up the cache directly for improving access performance. - accessedSystemTypeCache.put(type.getId(), type); - accessedSystemTypeCache.put(type.getName(), type); - - String message = "Successfully registered RSE system type ''{0}'' (id = ''{1}'')."; //$NON-NLS-1$ - message = MessageFormat.format(message, new Object[] { type.getLabel(), type.getId() }); - RSECorePlugin.getDefault().getLogger().logInfo(message); - } else { - String message = "RSE system type contribution skipped. Non-unique system type id (plugin: {0}, id: {1})."; //$NON-NLS-1$ - message = MessageFormat.format(message, new Object[] { element.getContributor().getName(), type.getId()}); - RSECorePlugin.getDefault().getLogger().logWarning(message); - } - } - } - - // check on the IRSESystemTypeProviders now - elements = registry.getConfigurationElementsFor(PI_RSE_CORE, PI_SYSTEM_TYPES_PROVIDER); - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - try { - Object provider = element.createExecutableExtension("class"); //$NON-NLS-1$ - if (provider instanceof IRSESystemTypeProvider) { - IRSESystemType[] typesForRegistration = ((IRSESystemTypeProvider)provider).getSystemTypesForRegistration(); - if (typesForRegistration == null) continue; - - for (int j = 0; j < typesForRegistration.length; j++) { - IRSESystemType type = typesForRegistration[j]; - if (!typeIds.contains(type.getId())) { - types.add(type); - typeIds.add(type.getId()); - - // Build up the cache directly for improving access performance. - accessedSystemTypeCache.put(type.getId(), type); - accessedSystemTypeCache.put(type.getName(), type); - - String message = "Successfully registered RSE system type ''{0}'' (id = ''{1}'')."; //$NON-NLS-1$ - message = MessageFormat.format(message, new Object[] { type.getLabel(), type.getId() }); - RSECorePlugin.getDefault().getLogger().logInfo(message); - } else { - String message = "RSE system type contribution skipped. Non-unique system type id (plugin: {0}, id: {1})."; //$NON-NLS-1$ - message = MessageFormat.format(message, new Object[] { element.getContributor().getName(), type.getId()}); - RSECorePlugin.getDefault().getLogger().logWarning(message); - } - } - } - } catch (CoreException e) { - String message = "RSE system types provider failed creation (plugin: {0}, id: {1})."; //$NON-NLS-1$ - message = MessageFormat.format(message, new Object[] { element.getContributor().getName(), element.getDeclaringExtension().getSimpleIdentifier()}); - RSECorePlugin.getDefault().getLogger().logError(message, e); - } - } - - return (IRSESystemType[])types.toArray(new IRSESystemType[types.size()]); - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEPreferenceInitializer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEPreferenceInitializer.java deleted file mode 100644 index ce8774a33..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEPreferenceInitializer.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007 IBM Corporation. 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 - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - ********************************************************************************/ -package org.eclipse.rse.internal.core; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.rse.core.IRSEPreferenceNames; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.RSEPreferencesManager; - -public class RSEPreferenceInitializer extends AbstractPreferenceInitializer { - - public void initializeDefaultPreferences() { - // the complex preferences - RSEPreferencesManager.initDefaults(); - - // the simple preferences - Preferences prefs = RSECorePlugin.getDefault().getPluginPreferences(); - // The ID of the default persistence provider - prefs.setDefault(IRSEPreferenceNames.DEFAULT_PERSISTENCE_PROVIDER, "org.eclipse.rse.persistence.MetadataPropertyFileProvider"); //$NON-NLS-1$ - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSESystemType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSESystemType.java deleted file mode 100644 index 9ba79a277..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSESystemType.java +++ /dev/null @@ -1,113 +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: - * Uwe Stieber (Wind River) - Dynamic system type provider extension. - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - ********************************************************************************/ -package org.eclipse.rse.internal.core; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.IRSESystemTypeConstants; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.AbstractRSESystemType; - -/** - * Class representing a system type statically contributed through plugin.xml. - */ -public class RSESystemType extends AbstractRSESystemType { - - private static final String ATTR_ID = "id"; //$NON-NLS-1$ - private static final String ATTR_NAME = "name"; //$NON-NLS-1$ - private static final String ATTR_LABEL = "label"; //$NON-NLS-1$ - private static final String ATTR_DESCRIPTION = "description"; //$NON-NLS-1$ - private static final String ATTR_ICON = "icon"; //$NON-NLS-1$ - private static final String ATTR_ICONLIVE = "iconLive"; //$NON-NLS-1$ - private static final String ATTR_ENABLEOFFLINE = "enableOffline"; //$NON-NLS-1$ - private static final String ATTR_VALUE = "value"; //$NON-NLS-1$ - private static final String ATTR_SUBSYSTEMCONFIGURATIONS = "subsystemConfigurationIds"; //$NON-NLS-1$ - - private String[] subsystemConfigurationIds; - - /** - * Constructor for an object representing a system type. - * @param element the configuration element describing the system type - */ - public RSESystemType(IConfigurationElement element) { - super(); - id = element.getAttribute(ATTR_ID); - name = element.getAttribute(ATTR_NAME); - if (id==null) { - RSECorePlugin.getDefault().getLogger().logWarning("RSE: System Type \""+name+"\" does not define an ID"); //$NON-NLS-1$ //$NON-NLS-2$ - //Fallback: use the name as ID. When PDE was used to define the - //extension, this should never happen since ID is marked as a - //required attribute. - id = name; - } - label = element.getAttribute(ATTR_LABEL); - description = element.getAttribute(ATTR_DESCRIPTION); - - loadProperties(element); - - String icon = element.getAttribute(ATTR_ICON); - if (icon != null) properties.put(IRSESystemTypeConstants.ICON, icon); - String iconLive = element.getAttribute(ATTR_ICONLIVE); - if (iconLive != null) properties.put(IRSESystemTypeConstants.ICON_LIVE, iconLive); - String enableOffline = element.getAttribute(ATTR_ENABLEOFFLINE); - if (enableOffline != null) properties.put(IRSESystemTypeConstants.ENABLE_OFFLINE, enableOffline); - - definingBundle = Platform.getBundle(element.getContributor().getName()); - - List subsystemConfigs = new LinkedList(); - String attribute = element.getAttribute(ATTR_SUBSYSTEMCONFIGURATIONS); - if (attribute != null) { - // split the list of subsystem configuration ids. - String[] splitted = attribute.split(";"); //$NON-NLS-1$ - // normalize the list of subsystem configuration ids - for (int i = 0; i < splitted.length; i++) { - subsystemConfigs.add(splitted[i].trim()); - } - } - subsystemConfigurationIds = (String[])subsystemConfigs.toArray(new String[subsystemConfigs.size()]); - } - - /** - * Loads properties defined for the system type. - * @param element the configuration element - */ - private void loadProperties(IConfigurationElement element) { - IConfigurationElement[] children = element.getChildren(); - properties = new HashMap(children.length); - - for (int i = 0; i < children.length; i++) { - IConfigurationElement child = children[i]; - String key = child.getAttribute(ATTR_NAME); - String value = child.getAttribute(ATTR_VALUE); - - if (key != null && value != null) properties.put(key, value); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getSubsystemConfigurationIds() - */ - public String[] getSubsystemConfigurationIds() { - return subsystemConfigurationIds; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RemoteSystemsProject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RemoteSystemsProject.java deleted file mode 100644 index db9b03f1b..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RemoteSystemsProject.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. 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.core; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.rse.core.RSECorePlugin; - - -/** - * Handle for a Remote Systems Project - * - * <p>A Remote Systems Project is a singleton created initially by the - * remote systems plugin. It is a container for all the connections and - * subsystems defined for working with remote systems. - * - * @see IRemoteSystemsProject - */ -public class RemoteSystemsProject extends PlatformObject - implements IRemoteSystemsProject, IProjectNature -{ - - /** - * ID of the nature for the remote system explorer project: "org.eclipse.rse.ui.remotesystemsnature" - */ - public static final String ID = "org.eclipse.rse.ui.remotesystemsnature"; //$NON-NLS-1$ - /** - * Name of the nature for the remote system explorer project: "Remote Systems Nature" - */ - public static final String NAME = "Remote Systems Nature"; //$NON-NLS-1$ - /** - * An empty array of strings indicating that a project doesn't have any prerequesite projects. - */ - protected static final String[] NO_PREREQUISITES= new String[0]; - - /** - * The platform project this <code>IRemoteProject</code> is based on - */ - protected IProject fProject; - - /** - * Constructor needed for <code>IProject.getNature()</code> and <code>IProject.addNature()</code>. - * - * @see #setProject - */ - public RemoteSystemsProject() - { - super(); - } - public RemoteSystemsProject(IProject project) - { - super(); - fProject= project; - } - - public void setProject(IProject project) - { - RSECorePlugin.getDefault().getLogger().logInfo("Inside setProject"); //$NON-NLS-1$ - fProject= project; - } - /** - * Configure the project with Java nature. - */ - public void configure() throws CoreException - { - RSECorePlugin.getDefault().getLogger().logInfo("Inside configure"); //$NON-NLS-1$ - } - /** - * Removes the Java nature from the project. - */ - public void deconfigure() throws CoreException - { - } - public IProject getProject() - { - return fProject; - } - public int hashCode() - { - return fProject.hashCode(); - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/SystemResourceConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/SystemResourceConstants.java deleted file mode 100644 index ca8267809..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/SystemResourceConstants.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. 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 Dykstal (IBM) - removed RESOURCE_TEAMPROFILE_NAME - ********************************************************************************/ - -package org.eclipse.rse.internal.core; - - -/** - * Constants related to project and folder names. - */ -public interface SystemResourceConstants -{ - - public static final String RESOURCE_PROJECT_NAME = "RemoteSystemsConnections"; //$NON-NLS-1$ - public static final String RESOURCE_TEMPFILES_PROJECT_NAME= "RemoteSystemsTempFiles"; //$NON-NLS-1$ - public static final String RESOURCE_CONNECTIONS_FOLDER_NAME = "Connections"; //$NON-NLS-1$ - public static final String RESOURCE_FILTERS_FOLDER_NAME = "Filters"; //$NON-NLS-1$ - public static final String RESOURCE_TYPE_FILTERS_FOLDER_NAME = "TypeFilters"; //$NON-NLS-1$ - public static final String RESOURCE_USERACTIONS_FOLDER_NAME = "UserActions"; //$NON-NLS-1$ - public static final String RESOURCE_COMPILECOMMANDS_FOLDER_NAME = "CompileCommands"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/ISystemFilterConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/ISystemFilterConstants.java deleted file mode 100644 index a4857eb71..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/ISystemFilterConstants.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. 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 Dykstal (IBM) - removing extension of ISystemFilterSavePolicies - ********************************************************************************/ - -package org.eclipse.rse.internal.core.filters; - -/** - * Constants used throughout filters framework. - */ -public interface ISystemFilterConstants { - /** - * Parameter value on create operations when a restore should be attempted first - */ - public static final boolean TRY_TO_RESTORE_YES = true; - /** - * Parameter value on create operations when no restore should be attempted first - */ - public static final boolean TRY_TO_RESTORE_NO = false; - - /** - * Suffix used when persisting data to a file. - */ - public static final String SAVEFILE_SUFFIX = ".xmi"; //$NON-NLS-1$ - - /** - * Default value for the type attribute for filter pools, filters and filterstrings - */ - public static final String DEFAULT_TYPE = "default"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java deleted file mode 100644 index fac3b9a78..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java +++ /dev/null @@ -1,1395 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.internal.core.filters; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterContainer; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.filters.SystemFilterSimple; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.references.IRSEReferencedObject; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.internal.references.SystemReferencedObject; - - -/** - * A filter is an encapsulation of a unique name, and a list - * of filter strings. - * Filters can be referenced. - */ -/** - * @lastgen class SystemFilterImpl extends SystemReferencedObjectImpl implements SystemFilter, SystemReferencedObject, SystemFilterContainer, IAdaptable {} - */ -public class SystemFilter extends SystemReferencedObject implements ISystemFilter, IRSEReferencedObject, IAdaptable -{ - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - private SystemFilterContainerCommonMethods helpers = null; - private ISystemFilterPool parentPool = null; - protected String[] filterStringArray = null; - protected ISystemFilterString[] filterStringObjectArray = null; - protected Vector filterStringVector = null; - - //protected static String SAVEFILE_PREFIX = DEFAULT_FILENAME_PREFIX_FILTER; - //protected static String SAVEFILE_SUFFIX = ".xmi"; - protected static boolean debug = true; - /** - * @generated This field/method will be replaced during code generation. - */ - /** - * @generated This field/method will be replaced during code generation. - */ - protected String name = NAME_EDEFAULT; - /** - * The default value of the '{@link #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected static final String TYPE_EDEFAULT = null; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected String type = TYPE_EDEFAULT; - /** - * The default value of the '{@link #isSupportsNestedFilters() <em>Supports Nested Filters</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSupportsNestedFilters() - * @generated - * @ordered - */ - protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; - /** - * The default value of the '{@link #getRelativeOrder() <em>Relative Order</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRelativeOrder() - * @generated - * @ordered - */ - protected static final int RELATIVE_ORDER_EDEFAULT = 0; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected int relativeOrder = RELATIVE_ORDER_EDEFAULT; - /** - * The default value of the '{@link #isDefault() <em>Default</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isDefault() - * @generated - * @ordered - */ - protected static final boolean DEFAULT_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean default_ = DEFAULT_EDEFAULT; - /** - * The default value of the '{@link #isStringsCaseSensitive() <em>Strings Case Sensitive</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isStringsCaseSensitive() - * @generated - * @ordered - */ - protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; - /** - * The default value of the '{@link #isPromptable() <em>Promptable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isPromptable() - * @generated - * @ordered - */ - protected static final boolean PROMPTABLE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean promptable = PROMPTABLE_EDEFAULT; - /** - * The default value of the '{@link #isSupportsDuplicateFilterStrings() <em>Supports Duplicate Filter Strings</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSupportsDuplicateFilterStrings() - * @generated - * @ordered - */ - protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; - /** - * The default value of the '{@link #isNonDeletable() <em>Non Deletable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isNonDeletable() - * @generated - * @ordered - */ - protected static final boolean NON_DELETABLE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean nonDeletable = NON_DELETABLE_EDEFAULT; - /** - * The default value of the '{@link #isNonRenamable() <em>Non Renamable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isNonRenamable() - * @generated - * @ordered - */ - protected static final boolean NON_RENAMABLE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT; - /** - * The default value of the '{@link #isNonChangable() <em>Non Changable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isNonChangable() - * @generated - * @ordered - */ - protected static final boolean NON_CHANGABLE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean nonChangable = NON_CHANGABLE_EDEFAULT; - /** - * The default value of the '{@link #isStringsNonChangable() <em>Strings Non Changable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isStringsNonChangable() - * @generated - * @ordered - */ - protected static final boolean STRINGS_NON_CHANGABLE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean stringsNonChangable = STRINGS_NON_CHANGABLE_EDEFAULT; - /** - * The default value of the '{@link #getRelease() <em>Release</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRelease() - * @generated - * @ordered - */ - protected static final int RELEASE_EDEFAULT = 0; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected int release = RELEASE_EDEFAULT; - /** - * The default value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSingleFilterStringOnly() - * @generated - * @ordered - */ - protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; - - /** - * The cached value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSingleFilterStringOnly() - * @generated - * @ordered - */ - protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected java.util.List nestedFilters = null; - /** - * @generated This field/method will be replaced during code generation. - */ - protected java.util.List strings = null; - - - // FIXME - protected ISystemFilter _parentFilter; - -/** - * Constructor. Do not instantiate directly, let MOF do it! - */ - protected SystemFilter() - { - super(); - helpers = new SystemFilterContainerCommonMethods(); - } - /* - * Private internal way to get filters. Makes it easy to change in future, if we don't use MOF. - */ - protected java.util.List internalGetFilters() - { - return getNestedFilters(); - } - - /** - * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null - */ - public String getType() - { - String type = getTypeGen(); - if (type == null) - return ISystemFilterConstants.DEFAULT_TYPE; - else - return type; - } - /** - * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null - */ - public String getTypeGen() - { - return type; - } - /* - * Creates a new nested system filter within this filter - * @param parentPool the SystemFilterPool that owns the root filter. - * @param data Optional transient data to be stored in the new filter. Can be null. - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - * - public SystemFilter createSystemFilter(SystemFilterPool parentPool, Object data, String aliasName, Vector filterStrings) - { - SystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), parentPool, data, aliasName, filterStrings); - newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself. - return newFilter; - }*/ - - /** - * Creates a new nested system filter within this filter. - * This filter will inherit/store the following attributes from this filter: - * <ul> - * <li>supportsNestedFilters - * <li>supportsDuplicateFilterStrings - * <li>stringsCaseSensitive - * <li>data - * </ul> - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - */ - public ISystemFilter createSystemFilter(String aliasName, Vector filterStrings) - { - ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), getParentFilterPool(), aliasName, filterStrings); - newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself. - newFilter.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings()); - newFilter.setStringsCaseSensitive(areStringsCaseSensitive()); - return newFilter; - } - - /** - * Internal use method - */ - public void initializeFilterStrings() - { - java.util.List filterStrings = getStrings(); - Iterator i = filterStrings.iterator(); - while (i.hasNext()) - ((ISystemFilterString)i.next()).setParentSystemFilter(this); - } - - /** - * Clones a given filter to the given target filter. - * All filter strings, and all nested filters, are copied. - * @param targetFilter new filter into which we copy all our data - */ - public void clone(ISystemFilter targetFilter) - { - // clone attributes - //targetFilter.setName(getName()); - targetFilter.setDefault(isDefault()); - targetFilter.setType(getType()); - targetFilter.setPromptable(isPromptable()); - targetFilter.setRelativeOrder(getRelativeOrder()); - targetFilter.setSupportsNestedFilters(isSupportsNestedFilters()); - targetFilter.setSupportsDuplicateFilterStrings(isSupportsDuplicateFilterStrings()); - targetFilter.setStringsNonChangable(isStringsNonChangable()); - targetFilter.setNonChangable(isNonChangable()); - targetFilter.setNonDeletable(isNonDeletable()); - targetFilter.setNonRenamable(isNonRenamable()); - if (isSetSingleFilterStringOnly()) - targetFilter.setSingleFilterStringOnly(isSingleFilterStringOnly()); - if (isSetStringsCaseSensitive()) - targetFilter.setStringsCaseSensitive(isStringsCaseSensitive()); - // clone filter strings - ISystemFilterString[] strings = getSystemFilterStrings(); - if (strings != null) { - for (int idx=0; idx<strings.length; idx++) { - copySystemFilterString(targetFilter, strings[idx]); - } - } - // clone nested filters... - ISystemFilter[] filters = getSystemFilters(); - if (filters != null) - for (int idx=0; idx<filters.length; idx++) - { - ISystemFilter newFilter = targetFilter.createSystemFilter(filters[idx].getName(), null); - filters[idx].clone(newFilter); // recursive call - } - } - /** - * Copies a given filter string from this filter to another filter in this pool or another pool - * in this manager or another manager. - */ - public ISystemFilterString copySystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString) - { - ISystemFilterString newString = targetFilter.addFilterString(null); - oldFilterString.clone(newString); - return newString; - } - - /** - * From SystemFilterContainer. - * Same as calling getParentFilterPool(). It walks the parent chain until the pool is found. - */ - public ISystemFilterPool getSystemFilterPool() - { - return getParentFilterPool(); - } - - /** - * Return true if this a transient or simple filter that is only created temporary "on the fly" - * and not intended to be saved or part of the filter framework. Eg it has no manager or provider. - * <p> - * We always return false. - * @see SystemFilterSimple - */ - public boolean isTransient() - { - return false; - } - - /** - * Does this support nested filters? Calls mof-generated isSupportsNestedFilters. - */ - public boolean supportsNestedFilters() - { - return isSupportsNestedFilters(); - } - /** - * Does this support duplicate filter strings? Calls mof-generated isSupportsDuplicateFilterStrings. - */ - public boolean supportsDuplicateFilterStrings() - { - return isSupportsDuplicateFilterStrings(); - } - - /** - * Return true if this filter is a nested filter or not. If not, its parent is the filter pool. - */ - public boolean isNested() - { - return (getParentFilter()!=null); - } - /** - * Are filter strings in this filter case sensitive? - * If not set locally, queries the parent filter pool's atttribute. - * @return The value of the StringsCaseSensitive attribute - */ - public boolean isStringsCaseSensitive() - { - if (!isSetStringsCaseSensitive()) - return getParentFilterPool().isStringsCaseSensitive(); - else - return stringsCaseSensitive; - } - /** - * Same as isStringsCaseSensitive() - * @return The value of the StringsCaseSensitive attribute - */ - public boolean areStringsCaseSensitive() - { - return isStringsCaseSensitive(); - } - /** - * Return Vector of String objects: the names of existing filters in this container. - * Needed by name validators for New and Rename actions to verify new name is unique. - */ - public Vector getSystemFilterNames() - { - return helpers.getSystemFilterNames(internalGetFilters()); - } - - /** - * Return the nested filters as a Vector - */ - public Vector getSystemFiltersVector() - { - return helpers.getSystemFiltersVector(internalGetFilters()); - } - /** - * Return the nested filters as an array - */ - public ISystemFilter[] getSystemFilters() - { - return helpers.getSystemFilters(internalGetFilters()); - } - /** - * Return how many filters are defined in this filter container - */ - public int getSystemFilterCount() - { - return internalGetFilters().size(); - } - - /** - * Return a filter object, given its aliasname. - * Can be used to test if an aliasname is already used (non-null return). - * @param aliasName unique aliasName (case insensitive) to search on. - * @return SystemFilter object with unique aliasName, or null if - * no filter object with this name exists. - */ - public ISystemFilter getSystemFilter(String aliasName) - { - return helpers.getSystemFilter(internalGetFilters(), aliasName); - - } - /** - * Adds given filter to the list. - * <p>PLEASE NOTE: - * <ul> - * <li> createSystemFilter calls this method for you! - * <li> this is a no-op if a filter with the same aliasname already exists - * </ul> - * @param filter SystemFilter object to add - * @return true if added, false if filter with this aliasname already existed. - */ - public boolean addSystemFilter(ISystemFilter filter) - { - return helpers.addSystemFilter(internalGetFilters(),filter); - } - /** - * Removes a given filter from the list. - * @param filter SystemFilter object to remove - */ - public void deleteSystemFilter(ISystemFilter filter) - { - helpers.deleteSystemFilter(internalGetFilters(),filter); - } - /** - * Rename a given filter in the list. - * @param filter SystemFilter object to remove - */ - public void renameSystemFilter(ISystemFilter filter, String newName) - { - helpers.renameSystemFilter(internalGetFilters(),filter, newName); - } - /** - * Updates a given filter in the list. - * @param filter SystemFilter object to update - * @param newName New name to assign it. Assumes unique checking already done. - * @param newStrings New strings to assign it. Replaces current strings. - */ - public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings) - { - helpers.updateSystemFilter(internalGetFilters(), filter, newName, newStrings); - } - /** - * Duplicates a given filter in the list. - * @param filter SystemFilter object to clone - * @param aliasName New, unique, alias name to give this filter. Clone will fail if this is not unique. - */ - public ISystemFilter cloneSystemFilter(ISystemFilter filter, String aliasName) - { - return helpers.cloneSystemFilter(internalGetFilters(), filter, aliasName); - } - /** - * Return a given filter's zero-based location - */ - public int getSystemFilterPosition(ISystemFilter filter) - { - return helpers.getSystemFilterPosition(internalGetFilters(),filter); - } - - /** - * Move a given filter to a given zero-based location - */ - public void moveSystemFilter(int pos, ISystemFilter filter) - { - helpers.moveSystemFilter(internalGetFilters(), pos, filter); - } - /** - * Return the parent pool of this filter. For nested filters, we walk up the parent chain - * until we find the pool. - */ - public ISystemFilterPool getParentFilterPool() - { - return parentPool; - } - /** - * Internal use method to set the parent filter pool. - */ - public void setParentFilterPool(ISystemFilterPool parentPool) - { - this.parentPool = parentPool; - ISystemFilter[] filters = getSystemFilters(); - if (filters != null) - for (int idx=0; idx<filters.length; idx++) - filters[idx].setParentFilterPool(parentPool); - // todo: decide if SystemFilterString objects need it too - } - /** - * Return the ISystemFilterContainer parent of this filter. Will be either - * a SystemFilterPool or a SystemFilter if this is a nested filter. - */ - public ISystemFilterContainer getParentFilterContainer() - { - ISystemFilter parentFilter = getParentFilter(); - return (parentFilter != null) ? (ISystemFilterContainer)parentFilter : (ISystemFilterContainer)getParentFilterPool(); - } - - /** - * Internal way to return emf-modelled list of filter strings. - * We use this so we can easily change to non-mof if we decide to. - */ - private java.util.List internalGetFilterStrings() - { - return getStrings(); - } - - /** - * Clear internal cache so it will be rebuilt on next request. - */ - protected void invalidateCache() - { - filterStringArray = null; - filterStringObjectArray = null; - filterStringVector = null; - setDirty(true); - } - - /** - * Return filter strings as an array of String objects. - */ - public String[] getFilterStrings() - { - if (filterStringArray == null) - { - java.util.List el = internalGetFilterStrings(); - filterStringArray = new String[el.size()]; - Iterator i = el.iterator(); - int idx = 0; - while (i.hasNext()) - filterStringArray[idx++] = ((ISystemFilterString)(i.next())).getString(); - } - return filterStringArray; - } - /** - * Return filter strings as a Vector of String objects - */ - public Vector getFilterStringsVector() - { - if (filterStringVector == null) - { - java.util.List el = internalGetFilterStrings(); - Iterator i = el.iterator(); - filterStringVector = new Vector(); - while (i.hasNext()) - filterStringVector.addElement(((ISystemFilterString)(i.next())).getString()); - } - return filterStringVector; - } - /** - * Get this filter's filter strings as a Vector of FilterString objects - */ - public Vector getFilterStringObjectsVector() - { - java.util.List el = internalGetFilterStrings(); - Iterator i = el.iterator(); - Vector filterStringVector = new Vector(); - while (i.hasNext()) - filterStringVector.addElement(i.next()); - return filterStringVector; - } - - /** - * Return how many filter strings are defined in this filter. - */ - public int getFilterStringCount() - { - return internalGetFilterStrings().size(); - } - /** - * Get a filter string given its string value - */ - public ISystemFilterString getSystemFilterString(String string) - { - ISystemFilterString[] strings = getSystemFilterStrings(); - ISystemFilterString match = null; - boolean cs = areStringsCaseSensitive(); - if (strings != null) - { - for (int idx=0; (match==null) && (idx<strings.length); idx++) - { - if (cs) - { - if (string.equals(strings[idx].getString())) // todo: allow case-sensitivity to be definable - match = strings[idx]; - } - else - { - if (string.equalsIgnoreCase(strings[idx].getString())) // todo: allow case-sensitivity to be definable - match = strings[idx]; - } - } - } - return match; - } - /** - * Set all the filter strings for this filter. - * @param newStrings Vector of String objects - */ - public void setFilterStrings(Vector newStrings) - { - java.util.List strings = internalGetFilterStrings(); - strings.clear(); - for (int idx=0; idx<newStrings.size(); idx++) - { - String currString = (String)newStrings.elementAt(idx); - ISystemFilterString string = new SystemFilterString(); - // FIXME initMOF().createSystemFilterString(); - string.setString(currString); - string.setParentSystemFilter(this); - strings.add(string); - } - invalidateCache(); - } - /** - * Get this filter's filter string objects as an array - */ - public ISystemFilterString[] getSystemFilterStrings() - { - if (filterStringObjectArray == null) - { - java.util.List el = internalGetFilterStrings(); - filterStringObjectArray = new ISystemFilterString[el.size()]; - Iterator i = el.iterator(); - int idx = 0; - while (i.hasNext()) - filterStringObjectArray[idx++] = (ISystemFilterString)(i.next()); - } - return filterStringObjectArray; - } - /** - * Set all the filter strings for this filter. - * @param newStrings array of String objects - */ - public void setFilterStrings(String newStrings[]) - { - java.util.List strings = internalGetFilterStrings(); - strings.clear(); - for (int idx=0; idx<newStrings.length; idx++) - { - addFilterString(newStrings[idx]); - } - //invalidateCache(); already done - } - private ISystemFilterString createFilterString(String string) - { - ISystemFilterString filterstring = new SystemFilterString(); - - // FIXME initMOF().createSystemFilterString(); - filterstring.setString(string); - filterstring.setParentSystemFilter(this); - return filterstring; - } - /** - * Append a new filter string to this filter's list - */ - public ISystemFilterString addFilterString(String newString) - { - java.util.List strings = internalGetFilterStrings(); - ISystemFilterString newFilterString = createFilterString(newString); - strings.add(newFilterString); - invalidateCache(); - return newFilterString; - } - /** - * Insert a new filter string to this filter's list, at the given zero-based position - */ - public ISystemFilterString addFilterString(String newString, int position) - { - java.util.List strings = internalGetFilterStrings(); - ISystemFilterString newFilterString = createFilterString(newString); - strings.add(position, newFilterString); - invalidateCache(); - return newFilterString; - } - /** - * Update a new filter string's string value - */ - public void updateFilterString(ISystemFilterString filterString, String newValue) - { - filterString.setString(newValue); - } - - /** - * Delete a filter string from this filter's list. - * @return the SystemFilterString object deleted, or null if not found - */ - public ISystemFilterString removeFilterString(String oldString) - { - java.util.List strings = internalGetFilterStrings(); - ISystemFilterString match = null; - Iterator i = strings.iterator(); - while ((match==null) && (i.hasNext())) - { - ISystemFilterString currstring = (ISystemFilterString)i.next(); - if (currstring.getString().equals(oldString)) - match = currstring; - } - if (match!=null) - { - strings.remove(match); - invalidateCache(); - } - return match; - } - - /** - * Remove a filter string from this filter's list, given its zero-based position - * @return the SystemFilterString object deleted, or null if not found - */ - public ISystemFilterString removeFilterString(int position) - { - java.util.List strings = internalGetFilterStrings(); - if (position >= strings.size()) - return null; - ISystemFilterString filterString = (ISystemFilterString)strings.get(position); - strings.remove(position); - invalidateCache(); - return filterString; - } - - /** - * Remove a filter string from this filter's list, given its SystemFilterString object. - * @return true if the given string existed and hence was deleted. - */ - public boolean removeFilterString(ISystemFilterString filterString) - { - java.util.List strings = internalGetFilterStrings(); - if (strings.contains(filterString)) - { - strings.remove(filterString); - invalidateCache(); - return true; - } - else - return false; - } - /** - * Move a given filter string to a given zero-based location - */ - public void moveSystemFilterString(int pos, ISystemFilterString filterString) - { - //FIXME internalGetFilterStrings().move(pos,filterString); - invalidateCache(); - } - - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - /** - * Return the children of this filter. - * This is all nested filters and all filter strings. - */ - public Object[] getChildren() - { - Vector strings = getFilterStringsVector(); - Vector filters = getSystemFiltersVector(); - Vector vChildren = new Vector(); - - // start with nested filters... - for (int idx=0; idx < filters.size(); idx++) - vChildren.addElement(filters.elementAt(idx)); - // continue with resolved filter string objects... - for (int idx=0; idx < strings.size(); idx++) - { - String filterString = (String)strings.elementAt(idx); - vChildren.addElement(filterString); - } - - // convert whole thing to an array... - Object[] children = new Object[vChildren.size()]; - for (int idx=0; idx<vChildren.size(); idx++) - children[idx] = vChildren.elementAt(idx); - - return children; - } - - /** - * Returns true if this filter has any nested filters or any filter strings - */ - public boolean hasChildren() - { - if (internalGetFilterStrings().size() > 0) - return true; - else - return helpers.hasSystemFilters(internalGetFilters()); - } - - /** - * Return the caller which instantiated the filter pool manager overseeing this filter framework instance - */ - public ISystemFilterPoolManagerProvider getProvider() - { - ISystemFilterPoolManager mgr = getSystemFilterPoolManager(); - if (mgr != null) - return mgr.getProvider(); - else - return null; - } - - /** - * Return the filter pool manager managing this collection of filter pools and their filters. - * To save space, we delegate this query to our parent filter pool. - */ - public ISystemFilterPoolManager getSystemFilterPoolManager() - { - ISystemFilterPool pool = getParentFilterPool(); - if (pool != null) - return pool.getSystemFilterPoolManager(); - else - return null; - } - - // ----------------------- - // SAVE/RESTORE METHODS... - // ----------------------- - - - - - - /** - * Restore specific filter. Used when save policy is SAVE_POLICY_ONE_FILE_PER_FILTER - * @param folder the folder containing the saved file. - * @param name The name of the saved filter. The file name is derived from this. - * @param parentPool the SystemFilterPool that is the parent of this filter. Will be perpetuated to nested filters. - * @param namingPolicy Tells us how to derive file name from filter name. Can be null for default prefix name. - * @return SystemFilter object if restored ok, null if error encountered. If null, call getLastException(). - */ - public static ISystemFilter restore(IFolder folder, String name, ISystemFilterPool parentPool, - IRSEFilterNamingPolicy namingPolicy) - throws Exception - { - /* FIXME - String fileName = getRootSaveFileName(namingPolicy, name); - - java.util.List ext = mofHelpers.restore(folder,fileName); - - // should be exactly one... - Iterator iList = ext.iterator(); - SystemFilter filter = (SystemFilter)iList.next(); - if (parentPool != null) - filter.setParentFilterPool(parentPool); - ((SystemFilterImpl)filter).initializeFilterStrings(); - return filter; - */ - return null; - } - - - /** - * Return the root save file name without the extension .xmi - */ - protected static String getRootSaveFileName(ISystemFilter filter) - { - return getRootSaveFileName(getNamingPolicy(filter), filter.getName()); - } - /** - * Return the root save file name without the extension .xmi - */ - protected static String getRootSaveFileName(IRSEFilterNamingPolicy namingPolicy, String name) - { - return namingPolicy.getFilterSaveFileName(name); - } - - - /** - * Return naming policy - */ - protected static IRSEFilterNamingPolicy getNamingPolicy(ISystemFilter filter) - { - return filter.getParentFilterPool().getNamingPolicy(); - } - - - - /** - * Ensure given path ends with path separator. - */ - public static String addPathTerminator(String path) - { - if (!path.endsWith(File.separator)) - path = path + File.separatorChar; - //else - // path = path; - return path; - } - - /** - * Return string identifying this filter - */ - public String toString() - { - return getName(); - } - /** - * @generated This field/method will be replaced during code generation - */ - public String getName() - { - return name; - } - - public String getDescription() - { - return RSECoreMessages.RESID_MODELOBJECTS_FILTER_DESCRIPTION; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setName(String newName) - { - name = newName; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setType(String newType) - { - type = newType; - setDirty(true); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isSupportsNestedFilters() - { - return supportsNestedFilters; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setSupportsNestedFilters(boolean newSupportsNestedFilters) - { - boolean oldSupportsNestedFilters = supportsNestedFilters; - if (oldSupportsNestedFilters != newSupportsNestedFilters) - { - supportsNestedFilters = newSupportsNestedFilters; - setDirty(true); - } - } - - /** - * @generated This field/method will be replaced during code generation - * When saving one filter per file, this captures this filter's relative order - * within the pool, as the file system cannot capture this. - */ - public int getRelativeOrder() - { - return relativeOrder; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setRelativeOrder(int newRelativeOrder) - { - relativeOrder = newRelativeOrder; - } - - /** - * @generated This field/method will be replaced during code generation - * Is this a vendor-supplied filter versus a user-defined filter - */ - public boolean isDefault() - { - return default_; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setDefault(boolean newDefault) - { - default_ = newDefault; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setStringsCaseSensitive(boolean newStringsCaseSensitive) - { - boolean oldStringsCaseSensitive = stringsCaseSensitive; - if (oldStringsCaseSensitive != newStringsCaseSensitive) - { - stringsCaseSensitive = newStringsCaseSensitive; - setDirty(true); - } - - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void unsetStringsCaseSensitive() - { - boolean oldStringsCaseSensitive = stringsCaseSensitive; - if (oldStringsCaseSensitive != STRINGS_CASE_SENSITIVE_EDEFAULT) - { - stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; - setDirty(true); - } - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean isSetStringsCaseSensitive() - { - return stringsCaseSensitive; - } - - /** - * @generated This field/method will be replaced during code generation - * If true, the user is prompted when this filter is expanded - */ - public boolean isPromptable() - { - return promptable; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setPromptable(boolean newPromptable) - { - promptable = newPromptable; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public ISystemFilter getParentFilter() - { - //FIXME - return _parentFilter; - //if (eContainerFeatureID != FiltersPackage.SYSTEM_FILTER__PARENT_FILTER) return null; - //return (SystemFilter)eContainer; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setParentFilter(ISystemFilter newParentFilter) - { - _parentFilter = newParentFilter; - /* FIXME - if (newParentFilter != eContainer || (eContainerFeatureID != FiltersPackage.SYSTEM_FILTER__PARENT_FILTER && newParentFilter != null)) - { - if (EcoreUtil.isAncestor(this, newParentFilter)) - throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); - NotificationChain msgs = null; - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newParentFilter != null) - msgs = ((InternalEObject)newParentFilter).eInverseAdd(this, FiltersPackage.SYSTEM_FILTER__NESTED_FILTERS, SystemFilter.class, msgs); - msgs = eBasicSetContainer((InternalEObject)newParentFilter, FiltersPackage.SYSTEM_FILTER__PARENT_FILTER, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, FiltersPackage.SYSTEM_FILTER__PARENT_FILTER, newParentFilter, newParentFilter)); - */ - } - - /** - * @generated This field/method will be replaced during code generation - */ - public java.util.List getNestedFilters() - { - if (nestedFilters == null) - { - nestedFilters = new ArrayList(); - //FIXME new EObjectContainmentWithInversejava.util.List(SystemFilter.class, this, FiltersPackage.SYSTEM_FILTER__NESTED_FILTERS, FiltersPackage.SYSTEM_FILTER__PARENT_FILTER); - } - return nestedFilters; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public java.util.List getStrings() - { - if (strings == null) - { - strings = new ArrayList(); - //FIXME new EObjectContainmenteList(SystemFilterString.class, this, FiltersPackage.SYSTEM_FILTER__STRINGS); - } - return strings; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isSupportsDuplicateFilterStrings() - { - return supportsDuplicateFilterStrings; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setSupportsDuplicateFilterStrings(boolean newSupportsDuplicateFilterStrings) - { - boolean oldSupportsDuplicateFilterStrings = supportsDuplicateFilterStrings; - if (oldSupportsDuplicateFilterStrings != newSupportsDuplicateFilterStrings) - { - supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; - setDirty(true); - } - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isNonDeletable() - { - return nonDeletable; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setNonDeletable(boolean newNonDeletable) - { - nonDeletable = newNonDeletable; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isNonRenamable() - { - return nonRenamable; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setNonRenamable(boolean newNonRenamable) - { - nonRenamable = newNonRenamable; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isNonChangable() - { - return nonChangable; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setNonChangable(boolean newNonChangable) - { - nonChangable = newNonChangable; - } - - /** - * @generated This field/method will be replaced during code generation - * Are the filter strings within this filter non-changable by the user. If true, - * strings can be deleted, added, edited or reordered. - */ - public boolean isStringsNonChangable() - { - return stringsNonChangable; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setStringsNonChangable(boolean newStringsNonChangable) - { - boolean oldStringsNonChangable = stringsNonChangable; - if (oldStringsNonChangable != newStringsNonChangable) - { - stringsNonChangable = newStringsNonChangable; - setDirty(true); - } - } - - /** - * @generated This field/method will be replaced during code generation - * In what release was this created? Typically, will be the version and release - * times 10, as in 40 or 51. - */ - public int getRelease() - { - return release; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setRelease(int newRelease) - { - release = newRelease; - } - - /** - * Returns true if this filter is limited to a single filter string. If not set here, - * it is queried from the parent pool. - */ - public boolean isSingleFilterStringOnly() - { - if (isSetSingleFilterStringOnly()) - return singleFilterStringOnly; - else - return getSystemFilterPool().isSingleFilterStringOnly(); - } - - public boolean isSingleFilterStringOnlyGen() - { - return singleFilterStringOnly; - } - - public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) - { - boolean oldSingleFilterStringOnly = singleFilterStringOnly; - if (oldSingleFilterStringOnly != newSingleFilterStringOnly) - { - singleFilterStringOnly = newSingleFilterStringOnly; - setDirty(true); - } - } - - - public void unsetSingleFilterStringOnly() - { - boolean oldSingleFilterStringOnly = singleFilterStringOnly; - if (oldSingleFilterStringOnly != SINGLE_FILTER_STRING_ONLY_EDEFAULT) - { - singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; - setDirty(true); - } - - } - - public boolean isSetSingleFilterStringOnly() - { - return singleFilterStringOnly; - } - - public boolean commit() - { - ISystemProfile profile = getSystemFilterPoolManager().getSystemProfile(); - boolean result = profile.commit(); - return result; - } - - public IRSEPersistableContainer getPersistableParent() { - IRSEPersistableContainer result = getParentFilterContainer(); - return result; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - List children = new ArrayList(20); - if (nestedFilters != null) { - children.addAll(nestedFilters); - } - if (filterStringVector != null) { - children.addAll(filterStringVector); - } - children.addAll(Arrays.asList(getPropertySets())); - IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()]; - children.toArray(result); - return result; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerCommonMethods.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerCommonMethods.java deleted file mode 100644 index 06ac72f39..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerCommonMethods.java +++ /dev/null @@ -1,570 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. 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: - * Kevin Doyle (IBM) - [190445] moveSystemFilter now reorganizes the list of filters - ********************************************************************************/ - -package org.eclipse.rse.internal.core.filters; -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.logging.Logger; - - -/** - * This class abstracts out some common code needed by any class that - * implements ISystemFilterContainer. - * <p> - * This class supports two overloaded version of each method. One that - * takes a MOF java.util.List for the filter list, and one that takes a Vector for - * the filter list. This is to offer seamless flexibility in how the filters - * are stored internally. - */ -public class SystemFilterContainerCommonMethods - //implements ISystemFilterContainer -{ - private Vector filterNameVector, filterVector; - private ISystemFilter[] filterArray; - - /** - * Constructor - */ - public SystemFilterContainerCommonMethods() - { - super(); - } - - - /** - * For performance reasons we have decided to store a cache of the - * filters in vector and array form, so each request will not result - * in a new temporary vector or array. However, this cache can get out - * of date, so this method must be called religiously to invalidate it - * after any change in the filters. - */ - public void invalidateCache() - { - filterNameVector = filterVector = null; - filterArray = null; - } - - /** - * Creates a new system filter within this pool or filter. - * @param filters MOF list of filters the new filter is to be added to. - * @param parentPool pool that contains this filter (directly or indirectly). - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - */ - public ISystemFilter createSystemFilter(java.util.List filters, - ISystemFilterPool parentPool, - String aliasName, Vector filterStrings) - { - ISystemFilter newFilter = null; - - // FIXME - not using error message and null return - // because I want to restore filters while not being hit with conflicts - newFilter = getSystemFilter(filters, aliasName); - if (newFilter != null) - { - return newFilter; - } - /* DKM - boolean exists = getSystemFilter(filters, aliasName) != null; - if (exists) - { - String msg = "Error creating filter: aliasName " + aliasName + " is not unique"; // no need to xlate, internal only - RSEUIPlugin.logError(msg); - return null; - } - */ - newFilter = internalCreateSystemFilter(parentPool, aliasName, filterStrings); - if (newFilter != null) - internalAddSystemFilter(filters, newFilter); - return newFilter; - } - /** - * Creates a new system filter within this pool or filter. - * @param filters Vector of filters the new filter is to be added to. - * @param parentPool pool that contains this filter (directly or indirectly) - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - */ - public ISystemFilter createSystemFilter(Vector filters, - ISystemFilterPool parentPool, - String aliasName, Vector filterStrings) - { - ISystemFilter newFilter = null; - boolean exists = getSystemFilter(filters, aliasName) != null; - if (exists) - { - String msg = "Error creating filter: aliasName " + aliasName + " is not unique"; // no need to xlate, internal only //$NON-NLS-1$ //$NON-NLS-2$ - RSECorePlugin.getDefault().getLogger().logError(msg, null); - return null; - } - newFilter = internalCreateSystemFilter(parentPool, aliasName, filterStrings); - if (newFilter != null) - internalAddSystemFilter(filters, newFilter); - return newFilter; - } - - - /** - * Internal encapsulation of mof effort to create new filter, and setting of - * the core attributes. - */ - private ISystemFilter internalCreateSystemFilter( - ISystemFilterPool parentPool, - String aliasName, Vector filterStrings) - { - ISystemFilter newFilter = null; - try - { - newFilter = new SystemFilter(); - // FIXME getMOFfactory().createSystemFilter(); - newFilter.setRelease(RSECorePlugin.CURRENT_RELEASE); - newFilter.setName(aliasName); - newFilter.setParentFilterPool(parentPool); - if (filterStrings != null) - newFilter.setFilterStrings(filterStrings); - //java.util.List filterStringList = newFilter.getFilterStrings(); - //for (int idx=0; idx<filterStrings.size(); idx++) - //{ - //SystemFilterString string = getMOFfactory().createSystemFilterString(); - //string.setString((String)filterStrings.elementAt(idx)); - //filterStringList.add(string); - //} - } catch (Exception e) - { - Logger logger = RSECorePlugin.getDefault().getLogger(); - logger.logError("Error creating filter: " + e.getClass().getName() + ": " + e.getMessage(), null); //$NON-NLS-1$ //$NON-NLS-2$ - logger.logError("...Alias name.: " + aliasName, null); //$NON-NLS-1$ - } - return newFilter; - } - - - /** - * Return Vector of String objects: the names of existing filters in this container. - * Needed by name validators for New and Rename actions to verify new name is unique. - */ - public Vector getSystemFilterNames(java.util.List filters) - { - if ((filterNameVector == null) || (filterNameVector.size() != filters.size())) - { - filterNameVector = new Vector(); - if (filters == null) - return filterNameVector; - Iterator i = filters.iterator(); - while (i.hasNext()) - { - ISystemFilter next = (ISystemFilter)i.next(); - filterNameVector.addElement(next.getName()); - } - } - return filterNameVector; - } - - /** - * Return Vector of String objects: the names of existing filters in this container. - * Needed by name validators for New and Rename actions to verify new name is unique. - */ - public Vector getSystemFilterNames(Vector filters) - { - if ((filterNameVector == null) || (filterNameVector.size() != filters.size())) - { - Vector filterNameVector = new Vector(); - if ((filters == null) || (filters.size()==0)) - return filterNameVector; - for (int idx=0; idx<filters.size(); idx++) - { - ISystemFilter next = (ISystemFilter)filters.elementAt(idx); - filterNameVector.addElement(next.getName()); - } - } - return filterNameVector; - } - - - /** - * Return the nested filters as a Vector - */ - public Vector getSystemFiltersVector(java.util.List filters) - { - if ((filterVector == null) || (filterVector.size() != filters.size())) - { - filterVector = new Vector(); - Iterator i = filters.iterator(); - while (i.hasNext()) - filterVector.addElement(i.next()); - } - return filterVector; - } - /** - * Return the nested filters as a Vector - */ - public Vector getSystemFiltersVector(Vector filters) - { - return filters; - } - - /** - * Return the nested filters as an array - */ - public ISystemFilter[] getSystemFilters(java.util.List filters) - { - if ((filterArray == null) || (filterArray.length != filters.size())) - { - filterArray = new ISystemFilter[filters.size()]; - Iterator i = filters.iterator(); - int idx = 0; - while (i.hasNext()) - filterArray[idx++]=(ISystemFilter)(i.next()); - } - return filterArray; - //return null; - } - /** - * Return the filters as an array - */ - public ISystemFilter[] getSystemFilters(Vector filters) - { - if (filters == null) - return null; - if ((filterArray == null) || (filterArray.length != filters.size())) - { - filterArray = new ISystemFilter[filters.size()]; - for (int idx=0; idx<filters.size(); idx++) - filterArray[idx]=(ISystemFilter)(filters.elementAt(idx)); - } - return filterArray; - } - - /** - * Return how many filters are defined in this filter container - */ - public int getSystemFilterCount(java.util.List filters) - { - int nbrChildren = (filters == null) ? 0 : filters.size(); - return nbrChildren; - } - - /** - * Return how many filters are defined in this filter container - */ - public int getSystemFilterCount(Vector filters) - { - int nbrChildren = (filters == null) ? 0 : filters.size(); - return nbrChildren; - } - - /** - * Return true if there are system filters - */ - public boolean hasSystemFilters(java.util.List filters) - { - return (filters!=null) && (filters.size()>0); - } - /** - * Return true if there are system filters - */ - public boolean hasSystemFilters(Vector filters) - { - return (filters!=null) && (filters.size()>0); - } - - - /** - * Return a filter object, given its aliasname. - * Can be used to test if an aliasname is already used (non-null return). - * @param aliasName unique aliasName (case insensitive) to search on. - * @return SystemFilter object with unique aliasName, or null if - * no filter object with this name exists. - */ - public ISystemFilter getSystemFilter(java.util.List filters, String aliasName) - { - ISystemFilter filter = null; - ISystemFilter currFilter = null; - Iterator i = filters.iterator(); - while (i.hasNext() && (filter==null)) - { - currFilter = (ISystemFilter)i.next(); - if (currFilter.getName().equalsIgnoreCase(aliasName)) - filter = currFilter; - } - return filter; - } - /** - * Return a filter object, given its aliasname. - * Can be used to test if an aliasname is already used (non-null return). - * @param aliasName unique aliasName (case insensitive) to search on. - * @return SystemFilter object with unique aliasName, or null if - * no filter object with this name exists. - */ - public ISystemFilter getSystemFilter(Vector filters, String aliasName) - { - if ((filters == null) || (filters.size()==0)) - return null; - ISystemFilter filter = null; - ISystemFilter currFilter = null; - for (int idx=0; (idx<filters.size()) && (filter==null); idx++) - { - currFilter = (ISystemFilter)filters.elementAt(idx); - if (currFilter.getName().equalsIgnoreCase(aliasName)) - filter = currFilter; - } - return filter; - } - - - /** - * Adds given filter to the list. - * <p>PLEASE NOTE: - * <ul> - * <li> createSystemFilter calls this method for you! - * <li> this is a no-op if a filter with the same aliasname already exists - * </ul> - * @param filter SystemFilter object to add - * @return true if added, false if filter with this aliasname already existed. - */ - public boolean addSystemFilter(java.util.List filters, ISystemFilter filter) - { - boolean exists = getSystemFilter(filters, filter.getName()) != null; - if (!exists) - return internalAddSystemFilter(filters, filter); - else - return false; - } - /** - * Internally, we can skip the uniqueness checking. - */ - protected boolean internalAddSystemFilter(java.util.List filters, ISystemFilter filter) - { - filters.add(filter); - invalidateCache(); - return true; - } - /** - * Adds given filter to the list. - * <p>PLEASE NOTE: - * <ul> - * <li> createSystemFilter calls this method for you! - * <li> this is a no-op if a filter with the same aliasname already exists - * </ul> - * @param filter SystemFilter object to add - * @return true if added, false if filter with this aliasname already existed. - */ - public boolean addSystemFilter(Vector filters, ISystemFilter filter) - { - boolean exists = getSystemFilter(filters, filter.getName()) != null; - if (!exists) - return internalAddSystemFilter(filters, filter); - else - return false; - } - /** - * Internally, we can skip the uniqueness checking. - */ - private boolean internalAddSystemFilter(Vector filters, ISystemFilter filter) - { - filters.add(filter); - invalidateCache(); - return true; - } - - - - /** - * Removes a given filter from the list. - * Does NOT follow references to remove them. - * @param filters MOF list to remove from - * @param filter SystemFilter object to remove - */ - public void deleteSystemFilter(java.util.List filters, ISystemFilter filter) - { - filters.remove(filter); - invalidateCache(); - } - /** - * Renames a given filter from the list. - * @param filters java.util.List list - * @param filter SystemFilter object to rename - * @param newName new name to give filter - */ - public void renameSystemFilter(java.util.List filters, ISystemFilter filter, String newName) - { - filter.setName(newName); - invalidateCache(); - } - - /** - * Removes a given filter from the list. - * Does NOT follow references to remove them. - * @param filters Vector list to remove from - * @param filter SystemFilter object to remove - */ - public void deleteSystemFilter(Vector filters, ISystemFilter filter) - { - filters.remove(filter); - invalidateCache(); - } - /** - * Renames a given filter from the list. - * @param filters Vector list - * @param filter SystemFilter object to rename - * @param newName new name to give filter - */ - public void renameSystemFilter(Vector filters, ISystemFilter filter, String newName) - { - filter.setName(newName); - invalidateCache(); - } - /** - * Updates a given filter in the list. - * @param filters Vector list - * @param filter SystemFilter object to update - * @param newName new name to give filter - * @param newStrings new strings to give filter - */ - public void updateSystemFilter(Vector filters, ISystemFilter filter, String newName, String[] newStrings) - { - filter.setName(newName); - filter.setFilterStrings(newStrings); - invalidateCache(); - } - /** - * Updates a given filter in the list. - * @param filters java.util.List list - * @param filter SystemFilter object to update - * @param newName new name to give filter - * @param newStrings new strings to give filter - */ - public void updateSystemFilter(java.util.List filters, ISystemFilter filter, String newName, String[] newStrings) - { - filter.setName(newName); - filter.setFilterStrings(newStrings); - invalidateCache(); - } - /** - * Duplicates a given filter in the list. - * @param filters MOF list of filters into which to place the clone - * @param filter SystemFilter object to clone - * @param aliasName New, unique, alias name to give this filter. Clone will fail if this is not unique. - */ - public ISystemFilter cloneSystemFilter(java.util.List filters, ISystemFilter filter, String aliasName) - { - - ISystemFilter copy = - createSystemFilter(filters, filter.getParentFilterPool(), - aliasName, filter.getFilterStringsVector()); - internalAfterCloneSystemFilter(filter, copy); - // now clone nested filters... - ISystemFilter[] nested = filter.getSystemFilters(); - if ((nested!=null) && (nested.length>0)) - for (int idx=0; idx<nested.length; idx++) - { - - } - return copy; - } - /** - * Duplicates a given filter in the list. - * @param filters Vector of filters into which to place the clone - * @param filter SystemFilter object to clone - * @param aliasName New, unique, alias name to give this filter. Clone will fail if this is not unique. - */ - public ISystemFilter cloneSystemFilter(Vector filters, ISystemFilter filter, String aliasName) - { - - ISystemFilter copy = - createSystemFilter(filters, filter.getParentFilterPool(), - aliasName, filter.getFilterStringsVector()); - internalAfterCloneSystemFilter(filter, copy); - // now clone nested filters... - ISystemFilter[] nested = filter.getSystemFilters(); - if ((nested!=null) && (nested.length>0)) - for (int idx=0; idx<nested.length; idx++) - { - - } - return copy; - } - - /** - * Does core effort to populate a filter clone with non-core attributes - * @param oldFilter SystemFilter original filter - * @param newFilter SystemFilter that is new - */ - public void internalAfterCloneSystemFilter(ISystemFilter oldFilter, ISystemFilter newFilter) - { - newFilter.setParentFilterPool(oldFilter.getParentFilterPool()); - newFilter.setSupportsNestedFilters(oldFilter.isSupportsNestedFilters()); - newFilter.setType(oldFilter.getType()); - newFilter.setDefault(oldFilter.isDefault()); - newFilter.setRelativeOrder(oldFilter.getRelativeOrder()); - } - - /** - * Return a given filter's zero-based location - */ - public int getSystemFilterPosition(java.util.List filters, ISystemFilter filter) - { - int position = -1; - Iterator i = filters.iterator(); - for (int idx=0; (position<0) && (idx < filters.size()); idx++) - { - ISystemFilter currFilter = (ISystemFilter)i.next(); - if (currFilter.getName().equals(filter.getName())) - position = idx; - } - return position; - } - /** - * Return a given filter's zero-based location - */ - public int getSystemFilterPosition(Vector filters, ISystemFilter filter) - { - int position = -1; - for (int idx=0; (position<0) && (idx < filters.size()); idx++) - { - ISystemFilter currFilter = (ISystemFilter)filters.elementAt(idx); - if (currFilter.getName().equals(filter.getName())) - position = idx; - } - return position; - } - - - /** - * Move a given filter to a given zero-based location - */ - public void moveSystemFilter(java.util.List filters, int pos, ISystemFilter filter) - { - filters.remove(filter); - filters.add(pos, filter); - invalidateCache(); - } - /** - * Move a given filter to a given zero-based location - */ - public void moveSystemFilter(Vector filters, int pos, ISystemFilter filter) - { - filters.remove(filter); - filters.insertElementAt(filter, pos); - invalidateCache(); - } - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerReferenceCommonMethods.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerReferenceCommonMethods.java deleted file mode 100644 index 86c9048bb..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerReferenceCommonMethods.java +++ /dev/null @@ -1,261 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterContainer; -import org.eclipse.rse.core.filters.ISystemFilterContainerReference; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.filters.SystemFilterReference; -import org.eclipse.rse.core.subsystems.ISubSystem; - - - -/** - * Both SystemFilter and SystemFilterPool contain filters, so the - * common methods for filters are abstracted out in SystemFilterContainer, - * which both classes implement. - * Both SystemFilterReference and SystemFilterPoolReference hold references - * to SystemFilterContainer objects (either SystemFilter or SystemFilterPool). - * There are a couple of methods that are common to both classes, related to - * getting an array of references to the filters that are held by the referenced - * object. - * This class offers an implementation of those common methods, and both - * SystemFilterReferenceImpl and SystemFilterPoolReferenceImpl use this via - * containment. - */ -public class SystemFilterContainerReferenceCommonMethods -{ - private ISystemFilterContainerReference parentRef = null; - private ISystemFilterReference[] referencedFilters = null; - - /** - * Constructor - * @param parentRef the object we are helping. - */ - public SystemFilterContainerReferenceCommonMethods(ISystemFilterContainerReference parentRef) - { - super(); - this.parentRef = parentRef; - } - - /** - * Return the name of the SystemFilter or SystemFilterPool that we reference. - */ - public String getName() - { - ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); - String name = null; - if (parent instanceof ISystemFilterPool) - name = ((ISystemFilterPool)parent).getName(); - else - name = ((ISystemFilter)parent).getName(); - return name; - } - - /** - * Return true if the referenced pool or filter has filters. - */ - public boolean hasFilters() - { - return getFilterCount() > 0; - } - - /** - * Return count of the number of filters in the referenced pool or filter - */ - public int getFilterCount() - { - int count = 0; - ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); - java.util.List mofList = null; - if (parent instanceof ISystemFilterPool) - mofList = ((ISystemFilterPool)parent).getFilters(); - else - mofList = ((ISystemFilter)parent).getNestedFilters(); - if (mofList != null) - count = mofList.size(); - return count; - } - - /** - * Get the list of nested filters referenced by this ISystemFilterContainerReference. - */ - public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) - { - - // These reference objects are built on the fly, each time, rather than - // maintaining a persisted list of such references. The reason - // is we do not at this time allow users to subset the master list - // of filters maintained by a filterpool. Hence, we always simply - // return a complete list. However, to save memory we try to only - // re-gen the list if something has changed. - ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); - List mofList = null; - if (parent instanceof ISystemFilterPool) - mofList = ((ISystemFilterPool)parent).getFilters(); - else if (parent instanceof ISystemFilter) { - mofList = ((ISystemFilter)parent).getNestedFilters(); - } - boolean needToReGen = compareFilters(mofList); - //System.out.println("In getSFRefs for " + getName() + ": regen? " + needToReGen); - - if (needToReGen) - { - // first, need remove backward references... - - // second, build new references... - referencedFilters = generateFilterReferences(subSystem, mofList); - } - if (referencedFilters == null) { - referencedFilters = new ISystemFilterReference[0]; - } - return referencedFilters; - } - - /** - * To save memory, we try to only regenerate the referenced filter list - * if something has changed. - */ - private boolean compareFilters(java.util.List newFilters) - { - boolean mustReGen = false; - if (newFilters == null) - { - if (referencedFilters != null) - return true; - else - return false; - } - else if (referencedFilters == null) - { - return true; // newFilters != null && referencedFilters == null - } - // both old and new are non-null - if (newFilters.size() != referencedFilters.length) - return true; - Iterator i = newFilters.iterator(); - for (int idx=0; !mustReGen && (idx<referencedFilters.length); idx++) - { - ISystemFilter newFilter = (ISystemFilter)i.next(); - if (referencedFilters[idx].getReferencedFilter() != newFilter) - mustReGen = true; - } - return mustReGen; - } - - - /** - * To save the memory of an intermediate array, we create the filter references - * directly from the MOF model... - */ - private ISystemFilterReference[] generateFilterReferences(ISubSystem subSystem, java.util.List newFilters) - { - if (newFilters == null) - return null; - ISystemFilterReference[] oldRefs = referencedFilters; - ISystemFilterReference[] refs = new ISystemFilterReference[newFilters.size()]; - Iterator i = newFilters.iterator(); - int idx = 0; - while (i.hasNext()) - { - ISystemFilter filter = (ISystemFilter)i.next(); - - boolean foundOldOne = false; - - // DKM - first check if we already have a reference for this - if (oldRefs != null) - { - for (int o = 0; o < oldRefs.length && !foundOldOne; o++) - { - ISystemFilterReference oRef = oldRefs[o]; - if (oRef.getReferencedFilter() == filter) - { - refs[idx++] = oRef; - foundOldOne = true; - } - } - } - if (!foundOldOne) - { - refs[idx++] = generateFilterReference(subSystem, filter); - } - } - return refs; - } - - - /** - * Create a single filter refererence - */ - public ISystemFilterReference generateFilterReference( ISubSystem subSystem, ISystemFilter filter) - { - return SystemFilterReference.createSystemFilterReference(subSystem, parentRef, filter, SystemFilterReference.PERSISTENT_NO); - } - /** - * Create a single filter refererence and append it to the end of the list. - * This will first check if there already is a reference to the given filter and if so - * will simply return it. - */ - public ISystemFilterReference generateAndRecordFilterReference(ISubSystem subSystem, ISystemFilter filter) - { - getSystemFilterReferences(subSystem); // regenerate all references if needed - ISystemFilterReference sfr = getExistingSystemFilterReference(subSystem, filter); - if (sfr == null) // still no reference exist? - { - /* */ - sfr = generateFilterReference(subSystem, filter); - int currLength = 0; - if (referencedFilters != null) - currLength = referencedFilters.length; - int newLength = currLength + 1; - ISystemFilterReference[] newRefs = new ISystemFilterReference[newLength]; - for (int idx=0; idx<currLength; idx++) - { - newRefs[idx] = referencedFilters[idx]; - } - newRefs[newLength-1] = sfr; - referencedFilters = newRefs; - - } - return sfr; - } - /** - * Return an existing reference to a given system filter. - * If no reference currently exists to this filter, returns null. - */ - public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) - { - ISystemFilterReference ref = null; - ISystemFilterReference[] refs = referencedFilters; - if ((refs != null) && (refs.length>0)) - { - for (int idx=0; (ref==null) && (idx<refs.length); idx++) - { - ISystemFilterReference aref = refs[idx]; - if (aref.getReferencedFilter() == filter && aref.getSubSystem() == subSystem) - ref = aref; - } - } - return ref; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java deleted file mode 100644 index 6cce211d4..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java +++ /dev/null @@ -1,1267 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - removing implementation of ISystemFilterSavePolicies, ISystemFilterConstants - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.internal.core.filters; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.SystemResourceHelpers; -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.SystemFilterNamingPolicy; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.internal.references.SystemPersistableReferencedObject; - - -/** - * This is a system filter pool, which is a means of grouping filters - * and managing them as a list. - * <p> - * To enable filters themselves to be automous and sharable, it is decided - * that no data will be persisted in the filter pool itself. Rather, all - * attributes other than the list of filters are transient and as such it is - * the responsibility of the programmer using a filter pool to set these - * attributes after creating or restoring a filter pool. Typically, this is - * what a filter pool manager (SystemFilterPoolManager) will do for you. - */ -/** - * @lastgen class SystemFilterPoolImpl extends SystemPersistableReferencedObjectImpl implements SystemFilterPool, SystemFilterSavePolicies, SystemFilterConstants, SystemFilterContainer, IAdaptable - */ -public class SystemFilterPool extends SystemPersistableReferencedObject - implements ISystemFilterPool, IAdaptable -{ - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - private String name; - /** - * The default value of the '{@link #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected static final String TYPE_EDEFAULT = null; - - private int savePolicy; - private IRSEFilterNamingPolicy namingPolicy = null; - private ISystemFilterPoolManager mgr; - private SystemFilterContainerCommonMethods helpers = null; - private Object filterPoolData = null; - private boolean initialized = false; - protected boolean specialCaseNoDataRestored = false; - private boolean debug = false; - protected static final String DELIMITER = SystemFilterPoolReference.DELIMITER; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected String type = TYPE_EDEFAULT; - /** - * The default value of the '{@link #isSupportsNestedFilters() <em>Supports Nested Filters</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSupportsNestedFilters() - * @generated - * @ordered - */ - protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; - /** - * The default value of the '{@link #isDeletable() <em>Deletable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isDeletable() - * @generated - * @ordered - */ - protected static final boolean DELETABLE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean deletable = DELETABLE_EDEFAULT; - /** - * The default value of the '{@link #isDefault() <em>Default</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isDefault() - * @generated - * @ordered - */ - protected static final boolean DEFAULT_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean default_ = DEFAULT_EDEFAULT; - /** - * The default value of the '{@link #isStringsCaseSensitive() <em>Strings Case Sensitive</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isStringsCaseSensitive() - * @generated - * @ordered - */ - protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; - /** - * This is true if the Strings Case Sensitive attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean stringsCaseSensitiveESet = false; - - /** - * The default value of the '{@link #isSupportsDuplicateFilterStrings() <em>Supports Duplicate Filter Strings</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSupportsDuplicateFilterStrings() - * @generated - * @ordered - */ - protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; - /** - * The default value of the '{@link #getRelease() <em>Release</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRelease() - * @generated - * @ordered - */ - protected static final int RELEASE_EDEFAULT = 0; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected int release = RELEASE_EDEFAULT; - /** - * The default value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSingleFilterStringOnly() - * @generated - * @ordered - */ - protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; - - /** - * The cached value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSingleFilterStringOnly() - * @generated - * @ordered - */ - protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; - - /** - * This is true if the Single Filter String Only attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean singleFilterStringOnlyESet = false; - - /** - * The default value of the '{@link #getOwningParentName() <em>Owning Parent Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOwningParentName() - * @generated - * @ordered - */ - protected static final String OWNING_PARENT_NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getOwningParentName() <em>Owning Parent Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOwningParentName() - * @generated - * @ordered - */ - protected String owningParentName = OWNING_PARENT_NAME_EDEFAULT; - - /** - * The default value of the '{@link #isNonRenamable() <em>Non Renamable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isNonRenamable() - * @generated - * @ordered - */ - protected static final boolean NON_RENAMABLE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isNonRenamable() <em>Non Renamable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isNonRenamable() - * @generated - * @ordered - */ - protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected java.util.List filters = null; - - /** - * Default constructor - */ - public SystemFilterPool(String poolName, boolean allowNestedFilters, boolean isDeletable) - { - super(); - helpers = new SystemFilterContainerCommonMethods(); - setRelease(RSECorePlugin.CURRENT_RELEASE); - if (!initialized) { - initialize(poolName, savePolicy, namingPolicy); - } - setDeletable(isDeletable); // mof attribute - setSupportsNestedFilters(allowNestedFilters); // cascades to each filter - } - - /* - * Private helper method to core initialization, from either createXXX or restore. - */ - protected void initialize(String name, - int savePolicy, IRSEFilterNamingPolicy namingPolicy) - { - setName(name); // mof attribute - setSavePolicy(savePolicy); - setNamingPolicy(namingPolicy); - - initialized = true; - } - - - //protected Vector internalGetFilters() - protected java.util.List internalGetFilters() - { - //return filters; - return getFilters(); // mof-supplied in parent class - } - - /** - * Return the caller which instantiated the filter pool manager overseeing this filter framework instance - */ - public ISystemFilterPoolManagerProvider getProvider() - { - ISystemFilterPoolManager mgr = getSystemFilterPoolManager(); - if (mgr != null) - return mgr.getProvider(); - else - return null; - } - - /** - * Set the save file policy. See constants in {@link org.eclipse.rse.internal.core.filters.ISystemFilterConstants SystemFilterConstants}. - * One of: - * <ul> - * <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool - * <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder - * <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool - * </ul> - * This method is called by the SystemFilterPoolManager. - */ - public void setSavePolicy(int policy) - { - if (this.savePolicy != policy) - { - this.savePolicy = policy; - setDirty(true); - } - } - - /** - * Set the naming policy used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - */ - public void setNamingPolicy(IRSEFilterNamingPolicy namingPolicy) - { - if (this.namingPolicy != namingPolicy) - { - this.namingPolicy = namingPolicy; - setDirty(true); - } - } - - /** - * Get the naming policy currently used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - */ - public IRSEFilterNamingPolicy getNamingPolicy() - { - return namingPolicy; - } - - /** - * Set whether filters in this pool support nested filters. - * Important to note this is stored in every filter as well as this filter pool. - */ - public void setSupportsNestedFilters(boolean supports) - { - this.setSupportsNestedFiltersGen(supports); - ISystemFilter[] filters = getSystemFilters(); - if (filters != null) - for (int idx=0; idx<filters.length; idx++) - filters[idx].setSupportsNestedFilters(supports); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters) - { - supportsNestedFilters = newSupportsNestedFilters; - } - - /** - * Set whether filters in this pool support duplicate filter strings. - * Important to note this is stored in every filter as well as this filter pool. - */ - public void setSupportsDuplicateFilterStrings(boolean supports) - { - setSupportsDuplicateFilterStringsGen(supports); - ISystemFilter[] filters = getSystemFilters(); - if (filters != null) - for (int idx=0; idx<filters.length; idx++) - filters[idx].setSupportsDuplicateFilterStrings(supports); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) - { - supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; - setDirty(true); - } - - /** - * Set whether filters in this pool support case-sensitive filter strings. - * Important to note this is stored in every filter as well as this filter pool. - */ - public void setStringsCaseSensitive(boolean supports) - { - this.setStringsCaseSensitiveGen(supports); - ISystemFilter[] filters = getSystemFilters(); - if (filters != null) - for (int idx=0; idx<filters.length; idx++) - filters[idx].setStringsCaseSensitive(supports); - setDirty(true); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive) - { - stringsCaseSensitive = newStringsCaseSensitive; - stringsCaseSensitiveESet = true; - setDirty(true); - } - - /** - * Set the filter pool manager. Called by SystemFilterPoolManager - */ - public void setSystemFilterPoolManager(ISystemFilterPoolManager mgr) - { - this.mgr = mgr; - } - /** - * Return the filter pool manager managing this collection of filter pools and their filters. - */ - public ISystemFilterPoolManager getSystemFilterPoolManager() - { - return mgr; - } - - /** - * While setData is for global data to set in all objects in the filter framework, - * this is to set transient data that only the filter pool holds. - */ - public void setSystemFilterPoolData(Object data) - { - this.filterPoolData = data; - } - - /** - * Return transient data set via setFilterPoolData. - */ - public Object getSystemFilterPoolData() - { - return filterPoolData; - } - - public String getId() - { - return getProvider().getId(); - } - - /** - * @see ISystemFilterPool#getName() - */ - public String getName() - { - return name; - } - - public String getDescription() - { - return RSECoreMessages.RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION; - } - - /** - * Set the name of this filter pool. - */ - public void setName(String name) - { - if (this.name == null || !this.name.equals(name) ) - { - this.name = name; - setDirty(true); - } - } - - /** - * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null - * Allows tools to have typed filter pools - */ - public String getType() - { - String type = this.getTypeGen(); - if (type == null) - return ISystemFilterConstants.DEFAULT_TYPE; - else - return type; - } - /** - * @generated This field/method will be replaced during code generation - * Allows tools to have typed filter pools - */ - public String getTypeGen() - { - return type; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isDeletable() - { - return deletable; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDeletable(boolean newDeletable) - { - deletable = newDeletable; - setDirty(true); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isDefault() - { - return default_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDefault(boolean newDefault) - { - default_ = newDefault; - } - - /** - * Does this support nested filters? Calls mof-generated isSupportsNestedFilters. - */ - public boolean supportsNestedFilters() - { - return isSupportsNestedFilters(); - } - /** - * Does this support duplicate filter strings? Calls mof-generated isSupportsDuplicateFilterStrings. - */ - public boolean supportsDuplicateFilterStrings() - { - return isSupportsDuplicateFilterStrings(); - } - /** - * @return The value of the StringsCaseSensitive attribute - * Are filter strings in this filter case sensitive? - * If not set locally, queries the parent filter pool manager's atttribute. - */ - public boolean isStringsCaseSensitive() - { - if (!isSetStringsCaseSensitive()) - return getSystemFilterPoolManager().isStringsCaseSensitive(); - else - return stringsCaseSensitive; - } - /** - * Same as isStringsCaseSensitive() - * @return The value of the StringsCaseSensitive attribute - */ - public boolean areStringsCaseSensitive() - { - return isStringsCaseSensitive(); - } - /** - * Clone this filter pools' attributes and filters into another filter pool. - * Assumes the core attributes were already set when filter pool was created: - * <ul> - * <li>Name - * <li>Deletable - * <li>Supports nested filters - * <li>Manager - * </ul> - * Attributes we clone: - * <ul> - * <li>Data - * <li>Type - * <li>Default - * <li>Case sensitive - * <li>Supports duplicate filter strings - * <li>Release - * </ul> - */ - public void cloneSystemFilterPool(ISystemFilterPool targetPool) - throws Exception - { - //System.out.println("In SystemFilterPoolImpl#cloneSystemFilterPool. targetPool null? " + (targetPool == null)); - if (filterPoolData != null) - targetPool.setSystemFilterPoolData(filterPoolData); - - //String ourType = getTypeGen(); - //if (ourType != null) - // targetPool.setType(ourType); - targetPool.setType(getType()); - - targetPool.setDeletable(isDeletable()); - targetPool.setSupportsNestedFilters(isSupportsNestedFilters()); - - //Boolean ourDefault = getDefault(); - //if (ourDefault != null) - // targetPool.setDefault(ourDefault); - targetPool.setDefault(isDefault()); - - targetPool.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings()); - targetPool.setRelease(getRelease()); - //targetPool.setNonDeletable(isNonDeletable()); - targetPool.setNonRenamable(isNonRenamable()); - targetPool.setOwningParentName(getOwningParentName()); - if (isSetSingleFilterStringOnly()) - targetPool.setSingleFilterStringOnly(isSingleFilterStringOnly()); - if (isSetStringsCaseSensitive()) - targetPool.setStringsCaseSensitive(isStringsCaseSensitive()); - - - ISystemFilter[] filters = getSystemFilters(); - if ((filters!=null) && (filters.length>0)) - { - for (int idx=0; idx<filters.length; idx++) - { - copySystemFilter(targetPool, filters[idx], filters[idx].getName()); - } - } - } - /** - * Copy a system filter to this or another filter pool. - */ - public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) - throws Exception - { - ISystemFilter newFilter = targetPool.createSystemFilter(newName, null); - oldFilter.clone(newFilter); - return newFilter; - } - /** - * Return filters in this pool, as an array. - */ - public ISystemFilter[] getSystemFilters() - { - return helpers.getSystemFilters(internalGetFilters()); - } - /** - * From SystemFilterContainer. - * Returns "this". - */ - public ISystemFilterPool getSystemFilterPool() - { - return this; - } - - /** - * Creates a new system filter within this pool. - * This filter will inherit/store the following attributes from this pool: - * <ul> - * <li>supportsNestedFilters - * <li>supportsDuplicateFilterStrings - * <li>stringsCaseSensitive - * </ul> - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - */ - public ISystemFilter createSystemFilter(String aliasName, Vector filterStrings) - { - ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), this, aliasName, filterStrings); - newFilter.setSupportsNestedFilters(supportsNestedFilters()); - newFilter.setStringsCaseSensitive(areStringsCaseSensitive()); - newFilter.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings()); - setDirty(true); - return newFilter; - } - - /** - * Return Vector of String objects: the names of existing filters in this container. - * Needed by name validators for New and Rename actions to verify new name is unique. - */ - public Vector getSystemFilterNames() - { - return helpers.getSystemFilterNames(internalGetFilters()); - } - - /** - * Return the nested filters as a Vector - */ - public Vector getSystemFiltersVector() - { - return helpers.getSystemFiltersVector(internalGetFilters()); - } - /** - * Return how many filters are defined in this filter container - */ - public int getSystemFilterCount() - { - return helpers.getSystemFilterCount(internalGetFilters()); - } - /** - * Return a filter object, given its aliasname. - * Can be used to test if an aliasname is already used (non-null return). - * @param aliasName unique aliasName (case insensitive) to search on. - * @return SystemFilter object with unique aliasName, or null if - * no filter object with this name exists. - */ - public ISystemFilter getSystemFilter(String aliasName) - { - return helpers.getSystemFilter(internalGetFilters(), aliasName); - } - /** - * Adds given filter to the list. - * <p>PLEASE NOTE: - * <ul> - * <li> createSystemFilter calls this method for you! - * <li> this is a no-op if a filter with the same aliasname already exists - * </ul> - * @param filter SystemFilter object to add - * @return true if added, false if filter with this aliasname already existed. - */ - public boolean addSystemFilter(ISystemFilter filter) - { - boolean result = helpers.addSystemFilter(internalGetFilters(),filter); - if (result) setDirty(true); - return result; - } - /** - * Removes a given filter from the list. - * @param filter SystemFilter object to remove - */ - public void deleteSystemFilter(ISystemFilter filter) - { - helpers.deleteSystemFilter(internalGetFilters(),filter); - setDirty(true); - } - - /** - * Rename a given filter in the list. - * @param filter SystemFilter object to remove - */ - public void renameSystemFilter(ISystemFilter filter, String newName) - { - helpers.renameSystemFilter(internalGetFilters(),filter, newName); - setDirty(true); - } - - /** - * Updates a given filter in the list. - * @param filter SystemFilter object to update - * @param newName New name to assign it. Assumes unique checking already done. - * @param newStrings New strings to assign it. Replaces current strings. - */ - public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings) - { - helpers.updateSystemFilter(internalGetFilters(), filter, newName, newStrings); - setDirty(true); - } - - /** - * Duplicates a given filter in the list. - * @param filter SystemFilter object to clone - * @param aliasName New, unique, alias name to give this filter. Clone will fail if this is not unique. - */ - public ISystemFilter cloneSystemFilter(ISystemFilter filter, String aliasName) - { - ISystemFilter result = helpers.cloneSystemFilter(internalGetFilters(), filter, aliasName); - setDirty(true); - return result; - } - - /** - * Return a given filter's zero-based location - */ - public int getSystemFilterPosition(ISystemFilter filter) - { - return helpers.getSystemFilterPosition(internalGetFilters(),filter); - } - - /** - * Move a given filter to a given zero-based location - */ - public void moveSystemFilter(int pos, ISystemFilter filter) - { - helpers.moveSystemFilter(internalGetFilters(),pos,filter); - setDirty(true); - } - - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - /** - * Private helper method to deduce filter names from disk files. - * Will populate and return a list. - * Only makes sense to use if the save policy is one file per filter. - */ - protected static Vector deduceFilterNames(IFolder folder, IRSEFilterNamingPolicy namingPolicy) - { - Vector filterNames = SystemResourceHelpers.getResourceHelpers().convertToVectorAndStrip( - SystemResourceHelpers.getResourceHelpers().listFiles(folder, - namingPolicy.getFilterSaveFileNamePrefix(), - ISystemFilterConstants.SAVEFILE_SUFFIX), - namingPolicy.getFilterSaveFileNamePrefix(), ISystemFilterConstants.SAVEFILE_SUFFIX); - return filterNames; - } - - - - /** - * Order filters according to user preferences. - * <p> - * While the framework has all the code necessary to arrange filters and save/restore - * that arrangement, you may choose to use preferences instead of this support. - * In this case, call this method and pass in the saved and sorted filter name list. - * <p> - * Called by someone after restore. - */ - public void orderSystemFilters(String[] names) - { - java.util.List filterList = internalGetFilters(); - ISystemFilter[] filters = new ISystemFilter[names.length]; - for (int idx=0; idx<filters.length; idx++) - filters[idx] = getSystemFilter(names[idx]); // convert name to filter - filterList.clear(); - for (int idx=0; idx<filters.length; idx++) - { - filterList.add(filters[idx]); - } - helpers.invalidateCache(); - } - - - // ----------------------- - // SAVE/RESTORE METHODS... - // ----------------------- - - /** - * Restore specific filter pool. You should not call this directly, as it is possible - * that certain data is not restored if the save policy is one file per filter. Rather, - * you should call the createSystemFilterPoolMethod. - * @param name name of pool to restore. Used to deduce file name for save policy of one file per pool. - * @param savePolicy policy used to save the pool. One of the following from SystemFilterPoolManager: - * <ul> - * <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool - * <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder - * <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool - * </ul> - * @param namingPolicy The names to use for file and folders when persisting to disk. Pass - * null to just use the defaults. - * @return SystemFilterPool object if restored ok, null if error encountered. If null, call getLastException(). - * @see org.eclipse.rse.internal.core.filters.ISystemFilterConstants - */ - protected static ISystemFilterPool restore(String name, int savePolicy, - IRSEFilterNamingPolicy namingPolicy) - throws Exception - { - if (namingPolicy == null) - namingPolicy = SystemFilterNamingPolicy.getNamingPolicy(); - - // FIXME SystemFilterImpl.initMOF(); // to be safe - - ISystemFilterPool pool = null; - /* FIXME - SystemFilterPool poolImpl = null; - switch(savePolicy) - { - case SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL: - pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, true); - poolImpl = (SystemFilterPoolImpl)pool; - break; - - case SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER: - pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, true); - poolImpl = (SystemFilterPoolImpl)pool; - break; - - case SAVE_POLICY_ONE_FILE_PER_FILTER: - pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, false); // restore data part - poolImpl = (SystemFilterPoolImpl)pool; - //pool = createPool(); - - poolImpl.setFolder(folder); // SystemFilter's restore will query it - pool.setNamingPolicy(namingPolicy); // SystemFilter's restore will query it - Vector filterNames = deduceFilterNames(folder, namingPolicy); - if (filterNames != null) - { - Exception lastException = null; - for (int idx=0; idx<filterNames.size(); idx++) - { - try { - SystemFilter filter = - SystemFilterImpl.restore(mofHelpers, folder, (String)filterNames.elementAt(idx), pool, namingPolicy); - poolImpl.addSystemFilter(filter); - } catch (Exception exc) {lastException = exc;} - } - if (lastException != null) - { - // todo, something! We want to signal the error, but not prevent pool from being restored. - // Only option: log it somewhere. - } - else - poolImpl.sortFilters(); - } - break; - } - if (poolImpl != null) - { - poolImpl.initialize(name,savePolicy,namingPolicy); - } - */ - return pool; - } - - - /** - * Internal use method - */ - protected void initializeFilterStrings() - { - java.util.List filters = getFilters(); - Iterator i = filters.iterator(); - while (i.hasNext()) - ((SystemFilter)i.next()).initializeFilterStrings(); - } - - /** - * When saving one file per filter, we store the relative order of each filter - * within each filter. After restoring, the filters are ordered by their file - * system existence, and so we must now re-order the internal list according to - * the relative order given in each filter - */ - protected void sortFilters() - { - java.util.List filterList = getFilters(); // get java.util.List - if (filterList.size() <= 1) // not enough to sort? - return; // outa here! - if (debug) - printFilterList("Before sorting"); //$NON-NLS-1$ - helpers.invalidateCache(); // force re-gen of array from java.util.List on next getSystemFilters() request - ISystemFilter[] filters = getSystemFilters(); // convert java.util.List to array - boolean[] processed = new boolean[filters.length]; - //for (int idx=0;idx<processed.length;idx++) - //processed[idx] = false; - filterList.clear(); // clear java.util.List - //boolean done = false; - int processedCount = 0; - int totalCount = filters.length; - int nextHighest = -1; - int firstMatchIdx = -1; - int round = 0; - boolean stop = false; - //int timeout = factorial(totalCount); - //System.out.println("Factorial of " + totalCount + " = " + timeout); - int timeout = totalCount + 1; - while ((processedCount != totalCount) && (round < timeout)) - { - nextHighest = 9999; - firstMatchIdx = -1; - stop = false; - // find next highest number - for (int idx=0; !stop && (idx<totalCount); idx++) - { - if (!processed[idx]) - { - int currOrder = filters[idx].getRelativeOrder(); - if (currOrder < nextHighest) - { - nextHighest = currOrder; - firstMatchIdx = idx; - //stop = true; - } - else if ((currOrder == nextHighest) && (firstMatchIdx==-1)) - { - firstMatchIdx = idx; - //stop = true; - } - } - } - ++round; - //System.out.println("Round " + round + ": nextHighest = " + nextHighest + ", firstMatchIdx = " + firstMatchIdx); - if (firstMatchIdx != -1) - { - filterList.add(filters[firstMatchIdx]); - processed[firstMatchIdx] = true; - ++processedCount; - } - } - helpers.invalidateCache(); // force re-gen of array from java.util.List on next getSystemFilters() request - if (debug) - printFilterList("After sorting"); //$NON-NLS-1$ - } - - private void printFilterList(String tagLine) - { - ISystemFilter[] filters = getSystemFilters(); - if (filters.length == 0) - return; - System.out.println(tagLine+" for filter pool " + getName()); //$NON-NLS-1$ - for (int idx=0; idx<filters.length; idx++) - { - System.out.println(" "+filters[idx].getName()+" "+filters[idx].getRelativeOrder()); //$NON-NLS-1$ //$NON-NLS-2$ - } - System.out.println(); - } - - - - /** - * Return the root save file name without the extension .xmi - */ - protected static String getRootSaveFileName(ISystemFilterPool pool) - { - return getRootSaveFileName(pool.getNamingPolicy(), pool.getName()); - } - /** - * Return the root save file name without the extension .xmi - */ - protected static String getRootSaveFileName(ISystemFilterPool pool, String newName) - { - return getRootSaveFileName(pool.getNamingPolicy(), newName); - } - /** - * Return the root save file name without the extension .xmi - */ - protected static String getRootSaveFileName(IRSEFilterNamingPolicy namingPolicy, String poolName) - { - return namingPolicy.getFilterPoolSaveFileName(poolName); - } - - - /** - * Return the unique reference name of this object. - * <p> - * As required by the {@link org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject IRSEPersistableReferencedObject} - * interface. - */ - public String getReferenceName() - { - return getSystemFilterPoolManager().getName()+DELIMITER+getName(); - } - - // ----------------------- - // HOUSEKEEPING METHODS... - // ----------------------- - /* */ - public String toString() - { - return getName(); - } - /** - * @generated This field/method will be replaced during code generation. - */ - public void setType(String newType) - { - type = newType; - setDirty(true); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isSupportsNestedFilters() - { - return supportsNestedFilters; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void unsetStringsCaseSensitive() - { - stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; - stringsCaseSensitiveESet = false; - setDirty(true); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean isSetStringsCaseSensitive() - { - return stringsCaseSensitiveESet; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public java.util.List getFilters() - { - if (filters == null) - { - filters = new ArrayList(); - //FIXME new EObjectContainmenteList(SystemFilter.class, this, FiltersPackage.SYSTEM_FILTER_POOL__FILTERS); - } - return filters; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isSupportsDuplicateFilterStrings() - { - return supportsDuplicateFilterStrings; - } - - /** - * @generated This field/method will be replaced during code generation - * In what release was this created? Typically, will be the version and release - * times 10, as in 40 or 51. - */ - public int getRelease() - { - return release; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setRelease(int newRelease) - { - release = newRelease; - setDirty(true); - } - - /** - * Returns true if this filter is limited to a single filter string. If not set here, - * it is queried from the parent manager. - */ - public boolean isSingleFilterStringOnly() - { - if (isSetSingleFilterStringOnly()) - return singleFilterStringOnly; - else - return getSystemFilterPoolManager().isSingleFilterStringOnly(); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSingleFilterStringOnlyGen() - { - return singleFilterStringOnly; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) - { - singleFilterStringOnly = newSingleFilterStringOnly; - singleFilterStringOnlyESet = true; - setDirty(true); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void unsetSingleFilterStringOnly() - { - singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; - singleFilterStringOnlyESet = false; - setDirty(true); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSetSingleFilterStringOnly() - { - return singleFilterStringOnlyESet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getOwningParentName() - { - return owningParentName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setOwningParentName(String newOwningParentName) - { - if (newOwningParentName != owningParentName) - { - owningParentName = newOwningParentName; - setDirty(true); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isNonRenamable() - { - return nonRenamable; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setNonRenamable(boolean newNonRenamable) - { - boolean oldNonRenamable = nonRenamable; - if (oldNonRenamable!= newNonRenamable) - { - nonRenamable = newNonRenamable; - setDirty(true); - } - } - - public boolean commit() - { - return getPersistableParent().commit(); - } - - public IRSEPersistableContainer getPersistableParent() { - ISystemProfile profile = null; - ISystemFilterPoolManager filterPoolManager = getSystemFilterPoolManager(); - if (filterPoolManager != null) { - profile = filterPoolManager.getSystemProfile(); - } - return profile; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - List children = new ArrayList(10); - children.addAll(Arrays.asList(getSystemFilters())); - children.addAll(Arrays.asList(getPropertySets())); - IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()]; - children.toArray(result); - return result; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolManager.java deleted file mode 100644 index 2f8f9243e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolManager.java +++ /dev/null @@ -1,1657 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. 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 Dykstal (IBM) - 142806: refactoring persistence framework - ********************************************************************************/ - -package org.eclipse.rse.internal.core.filters; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterContainer; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.RSEPersistableObject; -import org.eclipse.rse.core.references.IRSEBaseReferencingObject; -import org.eclipse.rse.logging.Logger; - -/** - * A filter pool manager manages filter pools. - * It is used to - * <ul> - * <li>Get a list of existing filter pools - * <li>Create filter pools - * <li>Delete filter pools - * <li>Clone filter pools - * <li>Rename filter pools - * </ul> - * <p> - * The filter pool manager ensures that - * changes to filters and pools are - * committed and events are fired properly. - * <p> - * This class is not intended to be subclassed by clients. - */ -public class SystemFilterPoolManager extends RSEPersistableObject implements ISystemFilterPoolManager { - private ISystemFilterPool[] poolArray = null; // cache for performance - private ISystemFilterPoolManagerProvider caller = null; - private Object poolMgrData; - private Vector poolNames; - private boolean initialized = false; - - private boolean suspendCallbacks = false; - private boolean suspendSave = false; - private Logger logger = null; - private ISystemProfile _profile; - - public static boolean debug = true; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - protected String name = NAME_EDEFAULT; - /** - * The default value of the '{@link #isSupportsNestedFilters() <em>Supports Nested Filters</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSupportsNestedFilters() - * @generated - * @ordered - */ - protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; - /** - * The default value of the '{@link #isStringsCaseSensitive() <em>Strings Case Sensitive</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isStringsCaseSensitive() - * @generated - * @ordered - */ - protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; - /** - * The default value of the '{@link #isSupportsDuplicateFilterStrings() <em>Supports Duplicate Filter Strings</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSupportsDuplicateFilterStrings() - * @generated - * @ordered - */ - protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; - /** - * This is true if the Supports Duplicate Filter Strings attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean supportsDuplicateFilterStringsESet = false; - - /** - * The default value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSingleFilterStringOnly() - * @generated - * @ordered - */ - protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; - - /** - * The cached value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSingleFilterStringOnly() - * @generated - * @ordered - */ - protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; - - protected List pools = null; - - /** - * Constructor - */ - private SystemFilterPoolManager(ISystemProfile profile) { - super(); - _profile = profile; - } - - public ISystemProfile getSystemProfile() { - return _profile; - } - - /** - * Factory to create a filter pool manager. - * @param profile the profile for which to create the filter pool manager. - * @param logger A logging object into which to log errors as they happen in the framework - * @param caller Objects which instantiate this class should implement the - * SystemFilterPoolManagerProvider interface, and pass "this" for this parameter. - * Given any filter framework object, it is possible to retrieve the caller's - * object via the getProvider method call. - * @param name the name of the filter pool manager. Typically this is also the name - * of the given folder, but this is not required. For the save policy of one file - * per manager, the name of the file is derived from this. For other save policies, - * the name is not used. - * @param allowNestedFilters true if filters inside filter pools in this manager are - * to allow nested filters. This is the default, but can be overridden at the - * individual filter pool level. - * @param savePolicy The save policy for the filter pools and filters. One of the - * following constants from the - * {@link ISystemFilterConstants} interface: - * <ul> - * <li>SAVE_POLICY_NONE - no files, all save/restore handled elsewhere - * <li>SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi - * <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool - * <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder - * <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool - * </ul> - * @param namingPolicy The names to use for file and folders when persisting to disk. Pass - * null to just use the defaults, or if using SAVE_POLICY_NONE. - */ - public static ISystemFilterPoolManager createSystemFilterPoolManager(ISystemProfile profile, Logger logger, - ISystemFilterPoolManagerProvider caller, String name, boolean allowNestedFilters, - int savePolicy, IRSEFilterNamingPolicy namingPolicy) { - SystemFilterPoolManager mgr = new SystemFilterPoolManager(profile); - mgr.initialize(logger, caller, name, allowNestedFilters); - return mgr; - } - - /* - * Private helper method to initialize state - */ - public void initialize(Logger logger, ISystemFilterPoolManagerProvider caller, String name, boolean allowNestedFilters) { - if (!initialized) { - initialize(logger, caller, name); // core data - } - setSupportsNestedFilters(allowNestedFilters); // cascade it down - invalidatePoolCache(); -// List pools = getPools(); -// ISystemFilterPool pool = null; -// Vector poolNames = getSystemFilterPoolNamesVector(); -// for (int idx = 0; idx < poolNames.size(); idx++) { -// String poolName = (String) poolNames.elementAt(idx); -//// pool = RSECorePlugin.getThePersistenceManager().restoreFilterPool(poolName); -// pool = null; // that's what the above returned -// pool.setSystemFilterPoolManager(this); -// pools.add(pool); -// -// /** FIXME test -// if (pool.specialCaseNoDataRestored) -// { -// pool.setDeletable(true); // what else to do? -// //pool.setSupportsNestedFilters(allowNestedFilters); will be cascaded down anyway -// } -// */ -// } - } - - /* - * Private helper method to do core initialization. - * Might be called from either the static factory method or the static restore method. - */ - public void initialize(Logger logger, ISystemFilterPoolManagerProvider caller, String name) { - this.logger = logger; - setProvider(caller); - setName(name); - setFilterPoolManager(); // cascade it down - initialized = true; - } - - /** - * Return the caller which instantiated the filter pool manager - */ - public ISystemFilterPoolManagerProvider getProvider() { - return caller; - } - - /** - * Set the caller instance which instantiated the filter pool manager. - * This is only recorded to enable getProvider from any filter framework object. - */ - public void setProvider(ISystemFilterPoolManagerProvider caller) { - this.caller = caller; - } - - /** - * Set the name of this manager. - */ - public void setName(String newName) { - if ((name == null && newName != null) || !name.equals(newName)) { - this.name = newName; - setDirty(true); - } - } - - /** - * Return attribute indicating if filter pools managed by this manager support nested filters. - * Same as isSupportsNestedFilters() - */ - public boolean supportsNestedFilters() { - return isSupportsNestedFilters(); - } - - /** - * Return attribute indicating if filters managed by this manager support nested duplicate filter strings. - * Same as isSupportsDuplicateFilterStrings() - */ - public boolean supportsDuplicateFilterStrings() { - //return allowDuplicateFilterStrings; - return isSupportsDuplicateFilterStrings(); - } - - /** - * Set attribute indicating if filter pools managed by this manager support nested filters, by default. - * Cascaded down to all pools, and all filters in all pools. - * Alternatively, just call it on the particular pool or filter it applies to. - */ - public void setSupportsNestedFilters(boolean newSupportsNestedFilters) { - // as generated by emf... - setSupportsNestedFiltersGen(newSupportsNestedFilters); - // our own stuff.. - ISystemFilterPool[] pools = getSystemFilterPools(); - for (int idx = 0; idx < pools.length; idx++) { - pools[idx].setSupportsNestedFilters(newSupportsNestedFilters); - } - } - - /** - * Set attribute indicating if filters managed by this manager support duplicate filter strings, by default. - * Cascaded down to all pools, and all filters in all pools. - * Alternatively, just call it on the particular pool or filter it applies to. - */ - public void setSupportsDuplicateFilterStrings(boolean newSupportsDuplicateFilterStrings) { - // as generated by emf... - setSupportsDuplicateFilterStringsGen(newSupportsDuplicateFilterStrings); - - // our own stuff.. - ISystemFilterPool[] pools = getSystemFilterPools(); - for (int idx = 0; idx < pools.length; idx++) { - pools[idx].setSupportsDuplicateFilterStrings(newSupportsDuplicateFilterStrings); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) { - supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; - supportsDuplicateFilterStringsESet = true; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isStringsCaseSensitive() { - return stringsCaseSensitive; - } - - /** - * Same as isStringsCaseSensitive() - * Are filter strings in this filter case sensitive? - * @return The value of the StringsCaseSensitive attribute - */ - public boolean areStringsCaseSensitive() { - return isStringsCaseSensitive(); - } - - /** - * Set attribute indicating if filters managed by this manager support case-sensitive filter strings, by default. - * Cascaded down to all pools, and all filters in all pools. - * Alternatively, just call it on the particular pool or filter it applies to. - */ - public void setStringsCaseSensitive(boolean newStringsCaseSensitive) { - // as generated by emf... - setStringsCaseSensitiveGen(newStringsCaseSensitive); - // our special code... - ISystemFilterPool[] pools = getSystemFilterPools(); - for (int idx = 0; idx < pools.length; idx++) { - pools[idx].setStringsCaseSensitive(newStringsCaseSensitive); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive) { - stringsCaseSensitive = newStringsCaseSensitive; - } - - /** - * Set transient variable pointing back to us. Called after restoring. - * Cascaded down to all pools, and all filters in all pools. - */ - protected void setFilterPoolManager() { - ISystemFilterPool[] pools = getSystemFilterPools(); - for (int idx = 0; idx < pools.length; idx++) { - pools[idx].setSystemFilterPoolManager(this); - } - } - - /** - * This is to set transient data that is subsequently queryable. - */ - public void setSystemFilterPoolManagerData(Object data) { - this.poolMgrData = data; - } - - /** - * Return transient data set via setFilterPoolData. - */ - public Object getSystemFilterPoolManagerData() { - return poolMgrData; - } - - /** - * Return array of SystemFilterPools managed by this manager. - */ - public ISystemFilterPool[] getSystemFilterPools() { - //System.out.println("Inside getSFPools for mgr "+getName()+". poolArray null? "+(poolArray==null)); - if ((poolArray == null) || (getPools().size() != poolArray.length)) { - List pools = getPools(); - poolArray = new ISystemFilterPool[pools.size()]; - Iterator i = pools.iterator(); - int idx = 0; - while (i.hasNext()) - poolArray[idx++] = (ISystemFilterPool) i.next(); - //System.out.println("Pool array created. length = "+poolArray.length); - } - return poolArray; - } - - /** - * Get list of filter pool names currently existing. - */ - public String[] getSystemFilterPoolNames() { - Vector v = getSystemFilterPoolNamesVector(); - String[] names = new String[v.size()]; - for (int idx = 0; idx < names.length; idx++) - names[idx] = (String) v.elementAt(idx); - return names; - } - - /** - * Get list of filter pool names currently existing. - */ - public Vector getSystemFilterPoolNamesVector() { - List pools = getPools(); - if ((poolNames == null) || (poolNames.size() != pools.size())) // been invalidated? - { - poolNames = new Vector(); - Iterator i = pools.iterator(); - while (i.hasNext()) - poolNames.addElement(((ISystemFilterPool) i.next()).getName()); - } - return poolNames; - } - - /* - * Call this to invalidate array cache after any activity - */ - private void invalidatePoolCache() { - poolArray = null; - poolNames = null; - } - - /** - * Create a new filter pool. - * Inherits the following attributes from this manager: - * <ul> - * <li>data ... the transient data to be associated with every filter pool and filter - * <li>supportsNestedFilters ... whether filters in the pool can themselves contain filters - * <li>save policy - * <li>filter pool folder and file name prefixes - * </ul> - * <p> - * If a pool of this name already exists, null will be returned. - * <p> - * Depending on the save policy, a new folder to hold the pool may be created. Its name will - * be derived from the pool name. - * <p> - * If the operation is successful, the pool will be saved to disk. - * <p> - * If this operation fails unexpectedly, an exception will be thrown. - * <p> - * Calls back to inform provider of this event - */ - public ISystemFilterPool createSystemFilterPool(String poolName, boolean isDeletable) throws Exception { - ISystemFilterPool pool = null; - poolName = poolName.trim(); - if (getSystemFilterPool(poolName) == null) { - pool = new SystemFilterPool(poolName, supportsNestedFilters(), isDeletable); - pool.setSystemFilterPoolManager(this); - pool.setStringsCaseSensitive(areStringsCaseSensitive()); - pool.setSupportsDuplicateFilterStrings(isSetSupportsDuplicateFilterStrings() && supportsDuplicateFilterStrings()); - List pools = getPools(); - pools.add(pool); - invalidatePoolCache(); - commit(pool); - if ((caller != null) && !suspendCallbacks) { - caller.filterEventFilterPoolCreated(pool); - } - } - return pool; - } - - /** - * Delete a given filter pool. Dependending on the save policy, the - * appropriate file or folder on disk will also be deleted. - * <p> - * Does the following: - * <ul> - * <li>Removes all references - * <li>Removes pool object from in-memory model - * <li>Removes folder from disk for policies of one folder per pool - * <li>Removes file from disk for policy of one file per pool - * <li>Saves model to disk for policy of one file per manager - * <li>Invalidates in-memory caches - * <li>Calls back to inform caller of this event - * </ul> - * @param pool The filter pool object to physically delete - */ - public void deleteSystemFilterPool(ISystemFilterPool pool) throws Exception { - - // remove all references - IRSEBaseReferencingObject[] refs = pool.getReferencingObjects(); - //boolean needsSave = false; - if (refs != null) { - for (int idx = 0; idx < refs.length; idx++) { - if (refs[idx] instanceof ISystemFilterPoolReference) { - ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference) refs[idx]; - ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager(); - if (fprMgr != null) fprMgr.removeSystemFilterPoolReference(fpRef, false);// false means don't dereference - } - } - } - // DWD removing a pool should mark its parent profile as dirty and cause a save to be "scheduled" - - // remove from model - List pools = getPools(); - pools.remove(pool); - invalidatePoolCache(); - - /* FIXME - // now in EMF, the pools are "owned" by the Resource, and only referenced by this pool manager, - // so I don't think just removing it from the manager is enough... it must also be removed from its - // resource. Phil. - Resource res = pool.eResource(); - if (res != null) - res.getContents().remove(pool); - - // remove from disk - if ( (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL) || - (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_FILTER) ) - { - String expectedFolderName = derivePoolFolderName(poolName); - if (expectedFolderName.equals(poolFolder.getName())) - { - // folder name equals what we would have named it if left to us. - // assumption is this folder only exists to hold this pool! - if (poolFolder.exists()) - getResourceHelpers().deleteResource(poolFolder); - } - } - else if (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER) - { - String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool); - IFile poolFile = SystemResourceHelpers.getResourceHelpers().getFile(poolFolder,poolFileName); - if (poolFile.exists()) - getResourceHelpers().deleteResource(poolFile); - } - else // all pools in one file per manager. Just save it - { - commit(); - } - invalidatePoolCache(); - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) - caller.filterEventFilterPoolDeleted(pool); - */ - } - - /** - * Delete all existing filter pools. Call this when you are about to delete this manager, say. - */ - public void deleteAllSystemFilterPools() { - ISystemFilterPool[] allPools = getSystemFilterPools(); - for (int idx = 0; idx < allPools.length; idx++) { - String name = allPools[idx].getName(); - try { - deleteSystemFilterPool(allPools[idx]); - } catch (Exception exc) { - logError("Exception deleting filter pool " + name + " from mgr " + getName(), exc); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - } - - /** - * Pre-test if we are going to run into any trouble renaming any of the files or folders - * used to persist a filter pool. - * @return true if everything seems ok, false if a file/folder is in use. - */ - public boolean preTestRenameFilterPool(ISystemFilterPool pool) throws Exception { - boolean ok = true; - /* - * DWD this looks like it needs to be modified so that it queries the persistence - * manager to see if the pool can be renamed. The provider is in charge of determining - * pool names in the persistent form. The Manager will have to construct a DOM - * object for this pool and query the appropriate provider. - */ - /* FIXME - if ( (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL) || - (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_FILTER) ) - { - String expectedFolderName = derivePoolFolderName(pool.getName()); - boolean ourFolderName = expectedFolderName.equals(pool.getFolder().getName()); - // we must rename the old file... - String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool); - IFile poolFile = getResourceHelpers().getFile(pool.getFolder(),poolFileName); - IFolder poolFolder = pool.getFolder(); - - // first, pre-test for file-in-use error: - boolean inUse = poolFile.exists() && SystemResourceHelpers.testIfResourceInUse(poolFile); - if (inUse) - { - SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FILE_INUSE); - msg.makeSubstitution(poolFile.getFullPath()); - throw new SystemMessageException(msg); - } - // next, pre-test for folder-in-use error: - if (ourFolderName) - { - inUse = poolFolder.exists() && SystemResourceHelpers.testIfResourceInUse(poolFolder); - if (inUse) - { - SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_INUSE); - msg.makeSubstitution(poolFolder.getFullPath()); - throw new SystemMessageException(msg); - } - } - } - else if (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER) - { - String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool); - IFile poolFile = getResourceHelpers().getFile(pool.getFolder(),poolFileName); - // first, pre-test for file-in-use error: - boolean inUse = poolFile.exists() && SystemResourceHelpers.testIfResourceInUse(poolFile); - if (inUse) - { - SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FILE_INUSE); - msg.makeSubstitution(poolFile.getFullPath()); - throw new SystemMessageException(msg); - } - } - */ - return ok; - } - - /** - * Rename a given filter pool. Dependending on the save policy, the - * appropriate file or folder on disk will also be renamed. - * <p> - * Does the following: - * <ul> - * <li>Updates all referencing objects - * <li>Renames pool object in the in-memory model - * <li>Renames folder on disk for policies of one folder per pool - * <li>Renames file on disk for policy of one file per pool - * <li>Saves model to disk for policy of one file per manager - * <li>Invalidates in-memory caches - * <li>Calls back to provider to inform of this event. - * </ul> - * @param pool The filter pool object to physically rename - * @param newName The new name to give the pool - */ - public void renameSystemFilterPool(ISystemFilterPool pool, String newName) throws Exception { - /* - * DWD Renaming a filter pool should mark its parent profile as dirty and - * the pool itself as dirty. A rewrite of the profile should be scheduled. - */ - - String oldName = pool.getName(); - // rename on disk - /* FIXME - int oldLen = oldName.length(); - int newLen = newName.length(); - if ( (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL) || - (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_FILTER) ) - { - String expectedFolderName = derivePoolFolderName(pool.getName()); - boolean ourFolderName = expectedFolderName.equals(pool.getFolder().getName()); - // we must rename the old file... - String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool); - String poolFileNewName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool,newName); - IFile poolFile = getResourceHelpers().getFile(pool.getFolder(),poolFileName); - IFolder poolFolder = pool.getFolder(); - - // first, pre-test for file-in-use error: - boolean inUse = poolFile.exists() && SystemResourceHelpers.testIfResourceInUse(poolFile); - if (inUse) - { - SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FILE_INUSE); - msg.makeSubstitution(poolFile.getFullPath()); - throw new SystemMessageException(msg); - } - // next, pre-test for folder-in-use error: - if (ourFolderName) - { - inUse = poolFolder.exists() && SystemResourceHelpers.testIfResourceInUse(poolFolder); - if (inUse) - { - SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_INUSE); - msg.makeSubstitution(poolFolder.getFullPath()); - throw new SystemMessageException(msg); - } - } - - if (poolFile.exists()) - { - // pre-test if the new name will be too long for MOF (256) - if (nameLenDiff > 0) - { - if (ourFolderName) - nameLenDiff *= 2; // new name affects folder and file - int newNameLen = poolFile.getLocation().toOSString().length() + nameLenDiff; - if (newNameLen > 256) - throw new Exception("Fully qualified filter pool name too long for "+newName+". Exceeds 256 characters"); - } - getResourceHelpers().renameResource(poolFile, poolFileNewName); - } - if (ourFolderName) - { - // folder name equals what we would have named it if left to us. - // assumption is this folder only exists to hold this pool! - if (poolFolder.exists()) - { - String newFolderName = derivePoolFolderName(newName); - getResourceHelpers().renameResource(poolFolder, newFolderName); - // as we now know, the original IFolder still points to the old name! - poolFolder = getResourceHelpers().getRenamedFolder(poolFolder, newFolderName); - pool.setFolder(poolFolder); - } - } - } - else if (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER) - { - String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool); - IFile poolFile = getResourceHelpers().getFile(pool.getFolder(),poolFileName); - // first, pre-test for file-in-use error: - boolean inUse = poolFile.exists() && SystemResourceHelpers.testIfResourceInUse(poolFile); - if (inUse) - { - SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FILE_INUSE); - msg.makeSubstitution(poolFile.getFullPath()); - throw new SystemMessageException(msg); - } - if (poolFile.exists()) - { - String poolFileNewName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool,newName); - getResourceHelpers().renameResource(poolFile, poolFileNewName); - } - } - */ - pool.setName(newName); - invalidatePoolCache(); - - // inform all referencees - IRSEBaseReferencingObject[] refs = pool.getReferencingObjects(); - if (refs != null) { - for (int idx = 0; idx < refs.length; idx++) { - IRSEBaseReferencingObject ref = refs[idx]; - if (ref instanceof ISystemFilterPoolReference) { - ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference) ref; - ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager(); - fprMgr.renameReferenceToSystemFilterPool(pool); - } - } - } - - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterPoolRenamed(pool, oldName); - } - - /** - * Copy the specified filter pool from this manager to this manager or another manager. - * <p> - * Does the following: - * <ul> - * <li>Clones all filters within the pool - * <li>Clones all filter strings within each filter - * <li>Asks target manager to save to disk - * <li>Calls back to target manager provider, unless callbacks are suspended - * </ul> - * @param targetMgr The target manager to copy our filter pool to. Can be this manager, but target pool name must be unique. - * @param oldPool The filter pool to copy - * @param newName The new name to give the copied pool - * @return the new copy - */ - public ISystemFilterPool copySystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName) throws Exception { - ISystemFilterPool newPool = targetMgr.createSystemFilterPool(newName, oldPool.isDeletable()); - //System.out.println("In SystemFilterPoolManagerImpl#copySystemFilterPool: newPool "+newName+" null? " + (newPool == null)); - oldPool.cloneSystemFilterPool(newPool); - commit(newPool); // save it all to disk - return newPool; - } - - /** - * Move the specified filter pool from this manager to another manager. - * <p> - * Does the following: - * <ul> - * <li>Performs a {@link #copySystemFilterPool(ISystemFilterPoolManager, ISystemFilterPool, String) copySystemFilterPool} operation. - * <li>If copy is successful, updates all references to reference the new copy. - * <li>If copy is successful, deletes original filter pool in this manager - * <li>If this final delete fails, deletes the copied version and restore original references - * <li>Asks target manager to save to disk - * <li>Saves this manager to disk - * <li>Calls back to both targer manager provider and this manager provider, unless callbacks are suspended - * </ul> - * @param targetMgr The target manager to move our filter pool to. Cannot be this manager. - * @param oldPool The filter pool to move - * @param newName The new name to give the moved pool - * @return the new copy of the moved system filter pool - */ - public ISystemFilterPool moveSystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName) throws Exception { - ISystemFilterPool newPool = copySystemFilterPool(targetMgr, oldPool, newName); - // find all references to original, and reset them to reference the new... - IRSEBaseReferencingObject[] refs = oldPool.getReferencingObjects(); - if (refs != null) { - for (int idx = 0; idx < refs.length; idx++) { - if (refs[idx] instanceof ISystemFilterPoolReference) { - ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference) refs[idx]; - //SystemFilterPool fp = fpRef.getReferencedFilterPool(); - ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager(); - fprMgr.resetSystemFilterPoolReference(fpRef, newPool); // reset the referenced pool - } - } - } - try { - deleteSystemFilterPool(oldPool); - } catch (Exception exc) { - if (refs != null) { - for (int idx = 0; idx < refs.length; idx++) { - if (refs[idx] instanceof ISystemFilterPoolReference) { - ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference) refs[idx]; - ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager(); - fprMgr.resetSystemFilterPoolReference(fpRef, oldPool); // reset the referenced pool - } - } - } - targetMgr.deleteSystemFilterPool(newPool); - throw exc; - } - return newPool; - } - - /** - * Copy all filter pools from this manager to another manager. - * <p> - * Does the following: - * <ul> - * <li>Clones all filter pools - * <li>Clones all filters within each pool - * <li>Clones all filter strings within each filter - * <li>Asks target manager to save to disk - * <li>Does not callback to caller to fire events, assumes caller doesn't want to know - * </ul> - * @param targetMgr The target manager to copy our filter pools to - */ - public void copySystemFilterPools(ISystemFilterPoolManager targetMgr) throws Exception { - targetMgr.setStringsCaseSensitive(areStringsCaseSensitive()); - ISystemFilterPool[] pools = getSystemFilterPools(); - if ((pools != null) && (pools.length > 0)) { - targetMgr.suspendCallbacks(true); - //boolean oldSuspendCallbacks = suspendCallbacks; - for (int idx = 0; idx < pools.length; idx++) { - ISystemFilterPool pool = pools[idx]; - copySystemFilterPool(targetMgr, pool, pool.getName()); - } - //suspendCallbacks = oldSuspendCallbacks; - targetMgr.suspendCallbacks(false); - } - } - - /** - * Given a filter pool name, return that filter pool object. - * If not found, returns null. - */ - public ISystemFilterPool getSystemFilterPool(String name) { - ISystemFilterPool pool = null; - ISystemFilterPool[] pools = getSystemFilterPools(); - if (pools != null) { - for (int idx = 0; (idx < pools.length) && (pool == null); idx++) { - if (pools[idx].getName().equals(name)) pool = pools[idx]; - } - } - return pool; - } - - /** - * Return the first pool that has the default attribute set to true. - * If none found, returns null. - */ - public ISystemFilterPool getFirstDefaultSystemFilterPool() { - ISystemFilterPool pool = null; - ISystemFilterPool[] pools = getSystemFilterPools(); - for (int idx = 0; (pool == null) && (idx < pools.length); idx++) - if (pools[idx].isDefault()) pool = pools[idx]; - return pool; - } - - // --------------------------------- - // FILTER METHODS - // --------------------------------- - /** - * Creates a new system filter within the given filter container (either a filter pool, or - * a filter). This creates the filter, and then saves the filter pool. - * <p>Calls back to inform provider of this event (filterEventFilterCreated) - * @param parent The parent which is either a SystemFilterPool or a SystemFilter - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - */ - public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings) throws Exception { - ISystemFilter newFilter = null; - ISystemFilterPool parentPool = null; - if (parent instanceof ISystemFilterPool) - parentPool = (ISystemFilterPool) parent; - else - parentPool = ((ISystemFilter) parent).getParentFilterPool(); - newFilter = parent.createSystemFilter(aliasName, filterStrings); - if (!suspendSave) commit(parentPool); - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterCreated(newFilter); - return newFilter; - } - - /** - * Creates a new system filter that is typed. - * Same as {@link #createSystemFilter(ISystemFilterContainer, String, Vector)} but - * takes a filter type as an additional parameter. - * <p> - * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This - * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique - * actions per type, say. - * - * @param parent The parent which is either a SystemFilterPool or a SystemFilter - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - * @param type The type of this filter - */ - public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings, String type) throws Exception { - boolean oldSuspendSave = suspendSave; - boolean oldSuspendCallbacks = suspendCallbacks; - suspendSave = true; - suspendCallbacks = true; - - ISystemFilter newFilter = createSystemFilter(parent, aliasName, filterStrings); - newFilter.setType(type); - - suspendSave = oldSuspendSave; - suspendCallbacks = oldSuspendCallbacks; - - if (!suspendSave) { - ISystemFilterPool parentPool = null; - if (parent instanceof ISystemFilterPool) - parentPool = (ISystemFilterPool) parent; - else - parentPool = ((ISystemFilter) parent).getParentFilterPool(); - commit(parentPool); - } - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterCreated(newFilter); - return newFilter; - } - - /** - * Creates a new system filter that is typed and promptable - * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,Vector, String)} but - * takes a boolean indicating if it is promptable. - * <p> - * A promptable filter is one in which the user is prompted for information at expand time. - * There is no base filter framework support for this, but tools can query this attribute and - * do their own thing at expand time. - * - * @param parent The parent which is either a SystemFilterPool or a SystemFilter - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - * @param type The type of this filter - * @param promptable Pass true if this is a promptable filter - */ - public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings, String type, boolean promptable) throws Exception { - boolean oldSuspendSave = suspendSave; - boolean oldSuspendCallbacks = suspendCallbacks; - suspendSave = true; - suspendCallbacks = true; - - ISystemFilter newFilter = createSystemFilter(parent, aliasName, filterStrings, type); - newFilter.setPromptable(promptable); - - suspendSave = oldSuspendSave; - suspendCallbacks = oldSuspendCallbacks; - - if (!suspendSave) { - ISystemFilterPool parentPool = null; - if (parent instanceof ISystemFilterPool) - parentPool = (ISystemFilterPool) parent; - else - parentPool = ((ISystemFilter) parent).getParentFilterPool(); - commit(parentPool); - } - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterCreated(newFilter); - return newFilter; - } - - /** - * Delete an existing system filter. - * Does the following: - * <ul> - * <li>Removes filter from its parent in memory. - * <li>If appropriate for the save policy, deletes the filter's file from disk. - * <li>Save the SystemFilterPool which direct or indirectly contains the filter. - * <li>Calls back to provider to inform it of this event (filterEventFilterDeleted) - * </ul> - */ - public boolean deleteSystemFilter(ISystemFilter filter) throws Exception { - - // ok to proceed... - boolean ok = true; - ISystemFilterContainer parent = filter.getParentFilterContainer(); - parent.deleteSystemFilter(filter); - commit(filter.getParentFilterPool()); - - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterDeleted(filter); - return ok; - } - - /** - * Renames a filter. This is better than filter.setName(String newName) as it - * saves the parent pool to disk. - * <p> - * Does the following: - * <ul> - * <li>Renames the object in the in-memory cache - * <li>If appropriate for the save policy, rename's the filter's file on disk. - * <li>Save parent filter pool's in-memory object to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterRenamed) - * </ul> - * Does fire an event. - */ - public void renameSystemFilter(ISystemFilter filter, String newName) throws Exception { - - // ok to proceed - ISystemFilterContainer parent = filter.getParentFilterContainer(); - String oldName = filter.getName(); - parent.renameSystemFilter(filter, newName); - // rename on disk - try { - - commit(filter.getParentFilterPool()); - } catch (Exception exc) { - parent.renameSystemFilter(filter, oldName); // rollback name change - throw exc; - } - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterRenamed(filter, oldName); - } - - /** - * Updates a filter. This is better than doing it directly as it saves it to disk. - * <p> - * Does the following: - * <ul> - * <li>Updates the object in the in-memory cache - * <li>Save parent filter pool's in-memory object to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterUpdated). - * </ul> - */ - public void updateSystemFilter(ISystemFilter filter, String newName, String[] strings) throws Exception { - - // ok to proceed... - ISystemFilterContainer parent = filter.getParentFilterContainer(); - String oldName = filter.getName(); - boolean rename = !oldName.equals(newName); - if (rename) { - renameSystemFilter(filter, newName); - } - parent.updateSystemFilter(filter, newName, strings); - ISystemFilterPool parentPool = filter.getParentFilterPool(); - commit(parentPool); - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterUpdated(filter); - } - - /** - * Sets a filter's type. This is better than calling filter.setType(String) directly as it saves the filter to disk after. - * <p> - * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This - * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique - * actions per type, say. - * @param filter The filter to be modified - * @param newType The type of this filter - */ - public void setSystemFilterType(ISystemFilter filter, String newType) throws Exception { - filter.setType(newType); - commit(filter.getParentFilterPool()); - } - - /** - * Copy a system filter to a pool in this or another filter manager. - */ - public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) throws Exception { - ISystemFilterPoolManager targetMgr = targetPool.getSystemFilterPoolManager(); - ISystemFilterPool oldPool = oldFilter.getParentFilterPool(); - - targetMgr.suspendCallbacks(true); - - ISystemFilter newFilter = oldPool.copySystemFilter(targetPool, oldFilter, newName); // creates it in memory - commit(targetPool); // save updated pool to disk - - targetMgr.suspendCallbacks(false); - - targetMgr.getProvider().filterEventFilterCreated(newFilter); - return newFilter; - } - - /** - * Move a system filter to a pool in this or another filter manager. - * Does this by first copying the filter, and only if successful, deleting the old copy. - */ - public ISystemFilter moveSystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) throws Exception { - ISystemFilter newFilter = copySystemFilter(targetPool, oldFilter, newName); - if (newFilter != null) { - deleteSystemFilter(oldFilter); - } - return newFilter; - } - - /** - * Return the zero-based position of a SystemFilter object within its container - */ - public int getSystemFilterPosition(ISystemFilter filter) { - ISystemFilterContainer container = filter.getParentFilterContainer(); - int position = -1; - boolean match = false; - ISystemFilter[] filters = container.getSystemFilters(); - - for (int idx = 0; !match && (idx < filters.length); idx++) { - if (filters[idx].getName().equals(filter.getName())) { - match = true; - position = idx; - } - } - return position; - } - - /** - * Move existing filters a given number of positions in the same container. - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.<p> - * <p> - * Does the following: - * <ul> - * <li>After the move, the pool containing the filter is saved to disk. - * <li>Calls back to provider to inform of this event - * </ul> - * @param filters Array of SystemFilters to move. - * @param delta the amount by which to move the filters (filterEventFiltersRePositioned) - */ - public void moveSystemFilters(ISystemFilter filters[], int delta) throws Exception { - /* - * DWD revisit this. Make sure that the pool is scheduled to be saved. - */ - // ISystemFilterContainer container = filters[0].getParentFilterContainer(); - int[] oldPositions = new int[filters.length]; - for (int idx = 0; idx < filters.length; idx++) - oldPositions[idx] = getSystemFilterPosition(filters[idx]); - if (delta > 0) // moving down, process backwards - for (int idx = filters.length - 1; idx >= 0; idx--) - moveFilter(filters[idx], oldPositions[idx] + delta); - else - for (int idx = 0; idx < filters.length; idx++) - moveFilter(filters[idx], oldPositions[idx] + delta); - - commit(filters[0].getParentFilterPool()); - - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFiltersRePositioned(filters, delta); - } - - /** - * Move one filter to new zero-based position. - */ - private void moveFilter(ISystemFilter filter, int newPos) { - ISystemFilterContainer container = filter.getParentFilterContainer(); - container.moveSystemFilter(newPos, filter); - } - - /** - * Order filters according to user preferences. - * <p> - * While the framework has all the code necessary to arrange filters and save/restore - * that arrangement, you may choose to use preferences instead of this support. - * In this case, call this method and pass in the saved and sorted filter name list. - * <p> - * Called by someone after restore. - */ - public void orderSystemFilters(ISystemFilterPool pool, String[] names) throws Exception { - pool.orderSystemFilters(names); - commit(pool); - } - - // ------------------------------- - // SYSTEM FILTER STRING METHODS... - // ------------------------------- - /** - * Append a new filter string to the given filter's list - * <p> - * Does the following: - * <ul> - * <li>Adds the filter string to the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringCreated) - * </ul> - */ - public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString) throws Exception { - ISystemFilterString newFilterString = filter.addFilterString(newString); - ISystemFilterPool parentPool = filter.getParentFilterPool(); - commit(parentPool); - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterStringCreated(newFilterString); - return newFilterString; - } - - /** - * Insert a new filter string to the its filters' list, at the given zero-based position - * <p> - * Does the following: - * <ul> - * <li>Adds the filter string to the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringCreated) - * </ul> - */ - public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString, int position) throws Exception { - ISystemFilterString newFilterString = filter.addFilterString(newString, position); - ISystemFilterPool parentPool = filter.getParentFilterPool(); - commit(parentPool); - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterStringCreated(newFilterString); - return newFilterString; - } - - /** - * Delete a filter string from the given filter's list - * <p> - * Does the following: - * <ul> - * <li>Removes the filter string from the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringDeleted) - * </ul> - * @return true if given string was found and hence was deleted. - */ - public boolean removeSystemFilterString(ISystemFilter filter, String oldString) throws Exception { - ISystemFilterString oldFilterString = filter.removeFilterString(oldString); - if (oldFilterString == null) return false; - ISystemFilterPool parentPool = filter.getParentFilterPool(); - commit(parentPool); - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterStringDeleted(oldFilterString); - return true; - } - - /** - * Remove a filter string from this filter's list, given its SystemFilterString object. - * <p> - * Does the following: - * <ul> - * <li>Removes the filter string from the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringDeleted) - * </ul> - * @return true if the given string existed and hence was deleted. - */ - public boolean removeSystemFilterString(ISystemFilter filter, ISystemFilterString filterString) throws Exception { - boolean ok = filter.removeFilterString(filterString); - if (!ok) return false; - ISystemFilterPool parentPool = filter.getParentFilterPool(); - commit(parentPool); - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterStringDeleted(filterString); - return ok; - } - - /** - * Remove a filter string from the given filter's list, given its zero-based position - * <p> - * Does the following: - * <ul> - * <li>Removes the filter string from the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringDeleted) - * </ul> - * @return true if a string existed at the given position and hence was deleted. - */ - public boolean removeSystemFilterString(ISystemFilter filter, int position) throws Exception { - ISystemFilterString oldFilterString = filter.removeFilterString(position); - if (oldFilterString == null) return false; - ISystemFilterPool parentPool = filter.getParentFilterPool(); - commit(parentPool); - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterStringDeleted(oldFilterString); - return true; - } - - /** - * Update a filter string's string vale - * <p> - * Does the following: - * <ul> - * <li>Update the filter string in the in-memory cache - * <li>Saves parent filter pool to disk. - * <li>Calls back to provider to inform it of this event (filterEventFilterStringUpdated) - * </ul> - */ - public void updateSystemFilterString(ISystemFilterString filterString, String newValue) throws Exception { - if (newValue.equals(filterString.getString())) return; - ISystemFilter filter = filterString.getParentSystemFilter(); - filter.updateFilterString(filterString, newValue); - ISystemFilterPool parentPool = filter.getParentFilterPool(); - commit(parentPool); - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterStringUpdated(filterString); - } - - /** - * Return the zero-based position of a SystemFilterString object within its filter - */ - public int getSystemFilterStringPosition(ISystemFilterString filterString) { - ISystemFilter filter = filterString.getParentSystemFilter(); - int position = -1; - boolean match = false; - ISystemFilterString[] filterStrings = filter.getSystemFilterStrings(); - - String matchString = filterString.getString(); - for (int idx = 0; !match && (idx < filterStrings.length); idx++) { - if (filterStrings[idx].getString().equals(matchString)) { - match = true; - position = idx; - } - } - return position; - } - - /** - * Copy a system filter string to a filter in this or another filter pool manager. - */ - public ISystemFilterString copySystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString) throws Exception { - /* - * DWD revisit this. make sure that pool is persisted. - */ - ISystemFilterPool targetPool = targetFilter.getParentFilterPool(); - ISystemFilterPoolManager targetMgr = targetPool.getSystemFilterPoolManager(); - ISystemFilter oldFilter = oldFilterString.getParentSystemFilter(); - // ISystemFilterPool oldPool = oldFilter.getParentFilterPool(); - - targetMgr.suspendCallbacks(true); - - ISystemFilterString newFilterString = oldFilter.copySystemFilterString(targetFilter, oldFilterString); // creates it in memory - commit(targetPool); // save updated pool to disk - - targetMgr.suspendCallbacks(false); - - targetMgr.getProvider().filterEventFilterStringCreated(newFilterString); - return newFilterString; - } - - /** - * Move a system filter string to a filter in this or another filter pool manager. - * Does this by doing a copy operation, then if successful doing a delete operation. - */ - public ISystemFilterString moveSystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString) throws Exception { - ISystemFilterString newString = copySystemFilterString(targetFilter, oldFilterString); - if (newString != null) { - removeSystemFilterString(oldFilterString.getParentSystemFilter(), oldFilterString); - } - return newString; - } - - /** - * Move existing filter strings a given number of positions in the same filter - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.<p> - * <p> - * Does the following: - * <ul> - * <li>After the move, the filter pool containing the filter containing the filter strings is saved to disk. - * <li>Calls back to provider to inform of the event (filterEventFilterStringsRePositioned) - * </ul> - * @param filterStrings Array of SystemFilterStrings to move. - * @param delta the amount by which to move the filter strings - */ - public void moveSystemFilterStrings(ISystemFilterString filterStrings[], int delta) throws Exception { - ISystemFilter filter = filterStrings[0].getParentSystemFilter(); - int[] oldPositions = new int[filterStrings.length]; - for (int idx = 0; idx < filterStrings.length; idx++) - oldPositions[idx] = getSystemFilterStringPosition(filterStrings[idx]); - if (delta > 0) // moving down, process backwards - for (int idx = filterStrings.length - 1; idx >= 0; idx--) - moveFilterString(filter, filterStrings[idx], oldPositions[idx] + delta); - else - for (int idx = 0; idx < filterStrings.length; idx++) - moveFilterString(filter, filterStrings[idx], oldPositions[idx] + delta); - - commit(filter.getParentFilterPool()); - - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterStringsRePositioned(filterStrings, delta); - } - - /** - * Move one filter string to new zero-based position. - */ - private void moveFilterString(ISystemFilter filter, ISystemFilterString filterString, int newPos) { - filter.moveSystemFilterString(newPos, filterString); - } - - // ----------------------------------- - // SUSPEND/RESUME CALLBACKS METHODS... - // ----------------------------------- - /** - * Suspend callbacks to the provider - */ - public void suspendCallbacks(boolean suspend) { - suspendCallbacks = suspend; - } - - // ----------------------- - // SAVE/RESTORE METHODS... - // ----------------------- - /** - * Return the save file that will be written for the given filter pool. - * Will depend on this manager's save policy. - */ - public IFile getSaveFile(ISystemFilterPool pool) { - /* FIXME - switch(savePolicy) - { - // ONE FILE PER FILTER POOL MANAGER - case SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_MANAGER: - return SystemMOFHelpers.getSaveFile(getFolder(), getRootSaveFileName(this)); - // ONE FOLDER AND FILE PER FILTER POOL - case SystemFilterConstants.SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL: - // ONE FILE PER FILTER POOL, ONE FOLDER PER MANAGER - case SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER: - // ONE FILE PER FILTER - case SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_FILTER: - return ((SystemFilterPoolImpl)pool).getSaveFile(); - } - */ - return null; - } - - /** - * Restore filter pools when all are stored in one file - * @param logger The logging object to log errors to - * @param mgrFolder The folder containing the file to restore from. - * @param name The name of the manager, from which the file name is derived. - * @param namingPolicy Naming prefix information for persisted data file names. - */ - protected static ISystemFilterPoolManager restoreFromOneFile(Logger logger, IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy) throws Exception { - /* FIXME - String fileName = getRootSaveFileName(namingPolicy, name); - - List ext = getMOFHelpers(logger).restore(mgrFolder,fileName); - - SystemFilterPoolManager mgr = null; - - // should be exactly one system filter pool manager... - Iterator iList = ext.iterator(); - mgr = (SystemFilterPoolManager)iList.next(); - return mgr; - */ - return null; - } - - /** - * Return our logger - */ - public Logger getLogger() { - if (logger == null) logger = RSECorePlugin.getDefault().getLogger(); - return logger; - } - - /** - * Set our logger - */ - public void setLogger(Logger logger) { - this.logger = logger; - } - - /** - * Helper method for logging information - * - * @param message Message to be written to the log file - */ - public void logInfo(String message) { - if (logger != null) - logger.logInfo(message); - else - System.out.println(getClass().getName() + ": INFO: " + message); //$NON-NLS-1$ - } - - /** - * Helper method for logging warnings - * - * @param message Message to be written to the log file - */ - public void logWarning(String message) { - if (logger != null) - logger.logWarning(message); - else - System.out.println(getClass().getName() + ": WARNING: " + message); //$NON-NLS-1$ - } - - /** - * Helper method for logging errors (exceptions) - * - * @param message Message to be written to the log file - * - * @param exception Any exception that generated the error condition, - * this will be used to print a stack trace in the log file. - */ - public void logError(String message, Throwable exception) { - if (logger != null) - logger.logError(message, exception); - else { - String msg = exception.getMessage(); - if (msg == null) msg = exception.getClass().getName(); - System.out.println(getClass().getName() + ": " + message + ": " + msg); //$NON-NLS-1$ //$NON-NLS-2$ - exception.printStackTrace(); - } - } - - /** - * Helper method for logging debug messages - * - * @param prefix typically the name of the class issuing the debug message. Pass in either - * retrieved using this.getClass() (for non-static methods) - * or using MyClass.class (for static methods) - * - * @param message Message to be written to the log file - */ - public void logDebugMessage(String prefix, String message) { - if ((logger != null)) { - logger.logDebugMessage(prefix, message); - } else - System.out.println(getClass().getName() + ": DEBUG: " + message); //$NON-NLS-1$ - } - - /** - * Helper method for logging trace information - * - * @deprecated Use either logInfo, logWarning, logError, or logDebugMessage. This - * method now calls logInfo. - */ - public void logMessage(String msg) { - if (logger != null) - logger.logInfo(msg); - else - System.out.println(getClass().getName() + ": " + msg); //$NON-NLS-1$ - } - - // OTHER - - public String toString() { - return getName(); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public String getName() { - return name; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isSupportsNestedFilters() { - return supportsNestedFilters; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public List getPools() { - if (pools == null) { - pools = new ArrayList(); - } - return pools; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters) { - supportsNestedFilters = newSupportsNestedFilters; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isSupportsDuplicateFilterStrings() { - return supportsDuplicateFilterStrings; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void unsetSupportsDuplicateFilterStrings() { - supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; - supportsDuplicateFilterStringsESet = false; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean isSetSupportsDuplicateFilterStrings() { - return supportsDuplicateFilterStringsESet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSingleFilterStringOnly() { - return singleFilterStringOnly; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) { - boolean oldSingleFilterStringOnly = singleFilterStringOnly; - if (oldSingleFilterStringOnly != newSingleFilterStringOnly) { - singleFilterStringOnly = newSingleFilterStringOnly; - setDirty(true); - } - } - - /** - * Save all the filter pools to disk. - * Uses the save policy specified in this manager's factory method. - */ - public boolean commit() { - ISystemProfile profile = getSystemProfile(); - boolean result = profile.commit(); - return result; - } - - /** - * Save all the filter pools to disk. - * Uses the save policy specified in this manager's factory method. - */ - public boolean commit(ISystemFilterPool pool) { - boolean result = pool.commit(); - return result; - } - - public IRSEPersistableContainer getPersistableParent() { - return null; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - return IRSEPersistableContainer.NO_CHILDREN; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java deleted file mode 100644 index e631d90f1..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java +++ /dev/null @@ -1,293 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * David Dykstal (IBM) - [189858] made sure that a reference remains broken if the profile - * contained in the reference was not found. - * David Dykstal (IBM) - [192122] extended search to look for filter pools in - * profile during getReferencedFilterPool() rather than returning broken reference - ********************************************************************************/ - -package org.eclipse.rse.internal.core.filters; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterContainer; -import org.eclipse.rse.core.filters.ISystemFilterContainerReference; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.internal.references.SystemPersistableReferencingObject; - -/** - * A reference to a filter pool. A reference may be "resolved" or "unresolved". - */ -public class SystemFilterPoolReference extends SystemPersistableReferencingObject implements ISystemFilterPoolReference, ISystemFilterContainerReference, IAdaptable { - - private SystemFilterContainerReferenceCommonMethods containerHelper = null; - private ISystemFilterPoolManager filterPoolManager = null; - public static final String DELIMITER = "___"; //$NON-NLS-1$ - public static final int DELIMITER_LENGTH = 3; - - /** - * Default constructor. - */ - private SystemFilterPoolReference() { - super(); - containerHelper = new SystemFilterContainerReferenceCommonMethods(this); - } - - /** - * Constructs a new resolved filter pool reference. - * @param filterPool The filter pool that this filter will refer to. - */ - public SystemFilterPoolReference(ISystemFilterPool filterPool) { - this(); - setReferenceToFilterPool(filterPool); - } - - /** - * Constructs a new filter pool reference. This is an unresolved reference. - * @param filterPoolName the name of the filter pool. - */ - public SystemFilterPoolReference(String filterPoolName) { - this(); - setReferencedObjectName(filterPoolName); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getFilterPoolReferenceManager() - */ - public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() { - return (ISystemFilterPoolReferenceManager) getParentReferenceManager(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getProvider() - */ - public ISystemFilterPoolReferenceManagerProvider getProvider() { - ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); - if (mgr != null) - return mgr.getProvider(); - else - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapterType) { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getReferencedFilterPoolName() - */ - public String getReferencedFilterPoolName() { - /* - * A filter pool reference stores the name of the filter pool it references in the form managerName___filterPoolName. - * or in the unqualified form of filterPoolName which references a locally defined filter pool. - * ___ is the delimiter. Absence of the delimiter indicates an unqualified name. - * The filter pool manager name is the same as its owning profile. - */ - String savedName = getReferencedObjectName(); - String[] parts = savedName.split(DELIMITER, 2); - String result = parts[0]; - if (parts.length == 2) { - result = parts[1]; - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getReferencedFilterPoolManagerName() - */ - public String getReferencedFilterPoolManagerName() { - /* - * A filter pool reference stores the name of the filter pool it references in the form managerName___filterPoolName. - * or in the unqualified form of filterPoolName which references a locally defined filter pool. - * ___ is the delimiter. Absence of the delimiter indicates an unqualified name. - * The filter pool manager name is the same as its owning profile. - */ - String result = null; - String savedName = getReferencedObjectName(); - String[] parts = savedName.split(DELIMITER, 2); - if (parts.length == 2) { - result = parts[0]; - } else { - ISystemFilterPoolReferenceManagerProvider provider = getProvider(); - if (provider instanceof ISubSystem) { - ISubSystem subsystem = (ISubSystem) provider; - ISystemProfile profile = subsystem.getSystemProfile(); - result = profile.getName(); - } - } - if (result == null) { - RSECorePlugin.getDefault().getLogger().logWarning("Unexpected condition: filter pool manager name not found.", null); //$NON-NLS-1$ - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#resetReferencedFilterPoolName(java.lang.String) - */ - public void resetReferencedFilterPoolName(String newName) { - super.setReferencedObjectName(newName); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#setReferenceToFilterPool(org.eclipse.rse.core.filters.ISystemFilterPool) - */ - public void setReferenceToFilterPool(ISystemFilterPool pool) { - super.setReferencedObject(pool); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getReferencedFilterPool() - */ - public ISystemFilterPool getReferencedFilterPool() { - ISystemFilterPool filterPool = (ISystemFilterPool) getReferencedObject(); - if (filterPool == null) { - String filterPoolName = getReferencedFilterPoolName(); - String profileName = getReferencedFilterPoolManagerName(); - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISystemProfile profile = registry.getSystemProfile(profileName); - if (profile != null) { - ISubSystem subsystem = (ISubSystem) getProvider(); - ISubSystemConfiguration config = subsystem.getSubSystemConfiguration(); - filterPoolManager = config.getFilterPoolManager(profile); - filterPool = filterPoolManager.getSystemFilterPool(filterPoolName); - // TODO (dwd) may not need filter pools managers on a per subsystem configuration basis, investigate - // added for 192122 - search all pools in the profile, these are unique anyway - if (filterPool == null) { - ISystemFilterPool[] candidatePools = profile.getFilterPools(); - for (int i = 0; i < candidatePools.length; i++) { - ISystemFilterPool candidatePool = candidatePools[i]; - String candidatePoolName = candidatePool.getName(); - if (candidatePoolName.equals(filterPoolName)) { - filterPool = candidatePool; - break; - } - } - } - } - } - if (filterPool != null) { - setReferenceToFilterPool(filterPool); - setReferenceBroken(false); - } else { - setReferenceBroken(true); - } - return filterPool; - } - - // ------------------------------------------------------------- - // Methods common with SystemFilterPoolReferenceImpl, and hence - // abstracted out into SystemFilterContainerReference... - // ------------------------------------------------------------- - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterContainerReference#getReferencedSystemFilterContainer() - */ - public ISystemFilterContainer getReferencedSystemFilterContainer() { - return getReferencedFilterPool(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterContainerReference#getSystemFilterReferences(org.eclipse.rse.core.subsystems.ISubSystem) - */ - public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) { - return containerHelper.getSystemFilterReferences(subSystem); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterContainerReference#getSystemFilterReference(org.eclipse.rse.core.subsystems.ISubSystem, org.eclipse.rse.core.filters.ISystemFilter) - */ - public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) { - //return containerHelper.generateFilterReference(filter); - return containerHelper.generateAndRecordFilterReference(subSystem, filter); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterContainerReference#getExistingSystemFilterReference(org.eclipse.rse.core.subsystems.ISubSystem, org.eclipse.rse.core.filters.ISystemFilter) - */ - public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) { - return containerHelper.getExistingSystemFilterReference(subSystem, filter); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterContainerReference#hasFilters() - */ - public boolean hasFilters() { - return containerHelper.hasFilters(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterContainerReference#getFilterCount() - */ - public int getFilterCount() { - return containerHelper.getFilterCount(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEModelObject#getName() - */ - public String getName() { - return getReferencedFilterPoolName(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getFullName() - */ - public String getFullName() { - return getReferencedObjectName(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.persistance.IRSEPersistableContainer#commit() - */ - public boolean commit() { - return false; - // return RSEUIPlugin.getThePersistenceManager().commit(getProvider().); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#getPersistableParent() - */ - public IRSEPersistableContainer getPersistableParent() { - IRSEPersistableContainer parent = null; - ISystemFilterPoolReferenceManagerProvider provider = getProvider(); - if (provider instanceof IRSEPersistableContainer) { - parent = (IRSEPersistableContainer) provider; - } - return parent; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.IRSEPersistableContainer#getPersistableChildren() - */ - public IRSEPersistableContainer[] getPersistableChildren() { - return IRSEPersistableContainer.NO_CHILDREN; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReferenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReferenceManager.java deleted file mode 100644 index e5222f07a..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReferenceManager.java +++ /dev/null @@ -1,1042 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.rse.core.SystemResourceHelpers; -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.filters.ISystemFilterSavePolicies; -import org.eclipse.rse.core.filters.SystemFilterNamingPolicy; -import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.internal.references.SystemPersistableReferenceManager; - -/** - * This class manages a persistable list of objects each of which reference - * a filter pool. This class builds on the parent class SystemPersistableReferenceManager, - * offering convenience versions of the parent methods that are typed to the - * classes in the filters framework. - * - * There will be one of these instantiated for a subsystem. Filter pool references can - * be moved within a subsystem and this manager provides that function as well. - */ -/** - * @lastgen class SystemFilterPoolReferenceManagerImpl extends SystemPersistableReferenceManagerImpl implements SystemFilterPoolReferenceManager, SystemPersistableReferenceManager {} - */ -public class SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager implements ISystemFilterPoolReferenceManager { - //private SystemFilterPoolManager[] poolMgrs = null; - private ISystemFilterPoolManagerProvider poolMgrProvider = null; - private ISystemFilterPoolManager defaultPoolMgr = null; - private ISystemFilterPoolReferenceManagerProvider caller = null; - private IRSEFilterNamingPolicy namingPolicy = null; - private int savePolicy = ISystemFilterSavePolicies.SAVE_POLICY_NONE; - private Object mgrData = null; - private IFolder mgrFolder = null; - private boolean initialized = false; - private boolean noSave; - private boolean noEvents; - private boolean fireEvents = true; - private ISystemFilterPoolReference[] fpRefsArray = null; - private static final ISystemFilterPoolReference[] emptyFilterPoolRefArray = new ISystemFilterPoolReference[0]; - - /** - * Default constructor. Typically called by MOF factory methods. - */ - public SystemFilterPoolReferenceManager() { - super(); - } - - /** - * A factory method to create a SystemFilterPoolReferenceManager instance. - * @param caller Objects which instantiate this class should implement the - * SystemFilterPoolReferenceManagerProvider interface, and pass "this" for this parameter. - * Given any filter framework object, it is possible to retrieve the caller's - * object via the getProvider method call. - * @param relatedPoolManagerProvider The managers that owns the master list of filter pools that - * this manager will contain references to. - * @param mgrFolder the folder that will hold the persisted file. This is used when - * the save policy is SAVE_POLICY_ONE_FILE_PER_MANAGER. For SAVE_POLICY_NONE, this - * is not used. If it is used, it is created if it does not already exist. - * @param name the name of the filter pool reference manager. This is used when - * the save policy is SAVE_POLICY_ONE_FILE_PER_MANAGER, to deduce the file name. - * @param savePolicy The save policy for the filter pool references list. One of the - * following from the {@link org.eclipse.rse.internal.core.filters.ISystemFilterConstants SystemFilterConstants} - * interface: - * <ul> - * <li>SAVE_POLICY_NONE - no files, all save/restore handled elsewhere - * <li>SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi - * </ul> - * @param namingPolicy The names to use for file and folders when persisting to disk. Pass - * null to just use the defaults, or if using SAVE_POLICY_NONE. - * @return a filter pool reference manager - */ - public static ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(ISystemFilterPoolReferenceManagerProvider caller, - ISystemFilterPoolManagerProvider relatedPoolManagerProvider, IFolder mgrFolder, String name, int savePolicy, IRSEFilterNamingPolicy namingPolicy) { - SystemFilterPoolReferenceManager mgr = null; - - if (mgrFolder != null) SystemResourceHelpers.getResourceHelpers().ensureFolderExists(mgrFolder); - if (namingPolicy == null) namingPolicy = SystemFilterNamingPolicy.getNamingPolicy(); - try { - if (savePolicy != ISystemFilterSavePolicies.SAVE_POLICY_NONE) mgr = (SystemFilterPoolReferenceManager) restore(caller, mgrFolder, name, namingPolicy); - } catch (Exception exc) // real error trying to restore, versus simply not found. - { - // todo: something. Log the exception somewhere? - } - if (mgr == null) // not found or some serious error. - { - mgr = createManager(); - } - if (mgr != null) { - mgr.initialize(caller, mgrFolder, name, savePolicy, namingPolicy, relatedPoolManagerProvider); - } - - return mgr; - } - - /* - * Private helper method. - */ - protected static SystemFilterPoolReferenceManager createManager() { - ISystemFilterPoolReferenceManager mgr = new SystemFilterPoolReferenceManager(); - return (SystemFilterPoolReferenceManager) mgr; - } - - /* - * Private helper method to initialize state - */ - protected void initialize(ISystemFilterPoolReferenceManagerProvider caller, IFolder folder, String name, int savePolicy, IRSEFilterNamingPolicy namingPolicy, - ISystemFilterPoolManagerProvider relatedPoolManagerProvider) { - if (!initialized) initialize(caller, folder, name, savePolicy, namingPolicy); // core data - //setSystemFilterPoolManagers(relatedPoolManagers); - setSystemFilterPoolManagerProvider(relatedPoolManagerProvider); - } - - /* - * Private helper method to do core initialization. - * Might be called from either the static factory method or the static restore method. - */ - protected void initialize(ISystemFilterPoolReferenceManagerProvider caller, IFolder folder, String name, int savePolicy, IRSEFilterNamingPolicy namingPolicy) { - this.mgrFolder = folder; - setProvider(caller); - setName(name); - this.savePolicy = savePolicy; - setNamingPolicy(namingPolicy); - initialized = true; - } - - private void invalidateFilterPoolReferencesCache() { - fpRefsArray = null; - invalidateCache(); - } - - // ------------------------------------------------------------ - // Methods for setting and querying attributes - // ------------------------------------------------------------ - /** - * Set the associated master pool manager provider. Note the provider - * typically manages multiple pool managers and we manage references - * across those. - * @param poolMgrProvider the factory (provider) for the filter pool managers that this - * reference manager provides services to - */ - public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider poolMgrProvider) { - this.poolMgrProvider = poolMgrProvider; - } - - /** - * @return the associated master pool manager provider. Note the provider - * typically manages multiple pool managers and we manage references - * across those. - */ - public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider() { - return poolMgrProvider; - } - - /** - * @return the managers of the master list of filter pools, from which - * objects in this list reference. - */ - public ISystemFilterPoolManager[] getSystemFilterPoolManagers() { - return poolMgrProvider.getSystemFilterPoolManagers(); - } - - /** - * @return the managers of the master list of filter pools, from which - * objects in this list reference, but which are not in the list of - * managers our pool manager supplier gives us. That is, these are - * references to filter pools outside the expected list. - */ - public ISystemFilterPoolManager[] getAdditionalSystemFilterPoolManagers() { - ISystemFilterPoolManager[] poolMgrs = getSystemFilterPoolManagers(); - Vector v = new Vector(); - ISystemFilterPoolReference[] fpRefs = getSystemFilterPoolReferences(); - for (int idx = 0; idx < fpRefs.length; idx++) { - ISystemFilterPool pool = fpRefs[idx].getReferencedFilterPool(); - if (pool != null) { - ISystemFilterPoolManager mgr = pool.getSystemFilterPoolManager(); - if (!managerExists(poolMgrs, mgr) && !v.contains(mgr)) { - System.out.println("Found unmatched manager: " + mgr.getName()); //$NON-NLS-1$ - v.addElement(mgr); - } - } - } - ISystemFilterPoolManager[] additionalMgrs = null; - if (v.size() > 0) { - additionalMgrs = new ISystemFilterPoolManager[v.size()]; - for (int idx = 0; idx < v.size(); idx++) - additionalMgrs[idx] = (ISystemFilterPoolManager) v.elementAt(idx); - } - return additionalMgrs; - } - - /** - * Look for a pool manager in an array of pool managers. - * @param mgrs the array in which to look - * @param mgr the item to look for - * @return true if the manager was found - */ - private boolean managerExists(ISystemFilterPoolManager[] mgrs, ISystemFilterPoolManager mgr) { - boolean match = false; - for (int idx = 0; !match && (idx < mgrs.length); idx++) - if (mgr == mgrs[idx]) match = true; - return match; - } - - /** - * Set the default manager of the master list of filter pools, from which - * objects in this list reference. - * @param mgr the filter pool manager that is the default pool manager. - */ - public void setDefaultSystemFilterPoolManager(ISystemFilterPoolManager mgr) { - defaultPoolMgr = mgr; - } - - /** - * @return the default manager of the master list of filter pools, from which - * objects in this list reference. - */ - public ISystemFilterPoolManager getDefaultSystemFilterPoolManager() { - return defaultPoolMgr; - } - - /** - * @return the object (the "provider" or factory) which instantiated - * this instance of the filter pool reference manager. - * This is also available from any filter reference framework object. - */ - public ISystemFilterPoolReferenceManagerProvider getProvider() { - return caller; - } - - /** - * Set the object which instantiated this instance of the filter pool reference manager. - * This makes it available to retrieve from any filter reference framework object, - * via the ubiquitous getProvider interface method. - * @param caller the factory that created this instance. - */ - public void setProvider(ISystemFilterPoolReferenceManagerProvider caller) { - this.caller = caller; - } - - /** - * Turn callbacks to the provider either off or on. - * @param fireEvents true if events are to be fired to the provider object, false if not. - */ - public void setProviderEventNotification(boolean fireEvents) { - this.fireEvents = fireEvents; - } - - /** - * Set the naming policy used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - * @param namingPolicy the naming policy - no longer used. - */ - public void setNamingPolicy(IRSEFilterNamingPolicy namingPolicy) { - this.namingPolicy = namingPolicy; - } - - /** - * Get the naming policy currently used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - * @return the naming policy - no longer used. - */ - public IRSEFilterNamingPolicy getNamingPolicy() { - return namingPolicy; - } - - /** - * This is to set transient data that is subsequently queryable. - * @param data the data associated with this pool reference manager. - */ - public void setSystemFilterPoolReferenceManagerData(Object data) { - this.mgrData = data; - } - - /** - * @return transient data set via setFilterPoolData. - */ - public Object getSystemFilterPoolReferenceManagerData() { - return mgrData; - } - - /** - * Set the name. This is an override of mof-generated method - * in order to potentially rename the disk file for a save - * policy of SAVE_POLICY_ONE_FILE_PER_MANAGER. - * No longer used. - * @param name the name of this reference manager. - */ - public void setName(String name) { - if (savePolicy == ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_MANAGER) { - IFile file = getResourceHelpers().getFile(getFolder(), getSaveFileName()); - super.setName(name); - String newFileName = getSaveFileName(); - try { - getResourceHelpers().renameFile(file, newFileName); - } catch (Exception exc) { - } - } else - super.setName(name); - } - - // --------------------------------------------------- - // Methods that work on FilterPool referencing objects - // --------------------------------------------------- - /** - * Ask each referenced pool for its name, and update it. - * Called after the name of the pool or its manager changes. - */ - public void regenerateReferencedSystemFilterPoolNames() { - ISystemFilterPoolReference[] fpRefs = getSystemFilterPoolReferences(); - for (int idx = 0; idx < fpRefs.length; idx++) { - ISystemFilterPool pool = fpRefs[idx].getReferencedFilterPool(); - if (pool != null) fpRefs[idx].resetReferencedFilterPoolName(pool.getReferenceName()); - } - invalidateFilterPoolReferencesCache(); // just in case! - quietSave(); - } - - /** - * @return array of SystemFilterPoolReference objects. - * Result will never be null, although it may be an array of length zero. - */ - public ISystemFilterPoolReference[] getSystemFilterPoolReferences() { - IRSEBasePersistableReferencingObject[] refObjs = super.getReferencingObjects(); - if (refObjs.length == 0) - return emptyFilterPoolRefArray; - else if ((fpRefsArray == null) || (fpRefsArray.length != refObjs.length)) { - fpRefsArray = new ISystemFilterPoolReference[refObjs.length]; - for (int idx = 0; idx < fpRefsArray.length; idx++) - fpRefsArray[idx] = (ISystemFilterPoolReference) refObjs[idx]; - } - return fpRefsArray; - } - - /** - * In one shot, set the filter pool references. Calls back to inform provider. - * @param filterPoolReferences an array of filter pool reference objects to set the list to. - * @param deReference true to first de-reference all objects in the existing list. - */ - public void setSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolReferences, boolean deReference) { - super.setReferencingObjects(filterPoolReferences, deReference); - invalidateFilterPoolReferencesCache(); - // callback to provider so they can fire events in their GUI - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesReset(); - quietSave(); - } - - /** - * Create a filter pool reference. This creates a raw reference that must be added to the managed - * lists by the caller. - */ - private ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPool filterPool) { - ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference(filterPool); - invalidateFilterPoolReferencesCache(); - return filterPoolReference; - } - - /** - * Create a filter pool reference. This creates an unresolved raw reference that - * must be added to the managed lists by the caller. - * That will be attempted to be resolved on first use. - * @param filterPoolName the fully qualified filter pool name - */ - private ISystemFilterPoolReference createSystemFilterPoolReference(String filterPoolName) { - ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference(filterPoolName); - invalidateFilterPoolReferencesCache(); - return filterPoolReference; - } - - /** - * Add a filter pool referencing object to the list. - * @param filterPoolReference a reference to add to this manager - * @return the new count of referencing objects - */ - public int addSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference) { - int count = addReferencingObject(filterPoolReference); - filterPoolReference.setParentReferenceManager(this); // DWD - should be done in the addReferencingObject method? - invalidateFilterPoolReferencesCache(); - quietSave(); - return count; - } - - /** - * Reset the filter pool a reference points to. Called on a move-filter-pool operation - * @param filterPoolReference the reference to fix up - * @param newPool the new pool to reference - */ - public void resetSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, ISystemFilterPool newPool) { - filterPoolReference.removeReference(); - filterPoolReference.setReferencedObject(newPool); - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceReset(filterPoolReference); - quietSave(); - } - - /** - * Remove a filter pool referencing object from the list. - * @param filterPoolReference the reference to remove - * @param deReference true if we want to dereference the referenced object (call removeReference on it) - * @return the new count of referencing objects - */ - public int removeSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, boolean deReference) { - int count = 0; - if (!deReference) - count = super.removeReferencingObject(filterPoolReference); - else - count = super.removeAndDeReferenceReferencingObject(filterPoolReference); - filterPoolReference.setParentReferenceManager(null); // DWD should be done in remove? - invalidateFilterPoolReferencesCache(); - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceDeleted(filterPoolReference); - quietSave(); - return count; - } - - /** - * @return count of referenced filter pools - */ - public int getSystemFilterPoolReferenceCount() { - return super.getReferencingObjectCount(); - } - - /** - * @param filterPoolRef the filter pool reference to search for - * @return the zero-based position of the reference within this manager - */ - public int getSystemFilterPoolReferencePosition(ISystemFilterPoolReference filterPoolRef) { - return super.getReferencingObjectPosition(filterPoolRef); - } - - /** - * Move a given filter pool reference to a given zero-based location. - * Calls back to inform provider of the event. - * @param filterPoolRef the reference to move - * @param pos the new position at which to move it. References at that position and beyond are - * moved up in the list. - */ - public void moveSystemFilterPoolReference(ISystemFilterPoolReference filterPoolRef, int pos) { - int oldPos = super.getReferencingObjectPosition(filterPoolRef); - super.moveReferencingObjectPosition(pos, filterPoolRef); - invalidateFilterPoolReferencesCache(); - if (!noSave) quietSave(); - if (fireEvents && (caller != null) && !noEvents) { - ISystemFilterPoolReference[] refs = new ISystemFilterPoolReference[1]; - refs[0] = filterPoolRef; - caller.filterEventFilterPoolReferencesRePositioned(refs, pos - oldPos); - } - } - - /** - * Move existing filter pool references a given number of positions. - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount. - * Calls back to inform provider. - * @param filterPoolRefs Array of SystemFilterPoolReferences to move. - * @param delta the amount by which to move these references. - */ - public void moveSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolRefs, int delta) { - int[] oldPositions = new int[filterPoolRefs.length]; - noEvents = noSave = true; - for (int idx = 0; idx < filterPoolRefs.length; idx++) - oldPositions[idx] = getSystemFilterPoolReferencePosition(filterPoolRefs[idx]); - if (delta > 0) // moving down, process backwards - for (int idx = filterPoolRefs.length - 1; idx >= 0; idx--) - moveSystemFilterPoolReference(filterPoolRefs[idx], oldPositions[idx] + delta); - else - for (int idx = 0; idx < filterPoolRefs.length; idx++) - moveSystemFilterPoolReference(filterPoolRefs[idx], oldPositions[idx] + delta); - invalidateFilterPoolReferencesCache(); - noEvents = noSave = false; - quietSave(); - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesRePositioned(filterPoolRefs, delta); - } - - // ---------------------------------------------- - // Methods that work on FilterPool master objects - // ---------------------------------------------- - /** - * @return array of filter pools currently referenced by this manager. - * Result will never be null, although it may be an array of length zero. - */ - public ISystemFilterPool[] getReferencedSystemFilterPools() { - ISystemFilterPoolReference[] refs = getSystemFilterPoolReferences(); - List pools = new ArrayList(refs.length); - for (int idx = 0; idx < refs.length; idx++) { - ISystemFilterPool pool = refs[idx].getReferencedFilterPool(); - if (pool != null) { - pools.add(pool); - } - } - ISystemFilterPool[] result = new ISystemFilterPool[pools.size()]; - pools.toArray(result); - return result; - } - - /** - * @param filterPool the filter pool to test to see if we have a reference to it - * @return true if the given filter pool has a referencing object in this list. - */ - public boolean isSystemFilterPoolReferenced(ISystemFilterPool filterPool) { - return super.isReferenced(filterPool); - } - - /** - * Given a filter pool, locate the referencing object for it and return it. - * @param filterPool the filter pool we are testing for a reference - * @return the referencing object if found, else null - */ - public ISystemFilterPoolReference getReferenceToSystemFilterPool(ISystemFilterPool filterPool) { - return (ISystemFilterPoolReference) super.getReferencedObject(filterPool); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.filters.ISystemFilterPoolReferenceManager#addReferenceToSystemFilterPool(org.eclipse.rse.filters.ISystemFilterPool) - */ - public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool) { - ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPool); - addReferencingObject(filterPoolReference); // DWD - should be done in addReferencingObject? - filterPoolReference.setParentReferenceManager(this); - invalidateFilterPoolReferencesCache(); - quietSave(); - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceCreated(filterPoolReference); - return filterPoolReference; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.filters.ISystemFilterPoolReferenceManager#addReferenceToSystemFilterPool(org.eclipse.rse.filters.ISystemFilterPoolManager, java.lang.String) - */ - public ISystemFilterPoolReference addReferenceToSystemFilterPool(String filterPoolName) { - ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPoolName); - addReferencingObject(filterPoolReference); - filterPoolReference.setParentReferenceManager(this); - invalidateFilterPoolReferencesCache(); - quietSave(); - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceCreated(filterPoolReference); - return filterPoolReference; - } - - /** - * Given a filter pool, locate the referencing object for it and remove it from the list. - * Also removes that reference from the filterPool itself, and calls back to provider when done. - * @param filterPool the filter pool whose references we are to remove - * @return the new count of referencing objects - */ - public int removeReferenceToSystemFilterPool(ISystemFilterPool filterPool) { - ISystemFilterPoolReference filterPoolReference = getReferenceToSystemFilterPool(filterPool); - int newCount = 0; - if (filterPoolReference != null) { - filterPoolReference.removeReference(); - newCount = removeReferencingObject(filterPoolReference); - filterPoolReference.setParentReferenceManager(null); // DWD should be done in removeReferencingObject? - invalidateFilterPoolReferencesCache(); - quietSave(); - // callback to provider so they can fire events in their GUI - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceDeleted(filterPoolReference); - } else - newCount = getSystemFilterPoolReferenceCount(); - return newCount; - } - - /** - * A referenced filter pool has been renamed. Update our stored name. - * Calls back to inform provider. - * @param pool the pool that has just been renamed - */ - public void renameReferenceToSystemFilterPool(ISystemFilterPool pool) { - ISystemFilterPoolReference poolRef = null; - IRSEBasePersistableReferencingObject[] refs = getReferencingObjects(); - for (int idx = 0; (poolRef == null) && (idx < refs.length); idx++) - if (refs[idx].getReferencedObject() == pool) poolRef = (ISystemFilterPoolReference) refs[idx]; - - if (poolRef != null) { - String oldName = poolRef.getReferencedObjectName(); - poolRef.resetReferencedFilterPoolName(pool.getReferenceName()); - invalidateFilterPoolReferencesCache(); - quietSave(); - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceRenamed(poolRef, oldName); - } - } - - /** - * In one shot, set the filter pool references to new references to supplied filter pools. - * Calls back to provider. - * @param filterPools of filter pool objects to create references for - * @param deReference true to first de-reference all objects in the existing list. - */ - public void setSystemFilterPoolReferences(ISystemFilterPool[] filterPools, boolean deReference) { - if (deReference) - super.removeAndDeReferenceAllReferencingObjects(); - else - removeAllReferencingObjects(); - // add current - if (filterPools != null) { - for (int idx = 0; idx < filterPools.length; idx++) { - //addReferenceToSystemFilterPool(filterPools[idx]); - ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPools[idx]); - addReferencingObject(filterPoolReference); - filterPoolReference.setParentReferenceManager(this); // DWD should be done in addReferencingObject? - } - invalidateFilterPoolReferencesCache(); - quietSave(); - if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesReset(); - } - } - - // ------------------------- - // SPECIAL CASE METHODS - // ------------------------- - /** - * Create a single filter refererence to a given filter. Needed when a filter - * is added to a pool, and the UI is not showing pools but rather all filters - * in all pool references. - * @param subSystem the subsystem that uses this reference manager - * @param filter the new filter that is being added - * @return the new reference - */ - public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) { - // step 1: find the reference to the filter pool that contains this filter - ISystemFilterPool pool = filter.getParentFilterPool(); - ISystemFilterPoolReference poolRef = getReferenceToSystemFilterPool(pool); - // step 2: generate a reference for it - if (poolRef != null) - return poolRef.getSystemFilterReference(subSystem, filter); - else - return null; - } - - /** - * Concatenate all filter references from all filter pools we reference, into one - * big list. Used when the UI is not showing pools. - * @param subSystem the subsystem for which this manager is providing filter pool reference management - * @return an array of references for this subsystem - */ - public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) { - ISystemFilterPoolReference[] poolRefs = getSystemFilterPoolReferences(); - Vector v = new Vector(); - for (int idx = 0; idx < poolRefs.length; idx++) { - ISystemFilterReference[] filterRefs = poolRefs[idx].getSystemFilterReferences(subSystem); - for (int jdx = 0; jdx < filterRefs.length; jdx++) - v.addElement(filterRefs[jdx]); - } - ISystemFilterReference[] allRefs = new ISystemFilterReference[v.size()]; - for (int idx = 0; idx < v.size(); idx++) - allRefs[idx] = (ISystemFilterReference) v.elementAt(idx); - return allRefs; - } - - /** - * Given a filter reference, return its position within this reference manager - * when you think of all filter references from all filter pool references as - * being concatenated. - * Used when the UI is not showing pools. - * @param filterRef the reference to locate - * @return the position fo this reference or -1 if not found. - */ - public int getSystemFilterReferencePosition(ISystemFilterReference filterRef) { - ISystemFilterPoolReference[] poolRefs = getSystemFilterPoolReferences(); - int match = -1; - int totalCount = 0; - for (int idx = 0; (match == -1) && (idx < poolRefs.length); idx++) { - ISystemFilterReference[] filterRefs = poolRefs[idx].getSystemFilterReferences(filterRef.getSubSystem()); - for (int jdx = 0; (match == -1) && (jdx < filterRefs.length); jdx++) { - if (filterRefs[jdx] == filterRef) - match = totalCount; - else - totalCount++; - } - } - return match; - } - - /** - * Given a filter, return its position within this reference manager - * when you think of all filter references from all filter pool references as - * being concatenated. - * Used when the UI is not showing pools. - * @param subSystem the subsystem in which to located the filter - * @param filter the filter to locate - * @return the position of the filter within this manager. - */ - public int getSystemFilterReferencePosition(ISubSystem subSystem, ISystemFilter filter) { - ISystemFilterPoolReference[] poolRefs = getSystemFilterPoolReferences(); - int match = -1; - int totalCount = 0; - for (int idx = 0; (match == -1) && (idx < poolRefs.length); idx++) { - ISystemFilterReference[] filterRefs = poolRefs[idx].getSystemFilterReferences(subSystem); - for (int jdx = 0; (match == -1) && (jdx < filterRefs.length); jdx++) { - if (filterRefs[jdx].getReferencedFilter() == filter) - match = totalCount; - else - totalCount++; - } - } - return match; - } - - // ----------------------- - // SAVE/RESTORE METHODS... - // ----------------------- - private void quietSave() { - try { - save(); - } catch (Exception exc) { - // TODO log exception - } - } - - /** - * Save all the filter pools to disk. - * Only called if the save policy is not "none". - * No longer used. - * @throws Exception - */ - public void save() throws Exception { - switch (savePolicy) { - // ONE FILE PER FILTER POOL REFERENCE MANAGER - case ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_MANAGER: - saveToOneFile(); - break; - } - } - - /** - * Save this reference manager to disk. - * Used only if using the reference manager to save a single file to disk. - * No longer used. - * @return true if the save succeeded - * @throws Exception - */ - protected boolean saveToOneFile() throws Exception { - /* FIXME - String saveFileName = getSaveFilePathAndName(); - File saveFile = new File(saveFileName); - boolean exists = saveFile.exists(); - saveFileName = saveFile.toURL().toString(); - Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; - Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFileName)); - //System.out.println("Saving filter pool ref mgr "+getName()+" to: " + saveFile); - //java.util.List ext = resFactory.createExtent(); mof way - //ext.add(this); - Resource res = resFactory.createResource(URI.createURI(saveFileName)); - res.getContents().add(this); - try - { - res.save(EMPTY_MAP); - } catch (Exception e) - { - if (debug) - { - System.out.println("Error saving filter pool ref mgr "+getName() + " to "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(); - } - throw e; - } - // if this is the first time we have created this file, we must update Eclipse - // resource tree to know about it... - if (!exists) - { - try { - mgrFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); - } catch(Exception exc) {} - } - */ - return true; - } - - /** - * Restore the filter pools from disk. - * After restoring, you must call resolveReferencesAfterRestore. - * No longer used. - * @param caller The object that is calling this, which must implement SystemFilterPoolReferenceManagerProvider - * @param mgrFolder folder containing filter pool references file. - * @param name the name of the manager to restore. File name is derived from it when saving to one file. - * @param namingPolicy to get file name prefix, via getFilterPoolReferenceManagerFileNamePrefix(). Pass null to use default. - * @return the restored manager, or null if it does not exist. - * @throws Exception if anything else went wrong - */ - public static ISystemFilterPoolReferenceManager restore(ISystemFilterPoolReferenceManagerProvider caller, IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy) throws Exception { - if (namingPolicy == null) namingPolicy = SystemFilterNamingPolicy.getNamingPolicy(); - ISystemFilterPoolReferenceManager mgr = restoreFromOneFile(mgrFolder, name, namingPolicy); - if (mgr != null) { - ((SystemFilterPoolReferenceManager) mgr).initialize(caller, mgrFolder, name, ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_MANAGER, namingPolicy); // core data - } - return mgr; - } - - /** - * Restore the filter pools from disk, assuming default for a naming policy. - * No longer used. - * @param caller The object that is calling this, which must implement SystemFilterPoolReferenceManagerProvider - * @param mgrFolder folder containing filter pool references file. - * @param name the name of the manager to restore. File name is derived from it when saving to one file. - * @return the restored manager, or null if it does not exist. - * @throws Exception if anything else went wrong - */ - public static ISystemFilterPoolReferenceManager restore(ISystemFilterPoolReferenceManagerProvider caller, IFolder mgrFolder, String name) throws Exception { - return restore(caller, mgrFolder, name, null); - } - - /** - * Restore filter pools when all are stored in one file. - * No longer used. - * @param mgrFolder The folder containing the file to restore from. - * @param name The name of the manager, from which the file name is derived. - * @param namingPolicy Naming prefix information for persisted data file names. - * @return the restored manager, or null if it does not exist. - * @throws Exception if anything else went wrong - */ - protected static ISystemFilterPoolReferenceManager restoreFromOneFile(IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy) throws Exception { - ISystemFilterPoolReferenceManager mgr = null; - /* FIXME - Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; - //ResourceSet resourceSet = MOF WAY - // Resource.Factory.Registry.getResourceSetFactory().makeResourceSet(); - Resource res = null; - String saveFile = getSaveFilePathAndName(mgrFolder, name, namingPolicy); - try - { - //res = resourceSet.load(saveFile); MOF Way - Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFile)); - res = resFactory.createResource(URI.createURI(saveFile)); - res.load(EMPTY_MAP); - } - catch (java.io.FileNotFoundException e) - { - System.out.println("Restore error: Filter pool ref mgr "+name+" missing its file: "+saveFile); - return null; - } - catch (Exception e) - { - if (debug) - { - System.out.println("Error restoring filter pool ref mgr "+name+" file "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(); - } - throw e; - } - - java.util.List ext = res.getContents(); - - // should be exactly one system filter pool manager... - Iterator iList = ext.iterator(); - mgr = (SystemFilterPoolReferenceManager)iList.next(); - if (debug) - System.out.println("Filter Pool Ref Mgr "+name+" loaded successfully."); - */ - return mgr; - } - - /** - * After restoring this from disk, there is only the referenced object name, - * not the referenced object pointer, for each referencing object. - * <p> - * This method is called after restore and for each restored object in the list must: - * <ol> - * <li>Do what is necessary to find the referenced object, and set the internal reference pointer. - * <li>Call addReference(this) on that object so it can maintain it's in-memory list of all referencing objects. - * <li>Set the important transient variables - * </ol> - * @param relatedPoolMgrProvider the filter pool manager provider that created the filter pools we reference - * (usually a subsystem configuration) - * @param provider the host of this reference manager, so you can later call getProvider - * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all - * were resolved. - */ - public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider, ISystemFilterPoolReferenceManagerProvider provider) { - setSystemFilterPoolManagerProvider(relatedPoolMgrProvider); - setProvider(provider); - ISystemFilterPoolManager[] relatedManagers = getSystemFilterPoolManagers(); - if (relatedManagers != null) { - Vector badRefs = new Vector(); - ISystemFilterPoolReference[] poolRefs = getSystemFilterPoolReferences(); - if (poolRefs != null) { - for (int idx = 0; idx < poolRefs.length; idx++) { - String poolName = poolRefs[idx].getReferencedFilterPoolName(); - String mgrName = poolRefs[idx].getReferencedFilterPoolManagerName(); - - ISystemFilterPool refdPool = getFilterPool(relatedManagers, mgrName, poolName); - if ((refdPool == null) && (getFilterPoolManager(relatedManagers, mgrName) == null)) { - //System.out.println("...looking for broken reference for "+mgrName+"."+poolName); - refdPool = relatedPoolMgrProvider.getSystemFilterPoolForBrokenReference(this, mgrName, poolName); - } - if (refdPool != null) { - poolRefs[idx].setReferenceToFilterPool(refdPool); // calls refdPool.addReference(poolRef) - } else { - badRefs.addElement(poolRefs[idx]); - } - } - if (badRefs.size() == 0) - return null; - else { - for (int idx = 0; idx < badRefs.size(); idx++) { - ISystemFilterPoolReference badRef = (ISystemFilterPoolReference) badRefs.elementAt(idx); - //badRef.setReferenceBroken(true); - super.removeReferencingObject(badRef); - } - invalidateFilterPoolReferencesCache(); - quietSave(); - return badRefs; - } - } - } - return null; - } - - /** - * Utility method to scan across all filter pools in a given named filter pool manager, for a match - * on a given filter pool name. - * @param mgrs The list of filter pool managers to scan for the given filter pool. - * @param mgrName The name of the manager to restrict the search to - * @param poolName The name of the filter pool as stored on disk. It may be qualified somehow - * to incorporate the manager name too. - * @return the filter pool that was found. - */ - public static ISystemFilterPool getFilterPool(ISystemFilterPoolManager[] mgrs, String mgrName, String poolName) { - ISystemFilterPoolManager mgr = getFilterPoolManager(mgrs, mgrName); - if (mgr == null) return null; - return mgr.getSystemFilterPool(poolName); - } - - /** - * Utility method to scan across all filter pool managers for a match on a give name. - * @param mgrs The list of filter pool managers to scan for the given name - * @param mgrName The name of the manager to restrict the search to - * @return the filter pool manager that was found or null if not found. - */ - public static ISystemFilterPoolManager getFilterPoolManager(ISystemFilterPoolManager[] mgrs, String mgrName) { - ISystemFilterPoolManager mgr = null; - for (int idx = 0; (mgr == null) && (idx < mgrs.length); idx++) - if (mgrs[idx].getName().equals(mgrName)) mgr = mgrs[idx]; - return mgr; - } - - // ------------------ - // HELPER METHODS... - // ------------------ - - /** - * If saving all info in one file, this returns the fully qualified name of that file, - * given the unadorned manager name and the prefix (if any) to adorn with. - * No longer used. - * @param mgrFolder The folder in which to save a reference manager. - * @param name The name of the file for a filter pool reference manager. - * @param namingPolicy The naming policy for a filter pool reference manager - * @return The name of the path to which to save the references in a filter pool reference manager. - */ - protected static String getSaveFilePathAndName(IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy) { - return SystemFilter.addPathTerminator(getFolderPath(mgrFolder)) + getSaveFileName(namingPolicy.getReferenceManagerSaveFileName(name)); - } - - /** - * Appends the correct extension to the file name where this manager is saved. - * No longer used. - * @param fileNameNoSuffix the file name <i>sans</i> suffix. - * @return the unqualified file name used to store this to disk. - */ - protected static String getSaveFileName(String fileNameNoSuffix) { - return fileNameNoSuffix + ISystemFilterConstants.SAVEFILE_SUFFIX; - } - - /** - * @return the full path name of the file in which to save this manager. - */ - protected String getSaveFilePathAndName() { - return SystemFilter.addPathTerminator(getFolderPath(mgrFolder)) + getSaveFileName(); - } - - /** - * @return the simple name of the file in which to save this manager. - */ - protected String getSaveFileName() { - return getSaveFileName(namingPolicy.getReferenceManagerSaveFileName(getName())); - } - - /** - * @return the folder that this manager is contained in. - */ - public IFolder getFolder() { - return mgrFolder; - } - - /** - * Set the folder that this manager is contained in. - * @param newFolder the new folder - */ - public void resetManagerFolder(IFolder newFolder) { - mgrFolder = newFolder; - } - - /** - * @return the path of the folder that contains this manager. - */ - public String getFolderPath() { - return getResourceHelpers().getFolderPath(mgrFolder); - } - - /** - * @param folder the folder to find the path for - * @return the path of the given folder - */ - public static String getFolderPath(IFolder folder) { - return SystemResourceHelpers.getResourceHelpers().getFolderPath(folder); - } - - /* - * To reduce typing... - */ - private SystemResourceHelpers getResourceHelpers() { - return SystemResourceHelpers.getResourceHelpers(); - } - - public String toString() { - return getName(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolWrapper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolWrapper.java deleted file mode 100644 index 0c015c4b8..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolWrapper.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.core.filters; - -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolWrapper; - -/** - * The system filter wizard allows callers to pass a list of wrapper objects - * for the user to select a filter pool. - * <p> - * This is a default implementation of the wrapper interface, that allows the - * display name and wrappered filter pool to be set via the constructor. - */ -public class SystemFilterPoolWrapper implements ISystemFilterPoolWrapper -{ - - - private String displayName; - private ISystemFilterPool pool; - - /** - * Constructor for SystemFilterPoolWrapper. - */ - public SystemFilterPoolWrapper(String displayName, ISystemFilterPool poolToWrapper) - { - super(); - this.displayName = displayName; - this.pool = poolToWrapper; - } - - /** - * @see org.eclipse.rse.core.filters.ISystemFilterPoolWrapper#getDisplayName() - */ - public String getDisplayName() - { - return displayName; - } - - /** - * @see org.eclipse.rse.core.filters.ISystemFilterPoolWrapper#getSystemFilterPool() - */ - public ISystemFilterPool getSystemFilterPool() - { - return pool; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolWrapperInformation.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolWrapperInformation.java deleted file mode 100644 index 1769d041d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolWrapperInformation.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; - -import java.util.Vector; - -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolWrapper; -import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation; - -/** - * The system filter wizard allows callers to pass a list of wrapper objects - * for the user to select a filter pool. Effectively, this prompting for - * euphamisms to filter pools. This requires an array of wrapper objects, - * and requires replacement mri for the pool prompt and tooltip text, and - * the verbiage above it. - * <p> - * This is all encapsulated in this class. The information is set via setters - * or constructor parameters. - */ -public class SystemFilterPoolWrapperInformation - implements ISystemFilterPoolWrapperInformation -{ - private String promptLabel, promptTooltip, verbiageLabel; - private Vector wrappers; - private ISystemFilterPoolWrapper[] wrapperArray; - private ISystemFilterPoolWrapper preSelectWrapper; - - /** - * Constructor for SystemFilterPoolWrapperInformation. - */ - public SystemFilterPoolWrapperInformation(String promptLabel, String promptTooltip, String verbiageLabel) - { - super(); - this.promptLabel= promptLabel; - this.verbiageLabel = verbiageLabel; - this.promptLabel= promptTooltip; - wrappers = new Vector(); - } - - /** - * Add a wrapper object - */ - public void addWrapper(ISystemFilterPoolWrapper wrapper) - { - wrappers.add(wrapper); - } - /** - * Add a filter pool, which we will wrapper here by creating a SystemFilterPoolWrapper object for you - */ - public void addWrapper(String displayName, ISystemFilterPool poolToWrap, boolean preSelect) - { - SystemFilterPoolWrapper wrapper = new SystemFilterPoolWrapper(displayName, poolToWrap); - wrappers.add(wrapper); - if (preSelect) - preSelectWrapper = wrapper; - } - /** - * Set the wrapper to preselect - */ - public void setPreSelectWrapper(ISystemFilterPoolWrapper wrapper) - { - this.preSelectWrapper = wrapper; - } - - - - public String getPromptLabel() - { - return promptLabel; - } - - public String getPromptTooltip() - { - return promptTooltip; - } - - public String getVerbiageLabel() - { - return verbiageLabel; - } - - - /** - * @see org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation#getWrappers() - */ - public ISystemFilterPoolWrapper[] getWrappers() - { - if (wrapperArray == null) - { - wrapperArray = new ISystemFilterPoolWrapper[wrappers.size()]; - for (int idx=0; idx<wrapperArray.length; idx++) - wrapperArray[idx] = (ISystemFilterPoolWrapper)wrappers.elementAt(idx); - } - return wrapperArray; - } - - /** - * @see org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation#getPreSelectWrapper() - */ - public ISystemFilterPoolWrapper getPreSelectWrapper() - { - if (preSelectWrapper == null) - { - if (wrappers.size() > 0) - return (ISystemFilterPoolWrapper)wrappers.elementAt(0); - else - return null; - } - else - return preSelectWrapper; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStartHere.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStartHere.java deleted file mode 100644 index da6ebaac5..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStartHere.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - removing implementation of ISystemFilterConstants - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - ********************************************************************************/ - -package org.eclipse.rse.internal.core.filters; - -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterSavePolicies; -import org.eclipse.rse.core.filters.ISystemFilterStartHere; -import org.eclipse.rse.core.filters.SystemFilterNamingPolicy; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.logging.Logger; - -/** - * Static methods for creating and restoring the "front doors" to the filter framework - * <ul> - * <li>SystemFilterNamingPolicy. This tells the framework what to use for file names when - * saving and restoring to/from disk. - * <li>SystemFilterPoolManager. This manages master lists of filter pools. Use only these - * APIs for creating: - * <ul> - * <li>SystemFilterPools. - * <li>SystemFilters - * </ul> - * <li>SystemFilterPoolReferenceManager. This manages a persistable list of filter pool - * references. Use its APIs for creating: - * <ul> - * <li>SystemFilterPoolReferences. - * </ul> - * </ul> - */ -public class SystemFilterStartHere - implements ISystemFilterStartHere -{ - private static SystemFilterStartHere _instance; - public SystemFilterStartHere() - { - } - - public static SystemFilterStartHere getInstance() - { - if (_instance == null) - { - _instance = new SystemFilterStartHere(); - } - return _instance; - } - - /** - * Factory method to return an instance populated with defaults. - * You can then simply override whatever is desired via setXXX methods. - */ - public IRSEFilterNamingPolicy createSystemFilterNamingPolicy() - { - return SystemFilterNamingPolicy.getNamingPolicy(); - } - - - /** - * Factory to create a filter pool manager, when you do NOT want it to worry about - * saving and restoring the filter data to disk. Rather, you will save and restore - * yourself. - * @param logger A logging object into which to log errors as they happen in the framework - * @param caller Objects which instantiate this class should implement the - * SystemFilterPoolManagerProvider interface, and pass "this" for this parameter. - * Given any filter framework object, it is possible to retrieve the caller's - * object via the getProvider method call. - * @param name the name of the filter pool manager. Not currently used but you may - * find a use for it. - * @param allowNestedFilters true if filters inside filter pools in this manager are - * to allow nested filters. This is the default, but can be overridden at the - * individual filter pool level. - */ - public ISystemFilterPoolManager - createSystemFilterPoolManager(ISystemProfile profile, - Logger logger, - ISystemFilterPoolManagerProvider caller, - String name, - boolean allowNestedFilters) - { - return SystemFilterPoolManager.createSystemFilterPoolManager(profile, logger, caller, - name, allowNestedFilters, ISystemFilterSavePolicies.SAVE_POLICY_NONE, null); - } - - - - /** - * Create a SystemFilterPoolReferenceManager instance, when you do NOT want it - * to be saved and restored to its own file. Rather, you will save and restore it - * yourself. - * @param caller Objects which instantiate this class should implement the - * SystemFilterPoolReferenceManagerProvider interface, and pass "this" for this parameter. - * Given any filter framework object, it is possible to retrieve the caller's - * object via the getProvider method call. - * @param relatedPoolMgrProvider The manager provider that own the master list of filter pools that - * this manager will contain references to. - * @param name the name of the filter pool reference manager. This is not currently - * used, but you may find a use for it. - * @param namingPolicy the naming policy object which will return the name of that one file. - */ - public ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager( - ISystemFilterPoolReferenceManagerProvider caller, - ISystemFilterPoolManagerProvider relatedPoolMgrProvider, - String name, IRSEFilterNamingPolicy namingPolicy) - { - return SystemFilterPoolReferenceManager.createSystemFilterPoolReferenceManager( - caller, relatedPoolMgrProvider, null, name, ISystemFilterSavePolicies.SAVE_POLICY_NONE, namingPolicy); - } - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterString.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterString.java deleted file mode 100644 index 2337a9a10..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterString.java +++ /dev/null @@ -1,305 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.internal.core.filters; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.RSEModelObject; -import org.eclipse.rse.core.references.IRSEBaseReferencingObject; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.internal.references.SystemReferencedObjectHelper; - - -/** - * This represents a filter string within a filter. Filters can hold one or more filter strings. - */ -/** - * @lastgen class SystemFilterStringImpl Impl implements SystemFilterString, IAdaptable {} - */ -public class SystemFilterString extends RSEModelObject implements ISystemFilterString, IAdaptable -{ - private ISystemFilter parentFilter; - protected SystemReferencedObjectHelper helper = null; - - /** - * The default value of the '{@link #getString() <em>String</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getString() - * @generated - * @ordered - */ - protected static final String STRING_EDEFAULT = null; - - /** - * @generated This field/method will be replaced during code generation. - */ - /** - * @generated This field/method will be replaced during code generation. - */ - protected String string = STRING_EDEFAULT; - /** - * The default value of the '{@link #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected static final String TYPE_EDEFAULT = null; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected String type = TYPE_EDEFAULT; - /** - * The default value of the '{@link #isDefault() <em>Default</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isDefault() - * @generated - * @ordered - */ - protected static final boolean DEFAULT_EDEFAULT = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected boolean default_ = DEFAULT_EDEFAULT; -/** - * Constructor. Do not instantiate yourself! Let MOF do it! - */ - protected SystemFilterString() - { - super(); - helper = new SystemReferencedObjectHelper(this); - } - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - /** - * Set the transient parent back-pointer. Called by framework at restore/create time. - */ - public void setParentSystemFilter(ISystemFilter filter) - { - this.parentFilter = filter; - } - /** - * Get the parent filter that contains this filter string. - */ - public ISystemFilter getParentSystemFilter() - { - return parentFilter; - } - /** - * Return the caller which instantiated the filter pool manager overseeing this filter framework instance - */ - public ISystemFilterPoolManagerProvider getProvider() - { - if (parentFilter != null) - return parentFilter.getProvider(); - else - return null; - } - /** - * Return the filter pool manager managing this collection of filter pools and their filters and their filter strings. - */ - public ISystemFilterPoolManager getSystemFilterPoolManager() - { - if (parentFilter != null) - return parentFilter.getSystemFilterPoolManager(); - else - return null; - } - /** - * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null - */ - public String getType() - { - String type = this.getTypeGen(); - if (type == null) - return ISystemFilterConstants.DEFAULT_TYPE; - else - return type; - } - /** - * Clones this filter string's attributes into the given filter string - */ - public void clone(ISystemFilterString targetString) - { - String ourString = getString(); - if (ourString != null) - targetString.setString(new String(ourString)); - targetString.setType(getTypeGen()); - targetString.setDefault(isDefault()); - } - - /** - * Is this filter string changable? Depends on mof attributes of parent filter - */ - public boolean isChangable() - { - boolean enable = !getParentSystemFilter().isNonChangable() && - !getParentSystemFilter().isStringsNonChangable(); - return enable; - } - - // ---------------------------------- - // IRSEReferencedObject methods... - // ---------------------------------- - /** - * Add a reference, increment reference count, return new count - * @return new count of how many referencing objects reference this object. - */ - public int addReference(IRSEBaseReferencingObject ref) - { - return helper.addReference(ref); - } - /** - * Remove a reference, decrement reference count, return new count - * @return new count of how many referencing objects reference this object. - */ - public int removeReference(IRSEBaseReferencingObject ref) - { - return helper.removeReference(ref); - } - /** - * Return a count of how many referencing objects reference this object. - */ - public int getReferenceCount() - { - return helper.getReferenceCount(); - } - /** - * Clear the list of referenced objects. - */ - public void removeAllReferences() - { - helper.removeAllReferences(); - } - /** - * Return a list of all referencing objects of this object - */ - public IRSEBaseReferencingObject[] getReferencingObjects() - { - return helper.getReferencingObjects(); - } - - - public String getName() - { - return getString(); - } - - public String getDescription() - { - return RSECoreMessages.RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION; - } - - public String getString() - { - return string; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setString(String newString) - { - string = newString; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setType(String newType) - { - type = newType; - } - - /** - * @generated This field/method will be replaced during code generation - * Is this a vendor-supplied filter string versus a user-defined filter string - */ - public boolean isDefault() - { - return default_; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setDefault(boolean newDefault) - { - default_ = newDefault; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public String toString() - { - - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (string: "); //$NON-NLS-1$ - result.append(string); - result.append(", type: "); //$NON-NLS-1$ - result.append(type); - result.append(", default: "); //$NON-NLS-1$ - result.append(default_); - result.append(')'); - return result.toString(); - } - - /** - * @generated This field/method will be replaced during code generation - * Allows tools to have typed filter strings - */ - public String getTypeGen() - { - return type; - } - - public boolean commit() - { - boolean result = getParentSystemFilter().commit(); - return result; - } - - public IRSEPersistableContainer getPersistableParent() { - return parentFilter; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - return IRSEPersistableContainer.NO_CHILDREN; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStringReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStringReference.java deleted file mode 100644 index 8bb897772..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStringReference.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.filters; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.filters.ISystemFilterStringReference; -import org.eclipse.rse.core.references.IRSEBaseReferencedObject; -import org.eclipse.rse.internal.references.SystemReferencingObjectHelper; - -/** - * A reference to a system filter string. - */ -public class SystemFilterStringReference - implements ISystemFilterStringReference, IAdaptable -{ - protected ISystemFilterReference parent; - protected ISystemFilter parentFilter; - protected SystemReferencingObjectHelper helper = null; - protected boolean referenceBroken = false; - - /** - * Constructor for SystemFilterStringReferenceImpl - * @param parentRef The parent filter reference for this filter string reference. - * @param referencedString The filter string we reference - */ - public SystemFilterStringReference(ISystemFilterReference parentRef, ISystemFilterString referencedString) - { - super(); - parent = parentRef; - helper = new SystemReferencingObjectHelper(this); - setReferencedObject(referencedString); - } - /** - * Constructor for SystemFilterStringReferenceImpl when starting with filter vs filter reference parent - * <p> - * we are not yet ready to make this available. - * @param parentFilter The parent filter for this filter string reference. - * @param referencedString The filter string we reference - */ - protected SystemFilterStringReference(ISystemFilter parentFilter, ISystemFilterString referencedString) - { - super(); - this.parentFilter = parentFilter; - helper = new SystemReferencingObjectHelper(this); - setReferencedObject(referencedString); - } - - - /** - * Return the reference manager which is managing this filter reference - * framework object. - */ - public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() - { - if (parent != null) - return parent.getFilterPoolReferenceManager(); - return null; - } - - /** - * Return the object which instantiated the pool reference manager object. - * Makes it easy to get back to the point of origin, given any filter reference - * framework object - */ - public ISystemFilterPoolReferenceManagerProvider getProvider() - { - ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); - if (mgr != null) - return mgr.getProvider(); - else - return null; - } - - /** - * @see ISystemFilterStringReference#getReferencedFilterString() - */ - public ISystemFilterString getReferencedFilterString() - { - return (ISystemFilterString)getReferencedObject(); - } - - /** - * Same as getReferencedFilterString().getString() - */ - public String getString() - { - return getReferencedFilterString().getString(); - } - - - /** - * @see ISystemFilterStringReference#getParent() - */ - public ISystemFilterReference getParent() - { - return parent; - } - /** - * @see ISystemFilterStringReference#getParentSystemFilter() - */ - public ISystemFilter getParentSystemFilter() - { - if (parentFilter != null) - return parentFilter; - else if (parent != null) - return parent.getReferencedFilter(); - else - return null; - } - - - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - * By default this returns Platform.getAdapterManager().getAdapter(this, adapterType); - * This in turn results in the default subsystem adapter SystemViewSubSystemAdapter, - * in package org.eclipse.rse.ui.view. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - // ---------------------------------------------- - // IRSEReferencingObject methods... - // ---------------------------------------------- - - /** - * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#setReferencedObject(IRSEBaseReferencedObject) - */ - public void setReferencedObject(IRSEBaseReferencedObject obj) - { - helper.setReferencedObject(obj); - } - - /** - * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#getReferencedObject() - */ - public IRSEBaseReferencedObject getReferencedObject() - { - return helper.getReferencedObject(); - } - - /** - * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#removeReference() - */ - public int removeReference() - { - return helper.removeReference(); - } - - /** - * Set to true if this reference is currently broken/unresolved - */ - public void setReferenceBroken(boolean broken) - { - referenceBroken = broken; - } - - /** - * Return true if this reference is currently broken/unresolved - */ - public boolean isReferenceBroken() - { - return referenceBroken; - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties deleted file mode 100644 index 1d1a347bb..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 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 -# -# Contributors: -# David Dykstal (IBM) - initial API and implementation -# David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies -# Martin Oberhuber (Wind River) - [184095] combined RSEModelResources and persistence.Messages into this file -############################################################################### - -# NLS_MESSAGEFORMAT_VAR -# NLS_ENCODING=UTF-8 - -# Model -RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION=An RSE Model Object represents any object in the Remote System Explorer. -RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION=A Referencing Object encapsulates the operations required of an object which is merely a reference to another object. -RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION=A filter string is a single string in a filter. It describes which files will pass through the filter. -RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION=A host pool is a group of hosts. There is one host pool associated with each profile. -RESID_MODELOBJECTS_PROFILE_DESCRIPTION=Your profile is the object with which all your unique settings and RSE objects such as connections are associated. -RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION=The Server Launcher is an object for storing configuration details about how to launch servers on the remote host. -RESID_MODELOBJECTS_FILTER_DESCRIPTION=A filter is a collection of filter strings that determines which files will pass through it. -RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION=A filter pool is a group of filters. There is one filter pool associated with each profile. - -RESID_SUBSYSTEM_AUTODETECT_LABEL=Auto-detect SSL -RESID_PROP_SERVERLAUNCHER_MEANS_LABEL=Launcher -RESID_PROP_SERVERLAUNCHER_PATH=Path to installed server on host -RESID_PROP_SERVERLAUNCHER_INVOCATION=Server launch command -RESID_CONNECTION_PORT_LABEL=Port -RESID_CONNECTION_DAEMON_PORT_LABEL=Daemon Port - -RESID_PROPERTYSET_REMOTE_SERVER_LAUNCHER=Remote Server Launcher -RESID_PROPERTYSET_LAUNCHER_PROPERTIES=Launcher Properties - -# Persistence -RSEPersistenceManager_DeleteProfileJobName=Delete RSE Profile Job -PropertyFileProvider_SavingTaskName=Saving DOM -PropertyFileProvider_UnexpectedException=Unexpected Exception -PropertyFileProvider_LoadingTaskName=Loading DOM -SaveRSEDOMJob_SavingProfileJobName=Saving RSE Profile {0} -SerializingProvider_UnexpectedException=Unexpected Exception - -# Password Persistence Manager -DefaultSystemType_Label=Default diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemHostPool.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemHostPool.java deleted file mode 100644 index b1225e062..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemHostPool.java +++ /dev/null @@ -1,624 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - created and used RSEPReferencesManager - * - moved SystemsPreferencesManager to a new plugin - * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter() - ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.IRSEUserIdConstants; -import org.eclipse.rse.core.RSEPreferencesManager; -import org.eclipse.rse.core.model.Host; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemHostPool; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.RSEModelObject; -import org.eclipse.rse.internal.core.RSECoreMessages; - - -/** - * A pool of host objects. - * There is one pool per profile. - * It is named the same as its owning profile. - * It is not persisted but provides a means of manipulating lists of host objects. - * Hosts are created and destroyed by the host pool so that the the relationships between the two can be maintained. - */ -public class SystemHostPool extends RSEModelObject implements ISystemHostPool -{ - - protected static final String NAME_EDEFAULT = null; - - private static Hashtable pools = null; - private static String CONNECTION_FILE_NAME = "connection"; //$NON-NLS-1$ - - - protected String name = NAME_EDEFAULT; - private java.util.List connections = null; - - /** - * Default constructor. - */ - protected SystemHostPool() - { - super(); - } - - /** - * Reset for a full refresh from disk, such as after a team synch - */ - public static void reset() - { - pools = null; - } - - // ------------------------------------------------------------------------------------- - // Host Pool Methods - // ------------------------------------------------------------------------------------- - /** - * Return (and create if necessary) the connection pool for a given system profile. - */ - public static ISystemHostPool getSystemHostPool(ISystemProfile profile) - throws Exception - { - if (pools == null) - pools = new Hashtable(); - SystemHostPool pool = (SystemHostPool)pools.get(profile); - if (pool == null) - { - pool = new SystemHostPool(); - pool.setName(profile.getName()); - try { - pool.restore(); // restore connections - } catch (Exception exc) { - } - pools.put(profile, pool); // store this pool reference, keyed by profile object. - } - return pool; - } - - /** - * Return the system profile that owns this connection pool - */ - public ISystemProfile getSystemProfile() - { - return SystemProfileManager.getDefault().getSystemProfile(getName()); - } - - /** - * Rename this connection pool. - */ - public void renameHostPool(String newName) - { - IHost[] connections = getHosts(); - String oldName = getName(); - for (int idx=0; idx<connections.length; idx++) - { - connections[idx].renamingSystemProfile(oldName, newName); - } - setName(newName); - } - - - /** - * Private debug method to print connections, to test restored ok. - * @deprecated - */ - public void printConnections() - { - java.util.List conns = getHostList(); - Iterator connsList = conns.iterator(); - if (!connsList.hasNext()) - { - System.out.println(); - System.out.println("No connections"); //$NON-NLS-1$ - } - while (connsList.hasNext()) - { - System.out.println(); - IHost conn = (IHost)connsList.next(); - System.out.println(" AliasName.....: " + conn.getAliasName()); //$NON-NLS-1$ - System.out.println(" -----------------------------------------------------"); //$NON-NLS-1$ - System.out.println(" HostName......: " + conn.getHostName()); //$NON-NLS-1$ - System.out.println(" SystemType....: " + conn.getSystemType().getId()); //$NON-NLS-1$ - System.out.println(" Description...: " + conn.getDescription()); //$NON-NLS-1$ - System.out.println(" UserId........: " + conn.getDefaultUserId()); //$NON-NLS-1$ - } - } - - // ------------------------------------------------------------------------------------- - // CONNECTION METHODS... - // ------------------------------------------------------------------------------------- - - /* - * (non-Javadoc) - * @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); - } - - /* - * (non-Javadoc) - * @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); - } - - /* - * (non-Javadoc) - * @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 - { - IHost conn = null; - boolean exists = getHost(aliasName) != null; - if (exists) - { - 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. - if (conn == null) conn = new Host(profile); - assert conn != null; - - 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; - } - return conn; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemHostPool#updateHost(org.eclipse.rse.core.model.IHost, org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int) - */ - 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) - renameHost(conn,aliasName); - conn.setSystemType(systemType); - conn.setHostName(hostName); - if (defaultUserIdLocation != IRSEUserIdConstants.USERID_LOCATION_NOTSET) - { - if (defaultUserIdLocation != IRSEUserIdConstants.USERID_LOCATION_HOST) - { - conn.setDefaultUserId(null); // clear what was there, to ensure inheritance - boolean forceToUpperCase = conn.getForceUserIdToUpperCase(); - if (forceToUpperCase && (defaultUserId != null)) - defaultUserId = defaultUserId.toUpperCase(); - if (defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_DEFAULT_SYSTEMTYPE) - { - RSEPreferencesManager.setDefaultUserId(systemType, defaultUserId); - } - //else if (defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_DEFAULT_OVERALL) - //{ - //prefMgr.setDefaultUserId(defaultUserId); - //} - } - else - { - conn.setDefaultUserId(defaultUserId); - } - } - conn.setDescription(description); - commit(conn); - } - - - /** - * Return array of connections in this pool - */ - public IHost[] getHosts() - { - - return (IHost[])getHostList().toArray(new IHost[connections.size()]); - } - - - - /* - * Invalidate cache so it will be regenerated - */ - protected void invalidateCache() - { - setDirty(true); - } - - /** - * Return a connection object, given its alias name. - * Can be used to test if an alias name is already used (non-null return). - * @param aliasName unique aliasName (case insensitive) to search on. - * @return SystemConnection object with unique aliasName, or null if - * no connection object with this name exists. - */ - public IHost getHost(String aliasName) - { - IHost conn = null; - IHost currconn = null; - java.util.List conns = getHostList(); - Iterator i = conns.iterator(); - while (i.hasNext() && (conn==null)) - { - currconn = (IHost)i.next(); - if (currconn.getAliasName().equalsIgnoreCase(aliasName)) - conn = currconn; - } - return conn; - } - /** - * Return the connection at the given zero-based offset - */ - public IHost getHost(int pos) - { - java.util.List conns = getHostList(); - if (pos < conns.size()) - return (IHost)conns.get(pos); - else - return null; - } - /** - * Return the zero-based position of a SystemConnection object within its profile. - */ - public int getHostPosition(IHost conn) - { - int position = -1; - boolean match = false; - java.util.List conns = getHostList(); - Iterator i = conns.iterator(); - int idx = 0; - while (!match && i.hasNext()) - { - IHost currConn = (IHost)i.next(); - if (conn.equals(currConn)) - { - match = true; - position = idx; - } - idx++; - } - return position; - } - - /** - * Return the number of SystemConnection objects within this pool. - */ - public int getHostCount() - { - java.util.List conns = getHostList(); - return conns.size(); - } - - - public boolean addHost(IHost conn) - { - List hostList = getHostList(); - if (!hostList.contains(conn)) - { - hostList.add(conn); - } - conn.setHostPool(this); - invalidateCache(); - return true; - } - - /** - * Removes a given connection from the list and deletes it from disk. - * <p> - * This will: - * <ul> - * <li>Delete the connection in memory - * <li>Delete the underlying folder - * </ul> - * <p> - * @param conn SystemConnection object to remove - */ - public void deleteHost(IHost conn) - { - conn.deletingHost(); // let connection do any necessary cleanup - getHostList().remove(conn); - setDirty(true); - conn.getSystemProfile().commit(); - } - - /** - * Renames a given connection in the list. - * This will: - * <ul> - * <li>Rename the profile in memory - * <li>Rename the underlying folder - * <li>Update the user preferences if this profile is currently active. - * </ul> - * @param conn SystemConnection object to rename - * @param newName The new name to give that connection. - */ - public void renameHost(IHost conn, String newName) - throws Exception - { - conn.setAliasName(newName); - invalidateCache(); - commit(conn); - } - - - /** - * Duplicates a given connection in this list within this list or another list. - * @param targetPool The SystemConnectionPool to hold the copied connection. Can equal this connection, as long as alias name is unique - * @param conn SystemConnection object (within our pool) to clone - * @param aliasName New, unique, alias name to give this connection. Clone will fail if this is not unique. - */ - public IHost cloneHost(ISystemHostPool targetPool, IHost conn, String aliasName) - throws Exception - { - IHost copy = - targetPool.createHost(conn.getSystemType(), aliasName, - conn.getHostName(), conn.getDescription(), conn.getLocalDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_HOST); - return copy; - } - - /** - * Move existing connections a given number of positions in the same pool. - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.<p> - * <ul> - * <li>After the move, the pool containing the moved connection is saved to disk. - * <li>The connection's alias name must be unique in pool. - * </ul> - * <b>TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?</b> - * @param conns Array of SystemConnections to move. - * @param delta the amount by which to move the connections - */ - public void moveHosts(IHost conns[], int delta) - { - int[] oldPositions = new int[conns.length]; - for (int idx=0; idx<conns.length; idx++) - oldPositions[idx] = getHostPosition(conns[idx]); - if (delta > 0) // moving down, process backwards - for (int idx=conns.length-1; idx>=0; idx--) - moveConnection(conns[idx], oldPositions[idx]+delta); - else - for (int idx=0; idx<conns.length; idx++) - moveConnection(conns[idx], oldPositions[idx]+delta); - - commit(); - } - - /** - * Move one connection to a new location - * <b>TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?</b> - */ - private void moveConnection(IHost conn, int newPos) - { - /* - * DWD revisit, make sure that connections can be "moved", whatever that means. - * It appears that connections can be moved up and down in the list which - * probably provides for some rational for keeping this around. - */ -// java.util.List connList = getHostList(); - //FIXME connList.move(newPos, conn); - invalidateCache(); - } - - /** - * Order connections according to user preferences. - * Called after restore. - */ - public void orderHosts(String[] names) - { - java.util.List connList = getHostList(); - IHost[] conns = new IHost[names.length]; - for (int idx=0; idx<conns.length; idx++) - conns[idx] = getHost(names[idx]); - connList.clear(); - //System.out.println("Ordering connections within pool " + getName() + "..."); - for (int idx=0; idx<conns.length; idx++) - { - connList.add(conns[idx]); - //System.out.println(" '"+conns[idx].getAliasName()+"'"); - } - //System.out.println(); - invalidateCache(); - } - - /** - * Return the unqualified save file name with the extension .xmi - */ - protected static String getSaveFileName(IHost connection) - { - return null;//FIXME return SystemMOFHelpers.getSaveFileName(getRootSaveFileName(connection)); - } - - /** - * Return the root save file name without the extension .xmi - */ - protected static String getRootSaveFileName(IHost connection) - { - return getRootSaveFileName(connection.getAliasName()); - } - /** - * Return the root save file name without the extension .xmi - */ - protected static String getRootSaveFileName(String connectionName) - { - //String fileName = connectionName; // maybe a bad idea to include connection name in it! - String fileName = CONNECTION_FILE_NAME; - return fileName; - } - - public String toString() - { - if (getName() == null) - return this.toStringGen(); - else - return getName(); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public String getName() - { - return name; - } - - public String getDescription() - { - return RSECoreMessages.RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setName(String newName) - { - name = newName; - } - - - public List getHostList() - { - if (connections == null) - { - connections = new ArrayList(); - } - return connections; - } - - /** - * @deprecated This field/method will be replaced during code generation. - */ - public String toStringGen() - { - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(')'); - return result.toString(); - } - - /** - * Restore connections from disk - */ - protected void restore() - throws Exception - { - //System.out.println("... . in pool.restore "); - - //FIXME - } - - /** - * Restore a connection of a given name from disk... - */ - protected IHost restore(String connectionName) - throws Exception - { - /*FIXME - //System.out.println("in SystemConnectionPoolImpl#restore for connection " + connectionName); - String fileName = getRootSaveFileName(connectionName); - //System.out.println(".......fileName = " + fileName); - //System.out.println(".......folderName = " + getConnectionFolder(connectionName).getName()); - java.util.List ext = getMOFHelpers().restore(getConnectionFolder(connectionName),fileName); - - // should be exactly one profile... - Iterator iList = ext.iterator(); - SystemConnection connection = (SystemConnection)iList.next(); - if (connection != null) - { - if (!connection.getAliasName().equalsIgnoreCase(connectionName)) - { - RSEUIPlugin.logDebugMessage(this.getClass().getName(),"Incorrect alias name found in connections.xmi file for " + connectionName+". Name was reset"); - connection.setAliasName(connectionName); // just in case! - } - internalAddConnection(connection); - } - return connection; - */ - return null; - } - - /** - * System host pools are not persisted and do not exist in the persistence hierarchy. - * @return null - */ - public IRSEPersistableContainer getPersistableParent() { - return null; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - return IRSEPersistableContainer.NO_CHILDREN; - } - - // ------------------------- - // SAVE / RESTORE METHODS... - // ------------------------- - /** - * Save all connections to disk. - * Attempts to save all of them, swallowing exceptions, - * then at the end throws the last exception caught. - */ - public boolean commit() - { - ISystemProfile profile = getSystemProfile(); - boolean result = profile.commit(); - return result; - } - - /** - * Attempt to save single connection to disk. - */ - public void commit(IHost connection) - { - commit(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemModelChangeEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemModelChangeEvent.java deleted file mode 100644 index 8379dc132..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemModelChangeEvent.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; - -import org.eclipse.rse.core.events.ISystemModelChangeEvent; - -/** - * For listeners interested in model changes with resources in the rse project. - * These events are designed to state what the change the resource was, not to - * optimize those events for a GUI (eg, a delete event versus a refresh event) - */ -public class SystemModelChangeEvent implements ISystemModelChangeEvent -{ - private int eventType, resourceType; - private Object resource; - private String oldName; - - /** - * Constructor for SystemModelChangeEvent. - */ - public SystemModelChangeEvent(int eventType, int resourceType, Object resource) - { - super(); - this.eventType = eventType; - this.resourceType = resourceType; - this.resource = resource; - } - /** - * Constructor for SystemModelChangeEvent for a rename event - */ - public SystemModelChangeEvent(int eventType, int resourceType, Object resource, String oldName) - { - this(eventType, resourceType, resource); - this.oldName = oldName; - } - /** - * Constructor you shouldn't use unless you intend to call the setters - */ - public SystemModelChangeEvent() - { - } - - /** - * Reset the event type - */ - public void setEventType(int eventType) - { - this.eventType = eventType; - } - /** - * Reset the resource type - */ - public void setResourceType(int resourceType) - { - this.resourceType = resourceType; - } - /** - * Reset the resource - */ - public void setResource(Object resource) - { - this.resource = resource; - } - /** - * Reset the old name on a rename event - */ - public void setOldName(String oldName) - { - this.oldName = oldName; - } - - /** - * Get the event type, such as {@link org.eclipse.rse.core.events.ISystemModelChangeEvents#SYSTEM_RESOURCE_ADDED}. - * @see org.eclipse.rse.core.events.ISystemModelChangeEvents - */ - public int getEventType() - { - return eventType; - } - /** - * Get the resource type, such as {@link org.eclipse.rse.core.events.ISystemModelChangeEvents#SYSTEM_RESOURCETYPE_CONNECTION}. - * @see org.eclipse.rse.core.events.ISystemModelChangeEvents - */ - public int getResourceType() - { - return resourceType; - } - /** - * Get the resource that this event applies to - */ - public Object getResource() - { - return resource; - } - - /** - * Get the old name of the resource, in the event of a resource rename. Null for other event types. - */ - public String getOldName() - { - return oldName; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemModelChangeEventManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemModelChangeEventManager.java deleted file mode 100644 index a827202af..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemModelChangeEventManager.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; -import java.util.Vector; - -import org.eclipse.rse.core.events.ISystemModelChangeEvent; -import org.eclipse.rse.core.events.ISystemModelChangeListener; - - -/** - * Manages the list of registered model change listeners. - */ -public class SystemModelChangeEventManager -{ - private Vector listeners = new Vector(); - - /** - * Constructor - */ - public SystemModelChangeEventManager() - { - } - - /** - * Add a listener to list of listeners. If this object is already in - * the list, this does nothing. - */ - public void addSystemModelChangeListener(ISystemModelChangeListener l) - { - if (!listeners.contains(l)) - listeners.addElement(l); - } - - /** - * Remove a listener to list of listeners. If this object is not in - * the list, this does nothing. - */ - public void removeSystemModelChangeListener(ISystemModelChangeListener l) - { - if (listeners.contains(l)) - listeners.removeElement(l); - } - - /** - * Notify all registered listeners of the given event - */ - public void notify(ISystemModelChangeEvent event) - { - for (int idx=0; idx<listeners.size(); idx++) - { - ISystemModelChangeListener l = (ISystemModelChangeListener)listeners.elementAt(idx); - l.systemModelResourceChanged(event); - } - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPreferenceChangeEvent.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPreferenceChangeEvent.java deleted file mode 100644 index 9cdd736e6..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPreferenceChangeEvent.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; -import java.util.EventObject; - -import org.eclipse.rse.core.events.ISystemPreferenceChangeEvent; - - -/** - * Event object sent to ISystemPreferenceChangeListeners when a - * remote system preference is changed. - * @see org.eclipse.rse.core.events.ISystemPreferenceChangeEvents - */ -public class SystemPreferenceChangeEvent - extends EventObject - implements ISystemPreferenceChangeEvent -{ - private static final long serialVersionUID = 1; - private int type; - private Object oldValue, newValue; - - /** - * Constructor - * @see org.eclipse.rse.core.events.ISystemPreferenceChangeEvents - * @param source The object that was added,deleted,renamed,changed. - * @param type The type of event, one of ISystemChangeEvent constants. - * @param parent The parent of the object that was added or deleted. - */ - public SystemPreferenceChangeEvent(int type, Object oldValue, Object newValue) - { - super(newValue); - setType(type); - this.oldValue = oldValue; - this.newValue = newValue; - } - - /** - * Return the type of the event - * @see org.eclipse.rse.core.events.ISystemPreferenceChangeEvents - */ - public int getType() - { - return type; - } - /** - * Return the old value prior to the change - */ - public Object getOldValue() - { - return oldValue; - } - /** - * Return the new value after the change - */ - public Object getNewValue() - { - return newValue; - } - - /** - * Set the type - * @see org.eclipse.rse.core.events.ISystemPreferenceChangeEvents - */ - public void setType(int type) - { - this.type = type; - } - /** - * Set the old value prior to the change - */ - public void setOldValue(Object value) - { - this.oldValue = value; - } - /** - * Return the new value after the change - */ - public void setNewValue(Object value) - { - this.newValue = value; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPreferenceChangeManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPreferenceChangeManager.java deleted file mode 100644 index 20d8bc32d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPreferenceChangeManager.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; -import java.util.Vector; - -import org.eclipse.rse.core.events.ISystemPreferenceChangeEvent; -import org.eclipse.rse.core.events.ISystemPreferenceChangeListener; - - -/** - * Manages the list of registered preference change listeners. - */ -public class SystemPreferenceChangeManager -{ - private Vector listeners = new Vector(); - - /** - * Constructor - */ - public SystemPreferenceChangeManager() - { - } - - /** - * Add a listener to list of listeners. If this object is already in - * the list, this does nothing. - */ - public void addSystemPreferenceChangeListener(ISystemPreferenceChangeListener l) - { - if (!listeners.contains(l)) - listeners.addElement(l); - } - - /** - * Remove a listener to list of listeners. If this object is not in - * the list, this does nothing. - */ - public void removeSystemPreferenceChangeListener(ISystemPreferenceChangeListener l) - { - if (listeners.contains(l)) - listeners.removeElement(l); - } - - /** - * Notify all registered listeners of the given event - */ - public void notify(ISystemPreferenceChangeEvent event) - { - for (int idx=0; idx<listeners.size(); idx++) - { - ISystemPreferenceChangeListener l = (ISystemPreferenceChangeListener)listeners.elementAt(idx); - l.systemPreferenceChanged(event); - } - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfile.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfile.java deleted file mode 100644 index 822d62c7e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfile.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemProfileManager; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.RSEModelObject; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; - -/** - * A profile contains hosts and filter pools. It is the unit of save/restore for RSE model - * objects. All model objects are contained within a profile. - */ -public class SystemProfile extends RSEModelObject implements ISystemProfile, IAdaptable -{ - - private ISystemProfileManager mgr = null; - private IRSEPersistenceProvider provider = null; - private boolean isActive = true; - private String name = null; - private boolean defaultPrivate = false; - - /** - * Default constructor - */ - protected SystemProfile() - { - super(); - } - - public SystemProfile(String name, boolean isActive) { - this.name = name; - this.isActive = isActive; - } - - /** - * Set the in-memory pointer back to the parent system profile manager - */ - public void setProfileManager(ISystemProfileManager mgr) - { - this.mgr = mgr; - } - - /** - * Get the in-memory pointer back to the parent system profile manager - */ - public ISystemProfileManager getProfileManager() - { - return mgr; - } - - /** - * Convenience method for create a new connection within this profile. - * Shortcut for {@link ISystemRegistry#createHost(String,String,String,String)} - */ - public IHost createHost(IRSESystemType systemType, String connectionName, String hostName, String description) throws Exception - { - return RSECorePlugin.getTheSystemRegistry().createHost(getName(), systemType, connectionName, hostName, description); - } - - /** - * Return all connections for this profile - */ - public IHost[] getHosts() - { - return RSECorePlugin.getTheSystemRegistry().getHostsByProfile(this); - } - - /** - * Return all filter pools for this profile - */ - public ISystemFilterPool[] getFilterPools() - { - ISubSystemConfiguration[] ssFactories = RSECorePlugin.getTheSystemRegistry().getSubSystemConfigurations(); - Vector poolsVector = new Vector(); - for (int idx = 0; idx < ssFactories.length; idx++) - { - ISystemFilterPoolManager poolMgr = ssFactories[idx].getFilterPoolManager(this); - ISystemFilterPool[] pools = poolMgr.getSystemFilterPools(); - for (int ydx=0; ydx<pools.length; ydx++) - { - poolsVector.add(pools[ydx]); - } - } - ISystemFilterPool[] allPools = new ISystemFilterPool[poolsVector.size()]; - poolsVector.toArray(allPools); - return allPools; - } - - /** - * Return all filter pools for this profile, scoped by a given subsystem factory - */ - public ISystemFilterPool[] getFilterPools(ISubSystemConfiguration ssf) - { - ISystemFilterPoolManager poolMgr = ssf.getFilterPoolManager(this); - return poolMgr.getSystemFilterPools(); - } - - /** - * Return true if this profile is currently active. - */ - public boolean isActive() - { - return isActive; - } - /** - * Reset whether this profile is currently active. - */ - public void setActive(boolean active) - { - this.isActive = active; - setDirty(true); - } - - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - //For debugging - public String toString() { - String result = getName(); - if (result == null) { - StringBuffer buf = new StringBuffer(super.toString()); - buf.append("Profile(name: "); //$NON-NLS-1$ - buf.append(name); - buf.append(", defaultPrivate: "); //$NON-NLS-1$ - buf.append(defaultPrivate); - buf.append(')'); - result = buf.toString(); - } - return result; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public String getName() - { - return name; - } - - public String getDescription() - { - return RSECoreMessages.RESID_MODELOBJECTS_PROFILE_DESCRIPTION; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setName(String newName) - { - name = newName; - setDirty(true); - } - - /** - * @generated This field/method will be replaced during code generation - * Is this profile created automatically, and is it the profile - * that is unique for this developer? - */ - public boolean isDefaultPrivate() - { - return defaultPrivate; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setDefaultPrivate(boolean newDefaultPrivate) - { - defaultPrivate = newDefaultPrivate; - setDirty(true); - } - - public boolean commit() - { - boolean result = false; - if (!RSECorePlugin.getThePersistenceManager().isBusy()) { - result = RSECorePlugin.getThePersistenceManager().commitProfile(this, 5000); - } - return result; - } - - /** - * The SystemProfile is the top of the persistence hierarchy. - * @return null - */ - public IRSEPersistableContainer getPersistableParent() { - return null; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - List children = new ArrayList(10); - children.addAll(Arrays.asList(getFilterPools())); - children.addAll(Arrays.asList(getHosts())); - children.addAll(Arrays.asList(getPropertySets())); - IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()]; - children.toArray(result); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfile#getPersistenceProvider() - */ - public IRSEPersistenceProvider getPersistenceProvider() { - return provider; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfile#setPersistenceProvider(org.eclipse.rse.persistence.IRSEPersistenceProvider) - */ - public void setPersistenceProvider(IRSEPersistenceProvider provider) { - this.provider = provider; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfileManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfileManager.java deleted file mode 100644 index a451f1e34..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfileManager.java +++ /dev/null @@ -1,465 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - created and used RSEPreferencesManager - * - moved SystemPreferencesManager to a new plugin - ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.RSEPreferencesManager; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemProfileManager; -import org.eclipse.rse.logging.Logger; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; - -/** - * A class that manages a list of SystemProfile objects. - * This should be used as a singleton. - */ -public class SystemProfileManager implements ISystemProfileManager { - - private List _profiles = new ArrayList(10); - private static SystemProfileManager singleton = null; - private boolean restoring = false; - - /** - * Ordinarily there should be only one instance of a SystemProfileManager - * created on the system, so the static method {@link #getDefault()} is - * preferred to using this. - */ - private SystemProfileManager() { - } - - /** - * @return (and create if necessary) the singleton instance of this class. - */ - public static SystemProfileManager getDefault() { - if (singleton == null) { - singleton = new SystemProfileManager(); - RSECorePlugin.getThePersistenceManager().restoreProfiles(5000); - singleton.ensureDefaultPrivateProfile(); - singleton.ensureDefaultTeamProfile(); - } - return singleton; - } - - /** - * Clear the default after a team synchronization say - */ - public static void clearDefault() { - singleton = null; - } - - public void setRestoring(boolean flag) { - restoring = flag; - } - - /** - * Create a new profile with the given name, and add to the list. - * The name must be unique within the existing list. - * <p> - * The underlying folder is created in the file system. - * <p> - * @param name What to name this profile - * @param makeActive true if this profile is to be added to the active profile list. - * @return new profile, or null if name not unique. - * @see ISystemProfileManager#createSystemProfile(String, boolean) - */ - public ISystemProfile createSystemProfile(String name, boolean makeActive) { - ISystemProfile existingProfile = getSystemProfile(name); - if (existingProfile != null) { - deleteSystemProfile(existingProfile, false); // replace the existing one with a new profile - } - ISystemProfile newProfile = internalCreateSystemProfile(name); - if (makeActive) { - RSEPreferencesManager.addActiveProfile(name); - ((SystemProfile) newProfile).setActive(makeActive); - } - newProfile.commit(); - return newProfile; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#makeSystemProfileActive(org.eclipse.rse.core.model.ISystemProfile, boolean) - */ - public void makeSystemProfileActive(ISystemProfile profile, boolean makeActive) { - boolean wasActive = isSystemProfileActive(profile.getName()); - if (wasActive && !makeActive) - RSEPreferencesManager.deleteActiveProfile(profile.getName()); - else if (makeActive && !wasActive) RSEPreferencesManager.addActiveProfile(profile.getName()); - ((SystemProfile) profile).setActive(makeActive); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#getSystemProfiles() - */ - public ISystemProfile[] getSystemProfiles() { - return getSystemProfiles(!restoring); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#getSystemProfileNames() - */ - public String[] getSystemProfileNames() { - ISystemProfile[] profiles = getSystemProfiles(); - String[] profileNames = new String[profiles.length]; - for (int i = 0; i < profiles.length; i++) { - ISystemProfile profile = profiles[i]; - profileNames[i] = profile.getName(); - } - return profileNames; -// if (profileNames == null) { -// ISystemProfile[] profiles = getSystemProfiles(); -// profileNames = new String[profiles.length]; -// for (int idx = 0; idx < profiles.length; idx++) -// profileNames[idx] = profiles[idx].getName(); -// } -// return profileNames; - } - -// /** -// * Something changed so invalide cache of profiles so it will be regenerated -// */ -// protected void invalidateCache() { -// profileNames = null; -// profileNamesVector = null; -// } -// - - public ISystemProfile getSystemProfile(String name) { - ISystemProfile result = null; - for (Iterator z = _profiles.iterator(); z.hasNext();) { - ISystemProfile p = (ISystemProfile) z.next(); - if (p.getName().equals(name)) { - result = p; - break; - } - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#getSystemProfile(java.lang.String) - */ - private ISystemProfile getSystemProfileOld(String name) { - ISystemProfile[] profiles = getSystemProfiles(); - if ((profiles == null) || (profiles.length == 0)) return null; - ISystemProfile match = null; - for (int idx = 0; (match == null) && (idx < profiles.length); idx++) - if (profiles[idx].getName().equals(name)) match = profiles[idx]; - return match; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#renameSystemProfile(org.eclipse.rse.core.model.ISystemProfile, java.lang.String) - */ - public void renameSystemProfile(ISystemProfile profile, String newName) { - boolean isActive = isSystemProfileActive(profile.getName()); - String oldName = profile.getName(); - profile.setName(newName); - if (isActive) RSEPreferencesManager.renameActiveProfile(oldName, newName); -// invalidateCache(); - // FIXME RSEUIPlugin.getThePersistenceManager().save(this); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#deleteSystemProfile(org.eclipse.rse.core.model.ISystemProfile, boolean) - */ - public void deleteSystemProfile(ISystemProfile profile, boolean persist) { - String oldName = profile.getName(); - boolean isActive = isSystemProfileActive(oldName); - _profiles.remove(profile); - /* FIXME in EMF the profiles are "owned" by the Resource, and only referenced by the profile manager, - * so just removing it from the manager is not enough, it must also be removed from its resource. - * No longer needed since EMF is not in use. - * Resource res = profile.eResource(); - * if (res != null) - * res.getContents().remove(profile); - */ - if (isActive) RSEPreferencesManager.deleteActiveProfile(oldName); -// invalidateCache(); - if (persist) { - IRSEPersistenceProvider provider = profile.getPersistenceProvider(); - RSECorePlugin.getThePersistenceManager().deleteProfile(provider, oldName); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#cloneSystemProfile(org.eclipse.rse.core.model.ISystemProfile, java.lang.String) - */ - public ISystemProfile cloneSystemProfile(ISystemProfile profile, String newName) { - ISystemProfile newProfile = createSystemProfile(newName, false); - return newProfile; - } - - public boolean isSystemProfileActive(String profileName) { - ISystemProfile profile = getSystemProfile(profileName); - return profile.isActive(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#isSystemProfileActive(java.lang.String) - */ - private boolean isSystemProfileActiveOld(String profileName) { - String[] activeProfiles = getActiveSystemProfileNames(); - boolean match = false; - for (int idx = 0; !match && (idx < activeProfiles.length); idx++) { - if (activeProfiles[idx].equals(profileName)) match = true; - } - return match; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#getActiveSystemProfiles() - */ - public ISystemProfile[] getActiveSystemProfiles() { - List activeProfiles = new ArrayList(); - for (Iterator z = _profiles.iterator(); z.hasNext();) { - ISystemProfile p = (ISystemProfile) z.next(); - if (p.isActive()) { - activeProfiles.add(p); - } - } - ISystemProfile[] result = new ISystemProfile[activeProfiles.size()]; - activeProfiles.toArray(result); - return result; -// String[] profileNames = getActiveSystemProfileNames(); -// ISystemProfile[] profiles = new ISystemProfile[profileNames.length]; -// for (int idx = 0; idx < profileNames.length; idx++) { -// profiles[idx] = getOrCreateSystemProfile(profileNames[idx]); -// ((SystemProfile) profiles[idx]).setActive(true); -// } -// return profiles; - } - - public String[] getActiveSystemProfileNames() { - ISystemProfile[] profiles = getActiveSystemProfiles(); - String[] names = new String[profiles.length]; - for (int i = 0; i < profiles.length; i++) { - ISystemProfile systemProfile = profiles[i]; - names[i] = systemProfile.getName(); - } - return names; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#getActiveSystemProfileNames() - */ - private String[] getActiveSystemProfileNamesOld() { - String[] activeProfileNames = RSEPreferencesManager.getActiveProfiles(); - // dy: defect 48355, need to sync this with the actual profile list. If the user - // imports old preference settings or does a team sync and a profile is deleted then - // it is possible an active profile no longer exists. - // String[] systemProfileNames = getSystemProfileNames(); - ISystemProfile[] systemProfiles = getSystemProfiles(); - boolean found; - boolean found_team = false; - boolean found_private = false; - boolean changed = false; - String defaultProfileName = RSEPreferencesManager.getDefaultPrivateSystemProfileName(); - - for (int activeIdx = 0; activeIdx < activeProfileNames.length; activeIdx++) { - // skip Team and Private profiles - String activeProfileName = activeProfileNames[activeIdx]; - if (activeProfileName.equals(defaultProfileName)) { - found_private = true; - } else if (activeProfileName.equals(RSEPreferencesManager.getDefaultTeamProfileName())) { - found_team = true; - } else { - found = false; - for (int systemIdx = 0; systemIdx < systemProfiles.length && !found; systemIdx++) { - if (activeProfileNames[activeIdx].equals(systemProfiles[systemIdx].getName())) { - found = true; - } - } - - if (!found) { - // The active profile no longer exists so remove it from the active list - RSEPreferencesManager.deleteActiveProfile(activeProfileNames[activeIdx]); - changed = true; - } - } - } - - for (int systemIdx = 0; systemIdx < systemProfiles.length && !changed; systemIdx++) { - boolean matchesBoth = false; - String name = systemProfiles[systemIdx].getName(); - - for (int activeIdx = 0; activeIdx < activeProfileNames.length && !matchesBoth; activeIdx++) { - String aname = activeProfileNames[activeIdx]; - if (name.equals(aname)) { - matchesBoth = true; - } - - } - if (!matchesBoth && found_private) { - if (systemProfiles[systemIdx].isActive() || systemProfiles[systemIdx].isDefaultPrivate()) { - RSEPreferencesManager.addActiveProfile(name); - RSEPreferencesManager.deleteActiveProfile(RSECorePlugin.getLocalMachineName()); - activeProfileNames = RSEPreferencesManager.getActiveProfiles(); - } - } - } - - // the active profiles list needed to be changed because of an external update, also - // check if Default profile needs to be added back to the list - if (changed || !found_team || !found_private) { - if (systemProfiles.length == 0) { - // First time user, make sure default is in the active list, the only time it wouldn't - // be is if the pref_store.ini was modified (because the user imported old preferences) - if (!found_team) { - RSEPreferencesManager.addActiveProfile(RSEPreferencesManager.getDefaultTeamProfileName()); - changed = true; - } - - if (!found_private) { - RSEPreferencesManager.addActiveProfile(RSECorePlugin.getLocalMachineName()); - changed = true; - } - } else { - ISystemProfile defaultProfile = getDefaultPrivateSystemProfile(); - if (defaultProfile != null && !found_private) { - RSEPreferencesManager.addActiveProfile(defaultProfile.getName()); - changed = true; - } - } - - if (changed) { - activeProfileNames = RSEPreferencesManager.getActiveProfiles(); - } - } - - return activeProfileNames; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#getDefaultPrivateSystemProfile() - */ - public ISystemProfile getDefaultPrivateSystemProfile() { - return getSystemProfile(RSEPreferencesManager.getDefaultPrivateSystemProfileName()); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#getDefaultTeamSystemProfile() - */ - public ISystemProfile getDefaultTeamSystemProfile() { - return getSystemProfile(RSEPreferencesManager.getDefaultTeamProfileName()); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemProfileManager#getSize() - */ - public int getSize() { - return _profiles.size(); - } - - /** - * Adds a newly restored profile to this manager - * @param profile the profile to add - */ - public void addSystemProfile(ISystemProfile profile) { - _profiles.add(profile); - profile.setProfileManager(this); - String name = profile.getName(); - if (profile.isActive()) { - RSEPreferencesManager.addActiveProfile(name); - } - } - - private void createDefaultPrivateProfile() { - String initProfileName = RSEPreferencesManager.getDefaultPrivateSystemProfileName(); - ISystemProfile profile = internalCreateSystemProfile(initProfileName); - profile.setDefaultPrivate(true); - } - - private ISystemProfile internalCreateSystemProfile(String name) { - ISystemProfile profile = new SystemProfile(); - profile.setName(name); - addSystemProfile(profile); - return profile; - } - - private void ensureDefaultPrivateProfile() { - // Ensure that one Profile is the default Profile - defect 48995 NH - boolean defaultProfileExists = false; - for (Iterator z = _profiles.iterator(); z.hasNext() && !defaultProfileExists;) { - ISystemProfile profile = (ISystemProfile) z.next(); - defaultProfileExists = profile.isDefaultPrivate(); - } - if (!defaultProfileExists) { - // find one with the right name - String defaultPrivateProfileName = RSEPreferencesManager.getDefaultPrivateSystemProfileName(); - for (Iterator z = _profiles.iterator(); z.hasNext() && !defaultProfileExists;) { - ISystemProfile profile = (ISystemProfile) z.next(); - if (profile.getName().equals(defaultPrivateProfileName)) { - profile.setDefaultPrivate(true); - defaultProfileExists = true; - } - } - } - if (!defaultProfileExists) { - // Find the first profile that is not the Team profile and make it the default private profile - String defaultTeamProfileName = RSEPreferencesManager.getDefaultTeamProfileName(); - for (Iterator z = _profiles.iterator(); z.hasNext() && !defaultProfileExists;) { - ISystemProfile profile = (ISystemProfile) z.next(); - if (!profile.getName().equals(defaultTeamProfileName)) { - profile.setDefaultPrivate(true); - defaultProfileExists = true; - } - } - } - if (!defaultProfileExists) { - // If Team is the only profile - then put a message in the log and create the default private profile - Logger logger = RSECorePlugin.getDefault().getLogger(); - logger.logWarning("Only one Profile Team exists - there is no Default Profile"); //$NON-NLS-1$ - createDefaultPrivateProfile(); - } - } - - private void ensureDefaultTeamProfile() { - String name = RSEPreferencesManager.getDefaultTeamProfileName(); - ISystemProfile teamProfile = getSystemProfile(name); - if (teamProfile == null) { - teamProfile = internalCreateSystemProfile(name); - } - } - - private ISystemProfile[] getSystemProfiles(boolean ensureDefaultPrivateProfileExists) { - if (ensureDefaultPrivateProfileExists) { - ensureDefaultPrivateProfile(); - } - ISystemProfile[] result = new ISystemProfile[_profiles.size()]; - _profiles.toArray(result); - return result; - } - -// /** -// * Instantiate a user profile given its name. -// * @param userProfileName the name of the profile to find or create -// * @return the profile that was found or created. -// */ -// private ISystemProfile getOrCreateSystemProfile(String userProfileName) { -// ISystemProfile userProfile = getSystemProfile(userProfileName); -// if (userProfile == null) { -// userProfile = internalCreateSystemProfile(userProfileName); -// } -// return userProfile; -// } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRemoteChangeEventManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRemoteChangeEventManager.java deleted file mode 100644 index c78cafa77..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRemoteChangeEventManager.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; -import java.util.Vector; - -import org.eclipse.rse.core.events.ISystemRemoteChangeEvent; -import org.eclipse.rse.core.events.ISystemRemoteChangeListener; - -/** - * Manages the list of registered remote resource change listeners. - */ -public class SystemRemoteChangeEventManager -{ - private Vector listeners = new Vector(); - - /** - * Constructor - */ - public SystemRemoteChangeEventManager() - { - } - - /** - * Add a listener to list of listeners. - * If this object is already in the list, this does nothing. - * @param l the new listener to add. - */ - public void addSystemRemoteChangeListener(ISystemRemoteChangeListener l) - { - if (!listeners.contains(l)) - listeners.addElement(l); - } - - /** - * Remove a listener to list of listeners. - * If this object is not in the list, this does nothing. - * @param l the listener to remove. - */ - public void removeSystemRemoteChangeListener(ISystemRemoteChangeListener l) - { - if (listeners.contains(l)) - listeners.removeElement(l); - } - - /** - * Notify all registered listeners of the given event. - * TODO document on which thread the event is being sent. - * @param event the event to send. - */ - public void notify(ISystemRemoteChangeEvent event) - { - for (int idx=0; idx<listeners.size(); idx++) - { - ISystemRemoteChangeListener l = (ISystemRemoteChangeListener)listeners.elementAt(idx); - l.systemRemoteResourceChanged(event); - } - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/AbstractCacheManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/AbstractCacheManager.java deleted file mode 100644 index 5c732dce9..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/AbstractCacheManager.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [190231] Moved from org.eclipse.rse.ui/subsystems to core - *********************************************************************************/ - -package org.eclipse.rse.internal.core.subsystems; - -import org.eclipse.rse.core.subsystems.ICacheManager; - -/** - * Abstract implementation of ICacheManager. Can be used by cache manager to provide some - * basic caching helper methods. - */ -public abstract class AbstractCacheManager implements ICacheManager { - - - private boolean restoreFromMemento = false; - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ICacheManager#setRestoreFromMemento(boolean) - */ - public void setRestoreFromMemento(boolean restore) { - restoreFromMemento = restore; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ICacheManager#isRestoreFromMemento() - */ - public boolean isRestoreFromMemento() { - return restoreFromMemento; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java deleted file mode 100644 index 09b76e7ba..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2004, 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: - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.internal.core.subsystems; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.rse.core.model.ILabeledObject; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.RSEModelObject; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.IServerLauncherProperties; -import org.eclipse.rse.internal.core.RSECoreMessages; - - -public abstract class ServerLauncher extends RSEModelObject implements IServerLauncherProperties, ILabeledObject -{ - - - protected String _name; - private String _label = null; - protected IConnectorService _connectorService; - - protected ServerLauncher(String name, IConnectorService service) - { - super(); - _name = name; - _connectorService = service; - } - - public String getName() - { - return _name; - } - - public String getLabel() { - if (_label != null) return _label; - return _name; - } - - public void setLabel(String label) { - _label = label; - setDirty(true); - } - - public String getDescription() - { - return RSECoreMessages.RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION; - } - - public IConnectorService getConnectorService() - { - return _connectorService; - } - - public IRSEPersistableContainer getPersistableParent() { - return _connectorService; - } - - public IRSEPersistableContainer[] getPersistableChildren() { - List children = Arrays.asList(getPropertySets()); - IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()]; - children.toArray(result); - return result; - } - - /** - * Clone the contents of this server launcher into the given server launcher - * <i>Your sublcass must override this if you add additional attributes! Be sure - * to call super.cloneServerLauncher(newOne) first.</i> - * @return the given new server launcher, for convenience. - */ - public IServerLauncherProperties cloneServerLauncher(IServerLauncherProperties newOne) - { - newOne.addPropertySets(getPropertySets()); - return newOne; - } - - /** - * @deprecated use property sets - * @param vendorName - * @param attributeName - * @param attributeValue - */ - public void setVendorAttribute(String vendorName, - String attributeName, String attributeValue) - { - IPropertySet set = getPropertySet(vendorName); - if (set == null) - { - set = createPropertySet(vendorName, ""); //$NON-NLS-1$ - } - set.addProperty(attributeName, attributeValue); - } - - /** - * @deprecated use property sets directly now - */ - public String getVendorAttribute(String vendor, String attributeName) - { - IPropertySet set = getPropertySet(vendor); - if (set != null) - { - return set.getPropertyValue(attributeName); - } - else - { - return null; - } - } - - - - public boolean commit() - { - return getConnectorService().getHost().commit(); - } - - - -} //ServerLauncherImpl
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxy.java deleted file mode 100644 index 2540d3ccf..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxy.java +++ /dev/null @@ -1,322 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * Uwe Stieber (Wind River) - systemTypeIds attribute extension and dynamic association - * of system types. - * David Dykstal (IBM) - 168870: move core function from UI to core - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - ********************************************************************************/ - -package org.eclipse.rse.internal.core.subsystems; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.SystemTypeMatcher; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; -import org.eclipse.rse.logging.Logger; -import org.osgi.framework.Bundle; - -/** - * Represents a registered subsystem factory extension. - */ -public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy { - // The associated configuration element this proxy is wrapping - private IConfigurationElement element = null; - - // The subsystem configuration id - private String id; - // The subsystem configuration name - private String name; - // The subsystem configuration description - private String description; - // The list of associated system types by id as it appears in the plugin.xml - private String systemTypeIds; - - // The list of resolved system types supported by this subsystem configuration. - private IRSESystemType[] resolvedSystemTypes; - - // The subsystem configuration vendor - private String vendor; - // The remote system resource category - private String category; - // The subsystem configuration priority - private int priority; - - // The subsystem configuration implementation class - private ISubSystemConfiguration configuration = null; - // Flag to mark if the subsystem configration class has been initialized. - // We need this flag as the class may fail to load and we cannot determine it - // only by the null value of the field configuration. - private boolean subSystemConfigurationInitialized = false; - - private final SystemTypeMatcher systemTypeMatcher; - - /** - * Constructor - * @param element The IConfigurationElement for this factory's plugin - */ - public SubSystemConfigurationProxy(IConfigurationElement element) { - assert element != null; - // Read the single attributes from the configuration element - this.element = element; - this.id = element.getAttribute("id"); //$NON-NLS-1$ - this.name = element.getAttribute("name").trim(); //$NON-NLS-1$ - this.description = element.getAttribute("description").trim(); //$NON-NLS-1$ - this.systemTypeIds = element.getAttribute("systemTypeIds"); //$NON-NLS-1$ - this.vendor = element.getAttribute("vendor"); //$NON-NLS-1$ - this.category = element.getAttribute("category"); //$NON-NLS-1$ - this.priority = Integer.MAX_VALUE; - - String priorityStr = element.getAttribute("priority"); //$NON-NLS-1$ - try { - if (priorityStr != null) priority = Integer.parseInt(priorityStr); - } catch (NumberFormatException e) { - Logger logger = RSECorePlugin.getDefault().getLogger(); - logger.logError("Exception reading priority for subsystem configuration " + name + " defined in plugin " + element.getDeclaringExtension().getNamespaceIdentifier(), e); //$NON-NLS-1$ //$NON-NLS-2$ - } - - if (vendor == null) vendor = "Unknown"; //$NON-NLS-1$ - if (category == null) category = "Unknown"; //$NON-NLS-1$ - - systemTypeMatcher = new SystemTypeMatcher(getDeclaredSystemTypeIds()); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getVendor() - */ - public String getVendor() { - return vendor; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getName() - */ - public String getName() { - return name; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getDescription() - */ - public String getDescription() { - return description; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getId() - */ - public String getId() { - return id; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getDeclaringBundle() - */ - public Bundle getDeclaringBundle() { - assert element != null; - return Platform.getBundle(element.getDeclaringExtension().getNamespaceIdentifier()); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getDeclaredSystemTypeIds() - */ - public String getDeclaredSystemTypeIds() { - return systemTypeIds; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getSystemTypes() - */ - public IRSESystemType[] getSystemTypes() { - if (resolvedSystemTypes == null) { - IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes(); - - // If the subsystem configuration supports all system types, just add all - // currently registered system types to the resolved list - if (supportsAllSystemTypes()) { - resolvedSystemTypes = systemTypes; - } else { - // We have to match the given lists of system type ids against - // the list of available system types. As the list of system types cannot - // change ones it has been initialized, we filter out the not matching ones - // here directly. - List systemTypesList = new ArrayList(systemTypes.length); - for (int i = 0; i < systemTypes.length; i++) { - IRSESystemType systemType = systemTypes[i]; - if (isMatchingDeclaredSystemTypes(systemType) - || (systemType.getSubsystemConfigurationIds() != null - && Arrays.asList(systemType.getSubsystemConfigurationIds()).contains(getId())) - ) { - if (!systemTypesList.contains(systemType)) { - systemTypesList.add(systemType); - } - } - } - resolvedSystemTypes = (IRSESystemType[])systemTypesList.toArray(new IRSESystemType[systemTypesList.size()]); - } - } - return resolvedSystemTypes; - } - - /** - * Checks if the specified system type is supported by this subsystem configuration. - * - * @param systemType The system type to check. Must be not <code>null</code>. - * @return <code>True</code> if the system type is supported by this subsystem configuration, <code>false</code> otherwise. - */ - protected boolean isMatchingDeclaredSystemTypes(IRSESystemType systemType) { - return systemTypeMatcher.matches(systemType); - } - - /** - * Return true if this factory supports all system types - */ - public boolean supportsAllSystemTypes() { - return systemTypeMatcher.supportsAllSystemTypes(); - } - - /** - * Return the value of the "category" attribute - */ - public String getCategory() { - return category; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getPriority() - */ - public int getPriority() { - return priority; - } - - /** - * Return true if this extension's systemTypes attribute matches the given system type name. - */ - public boolean appliesToSystemType(IRSESystemType type) { - assert type != null; - if (systemTypeMatcher.supportsAllSystemTypes()) return true; - return Arrays.asList(getSystemTypes()).contains(type); - } - - /** - * Return true if this subsystem factory has been instantiated yet. - * Use this when you want to avoid the side effect of starting the subsystem factory object. - */ - public boolean isSubSystemConfigurationActive() { - return (configuration != null); - } - - /** - * Return the subsystem factory's object, which is an instance of the class - * specified in the class attribute of the extender's xml for the factory extension point. - * The object is only instantiated once, and returned on each call to this. - */ - public ISubSystemConfiguration getSubSystemConfiguration() { - if (!subSystemConfigurationInitialized && configuration == null) { - try { - Object executable = element.createExecutableExtension("class"); //$NON-NLS-1$ - if (executable instanceof ISubSystemConfiguration) { - configuration = (ISubSystemConfiguration) executable; - configuration.setSubSystemConfigurationProxy(this); // side effect: restores filter pools - } - } catch (Exception exc) { - Logger logger = RSECorePlugin.getDefault().getLogger(); - logger.logError("Unable to start subsystem factory " + id, exc); //$NON-NLS-1$ - } - - // Attempt to restore the subsystem configuration completely. - restore(); - - subSystemConfigurationInitialized = true; - } - - return configuration; - } - - /** - * Reset for a full refresh from disk, such as after a team synch. - */ - public void reset() { - if (configuration != null) configuration.reset(); - } - - /** - * After a reset, restore from disk - */ - public void restore() { - try { - configuration.getAllSystemFilterPoolManagers(); - } catch (Exception exc) { - RSECorePlugin.getDefault().getLogger().logError("Error restoring subsystem for configuration " + getName(), exc); //$NON-NLS-1$ - } - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object o) { - if (o instanceof String) - return ((String)o).equals(id); - else if (o instanceof SubSystemConfigurationProxy) - return ((SubSystemConfigurationProxy)o).getId().equals(id); - else - return false; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return id.hashCode(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return id + "." + name; //$NON-NLS-1$ - } - - private URL getLocation(String fileName) { - URL result = null; - if (fileName != null) { - URL path = getDeclaringBundle().getEntry("/"); //$NON-NLS-1$ - try { - result = new URL(path, fileName); - } catch (MalformedURLException e) { - } - } - return result; - } - - public URL getImageLocation() { - URL result = getLocation(element.getAttribute("icon")); //$NON-NLS-1$ - return result; - } - - public URL getLiveImageLocation() { - URL result = getLocation(element.getAttribute("iconlive")); //$NON-NLS-1$ - return result; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxyComparator.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxyComparator.java deleted file mode 100644 index c2d9c8d10..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxyComparator.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.internal.core.subsystems; - -import java.util.Comparator; - -import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; - -public class SubSystemConfigurationProxyComparator implements Comparator { - - /** - * Constructor. - */ - public SubSystemConfigurationProxyComparator() { - } - - /** - * Compares priorities of subsystem configuration proxies. - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Object o1, Object o2) { - - if (o1 instanceof ISubSystemConfigurationProxy && o2 instanceof ISubSystemConfigurationProxy) { - ISubSystemConfigurationProxy proxy1 = (ISubSystemConfigurationProxy)o1; - ISubSystemConfigurationProxy proxy2 = (ISubSystemConfigurationProxy)o2; - - if (proxy1.getPriority() < proxy2.getPriority()) { - return -1; - } - else if (proxy1.getPriority() > proxy2.getPriority()) { - return 1; - } - else { - return 0; - } - } - else { - return 0; - } - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/logging/LogListener.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/logging/LogListener.java deleted file mode 100644 index ae2461fc9..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/logging/LogListener.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.logging; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.util.Date; - -import org.eclipse.core.runtime.ILogListener; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; -import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; - -/** - * Log Listener is a sink for messages coming from Logger. - */ -public class LogListener implements ILogListener, IPropertyChangeListener { - - private PrintWriter log = null; - private File outputFile = null; - - /** - * Create a new log listener for a plugin. - * @param plugin The plugin for which to create a log listener. - */ - public LogListener(Plugin plugin) { - IPath path = plugin.getStateLocation().addTrailingSeparator().append(".log"); //$NON-NLS-1$ - outputFile = path.toFile(); - if ((outputFile != null) && (outputFile.exists())) { - outputFile.delete(); - } - initialize(); - } - - /** - * Initialize the logger. Retrieves the logging location preference and sets up the logger - * to log to that location. - */ - private void initialize() { - try { - freeResources(); - log = new PrintWriter(new BufferedWriter(new FileWriter(outputFile.toString(), true)), true); - } catch (Exception e) { - log = null; - System.err.println("Exception in RemoteSystemLogListener.initialize(): " + e.getMessage()); //$NON-NLS-1$ - e.printStackTrace(); - } - } - - public void logging(IStatus status) { - if (log == null) - return; - else { - // Need a to string here, because we need to be able to compare dates. - String date = new Date().toString(); - log.println(date); - int severity = status.getSeverity(); - if (severity == IStatus.ERROR) { - log.print("ERROR"); //$NON-NLS-1$ - } else if (severity == IStatus.WARNING) { - log.print("WARNING"); //$NON-NLS-1$ - } else if (severity == IStatus.INFO) { - log.print("INFO"); //$NON-NLS-1$ - } else if (severity == IStatus.OK) { - log.print("DEBUG"); //$NON-NLS-1$ - } - - log.print(" "); //$NON-NLS-1$ - log.print(status.getPlugin()); - log.print(" "); //$NON-NLS-1$ - log.println(status.getMessage()); - if (status.getException() != null) status.getException().printStackTrace(log); - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) { - loggingChild(children[i]); - } - } - log.println("--------------------------------------------"); //$NON-NLS-1$ - } - - } - - public void logging(IStatus status, String plugin) { - logging(status); - } - - /** - * @param tmp org.eclipse.core.runtime.IStatus - */ - private void loggingChild(IStatus status) { - if (log == null) - return; - else { - log.print("\t\t"); //$NON-NLS-1$ - log.println(status.getMessage()); - if (status.getException() != null) status.getException().printStackTrace(log); - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) - logging(children[i]); - } - } - } - - /** - * Handle changes from Preferences page. - */ - public synchronized void propertyChange(PropertyChangeEvent event) { - // refresh the log location from plugin Preference store - initialize(); - } - - public void freeResources() { - if (log == null) return; - log.flush(); - log.close(); - log = null; - - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/logging/LoggingPreferenceInitializer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/logging/LoggingPreferenceInitializer.java deleted file mode 100644 index c25f8a3e2..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/logging/LoggingPreferenceInitializer.java +++ /dev/null @@ -1,44 +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.logging; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.logging.Logger; - -/** - * This class initializes logging preferences. - */ -public class LoggingPreferenceInitializer extends AbstractPreferenceInitializer { - - /** - * Constructor. - */ - public LoggingPreferenceInitializer() { - super(); - } - - /** - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - public void initializeDefaultPreferences() { - Preferences prefs = RSECorePlugin.getDefault().getPluginPreferences(); - prefs.setDefault(Logger.LOGGING_LEVEL, Logger.LOG_ERROR); - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFConstants.java deleted file mode 100644 index 8e0f95506..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFConstants.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.internal.persistence; - -interface PFConstants { - - static final String PROPERTIES_FILE_NAME = "node.properties"; //$NON-NLS-1$ - - /* - * Metatype names - * each entry is an array. The first is the preferred name. - * The other names are acceptable alternates. - * Names must not contain periods or whitespace. - * Lowercase letters, numbers and dashes (-) are preferred. - */ - static final String[] MT_ATTRIBUTE_TYPE = new String[] { "04-attr-type", "attr-type" }; //$NON-NLS-1$ //$NON-NLS-2$ - static final String[] MT_ATTRIBUTE = new String[] { "03-attr", "attr" }; //$NON-NLS-1$ //$NON-NLS-2$ - static final String[] MT_CHILD = new String[] { "06-child", "child" }; //$NON-NLS-1$ //$NON-NLS-2$ - static final String[] MT_NODE_TYPE = new String[] { "01-type", "01-node-type", "n-type" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - static final String[] MT_NODE_NAME = new String[] { "00-name", "00-node-name", "n-name" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - static final String[] MT_REFERENCE = new String[] { "05-ref", "ref" }; //$NON-NLS-1$ //$NON-NLS-2$ - - /* Type abbreviations */ - static final String AB_SUBSYSTEM = "SS"; //$NON-NLS-1$ - static final String AB_SERVICE_LAUNCHER = "SL"; //$NON-NLS-1$ - static final String AB_PROPERTY_SET = "PS"; //$NON-NLS-1$ - static final String AB_PROPERTY = "P"; //$NON-NLS-1$ - static final String AB_HOST = "H"; //$NON-NLS-1$ - static final String AB_FILTER_STRING = "FS"; //$NON-NLS-1$ - static final String AB_FILTER_POOL_REFERENCE = "FPR"; //$NON-NLS-1$ - static final String AB_FILTER_POOL = "FP"; //$NON-NLS-1$ - static final String AB_FILTER = "F"; //$NON-NLS-1$ - static final String AB_CONNECTOR_SERVICE = "CS"; //$NON-NLS-1$ - static final String AB_PROFILE = "PRF"; //$NON-NLS-1$ - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetadataAnchor.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetadataAnchor.java deleted file mode 100644 index 8f84fe8a7..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetadataAnchor.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.io.File; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.persistence.dom.RSEDOM; - -class PFMetadataAnchor implements PFPersistenceAnchor { - - public IStatus deleteProfileLocation(String profileName, IProgressMonitor monitor) { - IStatus result = Status.OK_STATUS; - File profileFolder = getProfileFolder(profileName); - if (profileFolder.exists()) { - delete(profileFolder); - } - return result; - } - - public PFPersistenceLocation getProfileLocation(String profileLocationName) { - File profileFolder = getProfileFolder(profileLocationName); - PFPersistenceLocation result = new PFMetadataLocation(profileFolder); - return result; - } - - public String[] getProfileLocationNames() { - List names = new Vector(10); - File providerFolder = getProviderFolder(); - File[] profileCandidates = providerFolder.listFiles(); - for (int i = 0; i < profileCandidates.length; i++) { - File profileCandidate = profileCandidates[i]; - if (profileCandidate.isDirectory()) { - String candidateName = profileCandidate.getName(); - if (candidateName.startsWith(PFConstants.AB_PROFILE)) { - names.add(candidateName); - } - } - } - String[] result = new String[names.size()]; - names.toArray(result); - return result; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.internal.persistence.PFPersistenceAnchor#makeSaveJob(org.eclipse.rse.persistence.dom.RSEDOM, org.eclipse.rse.persistence.IRSEPersistenceProvider) - */ - public Job makeSaveJob(RSEDOM dom, IRSEPersistenceProvider provider) { - return new PFMetatdataJob(dom, provider); - } - - /** - * @return the folder that acts as the parent for profile folders. - */ - private File getProviderFolder() { - IPath statePath = RSECorePlugin.getDefault().getStateLocation(); - File stateFolder = new File(statePath.toOSString()); - File providerFolder = getFolder(stateFolder, "profiles"); //$NON-NLS-1$ - return providerFolder; - } - - /** - * Returns the File (directory) in which a profile is stored. - * @return The folder that was created or found. - */ - private File getProfileFolder(String profileLocationName) { - File providerFolder = getProviderFolder(); - File profileFolder = getFolder(providerFolder, profileLocationName); - return profileFolder; - } - - /** - * Returns the specified folder of the parent container. If the folder does - * not exist it creates it. - * @param parent the parent folder - * @param name the name of the folder to find or create - * @return the found or created folder - */ - private File getFolder(File parent, String name) { - File folder = new File(parent, name); - if (!folder.exists()) { - folder.mkdir(); - } - return folder; - } - - /** - * Delete a File resource. If the resource is a directory then - * delete its children first. - * @param resource - */ - private void delete(File resource) { - if (resource.isDirectory()) { - File[] resources = resource.listFiles(); - for (int i = 0; i < resources.length; i++) { - File child = resources[i]; - delete(child); - } - } - resource.delete(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetadataLocation.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetadataLocation.java deleted file mode 100644 index 2269f9fa9..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetadataLocation.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.eclipse.rse.core.RSECorePlugin; - -class PFMetadataLocation implements PFPersistenceLocation { - - private File _baseFolder; - - public PFMetadataLocation(File baseFolder) { - _baseFolder = baseFolder; - } - - public void ensure() { - if (!exists()) { - _baseFolder.mkdirs(); - } - } - public boolean exists() { - return _baseFolder.exists(); - } - - public PFPersistenceLocation getChild(String childName) { - File childFolder = new File(_baseFolder, childName); - return new PFMetadataLocation(childFolder); - } - - public PFPersistenceLocation[] getChildren() { - File[] members = _baseFolder.listFiles(); - List children = new ArrayList(members.length); - for (int i = 0; i < members.length; i++) { - File member = members[i]; - if (member.isDirectory()) { - PFPersistenceLocation child = new PFMetadataLocation(member); - children.add(child); - } - } - PFPersistenceLocation[] result = new PFPersistenceLocation[children.size()]; - children.toArray(result); - return result; - } - - public InputStream getContents() { - InputStream stream = null; - File contentsFile = getContentsFile(); - try { - stream = new FileInputStream(contentsFile); - } catch (FileNotFoundException e) { - logException(e); - } - return stream; - } - - public URI getLocator() { - return _baseFolder.toURI(); - } - - public String getName() { - return _baseFolder.getName(); - } - - public boolean hasContents() { - return getContentsFile().exists(); - } - - public void keepChildren(Set keepSet) { - File[] children = _baseFolder.listFiles(); - for (int i = 0; i < children.length; i++) { - File child = children[i]; - if (!keepSet.contains(child.getName())) { - deleteFile(child); - } - } - } - - public void setContents(InputStream stream) { - OutputStream out = null; - try { - out = new FileOutputStream(getContentsFile()); - byte[] buffer = new byte[1000]; - int n = stream.read(buffer); - while(n > 0) { - out.write(buffer, 0, n); - n = stream.read(buffer); - } - } catch (FileNotFoundException e) { - logException(e); - } catch (IOException e) { - logException(e); - } - if (out != null) { - try { - out.close(); - } catch (IOException e) { - logException(e); - } - } - try { - stream.close(); - } catch (IOException e) { - logException(e); - } - } - - /** - * Force the deletion of the named "file" (which may be a folder). - * The file's children must be deleted first. - * @param file the file to delete. - */ - private void deleteFile(File file) { - if (file.isDirectory()) { - File[] children = file.listFiles(); - for (int i = 0; i < children.length; i++) { - File child = children[i]; - deleteFile(child); - } - } - file.delete(); - } - - private File getContentsFile() { - File contentsFile = new File(_baseFolder, PFConstants.PROPERTIES_FILE_NAME); - return contentsFile; - } - - private void logException(Exception e) { - RSECorePlugin.getDefault().getLogger().logError("unexpected exception", e); //$NON-NLS-1$ - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetatdataJob.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetatdataJob.java deleted file mode 100644 index bec9ef659..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFMetatdataJob.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) - [184095] Replace systemTypeName by IRSESystemType - * David Dykstal (IBM) - [188863] created out of SaveRSEDOMJob - ********************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.text.MessageFormat; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.persistence.dom.RSEDOM; - -/** - * The PFMetadataJob is a Job that belongs to the family - * {@link RSECorePlugin#getThePersistenceManager()}. It is used to - * save a DOM to the workspace metadata area. A DOM corresponds to a profile. - */ -public class PFMetatdataJob extends Job { - - private RSEDOM _dom; - private IRSEPersistenceProvider _provider; - - private class SerializingRule implements ISchedulingRule { - public boolean contains(ISchedulingRule rule) { - return this == rule; - } - public boolean isConflicting(ISchedulingRule rule) { - return (rule instanceof SerializingRule); - } - } - - public PFMetatdataJob(RSEDOM dom, IRSEPersistenceProvider provider) { - super("Saving Profile"); //$NON-NLS-1$ - String title = MessageFormat.format(RSECoreMessages.SaveRSEDOMJob_SavingProfileJobName, new Object[] { dom.getName() }); - setName(title); - setRule(new SerializingRule()); - _dom = dom; - _provider = provider; - } - - public IStatus run(IProgressMonitor monitor) { - IStatus result = Status.OK_STATUS; - boolean saved = _provider.saveRSEDOM(_dom, monitor); - if (!saved) { - result = Status.CANCEL_STATUS; - } - return result; - } - - public boolean belongsTo(Object family) { - Object[] families = new Object[] {RSECorePlugin.getThePersistenceManager()}; - for (int i = 0; i < families.length; i++) { - Object object = families[i]; - if (family == object) return true; - } - return super.belongsTo(family); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFPersistenceAnchor.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFPersistenceAnchor.java deleted file mode 100644 index b90c198c1..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFPersistenceAnchor.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.persistence.dom.RSEDOM; - -interface PFPersistenceAnchor { - - /** - * @return the names of all valid profiles. Can be used to get a profile - * location from getProfileLocation(). - */ - String[] getProfileLocationNames(); - - /** - * @param profileName The name of a profile - * @param monitor a progress monitor for progress and canceling - * @return an IStatus indicating if the delete operation succeeded - */ - IStatus deleteProfileLocation(String profileName, IProgressMonitor monitor); - - /** - * @param profileName the name of the profile to get the location for - * @return the location of the profile - */ - PFPersistenceLocation getProfileLocation(String profileName); - - /** - * Factory method to return a new Job instance to save an RSE DOM - * to the persistence location managed by this anchor. - * @param dom the RSEDOM (Profile) to save. - * @param provider the Persistence Provider asking for save. - * @return a Job to perform the save operation with proper - * scheduling rules. - */ - Job makeSaveJob(RSEDOM dom, IRSEPersistenceProvider provider); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFPersistenceLocation.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFPersistenceLocation.java deleted file mode 100644 index bc4be6953..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFPersistenceLocation.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.io.InputStream; -import java.net.URI; -import java.util.Set; - -interface PFPersistenceLocation { - - /** - * @return true if the location actually exists - */ - boolean exists(); - - /** - * Ensures the existence of the base location - */ - void ensure(); - - /** - * @return true if the location has contents associated with it. The - * contents may be retrieved using getContents() - */ - boolean hasContents(); - - /** - * @return the URI of this location. Should only be used for display - * purposes since the protocol is not guaranteed to be understood by - * any existing URI processor. - */ - URI getLocator(); - - /** - * @return the locations of the children of this location. It is possible - * for a location to have both contents and children. - */ - PFPersistenceLocation[] getChildren(); - - - /** - * Return the child of a particular simple name. This is a handle operation. - * The child does not need to exist to for this to produce a location. - * @param childName The name of the child. - * @return The child of that name. - */ - PFPersistenceLocation getChild(String childName); - - /** - * @return The simple name of this location, relative to its parent location. - */ - String getName(); - - /** - * Keeps only those children from this location that are in the keep set. - * Typically used to clean renamed nodes from the tree on a save operation. - * @param keepSet The names of the children that should be kept. Others are discarded. - */ - void keepChildren(Set keepSet); - - /** - * Sets the contents of this location to a particular stream. - * Implementations must close this stream when finished. - * @param stream the stream from which to read the new contents of this location. - */ - void setContents(InputStream stream); - - /** - * Returns an open stream which can be read to retrieve the contents of this - * location. The client is responsible for closing this stream. - * @return a stream that will retrieve the contents of this location. - */ - InputStream getContents(); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceAnchor.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceAnchor.java deleted file mode 100644 index 60ea64744..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceAnchor.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - * David Dykstal (IBM) - [189858] delayed the creation of the remote systems project by - * using handle-only operations. - *******************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.SystemResourceManager; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.persistence.dom.RSEDOM; - -class PFWorkspaceAnchor implements PFPersistenceAnchor { - - public String[] getProfileLocationNames() { - List names = new Vector(10); - IFolder providerFolder = getProviderFolder(); - if (providerFolder.isAccessible()) { - try { - IResource[] profileCandidates = providerFolder.members(); - for (int i = 0; i < profileCandidates.length; i++) { - IResource profileCandidate = profileCandidates[i]; - if (profileCandidate.getType() == IResource.FOLDER) { - String candidateName = profileCandidate.getName(); - if (candidateName.startsWith(PFConstants.AB_PROFILE)) { - names.add(candidateName); - } - } - } - } catch (CoreException e) { - logException(e); - } - } - String[] result = new String[names.size()]; - names.toArray(result); - return result; - } - - public IStatus deleteProfileLocation(String profileName, IProgressMonitor monitor) { - IStatus result = Status.OK_STATUS; - IFolder profileFolder = getProfileFolder(profileName); - if (profileFolder.exists()) { - try { - profileFolder.delete(IResource.FORCE, monitor); - } catch (CoreException e) { - result = new Status(IStatus.ERROR, null, 0, RSECoreMessages.PropertyFileProvider_UnexpectedException, e); - } - } - return result; - } - - public PFPersistenceLocation getProfileLocation(String profileLocationName) { - IFolder profileFolder = getProfileFolder(profileLocationName); - PFPersistenceLocation result = new PFWorkspaceLocation(profileFolder); - return result; - } - - public Job makeSaveJob(RSEDOM dom, IRSEPersistenceProvider provider) { - return new PFWorkspaceJob(dom, provider); - } - - /** - * Returns the IFolder in which a profile is stored. - * This is a handle operation, the resulting folder may not exist. - * @return The folder that was found. - */ - private IFolder getProfileFolder(String profileLocationName) { - IFolder providerFolder = getProviderFolder(); - IFolder profileFolder = getFolder(providerFolder, profileLocationName); - return profileFolder; - } - - /** - * Returns the IFolder in which this persistence provider stores its profiles. - * This is a handle operation. It will not create the folder if it is not - * found. - * @return The folder that contains the profiles for this provider. - */ - private IFolder getProviderFolder() { - IProject project = SystemResourceManager.getRemoteSystemsProject(false); - if (project.isAccessible()) { - try { - project.refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (Exception e) { - } - } - IFolder providerFolder = getFolder(project, "dom.properties"); //$NON-NLS-1$ - return providerFolder; - } - - /** - * Returns the specified folder of the parent container. - * This is a handle operation. The folder may not exist. - * @param parent the parent container - typically a project or folder - * @param name the name of the folder to find - * @return the found folder (may not exist) - */ - private IFolder getFolder(IContainer parent, String name) { - IPath path = new Path(name); - IFolder folder = parent.getFolder(path); - return folder; - } - - private void logException(Exception e) { - RSECorePlugin.getDefault().getLogger().logError("unexpected exception", e); //$NON-NLS-1$ - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceJob.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceJob.java deleted file mode 100644 index 681761267..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceJob.java +++ /dev/null @@ -1,69 +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) - [184095] Replace systemTypeName by IRSESystemType - * David Dykstal (IBM) - [188863] created out of SaveRSEDOMJob - ********************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.text.MessageFormat; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.persistence.dom.RSEDOM; - -/** - * The PFWorkspaceJob is a workspace job that belongs to the family - * {@link RSECorePlugin#getThePersistenceManager()}. It is used to - * save a DOM to the workspace. A DOM corresponds to a profile. - */ -public class PFWorkspaceJob extends WorkspaceJob { - - private RSEDOM _dom; - private IRSEPersistenceProvider _provider; - - public PFWorkspaceJob(RSEDOM dom, IRSEPersistenceProvider provider) { - super("Saving Profile"); //$NON-NLS-1$ - String title = MessageFormat.format(RSECoreMessages.SaveRSEDOMJob_SavingProfileJobName, new Object[] { dom.getName() }); - setName(title); - setRule(ResourcesPlugin.getWorkspace().getRoot()); - _dom = dom; - _provider = provider; - } - - public IStatus runInWorkspace(IProgressMonitor monitor) { - IStatus result = Status.OK_STATUS; - boolean saved = _provider.saveRSEDOM(_dom, monitor); - if (!saved) { - result = Status.CANCEL_STATUS; - } - return result; - } - - public boolean belongsTo(Object family) { - Object[] families = new Object[] {RSECorePlugin.getThePersistenceManager()}; - for (int i = 0; i < families.length; i++) { - Object object = families[i]; - if (family == object) return true; - } - return super.belongsTo(family); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceLocation.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceLocation.java deleted file mode 100644 index 0136dcbb9..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PFWorkspaceLocation.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - * David Dykstal (IBM) - [189858] delayed the creation of the remote systems project by - * using handle-only operations. The project is created only - * if required to exist for writing. - * David Dykstal (IBM) - [191130] use explicit getRemoteSystemsProject(boolean) method - *******************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.io.InputStream; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.SystemResourceManager; - -class PFWorkspaceLocation implements PFPersistenceLocation { - IFolder baseFolder = null; - - public PFWorkspaceLocation(IFolder baseResource) { - this.baseFolder = baseResource; - } - - public boolean exists() { - return baseFolder.exists(); - } - - public void ensure() { - ensure(baseFolder); - } - - public PFPersistenceLocation getChild(String childName) { - IPath path = new Path(childName); - IFolder member = baseFolder.getFolder(path); - PFPersistenceLocation result = new PFWorkspaceLocation(member); - return result; - } - - public PFPersistenceLocation[] getChildren() { - IResource[] members; - try { - members = baseFolder.members(); - } catch (CoreException e) { - logException(e); - members = new IResource[0]; - } - List children = new ArrayList(members.length); - for (int i = 0; i < members.length; i++) { - IResource member = members[i]; - if (member.getType() == IResource.FOLDER) { - PFPersistenceLocation child = new PFWorkspaceLocation((IFolder)member); - children.add(child); - } - } - PFPersistenceLocation[] result = new PFPersistenceLocation[children.size()]; - children.toArray(result); - return result; - } - - public URI getLocator() { - return baseFolder.getLocationURI(); - } - - public String getName() { - return baseFolder.getName(); - } - - public boolean hasContents() { - IPath propertiesFileName = new Path(PFConstants.PROPERTIES_FILE_NAME); - IFile propertiesFile = baseFolder.getFile(propertiesFileName); - boolean result = propertiesFile.exists(); - return result; - } - - public void keepChildren(Set keepSet) { - try { - IResource[] children = baseFolder.members(); - for (int i = 0; i < children.length; i++) { - IResource child = children[i]; - if (child.getType() == IResource.FOLDER) { - String childFolderName = child.getName(); - if (!keepSet.contains(childFolderName)) { - child.delete(true, null); - } - } - } - } catch (CoreException e) { - logException(e); - } - } - - public void setContents(InputStream stream) { - IPath propertiesFileName = new Path(PFConstants.PROPERTIES_FILE_NAME); - IFile propertiesFile = baseFolder.getFile(propertiesFileName); - try { - if (propertiesFile.exists()) { - propertiesFile.setContents(stream, IResource.FORCE | IResource.KEEP_HISTORY, null); - } else { - propertiesFile.create(stream, IResource.FORCE | IResource.KEEP_HISTORY, null); - } - } catch (CoreException e) { - logException(e); - } - } - - public InputStream getContents() { - InputStream result = null; - IPath propertiesFileName = new Path(PFConstants.PROPERTIES_FILE_NAME); - IFile propertiesFile = baseFolder.getFile(propertiesFileName); - if (propertiesFile.exists()) { - try { - result = propertiesFile.getContents(); - } catch (CoreException e) { - logException(e); - } - } - return result; - } - - private void ensure(IContainer resource) { - if (!resource.isAccessible()) { - if (resource.getType() == IResource.PROJECT) { - SystemResourceManager.getRemoteSystemsProject(true); - } else { - IFolder folder = (IFolder) resource; - ensure(folder.getParent()); - try { - folder.create(true, true, null); - } catch (CoreException e) { - logException(e); - } - } - } - } - - private void logException(Exception e) { - RSECorePlugin.getDefault().getLogger().logError("unexpected exception", e); //$NON-NLS-1$ - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PropertyFileProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PropertyFileProvider.java deleted file mode 100644 index f563f1580..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PropertyFileProvider.java +++ /dev/null @@ -1,783 +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 the initial implementation: - * David McKnight, David Dykstal. - * - * Contributors: - * David Dykstal (IBM) - removed printlns, printStackTrace and added logging. - * David Dykstal (IBM) - [177882] fixed escapeValue for garbling of CJK characters - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * David Dykstal (IBM) - [188863] fix job conflict problems for save jobs, ignore bad profiles on restore - ********************************************************************************/ -package org.eclipse.rse.internal.persistence; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.logging.Logger; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.persistence.dom.IRSEDOMConstants; -import org.eclipse.rse.persistence.dom.RSEDOM; -import org.eclipse.rse.persistence.dom.RSEDOMNode; -import org.eclipse.rse.persistence.dom.RSEDOMNodeAttribute; - -/** - * This is class is used to restore an RSE DOM from disk and import it into RSE. - * It stores the DOM as a tree of folders and .properties files. - */ -public class PropertyFileProvider implements IRSEPersistenceProvider { - - private static final String NULL_VALUE_STRING = "null"; //$NON-NLS-1$ - /* interesting character sets */ - private static final String VALID = "abcdefghijklmnopqrstuvwxyz0123456789-._"; //$NON-NLS-1$ - private static final String UPPER = "ABCDEFGHIJKLMNOPQRTSUVWXYZ"; //$NON-NLS-1$ - - /* properties */ - private static final String P_LOCATION = "location"; //$NON-NLS-1$ - - /* property values */ - private static final String PV_LOCATION_WORKSPACE = "workspace"; //$NON-NLS-1$ - private static final String PV_LOCATION_METADATA = "metadata"; //$NON-NLS-1$ - - - private Pattern period = Pattern.compile("\\."); //$NON-NLS-1$ - private Pattern suffixPattern = Pattern.compile("_(\\d+)$"); //$NON-NLS-1$ - private Pattern unicodePattern = Pattern.compile("#(\\p{XDigit}+)#"); //$NON-NLS-1$ - private Map typeQualifiers = getTypeQualifiers(); - private Map saveJobs = new HashMap(); - private PFPersistenceAnchor anchor = null; - private Properties properties = null; - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#getSavedProfileNames() - */ - public String[] getSavedProfileNames() { - String[] locationNames = getAnchor().getProfileLocationNames(); - List names = new ArrayList(locationNames.length); - for (int i = 0; i < locationNames.length; i++) { - String locationName = locationNames[i]; - String profileName = getNodeName(locationName); - if (isValidName(profileName)) { - names.add(profileName); - } - } - String[] result = new String[names.size()]; - names.toArray(result); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#deleteProfile(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) - */ - public IStatus deleteProfile(String profileName, IProgressMonitor monitor) { - String profileLocationName = getLocationName(PFConstants.AB_PROFILE, profileName); - IStatus result = getAnchor().deleteProfileLocation(profileLocationName, monitor); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#saveRSEDOM(org.eclipse.rse.persistence.dom.RSEDOM, org.eclipse.core.runtime.IProgressMonitor) - */ - public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor) { - boolean result = false; - synchronized (dom) { - String profileLocationName = getLocationName(dom); - PFPersistenceLocation profileLocation = getAnchor().getProfileLocation(profileLocationName); - try { - int n = countNodes(dom); - monitor.beginTask(RSECoreMessages.PropertyFileProvider_SavingTaskName, n); - saveNode(dom, profileLocation, monitor); - monitor.done(); - dom.markUpdated(); - result = true; - } catch (Exception e) { - logException(e); - } - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#loadRSEDOM(org.eclipse.rse.model.ISystemProfileManager, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) - */ - public RSEDOM loadRSEDOM(String profileName, IProgressMonitor monitor) { - RSEDOM dom = null; - String profileLocationName = getLocationName(PFConstants.AB_PROFILE, profileName); - PFPersistenceLocation location = getAnchor().getProfileLocation(profileLocationName); - if (location.exists()) { - int n = countLocations(location); - monitor.beginTask(RSECoreMessages.PropertyFileProvider_LoadingTaskName, n); - dom = (RSEDOM)loadNode(null, location, monitor); - monitor.done(); - } else { - String message = location.getLocator().toString() + " does not exist."; //$NON-NLS-1$ - getLogger().logError(message, null); - } - return dom; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#getSaveJob(org.eclipse.rse.persistence.dom.RSEDOM) - */ - public Job getSaveJob(RSEDOM dom) { - Job saveJob = (Job) saveJobs.get(dom); - if (saveJob == null) { - saveJob = anchor.makeSaveJob(dom, this); - saveJobs.put(dom, saveJob); - } - return saveJob; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#setProperties(java.util.Properties) - */ - public void setProperties(Properties properties) { - Properties defaults = new Properties(); - defaults.setProperty(P_LOCATION, PV_LOCATION_WORKSPACE); - this.properties = new Properties(defaults); - Set keys = properties.keySet(); - for (Iterator z = keys.iterator(); z.hasNext();) { - String key = (String) z.next(); - String value = properties.getProperty(key); - if (value != null) { - this.properties.put(key, value); - } - } - } - - /** - * Checks a profile name for validity. Currently all names are valid except for completely blank names. - * @param profileName the name to check - * @return true if the name is valid. - */ - private boolean isValidName(String profileName) { - return (profileName.trim().length() > 0); - } - - private PFPersistenceAnchor getAnchor() { - if (anchor == null) { - String location = properties.getProperty(P_LOCATION); - if (location.equals(PV_LOCATION_WORKSPACE)) { - anchor = new PFWorkspaceAnchor(); - } else if (location.equals(PV_LOCATION_METADATA)) { - anchor = new PFMetadataAnchor(); - } else { - anchor = new PFMetadataAnchor(); - } - } - return anchor; - } - - /** - * Saves a node from the DOM to the file system. - * @param node The node to save. - * @param location The location in which to save this node. - * @param monitor The progress monitor. If the monitor has been cancel then - * this method will do nothing and return null. - */ - private void saveNode(RSEDOMNode node, PFPersistenceLocation location, IProgressMonitor monitor) { - if (monitor.isCanceled()) return; - location.ensure(); - Properties properties = getProperties(node, false, monitor); - RSEDOMNode[] childNodes = node.getChildren(); - Set childNames = new HashSet(); - for (int i = 0; i < childNodes.length; i++) { - RSEDOMNode childNode = childNodes[i]; - String index = getIndexString(i); - if (!isNodeEmbedded(childNode)) { - String key = combine(PFConstants.MT_REFERENCE[0], index); - String childName = getLocationName(childNode); - PFPersistenceLocation childLocation = location.getChild(childName); - saveNode(childNode, childLocation, monitor); - properties.put(key, childName); - childNames.add(childName); - } - } - location.keepChildren(childNames); - writeProperties(properties, "RSE DOM Node", location); //$NON-NLS-1$ - } - - /** - * Returns the node name derived from the location name. - * Location names are constructed to be valid file system resource names and - * node names may be arbitrary. There is a mapping between the two. - * @param locationName The location name from which to derive the node name. - * @return the node name. - */ - private String getNodeName(String locationName) { - String[] parts = split(locationName, 2); - String frozenName = parts[1]; - String result = thaw(frozenName); - return result; - } - - /** - * Returns the name of a location that can be used to store a node of a particular - * type. The name is contructed to conform to the rules for file systems. - * The names are derived from the name and type of the node. Note that the - * actual name of the node is also stored as a property so we need not attempt - * to recover the node name from the location name. - * @param node The node that will eventually be stored in this location. - * @return The name of the location to store this node. - */ - private String getLocationName(RSEDOMNode node) { - String type = node.getType(); - type = (String) typeQualifiers.get(type); - String name = node.getName(); - String result = getLocationName(type, name); - return result; - } - - /** - * Returns the name of a location that can be used to store a node of a particular - * type. The name is contructed to conform to the rules for file systems. - * The names are derived from the name and type of the node. Note that the - * actual name of the node is also stored as a property so we need not attempt - * to recover the node name from the location name. - * @param nodeName The node that will eventually be stored in this location. - * @param typeName The type abbreviation for the node at this location. - * @return The name of the location to store this node. - */ - private String getLocationName(String typeName, String nodeName) { - String name = freeze(nodeName); - String result = combine(typeName, name); - return result; - } - - /** - * Transforms an arbitrary name into one that can be used in any file system - * that supports long names. The transformation appends a number to the name - * that captures the case of the letters in the name. If a character falls - * outside the range of understood characters, it is converted to its hexadecimal unicode - * equivalent. Spaces are converted to underscores. - * @param name The name to be transformed - * @return The transformed name - * @see #thaw(String) - */ - private String freeze(String name) { - int p = name.indexOf(':'); - if (p >= 0) { - name = name.substring(p + 1); - } - StringBuffer buf = new StringBuffer(name.length()); - char[] chars = name.toCharArray(); - long suffix = 0; - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - suffix *= 2; - if (VALID.indexOf(c) >= 0) { - buf.append(c); - } else if (UPPER.indexOf(c) >= 0) { // if uppercase - buf.append(Character.toLowerCase(c)); - suffix += 1; - } else if (c == ' ') { // if space - buf.append('_'); - suffix += 1; - } else { // if out of range - buf.append('#'); - buf.append(Integer.toHexString(c)); - buf.append('#'); - } - } - name = buf.toString() + "_" + Long.toString(suffix); //$NON-NLS-1$ - return name; - } - - /** - * Recovers an arbitrary name from its frozen counterpart. - * @param name The name to be transformed - * @return The transformed name - * @see #freeze(String) - */ - private String thaw(String name) { - String result = name; - Matcher m = suffixPattern.matcher(name); - if (m.find()) { - String root = name.substring(0, m.start()); - String suffix = m.group(1); - long caseCode = Long.parseLong(suffix); - root = thawUnicode(root); - root = thawCase(root, caseCode); - result = root; - } - return result; - } - - private String thawUnicode(String name) { - Matcher m = unicodePattern.matcher(name); - StringBuffer b = new StringBuffer(); - int p0 = 0; - while (m.find()) { - int p1 = m.start(); - String chunk0 = name.substring(p0, p1); - String digits = m.group(1); - int codePoint = Integer.valueOf(digits, 16).intValue(); - char ch = (char) codePoint; - String chunk1 = Character.toString(ch); - b.append(chunk0); - b.append(chunk1); - p0 = m.end(); - } - b.append(name.substring(p0)); - String result = b.toString(); - return result; - } - - private String thawCase(String name, long caseCode) { - StringBuffer b = new StringBuffer(); - char[] chars = name.toCharArray(); - for (int i = chars.length - 1; i >= 0; i--) { - char ch = chars[i]; - boolean shift = (caseCode & 1L) == 1; - if (shift) { - ch = (ch == '_') ? ' ' : Character.toUpperCase(ch); - } - b.append(ch); - caseCode = caseCode >> 1; - } - String result = b.reverse().toString(); - return result; - } - - private Map getTypeQualifiers() { - Map typeQualifiers = new HashMap(); - typeQualifiers.put(IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, PFConstants.AB_CONNECTOR_SERVICE); - typeQualifiers.put(IRSEDOMConstants.TYPE_FILTER, PFConstants.AB_FILTER); - typeQualifiers.put(IRSEDOMConstants.TYPE_FILTER_POOL, PFConstants.AB_FILTER_POOL); - typeQualifiers.put(IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE, PFConstants.AB_FILTER_POOL_REFERENCE); - typeQualifiers.put(IRSEDOMConstants.TYPE_FILTER_STRING, PFConstants.AB_FILTER_STRING); - typeQualifiers.put(IRSEDOMConstants.TYPE_HOST, PFConstants.AB_HOST); - typeQualifiers.put(IRSEDOMConstants.TYPE_PROFILE, PFConstants.AB_PROFILE); - typeQualifiers.put(IRSEDOMConstants.TYPE_PROPERTY, PFConstants.AB_PROPERTY); - typeQualifiers.put(IRSEDOMConstants.TYPE_PROPERTY_SET, PFConstants.AB_PROPERTY_SET); - typeQualifiers.put(IRSEDOMConstants.TYPE_SERVER_LAUNCHER, PFConstants.AB_SERVICE_LAUNCHER); - typeQualifiers.put(IRSEDOMConstants.TYPE_SUBSYSTEM, PFConstants.AB_SUBSYSTEM); - return typeQualifiers; - } - - /** - * Write a set of properties to a location. - * @param properties The Properties object to write. - * @param header The header to include in the location contents. - * @param location The PersistenceLocation which will contain the properties. - * @param monitor The progress monitor. - */ - private void writeProperties(Properties properties, String header, PFPersistenceLocation location) { - ByteArrayOutputStream outStream = new ByteArrayOutputStream(500); - PrintWriter out = new PrintWriter(outStream); - out.println("# " + header); //$NON-NLS-1$ - Map map = new TreeMap(properties); - Set keys = map.keySet(); - for (Iterator z = keys.iterator(); z.hasNext();) { - String key = (String) z.next(); - String value = (String) map.get(key); - String keyvalue = key + "=" + escapeValue(value); //$NON-NLS-1$ - out.println(keyvalue); - } - out.close(); - ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray()); - location.setContents(inStream); - } - - /** - * Tests if a node's definition should be embedded in its parent's definition or - * if it should be a separate definition. The test is usually based on node type. - * @param node The node to be tested. - * @return true if the node is to be embedded. - */ - private boolean isNodeEmbedded(RSEDOMNode node) { - Set embeddedTypes = new HashSet(); - embeddedTypes.add(IRSEDOMConstants.TYPE_FILTER); - embeddedTypes.add(IRSEDOMConstants.TYPE_CONNECTOR_SERVICE); - boolean result = embeddedTypes.contains(node.getType()); - return result; - } - - /** - * Transforms an integer into its five digit counterpart complete with leading - * zeroes. - * @param i an integer from 0 to 99999. - * @return a string equivalent from "00000" to "99999" - */ - private String getIndexString(int i) { - assert (i >= 0 && i <= 99999); - String index = "00000" + Integer.toString(i); //$NON-NLS-1$ - index = index.substring(index.length() - 5); - return index; - } - - /** - * "Fixes" a value. Values in Properties objects may not be null. Changes all - * null values to the string "null" and escapes the characters in other values. - * @param value The value to check. - * @return The fixed value - */ - private String fixValue(String value) { - if (value == null) return NULL_VALUE_STRING; - return value; - } - - /** - * Escapes the characters in the supplied string according to the rules - * for properties files. - * @param value The value to examine. - * @return The equivalent value with escapes. - */ - private String escapeValue(String value) { - StringBuffer buffer = new StringBuffer(value.length() + 20); - char[] characters = value.toCharArray(); - for (int i = 0; i < characters.length; i++) { - char c = characters[i]; - if (c == '\\') { - buffer.append("\\\\"); //$NON-NLS-1$ - } else if (c == '\t') { - buffer.append("\\t"); //$NON-NLS-1$ - } else if (c == '\f') { - buffer.append("\\f"); //$NON-NLS-1$ - } else if (c == '\n') { - buffer.append("\\n"); //$NON-NLS-1$ - } else if (c == '\r') { - buffer.append("\\r"); //$NON-NLS-1$ - } else if ((c < '\u0020' || c > '\u007E')) { - String cString = "0000" + Integer.toHexString(c); //$NON-NLS-1$ - cString = cString.substring(cString.length() - 4); - cString = "\\u" + cString; //$NON-NLS-1$ - buffer.append(cString); - } else if ("=!#:".indexOf(c) >= 0) { //$NON-NLS-1$ - buffer.append('\\'); - buffer.append(c); - } else { - buffer.append(c); - } - } - return buffer.toString(); - } - - /** - * Constructs a properties object containing all the properties for this node. - * The following properties exist: - * name property, type property, embedded child properties, and referenced - * child properties. Each property has its own key format in the Properties - * object. - * @param node The node to extract the properties from. - * @param force Force children to be embedded rather than reference. - * @param monitor The progress monitor. The work count is increased by one each time - * this method is invoked. - * @return The Properties object containing that node definition. - */ - private Properties getProperties(RSEDOMNode node, boolean force, IProgressMonitor monitor) { - Properties properties = new Properties(); - properties.put(PFConstants.MT_NODE_NAME[0], node.getName()); - properties.put(PFConstants.MT_NODE_TYPE[0], node.getType()); - properties.putAll(getAttributes(node)); - RSEDOMNode[] children = node.getChildren(); - for (int i = 0; i < children.length; i++) { - RSEDOMNode child = children[i]; - String index = getIndexString(i); - if (force || isNodeEmbedded(child)) { - String prefix = combine(PFConstants.MT_CHILD[0], index); - Properties childProperties = getProperties(child, true, monitor); - Enumeration e = childProperties.keys(); - while (e.hasMoreElements()) { - String key = (String) e.nextElement(); - String value = childProperties.getProperty(key); - String newKey = combine(prefix, key); - properties.put(newKey, value); - } - } - } - monitor.worked(1); - return properties; - } - - /** - * Constructs a Properties object from the attributes present in a DOM node. - * @param node The node containing the attributes. Keys for attributes are of the - * form "attribute.[attribute-name]". If the attribute has a type then there - * will also be an "attribute-type.[attribute-name]" property. - * [attribute-name] may contain periods but must not be null. - * @return The newly constructed Properties object. - */ - private Properties getAttributes(RSEDOMNode node) { - Properties properties = new Properties(); - RSEDOMNodeAttribute[] attributes = node.getAttributes(); - for (int i = 0; i < attributes.length; i++) { - RSEDOMNodeAttribute attribute = attributes[i]; - String attributeName = attribute.getKey(); - String propertyKey = combine(PFConstants.MT_ATTRIBUTE[0], attributeName); - properties.put(propertyKey, fixValue(attribute.getValue())); - String attributeType = attribute.getType(); - if (attributeType != null) { - propertyKey = combine(PFConstants.MT_ATTRIBUTE_TYPE[0], attributeName); - properties.put(propertyKey, attributeType); - } - } - return properties; - } - - /** - * Count the number of nodes in a tree rooted in the supplied node. The - * supplied node is counted so the minimum result is one. - * @param node The root of the tree. - * @return The node count. - */ - private int countNodes(RSEDOMNode node) { - RSEDOMNode[] children = node.getChildren(); - int result = 1; - for (int i = 0; i < children.length; i++) { - RSEDOMNode child = children[i]; - result += countNodes(child); - } - return result; - } - - /** - * Counts the number of locations that have contents in this location and below. - * This provides a lower bound to the number of nodes that have to be created from this - * persistent form of a DOM. - * @param location - * @return the number of locations that have contents. - */ - private int countLocations(PFPersistenceLocation location) { - int result = 0; - if (location.hasContents()) { - result += 1; - } - PFPersistenceLocation[] children = location.getChildren(); - for (int i = 0; i < children.length; i++) { - PFPersistenceLocation child = children[i]; - result += countLocations(child); - } - return result; - } - - /** - * Loads a node from a location. - * @param parent The parent of the node to be created. If null then this node is assumed to - * be a DOM root node (RSEDOM). - * @param nodeLocation The location in which the contents of this node is found. - * @param monitor The monitor used to report progress and cancelation. If the monitor is - * in canceled state then it this does method does nothing and returns null. If the monitor - * is not canceled then its work count is incremented by one. - * @return The newly loaded node. - */ - private RSEDOMNode loadNode(RSEDOMNode parent, PFPersistenceLocation nodeLocation, IProgressMonitor monitor) { - RSEDOMNode node = null; - if (!monitor.isCanceled()) { - Properties properties = loadProperties(nodeLocation); - if (properties != null) { - node = makeNode(parent, nodeLocation, properties, monitor); - } - monitor.worked(1); - } - return node; - } - - /** - * Loads the properties found in the location. Returns null if no properties - * were found. - * @param location The location in which to look for properties. - * @return The Properties object. - */ - private Properties loadProperties(PFPersistenceLocation location) { - Properties properties = null; - if (location.hasContents()) { - properties = new Properties(); - InputStream inStream = location.getContents(); - try { - properties.load(inStream); - inStream.close(); - } catch (IOException e) { - logException(e); - } - } - return properties; - } - - /** - * Makes a new RSEDOMNode from a set of properties. The properties must (at least) include - * a "name" property and a "type" property. Any child nodes are created and attached as well. - * @param parent The parent node of the node to be created. - * @param location The location in which referenced child folders can be found. - * @param properties The properties from which to create the node. - * @param monitor a monitor to support cancellation and progress reporting. - * @return the newly created DOM node and its children. - */ - private RSEDOMNode makeNode(RSEDOMNode parent, PFPersistenceLocation location, Properties properties, IProgressMonitor monitor) { - String nodeType = getProperty(properties, PFConstants.MT_NODE_TYPE); - String nodeName = getProperty(properties, PFConstants.MT_NODE_NAME); - RSEDOMNode node = (parent == null) ? new RSEDOM(nodeName) : new RSEDOMNode(parent, nodeType, nodeName); - node.setRestoring(true); - Set keys = properties.keySet(); - Map attributes = new HashMap(); - Map attributeTypes = new HashMap(); - Map childPropertiesMap = new HashMap(); - Set childNames = new TreeSet(); // child names are 5 digit strings, a tree set is used to maintain ordering - Set referenceKeys = new TreeSet(); // ditto for reference keys, "<reference-metatype>.<index>" - // since the properties are in no particular order, we make a first pass to gather info on what's there - for (Iterator z = keys.iterator(); z.hasNext();) { - String key = (String) z.next(); - String[] words = split(key, 2); - String metatype = words[0]; - if (find(metatype, PFConstants.MT_ATTRIBUTE)) { - String value = properties.getProperty(key); - attributes.put(words[1], value); - } else if (find(metatype, PFConstants.MT_ATTRIBUTE_TYPE)) { - String type = properties.getProperty(key); - attributeTypes.put(words[1], type); - } else if (find(metatype, PFConstants.MT_REFERENCE)) { - referenceKeys.add(key); - } else if (find(metatype, PFConstants.MT_CHILD)) { - String value = properties.getProperty(key); - words = split(words[1], 2); - String childName = words[0]; - childNames.add(childName); - String newKey = words[1]; - Properties p = getProperties(childPropertiesMap, childName); - p.put(newKey, value); - } - } - Set attributeNames = attributes.keySet(); - for (Iterator z = attributeNames.iterator(); z.hasNext();) { - String attributeName = (String) z.next(); - String attributeValue = (String) attributes.get(attributeName); - if (attributeValue.equals(NULL_VALUE_STRING)) attributeValue = null; - String attributeType = (String) attributeTypes.get(attributeName); - node.addAttribute(attributeName, attributeValue, attributeType); - } - for (Iterator z = childNames.iterator(); z.hasNext();) { - String childName = (String) z.next(); - Properties p = getProperties(childPropertiesMap, childName); - makeNode(node, location, p, monitor); - } - for (Iterator z = referenceKeys.iterator(); z.hasNext();) { - String key = (String) z.next(); - String childLocationName = properties.getProperty(key); - PFPersistenceLocation childLocation = location.getChild(childLocationName); - loadNode(node, childLocation, monitor); - } - node.setRestoring(false); - return node; - } - - /** - * Gets a property given a "multi-key" - * @param properties The properties object to search - * @param keys the "multi-key" for that property - * @return The first property found using one of the elements of the multi-key. - */ - private String getProperty(Properties properties, String[] keys) { - String result = null; - for (int i = 0; i < keys.length && result == null; i++) { - String key = keys[i]; - result = properties.getProperty(key); - } - return result; - } - - /** - * Finds a key (needle) in an array of values (the haystack) - * @param needle The value to look for - * @param haystack the values to search - * @return true if the value was found - */ - private boolean find(String needle, String[] haystack) { - for (int i = 0; i < haystack.length; i++) { - String value = haystack[i]; - if (value.equals(needle)) return true; - } - return false; - } - - /** - * Returns a Properties object from the given Map that holds them using the - * selector String. Creates a new Properties object and places it in the map - * if one does not exist for the selector. - * @param propertiesMap The map in which to look for Properties objects. - * @param selector The name of the Properties object - * @return a Properties object. - */ - private Properties getProperties(Map propertiesMap, String selector) { - Properties p = (Properties) propertiesMap.get(selector); - if (p == null) { - p = new Properties(); - propertiesMap.put(selector, p); - } - return p; - } - - /** - * Convenience method to combine two names into one. The individual names in the - * combined name are separated by periods. - * @param typeName The first name. - * @param nodeName The second name - * @return the combined name. - */ - private String combine(String typeName, String nodeName) { - return combine(new String[] { typeName, nodeName }); - } - - /** - * The generic method for creating a qualified name from a string of segments. - * The individual names are separated by periods. - * @param names The names to combine - * @return The combined name. - */ - private String combine(String[] names) { - StringBuffer buf = new StringBuffer(100); - for (int i = 0; i < names.length; i++) { - String name = names[i]; - if (i > 0) buf.append('.'); - buf.append(name); - } - return buf.toString(); - } - - /** - * Splits a combined name into its component parts. The period is used as the name - * separator. If a limit > 0 is specified the return value will contain at most that - * number of segments. The last segment may, in fact, be split some more. - * @param longName The name to be split - * @param limit The number of parts to split the name into. - * @return The parts of the name. - */ - private String[] split(String longName, int limit) { - return period.split(longName, limit); - } - - private Logger getLogger() { - Logger logger = RSECorePlugin.getDefault().getLogger(); - return logger; - } - - private void logException(Exception e) { - getLogger().logError("unexpected exception", e); //$NON-NLS-1$ - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java deleted file mode 100644 index b48421395..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java +++ /dev/null @@ -1,446 +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: - * David Dykstal (IBM) - 142806: refactoring persistence framework - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods - ********************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.IRSEPreferenceNames; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IRSEPersistableContainer; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.internal.core.model.SystemProfileManager; -import org.eclipse.rse.internal.persistence.dom.RSEDOMExporter; -import org.eclipse.rse.internal.persistence.dom.RSEDOMImporter; -import org.eclipse.rse.logging.Logger; -import org.eclipse.rse.persistence.IRSEPersistenceManager; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.persistence.dom.RSEDOM; -import org.eclipse.rse.services.Mutex; - -/** - * The persistence manager controls all aspects of persisting the RSE data model. It will both - * save and restore this model. There should be only persistence manager in existence. This instance - * can be retrieved using RSEUIPlugin.getThePersistenceManager. - * @see RSECorePlugin#getThePersistenceManager() - */ -public class RSEPersistenceManager implements IRSEPersistenceManager { - - private class ProviderRecord { - private String providerId = null; - private IConfigurationElement configurationElement = null; - private IRSEPersistenceProvider provider = null; - private boolean restored = false; - synchronized boolean isRestored() { - return restored; - } - synchronized void setRestored(boolean restored) { - this.restored = restored; - } - boolean isAutostart() { - boolean isAutostart = (configurationElement != null && ("true".equals(configurationElement.getAttribute("autostart")))); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isDefault = (providerId.equals(getDefaultPersistenceProviderId())); - return isAutostart || isDefault; - } - } - - private Map knownProviders = new HashMap(10); - private Map loadedProviders = new HashMap(10); - private RSEDOMExporter _exporter; - private RSEDOMImporter _importer; - private Mutex mutex = new Mutex(); - - public RSEPersistenceManager(ISystemRegistry registry) { - _exporter = RSEDOMExporter.getInstance(); - _importer = RSEDOMImporter.getInstance(); - _importer.setSystemRegistry(registry); - getProviderExtensions(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#isExporting() - */ - public synchronized boolean isBusy() { - return mutex.isLocked(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#registerPersistenceProvider(java.lang.String, org.eclipse.rse.persistence.IRSEPersistenceProvider) - */ - public void registerPersistenceProvider(String id, IRSEPersistenceProvider provider) { - ProviderRecord pr = getProviderRecord(id); - pr.provider = provider; - loadedProviders.put(provider, id); - } - - /** - * Returns the persistence provider denoted by the id. Only one instance of this - * persistence provider is created. - * @param id The id of the persistence provider, as denoted by the id attribute on its declaration. - * @return an IRSEPersistenceProvider which may be null if this id is not found. - */ - public IRSEPersistenceProvider getPersistenceProvider(String id) { - ProviderRecord pr = getProviderRecord(id); - loadProvider(pr); - return pr.provider; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#getPersistenceProviderIds() - */ - public String[] getPersistenceProviderIds() { - Set ids = knownProviders.keySet(); - String[] result = new String[ids.size()]; - ids.toArray(result); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#commitProfile(org.eclipse.rse.core.model.ISystemProfile) - */ - public boolean commitProfile(ISystemProfile profile, long timeout) { - boolean result = false; - result = save(profile, true, timeout); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#commitProfiles() - */ - public ISystemProfile[] commitProfiles(long timeout) { - List failed = new ArrayList(10); - ISystemProfile[] profiles = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfiles(); - for (int idx = 0; idx < profiles.length; idx++) { - ISystemProfile profile = profiles[idx]; - try { - boolean ok = commitProfile(profile, timeout); - if (!ok) { - failed.add(profile); - } - } catch (Exception exc) { - Logger logger = RSECorePlugin.getDefault().getLogger(); - String profileName = profile.getName(); - String message = "Error saving profile " + profileName; //$NON-NLS-1$ - logger.logError(message, exc); - failed.add(profile); - } - } - ISystemProfile[] result = new ISystemProfile[failed.size()]; - failed.toArray(result); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#migrateProfile(org.eclipse.rse.core.model.ISystemProfile, org.eclipse.rse.persistence.IRSEPersistenceProvider) - */ - public void migrateProfile(ISystemProfile profile, IRSEPersistenceProvider persistenceProvider) { - IRSEPersistenceProvider oldProvider = profile.getPersistenceProvider(); - oldProvider = (oldProvider == null) ? getDefaultPersistenceProvider() : oldProvider; - IRSEPersistenceProvider newProvider = persistenceProvider; - newProvider = (newProvider == null) ? getDefaultPersistenceProvider() : newProvider; - if (oldProvider != newProvider) { - String profileName = profile.getName(); - profile.setPersistenceProvider(newProvider); - profile.commit(); - deleteProfile(oldProvider, profileName); - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#deleteProfile(java.lang.String) - */ - public void deleteProfile(final IRSEPersistenceProvider persistenceProvider, final String profileName) { - Job job = new Job(RSECoreMessages.RSEPersistenceManager_DeleteProfileJobName) { - protected IStatus run(IProgressMonitor monitor) { - IRSEPersistenceProvider p = persistenceProvider != null ? persistenceProvider : getDefaultPersistenceProvider(); - IStatus result = p.deleteProfile(profileName, monitor); - return result; - } - }; - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#restoreProfiles() - */ - public ISystemProfile[] restoreProfiles(long timeout) { - String[] ids = getPersistenceProviderIds(); - List selectedRecords = new ArrayList(10); - for (int i = 0; i < ids.length; i++) { - String id = ids[i]; - ProviderRecord pr = getProviderRecord(id); - if (pr.isAutostart()) { - IRSEPersistenceProvider provider = getPersistenceProvider(id); - if (provider != null) { - pr.setRestored(false); - selectedRecords.add(pr); - } - } - } - List profiles = new ArrayList(10); - for (Iterator z = selectedRecords.iterator(); z.hasNext();) { - ProviderRecord pr = (ProviderRecord) z.next(); - ISystemProfile[] providerProfiles = restoreProfiles(pr.provider, timeout); - profiles.addAll(Arrays.asList(providerProfiles)); - } - ISystemProfile[] result = new ISystemProfile[profiles.size()]; - profiles.toArray(result); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#restoreProfiles(org.eclipse.rse.persistence.IRSEPersistenceProvider) - */ - public ISystemProfile[] restoreProfiles(IRSEPersistenceProvider provider, long timeout) { - ProviderRecord pr = getProviderRecord(provider); - pr.setRestored(false); // may already be false or true - List profiles = loadProfiles(provider, timeout); - pr.setRestored(true); - ISystemProfile[] result = new ISystemProfile[profiles.size()]; - profiles.toArray(result); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceManager#isRestoreComplete(java.lang.String) - */ - public boolean isRestoreComplete() { - boolean isComplete = true; - String[] ids = getPersistenceProviderIds(); - for (int i = 0; i < ids.length && isComplete; i++) { - String id = ids[i]; - ProviderRecord pr = getProviderRecord(id); - isComplete = pr.isAutostart() && pr.isRestored(); - } - return isComplete; - } - - private ProviderRecord getProviderRecord(String providerId) { - ProviderRecord providerRecord = (ProviderRecord) knownProviders.get(providerId); - if (providerRecord == null) { - providerRecord = new ProviderRecord(); - knownProviders.put(providerId, providerRecord); - } - return providerRecord; - } - - /** - * Returns the provider record for a given persistence provider. - * @param provider the provider for which to retrieve the provider record. - * @return the provider record. - */ - private ProviderRecord getProviderRecord(IRSEPersistenceProvider provider) { - ProviderRecord pr = null; - String id = (String) loadedProviders.get(provider); - if (id != null) { - pr = getProviderRecord(id); - } else { - pr = new ProviderRecord(); - } - return pr; - } - - /** - * Loads the map of known providers from the extensions made by all the plugins. - * This is done once at initialization of the manager. As these ids are resolved to - * their providers as needed, the configuration elements are replaced in the map - * by the persistence providers they reference. - */ - private void getProviderExtensions() { - Logger logger = RSECorePlugin.getDefault().getLogger(); - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IConfigurationElement[] providerCandidates = registry.getConfigurationElementsFor("org.eclipse.rse.core", "persistenceProviders"); //$NON-NLS-1$ //$NON-NLS-2$ - for (int j = 0; j < providerCandidates.length; j++) { - IConfigurationElement configurationElement = providerCandidates[j]; - if (configurationElement.getName().equals("persistenceProvider")) { //$NON-NLS-1$ - String candidateId = configurationElement.getAttribute("id"); //$NON-NLS-1$ - if (candidateId != null) { - ProviderRecord pr = getProviderRecord(candidateId); - pr.configurationElement = configurationElement; - pr.providerId = candidateId; - } else { - logger.logError("Missing id attribute in persistenceProvider element", null); //$NON-NLS-1$ - } - } else { - logger.logError("Invalid element in persistenceProviders extension point", null); //$NON-NLS-1$ - } - } - } - - /** - * Loads a provider given a provider record. If the provider has already been loaded - * it will not load it again. After loading, the provider will be initialized with any - * properties found in the extension. - * @param pr the provider record containing the configuration element describing the provider - * @return the provider - */ - private IRSEPersistenceProvider loadProvider(ProviderRecord pr) { - if (pr.provider == null) { - try { - pr.provider = (IRSEPersistenceProvider) pr.configurationElement.createExecutableExtension("class"); //$NON-NLS-1$ - loadedProviders.put(pr.provider, pr.providerId); - Properties properties = new Properties(); - IConfigurationElement[] children = pr.configurationElement.getChildren("property"); //$NON-NLS-1$ - for (int i = 0; i < children.length; i++) { - IConfigurationElement child = children[i]; - String name = child.getAttribute("name"); //$NON-NLS-1$ - String value = child.getAttribute("value"); //$NON-NLS-1$ - properties.put(name, value); - } - pr.provider.setProperties(properties); - } catch (CoreException e) { - Logger logger = RSECorePlugin.getDefault().getLogger(); - logger.logError("Exception loading persistence provider", e); //$NON-NLS-1$ - } - } - return pr.provider; - } - - /** - * Retrieves the default persistence provider for this workbench configuration. - * Several persistence providers may be registered, but the default one is used for all - * profiles that do not have one explicitly specified. - * This persistence provider's identifier is specified in the org.eclipse.rse.core/DEFAULT_PERSISTENCE_PROVIDER - * preference and can be specified a product's plugin_customization.ini file. - * @see IRSEPreferenceNames - * @return the default IRSEPersistenceProvider for this installation. - */ - private IRSEPersistenceProvider getDefaultPersistenceProvider() { - String providerId = getDefaultPersistenceProviderId(); - IRSEPersistenceProvider provider = getPersistenceProvider(providerId); - return provider; - } - - /** - * Retrieves the default persistence provider id from the preferences. - * This persistence provider identifier is specified in the org.eclipse.rse.core/DEFAULT_PERSISTENCE_PROVIDER - * preference and can be specified a product's plugin_customization.ini file. - * @return - */ - private String getDefaultPersistenceProviderId() { - Preferences preferences = RSECorePlugin.getDefault().getPluginPreferences(); - String providerId = preferences.getString(IRSEPreferenceNames.DEFAULT_PERSISTENCE_PROVIDER); - return providerId; - } - - /** - * Loads the profiles for a given persistence provider. - * @param persistenceProvider - * @return a list of profiles - */ - private List loadProfiles(IRSEPersistenceProvider persistenceProvider, long timeout) { - List profiles = new ArrayList(10); - String[] profileNames = persistenceProvider.getSavedProfileNames(); - for (int i = 0; i < profileNames.length; i++) { - String profileName = profileNames[i]; - ISystemProfile profile = load(persistenceProvider, profileName, timeout); - profiles.add(profile); - } - return profiles; - } - - /** - * Loads a profile of the given name using the given persistence provider. If the provider cannot - * find a profile with that name, return null. - * @param provider the persistence provider that understands the name and can produce a profile. - * @param profileName the name of the profile to produce - * @return the profile or null - */ - private synchronized ISystemProfile load(IRSEPersistenceProvider provider, String profileName, long timeout) { - ISystemProfile profile = null; - if (mutex.waitForLock(null, timeout)) { - try { - RSEDOM dom = provider.loadRSEDOM(profileName, new NullProgressMonitor()); - if (dom != null) { - SystemProfileManager.getDefault().setRestoring(true); - profile = _importer.restoreProfile(dom); - profile.setPersistenceProvider(provider); - cleanTree(profile); - SystemProfileManager.getDefault().setRestoring(false); - } - } finally { - mutex.release(); - } - } - return profile; - } - - /** - * Writes a profile to a DOM and schedules writing of that DOM to disk. - * May, in fact, update an existing DOM instead of creating a new one. - * If in the process of importing, skip writing. - * @return true if the profile is written to a DOM - */ - private boolean save(ISystemProfile profile, boolean force, long timeout) { - boolean result = false; - if (mutex.waitForLock(null, timeout)) { - try { - IRSEPersistenceProvider provider = profile.getPersistenceProvider(); - if (provider == null) { - provider = getDefaultPersistenceProvider(); - profile.setPersistenceProvider(provider); - } - RSEDOM dom = _exporter.createRSEDOM(profile, force); - cleanTree(profile); - if (dom.needsSave()) { - Job job = provider.getSaveJob(dom); - if (job != null) { - job.schedule(3000); // three second delay - } else { - provider.saveRSEDOM(dom, new NullProgressMonitor()); - } - } - result = true; - } finally { - mutex.release(); - } - } - return result; - } - - private void cleanTree(IRSEPersistableContainer node) { - node.setWasRestored(true); - node.setTainted(false); - node.setDirty(false); - IRSEPersistableContainer[] children = node.getPersistableChildren(); - for (int i = 0; i < children.length; i++) { - IRSEPersistableContainer child = children[i]; - cleanTree(child); - } - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SerializingProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SerializingProvider.java deleted file mode 100644 index 668e374e2..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SerializingProvider.java +++ /dev/null @@ -1,187 +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) - [184095] Replace systemTypeName by IRSESystemType - * David Dykstal (IBM) - [191130] use explicit getRemoteSystemsProject(boolean) method - ********************************************************************************/ - -package org.eclipse.rse.internal.persistence; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Properties; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.SystemResourceManager; -import org.eclipse.rse.internal.core.RSECoreMessages; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.persistence.dom.RSEDOM; - -/** - * This is class is used to restore an RSE DOM from disk and import it into RSE. - * @author dmcknigh - * - */ -public class SerializingProvider implements IRSEPersistenceProvider { - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#getSavedProfileNames() - */ - public String[] getSavedProfileNames() { - /* - * We look for folders inside the RemoteSystemsConnections folder that contain - * a single file named folderName.rsedom. We return the array of folder names. - */ - List names = new Vector(10); - try { - IProject project = SystemResourceManager.getRemoteSystemsProject(false); - if (project.isAccessible()) { - IResource[] candidates = project.members(); - for (int i = 0; i < candidates.length; i++) { - IResource candidate = candidates[i]; - if (candidate.getType() == IResource.FOLDER) { - IFolder candidateFolder = (IFolder) candidate; - IResource[] children = candidateFolder.members(); - if (children.length == 1) { - IResource child = children[0]; - if (child.getType() == IResource.FILE) { - String profileName = candidateFolder.getName(); - String domFileName = profileName + ".rsedom"; //$NON-NLS-1$ - String childName = child.getName(); - if (childName.equals(domFileName)) { - names.add(profileName); - } - } - } - } - } - } - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - String[] result = new String[names.size()]; - names.toArray(result); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#loadRSEDOM(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) - */ - public RSEDOM loadRSEDOM(String profileName, IProgressMonitor monitor) { - RSEDOM dom = null; - IFile profileFile = getProfileFile(profileName, monitor); - if (profileFile.exists()) { - //System.out.println("loading "+ profileFile.getLocation().toOSString() + "..."); // DWD debugging - try { - InputStream iStream = profileFile.getContents(); - - ObjectInputStream inStream = new ObjectInputStream(iStream); - dom = (RSEDOM) inStream.readObject(); - inStream.close(); - } catch (Exception e) { - e.printStackTrace(); - try { - profileFile.delete(true, false, monitor); - } catch (Exception e2) { - e.printStackTrace(); - } - - } - } - return dom; - } - - private IFile getProfileFile(String domName, IProgressMonitor monitor) { - IProject project = SystemResourceManager.getRemoteSystemsProject(true); - - // before loading, make sure the project is in synch - try { - project.refreshLocal(IResource.DEPTH_INFINITE, monitor); - } catch (Exception e) { - } - - IFolder folder = project.getFolder(domName); - if (!folder.exists()) { - try { - folder.create(true, true, monitor); - } catch (Exception e) { - } - } - return folder.getFile(domName + ".rsedom"); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#saveRSEDOM(org.eclipse.rse.persistence.dom.RSEDOM, org.eclipse.core.runtime.IProgressMonitor) - */ - public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor) { - - IFile profileFile = getProfileFile(dom.getName(), monitor); - File osFile = profileFile.getLocation().toFile(); - // System.out.println("saving "+ osFile.getAbsolutePath() + "..."); // DWD debugging - try { - OutputStream oStream = new FileOutputStream(osFile); - ObjectOutputStream outStream = new ObjectOutputStream(oStream); - outStream.writeObject(dom); - outStream.close(); - profileFile.getParent().refreshLocal(IResource.DEPTH_ONE, monitor); - dom.markUpdated(); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#getSaveJob(org.eclipse.rse.persistence.dom.RSEDOM) - */ - public Job getSaveJob(RSEDOM dom) { - return null; - } - - public IStatus deleteProfile(String profileName, IProgressMonitor monitor) { - IStatus result = Status.OK_STATUS; - IFile profileFile = getProfileFile(profileName, monitor); - if (profileFile.exists()) { - try { - profileFile.delete(IResource.FORCE | IResource.KEEP_HISTORY, monitor); - } catch (CoreException e) { - result = new Status(IStatus.ERROR, null, 0, RSECoreMessages.SerializingProvider_UnexpectedException, e); - } - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.persistence.IRSEPersistenceProvider#setProperties(java.util.Properties) - */ - public void setProperties(Properties properties) { - // Do nothing. The serializing provider does not make use of properties - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/IRSEDOMExporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/IRSEDOMExporter.java deleted file mode 100644 index 7adaf9fdd..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/IRSEDOMExporter.java +++ /dev/null @@ -1,149 +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.persistence.dom; - -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.IServerLauncherProperties; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.persistence.dom.RSEDOM; -import org.eclipse.rse.persistence.dom.RSEDOMNode; - -public interface IRSEDOMExporter { - /** - * Creates the RSE DOM for this profile - * @param profile - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return the created DOM - */ - RSEDOM createRSEDOM(ISystemProfile profile, boolean clean); - - /** - * Creates an RSE DOM for use in persistence - * @param dom - * @param profile - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return the created DOM - */ - public RSEDOM populateRSEDOM(RSEDOM dom, ISystemProfile profile, boolean clean); - - /** - * Returns the RSEDOM for this profile iff it exists - * @param profile - * @return The DOM retrieved from the profile - */ - RSEDOM getRSEDOM(ISystemProfile profile); - - /** - * Create a DOM node representing a host - * @param parent the parent of this node, must be node for an ISystemProfile - * @param host the host from which to create this node - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return The DOM node for the IHost - */ - RSEDOMNode createNode(RSEDOMNode parent, IHost host, boolean clean); - - /** - * Creates a DOM node for a connector service - * @param parent the parent of this node, must be node for an IHost - * @param cs the connector service from which to create a node - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return The DOM node for the IConnectorService - */ - RSEDOMNode createNode(RSEDOMNode parent, IConnectorService cs, boolean clean); - - /** - * Creates a DOM node for a server launcher - * @param parent the parent of this node, must be a node for an IConnectorService - * @param sl the server launcher properties from which to create a node - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return the DOM node for the IServerLauncherProperties - */ - RSEDOMNode createNode(RSEDOMNode parent, IServerLauncherProperties sl, boolean clean); - - /** - * Creates a DOM node for a subsystem - * @param parent the parent of this node, must be a node for an IConnectorService - * @param ss the subsystem from which to create a node - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return The DOM node for the ISubSystem - */ - RSEDOMNode createNode(RSEDOMNode parent, ISubSystem ss, boolean clean); - - /** - * Creates a DOM node for a filter - * @param parent the parent DOM node for this new node, must be a node for an ISystemFilterPool - * @param filter the filter from which to create the node - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return The DOM node for the filter - */ - RSEDOMNode createNode(RSEDOMNode parent, ISystemFilter filter, boolean clean); - - /** - * Create a DOM node representing a filter pool - * @param parent the parent DOM node for this new node, must be a node for an ISystemProfile - * @param filterPool the filter pool from which to create the node - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return The DOM node for the filter pool - */ - RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPool fp, boolean clean); - - /** - * Creates a DOM node for a filter pool reference - * @param parent the parent DOM node for this new node, must be a node for an ISubSystem - * @param fpr the filter pool reference from which to create the node - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return The DOM node for this filter pool reference - */ - RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPoolReference fpr, boolean clean); - - /** - * Creates a DOM node for a filter string - * @param parent the parent DOM node for this new node, must be node for an ISystemFilter - * @param fs the filter string from which to create the node - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return the DOM node for this filter string - */ - RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterString fs, boolean clean); - - /** - * Creates DOM nodes for each associated property set of a model object - * @param parent the parent DOM node for these new nodes, can be DOM node for any RSE model object - * @param mo the model object - * @param clean true if the node should being created from scratch, false if the an existing - * node should be found and merged - * @return an array of DOM nodes for the property sets of an RSE model object - */ - RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject mo, boolean clean); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/IRSEDOMImporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/IRSEDOMImporter.java deleted file mode 100644 index 75c681eb1..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/IRSEDOMImporter.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.persistence.dom; - -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemProfileManager; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.IServerLauncherProperties; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.persistence.dom.RSEDOM; -import org.eclipse.rse.persistence.dom.RSEDOMNode; - -public interface IRSEDOMImporter { - - /** - * Restores the profile represented by dom - * @param profileManager - * @param dom - * @return the restored profile - */ - ISystemProfile restoreProfile(ISystemProfileManager profileManager, RSEDOM dom); - - /** - * Restores the host represented by hostNode - */ - IHost restoreHost(ISystemProfile profile, RSEDOMNode hostNode); - - /** - * Restore the connector service represented by connectorServiceNode - */ - IConnectorService restoreConnectorService(IHost host, RSEDOMNode connectorServiceNode); - - IServerLauncherProperties restoreServerLauncher(IConnectorService service, RSEDOMNode serverLauncherNode, IServerLauncherProperties slproperties); - - /** - * Restores the subsystem represented by subSystemNode - */ - ISubSystem restoreSubSystem(IHost host, RSEDOMNode subSystemNode); - - ISystemFilter restoreFilter(ISystemFilterPool filterPool, RSEDOMNode systemFilterNode); - - /** - * Restore the filter pool represented by the node - */ - ISystemFilterPool restoreFilterPool(ISystemProfile profile, RSEDOMNode systemFilterPoolNode); - - ISystemFilterPoolReference restoreFilterPoolReference(ISubSystem subSystem, RSEDOMNode systemFilterPoolReferenceNode); - - ISystemFilterString restoreFilterString(ISystemFilter filter, RSEDOMNode systemFilterStringNode); - - /** - * Restores the property set represented by propertySetNode - */ - IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode); -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java deleted file mode 100644 index f95f6bd53..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java +++ /dev/null @@ -1,447 +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) - [175262] IHost.getSystemType() should return IRSESystemType - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.internal.persistence.dom; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IProperty; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.IPropertyType; -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.IDelegatingConnectorService; -import org.eclipse.rse.core.subsystems.IServerLauncherProperties; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.persistence.dom.IRSEDOMConstants; -import org.eclipse.rse.persistence.dom.RSEDOM; -import org.eclipse.rse.persistence.dom.RSEDOMNode; - -public class RSEDOMExporter implements IRSEDOMExporter { - - private static RSEDOMExporter _instance = new RSEDOMExporter(); - private Map _domMap; - - /** - * Constructor to create a new DOM exporter. - */ - protected RSEDOMExporter() { - _domMap = new HashMap(); - } - - /** - * @return the singleton instance of this exporter - */ - public static RSEDOMExporter getInstance() { - return _instance; - } - - /** - * Returns the RSEDOM for this profile if it exists - * @param profile the profile for which to get the DOM - * @return the DOM for a particular profile, null if the DOM does not exist - */ - public RSEDOM getRSEDOM(ISystemProfile profile) { - return (RSEDOM) _domMap.get(profile); - } - - /** - * Creates the RSE DOM for this profile. After it has found the DOM it will - * synchronize on the DOM to ensure its integrity while it is being updated. - * @param profile the profile for which to create the DOM - * @param clean indicates whether to create from scratch or merge with existing DOM - * @return The DOM for this profile - */ - public RSEDOM createRSEDOM(ISystemProfile profile, boolean clean) { - RSEDOM dom = getRSEDOM(profile); - if (dom == null) { - dom = new RSEDOM(profile); - _domMap.put(profile, dom); - clean = true; - } - synchronized (dom) { - populateRSEDOM(dom, profile, clean); - } - return dom; - } - - /** - * Creates an RSE DOM for use in persistence - * @param dom the root node for the target DOM - * @param profile the profile from which to populate the DOM - * @param clean indicates whether to create from scratch or merge with existing DOM - * @return The DOM, updated with the data from the profile - */ - public RSEDOM populateRSEDOM(RSEDOM dom, ISystemProfile profile, boolean clean) { - // for now we do complete refresh - // clean dom for fresh creation - if (clean) { - dom.clearChildren(); - } - - if (clean || profile.isDirty() || dom.isDirty()) { - dom.clearAttributes(); - dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT_PRIVATE, getBooleanString(profile.isDefaultPrivate())); - dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_IS_ACTIVE, getBooleanString(profile.isActive())); - } - - // create the dom using the profile - - // create filter pool nodes - ISystemFilterPool[] filterPools = profile.getFilterPools(); - for (int i = 0; i < filterPools.length; i++) { - ISystemFilterPool pool = filterPools[i]; - createNode(dom, pool, clean); - } - - // create hosts nodes - - // old nodes to compare with - List missingNodes = new ArrayList(); - if (!clean) { - RSEDOMNode[] oldHostNodes = dom.getChildren(IRSEDOMConstants.TYPE_HOST); - for (int o = 0; o < oldHostNodes.length; o++) { - missingNodes.add(oldHostNodes[o]); - } - } - - IHost[] hosts = profile.getHosts(); - for (int j = 0; j < hosts.length; j++) { - IHost host = hosts[j]; - RSEDOMNode hnode = createNode(dom, host, clean); - - if (!clean) { - // remove this one from the missing list - missingNodes.remove(hnode); - } - } - - if (!clean) { - // remaining missingNodes are probably deleted now - for (int x = 0; x < missingNodes.size(); x++) { - dom.removeChild((RSEDOMNode) missingNodes.get(x)); - } - } - - // create generic property set nodes - createPropertySetNodes(dom, profile, clean); - dom.setDirty(false); - - return dom; - } - - /** - * Creates DOM nodes for each associated property set - * @param parent The node of the DOM that needs a property set - * @param modelObject the RSE model object that has the property set. - * @param clean true if we are creating, false if we are merging - * @return an array of DOM nodes - each one being a property set - */ - public RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject modelObject, boolean clean) { - IPropertySet[] propertySets = modelObject.getPropertySets(); - RSEDOMNode[] result = new RSEDOMNode[propertySets.length]; - for (int i = 0; i < propertySets.length; i++) { - IPropertySet set = propertySets[i]; - RSEDOMNode propertySetNode = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName()); - propertySetNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, set.getDescription()); - String[] keys = set.getPropertyKeys(); - for (int k = 0; k < keys.length; k++) { - String key = keys[k]; - String value = set.getPropertyValue(key); - IPropertyType type = set.getPropertyType(key); - RSEDOMNode propertyNode = new RSEDOMNode(propertySetNode, IRSEDOMConstants.TYPE_PROPERTY, key); - propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, type.toString()); - propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE, value); - - } - result[i] = propertySetNode; - } - return result; - } - - /** - * Create a DOM node representing a filter pool - * @param parent the parent DOM node - * @param filterPool the filter pool from which to create a DOM node linked to this parent - * @param clean true if we are creating, false if we are merging - * @return the DOM node representing the filter pool - */ - public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPool filterPool, boolean clean) { - RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL, filterPool, clean); - if (clean || node.isDirty()) { - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterPool.getType()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filterPool.getId()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filterPool.supportsNestedFilters())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DELETABLE, getBooleanString(filterPool.isDeletable())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterPool.isDefault())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filterPool.isSetStringsCaseSensitive())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS, getBooleanString(filterPool.supportsDuplicateFilterStrings())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, Integer.toString(filterPool.getRelease())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filterPool.isSetSingleFilterStringOnly())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME, filterPool.getOwningParentName()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filterPool.isNonRenamable())); - } - ISystemFilter[] filters = filterPool.getSystemFilters(); - for (int i = 0; i < filters.length; i++) { - createNode(node, filters[i], clean); - } - createPropertySetNodes(node, filterPool, clean); - node.setDirty(false); - return node; - } - - /** - * Creates a DOM node for a filter - * @param parent The parent DOM node for this filter, usually a DOM node for a filter pool - * @param filter the filter for which to create a new node - * @param clean true if we are creating, false if we are merging - * @return the DOM node representing the filter - */ - public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilter filter, boolean clean) { - RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER, filter, clean); - if (clean || node.isDirty()) { - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filter.getName()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filter.isSupportsNestedFilters())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELATIVE_ORDER, Integer.toString(filter.getRelativeOrder())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filter.isDefault())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filter.isSetStringsCaseSensitive())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(filter.isPromptable())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS, getBooleanString(filter.supportsDuplicateFilterStrings())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_DELETABLE, getBooleanString(filter.isNonDeletable())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filter.isNonRenamable())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_CHANGEABLE, getBooleanString(filter.isNonChangable())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRINGS_NON_CHANGABLE, getBooleanString(filter.isStringsNonChangable())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, Integer.toString(filter.getRelease())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filter.isSetSingleFilterStringOnly())); - } - - // add nested filters - ISystemFilter[] nestedFilters = filter.getSystemFilters(); - for (int i = 0; i < nestedFilters.length; i++) { - createNode(node, nestedFilters[i], clean); - } - - // add filter strings - ISystemFilterString[] filterStrings = filter.getSystemFilterStrings(); - for (int j = 0; j < filterStrings.length; j++) { - createNode(node, filterStrings[j], clean); - } - - createPropertySetNodes(node, filter, clean); - node.setDirty(false); - return node; - } - - /** - * Creates a DOM node for a filter string - * @param parent the DOM node that is the parent to this filter string. This should be a node for a filter. - * @param filterString The filter string for which the node will be created - * @param clean true if we are creating, false if we are merging - * @return the DOM node for the filter string - */ - public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterString filterString, boolean clean) { - RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_STRING, filterString, clean); - - if (clean || node.isDirty()) { - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING, filterString.getString()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterString.getType()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterString.isDefault())); - } - - createPropertySetNodes(node, filterString, clean); - return node; - } - - /** - * Create a DOM node representing a host - * @param parent The DOM node that is the parent to this host, usually a node representing a profile - * @param host The host for which to create the DOM node - * @param clean true if we are creating, false if we are merging - * @return the DOM node for the host - */ - public RSEDOMNode createNode(RSEDOMNode parent, IHost host, boolean clean) { - RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_HOST, host, clean); - - if (clean || node.isDirty()) { - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, host.getSystemType().getName()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SYSTEM_TYPE, host.getSystemType().getId()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE, getBooleanString(host.isOffline())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME, host.getHostName()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, host.getDescription()); - } - - IConnectorService[] connectorServices = host.getConnectorServices(); - for (int i = 0; i < connectorServices.length; i++) { - IConnectorService service = connectorServices[i]; - if (!(service instanceof IDelegatingConnectorService)) // don't persist delegated ones - { - createNode(node, service, clean); - } - } - - createPropertySetNodes(node, host, clean); - node.setDirty(false); - return node; - } - - /** - * Creates a DOM node for a connector service - * @param parent the DOM node representing the parent for a connector service. This should be a Host - * @param connectorService the connector service for which a DOM node is to be created - * @param clean true if we are creating, false if we are merging - * @return the DOM node for the connector service - */ - public RSEDOMNode createNode(RSEDOMNode parent, IConnectorService connectorService, boolean clean) { - RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, connectorService, clean); - if (clean || node.isDirty()) { - // can't do this until connector service owns the properties (right now it's still subsystem) - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP, connectorService.getName()); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL, getBooleanString(connectorService.isUsingSSL())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PORT, Integer.toString(connectorService.getPort())); - } - // store the server launcher - // right now subsystem still owns the server launchers - // that will change later - - IServerLauncherProperties serverLauncher = connectorService.getRemoteServerLauncherProperties(); - if (serverLauncher != null) { - createNode(node, serverLauncher, clean); - } - - // store each subsystem - ISubSystem[] subSystems = connectorService.getSubSystems(); - for (int i = 0; i < subSystems.length; i++) { - createNode(node, subSystems[i], clean); - } - - createPropertySetNodes(node, connectorService, clean); - node.setDirty(false); - return node; - } - - /** - * Creates a DOM node for a server launcher - * @param parent the DOM node represnting a parent for a server launcher, usually a connector service - * @param serverLauncher the server launcher from which to create the node - * @param clean true if we are creating, false if we are merging - * @return the node representing the server launcher - */ - public RSEDOMNode createNode(RSEDOMNode parent, IServerLauncherProperties serverLauncher, boolean clean) { - RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SERVER_LAUNCHER, serverLauncher, clean); - - if (clean || node.isDirty()) { - } - - serverLauncher.saveToProperties(); - createPropertySetNodes(node, serverLauncher, clean); - return node; - } - - /** - * Creates a DOM node for a subsystem - * @param parent the DOM node representing the parent for this subsystem, usually a connector service - * @param subSystem the subsystem from which to create the DOM node - * @param clean true if we are creating, false if we are merging - * @return the DOM node representing the subsystem - */ - public RSEDOMNode createNode(RSEDOMNode parent, ISubSystem subSystem, boolean clean) { - RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SUBSYSTEM, subSystem, clean); - - if (clean || node.isDirty()) { - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN, getBooleanString(subSystem.isHidden())); - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, subSystem.getSubSystemConfiguration().getId()); - } - - // create filter pool reference nodes - ISystemFilterPoolReferenceManager refMgr = subSystem.getFilterPoolReferenceManager(); - if (refMgr != null) { - ISystemFilterPoolReference[] references = refMgr.getSystemFilterPoolReferences(); - for (int i = 0; i < references.length; i++) { - ISystemFilterPoolReference ref = references[i]; - createNode(node, ref, clean); - } - } - - createPropertySetNodes(node, subSystem, clean); - node.setDirty(false); - return node; - } - - /** - * Creates a DOM node for a filter pool reference - * @param parent the DOM node representing the parent for a filter pool reference, usually a subsystem - * @param filterPoolReference the reference from which to create a new DOM node - * @param clean true if we are creating, false if we are merging - * @return the DOM node created for the filter pool reference - */ - public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPoolReference filterPoolReference, boolean clean) { - RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE, filterPoolReference, clean); - String name = filterPoolReference.getFullName(); - node.setName(name); // filter pool references must write out the fully qualified name of their referenced filter pool - if (clean || node.isDirty()) { - ISystemFilterPool filterPool = filterPoolReference.getReferencedFilterPool(); - String refId = (filterPool != null) ? filterPool.getId() : "unknown"; //$NON-NLS-1$ - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID, refId); - } - createPropertySetNodes(node, filterPoolReference, clean); - node.setDirty(false); - return node; - } - - /** - * @param parent the DOM node representing the parent of the node we are trying to find - * @param type the type of the DOM node to look for - * @param modelObject the model object for which we are trying to find a matching node - * @param clean true if we are creating, false if we are merging - * @return the DOM node that we found or created - */ - private RSEDOMNode findOrCreateNode(RSEDOMNode parent, String type, IRSEModelObject modelObject, boolean clean) { - RSEDOMNode node = null; - String name = modelObject.getName(); - if (!clean) { - node = parent.getChild(type, name); - if (node != null && modelObject.isDirty()) { - node.clearAttributes(); - node.setDirty(true); - } - } - if (node == null) { - node = new RSEDOMNode(parent, type, name); - } - return node; - } - - /** - * Helper to get either "true" or "false" based on boolean flag - * @param flag the flag which to translate - * @return a string value suitable for the DOM - */ - private String getBooleanString(boolean flag) { - return flag ? IRSEDOMConstants.ATTRIBUTE_TRUE : IRSEDOMConstants.ATTRIBUTE_FALSE; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java deleted file mode 100644 index dd31ffdbe..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java +++ /dev/null @@ -1,502 +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) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods - ********************************************************************************/ - -package org.eclipse.rse.internal.persistence.dom; - -import java.util.Vector; - -import org.eclipse.rse.core.IRSECoreRegistry; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterStartHere; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.IPropertyType; -import org.eclipse.rse.core.model.IRSEModelObject; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.PropertyType; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.IServerLauncherProperties; -import org.eclipse.rse.core.subsystems.IServiceSubSystem; -import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.core.subsystems.SubSystemFilterNamingPolicy; -import org.eclipse.rse.internal.core.model.SystemProfile; -import org.eclipse.rse.internal.core.model.SystemProfileManager; -import org.eclipse.rse.persistence.dom.IRSEDOMConstants; -import org.eclipse.rse.persistence.dom.RSEDOM; -import org.eclipse.rse.persistence.dom.RSEDOMNode; -import org.eclipse.rse.persistence.dom.RSEDOMNodeAttribute; - -public class RSEDOMImporter { - private static RSEDOMImporter _instance = new RSEDOMImporter(); - private ISystemRegistry _registry; - - public static RSEDOMImporter getInstance() { - return _instance; - } - - public RSEDOMImporter() { - } - - public void setSystemRegistry(ISystemRegistry registry) { - _registry = registry; - } - - /** - * Restores the profile represented by dom - * @param dom - * @return the restored profile - */ - public ISystemProfile restoreProfile(RSEDOM dom) { - String profileName = dom.getName(); - boolean defaultPrivate = getBooleanValue(dom.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT_PRIVATE).getValue()); - boolean isActive = getBooleanValue(dom.getAttribute(IRSEDOMConstants.ATTRIBUTE_IS_ACTIVE).getValue()); - ISystemProfile profile = new SystemProfile(profileName, isActive); - if (profile != null) { - profile.setDefaultPrivate(defaultPrivate); - SystemProfileManager.getDefault().addSystemProfile(profile); - // restore the children for the profile - RSEDOMNode[] children = dom.getChildren(); - for (int i = 0; i < children.length; i++) { - RSEDOMNode child = children[i]; - String type = child.getType(); - if (type.equals(IRSEDOMConstants.TYPE_HOST)) { - restoreHost(profile, child); - } else if (type.equals(IRSEDOMConstants.TYPE_FILTER_POOL)) { - restoreFilterPool(profile, child); - } else if (type.equals(IRSEDOMConstants.TYPE_PROPERTY_SET)) { - restorePropertySet(profile, child); - } - } - } - return profile; - } - - /** - * Restores the host represented by hostNode - */ - public IHost restoreHost(ISystemProfile profile, RSEDOMNode hostNode) { - IHost host = null; - - // get host node attributes - String connectionName = hostNode.getName(); - String systemTypeName = getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_TYPE); - String systemTypeId = getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_SYSTEM_TYPE); - String hostName = getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_HOSTNAME); - String description = getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_DESCRIPTION); - boolean isOffline = getBooleanValue(getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_OFFLINE)); - boolean isPromptable = getBooleanValue(getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_PROMPTABLE)); - - // create host and set it's attributes - try { - // NOTE create host effectively recreates the subsystems - // so instead of creating subsystems on restore, we should be updating their properties - IRSECoreRegistry registry = RSECorePlugin.getTheCoreRegistry(); - IRSESystemType systemType = null; - if (systemTypeId != null) { - systemType = registry.getSystemTypeById(systemTypeId); - } else if (systemTypeName != null) { - systemType = registry.getSystemType(systemTypeName); - } - host = profile.createHost(systemType, connectionName, hostName, description); - host.setOffline(isOffline); - host.setPromptable(isPromptable); - } catch (Exception e) { - e.printStackTrace(); - } - - // restore children of host - RSEDOMNode[] children = hostNode.getChildren(); - for (int i = 0; i < children.length; i++) { - RSEDOMNode child = children[i]; - String type = child.getType(); - if (type.equals(IRSEDOMConstants.TYPE_CONNECTOR_SERVICE)) { - restoreConnectorService(host, child); - } else if (type.equals(IRSEDOMConstants.TYPE_PROPERTY_SET)) { - restorePropertySet(host, child); - } - } - return host; - } - - /** - * Restore the connector service represented by connectorServiceNode - */ - public IConnectorService restoreConnectorService(IHost host, RSEDOMNode connectorServiceNode) { - // TODO - this should come before subsystems - // but currently we're still using old way of creating subsystem first - IConnectorService service = null; - - // get attributes of the service - // String name = connectorServiceNode.getName(); - // String type = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); - // String group = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP).getValue(); - boolean useSSL = getBooleanValue(connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL).getValue()); - RSEDOMNodeAttribute att = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_PORT); - int port = 0; - if (att != null) { - port = getIntegerValue(att.getValue()); - } - - // first restore subsystems (since right now we need subsystem to get at service - RSEDOMNode[] ssChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_SUBSYSTEM); - for (int s = 0; s < ssChildren.length; s++) { - RSEDOMNode ssChild = ssChildren[s]; - ISubSystem subSystem = restoreSubSystem(host, ssChild); - if (subSystem != null && service == null) { - ISubSystemConfiguration subsystemConfiguration = subSystem.getSubSystemConfiguration(); - service = subsystemConfiguration.getConnectorService(host); - if (service != null) { - if (subsystemConfiguration.supportsServerLaunchProperties(host)) { - IServerLauncherProperties sl = subsystemConfiguration.createServerLauncher(service); - if (sl != null) { - // get server launcher properties - // right now we just set them for subsystem, but later that will change - RSEDOMNode serverLauncherPropertiesNode = null; - RSEDOMNode[] slChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_SERVER_LAUNCHER); - if (slChildren != null && slChildren.length > 0) { - serverLauncherPropertiesNode = slChildren[0]; - restoreServerLauncher(service, serverLauncherPropertiesNode, sl); - } - } - } - service.setPort(port); - service.setIsUsingSSL(useSSL); - } - } - if (service != null && subSystem != null) { - subSystem.setConnectorService(service); - } - } - - // restore all property sets - RSEDOMNode[] psChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET); - for (int p = 0; p < psChildren.length; p++) { - RSEDOMNode psChild = psChildren[p]; - restorePropertySet(service, psChild); - } - return service; - } - - public IServerLauncherProperties restoreServerLauncher(IConnectorService service, RSEDOMNode serverLauncherNode, IServerLauncherProperties sl) { - // restore all property sets - RSEDOMNode[] psChildren = serverLauncherNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET); - for (int p = 0; p < psChildren.length; p++) { - RSEDOMNode psChild = psChildren[p]; - restorePropertySet(sl, psChild); - } - sl.restoreFromProperties(); - service.setRemoteServerLauncherProperties(sl); - return sl; - } - - /** - * Restores the subsystem represented by subSystemNode - */ - public ISubSystem restoreSubSystem(IHost host, RSEDOMNode subSystemNode) { - // in most cases (if not all) the subsystem already exists - // since createHost() ends up recreating subsystems for each factory - String name = subSystemNode.getName(); - String type = subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); - boolean isHidden = getBooleanValue(subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN).getValue()); - ISubSystem subSystem = null; - ISubSystemConfiguration factory = getSubSystemConfiguration(type); - if (factory != null) { - if (factory instanceof IServiceSubSystemConfiguration) { - IServiceSubSystemConfiguration serviceFactory = (IServiceSubSystemConfiguration) factory; - ISubSystem[] existingSubSystems = _registry.getServiceSubSystems(host, serviceFactory.getServiceType()); - if (existingSubSystems != null && existingSubSystems.length > 0) { - subSystem = existingSubSystems[0]; - // need to switch factories - ((IServiceSubSystem) subSystem).switchServiceFactory(serviceFactory); - } - } else { - ISubSystemConfiguration config = _registry.getSubSystemConfiguration(type); - if (config!=null) { - ISubSystem[] existingSubSystems = config.getSubSystems(host, true); - if (existingSubSystems != null && existingSubSystems.length > 0) { - subSystem = existingSubSystems[0]; - } - } - } - - if (subSystem == null) { - // subSystem = factory.createSubSystemInternal(host); - ISubSystem[] createdSystems = _registry.createSubSystems(host, new ISubSystemConfiguration[]{factory}); - subSystem = createdSystems[0]; - } - subSystem.setHidden(isHidden); - subSystem.setHost(host); - subSystem.setSubSystemConfiguration(factory); - subSystem.setName(factory.getName()); - subSystem.setConfigurationId(factory.getId()); - - if (factory.supportsFilters()) { - ISystemFilterStartHere startHere = _registry.getSystemFilterStartHere(); - ISystemFilterPoolReferenceManager fprMgr = startHere.createSystemFilterPoolReferenceManager(subSystem, factory, name, new SubSystemFilterNamingPolicy()); - subSystem.setFilterPoolReferenceManager(fprMgr); - ISystemFilterPoolManager defaultFilterPoolManager = factory.getFilterPoolManager(host.getSystemProfile()); - fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); - } - - // restore filer pool references - RSEDOMNode[] filterPoolReferenceChildren = subSystemNode.getChildren(IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE); - for (int i = 0; i < filterPoolReferenceChildren.length; i++) { - RSEDOMNode fprChild = filterPoolReferenceChildren[i]; - restoreFilterPoolReference(subSystem, fprChild); - } - - // restore all property sets - RSEDOMNode[] psChildren = subSystemNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET); - for (int p = 0; p < psChildren.length; p++) { - RSEDOMNode psChild = psChildren[p]; - restorePropertySet(subSystem, psChild); - } - subSystem.wasRestored(); - } - return subSystem; - } - - /** - * Restore the filter - */ - public ISystemFilter restoreFilter(ISystemFilterPool filterPool, RSEDOMNode node) { - // get the node attributes for a filter - String name = node.getName(); - boolean supportsNestedFilters = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS).getValue()); - int relativeOrder = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELATIVE_ORDER).getValue()); - boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue()); - boolean isSetStringsCaseSensitive = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE).getValue()); - boolean isPromptable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE).getValue()); - boolean isSetSupportsDuplicateFilterStrings = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS).getValue()); - boolean isNonDeletable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_DELETABLE).getValue()); - boolean isNonRenamable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE).getValue()); - boolean isNonChangable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_CHANGEABLE).getValue()); - boolean isStringsNonChangable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRINGS_NON_CHANGABLE).getValue()); - int release = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE).getValue()); - boolean isSetSingleFilterStringOnly = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY).getValue()); - - Vector filterStrings = new Vector(); - - // create the filter strings - RSEDOMNode[] filterStringNodes = node.getChildren(IRSEDOMConstants.TYPE_FILTER_STRING); - for (int i = 0; i < filterStringNodes.length; i++) { - RSEDOMNode filterStringNode = filterStringNodes[i]; - - // might not have to restore the filter strings this way - //restoreFilterString(filter, filterStringNode); - - filterStrings.add(filterStringNode.getName()); - } - - // create the filter - ISystemFilter filter = filterPool.createSystemFilter(name, filterStrings); - filter.setSupportsNestedFilters(supportsNestedFilters); - filter.setRelativeOrder(relativeOrder); - filter.setDefault(isDefault); - filter.setStringsCaseSensitive(isSetStringsCaseSensitive); - filter.setPromptable(isPromptable); - filter.setSupportsDuplicateFilterStrings(isSetSupportsDuplicateFilterStrings); - filter.setNonDeletable(isNonDeletable); - filter.setNonChangable(isNonChangable); - filter.setNonRenamable(isNonRenamable); - filter.setStringsNonChangable(isStringsNonChangable); - filter.setRelease(release); - filter.setSingleFilterStringOnly(isSetSingleFilterStringOnly); - - // restore all property sets - RSEDOMNode[] psChildren = node.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET); - for (int p = 0; p < psChildren.length; p++) { - RSEDOMNode psChild = psChildren[p]; - restorePropertySet(filter, psChild); - } - return filter; - } - - /** - * Restore the filter pool represented by the node - */ - public ISystemFilterPool restoreFilterPool(ISystemProfile profile, RSEDOMNode node) { - ISystemFilterPool filterPool = null; - - // get the node attributes for a filter pool - String name = node.getName(); - String type = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); - String id = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_ID).getValue(); - boolean supportsNestedFilters = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS).getValue()); - boolean isDeletable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DELETABLE).getValue()); - boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue()); - boolean isSetStringsCaseSensitive = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE).getValue()); - boolean isSetSupportsDuplicateFilterStrings = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS).getValue()); - int release = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE).getValue()); - boolean isSetSingleFilterStringOnly = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY).getValue()); - String owningParentName = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME).getValue(); - boolean isNonRenamable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE).getValue()); - - // create the filter pool and set it's attributes - try { - ISubSystemConfiguration factory = getSubSystemConfiguration(id); - if (factory != null) { - ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile); - if (isDefault) { - filterPool = mgr.getFirstDefaultSystemFilterPool(); - } else { - filterPool = mgr.getSystemFilterPool(name); - } - if (filterPool == null) { - filterPool = mgr.createSystemFilterPool(name, isDeletable); -// filterPool = new SystemFilterPool(name, supportsNestedFilters, isDeletable); -// filterPool.setSystemFilterPoolManager(mgr); -// mgr.getPools().add(filterPool); - } - filterPool.setType(type); - filterPool.setDefault(isDefault); - filterPool.setSupportsNestedFilters(supportsNestedFilters); - filterPool.setStringsCaseSensitive(isSetStringsCaseSensitive); - filterPool.setSupportsDuplicateFilterStrings(isSetSupportsDuplicateFilterStrings); - filterPool.setRelease(release); - filterPool.setSingleFilterStringOnly(isSetSingleFilterStringOnly); - filterPool.setOwningParentName(owningParentName); - filterPool.setNonRenamable(isNonRenamable); -// filterPool.wasRestored(); - } - } catch (Exception e) { - e.printStackTrace(); - } - - // restore children - RSEDOMNode[] children = node.getChildren(); - for (int i = 0; i < children.length; i++) { - RSEDOMNode child = children[i]; - String ctype = child.getType(); - if (ctype.equals(IRSEDOMConstants.TYPE_FILTER)) { - if (filterPool != null) { - restoreFilter(filterPool, child); - } - } else if (ctype.equals(IRSEDOMConstants.TYPE_PROPERTY_SET)) { - restorePropertySet(filterPool, child); - } - } - return filterPool; - } - - /** - * Restore the filter pool reference that is represented by the node - */ - public ISystemFilterPoolReference restoreFilterPoolReference(ISubSystem subsystem, RSEDOMNode node) { - ISystemFilterPoolReference filterPoolReference = null; - String filterPoolName = node.getName(); - String[] part = filterPoolName.split("___", 2); //$NON-NLS-1$ - if (part.length == 1) { // name is unqualified and refers to a filter pool in the current profile, ensure it is qualified - ISystemProfile profile = subsystem.getSystemProfile(); - String profileName = profile.getName(); - filterPoolName = profileName + "___" + filterPoolName; //$NON-NLS-1$ - } - ISystemFilterPoolReferenceManager referenceManager = subsystem.getFilterPoolReferenceManager(); - filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPoolName); - return filterPoolReference; - } - - public ISystemFilterString restoreFilterString(ISystemFilter filter, RSEDOMNode node) { - /* - String string = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING).getValue(); - String type = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); - boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue()); - - SystemFilterString filterString = filter - */ - return null;//not sure if we need this - } - - /** - * Restores the property set represented by propertySetNode - */ - public IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode) { - String name = propertySetNode.getName(); - IPropertySet set = modelObject.createPropertySet(name); - // properties used to be stored as attributes, get those first for compatibility - RSEDOMNodeAttribute[] attributes = propertySetNode.getAttributes(); - for (int i = 0; i < attributes.length; i++) { - RSEDOMNodeAttribute attribute = attributes[i]; - if (attribute.getKey().equals(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION)) { // descriptions really are stored as attributes - set.setDescription(attribute.getValue()); - } else { - String typeStr = attribute.getType(); - IPropertyType type = PropertyType.fromString(typeStr); - set.addProperty(attribute.getKey(), attribute.getValue(), type); - } - } - // properties are now stored as children, get those next - RSEDOMNode[] children = propertySetNode.getChildren(); - for (int i = 0; i < children.length; i++) { - RSEDOMNode child = children[i]; - String propertyName = child.getName(); - String propertyValue = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE).getValue(); - String propertyTypeName = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); - IPropertyType propertyType = PropertyType.fromString(propertyTypeName); - if (propertyName.equals(IPropertySet.DESCRIPTION_KEY)) { // any descriptions found as properties should be set directly - set.setDescription(propertyValue); - } else { - set.addProperty(propertyName, propertyValue, propertyType); - } - } - return set; - } - - private boolean getBooleanValue(String booleanStr) { - return ((booleanStr != null) && booleanStr.equalsIgnoreCase(IRSEDOMConstants.ATTRIBUTE_TRUE)); - } - - private int getIntegerValue(String integerString) { - int result = 0; - if (integerString != null) { - try { - result = Integer.parseInt(integerString); - } catch (NumberFormatException e) { - } - } - return result; - } - - /** - * Returns the subsystem configuration for a given subsystem name - * @param subsystemName the name to look up - * @return the subsystem configuration matching the name - */ - private ISubSystemConfiguration getSubSystemConfiguration(String subsystemName) { - return _registry.getSubSystemConfiguration(subsystemName); - } - - private String getAttributeValue(RSEDOMNode node, String attributeName) { - String result = null; - RSEDOMNodeAttribute attribute = node.getAttribute(attributeName); - if (attribute != null) { - result = attribute.getValue(); - } - return result; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java deleted file mode 100644 index d61a4eb4d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java +++ /dev/null @@ -1,447 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.references; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager; -import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject; -import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject; - -/** - * <b>YOU MUST OVERRIDE resolveReferencesAfterRestore() IN THIS CLASS!</b> - * <p> - * <b>YOU MUST OVERRIDE getReferenceName() IN SYSTEMPERSISTABLEREFERENCEDOBJECT!</b> - * <p> - * @see org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager - * - * @lastgen class SystemPersistableReferenceManagerImpl Impl implements SystemPersistableReferenceManager, EObject {} - */ -public class SystemPersistableReferenceManager implements IRSEBasePersistableReferenceManager { - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - private IRSEBasePersistableReferencingObject[] listAsArray = null; - public static boolean debug = true; - public static HashMap EMPTY_MAP = new HashMap(); - - /** - * @generated This field/method will be replaced during code generation. - */ - protected String name = NAME_EDEFAULT; - /** - * @generated This field/method will be replaced during code generation. - */ - protected List referencingObjectList = null; - - /** - * Constructor. Typically called by EMF framework via factory create method. - */ - protected SystemPersistableReferenceManager() { - super(); - } - - /** - * Internal method to get the mof List that is the current list. - */ - protected List internalGetList() { - return getReferencingObjectList(); - } - - /** - * Internal method to invalidate any cached info. - * Must be called religiously by any method affecting list. - */ - protected void invalidateCache() { - listAsArray = null; - } - - /** - * Return an array of the referencing objects currently being managed. - * @return array of the referencing objects currently in this list. - */ - public IRSEBasePersistableReferencingObject[] getReferencingObjects() { - if ((listAsArray == null) || (listAsArray.length != internalGetList().size())) { - List list = internalGetList(); - listAsArray = new IRSEBasePersistableReferencingObject[list.size()]; - Iterator i = list.iterator(); - int idx = 0; - while (i.hasNext()) { - listAsArray[idx++] = (IRSEBasePersistableReferencingObject) i.next(); - } - } - return listAsArray; - } - - /** - * Set in one shot the list of referencing objects. Replaces current list. - * @param objects An array of referencing objects which is to become the new list. - * @param deReference true to first de-reference all objects in the existing list. - */ - public void setReferencingObjects(IRSEBasePersistableReferencingObject[] objects, boolean deReference) { - listAsArray = objects; - if (deReference) - removeAndDeReferenceAllReferencingObjects(); - else - removeAllReferencingObjects(); - List list = internalGetList(); - for (int idx = 0; idx < objects.length; idx++) - list.add(objects[idx]); - } - - /* - * DWD this should probably operate on IRSEPersistableReferencingObject - * instead and call setParentManager. This involves recasting this class to - * implement a new type or changing IRSEBasePersistableReferenceManager to - * deal with parent references - probably changing its name in the process. - * We could collapse IRSEBasePersistableReferencingObject and its subinterface - * into one interface. - */ - /** - * Add a referencing object to the managed list. - * @return new count of referenced objects being managed. - */ - public int addReferencingObject(IRSEBasePersistableReferencingObject object) { - List list = internalGetList(); - list.add(object); - invalidateCache(); - return getReferencingObjectCount(); - } - - /** - * Remove a referencing object from the managed list. - * <p>Does NOT call removeReference on the master referenced object. - * @return new count of referenced objects being managed. - */ - public int removeReferencingObject(IRSEBasePersistableReferencingObject object) { - List list = internalGetList(); - list.remove(object); - invalidateCache(); - return getReferencingObjectCount(); - } - - /** - * Remove and dereferences a referencing object from the managed list. - * <p>DOES call removeReference on the master referenced object. - * @return new count of referenced objects being managed. - */ - public int removeAndDeReferenceReferencingObject(IRSEBasePersistableReferencingObject object) { - object.removeReference(); - return removeReferencingObject(object); - } - - /** - * Remove all objects from the list. - * <p>Does NOT call removeReference on the master referenced objects. - */ - public void removeAllReferencingObjects() { - internalGetList().clear(); - } - - /** - * Remove and dereference all objects from the list. - * <p>DOES call removeReference on the master referenced objects. - */ - public void removeAndDeReferenceAllReferencingObjects() { - IRSEBasePersistableReferencingObject[] objs = getReferencingObjects(); - for (int idx = 0; idx < objs.length; idx++) { - objs[idx].removeReference(); - } - removeAllReferencingObjects(); - } - - /** - * Return how many referencing objects are currently in the list. - * @return current count of referenced objects being managed. - */ - public int getReferencingObjectCount() { - return internalGetList().size(); - } - - /** - * Return the zero-based position of the given referencing object within the list. - * Does a memory address comparison (==) to find the object. - * @param object The referencing object to find position of. - * @return zero-based position within the list. If not found, returns -1 - */ - public int getReferencingObjectPosition(IRSEBasePersistableReferencingObject object) { - List list = internalGetList(); - int position = -1; - boolean match = false; - - Iterator i = list.iterator(); - int idx = 0; - - while (!match && i.hasNext()) { - IRSEBasePersistableReferencingObject curr = (IRSEBasePersistableReferencingObject) i.next(); - if (curr == object) { - match = true; - position = idx; - } else - idx++; - } - return position; - } - - /** - * Move the given referencing object to a new zero-based position in the list. - * @param newPosition New zero-based position - * @param object The referencing object to move - */ - public void moveReferencingObjectPosition(int newPosition, IRSEBasePersistableReferencingObject object) { - // List list = internalGetList(); - //FIXME list.move(newPosition, object); - } - - /** - * Return true if the given referencable object is indeed referenced by a referencing object - * in the current list. This is done by comparing the reference names of each, not the - * in-memory pointers. - * @param object The referencable object to which to search for a referencing object within this list - * @return true if found in list, false otherwise. - */ - public boolean isReferenced(IRSEBasePersistableReferencedObject object) { - return (getReferencedObject(object) != null); - } - - /** - * Search list of referencing objects to see if one of them references the given referencable object. - * This is done by comparing the reference names of each, not the in-memory pointers. - * @param object The referencable object to which to search for a referencing object within this list - * @return the referencing object within this list which references the given referencable object, or - * null if no reference found. - */ - public IRSEBasePersistableReferencingObject getReferencedObject(IRSEBasePersistableReferencedObject object) { - List list = internalGetList(); - IRSEBasePersistableReferencingObject match = null; - Iterator i = list.iterator(); - int idx = 0; - - while ((match == null) && i.hasNext()) { - IRSEBasePersistableReferencingObject curr = (IRSEBasePersistableReferencingObject) i.next(); - if (curr.getReferencedObjectName().equals(object.getReferenceName())) { - match = curr; - } else - idx++; - } - return match; - } - - /** - * Return string identifying this filter - */ - public String toString() { - return getName(); - } - - // --------------------------------------------------------------------------- - // Methods for saving and restoring if not doing your own in your own subclass - // --------------------------------------------------------------------------- - - /** - * <b>YOU MUST OVERRIDE THIS METHOD!</b> - * <p> - * After restoring this from disk, there is only the referenced object name, - * not the referenced object pointer, for each referencing object. - * <p> - * This method is called after restore and for each restored object in the list must: - * <ol> - * <li>Do what is necessary to find the referenced object, and set the internal reference pointer. - * <li>Call addReference(this) on that object so it can maintain it's in-memory list - * of all referencing objects. - * </ol> - * @return true if resolved successfully. False if some references were not found and - * hence those referencing objects removed from the restored list. - */ - public boolean resolveReferencesAfterRestore() { - return false; - } - - /** - * Attempt to save contents of manager to disk. Only call if not doing your own save from - * your own model that uses a subclass of this. - * @param folder The folder in which to save the manager. - * @param fileName The unqualified file name to save to. Should include extension, such as .xmi - */ - public void save(IFolder folder, String fileName) throws Exception { - /* FIXME - initMOF(); - String path = folder.getLocation().toOSString(); - String saveFileName = addPathTerminator(path)+fileName; - File saveFile = new File(saveFileName); - boolean exists = saveFile.exists(); - saveFileName = saveFile.toURL().toString(); - Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; - - Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFileName)); - //java.util.List ext = resFactory.createExtent(); // MOF way - //ext.add(this); // MOF way - Resource mofRes = resFactory.createResource(URI.createURI(saveFileName)); - mofRes.getContents().add(this); - try - { - mofRes.save(EMPTY_MAP); - } catch (Exception e) - { - if (debug) - { - System.out.println("Error saving SystemPersistableReferenceManager "+getName() + " to "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(); - } - throw e; - } - - // if this is the first time we have created this file, we must update Eclipse - // resource tree to know about it... - if (!exists || !folder.exists()) - { - try - { - //RSEUIPlugin.logWarning("Calling refreshLocal on project after saving MOF file: " + saveFileName); - folder.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); - } catch(Exception exc) - { - System.out.println("Exception doing refreshLocal on project: " + exc.getClass().getName()); - } - } - else - { - try - { - //RSEUIPlugin.logWarning("Calling refreshLocal on project after saving MOF file: " + saveFileName); - folder.refreshLocal(IResource.DEPTH_ONE, null); - } catch(Exception exc) - { - System.out.println("Exception doing refreshLocal on project: " + exc.getClass().getName()); - } - } - */ - } - - /** - * Restore a persisted manager from disk. - * <p> - * After restoration, YOU MUST CALL {@link #resolveReferencesAfterRestore() resolveReferencesAfterRestore} - * This presumes yours subclass has overridden that method! - * <p> - * @param folder The folder in which the saved manager exists. - * @param fileName The unqualified save file name including extension such as .xmi - * @return The restored object, or null if given file not found. Any other error gives an exception. - */ - public static IRSEBasePersistableReferenceManager restore(IFolder folder, String fileName) throws Exception { - IRSEBasePersistableReferenceManager mgr = new SystemPersistableReferenceManager(); - /*FIXME - initMOF(); - Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; - String path = folder.getLocation().toOSString(); - String saveFile = addPathTerminator(path)+fileName; - //ResourceSet resourceSet = // MOF way - // Resource.Factory.Registry.getResourceSetFactory().makeResourceSet(); - Resource res1 = null; - try - { - // res1 = resourceSet.load(saveFile); MOF way - Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFile)); - res1 = resFactory.createResource(URI.createURI(saveFile)); - res1.load(EMPTY_MAP); - } - catch (java.io.FileNotFoundException e) - { - if (debug) - System.out.println("SystemPersistableReferenceManager file not found: "+saveFile); - return null; - } - catch (Exception e) - { - if (debug) - { - System.out.println("Error loading SystemPersistableReferenceManager from file: "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(); - } - throw e; - } - - java.util.List ext1 = res1.getContents(); - - // should be exactly one... - Iterator iList = ext1.iterator(); - mgr = (SystemPersistableReferenceManager)iList.next(); - - if (debug) - System.out.println("Ok. SystemPersistableReferenceManager "+mgr.getName()+" restored successfully."); - */ - return mgr; - } - - /** - * Ensure given path ends with path separator. - */ - public static String addPathTerminator(String path) { - if (!path.endsWith(File.separator)) path = path + File.separatorChar; - //else - // path = path; - return path; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public String getName() { - return name; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setName(String newName) { - name = newName; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public List getReferencingObjectList() { - if (referencingObjectList == null) { - referencingObjectList = new ArrayList(); - //FIXME new EObjectContainmentWithInversejava.util.List(SystemPersistableReferencingObject.class, this, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCE_MANAGER__REFERENCING_OBJECT_LIST, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER); - } - return referencingObjectList; - } - - //FIXME obsolete? - public String toStringGen() { - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(')'); - return result.toString(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencedObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencedObject.java deleted file mode 100644 index 9c9d20910..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencedObject.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.references; - -import org.eclipse.rse.core.references.IRSEPersistableReferencedObject; - -/** - * @see org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager - */ -public abstract class SystemPersistableReferencedObject extends SystemReferencedObject implements IRSEPersistableReferencedObject { - /** - * Constructor. - */ - public SystemPersistableReferencedObject() { - super(); - } - - /** - * Return the unique reference name of this object. - * <p> - * As required by the {@link org.eclipse.rse.core.references.IRSEPersistableReferencedObject} - * interface. - * <p> - * YOUR SUBCLASS MUST OVERRIDE THIS! - */ - public String getReferenceName() { - return null; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencedObjectHelper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencedObjectHelper.java deleted file mode 100644 index 1dcac3cfe..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencedObjectHelper.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.references; - -import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject; - -/** - * This class extends the support for a class that supports being managing by a transient - * in-memory reference to one which also supports the persistence of such references. - * To do this, such a referencable class must be able to return a name that is - * so unique that it can be used after restoration from disk to resolve a pointer to this - * specific object, in memory. - */ -public class SystemPersistableReferencedObjectHelper extends SystemReferencedObjectHelper implements IRSEBasePersistableReferencedObject { - - private String referenceName; - - /** - * Constructor for SystemPersistableReferencedObjectHelper - * @param parent the SystemPersistableReferencedObject that uses this helper. - * @param referenceName The unique name that can be stored to identify this object. - */ - protected SystemPersistableReferencedObjectHelper(IRSEBasePersistableReferencedObject parent, String referenceName) { - super(parent); - setReferenceName(referenceName); - } - - /** - * @return the unique reference name of this object, as set in the constructor - */ - public String getReferenceName() { - return referenceName; - } - - /** - * Set the unique reference name of this object. Overrides what was set in - * the constructor. Typically called on rename operation. - * @param name the name of this particular reference. - */ - public void setReferenceName(String name) { - this.referenceName = name; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencingObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencingObject.java deleted file mode 100644 index 7ff4b0169..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencingObject.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.references; - -import org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager; -import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject; -import org.eclipse.rse.core.references.IRSEPersistableReferencingObject; - -/** - * This class represents an object that references another object in the model. - * The reference is persistable. - * <p> - * @see org.eclipse.rse.core.references.IRSEPersistableReferencingObject - */ -// DWD Change this name to SystemPersistableReference? Ditto for the interface. -public abstract class SystemPersistableReferencingObject extends SystemReferencingObject implements IRSEPersistableReferencingObject { - - protected String referencedObjectName = null; - protected IRSEBasePersistableReferenceManager _referenceManager; - - /** - * Create a new referencing object. - */ - protected SystemPersistableReferencingObject() { - super(); - } - - /** - * Set the persistable referenced object name - */ - public void setReferencedObjectName(String newReferencedObjectName) { - referencedObjectName = newReferencedObjectName; - } - - /** - * Set the in-memory reference to the master object. - * This implementation also extracts that master object's name and calls - * setReferencedObjectName as part of this method call. - * @see org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject#setReferencedObject(IRSEBasePersistableReferencedObject) - */ - public void setReferencedObject(IRSEBasePersistableReferencedObject obj) { - getHelper().setReferencedObject(obj); - setReferencedObjectName(obj.getReferenceName()); - } - - /** - * Get the persistable referenced object name. - */ - public String getReferencedObjectName() { - return referencedObjectName; - } - - /** - * @return The reference manager for this reference. - */ - public IRSEBasePersistableReferenceManager getParentReferenceManager() { - return _referenceManager; - } - - /** - * Sets the reference manager for this reference. Must be done when this reference is created. - */ - public void setParentReferenceManager(IRSEBasePersistableReferenceManager newParentReferenceManager) { - _referenceManager = newParentReferenceManager; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (referencedObjectName: "); //$NON-NLS-1$ - result.append(referencedObjectName); - result.append(')'); - return result.toString(); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencingObjectHelper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencingObjectHelper.java deleted file mode 100644 index cb7eccac4..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferencingObjectHelper.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.references; - -import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject; -import org.eclipse.rse.core.references.IRSEBaseReferencingObject; - -/** - * This class extends the support for managing a transient in-memory reference - * to include support for storing a persistable name that uniquely identifies that - * object. - */ -public class SystemPersistableReferencingObjectHelper extends SystemReferencingObjectHelper -//implements IRSEPersistableReferencingObject -{ - private String masterObjectName = null; - - /** - * Default constructor. - */ - protected SystemPersistableReferencingObjectHelper(IRSEBaseReferencingObject caller) { - super(caller); - } - - /** - * Constructor that saves effort of calling setReferencedObject. - */ - public SystemPersistableReferencingObjectHelper(IRSEBaseReferencingObject caller, IRSEBasePersistableReferencedObject obj) { - this(caller); - setReferencedObject(obj); - } - - /** - * Set the object to which we reference. This overload takes an - * IRSEPersistableReferencedObject so we can query its name for - * storage purposes. - */ - public void setReferencedObject(IRSEBasePersistableReferencedObject obj) { - super.setReferencedObject(obj); - this.masterObjectName = obj.getReferenceName(); - } - - /** - * Return the name uniquely identifying the object we are referencing. - */ - public String getReferencedObjectName() { - return masterObjectName; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencedObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencedObject.java deleted file mode 100644 index 11817097a..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencedObject.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. 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.references; - -import org.eclipse.rse.core.model.RSEModelObject; -import org.eclipse.rse.core.references.IRSEBaseReferencingObject; -import org.eclipse.rse.core.references.IRSEReferencedObject; - -/** - * A class to encapsulate the operations required of an object which - * supports references to it by other objects (SystemReferencingObject). - * This type of class needs to support maintaining an in-memory list of - * all who reference it so that list can be following on delete and - * rename operations. - * <p> - * These references are not persistent. Persistent references are managed - * by the subclass SystemPersistableReferencedObject. - * <p> - * SystemFilter is a known concrete subclass. - */ -public abstract class SystemReferencedObject extends RSEModelObject implements IRSEReferencedObject { - - protected SystemReferencedObjectHelper helper = null; - - /** - * Default constructor. Typically called by EMF factory method. - */ - protected SystemReferencedObject() { - helper = new SystemReferencedObjectHelper(this); - } - - // ---------------------------------- - // IRSEReferencedObject methods... - // ---------------------------------- - /** - * Add a reference, increment reference count, return new count - * @param ref the referencing object - * @return new count of how many referencing objects reference this object. - */ - public int addReference(IRSEBaseReferencingObject ref) { - return helper.addReference(ref); - } - - /** - * Remove a reference, decrement reference count, return new count - * @param ref the referencing object - * @return new count of how many referencing objects reference this object. - */ - public int removeReference(IRSEBaseReferencingObject ref) { - return helper.removeReference(ref); - } - - /** - * @return a count of how many referencing objects reference this object. - */ - public int getReferenceCount() { - return helper.getReferenceCount(); - } - - /** - * Clear the list of referenced objects. - */ - public void removeAllReferences() { - helper.removeAllReferences(); - } - - /** - * @return a list of all referencing objects of this object - */ - public IRSEBaseReferencingObject[] getReferencingObjects() { - return helper.getReferencingObjects(); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencedObjectHelper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencedObjectHelper.java deleted file mode 100644 index d87fcb7b8..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencedObjectHelper.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.references; - -import java.util.Vector; - -import org.eclipse.rse.core.references.IRSEBaseReferencedObject; -import org.eclipse.rse.core.references.IRSEBaseReferencingObject; - -/** - * This is a class that implements all the methods in the IRSEReferencedObject. - * It makes implementing this interface trivial. - * The easiest use of this class is to subclass it, but since that is not - * always possible, it is not abstract and hence can be leveraged via containment. - */ -public class SystemReferencedObjectHelper implements IRSEBaseReferencedObject { - - private Vector referencingObjects = new Vector(); - - // private IRSEBaseReferencedObject parent = null; - - /** - * Constructor for SystemReferencedObjectHelper - * @param parent the SystemReferencedObject creating this helper - */ - public SystemReferencedObjectHelper(IRSEBaseReferencedObject parent) { - // this.parent = parent; - } - - /** - * @see IRSEBaseReferencedObject#addReference(IRSEBaseReferencingObject) - */ - public int addReference(IRSEBaseReferencingObject ref) { - // String fromName = getReferencingName(ref); - // String toName = getReferencedName(); - // System.out.println(MessageFormat.format("Adding reference from {0} to {1}", new Object[] {fromName, toName})); - referencingObjects.addElement(ref); - return referencingObjects.size(); - } - - // private String getReferencedName() { - // String toName = "unknown"; //$NON-NLS-1$ - // if (parent instanceof ISystemFilterPool) { - // ISystemFilterPool fp = (ISystemFilterPool) parent; - // toName = fp.getName(); - // } - // return toName; - // } - - // private String getReferencingName(IRSEBaseReferencingObject object) { - // String fromName = "unknown"; //$NON-NLS-1$ - // if (object instanceof ISystemFilterPoolReference) { - // ISystemFilterPoolReference fpr = (ISystemFilterPoolReference) object; - // ISystemFilterPoolReferenceManagerProvider provider = fpr.getProvider(); - // String prefix = "unknown|unknown|unknown"; //$NON-NLS-1$ - // if (provider instanceof ISubSystem) { - // ISubSystem subsystem = (ISubSystem) provider; - // IHost host = subsystem.getHost(); - // prefix = host.getAliasName() + "|" + subsystem.getName(); //$NON-NLS-1$ - // fromName = prefix + fpr.getName(); - // } - // } - // return fromName; - // } - - /** - * @see IRSEBaseReferencedObject#removeReference(IRSEBaseReferencingObject) - */ - public int removeReference(IRSEBaseReferencingObject ref) { - // String fromName = getReferencingName(ref); - // String toName = getReferencedName(); - // System.out.println(MessageFormat.format("Removing reference from {0} to {1}", new Object[] {fromName, toName})); - boolean found = referencingObjects.removeElement(ref); - assertThis(!found, "removeReference failed for " + ref); //$NON-NLS-1$ - return referencingObjects.size(); - } - - /** - * @see IRSEBaseReferencedObject#getReferenceCount() - */ - public int getReferenceCount() { - return referencingObjects.size(); - } - - /** - * Clear the list of referenced objects. - */ - public void removeAllReferences() { - IRSEBaseReferencingObject[] references = getReferencingObjects(); - for (int i = 0; i < references.length; i++) { - IRSEBaseReferencingObject reference = references[i]; - removeReference(reference); - } - // referencingObjects.removeAllElements(); - } - - /** - * @see IRSEBaseReferencedObject#getReferencingObjects() - */ - public IRSEBaseReferencingObject[] getReferencingObjects() { - IRSEBaseReferencingObject[] references = new IRSEBaseReferencingObject[referencingObjects.size()]; - referencingObjects.toArray(references); - return references; - } - - /** - * Assertion method for debugging purposes. All instances of assertion failure should be removed by - * release. - * @param assertion a boolean (usually an expression) that is to be tested - * @param msg the message printed on System.out - */ - protected void assertThis(boolean assertion, String msg) { - // if (!assertion) System.out.println("ASSERTION FAILED IN SystemReferencedObject: " + msg); //$NON-NLS-1$ - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObject.java deleted file mode 100644 index fe673349d..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObject.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [184095] Replace systemTypeName by IRSESystemType - ********************************************************************************/ - -package org.eclipse.rse.internal.references; - -import org.eclipse.rse.core.model.RSEModelObject; -import org.eclipse.rse.core.references.IRSEBaseReferencedObject; -import org.eclipse.rse.core.references.IRSEReferencingObject; -import org.eclipse.rse.internal.core.RSECoreMessages; - -/** - * A class to encapsulate the operations required of an object which - * is merely a reference to another object, something we call a shadow. - * Such shadows are needed to support a GUI which displays the same - * object in multiple places. To enable that, it is necessary not to - * use the same physical object in each UI representation as the UI - * will only know how to update/refresh the first one it finds. - * <p> - * These references are not persistent. Persistent references are managed - * by the subclass SystemPersistableReferencingObject. - */ -public abstract class SystemReferencingObject extends RSEModelObject implements IRSEReferencingObject { - private SystemReferencingObjectHelper helper = null; - protected boolean referenceBroken = false; - - /** - * Default constructor. - */ - protected SystemReferencingObject() { - super(); - helper = new SystemReferencingObjectHelper(this); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#setReferencedObject(org.eclipse.rse.core.references.IRSEBaseReferencedObject) - */ - public void setReferencedObject(IRSEBaseReferencedObject obj) { - helper.setReferencedObject(obj); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#getReferencedObject() - */ - public IRSEBaseReferencedObject getReferencedObject() { - return helper.getReferencedObject(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#removeReference() - */ - public int removeReference() { - return helper.removeReference(); - } - - /** - * Set to true if this reference is currently broken/unresolved - */ - public void setReferenceBroken(boolean broken) { - referenceBroken = broken; - } - - /** - * Return true if this reference is currently broken/unresolved - */ - public boolean isReferenceBroken() { - return referenceBroken; - } - - public String getDescription() { - return RSECoreMessages.RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION; - } - - protected final SystemReferencingObjectHelper getHelper() { - return helper; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java deleted file mode 100644 index 4ac567070..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.references; - -import org.eclipse.rse.core.references.IRSEBaseReferencedObject; -import org.eclipse.rse.core.references.IRSEBaseReferencingObject; - -/** - * This is a class that implements all the methods in the IRSEReferencingObject. - * It makes implementing this interface trivial. - * The easiest use of this class is to subclass it, but since that is not - * always possible, it is not abstract and hence can be leveraged via containment. - */ -public class SystemReferencingObjectHelper { - - private IRSEBaseReferencedObject masterObject = null; - private IRSEBaseReferencingObject caller = null; - - /** - * Default constructor. - * @param caller the reference that this object is helping. - */ - public SystemReferencingObjectHelper(IRSEBaseReferencingObject caller) { - super(); - this.caller = caller; - } - - /** - * Constructor that saves effort of calling setReferencedObject. - * @param caller the reference that this object is helping. - * @param obj the object to which this reference will point. - */ - public SystemReferencingObjectHelper(IRSEBaseReferencingObject caller, IRSEBaseReferencedObject obj) { - this(caller); - setReferencedObject(obj); - } - - /** - * Set the object to which this reference will point. - * Stores the reference in memory, replacing whatever was there. - * Also calls obj.addReference(caller); - * @param obj the object to which this reference will point. - */ - public void setReferencedObject(IRSEBaseReferencedObject obj) { - this.masterObject = obj; - if (obj != null) obj.addReference(caller); - } - - /** - * Get the object which is referenced. May be null if the reference is not set or has not been resolved. - * @return the referenced object. - */ - public IRSEBaseReferencedObject getReferencedObject() { - return masterObject; - } - - /** - * Removes this reference from the referenced object and clears this reference. - * Also, nulls out our memory reference. - * @return new reference count of master object - */ - public int removeReference() { - int newCount = 0; - IRSEBaseReferencedObject masterObject = getReferencedObject(); - if (masterObject != null) newCount = masterObject.removeReference(caller); - masterObject = null; - return newCount; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/logging/Logger.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/logging/Logger.java deleted file mode 100644 index 38fd59cef..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/logging/Logger.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.logging; - -import org.eclipse.core.runtime.ILog; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; -import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; -import org.eclipse.rse.internal.logging.LogListener; - -/** - * Generic Logger class for handling Remote Systems logging and tracing.<br> - * <br> - * The debug level is determined by a "debug_level" key in the preferences store - * of the plugin that owns this Logger instance.<br> - * <br> - * The debug location is determined by a "log_location" key in the preferences store - * of the plugin that owns this Logger instance.<br> - * <br> - * The valid values for these keys can be found in the javadocs for IRemoteSystemsLogging.<br>. - * This means that these keys could have been defined through hardcoding in your - * plugin startup code, through preferences.ini in the plugin install directory, - * OR from pref_store.ini in the plugin read/write metadata area. <br> - * The default behavior is to log to file, and to log only errors. - * <br> - * A typical usage of this class is as follows: <br> - * <br> - * public class myPlugin extends AbstractUIPlugin { <br> - * <br> - * // a cached Logger inst for convenience.<br> - * public static Logger out = null;<br> - * <br> - * public myPlugin(IPluginDescriptor descriptor) { <br> - * super(descriptor);<br> - * ......<br> - * ......<br> - * out = LoggerFactory.getInst(this);<br> - * out.logInfo("loading myPlugin class.");<br> - * //out.logWarning("This is a warning message.");<br> - * //out.logError("This is an error.", new Exception());<br> - * //out.logDebugMessage(<br> - * // "myPlugin",<br> - * // "this is a debug message from class myPlugin.");<br> - * ......<br> - * ......<br> - * }<br> - * <br> - * <br> - * public void shutdown() throws CoreException {<br> - * super.shutdown();<br> - * LoggerFactory.freeInst(this);<br> - * }<br> - * <br> - * - */ -public class Logger implements IPropertyChangeListener { - - /** - * Constant can be used to surround debugging code. Optimizing - * compilers have the possibility of removing the code from - * a production copy. - * - * Should be set false normally. Only set to true when testing. - */ - public static final boolean DEBUG = false; - - /** - * Name of the key that controls the logging level.<br> - * (value is "debug_level"). - */ - public static final String LOGGING_LEVEL = "logging_level"; //$NON-NLS-1$ - /** - * Set debug_level to this value to get Error messages.<br> - * (value is 0). - */ - public static final int LOG_ERROR = 0; - /** - * Set debug_level to this value to get Warning messages.<br> - * (value is 1). - */ - public static final int LOG_WARNING = 1; - /** - * Set debug_level to this value to get Information messages.<br> - * (value is 2). - */ - public static final int LOG_INFO = 2; - /** - * Set debug_level to this value to get Debug messages.<br> - * (value is 3). - */ - public static final int LOG_DEBUG = 3; - - private ILog systemsPluginLog = null; - - private LogListener logListener = null; - - private String pluginId = null; - - private Plugin systemPlugin = null; - - private int debug_level = Logger.LOG_ERROR; - - /** - * Creates a new Logger. Invoked by the LoggerFactory. - * @param systemPlugin The preferences for this plugin will determine the detail - * logged by this logger. This allows different levels of detail to be logged in the - * workbench. - * @see LoggerFactory#getLogger(Plugin) - */ - Logger(Plugin systemPlugin) { - this.systemPlugin = systemPlugin; - this.pluginId = systemPlugin.getBundle().getSymbolicName(); - initialize(); - } - - public synchronized void freeResources() { - logListener.freeResources(); - } - - public synchronized int getDebugLevel() { - return debug_level; - } - - /** - * Log a Debug message. This is intended to be used as follows:<br> - * Logger.logDebugMessage("someClassName", "someMessage");<br> - * <br> - * and the output will be:<br> - * <br> - * ---------------------------------------------------------------<br> - * DEBUG org.eclipse.rse.logging someClassName<br> - * someMessage<br> - * ---------------------------------------------------------------<br> - * <br> - * <br> - * Note that since this message is only for developer debugging, it does not - * need to be localized to proper local.<br> - */ - public synchronized void logDebugMessage(String className, String message) { - if (Logger.DEBUG && debug_level >= Logger.LOG_DEBUG) { - MultiStatus debugStatus = new MultiStatus(pluginId, IStatus.OK, className, null); - Status infoStatus = new Status(IStatus.OK, pluginId, IStatus.OK, message, null); - debugStatus.add(infoStatus); - systemsPluginLog.log(debugStatus); - } - } - - /** - * Log an Error message with an exception. Note that the message should already - * be localized to proper locale. - * @param message the message to log. - * @param ex the exception that caused the condition, may be null. - */ - public synchronized void logError(String message, Throwable ex) { - if (debug_level >= Logger.LOG_ERROR) { - if (message == null) message = ""; //$NON-NLS-1$ - Status errorStatus = new Status(IStatus.ERROR, pluginId, IStatus.OK, message, ex); - systemsPluginLog.log(errorStatus); - } - } - - /** - * Log an Information message. Note that the message should already - * be localized to proper local.<br> - * ie: Resource.getString() should already have been called - */ - public synchronized void logInfo(String message) { - logInfo(message, null); - } - - /** - * Log an Information message. Note that the message should already - * be localized to proper local.<br> - * ie: Resource.getString() should already have been called - */ - public synchronized void logInfo(String message, Throwable ex) { - if (debug_level >= Logger.LOG_INFO) { - if (message == null) message = ""; //$NON-NLS-1$ - Status infoStatus = new Status(IStatus.INFO, pluginId, IStatus.OK, message, ex); - systemsPluginLog.log(infoStatus); - } - } - - /** - * Log a Warning message. Note that the message should already - * be localized to proper local.<br> - * ie: Resource.getString() should already have been called - */ - public synchronized void logWarning(String message) { - logWarning(message, null); - } - - /** - * Log a Warning message. Note that the message should already - * be localized to proper local.<br> - * ie: Resource.getString() should already have been called - */ - public synchronized void logWarning(String message, Throwable ex) { - if (debug_level >= Logger.LOG_WARNING) { - if (message == null) message = ""; //$NON-NLS-1$ - Status warningStatus = new Status(IStatus.WARNING, pluginId, IStatus.OK, message, ex); - systemsPluginLog.log(warningStatus); - } - } - - /** - * Handle changes from a Preferences page. - */ - public synchronized void propertyChange(PropertyChangeEvent event) { - Preferences prefs = systemPlugin.getPluginPreferences(); - debug_level = prefs.getInt(Logger.LOGGING_LEVEL); - } - - public synchronized void setDebugLevel(int level) { - debug_level = level; - } - - /** - * Initialize the Logger. The logger uses an ILog from the platform for this particular plugin, and - * establishes a listener on that log to format the items placed in the log. - */ - private void initialize() { - systemsPluginLog = systemPlugin.getLog(); - logListener = new LogListener(systemPlugin); - systemsPluginLog.addLogListener(logListener); - Preferences store = systemPlugin.getPluginPreferences(); - debug_level = store.getInt(Logger.LOGGING_LEVEL); - store.addPropertyChangeListener(this); - store.addPropertyChangeListener(logListener); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/logging/LoggerFactory.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/logging/LoggerFactory.java deleted file mode 100644 index 28dc97e6c..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/logging/LoggerFactory.java +++ /dev/null @@ -1,62 +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.logging; - -import java.util.Hashtable; - -import org.eclipse.core.runtime.Plugin; - -/** - * Factory class for creating Logger instances.<br> - * Keep in mind that this factory class follows the singleton model.<br> - * ie: once an instance of a Logger class for a given plugin is created, - * it will always be reused. - */ -public class LoggerFactory { - - private static Hashtable pluginTable = new Hashtable(); - - /** - * Returns the Logger instance for a given plugin. There is only - * one instance of the Logger class per plugin. - * @param plugin the plugin for which to find or create the log - * @return the logger for that plugin - */ - public static Logger getLogger(Plugin plugin) { - Logger logger = (Logger) pluginTable.get(plugin); - if (logger == null) { - logger = new Logger(plugin); - pluginTable.put(plugin, logger); - } - return logger; - } - - /** - * Frees resources used by the Logger instance for the given plugin. - * This method must be called as part of the the plugin shutdown life cycle. - * @param plugin the plugin for which to free logging resources - */ - public static void freeLogger(Plugin plugin) { - Logger logger = (Logger) pluginTable.get(plugin); - if (logger != null) { - logger.freeResources(); - pluginTable.remove(plugin); - } - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/IRSEPersistenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/IRSEPersistenceManager.java deleted file mode 100644 index 223be7a22..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/IRSEPersistenceManager.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - 142806: refactoring persistence framework - ********************************************************************************/ - -package org.eclipse.rse.persistence; - -import org.eclipse.rse.core.model.ISystemProfile; - -public interface IRSEPersistenceManager { - - /** - * Schedules a save of particular profile. If the profile has an existing persistence provider - * it is saved by that persistence provider. If the profile has no persistence provider - * then the default persistence provider is used. If the persistence manager is in a state where - * it is saving or restoring another profile on another thread this call will block for the - * timeout value specified. If the timeout expires this call will return false. - * @param profile the profile to save - * @param timeout the timeout value in milliseconds. If the operation cannot be started in this time - * it will return false. - * @return true if the save was scheduled and false if the timeout expired without scheduling the save. - */ - public boolean commitProfile(ISystemProfile profile, long timeout); - - /** - * Save all profiles. Will attempt to schedule a save of all profiles. Each attempt will time out after - * the number of milliseconds specified if the operation cannot be started. - * @param timeout the maximum number of milliseconds to wait until the persistence manager becomes available - * to schedule a save for an individual profile. - * @return the list of profiles that could not be scheduled for save. - */ - public ISystemProfile[] commitProfiles(long timeout); - - /** - * Restore all profiles known to autostart persistence providers. - * @param timeout the maximum number of milliseconds to wait for the manager to become idle for each profile. - * @return an array of restored profiles. - */ - public ISystemProfile[] restoreProfiles(long timeout); - - /** - * Restore the profiles for a particular provider. - * @param provider a persistence provider - * @param timeout the maximum number of milliseconds to wait for the manager to become idle before restoring this - * the each profile managed by this provider. - * @return an array of the restored profiles. - */ - public ISystemProfile[] restoreProfiles(IRSEPersistenceProvider provider, long timeout); - - /** - * Delete the persistent form of a profile. - * @param persistenceProvider the persistence provider to use to delete the profile. - * If this is null the default persistence provider is used. - * @param profileName The name of the profile to delete - */ - public void deleteProfile(IRSEPersistenceProvider persistenceProvider, String profileName); - - /** - * Migrates a profile to a new persistence provider. It will delete the persistent form known to its previous - * persistence provider. If the new provider and the previous provider are the same this does nothing. - * @param profile the system profile to be migrated - * @param persistenceProvider the persistence provider to which this profile will be migrated. - */ - public void migrateProfile(ISystemProfile profile, IRSEPersistenceProvider persistenceProvider); - - /** - * Register the persistence provider to be used when saving and restoring RSE doms. - * The provider is registered under the provided id. - * If the id has already been registered, this provider replaces the previous provider - * with that id. - * @param id the provider id. - * @param provider the provider. - */ - public void registerPersistenceProvider(String id, IRSEPersistenceProvider provider); - - /** - * @return an array of persistence provider ids known to this workbench. These may have been - * provided by extension point or by registering them using - * {@link #registerPersistenceProvider(String, IRSEPersistenceProvider)} - */ - public String[] getPersistenceProviderIds(); - - /** - * Retrieves the persistence provider named by a particular id. It can return null if there - * is no provider known by that id. This may have the effect of activating the plugin that - * contains this provider. - * @param id the id of the persistence provider to locate - * @return the persistence provider or null - */ - public IRSEPersistenceProvider getPersistenceProvider(String id); - - /** - * @return true if this instance of the persistence manager is currently saving or restoring a profile. - */ - public boolean isBusy(); - - /** - * Indicate if all profiles for all autostart persistence provider have been restored. - * These profiles are restored when RSE is activated and when profiles - * are reloaded by the user. - * This can be used from a different thread - * than the one that requested the restore. - * @return true if the profiles have been fully restored - */ - public boolean isRestoreComplete(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/IRSEPersistenceProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/IRSEPersistenceProvider.java deleted file mode 100644 index 6cf319a47..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/IRSEPersistenceProvider.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. 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 Dykstal (IBM) - 177329: added getSaveJob so that the persistence provider - * determines the job characteristics. - ********************************************************************************/ - -package org.eclipse.rse.persistence; - -import java.util.Properties; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.persistence.dom.RSEDOM; - -/** - * This is the interface that needs to be implemented when providing an extension - * using the RSE persistence provider extension point. - * - * Implement this class to provide a specialized means of - * saving and restoring the RSE DOM. - * - * This interface is used by the persistence manager to schedule loads and saves - * of the DOM and should only be used by the persistence manager. - */ -public interface IRSEPersistenceProvider { - - /** - * Sets the properties for this provider. This must be done immediately - * after the provider is instantiated. The persistence manager will - * provide these properties for providers defined as extensions. - * @param properties the properties object containing the properties - * supplied in the extension. - */ - public void setProperties(Properties properties); - - /** - * Restores an RSE DOM given a profileName. - * - * @param profileName name of the Profile to load - * @param monitor The monitor to use for progress monitoring and cancellation. - * Must not be null. - * @return the RSE DOM for the specified profile - */ - public RSEDOM loadRSEDOM(String profileName, IProgressMonitor monitor); - - /** - * Persists an RSE DOM. Writes the DOM to some form of external storage and - * then marks the DOM as clean using {@link RSEDOM#markUpdated()}. - * @param dom the RSE DOM to persist. - * @param monitor The monitor to use for progress monitoring and cancellation. - * Must not be null. - * @return true if succcessful - */ - public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor); - - /** - * Returns a job suitable for saving a DOM. - * The result can be null if the persistence provider determines that - * a job would not be the best way of saving a particular DOM. - * @param dom the DOM for which to construct the job. - * @return The job that can be scheduled to perform the save operation. - */ - public Job getSaveJob(RSEDOM dom); - - /** - * @return The names of the profiles that have been saved by this persistence provider. - */ - public String[] getSavedProfileNames(); - - /** - * Removes a profile. Does nothing if the profile is not found. - * @param profileName the name of the profile to remove - * @param monitor The monitor to use for progress monitoring and cancellation. - * Must not be null. - * @return the IStatus indicating the operations success. - */ - public IStatus deleteProfile(String profileName, IProgressMonitor monitor); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java deleted file mode 100644 index ec1b0dd9f..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java +++ /dev/null @@ -1,89 +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.persistence.dom; - -public interface IRSEDOMConstants { - // node types - public static final String TYPE_PROFILE = "Profile"; //$NON-NLS-1$ - public static final String TYPE_PROPERTY_SET = "PropertySet"; //$NON-NLS-1$ - public static final String TYPE_PROPERTY = "Property"; //$NON-NLS-1$ - public static final String TYPE_HOST = "Host"; //$NON-NLS-1$ - public static final String TYPE_FILTER_POOL = "FilterPool"; //$NON-NLS-1$ - public static final String TYPE_FILTER = "Filter"; //$NON-NLS-1$ - public static final String TYPE_FILTER_STRING = "FilterString"; //$NON-NLS-1$ - public static final String TYPE_FILTER_POOL_REFERENCE = "FilterPoolReference"; //$NON-NLS-1$ - public static final String TYPE_CONNECTOR_SERVICE = "ConnectorService"; //$NON-NLS-1$ - public static final String TYPE_SERVER_LAUNCHER = "ServerLauncher"; //$NON-NLS-1$ - public static final String TYPE_SUBSYSTEM = "SubSystem"; //$NON-NLS-1$ - - // node attributes - - // profile attributes - public static final String ATTRIBUTE_DEFAULT_PRIVATE = "defaultPrivate"; //$NON-NLS-1$ - public static final String ATTRIBUTE_IS_ACTIVE = "isActive"; //$NON-NLS-1$ - - // subsystem attributes - public static final String ATTRIBUTE_HIDDEN = "hidden"; //$NON-NLS-1$ - - // common attributes - public static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$ - public static final String ATTRIBUTE_TYPE = "type"; //$NON-NLS-1$ - public static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$ - - // host attributes - public static final String ATTRIBUTE_HOSTNAME = "hostname"; //$NON-NLS-1$ - public static final String ATTRIBUTE_OFFLINE = "offline"; //$NON-NLS-1$ - public static final String ATTRIBUTE_SYSTEM_TYPE = "systemType"; //$NON-NLS-1$ - - // ConnectorService attributes - public static final String ATTRIBUTE_GROUP = "group"; //$NON-NLS-1$ - public static final String ATTRIBUTE_USE_SSL = "useSSL"; //$NON-NLS-1$ - - // Filter string attributes - public static final String ATTRIBUTE_STRING = "string"; //$NON-NLS-1$ - - // filter attributes - public static final String ATTRIBUTE_SUPPORTS_NESTED_FILTERS = "supportsNestedFilters"; //$NON-NLS-1$ - public static final String ATTRIBUTE_RELATIVE_ORDER = "relativeOrder"; //$NON-NLS-1$ - public static final String ATTRIBUTE_DEFAULT = "default"; //$NON-NLS-1$ - public static final String ATTRIBUTE_STRING_CASE_SENSITIVE = "stringsCaseSensitive"; //$NON-NLS-1$ - public static final String ATTRIBUTE_PROMPTABLE = "promptable"; //$NON-NLS-1$ - public static final String ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS = "supportsDuplicateFilterStrings"; //$NON-NLS-1$ - public static final String ATTRIBUTE_NON_DELETABLE = "nonDeletable"; //$NON-NLS-1$ - public static final String ATTRIBUTE_NON_RENAMABLE = "nonRenamable"; //$NON-NLS-1$ - public static final String ATTRIBUTE_NON_CHANGEABLE = "nonChangable"; //$NON-NLS-1$ - public static final String ATTRIBUTE_STRINGS_NON_CHANGABLE = "stringsNonChangable"; //$NON-NLS-1$ - public static final String ATTRIBUTE_RELEASE = "release"; //$NON-NLS-1$ - public static final String ATTRIBUTE_SINGLE_FILTER_STRING_ONLY = "singleFilterStringOnly"; //$NON-NLS-1$ - - // server launcher attributes - public static final String ATTRIBUTE_REXEC_PORT = "rexecPort"; //$NON-NLS-1$ - public static final String ATTRIBUTE_DAEMON_PORT = "daemonPort"; //$NON-NLS-1$ - public static final String ATTRIBUTE_PORT = "port"; //$NON-NLS-1$ - public static final String ATTRIBUTE_SERVER_PATH = "serverPath"; //$NON-NLS-1$ - public static final String ATTRIBUTE_SERVER_SCRIPT = "serverScript"; //$NON-NLS-1$ - public static final String ATTRIBUTE_RESTRICTED_TYPES = "restrictedTypes"; //$NON-NLS-1$ - - public static final String ATTRIBUTE_VALUE = "value"; //$NON-NLS-1$ - public static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$ - public static final String ATTRIBUTE_OWNING_PARENT_NAME = "owningParentName"; //$NON-NLS-1$ - public static final String ATTRIBUTE_REF_ID = "refID"; //$NON-NLS-1$ - public static final String ATTRIBUTE_DELETABLE = "deletable"; //$NON-NLS-1$ - public static final String ATTRIBUTE_TRUE = "true"; //$NON-NLS-1$ - public static final String ATTRIBUTE_FALSE = "false"; //$NON-NLS-1$ -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOM.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOM.java deleted file mode 100644 index 0703801ae..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOM.java +++ /dev/null @@ -1,90 +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.persistence.dom; - -import org.eclipse.rse.core.model.ISystemProfile; - -/** - * This class is the root node of an RSE DOM. Each - * RSEDOM represents the properties of a profile to persist. - */ -public class RSEDOM extends RSEDOMNode { - - /* - * Recommended for serializable objects. This should be updated if there is a schema change. - */ - private static final long serialVersionUID = 1L; - private transient ISystemProfile _profile; - - public RSEDOM(ISystemProfile profile) { - super(null, IRSEDOMConstants.TYPE_PROFILE, profile.getName()); - _profile = profile; - } - - public RSEDOM(String profileName) { - super(null, IRSEDOMConstants.TYPE_PROFILE, profileName); - _profile = null; - } - - public ISystemProfile getProfile() { - return _profile; - } - - /** - * Indicate that this DOM needs to be saved - */ - public void markForSave() { - if (!restoring && !_needsSave) { - _needsSave = true; - } - } - - /** - * @return true if this DOM has the DOM changed since last saved or restored. - */ - public boolean needsSave() { - return _needsSave; - } - - public void print(RSEDOMNode node, String indent) { - String type = node.getType(); - String name = node.getName(); - RSEDOMNodeAttribute[] attributes = node.getAttributes(); - RSEDOMNode[] children = node.getChildren(); - - System.out.println(indent + "RSEDOMNode " + type); //$NON-NLS-1$ - System.out.println(indent + "{"); //$NON-NLS-1$ - String sindent = indent + " "; //$NON-NLS-1$ - - System.out.println(sindent + "name=" + name); //$NON-NLS-1$ - for (int i = 0; i < attributes.length; i++) { - RSEDOMNodeAttribute attribute = attributes[i]; - String key = attribute.getKey(); - String value = attribute.getValue(); - System.out.println(sindent + key + "=" + value); //$NON-NLS-1$ - } - - String cindent = sindent + " "; //$NON-NLS-1$ - for (int c = 0; c < children.length; c++) { - RSEDOMNode child = children[c]; - print(child, cindent); - } - System.out.println(indent + "}"); //$NON-NLS-1$ - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOMNode.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOMNode.java deleted file mode 100644 index 6e47f2c86..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOMNode.java +++ /dev/null @@ -1,230 +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.persistence.dom; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -public class RSEDOMNode implements Serializable { - - private static final long serialVersionUID = 1L; // This should be updated if there is a schema change. - protected String _type; - protected String _name; - protected RSEDOMNode _parent; - protected List _children; - protected List _attributes; - - protected boolean _needsSave = false; - protected boolean _isDirty = true; - protected boolean restoring = false; - - public RSEDOMNode(RSEDOMNode parent, String type, String name) { - _type = type; - _name = name; - _parent = parent; - _children = new ArrayList(); - _attributes = new ArrayList(); - if (parent != null) { - parent.addChild(this); - } - } - - public void markUpdated() { - if (_needsSave) { - _needsSave = false; - - for (int i = 0; i < _children.size(); i++) { - RSEDOMNode child = (RSEDOMNode) _children.get(i); - child.markUpdated(); - } - } - } - - /** - * Propagates the needs save indicator up to the root - */ - public void markForSave() { - if (!restoring && !_needsSave) { - _needsSave = true; - _parent.markForSave(); - } - } - - /** - * Recursively removes all the children from this node on down - * - */ - public void clearChildren() { - RSEDOMNode[] children = getChildren(); - for (int i = 0; i < children.length; i++) { - children[i].clearAttributes(); - children[i].clearChildren(); - } - _children.clear(); - } - - /** - * Clears all attributes - * - */ - public void clearAttributes() { - _attributes.clear(); - } - - /** - * @return the name of this node - */ - public String getName() { - return _name; - } - - /** - * @return the type of this node - */ - public String getType() { - return _type; - } - - /** - * @return the parent of this node - */ - public RSEDOMNode getParent() { - return _parent; - } - - /** - * @return all the children of this node - */ - public RSEDOMNode[] getChildren() { - return (RSEDOMNode[]) _children.toArray(new RSEDOMNode[_children.size()]); - } - - /** - * @param key the name of this attribute - * @return the first attribute found that has the specified name - */ - public RSEDOMNodeAttribute getAttribute(String key) { - for (int i = 0; i < _attributes.size(); i++) { - RSEDOMNodeAttribute attribute = (RSEDOMNodeAttribute) _attributes.get(i); - if (key.equals(attribute.getKey())) { - return attribute; - } - } - return null; - } - - /** - * @param type - * @return the immediate children of this node that are of the specified type - */ - public RSEDOMNode[] getChildren(String type) { - List results = new ArrayList(); - for (int i = 0; i < _children.size(); i++) { - RSEDOMNode child = (RSEDOMNode) _children.get(i); - if (type.equals(child.getType())) { - results.add(child); - } - } - return (RSEDOMNode[]) results.toArray(new RSEDOMNode[results.size()]); - } - - /** - * @param type - * @param name - * @return the first immediate child of this node that is of the specified type and name - */ - public RSEDOMNode getChild(String type, String name) { - for (int i = 0; i < _children.size(); i++) { - RSEDOMNode child = (RSEDOMNode) _children.get(i); - if (type.equals(child.getType()) && name.equals(child.getName())) { - return child; - } - } - return null; - } - - /** - * @return all the attributes for this node - */ - public RSEDOMNodeAttribute[] getAttributes() { - return (RSEDOMNodeAttribute[]) _attributes.toArray(new RSEDOMNodeAttribute[_attributes.size()]); - } - - /** - * Adds a child to this node - * @param child - */ - public void addChild(RSEDOMNode child) { - _children.add(child); - markForSave(); - } - - /** - * Removes a child from this node - * @param child - */ - public void removeChild(RSEDOMNode child) { - _children.remove(child); - markForSave(); - } - - /** - * Adds an attribute to the node - * @param name - * @param value - * @param type - */ - public void addAttribute(String name, String value, String type) { - RSEDOMNodeAttribute attr = new RSEDOMNodeAttribute(name, value, type); - _attributes.add(attr); - markForSave(); - } - - /** - * Adds an attribute to the node - * @param name - * @param value - */ - public void addAttribute(String name, String value) { - RSEDOMNodeAttribute attr = new RSEDOMNodeAttribute(name, value); - _attributes.add(attr); - markForSave(); - } - - public boolean isDirty() { - return _isDirty; - } - - public void setDirty(boolean isDirty) { - _isDirty = isDirty; - } - - public void setRestoring(boolean restoring) { - this.restoring = restoring; - } - - public void setName(String name) { - _name = name; - } - - public void setType(String type) { - _type = type; - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOMNodeAttribute.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOMNodeAttribute.java deleted file mode 100644 index 65eefe63e..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/RSEDOMNodeAttribute.java +++ /dev/null @@ -1,51 +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.persistence.dom; - -import java.io.Serializable; - -public class RSEDOMNodeAttribute implements Serializable { - private static final long serialVersionUID = 1L; - private String _key; - private String _value; - private String _type; - - public RSEDOMNodeAttribute(String key, String value, String type) { - _key = key; - _value = value; - _type = type; - } - - public RSEDOMNodeAttribute(String key, String value) { - _key = key; - _value = value; - _type = null; - } - - public String getKey() { - return _key; - } - - public String getValue() { - return _value; - } - - public String getType() { - return _type; - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/package.html b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/package.html deleted file mode 100644 index 31fe153b3..000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/package.html +++ /dev/null @@ -1,20 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <meta name="Author" content="David Dykstal (IBM)"> - <title>Package-level Javadoc</title> -</head> -<body> -Application programming interface for manipulating the RSE document object model. -<h2> -Package Specification</h2> -<p> -The package provides classes that define the document object model (DOM) -for the RSE model objects. The RSE model consists of those objects which are typically -presented in the RSE system view. The DOM is created/updated from this model when the model is persisted. -Persistence providers will use this DOM to write a persistent form. -Likewise, the persistence provider will update or construct a DOM when restoring a model from its persistent form. -</p> -</body> -</html> |