1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-22 07:43:56 +02:00

bug 148808 - local subsystems do not work on linux/gtk

This commit is contained in:
David Dykstal 2006-06-28 03:16:48 +00:00
parent 21d998ba3c
commit 726c8abe70
18 changed files with 491 additions and 540 deletions

View file

@ -22,9 +22,8 @@ import java.security.cert.X509Certificate;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.eclipse.dstore.core.client.ClientConnection; import org.eclipse.dstore.core.client.ClientConnection;
import org.eclipse.dstore.core.client.ClientSSLProperties; import org.eclipse.dstore.core.client.ClientSSLProperties;
import org.eclipse.dstore.core.client.ConnectionStatus; import org.eclipse.dstore.core.client.ConnectionStatus;
@ -36,13 +35,13 @@ import org.eclipse.dstore.core.model.DataStore;
import org.eclipse.dstore.core.model.IDataStoreConstants; import org.eclipse.dstore.core.model.IDataStoreConstants;
import org.eclipse.dstore.core.model.IDataStoreProvider; import org.eclipse.dstore.core.model.IDataStoreProvider;
import org.eclipse.dstore.core.model.ISSLProperties; import org.eclipse.dstore.core.model.ISSLProperties;
import org.eclipse.dstore.core.server.ServerLauncher;
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.connectorservice.dstore.util.ConnectionStatusListener; import org.eclipse.rse.connectorservice.dstore.util.ConnectionStatusListener;
import org.eclipse.rse.connectorservice.dstore.util.StatusMonitor; import org.eclipse.rse.connectorservice.dstore.util.StatusMonitor;
import org.eclipse.rse.connectorservice.dstore.util.StatusMonitorFactory; import org.eclipse.rse.connectorservice.dstore.util.StatusMonitorFactory;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.comm.ISystemKeystoreProvider; import org.eclipse.rse.core.comm.ISystemKeystoreProvider;
import org.eclipse.rse.core.comm.SystemKeystoreProviderManager; import org.eclipse.rse.core.comm.SystemKeystoreProviderManager;
@ -69,6 +68,7 @@ import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
/** /**
* System class required by the remote systems framework. * System class required by the remote systems framework.
* This represents the live connection at tool runtime. * This represents the live connection at tool runtime.
@ -271,7 +271,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
// fall back to getting local machine ip address // fall back to getting local machine ip address
// this may be incorrect for the server in certain cases // this may be incorrect for the server in certain cases
// like over VPN // like over VPN
return RSEUIPlugin.getLocalMachineIPAddress(); return RSECorePlugin.getLocalMachineIPAddress();
} }
/** /**
@ -355,12 +355,12 @@ public class DStoreConnectorService extends AbstractConnectorService implements
try try
{ {
String path = Platform.resolve(pluginsURL).getPath(); String path = FileLocator.resolve(pluginsURL).getPath();
File systemsPluginDir = new File(path); File systemsPluginDir = new File(path);
path = systemsPluginDir.getParentFile().getAbsolutePath(); path = systemsPluginDir.getParentFile().getAbsolutePath();
String version = (String)(bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION)); String version = (String)(bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION));
String versionString = (new PluginVersionIdentifier(version)).toString(); Version v = new Version(version);
String versionString = v.toString();
String dstorePath = getDStorePath(path, versionString); String dstorePath = getDStorePath(path, versionString);
System.setProperty("A_PLUGIN_PATH", dstorePath); System.setProperty("A_PLUGIN_PATH", dstorePath);
} }
@ -759,7 +759,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
{ {
//dataStore.showTicket(launchStatus.getTicket()); // send security token to server, this must be done first //dataStore.showTicket(launchStatus.getTicket()); // send security token to server, this must be done first
DataElement ticket = dataStore.createTicket(launchStatus.getTicket()); DataElement ticket = dataStore.createTicket(launchStatus.getTicket());
DataElement ticketStatus = dataStore.queryShowTicket(ticket); dataStore.queryShowTicket(ticket);
//statusMonitor.waitForUpdate(ticketStatus); //statusMonitor.waitForUpdate(ticketStatus);
} }
else else
@ -834,7 +834,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
{ {
if (launchStatus.isSLLProblem()) if (launchStatus.isSLLProblem())
{ {
Throwable exception = launchStatus.getException(); launchStatus.getException();
List certs = launchStatus.getUntrustedCertificates(); List certs = launchStatus.getUntrustedCertificates();
if (certs.size() > 0) if (certs.size() > 0)

View file

@ -27,6 +27,7 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.Window;
import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.subsystems.AbstractConnectorService; import org.eclipse.rse.core.subsystems.AbstractConnectorService;
import org.eclipse.rse.core.subsystems.CommunicationsEvent; import org.eclipse.rse.core.subsystems.CommunicationsEvent;
@ -579,7 +580,7 @@ public class SshConnectorService extends AbstractConnectorService implements ISs
UserValidationDialog uvd = new UserValidationDialog(null, null, UserValidationDialog uvd = new UserValidationDialog(null, null,
fUser, message); fUser, message);
uvd.setUsernameMutable(false); uvd.setUsernameMutable(false);
if (uvd.open() == uvd.OK) { if (uvd.open() == Window.OK) {
retval[0] = uvd.getPassword(); retval[0] = uvd.getPassword();
} else { } else {
retval[0] = null; retval[0] = null;

View file

@ -15,7 +15,12 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core; package org.eclipse.rse.core;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.rse.core.internal.RSECoreRegistry; import org.eclipse.rse.core.internal.RSECoreRegistry;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
@ -27,6 +32,32 @@ public class RSECorePlugin extends Plugin {
// the shared instance // the shared instance
private static RSECorePlugin plugin; private static RSECorePlugin plugin;
/**
* @return the local machine name
*/
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
*/
public static String getLocalMachineIPAddress() {
String machineAddress = null;
try {
machineAddress = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
getDefault().log(e);
}
return machineAddress;
}
/** /**
* The constructor. * The constructor.
*/ */
@ -65,4 +96,10 @@ public class RSECorePlugin extends Plugin {
public IRSECoreRegistry getRegistry() { public IRSECoreRegistry getRegistry() {
return RSECoreRegistry.getDefault(); return RSECoreRegistry.getDefault();
} }
private void log(Throwable t) {
String pluginId = this.getBundle().getSymbolicName();
IStatus status = new Status(IStatus.ERROR, pluginId, 0, "Unexpected Exception", t);
getLog().log(status);
}
} }

View file

@ -29,6 +29,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.ISystemViewSupplier; import org.eclipse.rse.core.ISystemViewSupplier;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.SystemPropertyPageExtension; import org.eclipse.rse.core.SystemPropertyPageExtension;
import org.eclipse.rse.core.SystemResourceManager; import org.eclipse.rse.core.SystemResourceManager;
@ -41,6 +42,7 @@ import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.internal.model.SystemProfileManager; import org.eclipse.rse.internal.model.SystemProfileManager;
import org.eclipse.rse.internal.model.SystemRegistry; import org.eclipse.rse.internal.model.SystemRegistry;
import org.eclipse.rse.internal.persistence.RSEPersistenceManager; import org.eclipse.rse.internal.persistence.RSEPersistenceManager;
import org.eclipse.rse.model.ISystemProfile;
import org.eclipse.rse.model.ISystemProfileManager; import org.eclipse.rse.model.ISystemProfileManager;
import org.eclipse.rse.model.ISystemRegistry; import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.model.ISystemResourceChangeEvents; import org.eclipse.rse.model.ISystemResourceChangeEvents;
@ -89,8 +91,6 @@ public class RSEUIPlugin extends SystemBasePlugin
private ISubSystemConfigurationProxy[] subsystemFactories = null; private ISubSystemConfigurationProxy[] subsystemFactories = null;
private static String machineName = null;
private static String machineIP = null;
private Vector viewSuppliers = new Vector(); private Vector viewSuppliers = new Vector();
private SystemViewAdapterFactory svaf; // for fastpath access private SystemViewAdapterFactory svaf; // for fastpath access
private SystemTeamViewResourceAdapterFactory svraf; // for fastpath private SystemTeamViewResourceAdapterFactory svraf; // for fastpath
@ -559,12 +559,13 @@ public class RSEUIPlugin extends SystemBasePlugin
registerKeystoreProviders(); registerKeystoreProviders();
// if first time creating the remote systems project, add some default connections... // if first time creating the remote systems project, add some default connections...
if (SystemResourceManager.isFirstTime() // if (SystemResourceManager.isFirstTime()
&& !dontShowLocalConnection) // new support to allow products to not pre-create a local connection // && !dontShowLocalConnection) // new support to allow products to not pre-create a local connection
{ // {
//try //try
//{ //{
registry.createLocalHost(null, SystemResources.TERM_LOCAL, getLocalMachineName()); // profile, name, userId
// registry.createLocalHost(null, SystemResources.TERM_LOCAL, SystemProfileManager.getSystemProfileManager().getDefaultPrivateSystemProfileName()); // profile, name, userId
/* replaced with re-usable method by Phil, in v5.1.2 /* replaced with re-usable method by Phil, in v5.1.2
SystemConnection localConn = registry.createConnection( SystemConnection localConn = registry.createConnection(
//SystemResourceConstants.RESOURCE_TEAMPROFILE_NAME, IRSESystemType.SYSTEMTYPE_LOCAL, //SystemResourceConstants.RESOURCE_TEAMPROFILE_NAME, IRSESystemType.SYSTEMTYPE_LOCAL,
@ -582,6 +583,13 @@ public class RSEUIPlugin extends SystemBasePlugin
//{ //{
//logError("Error creating default Local connection", exc); //logError("Error creating default Local connection", exc);
//} //}
// }
// new support to allow products to not pre-create a local connection
if (SystemResourceManager.isFirstTime() && !dontShowLocalConnection) {
ISystemProfileManager profileManager = SystemProfileManager.getSystemProfileManager();
ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile();
String userName = System.getProperty("user.name");
registry.createLocalHost(profile, SystemResources.TERM_LOCAL, userName);
} }
} }
@ -1429,45 +1437,6 @@ public class RSEUIPlugin extends SystemBasePlugin
return msg; return msg;
} }
/**
* Return the local user's machine name
*/
public static String getLocalMachineName()
{
if (machineName == null)
{
try
{
//InetAddress ip = InetAddress.getByName("localhost");
machineName = InetAddress.getLocalHost().getHostName();
}catch(Exception exc)
{
machineName = ""; // ? what else ? no point in trying again.
logWarning("Exception getting local hostname: " + exc.getClass().getName() + ": " + exc.getMessage());
}
}
return machineName;
}
/**
* Return the local user's IP address
*/
public static String getLocalMachineIPAddress()
{
if (machineIP == null)
{
try
{
//InetAddress ip = InetAddress.getByName("localhost");
machineIP = InetAddress.getLocalHost().getHostAddress();
}catch(Exception exc)
{
machineIP = ""; // ? what else ? no point in trying again.
logWarning("Exception getting local hostname: " + exc.getClass().getName() + ": " + exc.getMessage());
}
}
return machineIP;
}
/** /**
* Register a view supplier so we can ask them to participate in team synchs * Register a view supplier so we can ask them to participate in team synchs
*/ */

View file

@ -26,6 +26,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent; import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent;
import org.eclipse.rse.internal.model.SystemProfileManager;
import org.eclipse.rse.model.ISystemPreferenceChangeEvents; import org.eclipse.rse.model.ISystemPreferenceChangeEvents;
import org.eclipse.rse.ui.ISystemPreferencesConstants; import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.Mnemonics; import org.eclipse.rse.ui.Mnemonics;
@ -590,7 +591,7 @@ public class RemoteSystemsPreferencePage
store.setDefault(ISystemPreferencesConstants.SHOWFILTERPOOLS, ISystemPreferencesConstants.DEFAULT_SHOWFILTERPOOLS); store.setDefault(ISystemPreferencesConstants.SHOWFILTERPOOLS, ISystemPreferencesConstants.DEFAULT_SHOWFILTERPOOLS);
String defaultProfileNames = ISystemPreferencesConstants.DEFAULT_ACTIVEUSERPROFILES; String defaultProfileNames = ISystemPreferencesConstants.DEFAULT_ACTIVEUSERPROFILES;
String userProfileName = RSEUIPlugin.getLocalMachineName(); String userProfileName = SystemProfileManager.getDefaultPrivateSystemProfileName();
defaultProfileNames += ";" + userProfileName; defaultProfileNames += ";" + userProfileName;

View file

@ -16,6 +16,8 @@
package org.eclipse.rse.ui.wizards; package org.eclipse.rse.ui.wizards;
import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.Wizard;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.internal.model.SystemProfileManager;
import org.eclipse.rse.ui.ISystemMessages; import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemProfileForm; import org.eclipse.rse.ui.SystemProfileForm;
@ -82,16 +84,8 @@ public class SystemNewConnectionWizardRenameProfilePage
{ {
Control c = form.createContents(parent); Control c = form.createContents(parent);
form.getInitialFocusControl().setFocus(); form.getInitialFocusControl().setFocus();
String initProfileName = SystemProfileManager.getDefaultPrivateSystemProfileName();
String initProfileName = RSEUIPlugin.getLocalMachineName();
int dotIndex = initProfileName.indexOf('.');
if (dotIndex != -1) {
initProfileName = initProfileName.substring(0, dotIndex);
}
form.setProfileName(initProfileName); form.setProfileName(initProfileName);
return c; return c;
} }
/** /**

View file

@ -15,13 +15,13 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.filters; package org.eclipse.rse.filters;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IFolder;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.references.ISystemBasePersistableReferenceManager; import org.eclipse.rse.references.ISystemBasePersistableReferenceManager;
/** /**
* This class manages a persistable list of objects each of which reference * This class manages a persistable list of objects each of which reference
* a filter pool. This class builds on the parent class SystemPersistableReferenceManager, * a filter pool. This class builds on the parent class SystemPersistableReferenceManager,
@ -31,23 +31,25 @@ import org.eclipse.rse.references.ISystemBasePersistableReferenceManager;
/** /**
* @lastgen interface SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager {} * @lastgen interface SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager {}
*/ */
public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistableReferenceManager public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistableReferenceManager {
{
/** /**
* Get the object which instantiated this instance of the filter pool reference manager. * Get the object which instantiated this instance of the filter pool reference manager.
* This is also available from any filter reference framework object. * This is also available from any filter reference framework object.
*/ */
public ISystemFilterPoolReferenceManagerProvider getProvider(); public ISystemFilterPoolReferenceManagerProvider getProvider();
/** /**
* Set the object which instantiated this instance of the filter pool reference manager. * 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, * This makes it available to retrieve from any filter reference framework object,
* via the ubiquitous getProvider interface method. * via the ubiquitous getProvider interface method.
*/ */
public void setProvider(ISystemFilterPoolReferenceManagerProvider caller); public void setProvider(ISystemFilterPoolReferenceManagerProvider caller);
/** /**
* Turn off callbacks to the provider until turned on again. * Turn off callbacks to the provider until turned on again.
*/ */
public void setProviderEventNotification(boolean fireEvents); public void setProviderEventNotification(boolean fireEvents);
// ------------------------------------------------------------ // ------------------------------------------------------------
// Methods for setting and querying related filterpool manager // Methods for setting and querying related filterpool manager
// ------------------------------------------------------------ // ------------------------------------------------------------
@ -65,17 +67,20 @@ public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistabl
* across those. * across those.
*/ */
public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider poolMgrProvider); public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider poolMgrProvider);
/** /**
* Get the associated master pool manager provider. Note the provider * Get the associated master pool manager provider. Note the provider
* typically manages multiple pool managers and we manage references * typically manages multiple pool managers and we manage references
* across those. * across those.
*/ */
public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider(); public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider();
/** /**
* Get the managers of the master list of filter pools, from which * Get the managers of the master list of filter pools, from which
* objects in this list reference. * objects in this list reference.
*/ */
public ISystemFilterPoolManager[] getSystemFilterPoolManagers(); public ISystemFilterPoolManager[] getSystemFilterPoolManagers();
/** /**
* Get the managers of the master list of filter pools, from which * 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 * objects in this list reference, but which are not in the list of
@ -84,11 +89,13 @@ public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistabl
* @return null if no unmatched managers found, else an array of such managers. * @return null if no unmatched managers found, else an array of such managers.
*/ */
public ISystemFilterPoolManager[] getAdditionalSystemFilterPoolManagers(); public ISystemFilterPoolManager[] getAdditionalSystemFilterPoolManagers();
/** /**
* Set the default manager of the master list of filter pools, from which * Set the default manager of the master list of filter pools, from which
* objects in this list reference. * objects in this list reference.
*/ */
public void setDefaultSystemFilterPoolManager(ISystemFilterPoolManager mgr); public void setDefaultSystemFilterPoolManager(ISystemFilterPoolManager mgr);
/** /**
* Get the default manager of the master list of filter pools, from which * Get the default manager of the master list of filter pools, from which
* objects in this list reference. * objects in this list reference.
@ -103,53 +110,56 @@ public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistabl
* Called after the name of the pool or its manager changes. * Called after the name of the pool or its manager changes.
*/ */
public void regenerateReferencedSystemFilterPoolNames(); public void regenerateReferencedSystemFilterPoolNames();
/** /**
* Return array of SystemFilterPoolReference objects. * Return array of SystemFilterPoolReference objects.
* Result will never be null, although it may be an array of length zero. * Result will never be null, although it may be an array of length zero.
*/ */
public ISystemFilterPoolReference[] getSystemFilterPoolReferences(); public ISystemFilterPoolReference[] getSystemFilterPoolReferences();
/** /**
* In one shot, set the filter pool references * In one shot, set the filter pool references
* <p> Calls back to inform provider * <p> Calls back to inform provider
* @param array of filter pool reference objects to set the list to. * @param array of filter pool reference objects to set the list to.
* @param deReference true to first de-reference all objects in the existing list. * @param deReference true to first de-reference all objects in the existing list.
*/ */
public void setSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolReferences, public void setSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolReferences, boolean deReference);
boolean deReference);
/**
* Create a filter pool referencing object, but do NOT add it to the list, do NOT call back.
*/
public ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPool filterPool);
/** /**
* Add a filter pool referencing object to the list. * Add a filter pool referencing object to the list.
* @return the new count of referencing objects * @return the new count of referencing objects
*/ */
public int addSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference); public int addSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference);
/** /**
* Reset the filter pool a reference points to. Called on a move-filter-pool operation * Reset the filter pool a reference points to. Called on a move-filter-pool operation
*/ */
public void resetSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, ISystemFilterPool newPool); public void resetSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, ISystemFilterPool newPool);
/** /**
* Remove a filter pool referencing object from the list. * Remove a filter pool referencing object from the list.
* @param filterPool Reference the reference to remove * @param filterPool Reference the reference to remove
* @param deReference true if we want to dereference the referenced object (call removeReference on it) * @param deReference true if we want to dereference the referenced object (call removeReference on it)
* @return the new count of referencing objects * @return the new count of referencing objects
*/ */
public int removeSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, public int removeSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, boolean deReference);
boolean deReference);
/** /**
* Return count of referenced filter pools * Return count of referenced filter pools
*/ */
public int getSystemFilterPoolReferenceCount(); public int getSystemFilterPoolReferenceCount();
/** /**
* Return the zero-based position of a SystemFilterPoolReference object within this list * Return the zero-based position of a SystemFilterPoolReference object within this list
*/ */
public int getSystemFilterPoolReferencePosition(ISystemFilterPoolReference filterPoolRef); public int getSystemFilterPoolReferencePosition(ISystemFilterPoolReference filterPoolRef);
/** /**
* Move a given filter pool reference to a given zero-based location * Move a given filter pool reference to a given zero-based location
* <p> Calls back to inform provider * <p> Calls back to inform provider
*/ */
public void moveSystemFilterPoolReference(ISystemFilterPoolReference filterPoolRef, int pos); public void moveSystemFilterPoolReference(ISystemFilterPoolReference filterPoolRef, int pos);
/** /**
* Move existing filter pool references a given number of positions. * 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 * If the delta is negative, they are all moved up by the given amount. If
@ -168,15 +178,18 @@ public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistabl
* Result will never be null, although it may be an array of length zero. * Result will never be null, although it may be an array of length zero.
*/ */
public ISystemFilterPool[] getReferencedSystemFilterPools(); public ISystemFilterPool[] getReferencedSystemFilterPools();
/** /**
* Return true if the given filter pool has a referencing object in this list. * Return true if the given filter pool has a referencing object in this list.
*/ */
public boolean isSystemFilterPoolReferenced(ISystemFilterPool filterPool); public boolean isSystemFilterPoolReferenced(ISystemFilterPool filterPool);
/** /**
* Given a filter pool, locate the referencing object for it and return it. * Given a filter pool, locate the referencing object for it and return it.
* @return the referencing object if found, else null * @return the referencing object if found, else null
*/ */
public ISystemFilterPoolReference getReferenceToSystemFilterPool(ISystemFilterPool filterPool); public ISystemFilterPoolReference getReferenceToSystemFilterPool(ISystemFilterPool filterPool);
/** /**
* Given a filter pool, create a referencing object and add it to the list. * Given a filter pool, create a referencing object and add it to the list.
* <p> Calls back to inform provider * <p> Calls back to inform provider
@ -184,25 +197,37 @@ public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistabl
*/ */
public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool); 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 filterPoolManager the manager that can be used to resolve the reference.
* @param filterPoolName the name of the filter pool being referenced.
* @return new filter pool reference
*/
public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPoolManager filterPoolManager, String filterPoolName);
/** /**
* Given a filter pool, locate the referencing object for it and remove it from the list. * Given a filter pool, locate the referencing object for it and remove it from the list.
* <p> Calls back to inform provider * <p> Calls back to inform provider
* @return the new count of referencing objects * @return the new count of referencing objects
*/ */
public int removeReferenceToSystemFilterPool(ISystemFilterPool filterPool); public int removeReferenceToSystemFilterPool(ISystemFilterPool filterPool);
/** /**
* A reference filter pool has been renamed. Update our stored name... * A reference filter pool has been renamed. Update our stored name...
* <p> Calls back to inform provider * <p> Calls back to inform provider
*/ */
public void renameReferenceToSystemFilterPool(ISystemFilterPool pool); public void renameReferenceToSystemFilterPool(ISystemFilterPool pool);
/** /**
* In one shot, set the filter pool references to new references to supplied filter pools. * In one shot, set the filter pool references to new references to supplied filter pools.
* <p> Calls back to inform provider * <p> Calls back to inform provider
* @param array of filter pool objects to create references for * @param array of filter pool objects to create references for
* @param deReference true to first de-reference all objects in the existing list. * @param deReference true to first de-reference all objects in the existing list.
*/ */
public void setSystemFilterPoolReferences(ISystemFilterPool[] filterPools, public void setSystemFilterPoolReferences(ISystemFilterPool[] filterPools, boolean deReference);
boolean deReference);
// ------------------------- // -------------------------
// SPECIAL CASE METHODS // SPECIAL CASE METHODS
// ------------------------- // -------------------------
@ -212,23 +237,27 @@ public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistabl
* in all pool references. * in all pool references.
*/ */
public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter); public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter);
/** /**
* Concatenate all filter references from all filter pools we reference, into one * Concatenate all filter references from all filter pools we reference, into one
* big list. * big list.
*/ */
public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem); public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem);
/** /**
* Given a filter reference, return its position within this reference manager * Given a filter reference, return its position within this reference manager
* when you think of all filter references from all filter pool references as * when you think of all filter references from all filter pool references as
* being concatenated * being concatenated
*/ */
public int getSystemFilterReferencePosition(ISystemFilterReference filterRef); public int getSystemFilterReferencePosition(ISystemFilterReference filterRef);
/** /**
* Given a filter, return its position within this reference manager * Given a filter, return its position within this reference manager
* when you think of all filter references from all filter pool references as * when you think of all filter references from all filter pool references as
* being concatenated * being concatenated
*/ */
public int getSystemFilterReferencePosition(ISubSystem subSystem, ISystemFilter filter); public int getSystemFilterReferencePosition(ISubSystem subSystem, ISystemFilter filter);
// ------------------------- // -------------------------
// SAVE / RESTORE METHODS... // SAVE / RESTORE METHODS...
// ------------------------- // -------------------------
@ -248,19 +277,19 @@ public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistabl
* @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all
* were resolved. * were resolved.
*/ */
public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider, public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider, ISystemFilterPoolReferenceManagerProvider provider);
ISystemFilterPoolReferenceManagerProvider provider);
/** /**
* Save all the filter pool references to disk. * Save all the filter pool references to disk.
* Use only if not doing your own saving, else override or set save policy to none. * Use only if not doing your own saving, else override or set save policy to none.
*/ */
public void save() public void save() throws Exception;
throws Exception;
/** /**
* Return the folder that this manager is contained in. * Return the folder that this manager is contained in.
*/ */
public IFolder getFolder(); public IFolder getFolder();
/** /**
* Reset the folder that this manager is contained in. * Reset the folder that this manager is contained in.
*/ */

View file

@ -608,10 +608,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
*/ */
public boolean isDefault() public boolean isDefault()
{ {
if (!default_)
{
default_ = (getType().equals(DEFAULT_TYPE));
}
return default_; return default_;
} }

View file

@ -23,6 +23,7 @@ import org.eclipse.rse.filters.ISystemFilter;
import org.eclipse.rse.filters.ISystemFilterContainer; import org.eclipse.rse.filters.ISystemFilterContainer;
import org.eclipse.rse.filters.ISystemFilterContainerReference; import org.eclipse.rse.filters.ISystemFilterContainerReference;
import org.eclipse.rse.filters.ISystemFilterPool; import org.eclipse.rse.filters.ISystemFilterPool;
import org.eclipse.rse.filters.ISystemFilterPoolManager;
import org.eclipse.rse.filters.ISystemFilterPoolReference; import org.eclipse.rse.filters.ISystemFilterPoolReference;
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
@ -31,24 +32,44 @@ import org.eclipse.rse.internal.references.SystemPersistableReferencingObject;
import org.eclipse.rse.references.ISystemPersistableReferencedObject; import org.eclipse.rse.references.ISystemPersistableReferencedObject;
/** /**
* A shadow object of a master filter pool * A reference to a filter pool. A reference may be "resolved" or "unresolved".
*/
/**
* @lastgen class SystemFilterPoolReferenceImpl extends SystemPersistableReferencingObjectImpl implements SystemFilterPoolReference, SystemFilterContainerReference, IAdaptable {}
*/ */
public class SystemFilterPoolReference extends SystemPersistableReferencingObject implements ISystemFilterPoolReference, ISystemFilterContainerReference, IAdaptable { public class SystemFilterPoolReference extends SystemPersistableReferencingObject implements ISystemFilterPoolReference, ISystemFilterContainerReference, IAdaptable {
private SystemFilterContainerReferenceCommonMethods containerHelper = null; private SystemFilterContainerReferenceCommonMethods containerHelper = null;
private ISystemFilterPoolManager filterPoolManager = null;
protected static final String DELIMITER = "___"; protected static final String DELIMITER = "___";
protected static final int DELIMITER_LENGTH = 3; protected static final int DELIMITER_LENGTH = 3;
/** /**
* Default constructor. Typically called by MOF factory method. * Default constructor.
*/ */
protected SystemFilterPoolReference() { private SystemFilterPoolReference() {
super(); super();
containerHelper = new SystemFilterContainerReferenceCommonMethods(this); 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.
* It is resolved on first use by using the supplied filterPoolManager.
* @param filterPoolManager the manager used to resolve the reference.
* @param filterPoolName the name of the filter pool.
*/
public SystemFilterPoolReference(ISystemFilterPoolManager filterPoolManager, String filterPoolName) {
this();
this.filterPoolManager = filterPoolManager;
setReferencedObjectName(filterPoolName);
}
/** /**
* Return the reference manager which is managing this filter reference * Return the reference manager which is managing this filter reference
* framework object. * framework object.
@ -134,7 +155,9 @@ public class SystemFilterPoolReference extends SystemPersistableReferencingObjec
public ISystemFilterPool getReferencedFilterPool() { public ISystemFilterPool getReferencedFilterPool() {
ISystemFilterPool filterPool = (ISystemFilterPool) getReferencedObject(); ISystemFilterPool filterPool = (ISystemFilterPool) getReferencedObject();
if (filterPool == null) { if (filterPool == null) {
String filterPoolName = getReferencedFilterPoolName();
filterPool = filterPoolManager.getSystemFilterPool(filterPoolName);
setReferenceToFilterPool(filterPool);
} }
return filterPool; return filterPool;
} }

View file

@ -422,16 +422,27 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
} }
/** /**
* Create a filter pool referencing object, but do NOT add it to the list, do NOT call back. * Create a filter pool reference. This creates a raw reference that must be added to the managed
* lists by the caller.
*/ */
public ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPool filterPool) private ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPool filterPool) {
{ ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference(filterPool);
ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference();
// FIXME SystemFilterImpl.initMOF().createSystemFilterPoolReference();
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
filterPoolReference.setReferencedObject((ISystemPersistableReferencedObject)filterPool);
return filterPoolReference; 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.
*/
// DWD working
private ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPoolManager filterPoolManager, String filterPoolName) {
ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference(filterPoolManager, filterPoolName);
invalidateFilterPoolReferencesCache();
return filterPoolReference;
}
/** /**
* Add a filter pool referencing object to the list. * Add a filter pool referencing object to the list.
* @return the new count of referencing objects * @return the new count of referencing objects
@ -444,6 +455,7 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
quietSave(); quietSave();
return count; return count;
} }
/** /**
* Reset the filter pool a reference points to. Called on a move-filter-pool operation * Reset the filter pool a reference points to. Called on a move-filter-pool operation
*/ */
@ -575,22 +587,32 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
return (ISystemFilterPoolReference)super.getReferencedObject(filterPool); return (ISystemFilterPoolReference)super.getReferencedObject(filterPool);
} }
/** /* (non-Javadoc)
* Given a filter pool, create a referencing object and add it to the list. * @see org.eclipse.rse.filters.ISystemFilterPoolReferenceManager#addReferenceToSystemFilterPool(org.eclipse.rse.filters.ISystemFilterPool)
* Also add that reference to the filterPool itself, and calls back to provider when done.
* @param filterPool what to reference
* @return the new reference object
*/ */
public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool) public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool) {
{
ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPool); ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPool);
addReferencingObject(filterPoolReference); // DWD - should be done in addReferencingObject addReferencingObject(filterPoolReference); // DWD - should be done in addReferencingObject?
filterPoolReference.setParentReferenceManager(this); filterPoolReference.setParentReferenceManager(this);
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
quietSave(); quietSave();
// callback to provider so they can fire events in their GUI // callback to provider so they can fire events in their GUI
if (fireEvents && (caller != null)) if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceCreated(filterPoolReference);
caller.filterEventFilterPoolReferenceCreated(filterPoolReference); return filterPoolReference;
}
// DWD Working
/* (non-Javadoc)
* @see org.eclipse.rse.filters.ISystemFilterPoolReferenceManager#addReferenceToSystemFilterPool(org.eclipse.rse.filters.ISystemFilterPoolManager, java.lang.String)
*/
public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPoolManager filterPoolManager, String filterPoolName) {
ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPoolManager, filterPoolName);
addReferencingObject(filterPoolReference); // DWD - should be done in addReferencingObject?
filterPoolReference.setParentReferenceManager(this);
invalidateFilterPoolReferencesCache();
quietSave();
// callback to provider so they can fire events in their GUI
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceCreated(filterPoolReference);
return filterPoolReference; return filterPoolReference;
} }

View file

@ -208,7 +208,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
addHost(conn); // only record internally if saved successfully addHost(conn); // only record internally if saved successfully
conn.setHostPool(this); conn.setHostPool(this);
conn.setAliasName(aliasName); conn.setAliasName(aliasName);
// DWD if default userID is null, and location is in the connection we should retrieve it and use it as the initial value. // 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 == ISystemUserIdConstants.USERID_LOCATION_CONNECTION) { if (defaultUserId == null && defaultUserIdLocation == ISystemUserIdConstants.USERID_LOCATION_CONNECTION) {
defaultUserId = conn.getDefaultUserId(); defaultUserId = conn.getDefaultUserId();
} }

View file

@ -29,54 +29,18 @@ import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemResources; import org.eclipse.rse.ui.SystemResources;
//import java.lang.ClassCastException;
/** /**
* A profile represents a user or name which is used to key filter pools and * A profile contains hosts and filter pools. It is the unit of save/restore for RSE model
* connections by. * objects. All model objects are contained within a profile.
*/ */
public class SystemProfile extends RSEModelObject implements ISystemProfile, IAdaptable public class SystemProfile extends RSEModelObject implements ISystemProfile, 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 ISystemProfileManager mgr; private ISystemProfileManager mgr;
private boolean active; private boolean active;
private String name = null;
private boolean defaultPrivate = false;
/**
* @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 #isDefaultPrivate() <em>Default Private</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDefaultPrivate()
* @generated
* @ordered
*/
protected static final boolean DEFAULT_PRIVATE_EDEFAULT = false;
/**
* @generated This field/method will be replaced during code generation.
*/
protected boolean defaultPrivate = DEFAULT_PRIVATE_EDEFAULT;
/** /**
* Default constructor * Default constructor
*/ */
@ -84,6 +48,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
{ {
super(); super();
} }
/** /**
* Set the in-memory pointer back to the parent system profile manager * Set the in-memory pointer back to the parent system profile manager
*/ */
@ -91,6 +56,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
{ {
this.mgr = mgr; this.mgr = mgr;
} }
/** /**
* Get the in-memory pointer back to the parent system profile manager * Get the in-memory pointer back to the parent system profile manager
*/ */
@ -115,6 +81,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
{ {
return RSEUIPlugin.getTheSystemRegistry().getHostsByProfile(this); return RSEUIPlugin.getTheSystemRegistry().getHostsByProfile(this);
} }
/** /**
* Return all filter pools for this profile * Return all filter pools for this profile
*/ */
@ -129,7 +96,6 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
for (int ydx=0; ydx<pools.length; ydx++) for (int ydx=0; ydx<pools.length; ydx++)
{ {
poolsVector.add(pools[ydx]); poolsVector.add(pools[ydx]);
//System.out.println("Filter pool: "+pools[ydx].getName()+", profile = "+pools[ydx].getProvider().get)
} }
} }
ISystemFilterPool[] allPools = new ISystemFilterPool[poolsVector.size()]; ISystemFilterPool[] allPools = new ISystemFilterPool[poolsVector.size()];
@ -137,6 +103,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
allPools[idx] = (ISystemFilterPool)poolsVector.elementAt(idx); allPools[idx] = (ISystemFilterPool)poolsVector.elementAt(idx);
return allPools; return allPools;
} }
/** /**
* Return all filter pools for this profile, scoped by a given subsystem factory * Return all filter pools for this profile, scoped by a given subsystem factory
*/ */
@ -145,17 +112,18 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
ISystemFilterPoolManager poolMgr = ssf.getFilterPoolManager(this); ISystemFilterPoolManager poolMgr = ssf.getFilterPoolManager(this);
return poolMgr.getSystemFilterPools(); return poolMgr.getSystemFilterPools();
} }
/** /**
* Return true if this profile is currently active for this user * Return true if this profile is currently active.
*/ */
public boolean isActive() public boolean isActive()
{ {
return active; return active;
} }
/** /**
* Reset whether this proifle is currently active for this user. * Reset whether this profile is currently active.
*/ */
protected void setActive(boolean active) public void setActive(boolean active)
{ {
this.active = active; this.active = active;
} }
@ -171,14 +139,20 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
} }
public String toString() public String toString() {
{ String result = getName();
String name = getName(); if (result == null) {
if (name != null) StringBuffer buf = new StringBuffer(super.toString());
return name; buf.append("Profile(name: ");
else buf.append(name);
return this.toStringGen(); buf.append(", defaultPrivate: ");
buf.append(defaultPrivate);
buf.append(')');
result = buf.toString();
} }
return result;
}
/** /**
* @generated This field/method will be replaced during code generation * @generated This field/method will be replaced during code generation
*/ */
@ -200,22 +174,6 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
name = newName; name = newName;
} }
/**
* @generated This field/method will be replaced during code generation.
*/
public String toStringGen()
{
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", defaultPrivate: ");
result.append(defaultPrivate);
result.append(')');
return result.toString();
}
/** /**
* @generated This field/method will be replaced during code generation * @generated This field/method will be replaced during code generation
* Is this profile created automatically, and is it the profile * Is this profile created automatically, and is it the profile

View file

@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.SystemPreferencesManager; import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.SystemResourceManager; import org.eclipse.rse.core.SystemResourceManager;
@ -30,23 +31,16 @@ import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.validators.ISystemValidator; import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorProfileName; import org.eclipse.rse.ui.validators.ValidatorProfileName;
//
//
/** /**
* A class that manages a list of SystemProfile objects. * A class that manages a list of SystemProfile objects.
* We use this as a singleton. * This should be used as a singleton.
*/ */
/**
* @lastgen class SystemProfileManagerImpl Impl implements SystemProfileManager, EObject {}
*/
public class SystemProfileManager implements ISystemProfileManager public class SystemProfileManager implements ISystemProfileManager
{ {
private List _profiles = null; private List _profiles = null;
private String[] profileNames = null; private String[] profileNames = null;
private Vector profileNamesVector = null; private Vector profileNamesVector = null;
private static ISystemProfileManager defaultInst = null; private static ISystemProfileManager singleton = null;
private static final String PROFILE_FILE_NAME = "profile"; private static final String PROFILE_FILE_NAME = "profile";
/** /**
@ -61,15 +55,29 @@ public class SystemProfileManager implements ISystemProfileManager
*/ */
public static ISystemProfileManager getSystemProfileManager() public static ISystemProfileManager getSystemProfileManager()
{ {
if (defaultInst == null) if (singleton == null)
{ {
singleton = new SystemProfileManager();
defaultInst = new SystemProfileManager(); RSEUIPlugin.getThePersistenceManager().restore(singleton); // restores all of RSE
// restores all of RSE
RSEUIPlugin.getThePersistenceManager().restore(defaultInst);
} }
return defaultInst; return singleton;
}
/**
* @return the name of the default private system profile.
*/
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");
}
return name;
} }
/** /**
@ -77,7 +85,7 @@ public class SystemProfileManager implements ISystemProfileManager
*/ */
public static void clearDefault() public static void clearDefault()
{ {
defaultInst = null; singleton = null;
} }
/** /**
@ -96,8 +104,7 @@ public class SystemProfileManager implements ISystemProfileManager
ISystemProfile existingProfile = getSystemProfile(name); ISystemProfile existingProfile = getSystemProfile(name);
if (existingProfile != null) if (existingProfile != null)
{ {
// replace the existing one with a new profile deleteSystemProfile(existingProfile); // replace the existing one with a new profile
deleteSystemProfile(existingProfile);
} }
ISystemProfile newProfile = internalCreateSystemProfileAndFolder(name); ISystemProfile newProfile = internalCreateSystemProfileAndFolder(name);
@ -132,7 +139,7 @@ public class SystemProfileManager implements ISystemProfileManager
// FIXME initMOF().createSystemProfile(); // FIXME initMOF().createSystemProfile();
initialize(profile, name); initialize(profile, name);
profile.setDefaultPrivate(name.equalsIgnoreCase("Private")); profile.setDefaultPrivate(name.equalsIgnoreCase(getDefaultPrivateSystemProfileName()));
//System.out.println("initializing new profile " + name + ", is default private? " + profile.isDefaultPrivate()); //System.out.println("initializing new profile " + name + ", is default private? " + profile.isDefaultPrivate());
return profile; return profile;
} }
@ -143,7 +150,7 @@ public class SystemProfileManager implements ISystemProfileManager
private ISystemProfile internalCreateSystemProfileAndFolder(String name) private ISystemProfile internalCreateSystemProfileAndFolder(String name)
{ {
ISystemProfile profile = internalCreateSystemProfile(name); ISystemProfile profile = internalCreateSystemProfile(name);
SystemResourceManager.getProfileFolder(profile); // creates proj/profileName folder // SystemResourceManager.getProfileFolder(profile); // creates proj/profileName folder DWD This is where those pesky folders get created
return profile; return profile;
} }
@ -183,14 +190,7 @@ public class SystemProfileManager implements ISystemProfileManager
for (int idx=0; (!defaultProfileExist) && (idx<profiles.size()); idx++) for (int idx=0; (!defaultProfileExist) && (idx<profiles.size()); idx++)
{ {
ISystemProfile profile = (ISystemProfile)profiles.get(idx); ISystemProfile profile = (ISystemProfile)profiles.get(idx);
String initProfileName = RSEUIPlugin.getLocalMachineName(); String initProfileName = getDefaultPrivateSystemProfileName();
int dotIndex = initProfileName.indexOf('.');
if (dotIndex != -1)
{
initProfileName = initProfileName.substring(0, dotIndex);
}
if (profile.getName().equalsIgnoreCase(initProfileName)) if (profile.getName().equalsIgnoreCase(initProfileName))
{ {
profile.setDefaultPrivate(true); profile.setDefaultPrivate(true);
@ -395,15 +395,17 @@ public class SystemProfileManager implements ISystemProfileManager
boolean found_team = false; boolean found_team = false;
boolean found_private = false; boolean found_private = false;
boolean changed = false; boolean changed = false;
String defaultProfileName = getDefaultPrivateSystemProfileName();
for (int activeIdx = 0; activeIdx < activeProfileNames.length; activeIdx++) for (int activeIdx = 0; activeIdx < activeProfileNames.length; activeIdx++)
{ {
// skip Team and Private profiles // skip Team and Private profiles
if (RSEUIPlugin.getLocalMachineName().equals(activeProfileNames[activeIdx])) String activeProfileName = activeProfileNames[activeIdx];
if (activeProfileName.equals(defaultProfileName))
{ {
found_private = true; found_private = true;
} }
else if (ISystemPreferencesConstants.DEFAULT_TEAMPROFILE.equals(activeProfileNames[activeIdx])) else if (activeProfileName.equals(ISystemPreferencesConstants.DEFAULT_TEAMPROFILE))
{ {
found_team = true; found_team = true;
} }
@ -446,7 +448,7 @@ public class SystemProfileManager implements ISystemProfileManager
if (systemProfiles[systemIdx].isActive() || systemProfiles[systemIdx].isDefaultPrivate()) if (systemProfiles[systemIdx].isActive() || systemProfiles[systemIdx].isDefaultPrivate())
{ {
SystemPreferencesManager.getPreferencesManager().addActiveProfile(name); SystemPreferencesManager.getPreferencesManager().addActiveProfile(name);
SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(RSEUIPlugin.getLocalMachineName()); SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(RSECorePlugin.getLocalMachineName());
activeProfileNames = SystemPreferencesManager.getPreferencesManager().getActiveProfileNames(); activeProfileNames = SystemPreferencesManager.getPreferencesManager().getActiveProfileNames();
} }
} }
@ -469,7 +471,7 @@ public class SystemProfileManager implements ISystemProfileManager
if (!found_private) if (!found_private)
{ {
SystemPreferencesManager.getPreferencesManager().addActiveProfile(RSEUIPlugin.getLocalMachineName()); SystemPreferencesManager.getPreferencesManager().addActiveProfile(RSECorePlugin.getLocalMachineName());
changed = true; changed = true;
} }
} }
@ -517,13 +519,14 @@ public class SystemProfileManager implements ISystemProfileManager
} }
return pos; return pos;
} }
/** /**
* Return the default private profile created at first touch. * Return the default private profile created at first touch.
* Will return null if it has been renamed! * Will return null if it has been renamed!
*/ */
public ISystemProfile getDefaultPrivateSystemProfile() public ISystemProfile getDefaultPrivateSystemProfile()
{ {
return getSystemProfile(RSEUIPlugin.getLocalMachineName()); return getSystemProfile(getDefaultPrivateSystemProfileName());
} }
/** /**
* Return the default team profile created at first touch. * Return the default team profile created at first touch.
@ -630,13 +633,7 @@ public class SystemProfileManager implements ISystemProfileManager
if (_profiles == null) if (_profiles == null)
{ {
ISystemProfile profile = new SystemProfile(); ISystemProfile profile = new SystemProfile();
String initProfileName = RSEUIPlugin.getLocalMachineName(); String initProfileName = getDefaultPrivateSystemProfileName();
int dotIndex = initProfileName.indexOf('.');
if (dotIndex != -1)
{
initProfileName = initProfileName.substring(0, dotIndex);
}
profile.setName(initProfileName); profile.setName(initProfileName);
profile.setDefaultPrivate(true); profile.setDefaultPrivate(true);
_profiles = new ArrayList(); _profiles = new ArrayList();

View file

@ -319,7 +319,7 @@ public class RSEPersistenceManager implements IRSEPersistenceManager
ISystemFilterPoolManager mgr = SystemFilterPoolManager.createManager(profile); ISystemFilterPoolManager mgr = SystemFilterPoolManager.createManager(profile);
((SystemFilterPoolManager)mgr).initialize(logger,caller,name); // core data ((SystemFilterPoolManager)mgr).initialize(logger,caller,name); // core data
mgr.setWasRestored(false); // DWD let's try this
return mgr; return mgr;
} }

View file

@ -244,7 +244,7 @@ public class RSEDOMImporter implements IRSEDOMImporter
String type = subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); String type = subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
boolean isHidden = getBooleanValue(subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN).getValue()); boolean isHidden = getBooleanValue(subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN).getValue());
ISubSystem subSystem = null; ISubSystem subSystem = null;
ISubSystemConfiguration factory = getFactoryFor(type); ISubSystemConfiguration factory = getSubsystemConfiguration(type);
if (factory != null) if (factory != null)
{ {
if (factory instanceof IServiceSubSystemConfiguration) if (factory instanceof IServiceSubSystemConfiguration)
@ -275,9 +275,10 @@ public class RSEDOMImporter implements IRSEDOMImporter
subSystem.setHidden(isHidden); subSystem.setHidden(isHidden);
subSystem.setHost(host); subSystem.setHost(host);
subSystem.setSubSystemConfiguration(factory); subSystem.setSubSystemConfiguration(factory);
subSystem.setName(factory.getName());
subSystem.setConfigurationId(factory.getId());
subSystem.setWasRestored(true); subSystem.setWasRestored(true);
if (factory.supportsFilters()) if (factory.supportsFilters())
{ {
ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.createSystemFilterPoolReferenceManager(subSystem, factory, name, new SubSystemFilterNamingPolicy()); ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.createSystemFilterPoolReferenceManager(subSystem, factory, name, new SubSystemFilterNamingPolicy());
@ -394,7 +395,7 @@ public class RSEDOMImporter implements IRSEDOMImporter
// create the filter pool and set it's attributes // create the filter pool and set it's attributes
try try
{ {
ISubSystemConfiguration factory = getFactoryFor(id); ISubSystemConfiguration factory = getSubsystemConfiguration(id);
if (factory != null) if (factory != null)
{ {
ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile); ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile);
@ -462,30 +463,28 @@ public class RSEDOMImporter implements IRSEDOMImporter
/** /**
* Restore the filter pool reference that is represented by the node * Restore the filter pool reference that is represented by the node
*/ */
public ISystemFilterPoolReference restoreFilterPoolReference(ISubSystem subSystem, RSEDOMNode node) public ISystemFilterPoolReference restoreFilterPoolReference(ISubSystem subsystem, RSEDOMNode node) {
{
ISystemFilterPoolReference filterPoolReference = null; ISystemFilterPoolReference filterPoolReference = null;
String refID = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID).getValue(); String subsystemName = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID).getValue();
String name = node.getName(); String filterPoolName = node.getName();
ISubSystemConfiguration configuration = getSubsystemConfiguration(subsystemName);
// find referenced filter pool if (configuration != null) {
ISubSystemConfiguration factory = getFactoryFor(refID); ISystemProfile profile = subsystem.getSystemProfile(); // DWD are there cases where this may be null?
if (factory != null) ISystemFilterPoolManager filterPoolManager = configuration.getFilterPoolManager(profile);
{ ISystemFilterPool filterPool = filterPoolManager.getSystemFilterPool(filterPoolName);
ISystemFilterPoolManager filterPoolManager = factory.getFilterPoolManager(subSystem.getSystemProfile()); ISystemFilterPoolReferenceManager referenceManager = subsystem.getFilterPoolReferenceManager();
ISystemFilterPool filterPool = filterPoolManager.getSystemFilterPool(name);
/* /*
* DWD filterpool can be null when restoring since there can be forward references. * DWD filterpool can be null when restoring since there can be forward references.
* A profile may be being restored that has references to a filter pool in a profile that doesn't yet exist. * A profile may be being restored that has references to a filter pool in a profile that doesn't yet exist.
* Need to create an "unresolved" reference instead of a null object and then patch them up * Need to create an "unresolved" reference instead of a null object and then patch them up
* at the end. * at the end.
*/ */
if (filterPool != null) { // for the time being don't restore a reference if the pool isn't found.
// create reference to the filterpool // create reference to the filterpool
ISystemFilterPoolReferenceManager referenceManager = subSystem.getFilterPoolReferenceManager(); if (filterPool != null) {
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPool); filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPool);
} else {
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPoolManager, filterPoolName);
} }
} }
return filterPoolReference; return filterPoolReference;
} }
@ -532,8 +531,13 @@ public class RSEDOMImporter implements IRSEDOMImporter
return Integer.parseInt(integerString); return Integer.parseInt(integerString);
} }
private ISubSystemConfiguration getFactoryFor(String id) /**
* 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 RSEUIPlugin.getTheSystemRegistry().getSubSystemConfiguration(id); return RSEUIPlugin.getTheSystemRegistry().getSubSystemConfiguration(subsystemName);
} }
} }

View file

@ -16,157 +16,73 @@
package org.eclipse.rse.internal.references; package org.eclipse.rse.internal.references;
import org.eclipse.rse.internal.filters.SystemFilterPoolReferenceManager;
import org.eclipse.rse.references.ISystemBasePersistableReferenceManager; import org.eclipse.rse.references.ISystemBasePersistableReferenceManager;
import org.eclipse.rse.references.ISystemBasePersistableReferencedObject; import org.eclipse.rse.references.ISystemBasePersistableReferencedObject;
import org.eclipse.rse.references.ISystemBaseReferencedObject; import org.eclipse.rse.references.ISystemBaseReferencedObject;
import org.eclipse.rse.references.ISystemPersistableReferencingObject; import org.eclipse.rse.references.ISystemPersistableReferencingObject;
/** /**
* This class represents a object that references another object, where this reference * This class represents an object that references another object in the model.
* is persistable to disk. * The reference is persistable.
* @see org.eclipse.rse.references.ISystemBasePersistableReferenceManager * <p>
* @lastgen class SystemPersistableReferencingObjectImpl extends SystemReferencingObjectImpl implements SystemPersistableReferencingObject, SystemReferencingObject {} * @see org.eclipse.rse.references.ISystemPersistableReferencingObject
*/ */
public abstract class SystemPersistableReferencingObject extends SystemReferencingObject implements ISystemPersistableReferencingObject // DWD Change this name to SystemPersistableReference? Ditto for the interface.
{ public abstract class SystemPersistableReferencingObject extends SystemReferencingObject implements ISystemPersistableReferencingObject {
/**
* The default value of the '{@link #getReferencedObjectName() <em>Referenced Object Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReferencedObjectName()
* @generated
* @ordered
*/
protected static final String REFERENCED_OBJECT_NAME_EDEFAULT = null;
/** protected String referencedObjectName = null;
* @generated This field/method will be replaced during code generation.
*/
protected String referencedObjectName = REFERENCED_OBJECT_NAME_EDEFAULT;
// FIXME
protected ISystemBasePersistableReferenceManager _referenceManager; protected ISystemBasePersistableReferenceManager _referenceManager;
/** /**
* Constructor. Typically called by MOF framework via factory create method. * Create a new referencing object.
*/ */
protected SystemPersistableReferencingObject() protected SystemPersistableReferencingObject() {
{
super(); super();
helper = new SystemReferencingObjectHelper(this);
} }
/** /**
* Set the persistable referenced object name * Set the persistable referenced object name
* @generated This field/method will be replaced during code generation.
*/ */
public void setReferencedObjectName(String newReferencedObjectName) public void setReferencedObjectName(String newReferencedObjectName) {
{
referencedObjectName = newReferencedObjectName; referencedObjectName = newReferencedObjectName;
} }
// ----------------------------------------------
// ISystemPersistableReferencingObject methods...
// ----------------------------------------------
/** /**
* Set the in-memory reference to the master object. * Set the in-memory reference to the master object.
* This implementation also extracts that master object's name and calls * This implementation also extracts that master object's name and calls
* setReferencedObjectName as part of this method call. * setReferencedObjectName as part of this method call.
* @see org.eclipse.rse.references.ISystemBasePersistableReferencingObject#setReferencedObject(ISystemBasePersistableReferencedObject) * @see org.eclipse.rse.references.ISystemBasePersistableReferencingObject#setReferencedObject(ISystemBasePersistableReferencedObject)
*/ */
public void setReferencedObject(ISystemBasePersistableReferencedObject obj) public void setReferencedObject(ISystemBasePersistableReferencedObject obj) {
{ getHelper().setReferencedObject((ISystemBaseReferencedObject) obj);
helper.setReferencedObject((ISystemBaseReferencedObject)obj);
setReferencedObjectName(obj.getReferenceName()); setReferencedObjectName(obj.getReferenceName());
} }
/** /**
* Get the persistable referenced object name. Handled by MOF generated code. * Get the persistable referenced object name.
* @generated This field/method will be replaced during code generation
*/ */
public String getReferencedObjectName() public String getReferencedObjectName() {
{
return referencedObjectName; return referencedObjectName;
} }
// ----------------------------------------------
// ISystemReferencingObject methods...
// ----------------------------------------------
/** /**
* @see org.eclipse.rse.references.ISystemBaseReferencingObject#setReferencedObject(ISystemBaseReferencedObject) * @return The reference manager for this reference.
*/ */
public void setReferencedObject(ISystemBaseReferencedObject obj) public ISystemBasePersistableReferenceManager getParentReferenceManager() {
{
helper.setReferencedObject(obj);
}
/**
* @see org.eclipse.rse.references.ISystemBaseReferencingObject#getReferencedObject()
*/
public ISystemBaseReferencedObject getReferencedObject()
{
return helper.getReferencedObject();
}
/**
* @see org.eclipse.rse.references.ISystemBaseReferencingObject#removeReference()
*/
public int removeReference()
{
return helper.removeReference();
}
/**
* @generated This field/method will be replaced during code generation
*/
public ISystemBasePersistableReferenceManager getParentReferenceManager()
{
/*FIXME
if (eContainerFeatureID != ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER) return null;
return (SystemPersistableReferenceManager)eContainer;
*/
if (_referenceManager == null)
{
//SystemFilterPoolReferenceManagerImpl.createSystemFilterPoolReferenceManager(caller, relatedPoolManagerProvider, mgrFolder, name, savePolicy, namingPolicy)
_referenceManager = new SystemFilterPoolReferenceManager();
}
return _referenceManager; return _referenceManager;
} }
/** /**
* @generated This field/method will be replaced during code generation. * Sets the reference manager for this reference. Must be done when this reference is created.
*/
public void setParentReferenceManager(ISystemBasePersistableReferenceManager newParentReferenceManager)
{
/*FIXME
if (newParentReferenceManager != eContainer || (eContainerFeatureID != ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER && newParentReferenceManager != null))
{
if (EcoreUtil.isAncestor(this, newParentReferenceManager))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newParentReferenceManager != null)
msgs = ((InternalEObject)newParentReferenceManager).eInverseAdd(this, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCE_MANAGER__REFERENCING_OBJECT_LIST, SystemPersistableReferenceManager.class, msgs);
msgs = eBasicSetContainer((InternalEObject)newParentReferenceManager, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER, newParentReferenceManager, newParentReferenceManager));
*/ */
public void setParentReferenceManager(ISystemBasePersistableReferenceManager newParentReferenceManager) {
_referenceManager = newParentReferenceManager; _referenceManager = newParentReferenceManager;
return;
} }
/** /* (non-Javadoc)
* @generated This field/method will be replaced during code generation. * @see java.lang.Object#toString()
*/ */
public String toString() public String toString() {
{
StringBuffer result = new StringBuffer(super.toString()); StringBuffer result = new StringBuffer(super.toString());
result.append(" (referencedObjectName: "); result.append(" (referencedObjectName: ");
result.append(referencedObjectName); result.append(referencedObjectName);

View file

@ -37,7 +37,7 @@ import org.eclipse.rse.ui.SystemResources;
*/ */
public abstract class SystemReferencingObject extends RSEModelObject implements ISystemReferencingObject public abstract class SystemReferencingObject extends RSEModelObject implements ISystemReferencingObject
{ {
protected SystemReferencingObjectHelper helper = null; private SystemReferencingObjectHelper helper = null;
protected boolean referenceBroken = false; protected boolean referenceBroken = false;
/** /**
@ -91,4 +91,8 @@ public abstract class SystemReferencingObject extends RSEModelObject implements
{ {
return SystemResources.RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION; return SystemResources.RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION;
} }
protected final SystemReferencingObjectHelper getHelper() {
return helper;
}
} }

View file

@ -1891,7 +1891,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
getFilterPoolManagerName(profile), // the filter pool manager name getFilterPoolManagerName(profile), // the filter pool manager name
supportsNestedFilters(), // whether or not nested filters are allowed supportsNestedFilters(), // whether or not nested filters are allowed
ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy); ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy);
mgr.setSingleFilterStringOnly(!supportsMultipleFilterStrings()); mgr.setSingleFilterStringOnly(!supportsMultipleFilterStrings()); // DWD was restored flag?
} }
catch (Exception exc) catch (Exception exc)
{ {