1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +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.Vector;
import org.eclipse.core.runtime.FileLocator;
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.ClientSSLProperties;
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.IDataStoreProvider;
import org.eclipse.dstore.core.model.ISSLProperties;
import org.eclipse.dstore.core.server.ServerLauncher;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.connectorservice.dstore.util.ConnectionStatusListener;
import org.eclipse.rse.connectorservice.dstore.util.StatusMonitor;
import org.eclipse.rse.connectorservice.dstore.util.StatusMonitorFactory;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.comm.ISystemKeystoreProvider;
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.Shell;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
/**
* System class required by the remote systems framework.
* 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
// this may be incorrect for the server in certain cases
// like over VPN
return RSEUIPlugin.getLocalMachineIPAddress();
return RSECorePlugin.getLocalMachineIPAddress();
}
/**
@ -355,12 +355,12 @@ public class DStoreConnectorService extends AbstractConnectorService implements
try
{
String path = Platform.resolve(pluginsURL).getPath();
String path = FileLocator.resolve(pluginsURL).getPath();
File systemsPluginDir = new File(path);
path = systemsPluginDir.getParentFile().getAbsolutePath();
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);
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
DataElement ticket = dataStore.createTicket(launchStatus.getTicket());
DataElement ticketStatus = dataStore.queryShowTicket(ticket);
dataStore.queryShowTicket(ticket);
//statusMonitor.waitForUpdate(ticketStatus);
}
else
@ -834,7 +834,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
{
if (launchStatus.isSLLProblem())
{
Throwable exception = launchStatus.getException();
launchStatus.getException();
List certs = launchStatus.getUntrustedCertificates();
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.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.Window;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
@ -579,7 +580,7 @@ public class SshConnectorService extends AbstractConnectorService implements ISs
UserValidationDialog uvd = new UserValidationDialog(null, null,
fUser, message);
uvd.setUsernameMutable(false);
if (uvd.open() == uvd.OK) {
if (uvd.open() == Window.OK) {
retval[0] = uvd.getPassword();
} else {
retval[0] = null;

View file

@ -15,7 +15,12 @@
********************************************************************************/
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.Status;
import org.eclipse.rse.core.internal.RSECoreRegistry;
import org.osgi.framework.BundleContext;
@ -27,6 +32,32 @@ public class RSECorePlugin extends Plugin {
// the shared instance
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.
*/
@ -65,4 +96,10 @@ public class RSECorePlugin extends Plugin {
public IRSECoreRegistry getRegistry() {
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.rse.core.IRSESystemType;
import org.eclipse.rse.core.ISystemViewSupplier;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.SystemPropertyPageExtension;
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.SystemRegistry;
import org.eclipse.rse.internal.persistence.RSEPersistenceManager;
import org.eclipse.rse.model.ISystemProfile;
import org.eclipse.rse.model.ISystemProfileManager;
import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.model.ISystemResourceChangeEvents;
@ -89,8 +91,6 @@ public class RSEUIPlugin extends SystemBasePlugin
private ISubSystemConfigurationProxy[] subsystemFactories = null;
private static String machineName = null;
private static String machineIP = null;
private Vector viewSuppliers = new Vector();
private SystemViewAdapterFactory svaf; // for fastpath access
private SystemTeamViewResourceAdapterFactory svraf; // for fastpath
@ -559,12 +559,13 @@ public class RSEUIPlugin extends SystemBasePlugin
registerKeystoreProviders();
// if first time creating the remote systems project, add some default connections...
if (SystemResourceManager.isFirstTime()
&& !dontShowLocalConnection) // new support to allow products to not pre-create a local connection
{
// if (SystemResourceManager.isFirstTime()
// && !dontShowLocalConnection) // new support to allow products to not pre-create a local connection
// {
//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
SystemConnection localConn = registry.createConnection(
//SystemResourceConstants.RESOURCE_TEAMPROFILE_NAME, IRSESystemType.SYSTEMTYPE_LOCAL,
@ -582,6 +583,13 @@ public class RSEUIPlugin extends SystemBasePlugin
//{
//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 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
*/

View file

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

View file

@ -16,6 +16,8 @@
package org.eclipse.rse.ui.wizards;
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.RSEUIPlugin;
import org.eclipse.rse.ui.SystemProfileForm;
@ -82,16 +84,8 @@ public class SystemNewConnectionWizardRenameProfilePage
{
Control c = form.createContents(parent);
form.getInitialFocusControl().setFocus();
String initProfileName = RSEUIPlugin.getLocalMachineName();
int dotIndex = initProfileName.indexOf('.');
if (dotIndex != -1) {
initProfileName = initProfileName.substring(0, dotIndex);
}
String initProfileName = SystemProfileManager.getDefaultPrivateSystemProfileName();
form.setProfileName(initProfileName);
return c;
}
/**

View file

@ -15,13 +15,13 @@
********************************************************************************/
package org.eclipse.rse.filters;
import java.util.Vector;
import org.eclipse.core.resources.IFolder;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.references.ISystemBasePersistableReferenceManager;
/**
* This class manages a persistable list of objects each of which reference
* a filter pool. This class builds on the parent class SystemPersistableReferenceManager,
@ -31,238 +31,267 @@ import org.eclipse.rse.references.ISystemBasePersistableReferenceManager;
/**
* @lastgen interface SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager {}
*/
public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistableReferenceManager
{
/**
* 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();
/**
public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistableReferenceManager {
/**
* 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
* <p> Calls back to inform provider
* @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,
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);
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 filterPool Reference 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);
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 newPosition new zero-based position for 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
/**
* 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 newPosition new zero-based position for 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();
*/
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
* <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 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.
* <p> Calls back to inform provider
* <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);
/**
* 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
* <p> Calls back to inform provider
* @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,
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 relatedManagers 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;
public void setSystemFilterPoolReferences(ISystemFilterPool[] filterPools, boolean deReference);
/**
* 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);
// -------------------------
// 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 relatedManagers 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);
}

View file

@ -608,10 +608,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
*/
public boolean isDefault()
{
if (!default_)
{
default_ = (getType().equals(DEFAULT_TYPE));
}
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.ISystemFilterContainerReference;
import org.eclipse.rse.filters.ISystemFilterPool;
import org.eclipse.rse.filters.ISystemFilterPoolManager;
import org.eclipse.rse.filters.ISystemFilterPoolReference;
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
@ -31,23 +32,43 @@ import org.eclipse.rse.internal.references.SystemPersistableReferencingObject;
import org.eclipse.rse.references.ISystemPersistableReferencedObject;
/**
* A shadow object of a master filter pool
*/
/**
* @lastgen class SystemFilterPoolReferenceImpl extends SystemPersistableReferencingObjectImpl implements SystemFilterPoolReference, SystemFilterContainerReference, IAdaptable {}
* 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;
protected static final String DELIMITER = "___";
protected static final int DELIMITER_LENGTH = 3;
/**
* Default constructor. Typically called by MOF factory method.
* Default constructor.
*/
protected SystemFilterPoolReference() {
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.
* 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
@ -82,7 +103,7 @@ public class SystemFilterPoolReference extends SystemPersistableReferencingObjec
/**
* Return name of the filter pool we reference
* The name is stored qualified by the manager name,
* so we first have to strip that off.
* so we first have to strip that off.
*/
public String getReferencedFilterPoolName() {
String savedName = super.getReferencedObjectName();
@ -134,7 +155,9 @@ public class SystemFilterPoolReference extends SystemPersistableReferencingObjec
public ISystemFilterPool getReferencedFilterPool() {
ISystemFilterPool filterPool = (ISystemFilterPool) getReferencedObject();
if (filterPool == null) {
String filterPoolName = getReferencedFilterPoolName();
filterPool = filterPoolManager.getSystemFilterPool(filterPoolName);
setReferenceToFilterPool(filterPool);
}
return filterPool;
}

View file

@ -49,19 +49,19 @@ import org.eclipse.rse.references.ISystemPersistableReferencedObject;
public class SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager implements ISystemFilterPoolReferenceManager
{
//private SystemFilterPoolManager[] poolMgrs = null;
private ISystemFilterPoolManagerProvider poolMgrProvider = null;
private ISystemFilterPoolManager defaultPoolMgr = null;
private ISystemFilterPoolManagerProvider poolMgrProvider = null;
private ISystemFilterPoolManager defaultPoolMgr = null;
private ISystemFilterPoolReferenceManagerProvider caller = null;
private ISystemFilterNamingPolicy 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];
private ISystemFilterNamingPolicy 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.
@ -422,17 +422,28 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
}
/**
* Create a filter pool referencing object, but do NOT add it to the list, do NOT call back.
*/
public ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPool filterPool)
{
ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference();
// FIXME SystemFilterImpl.initMOF().createSystemFilterPoolReference();
invalidateFilterPoolReferencesCache();
filterPoolReference.setReferencedObject((ISystemPersistableReferencedObject)filterPool);
* 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.
*/
// 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.
* @return the new count of referencing objects
*/
@ -444,6 +455,7 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
quietSave();
return count;
}
/**
* 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);
}
/**
* Given a filter pool, create a referencing object and add it to the list.
* 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
/* (non-Javadoc)
* @see org.eclipse.rse.filters.ISystemFilterPoolReferenceManager#addReferenceToSystemFilterPool(org.eclipse.rse.filters.ISystemFilterPool)
*/
public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool)
{
public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool) {
ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPool);
addReferencingObject(filterPoolReference); // DWD - should be done in addReferencingObject
addReferencingObject(filterPoolReference); // DWD - should be done in addReferencingObject?
filterPoolReference.setParentReferenceManager(this);
invalidateFilterPoolReferencesCache();
invalidateFilterPoolReferencesCache();
quietSave();
// callback to provider so they can fire events in their GUI
if (fireEvents && (caller != null))
caller.filterEventFilterPoolReferenceCreated(filterPoolReference);
if (fireEvents && (caller != null)) 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;
}

View file

@ -208,7 +208,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
addHost(conn); // only record internally if saved successfully
conn.setHostPool(this);
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) {
defaultUserId = conn.getDefaultUserId();
}

View file

@ -29,61 +29,26 @@ import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.ui.RSEUIPlugin;
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
* connections by.
* 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
{
/**
* 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 boolean active;
/**
* @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;
private String name = null;
private boolean defaultPrivate = false;
/**
* @generated This field/method will be replaced during code generation.
*/
protected boolean defaultPrivate = DEFAULT_PRIVATE_EDEFAULT;
/**
* Default constructor
*/
protected SystemProfile()
{
super();
}
/**
* 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;
}
/**
* 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 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++)
{
poolsVector.add(pools[ydx]);
//System.out.println("Filter pool: "+pools[ydx].getName()+", profile = "+pools[ydx].getProvider().get)
}
}
ISystemFilterPool[] allPools = new ISystemFilterPool[poolsVector.size()];
@ -137,6 +103,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
allPools[idx] = (ISystemFilterPool)poolsVector.elementAt(idx);
return allPools;
}
/**
* 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);
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()
{
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;
}
@ -171,14 +139,20 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
}
public String toString()
{
String name = getName();
if (name != null)
return name;
else
return this.toStringGen();
}
public String toString() {
String result = getName();
if (result == null) {
StringBuffer buf = new StringBuffer(super.toString());
buf.append("Profile(name: ");
buf.append(name);
buf.append(", defaultPrivate: ");
buf.append(defaultPrivate);
buf.append(')');
result = buf.toString();
}
return result;
}
/**
* @generated This field/method will be replaced during code generation
*/
@ -200,22 +174,6 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
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
* 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.Vector;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.SystemPreferencesManager;
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.ValidatorProfileName;
//
//
/**
* 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
{
private List _profiles = null;
private String[] profileNames = null;
private Vector profileNamesVector = null;
private static ISystemProfileManager defaultInst = null;
private static ISystemProfileManager singleton = null;
private static final String PROFILE_FILE_NAME = "profile";
/**
@ -61,15 +55,29 @@ public class SystemProfileManager implements ISystemProfileManager
*/
public static ISystemProfileManager getSystemProfileManager()
{
if (defaultInst == null)
if (singleton == null)
{
defaultInst = new SystemProfileManager();
// restores all of RSE
RSEUIPlugin.getThePersistenceManager().restore(defaultInst);
singleton = new SystemProfileManager();
RSEUIPlugin.getThePersistenceManager().restore(singleton); // restores all of RSE
}
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()
{
defaultInst = null;
singleton = null;
}
/**
@ -96,8 +104,7 @@ public class SystemProfileManager implements ISystemProfileManager
ISystemProfile existingProfile = getSystemProfile(name);
if (existingProfile != null)
{
// replace the existing one with a new profile
deleteSystemProfile(existingProfile);
deleteSystemProfile(existingProfile); // replace the existing one with a new profile
}
ISystemProfile newProfile = internalCreateSystemProfileAndFolder(name);
@ -132,7 +139,7 @@ public class SystemProfileManager implements ISystemProfileManager
// FIXME initMOF().createSystemProfile();
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());
return profile;
}
@ -143,7 +150,7 @@ public class SystemProfileManager implements ISystemProfileManager
private ISystemProfile internalCreateSystemProfileAndFolder(String 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;
}
@ -183,14 +190,7 @@ public class SystemProfileManager implements ISystemProfileManager
for (int idx=0; (!defaultProfileExist) && (idx<profiles.size()); idx++)
{
ISystemProfile profile = (ISystemProfile)profiles.get(idx);
String initProfileName = RSEUIPlugin.getLocalMachineName();
int dotIndex = initProfileName.indexOf('.');
if (dotIndex != -1)
{
initProfileName = initProfileName.substring(0, dotIndex);
}
String initProfileName = getDefaultPrivateSystemProfileName();
if (profile.getName().equalsIgnoreCase(initProfileName))
{
profile.setDefaultPrivate(true);
@ -395,15 +395,17 @@ public class SystemProfileManager implements ISystemProfileManager
boolean found_team = false;
boolean found_private = false;
boolean changed = false;
String defaultProfileName = getDefaultPrivateSystemProfileName();
for (int activeIdx = 0; activeIdx < activeProfileNames.length; activeIdx++)
{
// skip Team and Private profiles
if (RSEUIPlugin.getLocalMachineName().equals(activeProfileNames[activeIdx]))
String activeProfileName = activeProfileNames[activeIdx];
if (activeProfileName.equals(defaultProfileName))
{
found_private = true;
}
else if (ISystemPreferencesConstants.DEFAULT_TEAMPROFILE.equals(activeProfileNames[activeIdx]))
else if (activeProfileName.equals(ISystemPreferencesConstants.DEFAULT_TEAMPROFILE))
{
found_team = true;
}
@ -446,7 +448,7 @@ public class SystemProfileManager implements ISystemProfileManager
if (systemProfiles[systemIdx].isActive() || systemProfiles[systemIdx].isDefaultPrivate())
{
SystemPreferencesManager.getPreferencesManager().addActiveProfile(name);
SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(RSEUIPlugin.getLocalMachineName());
SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(RSECorePlugin.getLocalMachineName());
activeProfileNames = SystemPreferencesManager.getPreferencesManager().getActiveProfileNames();
}
}
@ -469,7 +471,7 @@ public class SystemProfileManager implements ISystemProfileManager
if (!found_private)
{
SystemPreferencesManager.getPreferencesManager().addActiveProfile(RSEUIPlugin.getLocalMachineName());
SystemPreferencesManager.getPreferencesManager().addActiveProfile(RSECorePlugin.getLocalMachineName());
changed = true;
}
}
@ -517,13 +519,14 @@ public class SystemProfileManager implements ISystemProfileManager
}
return pos;
}
/**
* Return the default private profile created at first touch.
* Will return null if it has been renamed!
*/
public ISystemProfile getDefaultPrivateSystemProfile()
{
return getSystemProfile(RSEUIPlugin.getLocalMachineName());
return getSystemProfile(getDefaultPrivateSystemProfileName());
}
/**
* Return the default team profile created at first touch.
@ -630,13 +633,7 @@ public class SystemProfileManager implements ISystemProfileManager
if (_profiles == null)
{
ISystemProfile profile = new SystemProfile();
String initProfileName = RSEUIPlugin.getLocalMachineName();
int dotIndex = initProfileName.indexOf('.');
if (dotIndex != -1)
{
initProfileName = initProfileName.substring(0, dotIndex);
}
String initProfileName = getDefaultPrivateSystemProfileName();
profile.setName(initProfileName);
profile.setDefaultPrivate(true);
_profiles = new ArrayList();

View file

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

View file

@ -244,7 +244,7 @@ public class RSEDOMImporter implements IRSEDOMImporter
String type = subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
boolean isHidden = getBooleanValue(subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN).getValue());
ISubSystem subSystem = null;
ISubSystemConfiguration factory = getFactoryFor(type);
ISubSystemConfiguration factory = getSubsystemConfiguration(type);
if (factory != null)
{
if (factory instanceof IServiceSubSystemConfiguration)
@ -271,13 +271,14 @@ public class RSEDOMImporter implements IRSEDOMImporter
if (subSystem == null)
{
subSystem = factory.createSubSystemInternal(host);
}
}
subSystem.setHidden(isHidden);
subSystem.setHost(host);
subSystem.setSubSystemConfiguration(factory);
subSystem.setName(factory.getName());
subSystem.setConfigurationId(factory.getId());
subSystem.setWasRestored(true);
if (factory.supportsFilters())
{
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
try
{
ISubSystemConfiguration factory = getFactoryFor(id);
ISubSystemConfiguration factory = getSubsystemConfiguration(id);
if (factory != null)
{
ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile);
@ -462,31 +463,29 @@ public class RSEDOMImporter implements IRSEDOMImporter
/**
* 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;
String refID = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID).getValue();
String name = node.getName();
// find referenced filter pool
ISubSystemConfiguration factory = getFactoryFor(refID);
if (factory != null)
{
ISystemFilterPoolManager filterPoolManager = factory.getFilterPoolManager(subSystem.getSystemProfile());
ISystemFilterPool filterPool = filterPoolManager.getSystemFilterPool(name);
String subsystemName = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID).getValue();
String filterPoolName = node.getName();
ISubSystemConfiguration configuration = getSubsystemConfiguration(subsystemName);
if (configuration != null) {
ISystemProfile profile = subsystem.getSystemProfile(); // DWD are there cases where this may be null?
ISystemFilterPoolManager filterPoolManager = configuration.getFilterPoolManager(profile);
ISystemFilterPool filterPool = filterPoolManager.getSystemFilterPool(filterPoolName);
ISystemFilterPoolReferenceManager referenceManager = subsystem.getFilterPoolReferenceManager();
/*
* 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.
* Need to create an "unresolved" reference instead of a null object and then patch them up
* 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
ISystemFilterPoolReferenceManager referenceManager = subSystem.getFilterPoolReferenceManager();
// create reference to the filterpool
if (filterPool != null) {
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPool);
} else {
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPoolManager, filterPoolName);
}
}
}
return filterPoolReference;
}
@ -532,8 +531,13 @@ public class RSEDOMImporter implements IRSEDOMImporter
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;
import org.eclipse.rse.internal.filters.SystemFilterPoolReferenceManager;
import org.eclipse.rse.references.ISystemBasePersistableReferenceManager;
import org.eclipse.rse.references.ISystemBasePersistableReferencedObject;
import org.eclipse.rse.references.ISystemBaseReferencedObject;
import org.eclipse.rse.references.ISystemPersistableReferencingObject;
/**
* This class represents a object that references another object, where this reference
* is persistable to disk.
* @see org.eclipse.rse.references.ISystemBasePersistableReferenceManager
* @lastgen class SystemPersistableReferencingObjectImpl extends SystemReferencingObjectImpl implements SystemPersistableReferencingObject, SystemReferencingObject {}
* This class represents an object that references another object in the model.
* The reference is persistable.
* <p>
* @see org.eclipse.rse.references.ISystemPersistableReferencingObject
*/
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;
// DWD Change this name to SystemPersistableReference? Ditto for the interface.
public abstract class SystemPersistableReferencingObject extends SystemReferencingObject implements ISystemPersistableReferencingObject {
protected String referencedObjectName = null;
protected ISystemBasePersistableReferenceManager _referenceManager;
/**
* @generated This field/method will be replaced during code generation.
* Create a new referencing object.
*/
protected String referencedObjectName = REFERENCED_OBJECT_NAME_EDEFAULT;
// FIXME
protected ISystemBasePersistableReferenceManager _referenceManager;
/**
* Constructor. Typically called by MOF framework via factory create method.
*/
protected SystemPersistableReferencingObject()
{
protected SystemPersistableReferencingObject() {
super();
helper = new SystemReferencingObjectHelper(this);
}
/**
* Set the persistable referenced object name
* @generated This field/method will be replaced during code generation.
*/
public void setReferencedObjectName(String newReferencedObjectName)
{
* Set the persistable referenced object name
*/
public void setReferencedObjectName(String newReferencedObjectName) {
referencedObjectName = newReferencedObjectName;
}
// ----------------------------------------------
// ISystemPersistableReferencingObject methods...
// ----------------------------------------------
/**
* 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.
* 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.references.ISystemBasePersistableReferencingObject#setReferencedObject(ISystemBasePersistableReferencedObject)
*/
public void setReferencedObject(ISystemBasePersistableReferencedObject obj)
{
helper.setReferencedObject((ISystemBaseReferencedObject)obj);
setReferencedObjectName(obj.getReferenceName());
public void setReferencedObject(ISystemBasePersistableReferencedObject obj) {
getHelper().setReferencedObject((ISystemBaseReferencedObject) obj);
setReferencedObjectName(obj.getReferenceName());
}
/**
* Get the persistable referenced object name. Handled by MOF generated code.
* @generated This field/method will be replaced during code generation
* Get the persistable referenced object name.
*/
public String getReferencedObjectName()
{
public String getReferencedObjectName() {
return referencedObjectName;
}
// ----------------------------------------------
// ISystemReferencingObject methods...
// ----------------------------------------------
/**
* @see org.eclipse.rse.references.ISystemBaseReferencingObject#setReferencedObject(ISystemBaseReferencedObject)
* @return The reference manager for this reference.
*/
public void setReferencedObject(ISystemBaseReferencedObject obj)
{
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();
}
public ISystemBasePersistableReferenceManager getParentReferenceManager() {
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;
return;
}
/**
* @generated This field/method will be replaced during code generation.
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString()
{
public String toString() {
StringBuffer result = new StringBuffer(super.toString());
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
{
protected SystemReferencingObjectHelper helper = null;
private SystemReferencingObjectHelper helper = null;
protected boolean referenceBroken = false;
/**
@ -91,4 +91,8 @@ public abstract class SystemReferencingObject extends RSEModelObject implements
{
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
supportsNestedFilters(), // whether or not nested filters are allowed
ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy);
mgr.setSingleFilterStringOnly(!supportsMultipleFilterStrings());
mgr.setSingleFilterStringOnly(!supportsMultipleFilterStrings()); // DWD was restored flag?
}
catch (Exception exc)
{