1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-08 17:45:24 +02:00

disconnect(IProgressMonitor), internalDisconnect(IProgressMonitor),

uninitializeService(IProgressMonitor)
This commit is contained in:
David McKnight 2006-04-26 19:55:23 +00:00
parent f52702305d
commit 0ecce33193
27 changed files with 146 additions and 19 deletions

View file

@ -291,7 +291,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
/** /**
* @see org.eclipse.rse.core.subsystems.IConnectorService#disconnect() * @see org.eclipse.rse.core.subsystems.IConnectorService#disconnect()
*/ */
public void disconnect() throws Exception public void internalDisconnect(IProgressMonitor monitor) throws Exception
{ {
try try
{ {
@ -716,7 +716,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
Display.getDefault().syncExec(msgAction); Display.getDefault().syncExec(msgAction);
if (msgAction.getReturnCode() != IDialogConstants.YES_ID) if (msgAction.getReturnCode() != IDialogConstants.YES_ID)
{ {
disconnect(); internalDisconnect(monitor);
throw new InterruptedException(); throw new InterruptedException();
} }
} }
@ -728,7 +728,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
Display.getDefault().syncExec(msgAction); Display.getDefault().syncExec(msgAction);
if (msgAction.getReturnCode() != IDialogConstants.YES_ID) if (msgAction.getReturnCode() != IDialogConstants.YES_ID)
{ {
disconnect(); internalDisconnect(monitor);
throw new InterruptedException(); throw new InterruptedException();
} }
} }

View file

@ -189,7 +189,7 @@ public class ConnectionStatusListener implements IDomainListener, IRunnableWithP
monitor.beginTask(message, IProgressMonitor.UNKNOWN); monitor.beginTask(message, IProgressMonitor.UNKNOWN);
try try
{ {
_connection.disconnect(); _connection.disconnect(monitor);
} }
catch(Exception exc) catch(Exception exc)
{ {

View file

@ -43,7 +43,7 @@ public class LocalConnectorService extends AbstractConnectorService
/** /**
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#disconnect() * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#disconnect()
*/ */
public void disconnect() throws Exception public void internalDisconnect(IProgressMonitor monitor) throws Exception
{ {
fireCommunicationsEvent(CommunicationsEvent.BEFORE_DISCONNECT); fireCommunicationsEvent(CommunicationsEvent.BEFORE_DISCONNECT);

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<jardesc>
<jar path="D:/servers/800/dstore_miners.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/org.eclipse.rse.services.dstore/export.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<refactoring deprecationInfo="true" structuralOnly="true"/>
<selectedProjects>
<project name="org.eclipse.rse.services.dstore"/>
</selectedProjects>
<manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
</sealing>
</manifest>
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
<javaElement handleIdentifier="=org.eclipse.rse.services.dstore/miners"/>
</selectedElements>
</jardesc>

View file

@ -264,7 +264,7 @@ public class CommandMinerThread extends MinerThread
} }
} }
} }
else else // windows
{ {
if ((theOS.indexOf("95") >= 0) || (theOS.indexOf("98") >= 0) || (theOS.indexOf("ME") >= 0)) if ((theOS.indexOf("95") >= 0) || (theOS.indexOf("98") >= 0) || (theOS.indexOf("ME") >= 0))
{ {
@ -293,6 +293,7 @@ public class CommandMinerThread extends MinerThread
} }
args[2] = _invocation; args[2] = _invocation;
_theProcess = Runtime.getRuntime().exec(args, getEnvironment(_subject), theDirectory); _theProcess = Runtime.getRuntime().exec(args, getEnvironment(_subject), theDirectory);
System.out.println("started shell:"+args[0] + " " + args[1] + " " + args[2]);
} }

View file

@ -254,6 +254,13 @@ public abstract class AbstractDStoreService implements IDStoreService
initMiner(monitor); initMiner(monitor);
} }
public void uninitService(IProgressMonitor monitor)
{
_initializeStatus = null;
_cmdDescriptorMap.clear();
_minerElement = null;
}
protected void initMiner(IProgressMonitor monitor) protected void initMiner(IProgressMonitor monitor)
{ {
DataElement fsElement = getMinerElement(); DataElement fsElement = getMinerElement();

View file

@ -265,6 +265,12 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
initMiner(monitor); initMiner(monitor);
} }
public void uninitService(IProgressMonitor monitor)
{
_minerElement = null;
_procMinerStatus = null;
}
public boolean isInitialized() public boolean isInitialized()
{ {
if (_procMinerStatus != null) if (_procMinerStatus != null)

View file

@ -162,6 +162,12 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
super.waitForInitialize(monitor); super.waitForInitialize(monitor);
} }
public void uninitService(IProgressMonitor monitor)
{
super.uninitService(monitor);
}
protected void initMiner(IProgressMonitor monitor) protected void initMiner(IProgressMonitor monitor)
{ {
// init env miner first // init env miner first

View file

@ -383,7 +383,10 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
public void initService(IProgressMonitor monitor) public void initService(IProgressMonitor monitor)
{ {
}
public void uninitService(IProgressMonitor monitor)
{
} }
public boolean isCaseSensitive() public boolean isCaseSensitive()

View file

@ -1148,6 +1148,10 @@ public class LocalFileService extends AbstractFileService implements IFileServic
} }
public void uninitService(IProgressMonitor monitor)
{
}
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return true; return true;

View file

@ -148,4 +148,8 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
{ {
} }
public void uninitService(IProgressMonitor monitor)
{
}
} }

View file

@ -137,6 +137,10 @@ public class LocalShellService implements IShellService, ILocalService
} }
public void uninitService(IProgressMonitor monitor)
{
}
public SystemMessage getMessage(String messageID) public SystemMessage getMessage(String messageID)
{ {
return null; return null;

View file

@ -24,5 +24,6 @@ public interface IService
public String getName(); public String getName();
public String getDescription(); public String getDescription();
public void initService(IProgressMonitor monitor); public void initService(IProgressMonitor monitor);
public void uninitService(IProgressMonitor monitor);
public SystemMessage getMessage(String messageID); public SystemMessage getMessage(String messageID);
} }

View file

@ -782,5 +782,10 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
getFileService().initService(monitor); getFileService().initService(monitor);
} }
public void uninitializeSubSystem(IProgressMonitor monitor)
{
super.uninitializeSubSystem(monitor);
getFileService().uninitService(monitor);
}
} }

View file

@ -181,6 +181,7 @@ public interface IRemoteFile extends IRemoteContainer, IRemotePropertyHolder
*/ */
public boolean isArchive(); public boolean isArchive();
/** /**
* Returns true if this is a binary file * Returns true if this is a binary file
*/ */

View file

@ -168,6 +168,11 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
{ {
if (this._parentFile == null) if (this._parentFile == null)
{ {
if (isRoot())
{
return null;
}
IRemoteFile parentFile = null; IRemoteFile parentFile = null;
// _context.getParentRemoteFile(); // _context.getParentRemoteFile();

View file

@ -1497,6 +1497,11 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
getConnectorService().addCommunicationsListener(this); getConnectorService().addCommunicationsListener(this);
} }
public void uninitializeSubSystem(IProgressMonitor monitor)
{
getConnectorService().removeCommunicationsListener(this);
}
/** /**
* Store the IRemoteFile in a hashmap to quick subsequent retrieval * Store the IRemoteFile in a hashmap to quick subsequent retrieval
* @param file the file * @param file the file

View file

@ -55,7 +55,7 @@ public class FTPConnectorService extends AbstractConnectorService
return _ftpService; return _ftpService;
} }
public void disconnect() public void internalDisconnect(IProgressMonitor monitor)
{ {
_ftpService.disconnect(); _ftpService.disconnect();
} }

View file

@ -100,6 +100,14 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
getConnectorService().addCommunicationsListener(this); getConnectorService().addCommunicationsListener(this);
} }
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/
public void uninitializeSubSystem(IProgressMonitor monitor)
{
getConnectorService().removeCommunicationsListener(this);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.RemoteProcessSubSystem#getParentProcess(org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcess) * @see org.eclipse.rse.subsystems.processes.core.subsystem.RemoteProcessSubSystem#getParentProcess(org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcess)
*/ */

View file

@ -197,5 +197,13 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
getProcessService().initService(monitor); getProcessService().initService(monitor);
} }
/* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/
public void uninitializeSubSystem(IProgressMonitor monitor)
{
super.uninitializeSubSystem(monitor);
getProcessService().uninitService(monitor);
}
} }

View file

@ -658,15 +658,16 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
} }
} }
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry(); //ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, this)); // registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, this));
Display.getDefault().asyncExec(new Refresh(this));
return results; return results;
} }
public void cancelAllShells() public void cancelAllShells()
{ {
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
for (int i = _cmdShells.size() - 1; i >= 0; i--) for (int i = _cmdShells.size() - 1; i >= 0; i--)
{ {
IRemoteCommandShell cmdShell = (IRemoteCommandShell) _cmdShells.get(i); IRemoteCommandShell cmdShell = (IRemoteCommandShell) _cmdShells.get(i);
@ -687,10 +688,25 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
// registry.fireEvent(new // registry.fireEvent(new
// org.eclipse.rse.model.SystemResourceChangeEvent(this, // org.eclipse.rse.model.SystemResourceChangeEvent(this,
// ISystemResourceChangeEvent.EVENT_COMMAND_SHELL_FINISHED, null)); // ISystemResourceChangeEvent.EVENT_COMMAND_SHELL_FINISHED, null));
registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, this)); Display.getDefault().asyncExec(new Refresh(this));
} }
public class Refresh implements Runnable
{
private RemoteCmdSubSystem _ss;
public Refresh(RemoteCmdSubSystem ss)
{
_ss = ss;
}
public void run()
{
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
registry.fireEvent(new SystemResourceChangeEvent(_ss, ISystemResourceChangeEvents.EVENT_REFRESH, _ss));
}
}
/** /**
* @see ICommunicationsListener#isPassiveCommunicationsListener() * @see ICommunicationsListener#isPassiveCommunicationsListener()
*/ */

View file

@ -243,5 +243,10 @@ public final class ShellServiceSubSystem extends RemoteCmdSubSystem implements I
getShellService().initService(monitor); getShellService().initService(monitor);
} }
public void uninitializeSubSystem(IProgressMonitor monitor)
{
cancelAllShells();
getShellService().uninitService(monitor);
}
} }

View file

@ -787,6 +787,15 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
} }
} }
protected void unintializeSubSystems(IProgressMonitor monitor)
{
for (int i = 0; i < _registeredSubSystems.size(); i++)
{
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(i);
ss.uninitializeSubSystem(monitor);
}
}
/** /**
* <i><b>Abstract</b> - you must override, </i>unless subsystem.getParentSubSystemFactory().supportsServerLaunchProperties * <i><b>Abstract</b> - you must override, </i>unless subsystem.getParentSubSystemFactory().supportsServerLaunchProperties
* returns true * returns true
@ -850,10 +859,15 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
* method of the subsystem. * method of the subsystem.
* @see IServerLauncher#disconnect() * @see IServerLauncher#disconnect()
*/ */
public void disconnect() throws Exception public final void disconnect(IProgressMonitor monitor) throws Exception
{ {
if (supportsServerLaunchProperties() && internalDisconnect(monitor);
(starter != null)) unintializeSubSystems(monitor);
}
public void internalDisconnect(IProgressMonitor monitor) throws Exception
{
if (supportsServerLaunchProperties() &&(starter != null))
{ {
try { try {
starter.disconnect(); starter.disconnect();

View file

@ -78,7 +78,7 @@ public interface IConnectorService extends IRSEModelObject
/** /**
* Disconnect from the remote system * Disconnect from the remote system
*/ */
public void disconnect() throws Exception; public void disconnect(IProgressMonitor monitor) throws Exception;
/** /**
* Notifies all listeners of a disconnection through a communications event * Notifies all listeners of a disconnection through a communications event
*/ */

View file

@ -81,6 +81,11 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
*/ */
public void initializeSubSystem(IProgressMonitor monitor); public void initializeSubSystem(IProgressMonitor monitor);
/**
* Called on each subsystem associated with a particular ISystem after it disconnects
*/
public void uninitializeSubSystem(IProgressMonitor monitor);
/** /**
* @return true if this subsystem's properties should take precedence over other subsystems that share the same ISystem * @return true if this subsystem's properties should take precedence over other subsystems that share the same ISystem
*/ */

View file

@ -2823,7 +2823,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
{ {
try try
{ {
getConnectorService().disconnect(); getConnectorService().disconnect(monitor);
} }
catch(Exception exc) catch(Exception exc)
{ {

View file

@ -24,6 +24,7 @@ import java.util.Vector;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
@ -1764,7 +1765,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
{ {
try try
{ {
ss.getConnectorService().disconnect(); ss.getConnectorService().disconnect(new NullProgressMonitor());
} }
catch (Exception exc) catch (Exception exc)
{ {