Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-07-24 07:56:48 -0400
committerUwe Stieber2014-07-24 07:56:48 -0400
commitc44ff301740782af3fd8a5a942e241bb52b1ab92 (patch)
treef59522838c6bf9a94357beb85cac70825d179e3c
parent064c22544b0150c3278eb0509521c26077bd42de (diff)
downloadorg.eclipse.tcf-c44ff301740782af3fd8a5a942e241bb52b1ab92.tar.gz
org.eclipse.tcf-c44ff301740782af3fd8a5a942e241bb52b1ab92.tar.xz
org.eclipse.tcf-c44ff301740782af3fd8a5a942e241bb52b1ab92.zip
Target Explorer: Fix channel communication log misses early "open channel" commands
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/InitializeLoggingStep.java83
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java2
8 files changed, 104 insertions, 19 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties
index 9c7ee52cd..17fb6c1a5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties
@@ -25,6 +25,7 @@ ShutDownStep.name=Close all TCF channels
LaunchValueAddStep.name=Launch value-add
ChainPeerStep.name=Redirect channel
+InitializeLoggingStep.name=Initialize channel communication logging
ApplyPatMapsStep.name=Apply path map to channel
CloseChannelStep.name=Close channel
ShutdownValueAddStep.name=Shutdown value-add
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 51feeedc9..797a230e2 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
@@ -59,6 +59,11 @@
id="org.eclipse.tcf.te.tcf.core.channelmanager.chainPeerStep"
class="org.eclipse.tcf.te.tcf.core.internal.channelmanager.steps.ChainPeerStep"
label="%ChainPeerStep.name"/>
+
+ <step
+ id="org.eclipse.tcf.te.tcf.core.channelmanager.initializeLoggingStep"
+ class="org.eclipse.tcf.te.tcf.core.internal.channelmanager.steps.InitializeLoggingStep"
+ label="%InitializeLoggingStep.name"/>
<step
id="org.eclipse.tcf.te.tcf.core.channelmanager.applyPathMapsStep"
@@ -83,6 +88,7 @@
<references>
<reference id="org.eclipse.tcf.te.tcf.core.channelmanager.launchValueAddsStepGroup"/>
<reference id="org.eclipse.tcf.te.tcf.core.channelmanager.chainPeersStepGroup"/>
+ <reference id="org.eclipse.tcf.te.tcf.core.channelmanager.initializeLoggingStep"/>
<reference id="org.eclipse.tcf.te.tcf.core.channelmanager.applyPathMapsStep"/>
</references>
</stepGroup>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java
index ebb610b3e..2eb6bf0b5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java
@@ -74,11 +74,12 @@ public interface IPathMapService extends IService {
* <b>Note:</b> This method must be called from outside the TCF event dispatch thread.
*
* @param context The context. Must not be <code>null</code>.
- * @param force If <code>true</code> the path map will be set even if it appears not to be
+ * @param force If <code>true</code>, the path map will be set even if it appears not to be
* different from the path map already set.
+ * @param forceEmpty If <code>true</code>, the path map will be set even if empty.
* @param callback The callback to invoke once the operation completed. Must not be <code>null</code>.
*/
- public void applyPathMap(Object context, boolean force, ICallback callback);
+ public void applyPathMap(Object context, boolean force, boolean forceEmpty, ICallback callback);
/**
* Returns the current client ID used to identify path map rules handled
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
index bdb8ded07..b723c6253 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
@@ -190,6 +190,7 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
// Create the data properties container passed to the "open channel" steps
final IPropertiesContainer data = new PropertiesContainer();
// Set the flags to be passed to the "open channel" steps
+ data.setProperty(IChannelManager.FLAG_FORCE_NEW, forceNew);
data.setProperty(IChannelManager.FLAG_NO_VALUE_ADD, noValueAdd);
data.setProperty(IChannelManager.FLAG_NO_PATH_MAP, noPathMap);
// No recent action history persistence
@@ -242,14 +243,6 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this);
}
- // Log successfully opened channels
- String message = finForceNew ? "Private" : "Shared"; //$NON-NLS-1$ //$NON-NLS-2$
- if (noValueAdd) message += ", No Value Add"; //$NON-NLS-1$
- if (noPathMap) message += ", Not Applying Path Map"; //$NON-NLS-1$
-
- ChannelEvent event = new ChannelEvent(ChannelManager.this, channel, ChannelEvent.TYPE_OPEN, message);
- EventManager.getInstance().fireEvent(event);
-
// Invoke the primary "open channel" done callback
internalDone.doneOpenChannel(null, channel);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
index ce48d6f41..e2124c841 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
@@ -79,7 +79,7 @@ public class ApplyPathMapsStep extends AbstractPeerStep {
if (service != null) {
// Pass in the channel for direct use. IChannelManager.getChannel(peer)
// does return null while still executing the "open channel" step group.
- service.applyPathMap(channel, true, callback);
+ service.applyPathMap(channel, true, false, callback);
} 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/internal/channelmanager/steps/InitializeLoggingStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/InitializeLoggingStep.java
new file mode 100644
index 000000000..7ced62b10
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/InitializeLoggingStep.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.internal.channelmanager.steps;
+
+import org.eclipse.core.runtime.Assert;
+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.te.runtime.events.EventManager;
+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.events.ChannelEvent;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
+import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
+
+/**
+ * Initialize channel communication logging step implementation.
+ */
+public class InitializeLoggingStep extends AbstractPeerStep {
+
+ /* (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 {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ if (channel == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Channel to target not available.")); //$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, ICallback callback) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+ Assert.isNotNull(callback);
+
+ final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ Assert.isNotNull(channel);
+
+ if (channel.getState() == IChannel.STATE_OPEN) {
+ boolean forceNew = StepperAttributeUtil.getBooleanProperty(IChannelManager.FLAG_FORCE_NEW, fullQualifiedId, data);
+ boolean noValueAdd = StepperAttributeUtil.getBooleanProperty(IChannelManager.FLAG_NO_VALUE_ADD, fullQualifiedId, data);
+ boolean noPathMap = StepperAttributeUtil.getBooleanProperty(IChannelManager.FLAG_NO_PATH_MAP, fullQualifiedId, data);
+
+ // Log successfully opened channels
+ String message = forceNew ? "Private" : "Shared"; //$NON-NLS-1$ //$NON-NLS-2$
+ if (noValueAdd) message += ", No Value Add"; //$NON-NLS-1$
+ if (noPathMap) message += ", Not Applying Path Map"; //$NON-NLS-1$
+
+ ChannelEvent event = new ChannelEvent(InitializeLoggingStep.this, channel, ChannelEvent.TYPE_OPEN, message);
+ EventManager.getInstance().fireEvent(event);
+ }
+
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ }
+
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
index 16d25d370..e5b1bac67 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
@@ -160,7 +160,7 @@ public class PathMapService extends AbstractService implements IPathMapService {
updateLaunchConfiguration(config, rulesList);
// Apply the path map
- applyPathMap(context, false, new Callback() {
+ applyPathMap(context, false, false, new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
if (status != null && Platform.inDebugMode()) {
@@ -208,7 +208,7 @@ public class PathMapService extends AbstractService implements IPathMapService {
updateLaunchConfiguration(config, rulesList);
// Apply the path map
- applyPathMap(context, true, new Callback() {
+ applyPathMap(context, true, true, new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
if (status != null && Platform.inDebugMode()) {
@@ -306,10 +306,10 @@ public class PathMapService extends AbstractService implements IPathMapService {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService#applyPathMap(java.lang.Object, boolean, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @see org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService#applyPathMap(java.lang.Object, boolean, boolean, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
*/
@Override
- public void applyPathMap(final Object context, final boolean force, final ICallback callback) {
+ public void applyPathMap(final Object context, final boolean force, final boolean forceEmpty, final ICallback callback) {
Assert.isTrue(!Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
Assert.isNotNull(context);
Assert.isNotNull(callback);
@@ -367,7 +367,7 @@ public class PathMapService extends AbstractService implements IPathMapService {
// If the merged path map differs from the agent side path map, apply the map
if (force || isDifferent(rules, map)) {
// Apply the path map
- set(rules, svc, force, new IPathMap.DoneSet() {
+ set(rules, svc, forceEmpty, new IPathMap.DoneSet() {
@Override
public void doneSet(IToken token, Exception error) {
innerCallback.done(PathMapService.this, StatusHelper.getStatus(error));
@@ -489,9 +489,10 @@ public class PathMapService extends AbstractService implements IPathMapService {
*
* @param map The path map. Must not be <code>null</code>.
* @param svc The path map service. Must not be <code>null</code>.
+ * @param forceEmpty If <code>true</code>, the path map will be set even if empty.
* @param done The callback to invoke. Must not be <code>null</code>.
*/
- public static void set(List<PathMapRule> map, IPathMap svc, boolean force, IPathMap.DoneSet done) {
+ public static void set(List<PathMapRule> map, IPathMap svc, boolean forceEmpty, IPathMap.DoneSet done) {
Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
Assert.isNotNull(map);
Assert.isNotNull(svc);
@@ -506,7 +507,7 @@ public class PathMapService extends AbstractService implements IPathMapService {
}
}
// Apply the path map rules if not empty or forced
- if (!map.isEmpty() || force) {
+ if (!map.isEmpty() || forceEmpty) {
svc.set(map.toArray(new PathMapRule[map.size()]), done);
} else {
done.doneSet(null, null);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
index ae7a4a146..dfe184235 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
@@ -53,7 +53,7 @@ public class PathMapEditorPage extends AbstractTcfLaunchTabContainerEditorPage {
if (peerNode != null && peerNode.getPeer() != null) {
IPathMapService service = ServiceManager.getInstance().getService(peerNode.getPeer(), IPathMapService.class);
if (service != null) {
- service.applyPathMap(peerNode.getPeer(), false, new Callback() {
+ service.applyPathMap(peerNode.getPeer(), false, true, new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
if (status != null && status.getSeverity() == IStatus.ERROR) {

Back to the top