Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-07-04 08:35:04 +0000
committerTobias Schwarz2014-07-04 08:36:56 +0000
commit8f170df14be2719dcc29ad8ec494fb8e3681478b (patch)
tree36434f94f665ab7e9928ef8a1717945f6bdff935
parent0b339905fc0ae6af00d98467d521a86033f8f75c (diff)
downloadorg.eclipse.tcf-8f170df14be2719dcc29ad8ec494fb8e3681478b.tar.gz
org.eclipse.tcf-8f170df14be2719dcc29ad8ec494fb8e3681478b.tar.xz
org.eclipse.tcf-8f170df14be2719dcc29ad8ec494fb8e3681478b.zip
Target Explorer: add steps for channel manager rework
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml61
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ChainPeersIterator.java78
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ValueAddsIterator.java57
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ApplyPathMapsStep.java78
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ChainPeerStep.java96
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/CloseChannelStep.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/LaunchValueAddStep.java84
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ShutdownValueAddStep.java59
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerStepContext.java62
17 files changed, 679 insertions, 14 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java
index 798836236..0ef68d438 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java
@@ -147,8 +147,7 @@ public class StepperAttributeUtil {
* @param fullQualifiedId The full qualified id for this step.
* @param data The data.
* @param value The new value.
- * @param share When <code>true</code>, the value is also stored within the parent full
- * qualified id to share the value with other steps within the same parent (group).
+ * @param share If <code>true</code>, the value is also stored without the full qualified id.
* @return <code>true</code> if the value was set.
*/
public final static boolean setProperty(String key, IFullQualifiedId fullQualifiedId, IPropertiesContainer data, Object value, boolean share) {
@@ -182,8 +181,7 @@ public class StepperAttributeUtil {
* @param fullQualifiedId The full qualified id for this step.
* @param data The data.
* @param value The new boolean value.
- * @param share When <code>true</code>, the value is also stored within the parent full
- * qualified id to share the value with other steps within the same parent (group).
+ * @param share If <code>true</code>, the value is also stored without the full qualified id.
* @return <code>true</code> if the value was set.
*/
public final static boolean setProperty(String key, IFullQualifiedId fullQualifiedId, IPropertiesContainer data, boolean value, boolean share) {
@@ -191,7 +189,7 @@ public class StepperAttributeUtil {
Assert.isNotNull(data);
if (share && fullQualifiedId != null) {
- data.setProperty(getFullQualifiedKey(key, fullQualifiedId.getParentId(), data), value);
+ data.setProperty(getFullQualifiedKey(key, null, data), value);
}
return data.setProperty(getFullQualifiedKey(key, fullQualifiedId, data), value);
}
@@ -217,8 +215,7 @@ public class StepperAttributeUtil {
* @param fullQualifiedId The full qualified id for this step.
* @param data The data.
* @param value The new int value.
- * @param share When <code>true</code>, the value is also stored within the parent full
- * qualified id to share the value with other steps within the same parent (group).
+ * @param share If <code>true</code>, the value is also stored without the full qualified id.
* @return <code>true</code> if the value was set.
*/
public final static boolean setProperty(String key, IFullQualifiedId fullQualifiedId, IPropertiesContainer data, int value, boolean share) {
@@ -226,7 +223,7 @@ public class StepperAttributeUtil {
Assert.isNotNull(data);
if (share && fullQualifiedId != null) {
- data.setProperty(getFullQualifiedKey(key, fullQualifiedId.getParentId(), data), value);
+ data.setProperty(getFullQualifiedKey(key, null, data), value);
}
return data.setProperty(getFullQualifiedKey(key, fullQualifiedId, data), value);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
index 1e403d8bf..2abfb226f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
@@ -10,7 +10,9 @@
package org.eclipse.tcf.te.runtime.stepper.utils;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.persistence.utils.DataHelper;
@@ -53,6 +55,7 @@ public final class StepperHelper {
}
if (stepGroupId != null && stepContext != null) {
+ scheduleStepperJob(stepContext, stepGroupId, name, histData, isCancelable, callback, monitor);
StepperJob job = new StepperJob(name != null ? name : "", //$NON-NLS-1$
stepContext,
data,
@@ -71,4 +74,33 @@ public final class StepperHelper {
}
}
+
+ public static final void scheduleStepperJob(Object context, String stepGroupId, String jobName, IPropertiesContainer data, boolean isCancelable, ICallback callback, IProgressMonitor monitor) {
+ IStepContext stepContext = null;
+ if (context instanceof IStepContext) {
+ stepContext = (IStepContext)context;
+ }
+ else if (context instanceof IAdaptable) {
+ stepContext = (IStepContext)((IAdaptable)context).getAdapter(IStepContext.class);
+ }
+ if (stepContext == null && context != null) {
+ stepContext = (IStepContext)Platform.getAdapterManager().getAdapter(context, IStepContext.class);
+ }
+
+ StepperJob job = new StepperJob(jobName != null ? jobName : "", //$NON-NLS-1$
+ stepContext,
+ data,
+ stepGroupId,
+ stepGroupId,
+ isCancelable,
+ monitor == null);
+ job.setJobCallback(callback);
+
+ if (monitor != null) {
+ job.run(monitor);
+ }
+ else {
+ job.schedule();
+ }
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml
index 5adce2509..c0aaa661a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml
@@ -19,7 +19,7 @@
</service>
</extension>
-<!-- Launch Step contributions -->
+<!-- Step contributions -->
<extension point="org.eclipse.tcf.te.runtime.stepper.steps">
<step
id="org.eclipse.tcf.te.tcf.core.openChannelStep"
@@ -35,6 +35,65 @@
id="org.eclipse.tcf.te.tcf.core.shutDownStep"
class="org.eclipse.tcf.te.tcf.core.steps.ShutDownStep"
label="%ShutDownStep.name"/>
+
+ <step
+ id="org.eclipse.tcf.te.tcf.core.internal.launchValueAddStep"
+ class="org.eclipse.tcf.te.tcf.core.steps.internal.LaunchValueAddStep"
+ label="%LaunchValueAddStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.core.internal.chainPeerStep"
+ class="org.eclipse.tcf.te.tcf.core.steps.internal.ChainPeerStep"
+ label="%ChainPeerStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.core.internal.applyPathMapsStep"
+ class="org.eclipse.tcf.te.tcf.core.steps.internal.ApplyPathMapsStep"
+ label="%ApplyPatMapsStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.core.internal.closeChannelStep"
+ class="org.eclipse.tcf.te.tcf.core.steps.internal.CloseChannelStep"
+ label="%CloseChannelStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.core.internal.shutdownValueAddsStepGroup"
+ class="org.eclipse.tcf.te.tcf.core.steps.internal.ShutdownValueAddStep"
+ label="%ShutdownValueAddStep.name"/>
+
</extension>
+<!-- Step contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
+ <stepGroup id="org.eclipse.tcf.te.tcf.core.openChannelStepGroup">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.core.launchValueAddsStepGroup"/>
+ <reference id="org.eclipse.tcf.te.tcf.core.chainPeersStepGroup"/>
+ <reference id="org.eclipse.tcf.te.tcf.core.internal.applyPathMapsStep"/>
+ </references>
+ </stepGroup>
+ <stepGroup id="org.eclipse.tcf.te.tcf.core.internal.launchValueAddsStepGroup"
+ iterator="org.eclipse.tcf.te.tcf.core.iterators.ValueAddsIterator">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.core.internal.launchValueAddStep"/>
+ </references>
+ </stepGroup>
+ <stepGroup id="org.eclipse.tcf.te.tcf.core.internal.chainPeersStepGroup"
+ iterator="org.eclipse.tcf.te.tcf.core.iterators.ChainPeersIterator">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.core.internal.chainPeerStep"/>
+ </references>
+ </stepGroup>
+
+
+ <stepGroup id="org.eclipse.tcf.te.tcf.core.closeChannelStepGroup">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.core.internal.closeChannelStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.core.shutdownValueAddsStepGroup"/>
+ </references>
+ </stepGroup>
+ <stepGroup id="org.eclipse.tcf.te.tcf.core.internal.shutdownValueAddsStepGroup"
+ iterator="org.eclipse.tcf.te.tcf.core.iterators.ValueAddsIterator">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.core.internal.shutdownValueAddStep"/>
+ </references>
+ </stepGroup>
+ </extension>
+
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java
index 86a2ae520..5258a52bf 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java
@@ -21,12 +21,18 @@ public interface ITcfStepAttributes {
public static final String ATTR_PREFIX = "org.eclipse.tcf.te.tcf.locator"; //$NON-NLS-1$
/**
- * Launch configuration attribute: The TCF channel.
+ * Step attribute: The TCF channel.
*/
public static final String ATTR_CHANNEL = ITcfStepAttributes.ATTR_PREFIX + ".channel"; //$NON-NLS-1$
/**
- * Launch configuration attribute: The token for a running TCF command.
+ * Step attribute: The token for a running TCF command.
*/
public static final String ATTR_RUNNING_TOKEN = ITcfStepAttributes.ATTR_PREFIX + ".running_token"; //$NON-NLS-1$
+
+ /**
+ * Step attribute: The value add.
+ */
+ public static final String ATTR_VALUE_ADD = ITcfStepAttributes.ATTR_PREFIX + ".value_add"; //$NON-NLS-1$
+
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ChainPeersIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ChainPeersIterator.java
new file mode 100644
index 000000000..6355634e4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ChainPeersIterator.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tcf.core.iterators;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepAttributes;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.interfaces.IPeerProperties;
+import org.eclipse.tcf.te.tcf.core.util.persistence.PeerDataHelper;
+import org.eclipse.tcf.te.tcf.core.va.ValueAddManager;
+import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd;
+
+/**
+ * ChainPeersIterator
+ */
+public class ChainPeersIterator extends AbstractPeerStepGroupIterator {
+
+ private final List<IPeer> peers = new ArrayList<IPeer>();
+
+ /**
+ * Constructor.
+ */
+ public ChainPeersIterator() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ super.initialize(context, data, fullQualifiedId, monitor);
+
+ final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
+ final String peerId = peer.getID();
+
+ IValueAdd[] valueAdds = ValueAddManager.getInstance().getValueAdd(peer);
+ for (IValueAdd valueAdd : valueAdds) {
+ IPeer valueAddPeer = valueAdd.getPeer(peerId);
+ if (valueAddPeer != null) {
+ peers.add(valueAddPeer);
+ }
+ }
+
+ String proxyConfiguration = peer.getAttributes().get(IPeerProperties.PROP_PROXIES);
+ IPeer[] proxies = proxyConfiguration != null ? PeerDataHelper.decodePeerList(proxyConfiguration) : null;
+
+ for (IPeer proxy : proxies) {
+ peers.add(proxy);
+ }
+ peers.add(peer);
+
+ setIterations(peers.size());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#internalNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ StepperAttributeUtil.setProperty(IStepAttributes.ATTR_ACTIVE_CONTEXT, fullQualifiedId, data, peers.get(getIteration()));
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ValueAddsIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ValueAddsIterator.java
new file mode 100644
index 000000000..066264b4d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ValueAddsIterator.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tcf.core.iterators;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
+import org.eclipse.tcf.te.tcf.core.va.ValueAddManager;
+import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd;
+
+/**
+ * ValueAddsIterator
+ */
+public class ValueAddsIterator extends AbstractPeerStepGroupIterator {
+
+ private IValueAdd[] valueAdds = null;
+
+ /**
+ * Constructor.
+ */
+ public ValueAddsIterator() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ super.initialize(context, data, fullQualifiedId, monitor);
+
+ valueAdds = ValueAddManager.getInstance().getValueAdd(getActivePeerContext(context, data, fullQualifiedId));
+
+ setIterations(valueAdds != null ? valueAdds.length : 0);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#internalNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ StepperAttributeUtil.setProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data, valueAdds[getIteration()]);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java
index 0aa87b5cd..c33878b5c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java
@@ -48,6 +48,6 @@ public class CloseChannelStep extends AbstractPeerStep {
if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
Tcf.getChannelManager().closeChannel(channel);
}
- callback.done(this, Status.OK_STATUS);
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java
index bc90bcba7..7c07759ce 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java
@@ -51,7 +51,7 @@ public class OpenChannelStep extends AbstractPeerStep {
@Override
public void doneOpenChannel(final Throwable error, final IChannel channel) {
StepperAttributeUtil.setProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId.getParentId(), data, channel);
- callback.done(OpenChannelStep.this, StatusHelper.getStatus(error));
+ callback(data, fullQualifiedId, callback, StatusHelper.getStatus(error), null);
}
});
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java
index 03eaa4e1a..cbdb61f46 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java
@@ -48,6 +48,6 @@ public class ShutDownStep extends AbstractPeerStep {
Tcf.getChannelManager().shutdown(getActivePeerContext(context, data, fullQualifiedId));
}
});
- callback.done(this, Status.OK_STATUS);
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ApplyPathMapsStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ApplyPathMapsStep.java
new file mode 100644
index 000000000..93af0ed0b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ApplyPathMapsStep.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tcf.core.steps.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.services.IPathMap;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
+import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
+
+/**
+ * ApplyPathMapsStep
+ */
+public class ApplyPathMapsStep extends AbstractPeerStep {
+
+ /**
+ * Constructor.
+ */
+ public ApplyPathMapsStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ if (channel == null || channel.getState() != IChannel.STATE_OPEN) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing TCF channel")); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
+ final IPathMapService service = ServiceManager.getInstance().getService(peer, IPathMapService.class);
+ final IPathMap svc = channel.getRemoteService(IPathMap.class);
+ if (service != null && svc != null) {
+ // Apply the initial path map to the opened channel.
+ // This must happen outside the TCF dispatch thread as it may trigger
+ // the launch configuration change listeners.
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ service.applyPathMap(peer, true, callback);
+ }
+ });
+ thread.start();
+ } else {
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ }
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ChainPeerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ChainPeerStep.java
new file mode 100644
index 000000000..2b03e5294
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ChainPeerStep.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tcf.core.steps.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
+import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
+
+/**
+ * ChainPeerStep
+ */
+public class ChainPeerStep extends AbstractPeerStep {
+
+ /**
+ * Constructor.
+ */
+ public ChainPeerStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
+
+ if (channel == null) {
+ channel = peer.openChannel();
+ }
+ else {
+ channel.redirect(peer.getAttributes());
+ }
+
+ final IChannel finChannel = channel;
+ channel.addChannelListener(new IChannel.IChannelListener() {
+ @Override
+ public void onChannelOpened() {
+ finChannel.removeChannelListener(this);
+ StepperAttributeUtil.setProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data, finChannel, true);
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ }
+
+ @Override
+ public void onChannelClosed(Throwable error) {
+ // Remove ourself as listener from the channel
+ finChannel.removeChannelListener(this);
+ callback(data, fullQualifiedId, callback, StatusHelper.getStatus(error), null);
+ }
+
+ @Override
+ public void congestionLevel(int level) {
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep#rollback(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IStatus, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+
+ if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
+ channel.close();
+ }
+
+ super.rollback(context, data, status, fullQualifiedId, monitor, callback);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/CloseChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/CloseChannelStep.java
new file mode 100644
index 000000000..715bcc8f8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/CloseChannelStep.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tcf.core.steps.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
+import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
+
+/**
+ * Close channel step implementation.
+ */
+public class CloseChannelStep extends AbstractPeerStep {
+
+ /**
+ * Constructor.
+ */
+ public CloseChannelStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
+ channel.close();
+ }
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/LaunchValueAddStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/LaunchValueAddStep.java
new file mode 100644
index 000000000..593153476
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/LaunchValueAddStep.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tcf.core.steps.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
+import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
+import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd;
+
+/**
+ * LaunchValueAddStep
+ */
+public class LaunchValueAddStep extends AbstractPeerStep {
+
+ /**
+ * Constructor.
+ */
+ public LaunchValueAddStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
+ if (valueAdd == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing value add channel")); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
+ final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID();
+ valueAdd.isAlive(peerId, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ boolean alive = ((Boolean)getResult()).booleanValue();
+
+ if (!alive) {
+ valueAdd.launch(peerId, callback);
+ }
+ else {
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ }
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep#rollback(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IStatus, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
+ final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID();
+
+ valueAdd.shutdown(peerId, callback);
+
+ super.rollback(context, data, status, fullQualifiedId, monitor, callback);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ShutdownValueAddStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ShutdownValueAddStep.java
new file mode 100644
index 000000000..c333ed43c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ShutdownValueAddStep.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tcf.core.steps.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
+import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
+import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd;
+
+/**
+ * ShutdownValueAddStep
+ */
+public class ShutdownValueAddStep extends AbstractPeerStep {
+
+ /**
+ * Constructor.
+ */
+ public ShutdownValueAddStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
+ if (valueAdd == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing value add channel")); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
+ final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID();
+
+ valueAdd.shutdown(peerId, callback);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
index 7fb76c053..b6ddf7a2a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
@@ -23,6 +23,7 @@
adaptableType="org.eclipse.tcf.protocol.IPeer"
class="org.eclipse.tcf.te.tcf.locator.internal.adapters.AdapterFactory">
<adapter type="org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableURIProvider"/>
+ <adapter type="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext"/>
<adapter type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"/>
</factory>
<factory
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java
index 2a93510ad..1b1f89d46 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java
@@ -107,6 +107,9 @@ public class AdapterFactory implements IAdapterFactory {
}
}
if (IStepContext.class.equals(adapterType)) {
+ if (adaptableObject instanceof IPeer) {
+ return new PeerStepContext((IPeer)adaptableObject);
+ }
if (adaptableObject instanceof IPeerNode) {
return new PeerNodeStepContext((IPeerNode)adaptableObject);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerStepContext.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerStepContext.java
new file mode 100644
index 000000000..00dc08dae
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerStepContext.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tcf.locator.internal.adapters;
+
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.te.runtime.stepper.context.AbstractStepContext;
+
+/**
+ * Peer step context implementation.
+ */
+public class PeerStepContext extends AbstractStepContext {
+
+ /**
+ * Constructor
+ */
+ public PeerStepContext(IPeer peer) {
+ super(peer);
+ }
+
+ /**
+ * Returns the peer.
+ * @return The peer.
+ */
+ public IPeer getPeer() {
+ return (IPeer)getContextObject();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getId()
+ */
+ @Override
+ public String getId() {
+ return getPeer().getID();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getName()
+ */
+ @Override
+ public String getName() {
+ return getPeer().getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(final Class adapter) {
+ if (IPeer.class.equals(adapter)) {
+ return getPeer();
+ }
+
+ return super.getAdapter(adapter);
+ }
+}

Back to the top