1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

rse.ui to rse.core refactoring

This commit is contained in:
David McKnight 2006-08-31 17:37:25 +00:00
parent 142328f173
commit 35604e44a8
225 changed files with 11854 additions and 636 deletions

View file

@ -21,11 +21,11 @@ import java.net.ConnectException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
import org.eclipse.rse.examples.daytime.DaytimeResources;
import org.eclipse.rse.examples.daytime.service.DaytimeService;
import org.eclipse.rse.examples.daytime.service.IDaytimeService;
import org.eclipse.rse.model.IHost;
/**
* The DaytimeConnectorService takes care of keeping a "session" for accessing

View file

@ -16,11 +16,11 @@
package org.eclipse.rse.examples.daytime.connectorservice;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.examples.daytime.subsystems.IDaytimeSubSystem;
import org.eclipse.rse.model.IHost;
/**
* This class manages our DaytimeConnectorService objects, so that if we ever

View file

@ -14,15 +14,16 @@ package org.eclipse.rse.examples.daytime.subsystems;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.widgets.Display;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemMessageObject;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemMessageObject;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.SubSystem;
import org.eclipse.rse.examples.daytime.model.DaytimeResource;
import org.eclipse.rse.examples.daytime.service.IDaytimeService;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.model.ISystemResourceChangeEvents;
import org.eclipse.rse.model.SystemRegistry;
import org.eclipse.rse.model.SystemResourceChangeEvent;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
@ -45,7 +46,7 @@ public class DaytimeSubSystem extends SubSystem {
//This is called after connect - expand the daytime node.
//May be called in worker thread.
//TODO find a more elegant solution for expanding the item, e.g. use implicit connect like filters
final ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry();
final SystemRegistry sr = RSEUIPlugin.getTheSystemRegistry();
final SystemResourceChangeEvent event = new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null);
//TODO bug 150919: postEvent() should not be necessary asynchronously
//sr.postEvent(event);

View file

@ -19,13 +19,13 @@ package org.eclipse.rse.examples.daytime.subsystems;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.servicesubsystem.ServiceSubSystemConfiguration;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.examples.daytime.connectorservice.DaytimeConnectorService;
import org.eclipse.rse.examples.daytime.connectorservice.DaytimeConnectorServiceManager;
import org.eclipse.rse.examples.daytime.service.IDaytimeService;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.services.IService;
/**

View file

@ -1,14 +1,15 @@
package org.eclipse.rse.examples.daytime.ui;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.examples.daytime.DaytimeResources;
import org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.examples.daytime.DaytimeResources;
import org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage;
public class DaytimeNewConnectionWizardPage extends
AbstractSystemNewConnectionWizardPage {

View file

@ -20,9 +20,9 @@ import java.util.Vector;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
import org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardPage;
public class DaytimeSubSystemConfigurationAdapter extends SubSystemConfigurationAdapter

View file

@ -2,6 +2,7 @@ package org.eclipse.rse.examples.daytime.ui;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter;
import org.eclipse.rse.examples.daytime.subsystems.DaytimeSubSystemConfiguration;

View file

@ -17,8 +17,8 @@
package samples.subsystems;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
import org.eclipse.rse.model.IHost;
import samples.RSESamplesPlugin;

View file

@ -16,10 +16,10 @@
package samples.subsystems;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.model.IHost;
/**
* This class manages our DeveloperConnectorService objects, so that if we

View file

@ -19,9 +19,9 @@ package samples.subsystems;
import java.util.Vector;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.SubSystem;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
import samples.model.DeveloperResource;

View file

@ -18,13 +18,13 @@ package samples.subsystems;
import java.util.Vector;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
import org.eclipse.rse.filters.ISystemFilter;
import org.eclipse.rse.filters.ISystemFilterPool;
import org.eclipse.rse.filters.ISystemFilterPoolManager;
import org.eclipse.rse.model.IHost;
import samples.RSESamplesPlugin;
@ -43,7 +43,7 @@ public class DeveloperSubSystemConfiguration extends SubSystemConfiguration {
/**
* Create an instance of our subsystem.
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(org.eclipse.rse.model.IHost)
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(org.eclipse.rse.core.model.IHost)
*/
public ISubSystem createSubSystemInternal(IHost conn) {
return new DeveloperSubSystem(conn, getConnectorService(conn));
@ -85,7 +85,7 @@ public class DeveloperSubSystemConfiguration extends SubSystemConfiguration {
* sheet for the "type" property when a filter is selected within our subsystem.
*
* Requires this line in rseSamplesResources.properties: property.type.teamfilter=Team filter
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getTranslatedFilterTypeProperty(org.eclipse.rse.filters.ISystemFilter)
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getTranslatedFilterTypeProperty(org.eclipse.rse.core.filters.ISystemFilter)
*/
public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter)
{

View file

@ -18,9 +18,9 @@ package samples.subsystems;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.filters.ISystemFilter;
import org.eclipse.rse.filters.ISystemFilterPool;
import org.eclipse.rse.ui.filters.actions.SystemChangeFilterAction;
import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
@ -92,7 +92,7 @@ public class DeveloperSubSystemConfigurationAdapter extends
/**
* Override of parent method for returning the image for filters in our subsystem.
* @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getSystemFilterImage(org.eclipse.rse.filters.ISystemFilter)
* @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getSystemFilterImage(org.eclipse.rse.core.filters.ISystemFilter)
*/
public ImageDescriptor getSystemFilterImage(ISystemFilter filter)
{

View file

@ -17,8 +17,8 @@
package samples.ui.actions;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.files.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;

View file

@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.rse.subsystems.shells.dstore,
org.eclipse.rse.subsystems.shells.local,
org.eclipse.rse.core,
org.eclipse.debug.core,
org.eclipse.core.resources,
org.eclipse.cdt.core,
@ -23,6 +22,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.rse.subsystems.shells.core,
org.eclipse.rse.services,
org.eclipse.cdt.debug.core,
org.eclipse.cdt.debug.mi.ui
org.eclipse.cdt.debug.mi.ui,
org.eclipse.rse.core
Eclipse-LazyStart: true
Bundle-Vendor: Eclipse.org

View file

@ -19,7 +19,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
import org.eclipse.swt.SWT;

View file

@ -39,7 +39,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.ui.RSEUIPlugin;

View file

@ -48,6 +48,8 @@ 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;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.SystemSignonInformation;
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.IRemoteServerLauncher;
@ -56,8 +58,6 @@ import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.ServerLaunchType;
import org.eclipse.rse.core.subsystems.SubSystem;
import org.eclipse.rse.dstore.universal.miners.environment.EnvironmentMiner;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.model.SystemSignonInformation;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.ui.ISystemMessages;

View file

@ -15,10 +15,10 @@
********************************************************************************/
package org.eclipse.rse.connectorservice.dstore;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.model.IHost;

View file

@ -25,10 +25,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.dstore.core.client.ClientConnection;
import org.eclipse.dstore.core.client.ConnectionStatus;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.model.SystemSignonInformation;
import org.eclipse.rse.core.subsystems.IRemoteServerLauncher;
import org.eclipse.rse.core.subsystems.IServerLauncher;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.model.SystemSignonInformation;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;

View file

@ -26,9 +26,9 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;

View file

@ -50,13 +50,13 @@ import com.jcraft.jsch.UIKeyboardInteractive;
import com.jcraft.jsch.UserInfo;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemSignonInformation;
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.model.SystemSignonInformation;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.ssh.ISshSessionProvider;
import org.eclipse.rse.ui.ISystemMessages;

View file

@ -16,10 +16,10 @@
package org.eclipse.rse.connectorservice.ssh;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.model.IHost;
/**
* ConnectorService manager class.

View file

@ -3,5 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="persistence"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -8,12 +8,16 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.rse.logging,
org.eclipse.rse.services
org.eclipse.rse.services,
org.eclipse.swt
Eclipse-LazyStart: true
Export-Package: org.eclipse.rse.core,
org.eclipse.rse.core.filters,
org.eclipse.rse.core.model,
org.eclipse.rse.core.persistance,
org.eclipse.rse.core.references,
org.eclipse.rse.internal.references
org.eclipse.rse.core.subsystems,
org.eclipse.rse.internal.references,
org.eclipse.rse.persistence,
org.eclipse.rse.persistence.dom
Bundle-Vendor: Eclipse.org

View file

@ -0,0 +1,706 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed the initial implementation:
* David McKnight, David Dykstal.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.persistence;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;
import java.util.regex.Pattern;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.rse.persistence.IRSEPersistenceProvider;
import org.eclipse.rse.persistence.dom.IRSEDOMConstants;
import org.eclipse.rse.persistence.dom.RSEDOM;
import org.eclipse.rse.persistence.dom.RSEDOMNode;
import org.eclipse.rse.persistence.dom.RSEDOMNodeAttribute;
/**
* This is class is used to restore an RSE DOM from disk and import it into RSE.
* It stores the DOM as a tree of folders and .properties files.
*/
public class PropertyFileProvider implements IRSEPersistenceProvider {
private static final String NULL_VALUE_STRING = "null";
private static final String PROPERTIES_FILE_NAME = "node.properties";
/* Metatype names */
private static final String MT_ATTRIBUTE_TYPE = "attr-type";
private static final String MT_ATTRIBUTE = "attr";
private static final String MT_CHILD = "child";
private static final String MT_NODE_TYPE = "n-type";
private static final String MT_NODE_NAME = "n-name";
private static final String MT_REFERENCE = "ref";
/* Type abbreviations */
private static final String AB_SUBSYSTEM = "SS";
private static final String AB_SERVICE_LAUNCHER = "SL";
private static final String AB_PROPERTY_SET = "PS";
private static final String AB_PROPERTY = "P";
private static final String AB_HOST = "H";
private static final String AB_FILTER_STRING = "FS";
private static final String AB_FILTER_POOL_REFERENCE = "FPR";
private static final String AB_FILTER_POOL = "FP";
private static final String AB_FILTER = "F";
private static final String AB_CONNECTOR_SERVICE = "CS";
private static final String AB_PROFILE = "PRF";
private Pattern period = Pattern.compile("\\.");
private Map typeQualifiers = getTypeQualifiers();
/* (non-Javadoc)
* @see org.eclipse.rse.persistence.IRSEPersistenceProvider#getSavedProfileNames()
*/
public String[] getSavedProfileNames() {
List names = new Vector(10);
IFolder providerFolder = getProviderFolder();
try {
IResource[] profileCandidates = providerFolder.members();
for (int i = 0; i < profileCandidates.length; i++) {
IResource profileCandidate = profileCandidates[i];
if (profileCandidate.getType() == IResource.FOLDER) {
String candidateName = profileCandidate.getName();
String[] parts = split(candidateName, 2);
if (parts[0].equals(AB_PROFILE)) {
String name = parts[1];
names.add(name);
}
}
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] result = new String[names.size()];
names.toArray(result);
return result;
}
/* (non-Javadoc)
* @see org.eclipse.rse.persistence.IRSEPersistenceProvider#saveRSEDOM(org.eclipse.rse.persistence.dom.RSEDOM, org.eclipse.core.runtime.IProgressMonitor)
*/
public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor) {
IFolder providerFolder = getProviderFolder();
// String profileName = dom.getName();
// System.out.println("saving profile " + profileName + " to " + providerFolder.getFullPath().toString() + "...");
try {
int n = countNodes(dom);
if (monitor != null) monitor.beginTask("Saving DOM", n);
saveNode(dom, providerFolder, monitor);
if (monitor != null) monitor.done();
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
/**
* Saves a node from the DOM to the file system.
* @param node The node to save.
* @param parentFolder The folder in which to save this node. The node will be a
* subfolder of this folder.
* @param monitor The progress monitor. If the monitor has been cancel then
* this method will do nothing and return null.
* @return The name of the folder saving this node. Can be used for constructing
* references to children. May return null if the monitor has been canceled.
*/
private String saveNode(RSEDOMNode node, IFolder parentFolder, IProgressMonitor monitor) {
if (monitor != null && monitor.isCanceled()) return null;
String nodeFolderName = getSaveFolderName(node);
IFolder nodeFolder = getFolder(parentFolder, nodeFolderName);
Properties properties = getProperties(node, false, monitor);
RSEDOMNode[] children = node.getChildren();
Set childFolderNames = new HashSet();
for (int i = 0; i < children.length; i++) {
RSEDOMNode child = children[i];
String index = getIndexString(i);
if (!isNodeEmbedded(child)) {
String key = combine(MT_REFERENCE, index);
String childFolderName = saveNode(child, nodeFolder, monitor);
if (childFolderName != null) properties.put(key, childFolderName);
childFolderNames.add(childFolderName);
}
}
removeFolders(nodeFolder, childFolderNames);
String propertiesFileName = PROPERTIES_FILE_NAME;
IFile propertiesFile = nodeFolder.getFile(propertiesFileName);
writeProperties(properties, "RSE DOM Node", propertiesFile);
return nodeFolderName;
}
/**
* Removes childFolders from the parent folder that are not in the keep set.
* Typically used to clean renamed nodes from the tree on a save operation.
* @param parentFolder The folder whose subfolders are to be examined.
* @param keepSet The names of the folders that should be kept. Others are discarded.
*/
private void removeFolders(IFolder parentFolder, Set keepSet) {
try {
IResource[] children = parentFolder.members();
for (int i = 0; i < children.length; i++) {
IResource child = children[i];
if (child.getType() == IResource.FOLDER) {
String childFolderName = child.getName();
if (!keepSet.contains(childFolderName)) {
child.delete(true, null);
}
}
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static final String VALID = "abcdefghijklmnopqrstuvwxyz0123456789-._";
private static final String UPPER = "ABCDEFGHIJKLMNOPQRTSUVWXYZ";
/**
* Returns the name of a folder that can be used to store a node of a particular
* type. Since this is a folder, its name must conform to the rules of the file
* system. The names are derived from the name and type of the node. Note that the
* actual name of the node is also stored as a property so we need not attempt
* to recover the node name from the folder name.
* @param node The node that will eventually be stored in this folder.
* @return The name of the folder to store this node.
*/
private String getSaveFolderName(RSEDOMNode node) {
String type = node.getType();
type = (String) typeQualifiers.get(type);
String name = node.getName();
int p = name.indexOf(':');
if (p >= 0) {
name = name.substring(p + 1);
}
StringBuffer buf = new StringBuffer(name.length());
char[] chars = name.toCharArray();
long suffix = 0;
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
suffix *= 2;
if (VALID.indexOf(c) >= 0) {
buf.append(c);
} else if (UPPER.indexOf(c) >= 0) { // if uppercase
buf.append(Character.toLowerCase(c));
suffix += 1;
} else if (c == ' ') { // if space
buf.append('_');
suffix += 1;
} else { // if out of range
buf.append('#');
buf.append(Integer.toHexString(c));
buf.append('#');
}
}
name = buf.toString() + "_" + Long.toString(suffix);
String result = combine(type, name);
return result;
}
private Map getTypeQualifiers() {
Map typeQualifiers = new HashMap();
typeQualifiers.put(IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, AB_CONNECTOR_SERVICE);
typeQualifiers.put(IRSEDOMConstants.TYPE_FILTER, AB_FILTER);
typeQualifiers.put(IRSEDOMConstants.TYPE_FILTER_POOL, AB_FILTER_POOL);
typeQualifiers.put(IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE, AB_FILTER_POOL_REFERENCE);
typeQualifiers.put(IRSEDOMConstants.TYPE_FILTER_STRING, AB_FILTER_STRING);
typeQualifiers.put(IRSEDOMConstants.TYPE_HOST, AB_HOST);
typeQualifiers.put(IRSEDOMConstants.TYPE_PROFILE, AB_PROFILE);
typeQualifiers.put(IRSEDOMConstants.TYPE_PROPERTY, AB_PROPERTY);
typeQualifiers.put(IRSEDOMConstants.TYPE_PROPERTY_SET, AB_PROPERTY_SET);
typeQualifiers.put(IRSEDOMConstants.TYPE_SERVER_LAUNCHER, AB_SERVICE_LAUNCHER);
typeQualifiers.put(IRSEDOMConstants.TYPE_SUBSYSTEM, AB_SUBSYSTEM);
return typeQualifiers;
}
/**
* Write a set of properties to a file.
* @param properties The Properties object to write.
* @param header The header to include in the properties file.
* @param file The IFile which will contain the properties.
* @param monitor The progress monitor.
*/
private void writeProperties(Properties properties, String header, IFile file) {
// System.out.println("writing "+file.getFullPath()+"...");
ByteArrayOutputStream outStream = new ByteArrayOutputStream(500);
PrintWriter out = new PrintWriter(outStream);
out.println("# " + header);
Map map = new TreeMap(properties);
Set keys = map.keySet();
for (Iterator z = keys.iterator(); z.hasNext();) {
String key = (String) z.next();
String value = (String)map.get(key);
String keyvalue = key + "=" + escapeValue(value);
// System.out.println("writing "+keyvalue);
out.println(keyvalue);
}
out.close();
// System.out.println("...wrote "+file.getFullPath());
ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
try {
if (!file.exists()) {
file.create(inStream, true, null);
} else {
file.setContents(inStream, true, true, null);
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* Tests if a node's definition should be embedded in its parent's definition or
* if it should be a separate definition. The test is usually based on node type.
* Currently only filter strings are embedded in their parent filter definition.
* @param node The node to be tested.
* @return true if the node is to be embedded.
*/
private boolean isNodeEmbedded(RSEDOMNode node) {
boolean result = false;
if (node.getType().equals(IRSEDOMConstants.TYPE_FILTER_STRING)) {
result = true;
}
return result;
}
/**
* Transforms an integer into its five digit counterpart complete with leading
* zeroes.
* @param i an integer from 0 to 99999.
* @return a string equivalent from "00000" to "99999"
*/
private String getIndexString(int i) {
if (i < 0 || i > 99999) throw new IllegalArgumentException("Argument must be between 0 and 99999");
String index = "00000" + Integer.toString(i);
index = index.substring(index.length() - 5);
return index;
}
/**
* "Fixes" a value. Values in Properties objects may not be null. Changes all
* null values to the string "null" and escapes the characters in other values.
* @param value The value to check.
* @return The fixed value
*/
private String fixValue(String value) {
if (value == null) return NULL_VALUE_STRING;
return value;
}
/**
* Escapes the characters in the supplied string according to the rules
* for properties files.
* @param value The value to examine.
* @return The equivalent value with escapes.
*/
private String escapeValue(String value) {
StringBuffer buffer = new StringBuffer(value.length() + 20);
char[] characters = value.toCharArray();
for (int i = 0; i < characters.length; i++) {
char c = characters[i];
if (c == '\\') {
buffer.append("\\\\");
} else if (c == '\t') {
buffer.append("\\t");
} else if (c == '\f') {
buffer.append("\\f");
} else if (c == '\n') {
buffer.append("\\n");
} else if (c == '\r') {
buffer.append("\\r");
} else if ((c < '\u0020' && c > '\u007E')) {
String cString = "0000" + Integer.toHexString(c);
cString = cString.substring(cString.length() - 4);
cString = "\\u" + cString;
buffer.append(cString);
} else if ("=!#:".indexOf(c) >= 0) {
buffer.append('\\');
buffer.append(c);
} else {
buffer.append(c);
}
}
return buffer.toString();
}
/**
* Constructs a properties object containing all the properties for this node.
* The following properties exist:
* name property, type property, embedded child properties, and referenced
* child properties. Each property has its own key format in the Properties
* object.
* @param node The node to extract the properties from.
* @param force Force children to be embedded rather than reference.
* @param monitor The progress monitor. The work count is increased by one each time
* this method is invoked.
* @return The Properties object containing that node definition.
*/
private Properties getProperties(RSEDOMNode node, boolean force, IProgressMonitor monitor) {
Properties properties = new Properties();
properties.put(MT_NODE_NAME, node.getName());
properties.put(MT_NODE_TYPE, node.getType());
properties.putAll(getAttributes(node));
RSEDOMNode[] children = node.getChildren();
for (int i = 0; i < children.length; i++) {
RSEDOMNode child = children[i];
String index = getIndexString(i);
if (force || isNodeEmbedded(child)) {
String prefix = combine(MT_CHILD, index);
Properties childProperties = getProperties(child, true, monitor);
Enumeration e = childProperties.keys();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String value = childProperties.getProperty(key);
String newKey = combine(prefix, key);
properties.put(newKey, value);
}
}
}
if (monitor != null) monitor.worked(1);
return properties;
}
/**
* Constructs a Properties object from the attributes present in a DOM node.
* @param node The node containing the attributes. Keys for attributes are of the
* form "attribute.[attribute-name]". If the attribute has a type then there
* will also be an "attribute-type.[attribute-name]" property.
* [attribute-name] may contain periods but must not be null.
* @return The newly constructed Properties object.
*/
private Properties getAttributes(RSEDOMNode node) {
Properties properties = new Properties();
RSEDOMNodeAttribute[] attributes = node.getAttributes();
for (int i = 0; i < attributes.length; i++) {
RSEDOMNodeAttribute attribute = attributes[i];
String attributeName = attribute.getKey();
String propertyKey = combine(MT_ATTRIBUTE, attributeName);
properties.put(propertyKey, fixValue(attribute.getValue()));
String attributeType = attribute.getType();
if (attributeType != null) {
propertyKey = combine(MT_ATTRIBUTE_TYPE, attributeName);
properties.put(propertyKey, attributeType);
}
}
return properties;
}
/**
* Count the number of nodes in a tree rooted in the supplied node. The
* supplied node is counted so the mininum result is one.
* @param node The root of the tree.
* @return The node count.
*/
private int countNodes(RSEDOMNode node) {
RSEDOMNode[] children = node.getChildren();
int result = 1;
for (int i = 0; i < children.length; i++) {
RSEDOMNode child = children[i];
result += countNodes(child);
}
return result;
}
/* (non-Javadoc)
* @see org.eclipse.rse.persistence.IRSEPersistenceProvider#loadRSEDOM(org.eclipse.rse.model.ISystemProfileManager, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
public RSEDOM loadRSEDOM(String profileName, IProgressMonitor monitor) {
RSEDOM dom = null;
IFolder profileFolder = getProfileFolder(profileName);
if (profileFolder.exists()) {
//System.out.println("loading from " + profileFolder.getFullPath().toString() + "...");
int n = countPropertiesFiles(profileFolder);
if (monitor != null) monitor.beginTask("Loading DOM", n);
dom = (RSEDOM) loadNode(null, profileFolder, monitor);
if (monitor != null) monitor.done();
} else {
//System.out.println(profileFolder.getFullPath().toString() + " does not exist.");
}
return dom;
}
/**
* Counts the number of properties files in this folder and below. This provides
* a lower bound to the number of nodes that have to be created from this
* persistent form of a DOM.
* @param folder
* @return the number of properties files found.
*/
private int countPropertiesFiles(IFolder folder) {
int result = 0;
IFile propertiesFile = folder.getFile(PROPERTIES_FILE_NAME);
if (propertiesFile.exists()) {
result += 1;
try {
IResource[] members = folder.members();
for (int i = 0; i < members.length; i++) {
IResource member = members[i];
if (member.getType() == IResource.FOLDER) {
IFolder childFolder = (IFolder) member;
result += countPropertiesFiles(childFolder);
}
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return result;
}
/**
* Loads a node from a folder.
* @param parent The parent of the node to be created. If null then this node is assumed to
* be a DOM root node (RSEDOM).
* @param nodeFolder The folder in which the node.properties file of this node is found.
* @param monitor The monitor used to report progress and cancelation. If the monitor is
* in canceled state then it this does method does nothing and returns null. If the monitor
* is not canceled then its work count is incremented by one.
* @return The newly loaded node.
*/
private RSEDOMNode loadNode(RSEDOMNode parent, IFolder nodeFolder, IProgressMonitor monitor) {
RSEDOMNode node = null;
if (monitor == null || !monitor.isCanceled()) {
Properties properties = loadProperties(nodeFolder);
if (properties != null) {
node = makeNode(parent, nodeFolder, properties, monitor);
}
if (monitor != null) monitor.worked(1);
}
return node;
}
/**
* Loads the properties found in the folder. Returns null if no properties
* file was found.
* @param folder The folder in which to look for properties.
* @return The Properties object.
*/
private Properties loadProperties(IFolder folder) {
Properties properties = null;
IFile attributeFile = folder.getFile(PROPERTIES_FILE_NAME);
if (attributeFile.exists()) {
properties = new Properties();
try {
InputStream inStream = attributeFile.getContents();
try {
properties.load(inStream);
inStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return properties;
}
/**
* Makes a new RSEDOMNode from a set of properties. The properties must (at least) include
* a "name" property and a "type" property. Any child nodes are created and attached as well.
* @param parent The parent node of the node to be created.
* @param nodeFolder The folder in which referenced child folders can be found. This will
* almost always be the folder in which the properties for the node to be created were found.
* @param properties The properties from which to create the node.
* @param monitor a monitor to support cancelation and progress reporting.
* @return the newly created DOM node and its children.
*/
private RSEDOMNode makeNode(RSEDOMNode parent, IFolder nodeFolder, Properties properties, IProgressMonitor monitor) {
String nodeType = properties.getProperty(MT_NODE_TYPE);
String nodeName = properties.getProperty(MT_NODE_NAME);
RSEDOMNode node = (parent == null) ? new RSEDOM(nodeName) : new RSEDOMNode(parent, nodeType, nodeName);
node.setRestoring(true);
Set keys = properties.keySet();
Map attributes = new HashMap();
Map attributeTypes = new HashMap();
Map childPropertiesMap = new HashMap();
Set childNames = new TreeSet(); // child names are 5 digit strings, a tree set is used to maintain ordering
Set referenceNames = new TreeSet(); // ditto for reference names
for (Iterator z = keys.iterator(); z.hasNext();) {
String key = (String) z.next();
String[] words = split(key, 2);
String metatype = words[0];
if (metatype.equals(MT_ATTRIBUTE)) {
String value = properties.getProperty(key);
attributes.put(words[1], value);
} else if (metatype.equals(MT_ATTRIBUTE_TYPE)) {
String type = properties.getProperty(key);
attributeTypes.put(words[1], type);
} else if (metatype.equals(MT_REFERENCE)) {
String referenceName = words[1];
referenceNames.add(referenceName);
} else if (metatype.equals(MT_CHILD)) {
String value = properties.getProperty(key);
words = split(words[1], 2);
String childName = words[0];
childNames.add(childName);
String newKey = words[1];
Properties p = getProperties(childPropertiesMap, childName);
p.put(newKey, value);
}
}
Set attributeNames = attributes.keySet();
for (Iterator z = attributeNames.iterator(); z.hasNext();) {
String attributeName = (String) z.next();
String attributeValue = (String) attributes.get(attributeName);
if (attributeValue.equals(NULL_VALUE_STRING)) attributeValue = null;
String attributeType = (String) attributeTypes.get(attributeName);
node.addAttribute(attributeName, attributeValue, attributeType);
}
for (Iterator z = childNames.iterator(); z.hasNext();) {
String childName = (String) z.next();
Properties p = getProperties(childPropertiesMap, childName);
makeNode(node, nodeFolder, p, monitor);
}
for (Iterator z = referenceNames.iterator(); z.hasNext();) {
String referenceName = (String) z.next();
String key = combine(MT_REFERENCE, referenceName);
String childFolderName = properties.getProperty(key);
IFolder childFolder = getFolder(nodeFolder, childFolderName);
loadNode(node, childFolder, monitor);
}
node.setRestoring(false);
return node;
}
/**
* Returns a Properties object from the given Map that holds them using the
* selector String. Creates a new Properties object and places it in the map
* if one does not exist for the selector.
* @param propertiesMap The map in which to look for Properties objects.
* @param selector The name of the Properties object
* @return a Properties object.
*/
private Properties getProperties(Map propertiesMap, String selector) {
Properties p = (Properties)propertiesMap.get(selector);
if (p == null) {
p = new Properties();
propertiesMap.put(selector, p);
}
return p;
}
/**
* Returns the IFolder in which this persistence provider stores its profiles.
* This will create the folder if the folder was not found.
* @return The folder that was created or found.
*/
private IFolder getProviderFolder() {
IProject project = RSEPersistenceManager.getRemoteSystemsProject();
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (Exception e) {
}
//IFolder providerFolder = getFolder(project, "org.eclipse.rse.dom.properties");
IFolder providerFolder = getFolder(project, "dom.properties");
return providerFolder;
}
/**
* Returns the IFolder in which a profile is stored.
* @return The folder that was created or found.
*/
private IFolder getProfileFolder(String profileName) {
String profileFolderName = combine(AB_PROFILE, profileName);
IFolder providerFolder = getProviderFolder();
IFolder profileFolder = getFolder(providerFolder, profileFolderName);
return profileFolder;
}
/**
* Returns the specified folder of the parent container. If the folder does
* not exist it creates it.
* @param parent the parent container - typically a project or folder
* @param name the name of the folder to find or create
* @return the found or created folder
*/
private IFolder getFolder(IContainer parent, String name) {
IPath path = new Path(name);
IFolder folder = parent.getFolder(path);
if (!folder.exists()) {
try {
folder.create(IResource.NONE, true, null);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return folder;
}
/**
* Convenience method to combine two names into one. The individual names in the
* combined name are separated by periods.
* @param typeName The first name.
* @param nodeName The second name
* @return the combined name.
*/
private String combine(String typeName, String nodeName) {
return combine(new String[] {typeName, nodeName});
}
/**
* The generic method for creating a qualified name from a string of segments.
* The individual names are separated by periods.
* @param names The names to combine
* @return The combined name.
*/
private String combine(String[] names) {
StringBuffer buf = new StringBuffer(100);
for (int i = 0; i < names.length; i++) {
String name = names[i];
if (i > 0) buf.append('.');
buf.append(name);
}
return buf.toString();
}
/**
* Splits a combined name into its component parts. The period is used as the name
* separator. If a limit > 0 is specified the return value will contain at most that
* number of segments. The last segment may, in fact, be split some more.
* @param longName The name to be split
* @param limit The number of parts to split the name into.
* @return The parts of the name.
*/
private String[] split(String longName, int limit) {
return period.split(longName, limit);
}
}

View file

@ -0,0 +1,425 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.persistence;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.SystemFilterPoolManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemHostPool;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemProfileManager;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.persistence.dom.RSEDOMExporter;
import org.eclipse.rse.internal.persistence.dom.RSEDOMImporter;
import org.eclipse.rse.logging.Logger;
import org.eclipse.rse.persistence.IRSEPersistenceManager;
import org.eclipse.rse.persistence.IRSEPersistenceProvider;
import org.eclipse.rse.persistence.dom.RSEDOM;
/**
* The persistence manager controls all aspects of persisting the RSE data model. It will both
* save and restore this model. There should be only persistence manager in existence. This instance
* can be retrieved using RSEUIPlugin.getThePersistenceManager.
* @see RSEUIPlugin#getThePersistenceManager()
*/
public class RSEPersistenceManager implements IRSEPersistenceManager {
private static final int STATE_NONE = 0;
private static final int STATE_IMPORTING = 1;
private static final int STATE_EXPORTING = 2;
private Map loadedProviders = new HashMap(10);
private int _currentState = STATE_NONE;
private RSEDOMExporter _exporter;
private RSEDOMImporter _importer;
private static IProject remoteSystemsProject = null;
public static final String RESOURCE_PROJECT_NAME = "RemoteSystemsConnections";
private ISystemRegistry _registry;
private ISystemProfileManager _profileManager;
public RSEPersistenceManager(ISystemRegistry registry)
{
_registry = registry;
_profileManager = registry.getSystemProfileManager();
_exporter = RSEDOMExporter.getInstance();
_exporter.setSystemRegistry(registry);
_importer = RSEDOMImporter.getInstance();
_importer.setSystemRegistry(registry);
}
/**
* Get the default remote systems project.
* @return IProject handle of the project. Use exists() to test existence.
*/
public static IProject getRemoteSystemsProject()
{
if (remoteSystemsProject == null)
{
remoteSystemsProject = ResourcesPlugin.getWorkspace().getRoot().getProject(RESOURCE_PROJECT_NAME);
}
return remoteSystemsProject;
}
public void registerRSEPersistenceProvider(String id, IRSEPersistenceProvider provider) {
loadedProviders.put(id, provider);
}
/**
* Returns the persistence provider denoted by the id. Only one instance of this
* persistence provider is created.
* @param id The id of the persistence provider, as denoted by the id attribute on its declaration.
* @return an IRSEPersistenceProvider which may be null if this id is not found.
*/
public IRSEPersistenceProvider getRSEPersistenceProvider(String id) {
Logger logger = RSECorePlugin.getDefault().getLogger();
IRSEPersistenceProvider provider = (IRSEPersistenceProvider) loadedProviders.get(id);
if (provider == null) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] providerCandidates = registry.getConfigurationElementsFor("org.eclipse.rse.core", "persistenceProviders");
for (int j = 0; j < providerCandidates.length; j++) {
IConfigurationElement providerCandidate = providerCandidates[j];
if (providerCandidate.getName().equals("persistenceProvider")) {
String candidateId = providerCandidate.getAttribute("id");
if (candidateId != null) {
if (candidateId.equals(id)) {
try {
provider = (IRSEPersistenceProvider) providerCandidate.createExecutableExtension("class");
} catch (CoreException e) {
logger.logError("Exception loading persistence provider", e); // DWD nls
}
}
} else {
logger.logError("Missing id attribute in persistenceProvider element", null); // DWD nls
}
} else {
logger.logError("Invalid element in persistenceProviders extension point", null); // DWD nls
}
}
if (provider == null) {
logger.logError("Persistence provider not found.", null); // DWD nls
}
loadedProviders.put(id, provider); // even if provider is null
}
return provider;
}
/**
* @return the default IRSEPersistenceProvider for this installation.
* TODO: need to determine what this is. Having more than one is problematic.
*/
public IRSEPersistenceProvider getRSEPersistenceProvider() {
IRSEPersistenceProvider provider = getRSEPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider");
return provider;
}
public boolean restore(ISystemProfileManager profileManager) {
return load(profileManager);
}
/**
* Restore a profile of a given name from disk...
*/
protected ISystemProfile restoreProfile(ISystemProfileManager mgr, String name) throws Exception {
/*
* FIXME String fileName = mgr.getRootSaveFileName(name); java.util.List
* ext = null;//FIXME
* getMOFHelpers().restore(SystemResourceManager.getProfileFolder(name),fileName);
* // should be exactly one profile... Iterator iList = ext.iterator();
* SystemProfile profile = (SystemProfile)iList.next();
* mgr.initialize(profile, name); return profile;
*/
return null;
}
/**
* Save all profiles to disk
*/
public boolean commit(ISystemProfileManager profileManager) {
ISystemProfile[] profiles = profileManager.getSystemProfiles();
for (int idx = 0; idx < profiles.length; idx++) {
try {
commit(profiles[idx]);
} catch (Exception exc) {
exc.printStackTrace();
System.out.println("Error saving profile " + profiles[idx] + ": " + exc.getClass().getName() + " " + exc.getMessage());
return false;
}
}
return true;
}
public boolean restore(ISystemHostPool connectionPool) {
return false;
}
/**
* Restore a connection of a given name from disk...
*/
protected IHost restoreHost(ISystemHostPool hostPool, String connectionName) throws Exception {
/*
* FIXME //System.out.println("in SystemConnectionPoolImpl#restore for
* connection " + connectionName); String fileName =
* getRootSaveFileName(connectionName);
* //System.out.println(".......fileName = " + fileName);
* //System.out.println(".......folderName = " +
* getConnectionFolder(connectionName).getName()); java.util.List ext =
* getMOFHelpers().restore(getConnectionFolder(connectionName),fileName);
* // should be exactly one profile... Iterator iList = ext.iterator();
* SystemConnection connection = (SystemConnection)iList.next(); if
* (connection != null) { if
* (!connection.getAliasName().equalsIgnoreCase(connectionName)) {
* RSEUIPlugin.logDebugMessage(this.getClass().getName(),"Incorrect
* alias name found in connections.xmi file for " + connectionName+".
* Name was reset"); connection.setAliasName(connectionName); // just in
* case! } internalAddConnection(connection); } return connection;
*/
return null;
}
public boolean commit(ISystemHostPool connectionPool) {
if (connectionPool.isDirty()) {
commit(connectionPool.getSystemProfile());
connectionPool.setDirty(false);
}
/*
Host[] connections = connectionPool.getHosts();
for (int idx = 0; idx < connections.length; idx++)
{
if (!saveHost(connectionPool, connections[idx]))
{
return false;
}
}
return true;
*/
return false; // all persistence should be at profile level
}
public boolean commit(ISystemFilterPoolManager filterPoolManager) {
if (filterPoolManager.isDirty()) {
commit(filterPoolManager.getSystemProfile());
filterPoolManager.setDirty(false);
}
return false;
}
public boolean commit(ISystemFilterPool filterPool) {
if (filterPool.isDirty()) {
commit(filterPool.getSystemFilterPoolManager().getSystemProfile());
filterPool.setDirty(false);
}
return false;
}
public boolean restore(ISystemFilterPool filterPool) {
//System.out.println("restore filterpool");
// DWD function Is this method really needed?
return false;
}
public boolean commit(ISystemFilter filter) {
// System.out.println("commit filter");
// DWD function Is this method really needed?
/*
if (filter.isDirty())
{
System.out.println("saving filter: "+filter.getName());
filter.setDirty(false);
}
*/
/* FIXME
//initMOF(); assume caller did this!
String fileName = getRootSaveFileName(this);
IFolder folder = getFolder(this);
getMOFHelpers().save(folder,fileName, this);
*/
return false;
}
public ISystemFilterPool restoreFilterPool(String name) {
//System.out.println("restore filter pool "+name);
// DWD function is this method really needed?
return null;
}
public boolean commit(ISubSystem subSystem) {
if (subSystem.isDirty()) {
// System.out.println("updated " + subSystem.getName());
try {
// commit everything for now
commit(_profileManager);
subSystem.setDirty(false);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
/*
// FIXME
if (subSystem.isDirty())
{
System.out.println("saving subsystem: "+subSystem.getName());
}
*/
return false;
}
/**
* Restore the filter pools from disk.
* @param logger The logging object to log errors to
* @param mgrFolder folder containing filter pool folders, or single file for that save policy
* @param name the name of the manager to restore. File name is derived from it when saving to one file.
* @param savePolicy How to persist filters. See SystemFilterConstants.
* @param namingPolicy Naming prefix information for persisted data file names.
* @return the restored manager, or null if it does not exist. If anything else went
* wrong, an exception is thrown.
*/
public ISystemFilterPoolManager restoreFilterPoolManager(ISystemProfile profile, Logger logger, ISystemFilterPoolManagerProvider caller, String name) {
ISystemFilterPoolManager mgr = SystemFilterPoolManager.createManager(profile);
((SystemFilterPoolManager) mgr).initialize(logger, caller, name); // core data
mgr.setWasRestored(false); // DWD let's try this
return mgr;
}
/**
* Attempt to save single profile to disk.
*/
public boolean commit(ISystemProfile profile) {
if (profile != null) {
return save(profile, false);
}
return false;
}
public boolean commit(IHost host) {
return commit(host.getSystemProfile());
}
/**
* Loads and restores RSE artifacts from the last session
* @param profileManager
* @return true if the profiles are loaded
*/
private boolean load(ISystemProfileManager profileManager) {
boolean successful = true;
if (isExporting() || isImporting()) {
successful = false;
} else {
_currentState = STATE_IMPORTING;
IProject project = getRemoteSystemsProject();
try {
if (!project.isSynchronized(IResource.DEPTH_ONE)) project.refreshLocal(IResource.DEPTH_ONE, null);
IRSEPersistenceProvider persistenceProvider = getRSEPersistenceProvider();
String profileNames[] = persistenceProvider.getSavedProfileNames();
for (int i = 0; i < profileNames.length; i++) {
String profileName = profileNames[i];
RSEDOM dom = importRSEDOM(profileName);
if (dom != null) {
ISystemProfile restoredProfile = _importer.restoreProfile(profileManager, dom);
if (restoredProfile == null) {
successful = false;
}
} else {
successful = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
_currentState = STATE_NONE;
}
return successful;
}
/**
* Writes the RSE model to a DOM and schedules writing of that DOM to disk.
* May, in fact, update an existing DOM instead of creating a new one.
* If in the process of importing, skip writing.
* @return true if the profile is written to a DOM
*/
private boolean save(ISystemProfile profile, boolean force) {
boolean result = false;
if (!isImporting()) {
_currentState = STATE_EXPORTING;
RSEDOM dom = exportRSEDOM(profile, true); // DWD should do merge, but does not handle deletes properly yet
_currentState = STATE_NONE;
result = true;
if (dom.needsSave()) {
Job job = dom.getSaveJob();
if (job == null) {
job = new SaveRSEDOMJob(dom, getRSEPersistenceProvider());
dom.setSaveJob(job);
}
job.schedule(3000); // five second delay
}
}
return result;
}
public boolean isExporting() {
return _currentState == STATE_EXPORTING;
}
public boolean isImporting() {
return _currentState == STATE_IMPORTING;
}
// public void setState(int state) {
// _currentState = state;
// }
private RSEDOM exportRSEDOM(ISystemProfile profile, boolean force) {
RSEDOM dom = _exporter.createRSEDOM(profile, force);
return dom;
}
private RSEDOM importRSEDOM(String domName) {
RSEDOM dom = null;
IRSEPersistenceProvider provider = getRSEPersistenceProvider();
if (provider != null) {
dom = provider.loadRSEDOM(domName, null);
} else {
Logger logger = RSECorePlugin.getDefault().getLogger();
logger.logError("Persistence provider is not available.", null); // DWD NLS
}
return dom;
}
}

View file

@ -0,0 +1,50 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.persistence;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.rse.persistence.IRSEPersistenceProvider;
import org.eclipse.rse.persistence.dom.RSEDOM;
public class SaveRSEDOMJob extends Job {
private RSEDOM _dom;
private IRSEPersistenceProvider _provider;
public SaveRSEDOMJob(RSEDOM dom, IRSEPersistenceProvider provider) {
super("Saving RSE Profile: " + dom.getName());
_dom = dom;
_provider = provider;
}
protected IStatus run(IProgressMonitor monitor) {
IStatus result = Status.OK_STATUS;
synchronized (_dom) { // synchronize on the DOM to prevent its update while writing
if (_dom.needsSave()) {
_provider.saveRSEDOM(_dom, monitor);
_dom.markUpdated();
} else {
result = Status.CANCEL_STATUS;
}
}
return result;
}
}

View file

@ -0,0 +1,179 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.persistence;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.persistence.IRSEPersistenceProvider;
import org.eclipse.rse.persistence.dom.RSEDOM;
/**
* This is class is used to restore an RSE DOM from disk and import it into RSE.
* @author dmcknigh
*
*/
public class SerializingProvider implements IRSEPersistenceProvider
{
/* (non-Javadoc)
* @see org.eclipse.rse.persistence.IRSEPersistenceProvider#getSavedProfileNames()
*/
public String[] getSavedProfileNames() {
/*
* We look for folders inside the RemoteSystemsConnections folder that contain
* a single file named folderName.rsedom. We return the array of folder names.
*/
List names = new Vector(10);
try {
IProject project = RSEPersistenceManager.getRemoteSystemsProject();
IResource[] candidates = project.members();
for (int i = 0; i < candidates.length; i++) {
IResource candidate = candidates[i];
if (candidate.getType() == IResource.FOLDER) {
IFolder candidateFolder = (IFolder) candidate;
IResource[] children = candidateFolder.members();
if (children.length == 1) {
IResource child = children[0];
if (child.getType() == IResource.FILE) {
String profileName = candidateFolder.getName();
String domFileName = profileName + ".rsedom";
String childName = child.getName();
if (childName.equals(domFileName)) {
names.add(profileName);
}
}
}
}
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] result = new String[names.size()];
names.toArray(result);
return result;
}
/**
* Restores a system profile in RSE. This API will likely change.
*
* @param profileManager
* @param profileFile the file representing the profile
* @return
*/
public RSEDOM loadRSEDOM(String profileName, IProgressMonitor monitor)
{
RSEDOM dom = null;
IFile profileFile = getProfileFile(profileName, monitor);
if (profileFile.exists())
{
//System.out.println("loading "+ profileFile.getLocation().toOSString() + "..."); // DWD debugging
try
{
InputStream iStream = profileFile.getContents();
ObjectInputStream inStream = new ObjectInputStream(iStream);
dom = (RSEDOM)inStream.readObject();
inStream.close();
}
catch (Exception e)
{
e.printStackTrace();
try
{
profileFile.delete(true, false, monitor);
}
catch (Exception e2)
{
e.printStackTrace();
}
}
}
return dom;
}
private IFile getProfileFile(String domName, IProgressMonitor monitor)
{
IProject project = RSEPersistenceManager.getRemoteSystemsProject();
// before loading, make sure the project is in synch
try
{
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
catch (Exception e)
{
}
IFolder folder = project.getFolder(domName);
if (!folder.exists())
{
try
{
folder.create(true, true, monitor);
}
catch (Exception e)
{
}
}
return folder.getFile(domName + ".rsedom");
}
/**
* Saves an RSE dom to disk. This API will likely change.
* @param dom
* @param profileFile
* @return true if succcessful
*/
public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor)
{
IFile profileFile = getProfileFile(dom.getName(), monitor);
File osFile = profileFile.getLocation().toFile();
// System.out.println("saving "+ osFile.getAbsolutePath() + "..."); // DWD debugging
try
{
OutputStream oStream = new FileOutputStream(osFile);
ObjectOutputStream outStream = new ObjectOutputStream(oStream);
outStream.writeObject(dom);
outStream.close();
profileFile.getParent().refreshLocal(IResource.DEPTH_ONE, monitor);
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
return true;
}
}

View file

@ -0,0 +1,447 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.persistence.dom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.IPropertyType;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.persistence.dom.IRSEDOMConstants;
import org.eclipse.rse.persistence.dom.IRSEDOMExporter;
import org.eclipse.rse.persistence.dom.RSEDOM;
import org.eclipse.rse.persistence.dom.RSEDOMNode;
public class RSEDOMExporter implements IRSEDOMExporter {
private static RSEDOMExporter _instance = new RSEDOMExporter();
private Map _domMap;
private ISystemRegistry _registry;
/**
* Constructor to create a new DOM exporter.
*/
protected RSEDOMExporter() {
_domMap = new HashMap();
}
public void setSystemRegistry(ISystemRegistry registry)
{
_registry = registry;
}
/**
* @return the singleton instance of this exporter
*/
public static RSEDOMExporter getInstance() {
return _instance;
}
/**
* Returns the RSEDOM for this profile if it exists
* @param profile the profile for which to get the DOM
* @return the DOM for a particular profile, null if the DOM does not exist
*/
public RSEDOM getRSEDOM(ISystemProfile profile) {
return (RSEDOM) _domMap.get(profile);
}
/**
* Creates the RSE DOM for this profile. After it has found the DOM it will
* synchronize on the DOM to ensure its integrity while it is being updated.
* @param profile the profile for which to create the DOM
* @param clean indicates whether to create from scratch or merge with existing DOM
* @return The DOM for this profile
*/
public RSEDOM createRSEDOM(ISystemProfile profile, boolean clean) {
RSEDOM dom = getRSEDOM(profile);
if (dom == null) {
dom = new RSEDOM(profile);
_domMap.put(profile, dom);
clean = true;
}
synchronized (dom) {
populateRSEDOM(dom, profile, clean);
}
return dom;
}
/**
* Creates an RSE DOM for use in persistence
* @param dom the root node for the target DOM
* @param profile the profile from which to populate the DOM
* @param clean indicates whether to create from scratch or merge with existing DOM
* @return The DOM, updated with the data from the profile
*/
public RSEDOM populateRSEDOM(RSEDOM dom, ISystemProfile profile, boolean clean) {
// for now we do complete refresh
// clean dom for fresh creation
if (clean) {
dom.clearChildren();
}
if (clean || profile.isDirty() || dom.isDirty()) {
dom.clearAttributes();
dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT_PRIVATE, getBooleanString(profile.isDefaultPrivate()));
dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_IS_ACTIVE, getBooleanString(profile.isActive()));
}
// create the dom using the profile
// create filter pool nodes
ISystemFilterPool[] filterPools = profile.getFilterPools();
for (int i = 0; i < filterPools.length; i++) {
ISystemFilterPool pool = filterPools[i];
createNode(dom, pool, clean);
}
// create hosts nodes
// old nodes to compare with
RSEDOMNode[] oldHostNodes = null;
if (!clean) {
oldHostNodes = dom.getChildren(IRSEDOMConstants.TYPE_HOST);
}
List missingNodes = new ArrayList();
if (!clean) {
for (int o = 0; o < oldHostNodes.length; o++) {
missingNodes.add(oldHostNodes[o]);
}
}
IHost[] hosts = profile.getHosts();
for (int j = 0; j < hosts.length; j++) {
IHost host = hosts[j];
RSEDOMNode hnode = createNode(dom, host, clean);
if (!clean) {
// remove this one from the missing list
missingNodes.remove(hnode);
}
}
if (!clean) {
// remaining missingNodes are probably deleted now
for (int x = 0; x < missingNodes.size(); x++) {
dom.removeChild((RSEDOMNode) missingNodes.get(x));
}
}
// create generic property set nodes
createPropertySetNodes(dom, profile, clean);
dom.setDirty(false);
return dom;
}
/**
* Creates DOM nodes for each associated property set
* @param parent The node of the DOM that needs a property set
* @param modelObject the RSE model object that has the property set.
* @param clean true if we are creating, false if we are merging
* @return an array of DOM nodes - each one being a property set
*/
public RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject modelObject, boolean clean) {
IPropertySet[] propertySets = modelObject.getPropertySets();
for (int i = 0; i < propertySets.length; i++) {
IPropertySet set = propertySets[i];
RSEDOMNode node = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName());
String[] keys = set.getPropertyKeys();
for (int k = 0; k < keys.length; k++) {
String key = keys[k];
String value = set.getPropertyValue(key);
IPropertyType type = set.getPropertyType(key);
node.addAttribute(key, value, type.toString());
}
}
return parent.getChildren();
}
/**
* Create a DOM node representing a filter pool
* @param parent the parent DOM node
* @param filterPool the filter pool from which to create a DOM node linked to this parent
* @param clean true if we are creating, false if we are merging
* @return the DOM node representing the filter pool
*/
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPool filterPool, boolean clean) {
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL, filterPool, clean);
if (clean || node.isDirty()) {
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterPool.getType());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filterPool.getId());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filterPool.supportsNestedFilters()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DELETABLE, getBooleanString(filterPool.isDeletable()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterPool.isDefault()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filterPool.isSetStringsCaseSensitive()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS, getBooleanString(filterPool.supportsDuplicateFilterStrings()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, "" + filterPool.getRelease());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filterPool.isSetSingleFilterStringOnly()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME, filterPool.getOwningParentName());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filterPool.isNonRenamable()));
}
ISystemFilter[] filters = filterPool.getSystemFilters();
for (int i = 0; i < filters.length; i++) {
createNode(node, filters[i], clean);
}
createPropertySetNodes(node, filterPool, clean);
node.setDirty(false);
return node;
}
/**
* Creates a DOM node for a filter
* @param parent The parent DOM node for this filter, usually a DOM node for a filter pool
* @param filter the filter for which to create a new node
* @param clean true if we are creating, false if we are merging
* @return the DOM node representing the filter
*/
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilter filter, boolean clean) {
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER, filter, clean);
if (clean || node.isDirty()) {
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filter.getName());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filter.isSupportsNestedFilters()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELATIVE_ORDER, "" + filter.getRelativeOrder());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filter.isDefault()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filter.isSetStringsCaseSensitive()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(filter.isPromptable()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS, getBooleanString(filter.supportsDuplicateFilterStrings()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_DELETABLE, getBooleanString(filter.isNonDeletable()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filter.isNonRenamable()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_CHANGEABLE, getBooleanString(filter.isNonChangable()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRINGS_NON_CHANGABLE, getBooleanString(filter.isStringsNonChangable()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, "" + filter.getRelease());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filter.isSetSingleFilterStringOnly()));
}
// add nested filters
ISystemFilter[] nestedFilters = filter.getSystemFilters();
for (int i = 0; i < nestedFilters.length; i++) {
createNode(node, nestedFilters[i], clean);
}
// add filter strings
ISystemFilterString[] filterStrings = filter.getSystemFilterStrings();
for (int j = 0; j < filterStrings.length; j++) {
createNode(node, filterStrings[j], clean);
}
createPropertySetNodes(node, filter, clean);
node.setDirty(false);
return node;
}
/**
* Creates a DOM node for a filter string
* @param parent the DOM node that is the parent to this filter string. This should be a node for a filter.
* @param filterString The filter string for which the node will be created
* @param clean true if we are creating, false if we are merging
* @return the DOM node for the filter string
*/
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterString filterString, boolean clean) {
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_STRING, filterString, clean);
if (clean || node.isDirty()) {
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING, filterString.getString());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterString.getType());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterString.isDefault()));
}
createPropertySetNodes(node, filterString, clean);
return node;
}
/**
* Create a DOM node representing a host
* @param parent The DOM node that is the parent to this host, usually a node representing a profile
* @param host The host for which to create the DOM node
* @param clean true if we are creating, false if we are merging
* @return the DOM node for the host
*/
public RSEDOMNode createNode(RSEDOMNode parent, IHost host, boolean clean) {
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_HOST, host, clean);
if (clean || node.isDirty()) {
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, host.getSystemType());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE, getBooleanString(host.isOffline()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME, host.getHostName());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, host.getDescription());
}
IConnectorService[] connectorServices = host.getConnectorServices();
for (int i = 0; i < connectorServices.length; i++) {
IConnectorService service = connectorServices[i];
createNode(node, service, clean);
}
createPropertySetNodes(node, host, clean);
node.setDirty(false);
return node;
}
/**
* Creates a DOM node for a connector service
* @param parent the DOM node representing the parent for a connector service. This should be a Host
* @param connectorService the connector service for which a DOM node is to be created
* @param clean true if we are creating, false if we are merging
* @return the DOM node for the connector service
*/
public RSEDOMNode createNode(RSEDOMNode parent, IConnectorService connectorService, boolean clean) {
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, connectorService, clean);
if (clean || node.isDirty()) {
// store it's attributes
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, connectorService.getHostType());
// can't do this til connector service owns the properties (right now it's still subsystem)
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP, connectorService.getName());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL, getBooleanString(connectorService.isUsingSSL()));
}
// store the server launcher
// right now subsystem still owns the server launchers
// that will change later
IServerLauncherProperties serverLauncher = connectorService.getRemoteServerLauncherProperties();
if (serverLauncher != null) {
createNode(node, serverLauncher, clean);
}
// store each subsystem
ISubSystem[] subSystems = connectorService.getSubSystems();
for (int i = 0; i < subSystems.length; i++) {
createNode(node, subSystems[i], clean);
}
createPropertySetNodes(node, connectorService, clean);
node.setDirty(false);
return node;
}
/**
* Creates a DOM node for a server launcher
* @param parent the DOM node represnting a parent for a server launcher, usually a connector service
* @param serverLauncher the server launcher from which to create the node
* @param clean true if we are creating, false if we are merging
* @return the node representing the server launcher
*/
public RSEDOMNode createNode(RSEDOMNode parent, IServerLauncherProperties serverLauncher, boolean clean) {
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SERVER_LAUNCHER, serverLauncher, clean);
if (clean || node.isDirty()) {
}
serverLauncher.saveToProperties();
createPropertySetNodes(node, serverLauncher, clean);
return node;
}
/**
* Creates a DOM node for a subsystem
* @param parent the DOM node representing the parent for this subsystem, usually a connector service
* @param subSystem the subsystem from which to create the DOM node
* @param clean true if we are creating, false if we are merging
* @return the DOM node representing the subsystem
*/
public RSEDOMNode createNode(RSEDOMNode parent, ISubSystem subSystem, boolean clean) {
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SUBSYSTEM, subSystem, clean);
if (clean || node.isDirty()) {
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN, getBooleanString(subSystem.isHidden()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, subSystem.getSubSystemConfiguration().getId());
}
// create filter pool reference nodes
ISystemFilterPoolReferenceManager refMgr = subSystem.getFilterPoolReferenceManager();
if (refMgr != null) {
ISystemFilterPoolReference[] references = refMgr.getSystemFilterPoolReferences();
for (int i = 0; i < references.length; i++) {
ISystemFilterPoolReference ref = references[i];
createNode(node, ref, clean);
}
}
createPropertySetNodes(node, subSystem, clean);
node.setDirty(false);
return node;
}
/**
* Creates a DOM node for a filter pool reference
* @param parent the DOM node representing the parent for a filter pool reference, usually a subsystem
* @param filterPoolReference the reference from which to create a new DOM node
* @param clean true if we are creating, false if we are merging
* @return the DOM node created for the filter pool reference
*/
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPoolReference filterPoolReference, boolean clean) {
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE, filterPoolReference, clean);
if (clean || node.isDirty()) {
ISystemFilterPool filterPool = filterPoolReference.getReferencedFilterPool();
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID, filterPool.getId());
}
createPropertySetNodes(node, filterPoolReference, clean);
node.setDirty(false);
return node;
}
/**
* @param parent the DOM node representing the parent of the node we are trying to find
* @param type the type of the DOM node to look for
* @param modelObject the model object for which we are trying to find a matching node
* @param clean true if we are creating, false if we are merging
* @return the DOM node that we found or created
*/
private RSEDOMNode findOrCreateNode(RSEDOMNode parent, String type, IRSEModelObject modelObject, boolean clean) {
RSEDOMNode node = null;
String name = modelObject.getName();
if (!clean) {
node = parent.getChild(type, name);
if (node != null && modelObject.isDirty()) {
node.clearAttributes();
node.setDirty(true);
}
}
boolean newNode = (node == null);
if (newNode) {
node = new RSEDOMNode(parent, type, name);
}
return node;
}
/**
* Helper to get either "true" or "false" based on boolean flag
* @param flag the flag which to translate
* @return a string value suitable for the DOM
*/
private String getBooleanString(boolean flag) {
return flag ? IRSEDOMConstants.ATTRIBUTE_TRUE : IRSEDOMConstants.ATTRIBUTE_FALSE;
}
}

View file

@ -0,0 +1,554 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.persistence.dom;
import java.util.Vector;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterConstants;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.core.filters.ISystemFilterStartHere;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.IPropertyType;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemProfileManager;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.PropertyType;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.IServiceSubSystem;
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.SubSystemFilterNamingPolicy;
import org.eclipse.rse.persistence.dom.IRSEDOMConstants;
import org.eclipse.rse.persistence.dom.IRSEDOMImporter;
import org.eclipse.rse.persistence.dom.RSEDOM;
import org.eclipse.rse.persistence.dom.RSEDOMNode;
import org.eclipse.rse.persistence.dom.RSEDOMNodeAttribute;
public class RSEDOMImporter implements IRSEDOMImporter
{
private static RSEDOMImporter _instance = new RSEDOMImporter();
private ISystemRegistry _registry;
public static RSEDOMImporter getInstance()
{
return _instance;
}
public RSEDOMImporter()
{
}
public void setSystemRegistry(ISystemRegistry registry)
{
_registry = registry;
}
/**
* Restores the profile represented by dom
* @param profileManager
* @param dom
* @return the restored profile
*/
public ISystemProfile restoreProfile(ISystemProfileManager profileManager, RSEDOM dom)
{
// create the profile
String profileName = dom.getName();
boolean defaultPrivate = getBooleanValue(dom.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT_PRIVATE).getValue());
boolean isActive = getBooleanValue(dom.getAttribute(IRSEDOMConstants.ATTRIBUTE_IS_ACTIVE).getValue());
ISystemProfile profile = profileManager.createSystemProfile(profileName, isActive);
if (profile != null)
{
profile.setDefaultPrivate(defaultPrivate);
profileManager.makeSystemProfileActive(profile, isActive);
// restore the children for the profile
RSEDOMNode[] children = dom.getChildren();
for (int i = 0;i < children.length; i++)
{
RSEDOMNode child = children[i];
String type = child.getType();
if (type.equals(IRSEDOMConstants.TYPE_HOST))
{
restoreHost(profile, child);
}
else if (type.equals(IRSEDOMConstants.TYPE_FILTER_POOL))
{
restoreFilterPool(profile, child);
}
else if (type.equals(IRSEDOMConstants.TYPE_PROPERTY_SET))
{
restorePropertySet(profile, child);
}
}
}
return profile;
}
/**
* Restores the host represented by hostNode
*/
public IHost restoreHost(ISystemProfile profile, RSEDOMNode hostNode)
{
IHost host = null;
// get host node attributes
String connectionName = hostNode.getName();
String systemType = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
String hostName = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME).getValue();
String description = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION).getValue();
boolean isOffline = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE).getValue());
boolean isPromptable = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE).getValue());
// create host and set it's attributes
try
{
// NOTE create host effectively recreates the subsystems
// so instead of creating subsystems on restore, we should be updating their properties
host = profile.createHost(systemType, connectionName, hostName, description);
host.setOffline(isOffline);
host.setPromptable(isPromptable);
}
catch (Exception e)
{
e.printStackTrace();
}
// restore children of host
RSEDOMNode[] children = hostNode.getChildren();
for (int i = 0;i < children.length; i++)
{
RSEDOMNode child = children[i];
String type = child.getType();
if (type.equals(IRSEDOMConstants.TYPE_CONNECTOR_SERVICE))
{
restoreConnectorService(host, child);
}
else if (type.equals(IRSEDOMConstants.TYPE_PROPERTY_SET))
{
restorePropertySet(profile, child);
}
}
return host;
}
/**
* Restore the connector service represented by connectorServiceNode
*/
public IConnectorService restoreConnectorService(IHost host, RSEDOMNode connectorServiceNode)
{
// TODO - this should come before subsystems
// but currently we're still using old way of creating subsystem first
IConnectorService service = null;
// get attributes of the service
// String name = connectorServiceNode.getName();
// String type = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
// String group = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP).getValue();
boolean useSSL = getBooleanValue(connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL).getValue());
// first restore subsystems (since right now we need subsystem to get at service
RSEDOMNode[] ssChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_SUBSYSTEM);
for (int s = 0; s < ssChildren.length; s++)
{
RSEDOMNode ssChild = ssChildren[s];
ISubSystem subSystem = restoreSubSystem(host, ssChild);
if (subSystem != null && service == null)
{
ISubSystemConfiguration factory = subSystem.getSubSystemConfiguration();
service = factory.getConnectorService(host);
if (service != null)
{
if (factory.supportsServerLaunchProperties(host))
{
IServerLauncherProperties sl = factory.createServerLauncher(service);
if (sl != null)
{
// get server launcher properties
// right now we just set them for subsystem, but later that will change
RSEDOMNode serverLauncherPropertiesNode = null;
RSEDOMNode[] slChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_SERVER_LAUNCHER);
if (slChildren != null && slChildren.length > 0)
{
serverLauncherPropertiesNode = slChildren[0];
restoreServerLauncher(service, serverLauncherPropertiesNode, sl);
}
}
}
service.setIsUsingSSL(useSSL);
}
}
if (service != null && subSystem != null)
{
subSystem.setConnectorService(service);
}
}
// restore all property sets
RSEDOMNode[] psChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET);
for (int p = 0;p < psChildren.length; p++)
{
RSEDOMNode psChild = psChildren[p];
restorePropertySet(service, psChild);
}
return service;
}
public IServerLauncherProperties restoreServerLauncher(IConnectorService service, RSEDOMNode serverLauncherNode, IServerLauncherProperties sl)
{
// restore all property sets
RSEDOMNode[] psChildren = serverLauncherNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET);
for (int p = 0;p < psChildren.length; p++)
{
RSEDOMNode psChild = psChildren[p];
restorePropertySet(sl, psChild);
}
sl.restoreFromProperties();
service.setRemoteServerLauncherProperties(sl);
return sl;
}
/**
* Restores the subsystem represented by subSystemNode
*/
public ISubSystem restoreSubSystem(IHost host, RSEDOMNode subSystemNode)
{
// in most cases (if not all) the subsystem already exists
// since createHost() ends up recreating subsystems for each factory
String name = subSystemNode.getName();
String type = subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
boolean isHidden = getBooleanValue(subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN).getValue());
ISubSystem subSystem = null;
ISubSystemConfiguration factory = getSubSystemConfiguration(type);
if (factory != null)
{
if (factory instanceof IServiceSubSystemConfiguration)
{
IServiceSubSystemConfiguration serviceFactory = (IServiceSubSystemConfiguration)factory;
ISubSystem[] existingSubSystems = _registry.getServiceSubSystems(serviceFactory.getServiceType(), host);
if (existingSubSystems != null && existingSubSystems.length > 0)
{
subSystem = existingSubSystems[0];
// need to switch factories
((IServiceSubSystem)subSystem).switchServiceFactory(serviceFactory);
}
}
else
{
ISubSystem[] existingSubSystems = _registry.getSubSystems(type, host);
if (existingSubSystems != null && existingSubSystems.length > 0)
{
subSystem = existingSubSystems[0];
}
}
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())
{
ISystemFilterStartHere startHere = _registry.getSystemFilterStartHere();
ISystemFilterPoolReferenceManager fprMgr = startHere.createSystemFilterPoolReferenceManager(subSystem, factory, name, new SubSystemFilterNamingPolicy());
subSystem.setFilterPoolReferenceManager(fprMgr);
ISystemFilterPoolManager defaultFilterPoolManager = factory.getFilterPoolManager(host.getSystemProfile());
fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager);
}
// restore filer pool references
RSEDOMNode[] filterPoolReferenceChildren = subSystemNode.getChildren(IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE);
for (int i = 0; i < filterPoolReferenceChildren.length; i++)
{
RSEDOMNode fprChild = filterPoolReferenceChildren[i];
restoreFilterPoolReference(subSystem, fprChild);
}
// restore all property sets
RSEDOMNode[] psChildren = subSystemNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET);
for (int p = 0;p < psChildren.length; p++)
{
RSEDOMNode psChild = psChildren[p];
restorePropertySet(subSystem, psChild);
}
}
return subSystem;
}
/**
* Restore the filter
*/
public ISystemFilter restoreFilter(ISystemFilterPool filterPool, RSEDOMNode node)
{
// get the node attributes for a filter
String name = node.getName();
boolean supportsNestedFilters = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS).getValue());
int relativeOrder = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELATIVE_ORDER).getValue());
boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue());
boolean isSetStringsCaseSensitive = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE).getValue());
boolean isPromptable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE).getValue());
boolean isSetSupportsDuplicateFilterStrings = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS).getValue());
boolean isNonDeletable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_DELETABLE).getValue());
boolean isNonRenamable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE).getValue());
boolean isNonChangable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_CHANGEABLE).getValue());
boolean isStringsNonChangable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRINGS_NON_CHANGABLE).getValue());
int release = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE).getValue());
boolean isSetSingleFilterStringOnly = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY).getValue());
Vector filterStrings = new Vector();
// create the filter strings
RSEDOMNode filterStringNodes[] = node.getChildren(IRSEDOMConstants.TYPE_FILTER_STRING);
for (int i = 0; i < filterStringNodes.length; i++)
{
RSEDOMNode filterStringNode = filterStringNodes[i];
// might not have to restore the filter strings this way
//restoreFilterString(filter, filterStringNode);
filterStrings.add(filterStringNode.getName());
}
// create the filter
ISystemFilter filter = filterPool.createSystemFilter(name, filterStrings);
filter.setWasRestored(true);
// set filter attributes
filter.setSupportsNestedFilters(supportsNestedFilters);
filter.setRelativeOrder(relativeOrder);
filter.setDefault(isDefault);
filter.setStringsCaseSensitive(isSetStringsCaseSensitive);
filter.setPromptable(isPromptable);
filter.setSupportsDuplicateFilterStrings(isSetSupportsDuplicateFilterStrings);
filter.setNonDeletable(isNonDeletable);
filter.setNonChangable(isNonChangable);
filter.setNonRenamable(isNonRenamable);
filter.setStringsNonChangable(isStringsNonChangable);
filter.setRelease(release);
filter.setSingleFilterStringOnly(isSetSingleFilterStringOnly);
// restore all property sets
RSEDOMNode[] psChildren = node.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET);
for (int p = 0;p < psChildren.length; p++)
{
RSEDOMNode psChild = psChildren[p];
restorePropertySet(filter, psChild);
}
return filter;
}
/**
* Restore the filter pool represented by the node
*/
public ISystemFilterPool restoreFilterPool(ISystemProfile profile, RSEDOMNode node)
{
ISystemFilterPool filterPool = null;
// get the node attributes for a filter pool
String name = node.getName();
String type = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
String id = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_ID).getValue();
boolean supportsNestedFilters = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS).getValue());
boolean isDeletable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DELETABLE).getValue());
boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue());
boolean isSetStringsCaseSensitive = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE).getValue());
boolean isSetSupportsDuplicateFilterStrings = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS).getValue());
int release = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE).getValue());
boolean isSetSingleFilterStringOnly = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY).getValue());
String owningParentName = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME).getValue();
boolean isNonRenamable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE).getValue());
// create the filter pool and set it's attributes
try
{
ISubSystemConfiguration factory = getSubSystemConfiguration(id);
if (factory != null)
{
ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile);
if (isDefault)
{
filterPool = mgr.getFirstDefaultSystemFilterPool();
}
else
{
filterPool = mgr.getSystemFilterPool(name);
}
if (filterPool == null)
{
filterPool = _registry.getSystemFilterPool().createSystemFilterPool(name,
supportsNestedFilters,
isDeletable,
ISystemFilterConstants.TRY_TO_RESTORE_NO);
if (filterPool != null)
{
filterPool.setSystemFilterPoolManager(mgr);
// add to model
mgr.getPools().add(filterPool);
}
}
filterPool.setType(type);
filterPool.setDefault(isDefault);
filterPool.setSupportsNestedFilters(supportsNestedFilters);
filterPool.setStringsCaseSensitive(isSetStringsCaseSensitive);
filterPool.setSupportsDuplicateFilterStrings(isSetSupportsDuplicateFilterStrings);
filterPool.setRelease(release);
filterPool.setSingleFilterStringOnly(isSetSingleFilterStringOnly);
filterPool.setOwningParentName(owningParentName);
filterPool.setNonRenamable(isNonRenamable);
filterPool.setWasRestored(true);
}
}
catch (Exception e)
{
e.printStackTrace();
}
// restore children
RSEDOMNode[] children = node.getChildren();
for (int i = 0;i < children.length; i++)
{
RSEDOMNode child = children[i];
String ctype = child.getType();
if (ctype.equals(IRSEDOMConstants.TYPE_FILTER))
{
if (filterPool != null)
{
restoreFilter(filterPool, child);
}
}
else if (ctype.equals(IRSEDOMConstants.TYPE_PROPERTY_SET))
{
restorePropertySet(filterPool, child);
}
}
return filterPool;
}
/**
* Restore the filter pool reference that is represented by the node
*/
public ISystemFilterPoolReference restoreFilterPoolReference(ISubSystem subsystem, RSEDOMNode node) {
ISystemFilterPoolReference filterPoolReference = null;
String 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.
*/
// create reference to the filterpool
if (filterPool != null) {
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPool);
} else {
try {
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPoolManager, filterPoolName);
} catch(NullPointerException e) {
//TODO Workaround for bug 153253 -- should be fixed properly
System.err.println("TODO: Fix bug 153253 - NPE reading connection-private filter pools");
e.printStackTrace();
}
}
}
return filterPoolReference;
}
public ISystemFilterString restoreFilterString(ISystemFilter filter, RSEDOMNode node)
{
/*
String string = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING).getValue();
String type = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue());
SystemFilterString filterString = filter
*/
return null;//not sure if we need this
}
/**
* Restores the property set represented by propertySetNode
*/
public IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode)
{
String name = propertySetNode.getName();
IPropertySet set = modelObject.createPropertySet(name);
RSEDOMNodeAttribute[] attributes = propertySetNode.getAttributes();
for (int i = 0; i < attributes.length; i++)
{
RSEDOMNodeAttribute attribute = attributes[i];
String typeStr = attribute.getType();
IPropertyType type = PropertyType.fromString(typeStr);
set.addProperty(attribute.getKey(), attribute.getValue(), type);
}
return set;
}
private boolean getBooleanValue(String booleanStr)
{
return ((booleanStr != null) && booleanStr.equalsIgnoreCase(IRSEDOMConstants.ATTRIBUTE_TRUE));
}
private int getIntegerValue(String integerString)
{
return Integer.parseInt(integerString);
}
/**
* Returns the subsystem configuration for a given subsystem name
* @param subsystemName the name to look up
* @return the subsystem configuration matching the name
*/
private ISubSystemConfiguration getSubSystemConfiguration(String subsystemName)
{
return _registry.getSubSystemConfiguration(subsystemName);
}
}

View file

@ -0,0 +1,119 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.persistence;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemHostPool;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemProfileManager;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.logging.Logger;
public interface IRSEPersistenceManager
{
/**
* Register the persistence provider to be used when saving and restoring RSE doms.
* The provider is registered under the provided id.
* @param id the provider id.
* @param provider the provider.
*/
public void registerRSEPersistenceProvider(String id, IRSEPersistenceProvider provider);
/**
* Restore all profiles
* @param profileManager
* @return true if successful
*/
public boolean restore(ISystemProfileManager profileManager);
/**
* Save all profiles
* @param profileManager
* @return true if successful
*/
public boolean commit(ISystemProfileManager profileManager);
public boolean commit(IHost host);
/**
* Restore all connections in the connection pool
* @param connectionPool
* @return true if successful
*/
public boolean restore(ISystemHostPool connectionPool);
/**
* Save all connections in the connection pool
* @param connectionPool
* @return true if successful
*/
public boolean commit(ISystemHostPool connectionPool);
public boolean commit(ISystemFilterPoolManager filterPoolManager);
/**
* Save all the filters in the filter pool
* @param filterPool
* @return true if successful
*/
public boolean commit(ISystemFilterPool filterPool);
/**
* Save this filter
* @param filter
* @return true if successful
*/
public boolean commit(ISystemFilter filter);
/**
* Restore all the filters for the filter pool
* @param filterPool
* @return true if sucessful
*/
public boolean restore(ISystemFilterPool filterPool);
/**
* Restore the filter pool
* @param name
* @return the filter pool if successful
*/
public ISystemFilterPool restoreFilterPool(String name);
/**
* Save this subsystem
* @param subSystem
* @return true if successful
*/
public boolean commit(ISubSystem subSystem);
/**
* Save this profile
* @param profile
* @return true if successful
*/
public boolean commit(ISystemProfile profile);
public ISystemFilterPoolManager restoreFilterPoolManager(ISystemProfile profile, Logger logger, ISystemFilterPoolManagerProvider caller, String name);
public boolean isExporting();
public boolean isImporting();
}

View file

@ -0,0 +1,55 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.persistence;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.persistence.dom.RSEDOM;
/**
* This is the interface that needs to be implemented when providing an extension
* using the RSE persistence provider extension point.
*
* Implement this class to provide a specialized means of
* saving and restoring RSEDOM
*
*/
public interface IRSEPersistenceProvider
{
/**
* Restores an RSE DOM given a profileName.
*
* @param profileName name of the Profile to load
* @param monitor
* @return the RSE DOM for the specified profile
*/
public RSEDOM loadRSEDOM(String profileName, IProgressMonitor monitor);
/**
* Persists an RSE DOM.
*
* @param dom the RSE DOM to persist
* @param monitor
* @return true if succcessful
*/
public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor);
/**
* @return The names of the profiles that have been saved by this persistence provider.
*/
public String[] getSavedProfileNames();
}

View file

@ -0,0 +1,88 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.persistence.dom;
public interface IRSEDOMConstants
{
// node types
public static final String TYPE_PROFILE = "Profile";
public static final String TYPE_PROPERTY_SET = "PropertySet";
public static final String TYPE_PROPERTY = "Property";
public static final String TYPE_HOST = "Host";
public static final String TYPE_FILTER_POOL = "FilterPool";
public static final String TYPE_FILTER = "Filter";
public static final String TYPE_FILTER_STRING = "FilterString";
public static final String TYPE_FILTER_POOL_REFERENCE = "FilterPoolReference";
public static final String TYPE_CONNECTOR_SERVICE = "ConnectorService";
public static final String TYPE_SERVER_LAUNCHER = "ServerLauncher";
public static final String TYPE_SUBSYSTEM = "SubSystem";
// node attributes
// profile attributes
public static final String ATTRIBUTE_DEFAULT_PRIVATE="defaultPrivate";
public static final String ATTRIBUTE_IS_ACTIVE="isActive";
// subsystem attributes
public static final String ATTRIBUTE_HIDDEN="hidden";
// common attributes
public static final String ATTRIBUTE_NAME="name";
public static final String ATTRIBUTE_TYPE="type";
// host attributes
public static final String ATTRIBUTE_HOSTNAME = "hostname";
public static final String ATTRIBUTE_OFFLINE = "offline";
public static final String ATTRIBUTE_DESCRIPTION = "description";
// ConnectorService attributes
public static final String ATTRIBUTE_GROUP="group";
public static final String ATTRIBUTE_USE_SSL="useSSL";
// Filter string attributes
public static final String ATTRIBUTE_STRING = "string";
// filter attributes
public static final String ATTRIBUTE_SUPPORTS_NESTED_FILTERS = "supportsNestedFilters";
public static final String ATTRIBUTE_RELATIVE_ORDER = "relativeOrder";
public static final String ATTRIBUTE_DEFAULT = "default";
public static final String ATTRIBUTE_STRING_CASE_SENSITIVE = "stringsCaseSensitive";
public static final String ATTRIBUTE_PROMPTABLE ="promptable";
public static final String ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS="supportsDuplicateFilterStrings";
public static final String ATTRIBUTE_NON_DELETABLE="nonDeletable";
public static final String ATTRIBUTE_NON_RENAMABLE="nonRenamable";
public static final String ATTRIBUTE_NON_CHANGEABLE="nonChangable";
public static final String ATTRIBUTE_STRINGS_NON_CHANGABLE="stringsNonChangable";
public static final String ATTRIBUTE_RELEASE="release";
public static final String ATTRIBUTE_SINGLE_FILTER_STRING_ONLY="singleFilterStringOnly";
// server launcher attributes
public static final String ATTRIBUTE_REXEC_PORT="rexecPort";
public static final String ATTRIBUTE_DAEMON_PORT="daemonPort";
public static final String ATTRIBUTE_PORT="port";
public static final String ATTRIBUTE_SERVER_PATH="serverPath";
public static final String ATTRIBUTE_SERVER_SCRIPT="serverScript";
public static final String ATTRIBUTE_RESTRICTED_TYPES="restrictedTypes";
public static final String ATTRIBUTE_VALUE = "value";
public static final String ATTRIBUTE_ID = "id";
public static final String ATTRIBUTE_OWNING_PARENT_NAME = "owningParentName";
public static final String ATTRIBUTE_REF_ID= "refID";
public static final String ATTRIBUTE_DELETABLE = "deletable";
public static final String ATTRIBUTE_TRUE = "true";
public static final String ATTRIBUTE_FALSE = "false";
}

View file

@ -0,0 +1,130 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.persistence.dom;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.ISubSystem;
public interface IRSEDOMExporter
{
/**
* Creates the RSE DOM for this profile
* @param profile
* @param clean indicates whether to create from scratch or merger
* @return
*/
RSEDOM createRSEDOM(ISystemProfile profile, boolean clean);
/**
* Creates an RSE DOM for use in persistence
* @param dom
* @param profile
* @return
*/
public RSEDOM populateRSEDOM(RSEDOM dom, ISystemProfile profile, boolean clean);
/**
* Returns the RSEDOM for this profile iff it exists
* @param profile
* @return
*/
RSEDOM getRSEDOM(ISystemProfile profile);
/**
* Create a DOM node representing a host
* @param parent
* @param host
* @return
*/
RSEDOMNode createNode(RSEDOMNode parent, IHost host, boolean clean);
/**
* Creates a DOM node for a connector service
* @param parent
* @param connectorService
* @return
*/
RSEDOMNode createNode(RSEDOMNode parent, IConnectorService cs, boolean clean);
/**
* Creates a DOM node for a server launcher
* @param parent
* @param serverLauncher
* @return
*/
RSEDOMNode createNode(RSEDOMNode parent, IServerLauncherProperties sl, boolean clean);
/**
* Creates a DOM node for a subsystem
* @param parent
* @param subSystem
* @return
*/
RSEDOMNode createNode(RSEDOMNode parent, ISubSystem ss, boolean clean);
/**
* Creates a DOM node for a filter
* @param parent
* @param filter
* @return
*/
RSEDOMNode createNode(RSEDOMNode parent, ISystemFilter sf, boolean clean);
/**
* Create a DOM node representing a filter pool
* @param parent
* @param filterPool
* @return
*/
RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPool fp, boolean clean);
/**
* Creates a DOM node for a filter pool reference
* @param parent
* @param filterPoolReference
* @return
*/
RSEDOMNode createNode(RSEDOMNode parent , ISystemFilterPoolReference fpr, boolean clean);
/**
* Creates a DOM node for a filter string
* @param parent
* @param filterString
* @return
*/
RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterString fs, boolean clean);
/**
* Creates DOM nodes for each associated property set
* @param parent
* @param modelObject
* @return
*/
RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject mo, boolean clean);
}

View file

@ -0,0 +1,78 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.persistence.dom;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemProfileManager;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.ISubSystem;
public interface IRSEDOMImporter
{
/**
* Restores the profile represented by dom
* @param profileManager
* @param dom
* @return the restored profile
*/
ISystemProfile restoreProfile(ISystemProfileManager profileManager, RSEDOM dom);
/**
* Restores the host represented by hostNode
*/
IHost restoreHost(ISystemProfile profile, RSEDOMNode hostNode);
/**
* Restore the connector service represented by connectorServiceNode
*/
IConnectorService restoreConnectorService(IHost host, RSEDOMNode connectorServiceNode);
IServerLauncherProperties restoreServerLauncher(IConnectorService service, RSEDOMNode serverLauncherNode, IServerLauncherProperties slproperties);
/**
* Restores the subsystem represented by subSystemNode
*/
ISubSystem restoreSubSystem(IHost host, RSEDOMNode subSystemNode);
ISystemFilter restoreFilter(ISystemFilterPool filterPool, RSEDOMNode systemFilterNode);
/**
* Restore the filter pool represented by the node
*/
ISystemFilterPool restoreFilterPool(ISystemProfile profile, RSEDOMNode systemFilterPoolNode);
ISystemFilterPoolReference restoreFilterPoolReference(ISubSystem subSystem, RSEDOMNode systemFilterPoolReferenceNode);
ISystemFilterString restoreFilterString(ISystemFilter filter, RSEDOMNode systemFilterStringNode);
/**
* Restores the property set represented by propertySetNode
*/
IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode);
}

View file

@ -0,0 +1,99 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.persistence.dom;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.rse.core.model.ISystemProfile;
/**
* This class is the root node of an RSE DOM. Each
* RSEDOM represents the properties of a profile to persist.
*/
public class RSEDOM extends RSEDOMNode {
/*
* Recommended for serializable objects. This should be updated if there is a schema change.
*/
private static final long serialVersionUID = 1L;
private Job saveJob = null;
private transient ISystemProfile _profile;
public RSEDOM(ISystemProfile profile) {
super(null, TYPE_PROFILE, profile.getName());
_profile = profile;
}
public RSEDOM(String profileName) {
super(null, TYPE_PROFILE, profileName);
_profile = null;
}
public ISystemProfile getProfile() {
return _profile;
}
/**
* Indicate that this DOM needs to be saved
*/
public void markForSave() {
if (!restoring && !_needsSave) {
_needsSave = true;
}
}
/**
* @return true if this DOM has the DOM changed since last saved or restored.
*/
public boolean needsSave() {
return _needsSave;
}
public void print(RSEDOMNode node, String indent) {
String type = node.getType();
String name = node.getName();
RSEDOMNodeAttribute[] attributes = node.getAttributes();
RSEDOMNode[] children = node.getChildren();
System.out.println(indent + "RSEDOMNode " + type);
System.out.println(indent + "{");
String sindent = indent + " ";
System.out.println(sindent + "name=" + name);
for (int i = 0; i < attributes.length; i++) {
RSEDOMNodeAttribute attribute = attributes[i];
String key = attribute.getKey();
String value = attribute.getValue();
System.out.println(sindent + key + "=" + value);
}
String cindent = sindent + " ";
for (int c = 0; c < children.length; c++) {
RSEDOMNode child = children[c];
print(child, cindent);
}
System.out.println(indent + "}");
}
public Job getSaveJob() {
return saveJob;
}
public void setSaveJob(Job saveJob) {
this.saveJob = saveJob;
}
}

View file

@ -0,0 +1,265 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.persistence.dom;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class RSEDOMNode implements IRSEDOMConstants, Serializable
{
/*
* Recommended for serializable objects. This should be updated if there is a schema change.
*/
private static final long serialVersionUID = 1L;
protected String _type;
protected String _name;
protected RSEDOMNode _parent;
protected List _children;
protected List _attributes;
protected boolean _needsSave = false;
protected boolean _isDirty = true;
protected boolean restoring = false;
public RSEDOMNode(RSEDOMNode parent, String type, String name)
{
_type = type;
_name = name;
_parent = parent;
_children = new ArrayList();
_attributes = new ArrayList();
if (parent != null)
{
parent.addChild(this);
}
}
public void markUpdated()
{
if (_needsSave)
{
_needsSave = false;
for (int i = 0; i < _children.size(); i++)
{
RSEDOMNode child = (RSEDOMNode)_children.get(i);
child.markUpdated();
}
}
}
/**
* Propagate needs save indicator up to the root
* @param flag
*/
public void markForSave()
{
if (!restoring && !_needsSave)
{
_needsSave = true;
_parent.markForSave();
}
}
/**
* Recursively removes all the children from this node on down
*
*/
public void clearChildren()
{
RSEDOMNode[] children = getChildren();
for (int i = 0; i < children.length; i++)
{
children[i].clearAttributes();
children[i].clearChildren();
}
_children.clear();
}
/**
* Clears all attributes
*
*/
public void clearAttributes()
{
_attributes.clear();
}
/**
* Returns the name of this node
* @return
*/
public String getName()
{
return _name;
}
/**
* Returns the type of this node
* @return
*/
public String getType()
{
return _type;
}
/**
* Returns the parent of this node
* @return
*/
public RSEDOMNode getParent()
{
return _parent;
}
/**
* Returns all the children of this node
* @return
*/
public RSEDOMNode[] getChildren()
{
return (RSEDOMNode[])_children.toArray(new RSEDOMNode[_children.size()]);
}
/**
* Returns the first attribute found that has the specified key
* @param key
* @return
*/
public RSEDOMNodeAttribute getAttribute(String key)
{
for (int i = 0; i < _attributes.size(); i++)
{
RSEDOMNodeAttribute attribute = (RSEDOMNodeAttribute)_attributes.get(i);
if (key.equals(attribute.getKey()))
{
return attribute;
}
}
return null;
}
/**
* Returns the immediate children of this node that are of the specified type
* @param type
* @return
*/
public RSEDOMNode[] getChildren(String type)
{
List results = new ArrayList();
for (int i = 0; i < _children.size(); i++)
{
RSEDOMNode child = (RSEDOMNode)_children.get(i);
if (type.equals(child.getType()))
{
results.add(child);
}
}
return (RSEDOMNode[])results.toArray(new RSEDOMNode[results.size()]);
}
/**
* Returns the first immediate child of this node that is of the specified type and name
* @param type
* @param name
* @return
*/
public RSEDOMNode getChild(String type, String name)
{
for (int i = 0; i < _children.size(); i++)
{
RSEDOMNode child = (RSEDOMNode)_children.get(i);
if (type.equals(child.getType()) && name.equals(child.getName()))
{
return child;
}
}
return null;
}
/**
* Returns all the attributes for this node
* @return
*/
public RSEDOMNodeAttribute [] getAttributes()
{
return (RSEDOMNodeAttribute[])_attributes.toArray(new RSEDOMNodeAttribute[_attributes.size()]);
}
/**
* Adds a child to this node
* @param child
*/
public void addChild(RSEDOMNode child)
{
_children.add(child);
markForSave();
}
/**
* Removes a child from this node
* @param child
*/
public void removeChild(RSEDOMNode child)
{
_children.remove(child);
markForSave();
}
/**
* Adds an attribute to the node
* @param name
* @param value
* @param type
*/
public void addAttribute(String name, String value, String type)
{
RSEDOMNodeAttribute attr = new RSEDOMNodeAttribute(name, value, type);
_attributes.add(attr);
markForSave();
}
/**
* Adds an attribute to the node
* @param name
* @param value
*/
public void addAttribute(String name, String value)
{
RSEDOMNodeAttribute attr = new RSEDOMNodeAttribute(name, value);
_attributes.add(attr);
markForSave();
}
public boolean isDirty()
{
return _isDirty;
}
public void setDirty(boolean isDirty)
{
_isDirty = isDirty;
}
public void setRestoring(boolean restoring) {
this.restoring = restoring;
}
}

View file

@ -0,0 +1,58 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.persistence.dom;
import java.io.Serializable;
public class RSEDOMNodeAttribute implements Serializable
{
private static final long serialVersionUID = 1L;
private String _key;
private String _value;
private String _type;
public RSEDOMNodeAttribute(String key, String value, String type)
{
_key = key;
_value = value;
_type = type;
}
public RSEDOMNodeAttribute(String key, String value)
{
_key = key;
_value = value;
_type = null;
}
public String getKey()
{
return _key;
}
public String getValue()
{
return _value;
}
public String getType()
{
return _type;
}
}

View file

@ -3,4 +3,26 @@
<plugin>
<extension-point id="systemTypes" name="RSE System Types" schema="schema/systemTypes.exsd"/>
<!-- ================================================================= -->
<!-- Define Persistence Provider extension point -->
<!-- ================================================================= -->
<extension-point id="persistenceProviders" name="%extPoint.persistenceProviders" schema="schema/persistenceProviders.exsd"/>
<!-- ========================================================================= -->
<!-- Persistence Providers -->
<!-- ========================================================================= -->
<extension
point="org.eclipse.rse.core.persistenceProviders">
<persistenceProvider
class="org.eclipse.rse.internal.persistence.SerializingProvider"
id="org.eclipse.rse.persistence.SerializingProvider"
name="Serializing Persistence Provider"/>
<persistenceProvider
class="org.eclipse.rse.internal.persistence.PropertyFileProvider"
id="org.eclipse.rse.persistence.PropertyFileProvider"
name="Property File Persistence Provider"/>
</extension>
</plugin>

View file

@ -0,0 +1,134 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.rse.core">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.rse.core" id="persistenceProviders" name="Persistence Providers"/>
</appInfo>
<documentation>
This extension point is used to allow the delegation of profile persistence to vendors where needed.
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="persistenceProvider" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="persistenceProvider">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
a unique name that will be used to identify the persistence Provider.
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
a translatable name that will be used to identify this persistence Provider in the UI.
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
a fully qualified name of the Java class that implements the &lt;samp&gt;org.eclipse.rse.persistence.IRSEPersistenceProvider&lt;/samp&gt; interface.
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.rse.persistence.IRSEpersistenceProvider"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
1.0.0
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
The following is an example of this extension point&apos;s usage:
&lt;p&gt;
&lt;pre&gt;
&lt;extension point=&quot;org.eclipse.rse.core.persistenceProviders&quot;&gt;
&lt;persistenceProvider
id=&quot;org.eclipse.rse.persistence.DefaultRSEpersistenceProvider&quot;
name=&quot;Default persistence Provider&quot;
class=&quot;org.eclipse.rse.persistence.DefaultRSEpersistenceProvider&quot;&gt;
&lt;/persistenceProvider&gt;
&lt;/extension&gt;
&lt;/pre&gt;
&lt;/p&gt;
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
Plug-ins that want to extend this extension point must implement &lt;samp&gt;org.eclipse.rse.persistence.IRSEPersistenceProvider&lt;/samp&gt; interface.
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
The Remote Systems Explorer in org.eclipse.rse.core provides a default implementation of this extension point.
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
Copyright (c) 2006 IBM Corporation. All Rights Reserved.
This program and the accompanying materials are made available under the terms
of the Eclipse Public License v1.0 which accompanies this distribution, and is
available at http://www.eclipse.org/legal/epl-v10.html
Contributors:
IBM Corporation - initial API and implementation
</documentation>
</annotation>
</schema>

View file

@ -22,8 +22,11 @@ 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.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.internal.persistence.RSEPersistenceManager;
import org.eclipse.rse.logging.Logger;
import org.eclipse.rse.logging.LoggerFactory;
import org.eclipse.rse.persistence.IRSEPersistenceManager;
import org.osgi.framework.BundleContext;
/**
@ -35,6 +38,24 @@ public class RSECorePlugin extends Plugin {
private static RSECorePlugin plugin;
private Logger logger = null;
private ISystemRegistry _registry;
private IRSEPersistenceManager _persistenceManager = null;
public static IRSEPersistenceManager getThePersistenceManager()
{
return getDefault().getPersistenceManager();
}
/**
* @return the persistence manager used for persisting RSE profiles
*/
public IRSEPersistenceManager getPersistenceManager()
{
if (_persistenceManager == null)
{
_persistenceManager = new RSEPersistenceManager(_registry);
}
return _persistenceManager;
}
/**
* @return the local machine name
*/
@ -67,6 +88,16 @@ public class RSECorePlugin extends Plugin {
public RSECorePlugin() {
plugin = this;
}
public void setSystemRegistry(ISystemRegistry registry)
{
_registry = registry;
}
public ISystemRegistry getSystemRegistry()
{
return _registry;
}
/*
* (non-Javadoc)

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import java.util.Vector;
import org.eclipse.rse.core.model.IRSEModelObject;
@ -72,7 +72,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
String getName();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getName <em>Name</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
@ -98,7 +98,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
String getType();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getType <em>Type</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getType <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Type</em>' attribute.
@ -124,7 +124,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isSupportsNestedFilters();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSupportsNestedFilters <em>Supports Nested Filters</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsNestedFilters <em>Supports Nested Filters</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Supports Nested Filters</em>' attribute.
@ -150,7 +150,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
int getRelativeOrder();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getRelativeOrder <em>Relative Order</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelativeOrder <em>Relative Order</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Relative Order</em>' attribute.
@ -176,7 +176,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isDefault();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isDefault <em>Default</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isDefault <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Default</em>' attribute.
@ -204,7 +204,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isStringsCaseSensitive();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Strings Case Sensitive</em>' attribute.
@ -216,7 +216,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
void setStringsCaseSensitive(boolean value);
/**
* Unsets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute.
* Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetStringsCaseSensitive()
@ -227,7 +227,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
void unsetStringsCaseSensitive();
/**
* Returns whether the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute is set.
* Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Strings Case Sensitive</em>' attribute is set.
@ -255,7 +255,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isPromptable();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isPromptable <em>Promptable</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isPromptable <em>Promptable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Promptable</em>' attribute.
@ -286,7 +286,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
public boolean supportsDuplicateFilterStrings();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSupportsDuplicateFilterStrings <em>Supports Duplicate Filter Strings</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsDuplicateFilterStrings <em>Supports Duplicate Filter Strings</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Supports Duplicate Filter Strings</em>' attribute.
@ -312,7 +312,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isNonDeletable();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isNonDeletable <em>Non Deletable</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonDeletable <em>Non Deletable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Non Deletable</em>' attribute.
@ -338,7 +338,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isNonRenamable();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isNonRenamable <em>Non Renamable</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonRenamable <em>Non Renamable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Non Renamable</em>' attribute.
@ -364,7 +364,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isNonChangable();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isNonChangable <em>Non Changable</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonChangable <em>Non Changable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Non Changable</em>' attribute.
@ -390,7 +390,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isStringsNonChangable();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isStringsNonChangable <em>Strings Non Changable</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsNonChangable <em>Strings Non Changable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Strings Non Changable</em>' attribute.
@ -416,7 +416,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
int getRelease();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getRelease <em>Release</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelease <em>Release</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Release</em>' attribute.
@ -444,7 +444,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
boolean isSingleFilterStringOnly();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Single Filter String Only</em>' attribute.
@ -456,7 +456,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
void setSingleFilterStringOnly(boolean value);
/**
* Unsets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetSingleFilterStringOnly()
@ -467,7 +467,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
void unsetSingleFilterStringOnly();
/**
* Returns whether the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute is set.
* Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Single Filter String Only</em>' attribute is set.
@ -480,8 +480,8 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
/**
* Returns the value of the '<em><b>Nested Filters</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.rse.filters.ISystemFilter}.
* It is bidirectional and its opposite is '{@link org.eclipse.rse.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}'.
* The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilter}.
* It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Nested Filters</em>' containment reference list isn't clear,
@ -490,14 +490,14 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
* <!-- end-user-doc -->
* @return the value of the '<em>Nested Filters</em>' containment reference list.
* @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_NestedFilters()
* @see org.eclipse.rse.filters.ISystemFilter#getParentFilter
* @see org.eclipse.rse.core.filters.ISystemFilter#getParentFilter
* @generated
*/
java.util.List getNestedFilters();
/**
* Returns the value of the '<em><b>Parent Filter</b></em>' container reference.
* It is bidirectional and its opposite is '{@link org.eclipse.rse.filters.ISystemFilter#getNestedFilters <em>Nested Filters</em>}'.
* It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters <em>Nested Filters</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Parent Filter</em>' container reference isn't clear,
@ -507,14 +507,14 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
* @return the value of the '<em>Parent Filter</em>' container reference.
* @see #setParentFilter(ISystemFilter)
* @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_ParentFilter()
* @see org.eclipse.rse.filters.ISystemFilter#getNestedFilters
* @see org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters
* @model opposite="nestedFilters"
* @generated
*/
ISystemFilter getParentFilter();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}' container reference.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Parent Filter</em>' container reference.
@ -525,7 +525,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
/**
* Returns the value of the '<em><b>Strings</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.rse.filters.ISystemFilterString}.
* The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilterString}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Strings</em>' containment reference list isn't clear,

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
/**
* Constants used throughout filters framework.
*/

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
//
import java.util.Vector;

View file

@ -14,10 +14,11 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import org.eclipse.rse.core.subsystems.ISubSystem;
/**
* Both SystemFilter and SystemFilterPool contain filters, so the
* common methods for filters are abstracted out in SystemFilterContainer,

View file

@ -14,8 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy;
package org.eclipse.rse.core.filters;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.references.IRSEPersistableReferencedObject;
@ -255,7 +254,7 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys
boolean isSingleFilterStringOnly();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Single Filter String Only</em>' attribute.
@ -267,7 +266,7 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys
void setSingleFilterStringOnly(boolean value);
/**
* Unsets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetSingleFilterStringOnly()
@ -278,7 +277,7 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys
void unsetSingleFilterStringOnly();
/**
* Returns whether the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute is set.
* Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Single Filter String Only</em>' attribute is set.
@ -306,7 +305,7 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys
String getOwningParentName();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#getOwningParentName <em>Owning Parent Name</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#getOwningParentName <em>Owning Parent Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Owning Parent Name</em>' attribute.
@ -332,7 +331,7 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys
boolean isNonRenamable();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#isNonRenamable <em>Non Renamable</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isNonRenamable <em>Non Renamable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Non Renamable</em>' attribute.
@ -341,4 +340,9 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys
*/
void setNonRenamable(boolean value);
public ISystemFilterPool createSystemFilterPool(
String name,
boolean allowNestedFilters,
boolean isDeletable,
boolean tryToRestore);
}

View file

@ -14,11 +14,11 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import java.util.Vector;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.persistance.IRSEPersistableContainer;
import org.eclipse.rse.model.ISystemProfile;
@ -622,7 +622,7 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer
boolean isSingleFilterStringOnly();
/**
* Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPoolManager#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPoolManager#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Single Filter String Only</em>' attribute.

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import org.eclipse.core.runtime.IAdaptable;
/**

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.references.IRSEPersistableReferencingObject;

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import java.util.Vector;

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
/**
* An interface for classes that instantiate SystemFilterPoolReferenceManager objects.
* This is the "caller" and as is recorded and recoverable from any object within

View file

@ -14,7 +14,8 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
/**

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
/**
* The system filter wizard allows callers to pass a list of wrapper objects
* for the user to select a filter pool

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
/**
* The system filter wizard allows callers to pass a list of wrapper objects
* for the user to select a filter pool. Effectively, this prompting for

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import org.eclipse.rse.core.model.ISystemContainer;
import org.eclipse.rse.core.model.ISystemContentsType;
import org.eclipse.rse.core.references.IRSEReferencingObject;

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
/**
* A save policy dictates how filter framework artifacts are persisted to disk.
*/

View file

@ -0,0 +1,57 @@
package org.eclipse.rse.core.filters;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.logging.Logger;
public interface ISystemFilterStartHere {
/**
* Factory method to return an instance populated with defaults.
* You can then simply override whatever is desired via setXXX methods.
*/
public IRSEFilterNamingPolicy createSystemFilterNamingPolicy();
/**
* Factory to create a filter pool manager, when you do NOT want it to worry about
* saving and restoring the filter data to disk. Rather, you will save and restore
* yourself.
* @param logger A logging object into which to log errors as they happen in the framework
* @param caller Objects which instantiate this class should implement the
* SystemFilterPoolManagerProvider interface, and pass "this" for this parameter.
* Given any filter framework object, it is possible to retrieve the caller's
* object via the getProvider method call.
* @param name the name of the filter pool manager. Not currently used but you may
* find a use for it.
* @param allowNestedFilters true if filters inside filter pools in this manager are
* to allow nested filters. This is the default, but can be overridden at the
* individual filter pool level.
*/
public ISystemFilterPoolManager
createSystemFilterPoolManager(ISystemProfile profile,
Logger logger,
ISystemFilterPoolManagerProvider caller,
String name,
boolean allowNestedFilters);
/**
* Create a SystemFilterPoolReferenceManager instance, when you do NOT want it
* to be saved and restored to its own file. Rather, you will save and restore it
* yourself.
* @param caller Objects which instantiate this class should implement the
* SystemFilterPoolReferenceManagerProvider interface, and pass "this" for this parameter.
* Given any filter framework object, it is possible to retrieve the caller's
* object via the getProvider method call.
* @param relatedPoolManagers The managers that own the master list of filter pools that
* this manager will contain references to.
* @param name the name of the filter pool reference manager. This is not currently
* used, but you may find a use for it.
* @param namingPolicy the naming policy object which will return the name of that one file.
*/
public ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(
ISystemFilterPoolReferenceManagerProvider caller,
ISystemFilterPoolManagerProvider relatedPoolMgrProvider,
String name, IRSEFilterNamingPolicy namingPolicy);
}

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.rse.core.model.IRSEModelObject;

View file

@ -14,7 +14,7 @@
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.filters;
package org.eclipse.rse.core.filters;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
/**

View file

@ -0,0 +1,148 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.filters;
/**
* A naming policy so tool writers can override defaults used when
* saving filter data to disk.
* <p>
* Subclass this and override what you wish to change.
*/
public class SystemFilterNamingPolicy implements IRSEFilterNamingPolicy, ISystemFilterConstants
{
protected String managerFileNamePrefix, poolFolderNamePrefix, poolFolderNameSuffix,
poolFileNamePrefix, filterFileNamePrefix,
referenceManagerFileNamePrefix;
/**
* Default prefix for filter pool manager persisted file: "filterPools_"
*/
public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER = "filterPools_";
/**
* Default prefix for filter pool reference manager persisted file: "filterPoolRefs_"
*/
public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER = "filterPoolRefs_";
/**
* Default prefix for filter pool persisted file: "filterPool_"
*/
public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOL = "filterPool_";
/**
* Default prefix for filter persisted file: "filter_"
*/
public static final String DEFAULT_FILENAME_PREFIX_FILTER = "filter_";
/**
* Default prefix for filter pool folder: "FilterPool_"
*/
public static final String DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL = "FilterPool_";
/**
* Factory method to return an instance populated with defaults.
* Can then simply override whatever is desired.
*/
public static IRSEFilterNamingPolicy getNamingPolicy()
{
return new SystemFilterNamingPolicy();
}
/**
* Constructor for SystemFilterNamingPolicyImpl
*/
public SystemFilterNamingPolicy()
{
super();
}
/**
* Get the unqualified save file name for the given SystemFilterPoolManager object.
* Do NOT include the extension, as .xmi will be added.
* <p>
* Returns "filterPools_"+managerName by default.
*/
public String getManagerSaveFileName(String managerName)
{
return DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER+managerName;
}
/**
* Get the unqualified save file name for the given SystemFilterPoolReferenceManager object.
* Do NOT include the extension, as .xmi will be added.
* <p>
* Returns "filterPoolRefs_"+managerName by default.
*/
public String getReferenceManagerSaveFileName(String managerName)
{
return DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER+managerName;
}
/**
* Get the unqualified save file name for the given SystemFilterPool object.
* Do NOT include the extension, as .xmi will be added.
* <p>
* Returns getFilterPoolSaveFileNamePrefix()+poolName by default.
*/
public String getFilterPoolSaveFileName(String poolName)
{
return getFilterPoolSaveFileNamePrefix()+poolName;
}
/**
* Get the file name prefix for all pool files.
* Used to deduce the saved pools by examining the file system
* <p>
* By default returns "filterPool_"
*/
public String getFilterPoolSaveFileNamePrefix()
{
return DEFAULT_FILENAME_PREFIX_FILTERPOOL;
}
/**
* Get the folder name for the given SystemFilterPool object.
* <p>
* Returns getFilterPoolFolderNamePrefix()+poolName by default.
*/
public String getFilterPoolFolderName(String poolName)
{
return getFilterPoolFolderNamePrefix()+poolName;
}
/**
* Get the folder name prefix for all pool folders.
* Used to deduce the saved pools by examining the file system
* <p>
* By default returns "FilterPool_"
*/
public String getFilterPoolFolderNamePrefix()
{
return DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL;
}
/**
* Get the unqualified save file name for the given SystemFilter object.
* Do NOT include the extension, as .xmi will be added.
* <p>
* Returns getFilterSaveFileNamePrefix()+filterName by default.
*/
public String getFilterSaveFileName(String filterName)
{
return getFilterSaveFileNamePrefix()+filterName;
}
/**
* Get the file name prefix for all filter files.
* Used to deduce the saved filters by examining the file system
* <p>
* Returns "Filter_" by default.
*/
public String getFilterSaveFileNamePrefix()
{
return DEFAULT_FILENAME_PREFIX_FILTER;
}
}

View file

@ -22,6 +22,8 @@ import java.util.List;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
public class AbstractSystemResourceSet implements ISystemResourceSet
{
private List _resourceSet;
@ -102,7 +104,7 @@ public class AbstractSystemResourceSet implements ISystemResourceSet
buf.append(pathFor(resource));
if (i < _resourceSet.size())
{
buf.append(", "); //$NON-NLS-1$
buf.append(", ");
}
buf.append('\n');
}

View file

@ -0,0 +1,212 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.model;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
/**
* Interface for SystemConnection objects.
* A SystemConnect holds information identifying a remote system. It also logically contains
* SubSystem objects, although this containment is achievable programmatically versus via
* object oriented containment.
* <p>
*/
/**
* @lastgen interface SystemConnection {}
*/
public interface IHost extends IRSEModelObject
{
/**
* Return the system profile that owns this connection
*/
public ISystemProfile getSystemProfile();
/**
* Return the name of the system profile that owns this connection
*/
public String getSystemProfileName();
/**
* Set the parent connection pool this is owned by.
* Connection pools are internal management objects, one per profile.
*/
public void setHostPool(ISystemHostPool pool);
/**
* Set the parent connection pool this is owned by.
* Connection pools are internal management objects, one per profile.
*/
public ISystemHostPool getHostPool();
/**
* Return the subsystem instances under this connection.
* Just a shortcut to {@link org.eclipse.rse.model.ISystemRegistry#getSubSystems(IHost)}
*/
public ISubSystem[] getSubSystems();
/**
* Return the local default user Id without resolving up the food chain.
* @see #getDefaultUserId()
*/
public String getLocalDefaultUserId();
/**
* Clear the local default user Id so next query will return the value from
* the preference store.
* <p>
* Same as calling setDefaultUserId(null)
* @see #setDefaultUserId(String)
*/
public void clearLocalDefaultUserId();
/**
* Private method called when this connection is being deleted, so
* we can do any pre-death cleanup we need.
* <p>
* What we need to do is delete our entry in the preference store for our default userId.
*/
public void deletingHost();
/**
* Private method called when this connection's profile is being rename, so
* we can do any pre-death cleanup we need.
* <p>
* What we need to do is rename our entry in the preference store for our default userId.
*/
public void renamingSystemProfile(String oldName, String newName);
/**
* Call this to query whether the default userId is to be uppercased.
*/
public boolean getForceUserIdToUpperCase();
/**
* Call this to compare two userIds taking case sensitivity
*/
public boolean compareUserIds(String userId1, String userId2);
/**
* @return The value of the SystemType attribute
*/
public String getSystemType();
/**
* @param value The new value of the SystemType attribute
*/
public void setSystemType(String value);
/**
* @return The value of the AliasName attribute
* The unique key for this object. Unique per connection pool
*/
public String getAliasName();
/**
* @param value The new value of the AliasName attribute
*/
public void setAliasName(String value);
/**
* @return The value of the HostName attribute
*/
public String getHostName();
/**
* @param value The new value of the HostName attribute
*/
public void setHostName(String value);
/**
* @return The value of the Description attribute
*/
public String getDescription();
/**
* @param value The new value of the Description attribute
*/
public void setDescription(String value);
/**
* We return the default user Id. Note that we don't store it directly in
* the mof-modelled attribute, as we don't want the team to share it. Rather,
* we store the actual user Id in the preference store keyed by this connection's
* unique name (profile.connName) and store that key in this attribute.
* <p>
* Further, it is possible that there is no default user id. If so, this
* method will go to the preference store and will try to get the default user
* Id per this connection's system type.
* <p>
* This is all transparent to the caller though.
* <p>
* @return The value of the DefaultUserId attribute
*/
public String getDefaultUserId();
/**
* Intercept of setDefaultUserId so we can force it to uppercase.
* Also, we do not store the user Id per se in the attribute, but rather
* we store it in the preference with a key name unique to this connection.
* We store that key name in this attribute. However, this is all transparent to
* the caller.
* @param value The new value of the DefaultUserId attribute
*/
public void setDefaultUserId(String value);
/**
* @generated This field/method will be replaced during code generation
* @return The value of the Promptable attribute
*/
boolean isPromptable();
/**
* @generated This field/method will be replaced during code generation
* @param value The new value of the Promptable attribute
*/
void setPromptable(boolean value);
/**
* Returns the value of the '<em><b>Offline</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* Is this connection offline? If so, there is no live connection. Subsystems
* decide how much to enable while offline.
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Offline</em>' attribute.
* @see #setOffline(boolean)
* @see org.eclipse.rse.model.ModelPackage#getSystemConnection_Offline()
* @model
* @generated
*/
boolean isOffline();
/**
* Sets the value of the '{@link org.eclipse.rse.core.model.IHost#isOffline <em>Offline</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Offline</em>' attribute.
* @see #isOffline()
* @generated
*/
void setOffline(boolean value);
/**
* Returns all the connector services provided
* for this host
* @return the connector services
*/
IConnectorService[] getConnectorServices();
}

View file

@ -26,14 +26,14 @@ public interface ISubSystemConfigurationCategories
/**
* Job subsystems
*/
public static final String SUBSYSTEM_CATEGORY_JOBS = "jobs"; //$NON-NLS-1$
public static final String SUBSYSTEM_CATEGORY_JOBS = "jobs";
/**
* File subsystems
*/
public static final String SUBSYSTEM_CATEGORY_FILES = "files"; //$NON-NLS-1$
public static final String SUBSYSTEM_CATEGORY_FILES = "files";
/**
* Command subsystems
*/
public static final String SUBSYSTEM_CATEGORY_CMDS = "commands"; //$NON-NLS-1$
public static final String SUBSYSTEM_CATEGORY_CMDS = "commands";
}

View file

@ -52,7 +52,7 @@ public interface ISystemContainer
/**
* Marks the object as stale or not
* @param isStale whether the object is to be marked stale or not
* @param clearCache indicates whether or not to clear the cache
* @param indicates whether or not to clear the cache
*/
public void markStale(boolean isStale, boolean clearCache);

View file

@ -0,0 +1,179 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.model;
import java.util.List;
import org.eclipse.rse.core.persistance.IRSEPersistableContainer;
//
/**
* A list of connections.
*/
/**
* @lastgen interface SystemConnectionPool {}
*/
public interface ISystemHostPool extends IRSEPersistableContainer
{
/**
* Return the system profile that owns this connection pool
*/
public ISystemProfile getSystemProfile();
/**
* Rename this connection pool.
*/
public void renameHostPool(String newName);
/**
* Return array of connections in this pool
*/
public IHost[] getHosts();
/**
* Create a connection.
*/
public IHost createHost(String systemType, String aliasName, String hostName)
throws Exception;
/**
* Create a connection.
*/
public IHost createHost(String systemType, String aliasName, String hostName, String description)
throws Exception;
/**
* Create a connection.
*/
public IHost createHost(String systemType, String aliasName, String hostName, String description,
String defaultUserId, int defaultUserIdLocation)
throws Exception;
/**
* Update an existing connection given the new information.
* This method:
* <ul>
* <li>calls the setXXX methods on the given connection object, updating the information in it.
* <li>saves the connection to disk (renaming its folder if needed)
* </ul>
* <p>
* @param conn SystemConnection to be updated
* @param systemType system type matching one of the system type names defined via the
* systemType extension point.
* @param aliasName unique connection name.
* @param hostName ip name of host.
* @param description optional description of the connection. Can be null.
* @param defaultUserId userId to use as the default for the subsystems.
* @param defaultUserIdLocation where to set the given default user Id. See ISystemUserIdConstants
*/
public void updateHost(IHost conn, String systemType,
String aliasName, String hostName,
String description,String defaultUserId, int defaultUserIdLocation)
throws Exception;
/**
* Return a connection given its name.
*/
public IHost getHost(String aliasName);
/**
* Return the connection at the given zero-based offset
*/
public IHost getHost(int pos);
/**
* Add a new connection to the list.
*/
public boolean addHost(IHost conn);
/**
* Removes a given connection from the list and deletes it from disk.
* <p>
* This will:
* <ul>
* <li>Delete the connection in memory
* <li>Delete the underlying folder
* </ul>
* <p>
* @param conn SystemConnection object to remove
*/
public void deleteHost(IHost conn);
/**
* Renames a given connection in the list.
* This will:
* <ul>
* <li>Rename the profile in memory
* <li>Rename the underlying folder
* <li>Update the user preferences if this profile is currently active.
* </ul>
* @param conn SystemConnection object to rename
* @param newName The new name to give that connection.
*/
public void renameHost(IHost conn, String newName) throws Exception;
/**
* Return the zero-based position of a SystemConnection object within its profile.
*/
public int getHostPosition(IHost conn);
/**
* Return the number of SystemConnection objects within this pool.
*/
public int getHostCount();
/**
* Duplicates a given connection in this list within this list or another list.
* @param targetPool The SystemConnectionPool to hold the copied connection. Can equal this connection, as long as alias name is unique
* @param conn SystemConnection object (within our pool) to clone
* @param alias New, unique, alias name to give this connection. Clone will fail if this is not unique.
*/
public IHost cloneHost(ISystemHostPool targetPool, IHost conn, String aliasName)
throws Exception;
/**
* Move existing connections a given number of positions in the same pool.
* If the delta is negative, they are all moved up by the given amount. If
* positive, they are all moved down by the given amount.<p>
* <ul>
* <li>After the move, the pool containing the moved connection is saved to disk.
* <li>The connection's alias name must be unique in pool.
* </ul>
* <b>TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?</b>
* @param conns Array of SystemConnections to move.
* @param newPosition new zero-based position for the connection
*/
public void moveHosts(IHost conns[], int delta);
/**
* Order connections according to user preferences.
* Called after restore.
*/
public void orderHosts(String[] names);
/**
* @generated This field/method will be replaced during code generation
* @return The value of the Name attribute
*/
String getName();
/**
* @generated This field/method will be replaced during code generation
* @param value The new value of the Name attribute
*/
void setName(String value);
/**
* @generated This field/method will be replaced during code generation
* @return The list of Connections references
*/
List getHostList();
}

View file

@ -16,17 +16,16 @@
package org.eclipse.rse.core.model;
/**
* The event IDs sent when local resources in the RSE model change.
* You should monitor for these events in your view if you display any of the resource types listed here.
* <p>
* To monitor, implement interface {@link org.eclipse.rse.core.model.ISystemModelChangeListener} and
* call {@link org.eclipse.rse.model.ISystemRegistry#addSystemModelChangeListener(ISystemModelChangeListener)}
* and in your dispose method, call {@link org.eclipse.rse.model.ISystemRegistry#removeSystemModelChangeListener(ISystemModelChangeListener)}.
* call {@link org.eclipse.rse.core.model.ISystemRegistry#addSystemModelChangeListener(ISystemModelChangeListener)}
* and in your dispose method, call {@link org.eclipse.rse.core.model.ISystemRegistry#removeSystemModelChangeListener(ISystemModelChangeListener)}.
* <p>
* If you are interesting in firing model change events, see
* {@link org.eclipse.rse.model.ISystemRegistry#fireModelChangeEvent(int, int, Object, String)}.
* {@link org.eclipse.rse.core.model.ISystemRegistry#fireModelChangeEvent(int, int, Object, String)}.
*/
public interface ISystemModelChangeEvents
{

View file

@ -15,20 +15,18 @@
********************************************************************************/
package org.eclipse.rse.core.model;
/**
* Interface that listeners interesting in changes to local resources in the RSE model
* implement, and subsequently register their interest, via SystemRegistry.
* <p>
* If you list any of the resource types defined in {@link org.eclipse.rse.core.model.ISystemModelChangeEvents}
* you should monitor by implementing this interface, and registering with the
* system registry via {@link org.eclipse.rse.model.ISystemRegistry#addSystemModelChangeListener(ISystemModelChangeListener)}.
* system registry via {@link org.eclipse.rse.core.model.ISystemRegistry#addSystemModelChangeListener(ISystemModelChangeListener)}.
* In your view's dispose method, you must also de-register by calling
* {@link org.eclipse.rse.model.ISystemRegistry#removeSystemModelChangeListener(ISystemModelChangeListener)}.
* {@link org.eclipse.rse.core.model.ISystemRegistry#removeSystemModelChangeListener(ISystemModelChangeListener)}.
* <p>
* If you are interesting in firing model change events, see
* {@link org.eclipse.rse.model.ISystemRegistry#fireModelChangeEvent(int, int, Object, String)}.
* {@link org.eclipse.rse.core.model.ISystemRegistry#fireModelChangeEvent(int, int, Object, String)}.
*/
public interface ISystemModelChangeListener
{

View file

@ -0,0 +1,48 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.model;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
/**
* Interface that all subsystem factory supplied pages contributed to the New Connection wizard
* must implement.
* @see org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage
* @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewConnectionWizardPages(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)
*/
public interface ISystemNewConnectionWizardPage
{
/**
* This is called when the users presses Finish. All that should be done here is validation
* of the input, returning true if all is ok and the finish can proceed.
*/
public boolean performFinish();
/**
* This is called frequently by the framework to decide whether to enable the Finish and
* Next buttons.
* <p>
* Return true if the page is complete and has no errors
*/
public boolean isPageComplete();
/**
* Return the subsystem factory that supplied this page
*/
public ISubSystemConfiguration getSubSystemConfiguration();
}

View file

@ -0,0 +1,95 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.model;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
//
/**
* The interface that RSE system profiles implement.
* <p>
* A profile represents a user or name which is used to key important user-data
* by:
* <ul>
* <li>Hosts
* <li>Filter pools
* <li>User actions
* <li>Compile commands
* </ul>
*
* <p>
* @lastgen interface SystemProfile {}
*/
public interface ISystemProfile extends IRSEModelObject
{
/**
* Set the in-memory pointer back to the parent system profile manager
*/
public void setProfileManager(ISystemProfileManager mgr);
/**
* Get the in-memory pointer back to the parent system profile manager
*/
public ISystemProfileManager getProfileManager();
/**
* Convenience method for create a new connection within this profile.
* Shortcut for {@link ISystemRegistry#createHost(String,String,String,String)}
*/
public IHost createHost(String systemType, String connectionName, String hostName, String description) throws Exception;
/**
* @return The value of the Name attribute
*/
String getName();
/**
* @param value The new value of the Name attribute
*/
void setName(String value);
/**
* @return The value of the DefaultPrivate attribute
* Is this profile created automatically, and is it the profile
* that is unique for this developer?
*/
boolean isDefaultPrivate();
/**
* @generated This field/method will be replaced during code generation
* @param value The new value of the DefaultPrivate attribute
*/
void setDefaultPrivate(boolean value);
/**
* Return all connections for this profile
*/
public IHost[] getHosts();
/**
* Return all filter pools for this profile
*/
public ISystemFilterPool[] getFilterPools();
/**
* Return all filter pools for this profile, scoped by a given subsystem factory
*/
public ISystemFilterPool[] getFilterPools(ISubSystemConfiguration ssf);
/**
* Return true if this profile is currently active for this user
*/
public boolean isActive();
}

View file

@ -0,0 +1,130 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.model;
import java.util.Vector;
/**
* A class that manages a list of SystemProfile objects.
*/
/**
* @lastgen interface SystemProfileManager {}
*/
public interface ISystemProfileManager {
/**
* Create a new profile with the given name, and add to the list.
* The name must be unique within the existing list.
* <p>
* The underlying folder is created in the file system.
* <p>
* @param name What to name this profile
* @param makeActive true if this profile is to be added to the active profile list.
* @return new profile, or null if name not unique.
*/
public ISystemProfile createSystemProfile(String name, boolean makeActive);
/**
* Toggle an existing profile's state between active and inactive
*/
public void makeSystemProfileActive(ISystemProfile profile, boolean makeActive);
/**
* Get an array of all existing profiles.
*/
public ISystemProfile[] getSystemProfiles();
/**
* Get an array of all existing profile names.
*/
public String[] getSystemProfileNames();
/**
* Get a vector of all existing profile names.
*/
public Vector getSystemProfileNamesVector();
/**
* Get a profile given its name.
*/
public ISystemProfile getSystemProfile(String name);
/**
* Return the profiles identified via preferences as the active profiles...
*/
public ISystemProfile[] getActiveSystemProfiles();
/**
* Return the profile names currently selected by the user as his "active" profiles
*/
public String[] getActiveSystemProfileNames();
/**
* Return 0-based position of the given active profile within the list of active profiles.
*/
public int getActiveSystemProfilePosition(String profileName);
/**
* Return the default private profile created at first touch.
* Will return null if it has been renamed!
*/
public ISystemProfile getDefaultPrivateSystemProfile();
/**
* Return the default team profile created at first touch.
* Will return null if it has been renamed!
*/
public ISystemProfile getDefaultTeamSystemProfile();
/**
* Rename the given profile.
*/
public void renameSystemProfile(ISystemProfile profile, String newName);
/**
* Delete the given profile
*/
public void deleteSystemProfile(ISystemProfile profile);
/**
* Clone the given profile
*/
public ISystemProfile cloneSystemProfile(ISystemProfile profile, String newName);
/**
* Return true if the given profile is active
* @see ISystemProfile#isActive()
*/
public boolean isSystemProfileActive(String profileName);
/**
* @generated This field/method will be replaced during code generation
* @return The list of Profiles references
*/
java.util.List getProfiles();
// /**
// * Reusable method to return a name validator for renaming a profile.
// * @param the current profile name on updates. Can be null for new profiles. Used
// * to remove from the existing name list the current connection.
// */
// public ISystemValidator getProfileNameValidator(String profileName);
// /**
// * Reusable method to return a name validator for renaming a profile.
// * @param the current profile object on updates. Can be null for new profiles. Used
// * to remove from the existing name list the current connection.
// */
// public ISystemValidator getProfileNameValidator(ISystemProfile profile);
}

View file

@ -0,0 +1,687 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.model;
import java.util.List;
import java.util.Vector;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterStartHere;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.widgets.Shell;
/**
* Registry or front door for all remote system connections.
* There is a singleton of the class implementation of this interface.
* To get it, call the {@link org.eclipse.rse.ui.RSEUIPlugin#getTheSystemRegistry() getTheSystemRegistry}
* method in the RSEUIPlugin object.
* <p>
* The idea here is that connections are grouped by system profile. At any
* time, there is a user-specified number of profiles "active" and connections
* from each active profile are worked with.
*/
public interface ISystemRegistry extends ISchedulingRule
{
public ISystemFilterStartHere getSystemFilterStartHere();
public ISystemFilterPool getSystemFilterPool();
// ----------------------------------
// UI METHODS...
// ----------------------------------
/**
* Show the RSE perspective if it is not already showing
*/
public void showRSEPerspective();
/**
* Expand the given connection in the RSE, if the RSE is the active perspective.
*/
public void expandHost(IHost conn);
/**
* Expand the given subsystem in the RSE, if the RSE is the active perspective.
*/
public void expandSubSystem(ISubSystem subsystem);
// ----------------------------
// SUBSYSTEM FACTORY METHODS...
// ----------------------------
/**
* Private method used by RSEUIPlugin to tell registry all registered subsystem
* factories. This way, all code can use this registry to access them versus the
* RSEUIPlugin.
*/
public void setSubSystemConfigurationProxies(ISubSystemConfigurationProxy[] proxies);
/**
* Public method to retrieve list of subsystem factory proxies registered by extension points.
*/
public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxies();
/**
* Return all subsystem factory proxies matching a subsystem factory category.
* @see ISubSystemConfigurationCategories
*/
public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxiesByCategory(String factoryCategory);
/**
* Return all subsystem factories. Be careful when you call this, as it activates all
* subsystem factories.
*/
public ISubSystemConfiguration[] getSubSystemConfigurations();
/**
* Return the parent subsystemconfiguration given a subsystem object.
*/
public ISubSystemConfiguration getSubSystemConfiguration(ISubSystem subsystem);
/**
* Return the subsystemconfiguration, given its plugin.xml-declared id.
*/
public ISubSystemConfiguration getSubSystemConfiguration(String id);
/**
* Return all subsystem factories which have declared themselves part of the given category.
* <p>
* This looks for a match on the "category" of the subsystem factory's xml declaration
* in its plugin.xml file. Thus, it is effecient as it need not bring to life a
* subsystem factory just to test its parent class type.
*
* @see ISubSystemConfigurationCategories
*/
public ISubSystemConfiguration[] getSubSystemConfigurationsByCategory(String factoryCategory);
/**
* Return all subsystem factories which support the given system type. If the type is null,
* returns all.
*
*/
public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType);
/**
* Return all subsystem factories which support the given system type. If the type is null,
* returns all.
*/
public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType, boolean filterDuplicateServiceSubSystemFactories);
// ----------------------------
// USER PREFERENCE METHODS...
// ----------------------------
/**
* Are connection names to be qualified by profile name?
*/
public boolean getQualifiedHostNames();
/**
* Set if connection names are to be qualified by profile name
*/
public void setQualifiedHostNames(boolean set);
/**
* Reflect the user changing the preference for showing filter pools.
*/
public void setShowFilterPools(boolean show);
/*
* Reflect the user changing the preference for showing filter strings.
*
public void setShowFilterStrings(boolean show);
*/
/**
* Reflect the user changing the preference for showing new connection prompt
*/
public void setShowNewHostPrompt(boolean show);
// ----------------------------
// PROFILE METHODS...
// ----------------------------
/**
* Return singleton profile manager
*/
public ISystemProfileManager getSystemProfileManager();
/**
* Return the profiles currently selected by the user as his "active" profiles
*/
public ISystemProfile[] getActiveSystemProfiles();
/**
* Return the profile names currently selected by the user as his "active" profiles
*/
public String[] getActiveSystemProfileNames();
/**
* Return all defined profiles
*/
public ISystemProfile[] getAllSystemProfiles();
/**
* Return all defined profile names
*/
public String[] getAllSystemProfileNames();
/**
* Return all defined profile names as a vector
*/
public Vector getAllSystemProfileNamesVector();
/**
* Get a SystemProfile given its name
*/
public ISystemProfile getSystemProfile(String profileName);
/**
* Create a SystemProfile given its name and whether or not to make it active
*/
public ISystemProfile createSystemProfile(String profileName, boolean makeActive)
throws Exception;
/**
* Copy a SystemProfile. All connections connection data is copied.
* @param monitor Progress monitor to reflect each step of the operation
* @param profile Source profile to copy
* @param newName Unique name to give copied profile
* @param makeActive whether to make the copied profile active or not
* @return new SystemProfile object
*/
public ISystemProfile copySystemProfile(IProgressMonitor monitor, ISystemProfile profile, String newName, boolean makeActive)
throws Exception;
/**
* Rename a SystemProfile. Rename is propogated to all subsystem factories so
* they can rename their filter pool managers and whatever else is required.
*/
public void renameSystemProfile(ISystemProfile profile, String newName)
throws Exception;
/**
* Delete a SystemProfile. Prior to physically deleting the profile, we delete all
* the connections it has, all the subsystems they have.
* <p>
* As well, all the filter pools for this profile are deleted, and subsequently any
* cross references from subsystems in connections in other profiles are removed.
* <p>
* A delete event is fired for every connection deleted.
*/
public void deleteSystemProfile(ISystemProfile profile)
throws Exception;
/**
* Make or unmake the given profile active
*/
public void setSystemProfileActive(ISystemProfile profile, boolean makeActive);
/**
* Return the list of connector services provided for the given host
* @param conn the host
* @return the list of connector services
*/
public IConnectorService[] getConnectorServices(IHost conn);
// ----------------------------
// SUBSYSTEM METHODS...
// ----------------------------
/**
* Return list of subsystem objects for a given connection. If the subsystems have
* not all been read into memory, this loads them up
*/
public ISubSystem[] getSubSystems(IHost conn);
/**
* Return list of subsystem objects for a given connection. Use the force
* flag to indicate whether or not to restore from disk
*/
public ISubSystem[] getSubSystems(IHost conn, boolean force);
public ISubSystem[] getServiceSubSystems(Class serviceType, IHost connection);
/**
* Resolve a subsystem from it's profile, connection and subsystem name.
*
* @param srcProfileName the name of the profile
* @param srcConnectionName the name of the connection
* @param subsystemFactoryId the id of the subsystem
*
* @return the subsystem
*/
public ISubSystem getSubSystem(String srcProfileName, String srcConnectionName, String subsystemFactoryId);
/**
* Resolve a subsystem from it's absolute name
*
* @param absoluteSubSystemName the name of the subsystem
*
* @return the subsystem
*/
public ISubSystem getSubSystem(String absoluteSubSystemName);
/**
* Return the absolute name for the specified subsystem
* @param the subsystem
* @return the absolute name of the subsystem
*/
public String getAbsoluteNameForSubSystem(ISubSystem subsystem);
/**
* Return the absolute name for the specified connection
* @param the connection
* @return the absolute name of the connection
*/
public String getAbsoluteNameForConnection(IHost connection);
/**
* Get a list of subsystem objects owned by the subsystem factory identified by
* its given plugin.xml-described id. Array is never null, but may be of length 0.
* <p>
* This is a list that of all subsystems for all connections owned by the factory.
*/
public ISubSystem[] getSubSystems(String factoryId);
/**
* Get a list of subsystem objects for given connection, owned by the subsystem factory
* identified by its given plugin.xml-described id. Array will never be null but may be length zero.
*/
public ISubSystem[] getSubSystems(String factoryId, IHost connection);
/**
* Get a list of subsystem objects for given connection, owned by a subsystem factory
* that is of the given category. Array will never be null but may be length zero.
* <p>
* This looks for a match on the "category" of the subsystem factory's xml declaration
* in its plugin.xml file.
*
* @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories
*/
public ISubSystem[] getSubSystemsBySubSystemConfigurationCategory(String factoryCategory, IHost connection);
/**
* Delete a subsystem object. This code finds the factory that owns it and
* delegates the request to that factory.
*/
public boolean deleteSubSystem(ISubSystem subsystem);
// ----------------------------
// CONNECTION METHODS...
// ----------------------------
/**
* Return the first connection to localhost we can find. While we always create a default one in
* the user's profile, it is possible that this profile is not active or the connection was deleted.
* However, since any connection to localHost will usually do, we just search all active profiles
* until we find one, and return it. <br>
* If no localhost connection is found, this will return null. If one is needed, it can be created
* easily by calling {@link #createLocalHost(ISystemProfile, String, String)}.
*/
public IHost getLocalHost();
/**
* Return all connections in all active profiles.
*/
public IHost[] getHosts();
/**
* Return all connections in a given profile name.
*/
public IHost[] getHostsByProfile(ISystemProfile profile);
/**
* Return all connections in a given profile.
*/
public IHost[] getHostsByProfile(String profileName);
/**
* Return all connections for which there exists one or more subsystems owned
* by a given subsystem factory.
* @see #getSubSystemConfiguration(String)
*/
public IHost[] getHostsBySubSystemConfiguration(ISubSystemConfiguration factory);
/**
* Return all connections for which there exists one or more subsystems owned
* by a given subsystem factory, identified by factory Id
*/
public IHost[] getHostsBySubSystemConfigurationId(String factoryId);
/**
* Return all connections for which there exists one or more subsystems owned
* by any a given subsystem factory that is of the given category.
* <p>
* This looks for a match on the "category" of the subsystem factory's xml declaration
* in its plugin.xml file. Thus, it is effecient as it need not bring to life a
* subsystem factory just to test its parent class type.
*
* @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories
*/
public IHost[] getHostsBySubSystemConfigurationCategory(String factoryCategory);
/**
* Return all connections for all active profiles, for the given system type.
*/
public IHost[] getHostsBySystemType(String systemType);
/**
* Return all connections for all active profiles, for the given system types.
*/
public IHost[] getHostsBySystemTypes(String[] systemTypes);
/**
* Return a SystemConnection object given a system profile containing it,
* and a connection name uniquely identifying it.
*/
public IHost getHost(ISystemProfile profile, String connectionName);
/**
* Return the zero-based position of a SystemConnection object within its profile.
*/
public int getHostPosition(IHost conn);
/**
* Return the number of SystemConnection objects within the given profile
*/
public int getHostCount(String profileName);
/**
* Return the number of SystemConnection objects within the given connection's owning profile
*/
public int getHostCountWithinProfile(IHost conn);
/**
* Return the number of SystemConnection objects within all active profiles
*/
public int getHostCount();
/**
* Return a vector of previously-used connection names in the given named profile.
* @return Vector of String objects.
*/
public Vector getHostAliasNames(String profileName);
/**
* Return a vector of previously-used connection names in the given profile.
* @return Vector of String objects.
*/
public Vector getHostAliasNames(ISystemProfile profile);
/**
* Return a vector of previously-used connection names in all active profiles.
*/
public Vector getHostAliasNamesForAllActiveProfiles();
/**
* Return array of all previously specified hostnames.
*/
public String[] getHostNames();
/**
* Return array of previously specified hostnames for a given system type.
*/
public String[] getHostNames(String systemType);
/**
* Returns the clipboard used for copy actions
*/
public Clipboard getSystemClipboard();
/**
* Returns the list of objects on the system clipboard
* @param srcType the transfer type
* @return the list of clipboard objects
*/
public List getSystemClipboardObjects(int srcType);
/**
* Convenience method to create a local connection, as it often that one is needed
* for access to the local file system.
* @param profile - the profile to create this connection in. If null is passed, we first
* try to find the default private profile and use it, else we take the first active profile.
* @param name - the name to give this profile. Must be unique and non-null.
* @param userId - the user ID to use as the default for the subsystems. Can be null.
*/
public IHost createLocalHost(ISystemProfile profile, String name, String userId);
/**
* Create a connection object, given the connection pool and given all the possible attributes.
* <p>
* THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN
* THE POOL YOU SPECIFY. THE POOL IS ALSO SAVED TO DISK.
* <p>
* This method:
* <ul>
* <li>creates and saves a new connection within the given profile
* <li>calls all subsystem factories to give them a chance to create a subsystem instance
* <li>fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners
* </ul>
* <p>
* @param profileName Name of the system profile the connection is to be added to.
* @param systemType system type matching one of the system type names defined via the
* systemTypes extension point.
* @param connectionName unique connection name.
* @param hostName ip name of host.
* @param description optional description of the connection. Can be null.
* @param defaultUserId userId to use as the default for the subsystems.
* @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.ISystemUserIdConstants ISystemUserIdConstants}
* that tells us where to set the user Id
* @param newConnectionWizardPages when called from the New Connection wizard this is union of the list of additional
* wizard pages supplied by the subsystem factories that pertain to the specified system type. Else null.
* @return SystemConnection object, or null if it failed to create. This is typically
* because the connectionName is not unique. Call getLastException() if necessary.
*/
public IHost createHost(String profileName, String systemType,
String connectionName, String hostName,
String description,String defaultUserId, int defaultUserIdLocation,
ISystemNewConnectionWizardPage[] newConnectionWizardPages)
throws Exception;
/**
* Create a connection object. This is a simplified version
* <p>
* THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN
* THE PROFILE YOU SPECIFY. THE PROFILE IS ALSO SAVED TO DISK.
* <p>
* This method:
* <ul>
* <li>creates and saves a new connection within the given profile
* <li>calls all subsystem factories to give them a chance to create a subsystem instance
* <li>fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners
* </ul>
* <p>
* @param profileName Name of the system profile the connection is to be added to.
* @param systemType system type matching one of the system type names defined via the
* systemTypes extension point.
* @param connectionName unique connection name.
* @param hostName ip name of host.
* @param description optional description of the connection. Can be null.
* @return SystemConnection object, or null if it failed to create. This is typically
* because the connectionName is not unique. Call getLastException() if necessary.
*/
public IHost createHost(String profileName, String systemType, String connectionName, String hostName, String description)
throws Exception;
/**
* Create a connection object. This is a very simplified version that defaults to the user's
* private profile, or the first active profile if there is no private profile.
* <p>
* THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN
* THE DEFAULT PRIVATE PROFILE, WHICH IS SAVED TO DISK.
* <p>
* This method:
* <ul>
* <li>creates and saves a new connection within the given profile
* <li>calls all subsystem factories to give them a chance to create a subsystem instance
* <li>fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners
* </ul>
* <p>
* @param systemType system type matching one of the system type names defined via the
* systemTypes extension point.
* @param connectionName unique connection name.
* @param hostName ip name of host.
* @param description optional description of the connection. Can be null.
* @return SystemConnection object, or null if it failed to create. This is typically
* because the connectionName is not unique. Call getLastException() if necessary.
*/
public IHost createHost(String systemType, String connectionName, String hostName, String description)
throws Exception;
/**
* Update an existing connection given the new information.
* This method:
* <ul>
* <li>calls the setXXX methods on the given connection object, updating the information in it.
* <li>save the connection's connection pool to disk
* <li>fires an ISystemResourceChangeEvent event of type EVENT_CHANGE to all registered listeners
* <li>if the systemtype or hostname is changed, calls disconnect on each associated subsystem.
* We must do this because a hostname changes fundamentally affects the connection,
* rendering any information currently displayed under
* that connection obsolete. That is, the user will have to reconnect.
* </ul>
* <p>
* @param conn SystemConnection to be updated
* @param systemType system type matching one of the system type names defined via the
* systemTypes extension point.
* @param connectionName unique connection name.
* @param hostName ip name of host.
* @param description optional description of the connection. Can be null.
* @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.ISystemUserIdConstants ISystemUserIdConstants}
* that tells us where to set the user Id
* @param defaultUserId userId to use as the default for the subsystems.
*/
public void updateHost(Shell shell, IHost conn, String systemType,
String connectionName, String hostName,
String description,String defaultUserId, int defaultUserIdLocation);
/**
* Update the workoffline mode for a connection.
*
* @param conn SystemConnection to change
* @param offline true if connection should be set offline, false if it should be set online
*/
public void setHostOffline(IHost conn, boolean offline);
/**
* Delete an existing connection.
* <p>
* Lots to do here:
* <ul>
* <li>Delete all subsystem objects for this connection, including their file's on disk.
* <li>Delete the connection from memory.
* <li>Delete the connection's folder from disk.
* </ul>
* Assumption: firing the delete event is done elsewhere. Specifically, the doDelete method of SystemView.
*/
public void deleteHost(IHost conn);
/**
* Renames an existing connection.
* <p>
* Lots to do here:
* <ul>
* <li>Reset the conn name for all subsystem objects for this connection
* <li>Rename the connection in memory.
* <li>Rename the connection's folder on disk.
* </ul>
* Assumption: firing the rename event is done elsewhere. Specifically, the doRename method of SystemView.
*/
public void renameHost(IHost conn, String newName) throws Exception;
/**
* Move existing connections a given number of positions in the same profile.
* If the delta is negative, they are all moved up by the given amount. If
* positive, they are all moved down by the given amount.<p>
* <ul>
* <li>After the move, the pool containing the moved connection is saved to disk.
* <li>The connection's name must be unique in pool.
* <li>Fires a single ISystemResourceChangeEvent event of type EVENT_MOVE, if the pool is the private pool.
* </ul>
* <b>TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?</b>
* @param conns Array of SystemConnections to move.
* @param newPosition new zero-based position for the connection
*/
public void moveHosts(String profileName, IHost conns[], int delta);
/**
* Copy a SystemConnection. All subsystems are copied, and all connection data is copied.
* @param monitor Progress monitor to reflect each step of the operation
* @param conn The connection to copy
* @param targetProfile What profile to copy into
* @param newName Unique name to give copied profile
* @return new SystemConnection object
*/
public IHost copyHost(IProgressMonitor monitor, IHost conn,
ISystemProfile targetProfile, String newName)
throws Exception;
/**
* Move a SystemConnection to another profile. All subsystems are copied, and all connection data is copied.
* @param monitor Progress monitor to reflect each step of the operation
* @param conn The connection to move
* @param targetProfile What profile to move to
* @param newName Unique name to give moved profile
* @return new SystemConnection object
*/
public IHost moveHost(IProgressMonitor monitor, IHost conn,
ISystemProfile targetProfile, String newName)
throws Exception;
/**
* Return true if any of the subsystems for the given connection are currently connected
*/
public boolean isAnySubSystemConnected(IHost conn);
/**
* Return true if all of the subsystems for the given connection are currently connected
*/
public boolean areAllSubSystemsConnected(IHost conn);
/**
* Disconnect all subsystems for the given connection, if they are currently connected.
*/
public void disconnectAllSubSystems(IHost conn);
/**
* Inform the world when the connection status changes for a subsystem within a connection
*/
public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected);
/**
* Inform the world when the connection status changes for a subsystem within a connection
*/
public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected, boolean collapseTree);
// ----------------------------
// MISCELLANEOUS METHODS...
// ----------------------------
/**
* Returns filter references associated with this resource under the subsystem
*/
public List findFilterReferencesFor(Object resource, ISubSystem subsystem);
/**
* Marks all filters for this subsystem as stale to prevent caching
* @param subsystem
*/
public void invalidateFiltersFor(ISubSystem subsystem);
/**
* Marks all filters for this subsystem the contain resourceParent as stale to prevent caching
* @param resourceParent
* @param subsystem
*/
public void invalidateFiltersFor(Object resourceParent, ISubSystem subsystem);
/**
* Return last exception object caught in any method, or null if no exception.
* This has the side effect of clearing the last exception.
*/
public Exception getLastException();
// ----------------------------
// SAVE / RESTORE METHODS...
// ----------------------------
/**
* Save everything!
*/
public boolean save();
/**
* Save specific connection pool
* @return true if saved ok, false if error encountered. If false, call getLastException().
*/
public boolean saveHostPool(ISystemHostPool pool);
/**
* Save specific connection
* @return true if saved ok, false if error encountered. If false, call getLastException().
*/
public boolean saveHost(IHost conn);
/**
* Restore all connections within active profiles
* @return true if restored ok, false if error encountered. If false, call getLastException().
*/
public boolean restore();
} //SystemRegistry

View file

@ -18,13 +18,12 @@
package org.eclipse.rse.core.model;
/**
* Represents contents that are children of a container
*/
public class SystemChildrenContentsType implements ISystemContentsType
{
public static String CONTENTS_TYPE_CHILDREN = "contents_children"; //$NON-NLS-1$
public static String CONTENTS_TYPE_CHILDREN = "contents_children";
public static SystemChildrenContentsType _instance = new SystemChildrenContentsType();
public static SystemChildrenContentsType getInstance()

View file

@ -0,0 +1,121 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.model;
/**
* This class encapsulates the signon information required for a remote system. This class
* must be secure and never disclose the password for the remote system in its unencrypted form.
* However the encrypted form of the password is not considered secret information and can be
* accessed by anyone.
*
* @author yantzi
*/
public final class SystemSignonInformation {
private String _hostname, _userid, _systemType, _password;
/**
* Default no-arg constructor
*/
public SystemSignonInformation()
{
}
/**
* Constructor for SystemSignonInformation.
*/
public SystemSignonInformation(String hostname, String userid, String systemType) {
_hostname = hostname;//RSEUIPlugin.getQualifiedHostName(hostname).toUpperCase();
_userid = userid;
_systemType = systemType;
}
/**
* Constructor for SystemSignonInformation.
*/
public SystemSignonInformation(String hostname, String userid, String password, String systemType) {
_hostname = hostname;//RSEUIPlugin.getQualifiedHostName(hostname).toUpperCase();
_userid = userid;
_password = password;
_systemType = systemType;
}
/**
* Returns the hostname of the remote system
* @return String
*/
public String getHostname() {
return _hostname;
}
/**
* Returns the systemType of the remote system
* @return String
*/
public String getSystemType() {
return _systemType;
}
/**
* Returns the userid for the remote system
* @return String
*/
public String getUserid() {
return _userid;
}
/**
* Return the password for the remote system
*/
public String getPassword() {
return _password;
}
/**
* Sets the password for the remote system
*/
public void setPassword(String string) {
_password = string;
}
/**
* Sets the hostname.
* @param hostname The hostname to set
*/
public void setHostname(String hostname) {
_hostname = hostname;//RSEUIPlugin.getQualifiedHostName(hostname).toUpperCase();
}
/**
* Sets the systemType.
* @param systemType The systemType to set
*/
public void setSystemType(String systemType) {
_systemType = systemType;
}
/**
* Sets the userid.
* @param userid The userid to set
*/
public void setUserid(String userid) {
_userid = userid;
}
}

View file

@ -16,7 +16,6 @@
package org.eclipse.rse.core.references;
import org.eclipse.core.resources.IFolder;
import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject;
/**

View file

@ -0,0 +1,46 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
public class CommunicationsEvent {
// Communications event types
public static final int BEFORE_CONNECT = 1;
public static final int AFTER_CONNECT = 2;
public static final int BEFORE_DISCONNECT = 3;
public static final int AFTER_DISCONNECT = 4;
public static final int CONNECTION_ERROR = 5;
private IConnectorService system;
private int state;
public CommunicationsEvent(IConnectorService system, int state) {
this.system = system;
this.state = state;
}
public int getState() {
return state;
}
public IConnectorService getSystem() {
return system;
}
}

View file

@ -0,0 +1,49 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
/**
* ICommunicationsListener - listen to communication events
* @see CommunicationsEvent
*/
public interface ICommunicationsListener {
/**
* This method is invoked whenever the communications state is invoked
* immediately before and after the state of the communications changes.
* The state field in CommunicationsEvent determines which state
* change is about to or has occured.
*/
public void communicationsStateChange(CommunicationsEvent e);
/**
* This method determines if the communications listener is a passive or
* active listener. Typically a passive listener registers with the communications
* system and responds to events as they occur. An active listener typically
* registeres with the communications system only for the duration of the task (i.e.
* user editing a file, or outstanding communications request.)
*
* The user will be prompted on a disconnect if there are any active communication
* listeners registered.
*
* @return false if the communications listener is an active listener, true if the
* communications listener is a passive listener.
*/
public boolean isPassiveCommunicationsListener();
}

View file

@ -0,0 +1,339 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.swt.widgets.Shell;
/**
* This is the interface implemented by ConnectorService (formerly System) objects.
* <p>
* A connector service manages a live connection to a remote system, with
* operations for connecting and disconnecting, and storing information
* typically cached from a subsystem: user ID, password, port, etc.
* <p>
* The SubSystem interface includes a method, getConnectorService(), which returns an
* instance of an object that implements this interface for that subsystem.
* <p>
* A single connector service object can be unique to a subsystem instance, but
* it can also be shared across multiple subsystems in a single host if those
* subsystems share a physical connection to the remote system. This sharing is done via
* subclasses of {@link org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager}
* which are returned by another getter method in SubSystem.
*/
public interface IConnectorService extends IRSEModelObject
{
/**
* Return the subsystem object this system is associated with
*/
public ISubSystem getPrimarySubSystem();
/**
* Return all the subsystems that use this service
* @return the subsystems that use this service
*/
public ISubSystem[] getSubSystems();
/**
* Set the subsystem, when its not known at constructor time
*/
public void registerSubSystem(ISubSystem ss);
/**
* Deregister the subsystem
* @param ss
*/
public void deregisterSubSystem(ISubSystem ss);
/**
* Return true if currently connected.
*/
public boolean isConnected();
/**
* Attempt to connect to the remote system.
*/
public void connect(IProgressMonitor monitor) throws Exception;
/**
* Disconnect from the remote system
*/
public void disconnect(IProgressMonitor monitor) throws Exception;
/**
* Notifies all listeners of a disconnection through a communications event
*/
public void notifyDisconnection();
/**
* Notifies all listeners of a connection through a communications event
*/
public void notifyConnection();
/**
* Notifies all listeners of an error through a communications event
*/
public void notifyError();
/**
* Reset after some fundamental change, such as a hostname change.
* Clear any memory of the current connection.
*/
public void reset();
/**
* Return the version, release, modification of the remote system,
* if connected, if applicable and if available. Else return null.
* <p>
* Up to each implementer to decide if this will be cached.
*/
public String getVersionReleaseModification();
/**
* Return the home directory of the remote system for the current user, if available.
* <p>
* Up to each implementer to decide how to implement, and if this will be cached.
*/
public String getHomeDirectory();
/**
* Return the temp directory of the remote system for the current user, if available.
* <p>
* Up to each implementer to decide how to implement, and if this will be cached.
*/
public String getTempDirectory();
// --------------------------------------------------------------------
// Utility methods that offer combined connection and subsystem info...
// --------------------------------------------------------------------
/**
* Return the system type for this connection.
*/
public String getHostType();
/**
* Return the name of this connector service
* @return the name of this connector service
*/
public String getName();
public void setHost(IHost host);
/**
* Return the host
* @return
*/
public IHost getHost();
/**
* Return the host name for the connection this system's subsystem is associated with
*/
public String getHostName();
/**
* Return the port for this connector
*/
public int getPort();
/**
* Set the port for this connector
* @param port
*/
public void setPort(int port);
/**
* Return the userId for this system's subsystem we are associated with
*/
public String getUserId();
/**
* Set the user id for this connector
* @param userId
*/
public void setUserId(String userId);
public boolean isUsingSSL();
public void setIsUsingSSL(boolean flag);
/**
* Return the password for this system's subsystem we are associated with.
* <p>
* If not currently set in transient memory, prompts the user for a password.
* <p>
* Throws InterruptedException if user is prompted and user cancels that prompt.
* @param shell parent for the prompt dialog if needed. Can be null if know password exists.
* @param forcePrompt forces the prompt dialog to be displayed even if the password is currently
* in memory.
*/
public void promptForPassword(Shell shell, boolean forcePrompt)
throws InterruptedException;
/**
* Set the password if you got it from somewhere
*/
public void setPassword(String matchingUserId, String password);
/**
* Set the password if you got it from somewhere
*/
public void setPassword(String matchingUserId, String password, boolean persist);
/**
* Clear internal userId cache. Called when user uses the property dialog to
* change his userId.
*/
public void clearUserIdCache();
/**
* Clear internal password cache. Called when user uses the property dialog to
* change his userId.
*/
public void clearPasswordCache();
/**
* Clear internal password cache. Called when user uses the property dialog to
* change his userId.
* @param clearDiskCache if true, clears the password from disk
*/
public void clearPasswordCache(boolean clearDiskCache);
/**
* Return true if password is currently cached.
*/
public boolean isPasswordCached();
/**
* Return true if password is currently cached.
*/
public boolean isPasswordCached(boolean onDisk);
/**
* Return true if this system can inherit the uid and password of
* other ISystems in this connection
*
* @return true if it can inherit the user/password
*/
public boolean inheritConnectionUserPassword();
/*
* Return true if this system can share it's uid and password
* with other ISystems in this connection
*
* @return true if it can share the user/password
*/
public boolean shareUserPasswordWithConnection();
/**
* Register a communications listener
*/
public void addCommunicationsListener(ICommunicationsListener listener);
/**
* Remove a communications listener
*/
public void removeCommunicationsListener(ICommunicationsListener listener);
/**
* Returns the suppressSignonPrompt flag. If this is set to true then the user
* will not be prompted to signon, instead an InterruptedException will be thrown
* by the promptForPassword method.
*
* @return boolean
*/
public boolean isSuppressSignonPrompt();
/**
* Sets the suppressSignonPrompt flag. Tool writers can use this to temporarily
* disable the user from being prompted to signon. This would cause the promptForPassword
* method to throw an InterruptedException instead of prompting. The intent of this
* method is to allow tool writeres to prevent multiple signon prompts during a
* set period of time (such as a series of related communication calls) if the user
* cancels the first prompt. <b>It is the callers responsability to set this value
* back to false when the tool no longer needs to suppress the signon prompt or all
* other tools sharing this connection will be affected.</b>
*
* @param suppressSignonPrompt
*/
public void setSuppressSignonPrompt(boolean suppressSignonPrompt);
/**
* Returns the value of the '<em><b>Remote Server Launcher</b></em>' containment reference.
* It is bidirectional and its opposite is '{@link org.eclipse.rse.core.subsystems.IServerLauncherProperties#getParentSubSystem <em>Parent Sub System</em>}'.
* <!-- begin-user-doc -->
* <p>
* Get the remote server launcher, which may be null. This an optional object containing
* properties used to launch the remote server that communicates with this subsystem.
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Remote Server Launcher</em>' containment reference.
* @see #setRemoteServerLauncher(IServerLauncherProperties)
* @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getSubSystem_RemoteServerLauncher()
* @see org.eclipse.rse.core.subsystems.IServerLauncherProperties#getParentSubSystem
* @model opposite="parentSubSystem" containment="true"
* @generated
*/
IServerLauncherProperties getRemoteServerLauncherProperties();
/**
* Sets the value of the '{@link org.eclipse.rse.core.subsystems.ISubSystem#getRemoteServerLauncher <em>Remote Server Launcher</em>}' containment reference.
* <!-- begin-user-doc -->
* Set the remote server launcher, which is an optional object containing
* properties used to launch the remote server that communicates with this subsystem.
* <!-- end-user-doc -->
* @param value the new value of the '<em>Remote Server Launcher</em>' containment reference.
* @see #getRemoteServerLauncher()
* @generated
*/
void setRemoteServerLauncherProperties(IServerLauncherProperties value);
boolean hasRemoteServerLauncherProperties();
boolean supportsRemoteServerLaunching();
/**
* Tell us if this subsystem factory supports server launch properties, which allow the user
* to configure how the server-side code for these subsystems are started. There is a Server
* Launch Setting property page, with a pluggable composite, where users can configure these
* properties.
*/
public boolean supportsServerLaunchProperties();
/**
* Report if this connector service can use a user identifier.
* Returns true in default implementation.
* Typically used to indicate if a login dialog needs to be presented when connecting.
* @return true if and only if the connector service can use a user id.
*/
public boolean supportsUserId();
/**
* Report if this connector service requires a user id.
* Returns true in default implementation.
* Typically used to indicate if a login dialog can allow an empty user id.
* Must be ignored if supportsUserId() is false.
* @return true or false to indicate if the connector service requires a user id.
*/
public boolean requiresUserId();
/**
* Can be used to determine if a password field is present on a login dialog for this connector service.
* The default implementation of this interface should return true.
* @return true if the subsystem can use a password, false if a password is irrelevant.
*/
public boolean supportsPassword();
/**
* If a password is supported this is used to determine if the password is required.
* Must be ignored if supportsPassword() returns false.
* The default implementation of this interface should return true.
* @return true if the connector service requires a password, false if a password may be empty.
*/
public boolean requiresPassword();
}

View file

@ -16,7 +16,8 @@
package org.eclipse.rse.core.subsystems;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.core.model.IHost;
public interface IConnectorServiceManager

View file

@ -0,0 +1,62 @@
/********************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import org.eclipse.rse.core.model.ISystemContainer;
import org.eclipse.rse.core.model.ISystemContentsType;
/**
* @author dmcknigh
*/
public interface IRemoteContainer extends ISystemContainer
{
/**
* Returns whether the object has contents of a particular type associated with the specified filter string.
* @param contentsType type of contents
* @param filter criteria for contained contents
* @return <code>true</code> if the object has contents, <code>false</code> otherwise.
*/
public boolean hasContents(ISystemContentsType contentsType, String filter);
/**
* Returns the contents of the object.
* @param contentsType type of contents
* @param filter criteria for contained contents.
* @return an array of contents.
*/
public Object[] getContents(ISystemContentsType contentsType, String filter);
/*
* Replace occurrences of cached object with new object
*/
public void replaceContent(Object oldObject, Object newObject);
/**
* Sets the contents of this object that match a particular filter
* @param contentsType type of contents
* @param filter matching criteria for the contained objects
* @param con the contained objects that match the filter
*/
public void setContents(ISystemContentsType contentsType, String filter, Object[] con);
/**
* Copies the persistable contents from this one to another one
* @param container the container to copy contents to
*/
public void copyContentsTo(IRemoteContainer container);
}

View file

@ -0,0 +1,62 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
/**
* This interface represents an object that can be used to jump into line in source
*/
public interface IRemoteLineReference
{
/**
* Gets the path to the file that this output references if it references any. It may return null if
* no such association exists. This may be used to jump to an editor from a view which displays
* this
*
* @return the path of the referenced file if there is one
*/
public String getAbsolutePath();
/**
* Gets the line number within a file that this references if it references any. By default
* it should return 0. If no file association exists, it also returns 0. This may be used to jump into
* a location within an editor from a view which displays remote output.
*
* @return the line number within a referenced file if there is one.
*/
public int getLine();
/**
* Get the start offset in a line corresponding to this reference. -1 indicates there is no offset
* @return the offset
*/
public int getCharStart();
/**
* Get the end offset in a line corresponding to this reference. -1 indicates there is no offset
* @return the offset
*/
public int getCharEnd();
/**
* Get the object that contains this object.
*
* @return the parent object
*/
public Object getParent();
}

View file

@ -0,0 +1,30 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
public interface IRemoteObjectIdentifier
{
/**
* For drag and drop, and clipboard, support of remote objects.
* <p>
* Return the unique ID for the given remote object within the subsystem.
*/
public String getAbsoluteName(Object object);
}

View file

@ -0,0 +1,78 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
//
/**
* @lastgen interface RemoteSystemEnvVar {}
*/
public interface IRemoteSystemEnvVar {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String copyright = "(c) Copyright IBM Corporation 2002, 2004.";
/**
* @generated This field/method will be replaced during code generation
* @return The value of the Name attribute
* The name of the environment variable to set at connect time
*/
String getName();
/**
* @generated This field/method will be replaced during code generation
* @param value The new value of the Name attribute
*/
void setName(String value);
/**
* @generated This field/method will be replaced during code generation
* @return The value of the Value attribute
* The value to set this environment variable to at connect time
*/
String getValue();
/**
* @generated This field/method will be replaced during code generation
* @param value The new value of the Value attribute
*/
void setValue(String value);
/**
* @generated This field/method will be replaced during code generation
* @return The value of the AdditionalAttributes attribute
* Additional attributes that may need to be persisted per environment variable.
*/
String getAdditionalAttributes();
/**
* @generated This field/method will be replaced during code generation
* @param value The new value of the AdditionalAttributes attribute
*/
void setAdditionalAttributes(String value);
}

View file

@ -18,7 +18,7 @@
package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.model.SystemSignonInformation;
import org.eclipse.rse.core.model.SystemSignonInformation;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;

View file

@ -0,0 +1,51 @@
/********************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import org.eclipse.rse.core.model.IRSEModelObject;
/**
* Implement this interface to provide peristable properties for server launching
* All properties to be persisted to be are stored and restored from associated
* IPropertySets
*
*/
public interface IServerLauncherProperties extends IRSEModelObject
{
public IServerLauncherProperties cloneServerLauncher(IServerLauncherProperties newOne);
/**
* Returns the connector service
* @return
*/
public IConnectorService getConnectorService();
/**
* Update cached values based on IPropertySets
*
*/
public void restoreFromProperties();
/**
* Store cached values based on IPropertySets
*
*/
public void saveToProperties();
} // ServerLauncher

View file

@ -0,0 +1,24 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
public interface IServiceSubSystem extends ISubSystem
{
public Class getServiceType();
public void switchServiceFactory(IServiceSubSystemConfiguration factory);
}

View file

@ -0,0 +1,38 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.services.IService;
/**
* This is the interface for the class that is for subsystem-providers who desire not to use MOF.
*
* @lastgen interface DefaultSubSystemConfiguration extends SubSystemConfiguration {}
*/
public interface IServiceSubSystemConfiguration extends ISubSystemConfiguration
{
public IConnectorService getConnectorService(IHost host);
public void setConnectorService(IHost host, IConnectorService connectorService);
public Class getServiceType();
public Class getServiceImplType();
public IService getService(IHost host);
} //DefaultSubSystemConfiguration

View file

@ -18,19 +18,17 @@ package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.persistance.IRSEPersistableContainer;
import org.eclipse.rse.filters.ISystemFilter;
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
import org.eclipse.rse.filters.ISystemFilterReference;
import org.eclipse.rse.filters.ISystemFilterString;
import org.eclipse.rse.model.IHost;
import org.eclipse.rse.model.ISystemProfile;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.PropertyPage;
@ -126,19 +124,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
*/
public void checkIsConnected() throws SystemMessageException;
// -------------------------------------
// GUI methods
// -------------------------------------
/**
* Return the single property page to show in the tabbed notebook for the
* for SubSystem property of the parent Connection. Return null if no
* page is to be contributed for this. You are limited to a single page,
* so you may have to compress. It is recommended you prompt for the port
* if applicable since the common base subsystem property page is not shown
* To help with this you can use the SystemPortPrompt widget.
*/
public PropertyPage getPropertyPage(Composite parent);
// ---------------------------------------------------
// Methods for business partners to add their own
// persisted attributes to the subsystem object...
@ -358,7 +344,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* Connect to the remote system.
* In addition to calling getSystem().connect(),this might fire events.
*
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
*/
public void connect(Shell shell) throws Exception;
/**
@ -371,7 +357,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* Connect to the remote system, optionally forcing a signon prompt even if the password
* is cached in memory or on disk.
*
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param forcePrompt forces the prompt dialog to be displayed even if the password is currently
* in memory.
*/
@ -493,7 +479,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* type. Be sure to register your adapter factory.
*
* @param filterString filter pattern for objects to return.
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Array of objects that are the result of this filter string
*/
public Object[] resolveFilterString(String filterString, Shell shell)
@ -506,7 +492,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* filter strings versus a single filter string.
*
* @param filterStrings array of filter patterns for objects to return.
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Array of objects that are the result of resolving all the filter strings
*/
public Object[] resolveFilterStrings(String[] filterStrings, Shell shell)
@ -535,7 +521,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
*
* @param parent Object that is being expanded.
* @param filterString filter pattern for children of parent.
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Array of objects that are the result of this filter string
*/
public Object[] resolveFilterString(Object parent, String filterString, Shell shell)
@ -545,7 +531,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* Execute a remote command. This is only applicable if the subsystem factory reports
* true for supportsCommands().
* @param command Command to be executed remotely.
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Object context context of a command (i.e. working directory). Null is valid and means to use the default context.
* @return Array of objects that are the result of running this command. Typically, these
* are messages logged by the command.
@ -567,7 +553,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param subject Identifies which object to get the properties of
* @param key Identifies property to set
* @param value Value to set property to
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation.
*/
public Object setProperty(Object subject, String key, String value, Shell shell)
@ -579,7 +565,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* true for supportsProperties().
* @param subject Identifies which object to get the properties of
* @param key Identifies property to get value of
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return String The value of the requested key.
*/
public String getProperty(Object subject, String key, Shell shell)
@ -590,9 +576,9 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* a number of remote environment variables. This is only applicable if the subsystem factory reports
* true for supportsProperties().
* @param subject Identifies which object to get the properties of
* @param keys Identifies properties to set
* @param values Values to set properties to. One to one mapping to keys by index number
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @param key Identifies property to set
* @param value Values to set properties to. One to one mapping to keys by index number
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation.
*/
public Object setProperties(Object subject, String[] keys, String[] values, Shell shell)
@ -603,9 +589,9 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* a remote environment variable. This is only applicable if the subsystem factory reports
* true for supportsProperties().
* @param subject Identifies which object to get the properties of
* @param keys Identifies properties to get value of
* @param shell parent shell used to show error message. Null means you will handle showing the error message.
* @return String[] The values of the requested keys.
* @param key Identifies property to get value of
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Object The values of the requested keys.
*/
public String[] getProperties(Object subject, String[] keys, Shell shell)
throws Exception;
@ -658,7 +644,24 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* Returns the parent object associated with a filter reference. It's up to the
* subsystem implementation to decide what "parent object" means for a filter reference.
* @param filterRef the filter reference to determine a target object from.
* @return
*/
Object getTargetForFilter(ISystemFilterReference filterRef);
//// -------------------------------------
// // GUI methods
// // -------------------------------------
// /**
// * Return the single property page to show in the tabbed notebook for the
// * for SubSystem property of the parent Connection. Return null if no
// * page is to be contributed for this. You are limited to a single page,
// * so you may have to compress. It is recommended you prompt for the port
// * if applicable since the common base subsystem property page is not shown
// * To help with this you can use the SystemPortPrompt widget.
// */
// public PropertyPage getPropertyPage(Composite parent);
}

View file

@ -0,0 +1,554 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.persistance.IRSEPersistableContainer;
import org.eclipse.swt.widgets.Shell;
public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvider, IRSEPersistableContainer
{
// ---------------------------------
// CONSTANTS...
// ---------------------------------
public static final boolean FORCE_INTO_MEMORY = true;
public static final boolean LAZILY = false;
/**
* Reset for a full refresh from disk, such as after a team synch.
*/
public void reset();
// ---------------------------------
// CRITICAL METHODS...
// ---------------------------------
/**
* Return true if the subsystem supports more than one filter string
* <p>RETURNS true BY DEFAULT
*/
public boolean supportsMultiStringFilters();
/**
* Return true if the subsystem supports the exporting of filter strings from it's filters
* <p>RETURNS true BY DEFAULT
*/
public boolean supportsFilterStringExport();
/**
* Return true if subsystem instances from this factory support connect and disconnect actions
* <p>Returns true in default implementation.
*/
public boolean supportsSubSystemConnect();
/**
* Return true (default) or false to indicate if subsystems of this factory support user-editable
* port numbers.
* <p>Returns true in default implementation.
*/
public boolean isPortEditable();
/**
* Return true if subsystem instances from this factory support remote command execution
* <p>Returns false in default implementation, and is usually only true for command subsystems.
*/
public boolean supportsCommands();
/**
* Return true if subsystem instances from this factory support getting and setting properties
* <p>Returns false in default implementation, and not actually used yet.
*/
public boolean supportsProperties();
/**
* Required method for subsystem factory child classes. Return true if you support filters, false otherwise.
* If you support filters, then some housekeeping will be done for you automatically. Specifically, they
* will be saved and restored for you automatically.
* <p>Returns true in default implementation.
*/
public boolean supportsFilters();
/**
* Indicates whether the subsystem supports displaying children under
* its filters. By default, this will return true, but if filters that can't
* be expanded are desired, this can be overridden to return false.
*/
public boolean supportsFilterChildren();
/**
* Required method for subsystem factory child classes. Return true if you filter caching.
* If you support filter caching, then the views will always check the in-memory cache for
* filter results before attempting a query.
* <p>Returns true in default implementation.
*/
public boolean supportsFilterCaching();
/**
* Required method for subsystem factory child classes. Return true if you support filters, and you support
* multiple filter strings per filter. Return false to restrict the user to one string per filter.
* <p>Returns true in default implementation.
*/
public boolean supportsMultipleFilterStrings();
/**
* Required method for subsystem factory child classes if returning true from supportsFilters.
* Return true if you support filters within filters, false otherwise.
* <p>Returns false in default implementation.
*/
public boolean supportsNestedFilters();
/**
* Return true if you support quick filters. These allow the user to subset a remote system object at
* the time they expand it in the remote system explorer tree view.
* <p>
* Not supported yet
*/
public boolean supportsQuickFilters();
/**
* Return true if filters of this subsystem factory support dropping into.
*/
public boolean supportsDropInFilters();
/**
* Return true if filters of this subsystem factory provide a custom implementation of drop support.
* By default, the filter reference adapter treats a drop on a filter as an update to the list of filter
* strings for a filter. For things like files, it is more desirable to treat the drop as a physical
* resource copy, so in that case, custom drop makes sense.
*
* By default this returns false.
*/
public boolean providesCustomDropInFilters();
/**
* Return true if you support user-defined actions for the remote system objects returned from expansion of
* subsystems created by this subsystem factory
* @see #getActionSubSystem(ISubSystem)
* @see #supportsUserDefinedActions(ISelection)
* <p>Returns false in default implementation.
*/
public boolean supportsUserDefinedActions();
/**
* Return true if you support compile actions for the remote system objects returned from expansion of
* subsystems created by this subsystem factory.
* @see #getCompileManager()
* <p>Returns false in default implementation.
*/
public boolean supportsCompileActions();
/**
* Return true if you support user-defined/managed named file types
* <p>Returns false in default implementation.
*/
public boolean supportsFileTypes();
/**
* Tell us if this subsystem factory supports targets, which are destinations for
* pushes and builds. Normally only true for file system factories.
*/
public boolean supportsTargets();
/**
* Tell us if this subsystem factory supports server launch properties, which allow the user
* to configure how the server-side code for these subsystems are started. There is a Server
* Launch Setting property page, with a pluggable composite, where users can configure these
* properties.
* <br> By default we return false here. This is overridden in UniversalFileSubSystemConfiguration though.
*/
public boolean supportsServerLaunchProperties(IHost host);
/**
* If {@link #supportsServerLaunchProperties(IHost)} returns true, this method may be called by
* the server launcher to decide if a given remote server launch type is supported or not.
* <br> We return true by default.
* @see org.eclipse.rse.core.subsystems.ServerLaunchType
* @see #getServerLauncherForm(Shell, ISystemMessageLine)
*/
public boolean supportsServerLaunchType(ServerLaunchType serverLaunchType);
/**
* Tell us if filter strings are case sensitive.
* <p>Returns false in default implementation.
*/
public boolean isCaseSensitive();
// ---------------------------------
// USER-PREFERENCE METHODS...
// ---------------------------------
/**
* If we support filters, should we show filter pools in the remote system explorer?
* Typically retrieved from user preferences.
*/
public boolean showFilterPools();
/*
* If we support filters, should we show filter strings in the remote system explorer?
* Typically retrieved from user preferences.
*
public boolean showFilterStrings();
*/
/**
* If we support filters, should we show filter pools in the remote system explorer?
* This is to set it after the user changes it in the user preferences. It may require
* refreshing the current view.
*/
public void setShowFilterPools(boolean show);
/*
* If we support filters, should we show filter strings in the remote system explorer?
* This is to set it after the user changes it in the user preferences. It may require
* refreshing the current view.
*
public void setShowFilterStrings(boolean show);
*/
// ---------------------------------
// PROXY METHODS. USED INTERNALLY...
// ---------------------------------
/**
* Private method called by RSEUIPlugin
*/
public void setSubSystemConfigurationProxy(ISubSystemConfigurationProxy proxy);
/**
* Private method
*/
public ISubSystemConfigurationProxy getSubSystemConfigurationProxy();
// ---------------------------------
// FACTORY ATTRIBUTE METHODS...
// ---------------------------------
/**
* Return vendor of this factory.
* This comes from the xml "vendor" attribute of the extension point.
*/
public String getVendor();
/**
* Return name of this factory. Matches value in name attribute in extension point xml
*/
public String getName();
/**
* Return description of this factory. Comes from translated description string in extension point xml
*/
public String getDescription();
/**
* Return unique id of this factory. Matches value in id attribute in extension point xml
*/
public String getId();
/**
* Return the category this subsystem factory subscribes to.
* @see org.eclipse.rse.model.ISubSystemConfigurationCategories
*/
public String getCategory();
/**
* Return the system types this subsystem factory supports.
*/
public String[] getSystemTypes();
// ---------------------------------
// PROFILE METHODS...
// ---------------------------------
/**
* Called by SystemRegistry when we are about to delete a profile.
* <p>
* Our only mission is to delete the filter pool associated with it,
* because the registry has already called deleteSubSystemsByConnection
* for every subsystem of every connection owned by this profile.
*/
public void deletingSystemProfile(ISystemProfile profile);
/**
* Called by SystemRegistry when we have toggled the active-status of a profile
*/
public void changingSystemProfileActiveStatus(ISystemProfile profile, boolean newStatus);
/**
* Get owning profile object given a filter pool object
*/
public ISystemProfile getSystemProfile(ISystemFilterPool pool);
// ---------------------------------
// SUBSYSTEM METHODS...
// ---------------------------------
/**
* Called by SystemRegistry's renameSystemProfile method to ensure we update our
* subsystem names within each subsystem.
* <p>
* This is called AFTER changing the profile's name!!
*/
public void renameSubSystemProfile(ISubSystem ss, String oldProfileName, String newProfileName);
/**
* Called by SystemRegistry's renameSystemProfile method to pre-test if we are going to run into errors on a
* profile rename, due to file or folder in use.
*/
public void preTestRenameSubSystemProfile(String oldProfileName) throws Exception;
/**
* Called by SystemRegistry's renameConnection method to ensure we update our
* connection names within each subsystem.
* <p>
* Must be called prior to changing the connection's name!!
*/
public void renameSubSystemsByConnection(IHost conn, String newConnectionName);
/**
* Called by SystemRegistry's deleteConnection method to ensure we delete all our
* subsystems for a given connection.
*/
public void deleteSubSystemsByConnection(IHost conn);
/**
* Creates a new subsystem instance that is associated with the given connection object.
* SystemRegistryImpl calls this when a new connection is created, and appliesToSystemType returns true.
* @param conn The connection to create a subsystem for
* @param creatingConnection true if we are creating a connection, false if just creating
* another subsystem for an existing connection.
* @param yourNewConnectionWizardPages The wizard pages you supplied to the New Connection wizard, via the
* {@link org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter#getNewConnectionWizardPages(ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)}
* method or null if you didn't override this method.
*/
public ISubSystem createSubSystem(IHost conn, boolean creatingConnection, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages);
// used in the case where newsubsystems are added after a connection exists
public ISubSystem createSubSystemAfterTheFact(IHost conn);
public ISubSystem createSubSystemInternal(IHost conn);
/**
* Find or create a connector service for this host
*/
public IConnectorService getConnectorService(IHost host);
/**
* Overridable entry for child classes to contribute a server launcher instance
* for a given subsystem.
* <p>
* Create an instance of ServerLauncher, and add it to the given subsystem.
* When a subsystem is created, and {@link #supportsServerLaunchProperties(IHost)}
* returns true, this method is called to create the server launcher instance
* associated with the subsystem. The default implementation is to create an
* instance of {@link IRemoteServerLauncher}, but override to create your own
* ServerLauncher instance if you have your own class.
*/
public IServerLauncherProperties createServerLauncher(IConnectorService connectorService);
/**
* Updates user-editable attributes of an existing subsystem instance.
* These attributes typically affect the live connection, so the subsystem will be forced to
* disconnect.
* <p>
* The subsystem will be saved to disk.
* @param shell parent shell needed in case an error message is displayed
* @param subsystem target of the update action
* @param updateUserId true if we are updating the userId, else false to ignore userId
* @param userId new local user Id. Ignored if updateUserId is false
* @param updatePort true if we are updating the port, else false to ignore port
* @param port new local port value. Ignored if updatePort is false
*/
public void updateSubSystem(Shell shell, ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port);
/**
* Update the port for the given subsystem instance.
* Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)}
*/
public void setSubSystemPort(Shell shell, ISubSystem subsystem, int port);
/**
* Update the user ID for the given subsystem instance.
* Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)}
*/
public void setSubSystemUserId(Shell shell, ISubSystem subsystem, String userId);
/**
* Returns true if this factory allows users to delete instances of subsystem objects.
* Would only be true if users are allowed to create multiple instances of subsystem objects
* per connection.
*/
public boolean isSubSystemsDeletable();
/**
* Deletes a given subsystem instance from the list maintained by this factory.
* SystemRegistryImpl calls this when the user selects to delete a subsystem object,
* or delete the parent connection this subsystem is associated with.
* In former case, this is only called if the factory supports user-deletable subsystems.
*/
public boolean deleteSubSystem(ISubSystem subsystem);
/**
* Clone a given subsystem into the given connection.
* Called when user does a copy-connection action.
* @param oldSubsystem The subsystem to be cloned
* @param newConnection The connection into which to create and clone the old subsystem
* @param copyProfileOperation Pass true if this is an profile-copy operation versus a connection-copy operation
* @return New subsystem within the new connection
*/
public ISubSystem cloneSubSystem(ISubSystem oldSubsystem, IHost newConnection, boolean copyProfileOperation)
throws Exception;
/**
* Returns a list of subsystem objects existing for the given connection.
* @param conn System connection to retrieve subsystems for
* @param force true if we should force all the subsystems to be restored from disk if not already
*/
public ISubSystem[] getSubSystems(IHost conn, boolean force);
/**
* Returns a list of all subsystem objects for all connections.
*/
public ISubSystem[] getSubSystems(boolean force);
/**
* Renames a subsystem. This is better than ss.setName(String newName) as it saves the subsystem to disk.
*/
public void renameSubSystem(ISubSystem subsystem, String newName);
/**
* Disconnect all subsystems currently connected.
* Called by shutdown() of RSEUIPlugin.
*/
public void disconnectAllSubSystems()
throws Exception;
// ---------------------------------
// FILTER POOL METHODS...
// ---------------------------------
/**
* Get the filter pool manager for the given profile
*/
public ISystemFilterPoolManager getFilterPoolManager(ISystemProfile profile);
/**
* Copy the filter pool manager and return a new one. Called during profile-copy operations.
* Will also copy all of the filter pools and their respective data.
*/
public ISystemFilterPoolManager copyFilterPoolManager(ISystemProfile oldProfile, ISystemProfile newProfile)
throws Exception;
/**
* Given a subsystem, return the first (hopefully only) default pool for this
* subsystem's profile.
*/
public ISystemFilterPool getDefaultSystemFilterPool(ISubSystem subsys);
/**
* Test if any filter pools in the given profile are referenced by other profiles,
* which are active.
* <p>
* Called when user tries to make a profile inactive. We prevent this if there exists
* active references.
* @param profile The profile being tested
* @return An array of the active subsystems which reference filter pools in this profile,
* or null if none are found.
*/
public ISubSystem[] testForActiveReferences(ISystemProfile profile);
// ---------------------------------
// FILTER METHODS
// ---------------------------------
/**
* Return the translated string to show in the property sheet for the type property when a filter is selected.
*/
public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter);
/**
* Return true if we should show the refresh action in the popup for the given element.
*/
public boolean showRefreshOnFilter();
/**
* Return true if we should show the show in table action in the popup for the given element.
*/
public boolean showGenericShowInTableOnFilter();
/**
* Given a filter, decide whether to show the Filter Strings property page
* for this filter. Default is true.
*/
public boolean showChangeFilterStringsPropertyPage(ISystemFilter filter);
/**
* Determines whether this factory is responsible for the creation of subsytems of the specified type
* Subsystem factories should override this to indicate which subsystems they support.
*
* @param subSystemType type of subsystem
* @return whether this factory is for the specified subsystemtype
*/
public boolean isFactoryFor(Class subSystemType);
// ---------------------------------
// FILTER REFERENCE METHODS
// ---------------------------------
// ---------------------------------
// STATE METHODS...
// ---------------------------------
/**
* Called by adapters prior to asking for actions, in case the connection of the currently selected
* object is required by the action.
*/
public void setConnection(IHost connection);
/**
* Called by adapters prior to asking for actions. For cases when current selection is needed.
*/
public void setCurrentSelection(Object[] selection);
// ---------------------------------
// SAVE METHODS...
// ---------------------------------
/**
* Saves absolutely everything to disk. This is called as a safety
* measure when the workbench shuts down.
* <p>
* Totally handled for you!
* <p>
* Calls saveSubSystems() and saveFilterPools()
* <p>
* Exceptions are swallowed since we cannot deal with them on shutdown anyway!
*/
public boolean commit();
/**
* Save one subsystem to disk.
* Called by each subsystem when their data changes.
*/
public void saveSubSystem(ISubSystem subsys)
throws Exception;
/**
* <i><b>Private</b>. Do not call or use.</i><br>
* @generated This field/method will be replaced during code generation
* @return The list of SubSystemList references
*/
java.util.List getSubSystemList();
/**
* <i><b>Private</b>. Do not call or use.</i><br>
* @generated This field/method will be replaced during code generation
* @return The list of FilterPoolManagerList references
*/
java.util.List getFilterPoolManagerList();
public ISystemFilterPool getDefaultFilterPool(ISystemProfile profile, String oldProfileName);
public ISystemProfile getSystemProfile(String name);
public void renameFilterPoolManager(ISystemProfile profile);
// /**
// * Return the validator for the userId.
// * A default is supplied.
// * Note this is only used for the subsystem's properties, so will not
// * be used by the connection's default. Thus, is only of limited value.
// * <p>
// * This must be castable to ICellEditorValidator for the property sheet support.
// */
// public ISystemValidator getUserIdValidator();
// /**
// * Return the validator for the password which is prompted for at runtime.
// * No default is supplied.
// */
// public ISystemValidator getPasswordValidator();
// /**
// * Return the validator for the port.
// * A default is supplied.
// * This must be castable to ICellEditorValidator for the property sheet support.
// */
// public ISystemValidator getPortValidator();
}

View file

@ -0,0 +1,99 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
/**
* Interface to SubSystemConfigurationExtension class
* Internal use, not likely you will ever need to use it or access it directly.
*/
public interface ISubSystemConfigurationProxy
{
/**
* Return value of the <samp>name</samp> xml attribute.
* Return name of this factory. Matches value in name attribute in extension point xml
*/
public String getName();
/**
* Return value of the <samp>description</samp> xml attribute.
* Return description of this factory. Matches value in description attribute in extension point xml
*/
public String getDescription();
/**
* Return value of the <samp>id</samp> xml attribute.
* Return unique id of this configuration.
*/
public String getId();
/**
* Return value of the <samp>systemTypes</samp> xml attribute.
* Return the system types this subsystem configuration supports.
*/
public String[] getSystemTypes();
/**
* Return true if this factory supports all system types
*/
public boolean supportsAllSystemTypes();
/**
* Return value of the <samp>vendor</samp> xml attribute.
* Return vendor of this configuration.
*/
public String getVendor();
/**
* Return value of the <samp>category</samp> xml attribute.
* Return the category this subsystem configuration subscribes to.
* @see org.eclipse.rse.model.ISubSystemConfigurationCategories
*/
public String getCategory();
/**
* Return true if the subsystem factory has been instantiated yet
*/
public boolean isSubSystemConfigurationActive();
/**
* Returns the priority of the subsystem configuration.
*/
public int getPriority();
/**
* Return the subsystem factory singleton instance. Will instantiate if not already.
*/
public ISubSystemConfiguration getSubSystemConfiguration();
/**
* Return an instance of the ISystem class identified by the "systemClass" attribute
* of this subsystemFactory extension point. Note each call to this method returns a
* new instance of the class, or null if no "systemClass" attribute was specified.
*/
public IConnectorService getSystemObject();
/**
* Test if the given system type matches one or more of the type names declared in the
* <samp>systemTypes</samp> attribute of this extension.
*/
public boolean appliesToSystemType(String type);
/**
* Reset for a full refresh from disk, such as after a team synch.
*/
public void reset();
/**
* After a reset, restore from disk
*/
public void restore();
}

View file

@ -18,12 +18,13 @@ package org.eclipse.rse.core.subsystems;
import org.eclipse.rse.core.model.ISystemContentsType;
/**
* Represents contents that are children of a container
*/
public class RemoteChildrenContentsType implements ISystemContentsType
{
public static String CONTENTS_TYPE_CHILDREN = "contents_children"; //$NON-NLS-1$
public static String CONTENTS_TYPE_CHILDREN = "contents_children";
public static RemoteChildrenContentsType _instance = new RemoteChildrenContentsType();
public static RemoteChildrenContentsType getInstance()

View file

@ -0,0 +1,121 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy;
import org.eclipse.rse.core.filters.SystemFilterNamingPolicy;
/**
* A filter naming policy is responsible for returning the save file names for
* a given filter framework object.
* This policy implements our naming policy for the filter files in the
* remote systems project.
*/
public class SubSystemFilterNamingPolicy
extends SystemFilterNamingPolicy
implements IRSEFilterNamingPolicy
{
/**
* Constructor for SubSystemFilterNamingPolicy
*/
public SubSystemFilterNamingPolicy()
{
super();
}
/**
* Get the unqualified save file name for the given SystemFilterPoolManager object.
* Do NOT include the extension, as .xmi will be added.
* <p>
* Returns "filterPools_"+managerName by default.
*/
public String getManagerSaveFileName(String managerName)
{
return super.getManagerSaveFileName(managerName);
}
/**
* Get the unqualified save file name for the given SystemFilterPoolReferenceManager object.
* Do NOT include the extension, as .xmi will be added.
* <p>
* Returns "filterPoolRefs_"+managerName by default.
*/
public String getReferenceManagerSaveFileName(String managerName)
{
return super.getReferenceManagerSaveFileName(managerName);
}
/**
* Get the unqualified save file name for the given SystemFilterPool object.
* Do NOT include the extension, as .xmi will be added.
* <p>
* Returns getFilterPoolSaveFileNamePrefix()+poolName by default.
*/
public String getFilterPoolSaveFileName(String poolName)
{
return super.getFilterPoolSaveFileName(poolName);
}
/**
* Get the file name prefix for all pool files.
* Used to deduce the saved pools by examining the file system
* <p>
* By default returns "filterPool_"
*/
public String getFilterPoolSaveFileNamePrefix()
{
return super.getFilterPoolSaveFileNamePrefix();
}
/**
* Get the folder name for the given SystemFilterPool object.
* <p>
* Returns getFilterPoolFolderNamePrefix()+poolName by default.
*/
public String getFilterPoolFolderName(String poolName)
{
return super.getFilterPoolFolderName(poolName);
}
/**
* Get the folder name prefix for all pool folders.
* Used to deduce the saved pools by examining the file system
* <p>
* By default returns "FilterPool_"
*/
public String getFilterPoolFolderNamePrefix()
{
return super.getFilterPoolFolderNamePrefix();
}
/**
* Get the unqualified save file name for the given SystemFilter object.
* Do NOT include the extension, as .xmi will be added.
* <p>
* Returns getFilterSaveFileNamePrefix()+filterName by default.
*/
public String getFilterSaveFileName(String filterName)
{
return super.getFilterSaveFileName(filterName);
}
/**
* Get the file name prefix for all filter files.
* Used to deduce the saved filters by examining the file system
* <p>
* Returns "Filter_" by default.
*/
public String getFilterSaveFileNamePrefix()
{
return super.getFilterSaveFileNamePrefix();
}
}

View file

@ -27,10 +27,11 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.filters.ISystemFilterReference;
import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.model.ISystemResourceChangeEvents;
import org.eclipse.rse.model.SystemRegistry;
import org.eclipse.rse.model.SystemResourceChangeEvent;
import org.eclipse.rse.processes.ui.ProcessesPlugin;
import org.eclipse.rse.processes.ui.SystemProcessesResources;
@ -43,6 +44,7 @@ import org.eclipse.rse.subsystems.processes.core.subsystem.RemoteProcessSubSyste
import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemBaseAction;
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.swt.widgets.Shell;
@ -145,7 +147,7 @@ public class SystemKillProcessAction extends SystemBaseDialogAction implements I
*/
protected IRunnableContext getRunnableContext()
{
ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry();
SystemRegistry sr = RSEUIPlugin.getTheSystemRegistry();
IRunnableContext irc = sr.getRunnableContext();
if (irc == null)
irc = new ProgressMonitorDialog(getShell());
@ -239,7 +241,7 @@ public class SystemKillProcessAction extends SystemBaseDialogAction implements I
// update the ui
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
SystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
for (int i = 0; i < results.size(); i++)
{
ISystemFilterReference ref = (ISystemFilterReference)results.get(i);

View file

@ -16,7 +16,7 @@
package org.eclipse.rse.processes.ui.actions;
import org.eclipse.rse.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.processes.ui.SystemProcessFilterStringEditPane;
import org.eclipse.rse.processes.ui.SystemProcessesResources;
import org.eclipse.rse.ui.ISystemIconConstants;

Some files were not shown because too many files have changed in this diff Show more