diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectStrategy.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectStrategy.java | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectStrategy.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectStrategy.java new file mode 100644 index 000000000..e707bba10 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectStrategy.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.connection.interfaces; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.tcf.te.core.model.interfaces.IConnectable; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension; + +/** + * A connect strategy. + * <p> + * The connect strategy describes the step to perform to connect or disconnect + * to or from a given context. + */ +public interface IConnectStrategy extends IExecutableExtension { + + /** + * Check if the given connectable is valid for this connect strategy. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @return An error message if the connectable context is invalid, </code>null</code> if it is valid. + */ + public String validate(IConnectable connectable); + + /** + * Check if prerequisites for connecting are valid. + * <p> + * Don't run any time-consuming checks. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @return <code>True</code> if the connectable can be connected, <code>false</code> otherwise. + */ + public boolean canConnect(IConnectable connectable); + + /** + * Check if prerequisites for disconnecting are valid. + * <p> + * Don't run any time-consuming checks. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @return <code>True</code> if the connectable can be disconnected, <code>false</code> otherwise. + */ + public boolean canDisconnect(IConnectable connectable); + + /** + * Connect the context. + * <p> + * The connect will be performed by the eclipse job model when no external progress monitor is given. + * If the connect sequence finished or failed or got canceled, the given callback is called if not <code>null</code>. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @param progress An possible external progress monitor or <code>null</code>. + * @param ticksToUse The ticks to use. + * @param cb The callback to call when completed. + * @param autoAttach <code>false</code> to avoid auto attaching. + */ + public void connect(IConnectable connectable, IProgressMonitor progress, int ticksToUse, ICallback cb, boolean autoAttach); + + /** + * Disconnect the context. + * <p> + * The connect will be performed by the eclipse job model when no external progress monitor is given. + * If the connect sequence finished or failed , the given callback is called if not <code>null</code>. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @param progress An possible external progress monitor or <code>null</code>. + * @param cb The callback to call when completed. + * @param useJob <code>true</code> if the disconnect should run in a job. + * @param quitting <code>true</code> if disconnect is called during workbench shutdown. + */ + public void disconnect(IConnectable connectable, IProgressMonitor progress, int ticksToUse, ICallback cb, boolean quitting); + + /** + * Returns if or if not this connect strategy describes a connection type + * of the given family. + * + * @param connectable The connectable context or <code>null</code>. + * @param typeFamily The connection type family id. + * + * @return <code>True</code> if this connect strategy describes a connection type of the given family. + */ + public boolean isConnectionTypeFamily(IConnectable connectable, long typeFamily); +} |