1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

[176211][api][refactor]Stage 1

- move constants that are model resource descriptions from SystemResources to
RSEModelResources and fix affected classes.
- fix SystemHostPool so that it references the core persistence manager, this
will make it easier to move later.
This commit is contained in:
David Dykstal 2007-03-02 18:54:14 +00:00
parent 5c799eff71
commit 7fdfbed0a2
15 changed files with 70 additions and 70 deletions

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -386,7 +386,7 @@ public class RSEPersistenceManager implements IRSEPersistenceManager {
job = new SaveRSEDOMJob(dom, getRSEPersistenceProvider());
dom.setSaveJob(job);
}
job.schedule(3000); // five second delay
job.schedule(3000); // three second delay
}
}
return result;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -22,9 +22,15 @@ import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.persistence.IRSEPersistenceProvider;
import org.eclipse.rse.persistence.dom.RSEDOM;
/**
* The SaveRSEDOMJob is a workspace job that belongs to the family
* {@link RSECorePlugin#getThePersistenceManager()}. It is used to
* same a DOM to the workspace. A DOM corresponds to a profile.
*/
public class SaveRSEDOMJob extends WorkspaceJob {
private RSEDOM _dom;
@ -50,5 +56,14 @@ public class SaveRSEDOMJob extends WorkspaceJob {
}
return result;
}
public boolean belongsTo(Object family) {
Object[] families = new Object[] {RSECorePlugin.getThePersistenceManager()};
for (int i = 0; i < families.length; i++) {
Object object = families[i];
if (family == object) return true;
}
return super.belongsTo(family);
}
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -126,8 +126,8 @@ public interface ISystemProfileManager {
public boolean isSystemProfileActive(String profileName);
/**
* @generated This field/method will be replaced during code generation
* @return The list of Profiles references
* @return The list of profiles known to this manager. This list is generated
* at the point of this call and may thus be manipulated by the caller.
*/
java.util.List getProfiles();

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -536,12 +536,12 @@ public interface ISystemRegistry extends ISchedulingRule {
* @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 hostAddress ip name of host.
* @param description optional description of the connection. Can be null.
* @return SystemConnection object, or null if it failed to create. This is typically
* because the connectionName is not unique. Call getLastException() if necessary.
*/
public IHost createHost(String systemType, String connectionName, String hostName, String description) throws Exception;
public IHost createHost(String systemType, String connectionName, String hostAddress, String description) throws Exception;
/**
* Creates subsystems for a given host and subsystem configurations.

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -27,10 +27,17 @@ public class RSEModelResources extends NLS {
public static String RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION;
public static String RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION;
public static String RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION;
public static String RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION;
public static String RESID_MODELOBJECTS_PROFILE_DESCRIPTION;
public static String RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION;
public static String RESID_MODELOBJECTS_FILTER_DESCRIPTION;
public static String RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION;
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, RSEModelResources.class);
}
}

View file

@ -1,5 +1,5 @@
################################################################################
# Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
# Copyright (c) 2000, 2007 IBM Corporation. All rights reserved.
# This program and the accompanying materials are made available under the terms
# of the Eclipse Public License v1.0 which accompanies this distribution, and is
# available at http://www.eclipse.org/legal/epl-v10.html
@ -19,3 +19,9 @@
RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION=An RSE Model Object represents any object in the Remote System Explorer.
RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION=A Referencing Object encapsulates the operations required of an object which is merely a reference to another object.
RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION=A filter string is a single string in a filter. It describes which files will pass through the filter.
RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION=A host pool is a group of hosts. There is one host pool associated with each profile.
RESID_MODELOBJECTS_PROFILE_DESCRIPTION=Your profile is the object with which all your unique settings and RSE objects such as connections are associated.
RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION=The Server Launcher is an object for storing configuration details about how to launch servers on the remote host.
RESID_MODELOBJECTS_FILTER_DESCRIPTION=A filter is a collection of filter strings that determines which files will pass through it.
RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION=A filter pool is a group of filters. There is one filter pool associated with each profile.

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -1230,14 +1230,6 @@ public class SystemResources extends NLS
public static String ACTION_COMPILE_NOPROMPT_LABEL;
// RSE Model Objects
public static String RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION;
public static String RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION;
public static String RESID_MODELOBJECTS_PROFILE_DESCRIPTION;
public static String RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION;
public static String RESID_MODELOBJECTS_FILTER_DESCRIPTION;
public static String RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION;
// Services form
public static String RESID_SERVICESFORM_CONFIGURATION_TOOLTIP;
public static String RESID_SERVICESFORM_SERVICES_TOOLTIP;

View file

@ -1,5 +1,5 @@
################################################################################
# Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
# Copyright (c) 2000, 2007 IBM Corporation. All rights reserved.
# This program and the accompanying materials are made available under the terms
# of the Eclipse Public License v1.0 which accompanies this distribution, and is
# available at http://www.eclipse.org/legal/epl-v10.html
@ -1418,13 +1418,6 @@ RESID_PROPERTIES_PROPERTIES_LABEL=Properties
RESID_PROPERTIES_PROPERTIES_TOOLTIP=
ACTION_COMPILE_NOPROMPT_LABEL=Compile
#### RSE Model Objects ####
RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION=A filter string is a single string in a filter. It describes which files will pass through the filter.
RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION=A host pool is a group of hosts. There is one host pool associated with each profile.
RESID_MODELOBJECTS_PROFILE_DESCRIPTION=Your profile is the object with which all your unique settings and RSE objects such as connections are associated.
RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION=The Server Launcher is an object for storing configuration details about how to launch servers on the remote host.
RESID_MODELOBJECTS_FILTER_DESCRIPTION=A filter is a collection of filter strings that determines which files will pass through it.
RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION=A filter pool is a group of filters. There is one filter pool associated with each profile.
RESID_SERVICESFORM_CONFIGURATION_TOOLTIP=Select the configuration you wish to use to enable this subsystem. A configuration comprises a connector service and a subsystem service.
RESID_SERVICESFORM_SERVICES_TOOLTIP=Select the elements of your chosen configuration and you can view and edit their properties in the Properties section.

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -32,6 +32,7 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterSavePolicies;
import org.eclipse.rse.core.filters.SystemFilterNamingPolicy;
import org.eclipse.rse.core.model.RSEModelResources;
import org.eclipse.rse.internal.filters.SystemFilter;
import org.eclipse.rse.internal.filters.SystemFilterContainerCommonMethods;
import org.eclipse.rse.internal.filters.SystemFilterPoolReference;
@ -286,8 +287,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
* Use this method only if you are not using a SystemFilterPoolManager, else
* use the createSystemFilterPool method in that class.
*
* @param mofHelpers SystemMOFHelpers object with helper methods for saving and restoring via mof
* @param poolFolder the folder that will hold the filter pool.
* This folder will be created if it does not already exist.
* @param name the name of the filter pool. Typically this is also the name
* of the given folder, but this is not required. For the save policy of one file
@ -296,15 +295,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
* to allow nested filters.
* @param isDeletable true if this filter pool is allowed to be deleted by users.
* @param tryToRestore true to attempt a restore first, false if a pure create operation.
* @param savePolicy The save policy for the filter pool and filters. One of the
* following constants from the SystemFilterConstants interface:
* <ul>
* <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool
* <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder
* <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool
* </ul>
* @param namingPolicy The names to use for file and folders when persisting to disk. Pass
* null to just use the defaults.
*/
public ISystemFilterPool createSystemFilterPool(
String name,
@ -558,7 +548,7 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
public String getDescription()
{
return SystemResources.RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION;
return RSEModelResources.RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION;
}
/**
@ -860,7 +850,7 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
/**
* Duplicates a given filter in the list.
* @param filter SystemFilter object to clone
* @param alias New, unique, alias name to give this filter. Clone will fail if this is not unique.
* @param aliasName New, unique, alias name to give this filter. Clone will fail if this is not unique.
*/
public ISystemFilter cloneSystemFilter(ISystemFilter filter, String aliasName)
{
@ -945,8 +935,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
* Restore specific filter pool. You should not call this directly, as it is possible
* that certain data is not restored if the save policy is one file per filter. Rather,
* you should call the createSystemFilterPoolMethod.
* @param mofHelpers SystemMOFHelpers object with helper methods for saving and restoring via mof
* @param folder The filter pool folder.
* @param name name of pool to restore. Used to deduce file name for save policy of one file per pool.
* @param savePolicy policy used to save the pool. One of the following from SystemFilterPoolManager:
* <ul>

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -31,11 +31,11 @@ import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.RSEModelResources;
import org.eclipse.rse.core.references.IRSEReferencedObject;
import org.eclipse.rse.filters.SystemFilterSimple;
import org.eclipse.rse.internal.references.SystemReferencedObject;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemResources;
/**
@ -555,7 +555,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
/**
* Duplicates a given filter in the list.
* @param filter SystemFilter object to clone
* @param alias New, unique, alias name to give this filter. Clone will fail if this is not unique.
* @param aliasName New, unique, alias name to give this filter. Clone will fail if this is not unique.
*/
public ISystemFilter cloneSystemFilter(ISystemFilter filter, String aliasName)
{
@ -938,7 +938,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
/**
* Restore specific filter. Used when save policy is SAVE_POLICY_ONE_FILE_PER_FILTER
* @param mofHelpers helper object with routines for saving/restoring using mof.
* @param folder the folder containing the saved file.
* @param name The name of the saved filter. The file name is derived from this.
* @param parentPool the SystemFilterPool that is the parent of this filter. Will be perpetuated to nested filters.
@ -1021,7 +1020,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
public String getDescription()
{
return SystemResources.RESID_MODELOBJECTS_FILTER_DESCRIPTION;
return RSEModelResources.RESID_MODELOBJECTS_FILTER_DESCRIPTION;
}
/**

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -24,10 +24,10 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.model.RSEModelResources;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
import org.eclipse.rse.internal.references.SystemReferencedObjectHelper;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemResources;
/**
@ -220,7 +220,7 @@ public class SystemFilterString extends RSEModelObject implements ISystemFilterS
public String getDescription()
{
return SystemResources.RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION;
return RSEModelResources.RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION;
}
public String getString()

View file

@ -22,13 +22,13 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.rse.core.IRSEUserIdConstants;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.RSEPreferencesManager;
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.RSEModelObject;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.core.model.RSEModelResources;
/**
@ -67,7 +67,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
}
// -------------------------------------------------------------------------------------
// CONNECTION POOL METHODS...
// Host Pool Methods
// -------------------------------------------------------------------------------------
/**
* Return (and create if necessary) the connection pool for a given system profile.
@ -75,15 +75,12 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
public static ISystemHostPool getSystemHostPool(ISystemProfile profile)
throws Exception
{
//System.out.println("in getSystemConnectionPool for " + profile);
if (pools == null)
pools = new Hashtable();
SystemHostPool pool = (SystemHostPool)pools.get(profile);
//System.out.println("... pool: " + pool);
if (pool == null)
{
pool = new SystemHostPool();
// FIXME (SystemConnectionPoolImpl)initMOF().createSystemConnectionPool();
pool.setName(profile.getName());
try {
pool.restore(); // restore connections
@ -392,7 +389,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
conn.deletingHost(); // let connection do any necessary cleanup
getHostList().remove(conn);
setDirty(true);
RSEUIPlugin.getThePersistenceManager().commit(conn.getSystemProfile());
RSECorePlugin.getThePersistenceManager().commit(conn.getSystemProfile());
}
/**
@ -503,7 +500,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
*/
public boolean commit()
{
return RSEUIPlugin.getThePersistenceManager().commit(this);
return RSECorePlugin.getThePersistenceManager().commit(this);
}
/**
@ -604,7 +601,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
public String getDescription()
{
return SystemResources.RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION;
return RSEModelResources.RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION;
}
/**

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -24,10 +24,11 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemProfileManager;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.model.RSEModelResources;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemResources;
/**
* A profile contains hosts and filter pools. It is the unit of save/restore for RSE model
@ -67,7 +68,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
/**
* Convenience method for create a new connection within this profile.
* Shortcut for {@link org.eclipse.rse.model.ISystemRegistry#createHost(String,String,String,String)}
* Shortcut for {@link ISystemRegistry#createHost(String,String,String,String)}
*/
public IHost createHost(String systemType, String connectionName, String hostName, String description) throws Exception
{
@ -163,7 +164,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd
public String getDescription()
{
return SystemResources.RESID_MODELOBJECTS_PROFILE_DESCRIPTION;
return RSEModelResources.RESID_MODELOBJECTS_PROFILE_DESCRIPTION;
}
/**

View file

@ -43,9 +43,11 @@ public class SystemProfileManager implements ISystemProfileManager {
private static final String PROFILE_FILE_NAME = "profile"; //$NON-NLS-1$
/**
* Default constructor
* Ordinarily there should be only one instance of a SystemProfileManager
* created on the system, so the static method {@link #getSystemProfileManager()} is
* preferred to using this.
*/
protected SystemProfileManager() {
private SystemProfileManager() {
super();
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2004, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -17,10 +17,10 @@
package org.eclipse.rse.core.internal.subsystems;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.model.RSEModelResources;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemResources;
public abstract class ServerLauncher extends RSEModelObject implements IServerLauncherProperties
@ -44,7 +44,7 @@ public abstract class ServerLauncher extends RSEModelObject implements IServerLa
public String getDescription()
{
return SystemResources.RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION;
return RSEModelResources.RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION;
}
public IConnectorService getConnectorService()