Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-07-30 03:02:20 -0400
committerTobias Schwarz2013-07-30 03:02:20 -0400
commitcd3cdbc0a85da2f57a2732cb63fb4e29f6ab4848 (patch)
treee218b386aeba23add09442d642243cd4c0b1302f
parentb07499780c7f2cb8ae57e921dfd91cbac60eb93d (diff)
downloadorg.eclipse.tcf-cd3cdbc0a85da2f57a2732cb63fb4e29f6ab4848.tar.gz
org.eclipse.tcf-cd3cdbc0a85da2f57a2732cb63fb4e29f6ab4848.tar.xz
org.eclipse.tcf-cd3cdbc0a85da2f57a2732cb63fb4e29f6ab4848.zip
Target Explorer: add common property access service
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core.model/META-INF/MANIFEST.MF3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core.model/src/org/eclipse/tcf/te/tcf/core/model/services/PropertiesAccessService.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/internal/services/PropertiesAccessService.java)22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF81
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/LocatorModelPropertyTester.java73
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/services/PropertiesAccessService.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml7
9 files changed, 98 insertions, 211 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
index a4880a209..87c957537 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
@@ -100,11 +100,12 @@ public class FileTransferItem extends PropertiesContainer implements IFileTransf
*/
@Override
public boolean equals(Object obj) {
- if (obj instanceof IFileTransferItem) {
+ boolean equals = super.equals(obj);
+ if (!equals && obj instanceof IFileTransferItem) {
return getHostPath() != null ? getHostPath().equals(((IFileTransferItem)obj).getHostPath()) : ((IFileTransferItem)obj).getHostPath() == null
&& getTargetPath() != null ? getTargetPath().equals(((IFileTransferItem)obj).getTargetPath()) : ((IFileTransferItem)obj).getTargetPath() == null
&& getDirection() == ((IFileTransferItem)obj).getDirection();
}
- return super.equals(obj);
+ return equals;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java
index 06d23e042..283458491 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java
@@ -79,10 +79,11 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo
*/
@Override
public boolean equals(Object obj) {
- if (obj instanceof PropertiesContainer) {
+ boolean equals = super.equals(obj);
+ if (!equals && obj instanceof PropertiesContainer) {
return uniqueId.equals(((PropertiesContainer)obj).uniqueId);
}
- return super.equals(obj);
+ return equals;
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core.model/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core.model/META-INF/MANIFEST.MF
index 0e3b8c298..355c82eb8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core.model/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core.model/META-INF/MANIFEST.MF
@@ -8,7 +8,8 @@ Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.tcf.core;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0"
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/internal/services/PropertiesAccessService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core.model/src/org/eclipse/tcf/te/tcf/core/model/services/PropertiesAccessService.java
index c6db5ac3d..0eb0ca06d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/internal/services/PropertiesAccessService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core.model/src/org/eclipse/tcf/te/tcf/core/model/services/PropertiesAccessService.java
@@ -7,7 +7,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.tcf.processes.core.model.internal.services;
+package org.eclipse.tcf.te.tcf.core.model.services;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -15,10 +15,10 @@ import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
import org.eclipse.tcf.te.runtime.services.AbstractService;
import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
/**
* Process context node properties access service implementation.
@@ -42,8 +42,8 @@ public class PropertiesAccessService extends AbstractService implements IPropert
Assert.isNotNull(key);
final AtomicReference<Object> value = new AtomicReference<Object>();
- if (context instanceof IProcessContextNode) {
- final IProcessContextNode node = (IProcessContextNode) context;
+ if (context instanceof IPropertiesContainer) {
+ final IPropertiesContainer node = (IPropertiesContainer) context;
Runnable runnable = new Runnable() {
@Override
@@ -69,8 +69,8 @@ public class PropertiesAccessService extends AbstractService implements IPropert
Assert.isNotNull(key);
final AtomicBoolean result = new AtomicBoolean();
- if (context instanceof IPeerModel) {
- final IProcessContextNode node = (IProcessContextNode) context;
+ if (context instanceof IPropertiesContainer) {
+ final IPropertiesContainer node = (IPropertiesContainer) context;
Runnable runnable = new Runnable() {
@Override
@@ -95,8 +95,8 @@ public class PropertiesAccessService extends AbstractService implements IPropert
Assert.isNotNull(key);
final AtomicBoolean result = new AtomicBoolean();
- if (context instanceof IPeerModel) {
- final IProcessContextNode node = (IProcessContextNode) context;
+ if (context instanceof IPropertiesContainer) {
+ final IPropertiesContainer node = (IPropertiesContainer) context;
Runnable runnable = new Runnable() {
@Override
@@ -120,8 +120,8 @@ public class PropertiesAccessService extends AbstractService implements IPropert
Assert.isNotNull(context);
final AtomicReference<Object> value = new AtomicReference<Object>();
- if (context instanceof IProcessContextNode) {
- final IProcessContextNode node = (IProcessContextNode) context;
+ if (context instanceof IContainerModelNode) {
+ final IContainerModelNode node = (IContainerModelNode) context;
Runnable runnable = new Runnable() {
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
index 377f4b0fc..e51f6ce16 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
@@ -1,40 +1,41 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.tcf.locator; singleton:=true
-Bundle-Version: 1.1.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.tcf.core;bundle-version="1.1.0",
- org.eclipse.tcf.te.core;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.persistence;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.stepper;bundle-version="1.1.0",
- org.eclipse.tcf.te.tcf.core;bundle-version="1.1.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.tcf.locator,
- org.eclipse.tcf.te.tcf.locator.activator;x-internal:=true,
- org.eclipse.tcf.te.tcf.locator.help,
- org.eclipse.tcf.te.tcf.locator.interfaces,
- org.eclipse.tcf.te.tcf.locator.interfaces.nodes,
- org.eclipse.tcf.te.tcf.locator.interfaces.preferences,
- org.eclipse.tcf.te.tcf.locator.interfaces.services,
- org.eclipse.tcf.te.tcf.locator.internal;x-internal:=true,
- org.eclipse.tcf.te.tcf.locator.internal.adapters;x-internal:=true,
- org.eclipse.tcf.te.tcf.locator.internal.nodes;x-internal:=true,
- org.eclipse.tcf.te.tcf.locator.internal.services;x-internal:=true,
- org.eclipse.tcf.te.tcf.locator.iterators,
- org.eclipse.tcf.te.tcf.locator.listener,
- org.eclipse.tcf.te.tcf.locator.model,
- org.eclipse.tcf.te.tcf.locator.nls,
- org.eclipse.tcf.te.tcf.locator.nodes,
- org.eclipse.tcf.te.tcf.locator.persistence,
- org.eclipse.tcf.te.tcf.locator.services,
- org.eclipse.tcf.te.tcf.locator.steps,
- org.eclipse.tcf.te.tcf.locator.utils
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.tcf.locator; singleton:=true
+Bundle-Version: 1.1.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.tcf.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.persistence;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.stepper;bundle-version="1.1.0",
+ org.eclipse.tcf.te.tcf.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.tcf.core.model;bundle-version="1.1.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.tcf.locator,
+ org.eclipse.tcf.te.tcf.locator.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.locator.help,
+ org.eclipse.tcf.te.tcf.locator.interfaces,
+ org.eclipse.tcf.te.tcf.locator.interfaces.nodes,
+ org.eclipse.tcf.te.tcf.locator.interfaces.preferences,
+ org.eclipse.tcf.te.tcf.locator.interfaces.services,
+ org.eclipse.tcf.te.tcf.locator.internal;x-internal:=true,
+ org.eclipse.tcf.te.tcf.locator.internal.adapters;x-internal:=true,
+ org.eclipse.tcf.te.tcf.locator.internal.nodes;x-internal:=true,
+ org.eclipse.tcf.te.tcf.locator.internal.services;x-internal:=true,
+ org.eclipse.tcf.te.tcf.locator.iterators,
+ org.eclipse.tcf.te.tcf.locator.listener,
+ org.eclipse.tcf.te.tcf.locator.model,
+ org.eclipse.tcf.te.tcf.locator.nls,
+ org.eclipse.tcf.te.tcf.locator.nodes,
+ org.eclipse.tcf.te.tcf.locator.persistence,
+ org.eclipse.tcf.te.tcf.locator.services,
+ org.eclipse.tcf.te.tcf.locator.steps,
+ org.eclipse.tcf.te.tcf.locator.utils
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/LocatorModelPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/LocatorModelPropertyTester.java
index 23ce5394f..2ea867dfa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/LocatorModelPropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/LocatorModelPropertyTester.java
@@ -16,6 +16,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator;
@@ -35,27 +36,27 @@ public class LocatorModelPropertyTester extends PropertyTester {
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
*/
@Override
- public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
+ public boolean test(Object receiver, final String property, final Object[] args, final Object expectedValue) {
+ if (receiver instanceof IPeer) {
+ receiver = Platform.getAdapterManager().getAdapter(receiver, IPeerModel.class);
+ }
// The receiver is expected to be a peer model node or a peer
- if (receiver instanceof IPeerModel || receiver instanceof IPeer) {
+ if (receiver instanceof IPeerModel) {
+ final IPeerModel peerModel = (IPeerModel)receiver;
final AtomicBoolean result = new AtomicBoolean();
// If we have to test for local or remote services, we have to handle it special
if ("hasLocalService".equals(property) || "hasRemoteService".equals(property)) { //$NON-NLS-1$ //$NON-NLS-2$
// This tests must happen outside the TCF dispatch thread's
if (!Protocol.isDispatchThread()) {
- result.set(testServices((IPeerModel) receiver, property, args, expectedValue));
+ result.set(testServices(peerModel, property, args, expectedValue));
}
}
else {
Runnable runnable = new Runnable() {
@Override
public void run() {
- if (receiver instanceof IPeerModel) {
- result.set(testPeerModel((IPeerModel) receiver, property, args, expectedValue));
- } else {
- result.set(testPeer((IPeer) receiver, property, args, expectedValue));
- }
+ result.set(testPeerModel(peerModel, property, args, expectedValue));
}
};
@@ -83,54 +84,38 @@ public class LocatorModelPropertyTester extends PropertyTester {
* @return <code>True</code> if the property to test has the expected value, <code>false</code>
* otherwise.
*/
- protected boolean testPeerModel(IPeerModel node, String property, Object[] args, Object expectedValue) {
- Assert.isNotNull(node);
+ protected boolean testPeerModel(IPeerModel peerModel, String property, Object[] args, Object expectedValue) {
+ Assert.isNotNull(peerModel);
Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- return testPeer(node.getPeer(), property, args, expectedValue);
- }
-
- /**
- * Test the specific peer properties.
- *
- * @param node The peer. Must not be <code>null</code>.
- * @param property The property to test.
- * @param args The property arguments.
- * @param expectedValue The expected value.
- *
- * @return <code>True</code> if the property to test has the expected value, <code>false</code>
- * otherwise.
- */
- protected boolean testPeer(IPeer node, String property, Object[] args, Object expectedValue) {
- Assert.isNotNull(node);
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ IPeer peer = peerModel.getPeer();
if ("name".equals(property)) { //$NON-NLS-1$
- if (node.getName() != null && node.getName().equals(expectedValue)) {
+ if (peer.getName() != null && peer.getName().equals(expectedValue)) {
return true;
}
}
if ("nameRegex".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
- if (node.getName() != null && node.getName().matches((String)expectedValue)) {
+ if (peer.getName() != null && peer.getName().matches((String)expectedValue)) {
return true;
}
}
if ("osName".equals(property)) { //$NON-NLS-1$
- if (node.getOSName() != null && node.getOSName().equals(expectedValue)) {
+ if (peer.getOSName() != null && peer.getOSName().equals(expectedValue)) {
return true;
}
}
if ("osNameRegex".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
- if (node.getOSName() != null && node.getOSName().matches((String)expectedValue)) {
+ if (peer.getOSName() != null && peer.getOSName().matches((String)expectedValue)) {
return true;
}
}
if ("isStaticPeer".equals(property)) { //$NON-NLS-1$
- String value = node.getAttributes().get("static.transient"); //$NON-NLS-1$
+ String value = peer.getAttributes().get("static.transient"); //$NON-NLS-1$
boolean isStaticPeer = value != null && Boolean.parseBoolean(value.trim());
if (expectedValue instanceof Boolean) {
return ((Boolean) expectedValue).booleanValue() == isStaticPeer;
@@ -138,21 +123,21 @@ public class LocatorModelPropertyTester extends PropertyTester {
}
if ("isRedirected".equals(property)) { //$NON-NLS-1$
- boolean isRedirected = node instanceof PeerRedirector;
+ boolean isRedirected = peer instanceof PeerRedirector;
if (expectedValue instanceof Boolean) {
return ((Boolean) expectedValue).booleanValue() == isRedirected;
}
}
if ("isProxy".equals(property)) { //$NON-NLS-1$
- boolean isProxy = node.getAttributes().containsKey("Proxy"); //$NON-NLS-1$
+ boolean isProxy = peer.getAttributes().containsKey("Proxy"); //$NON-NLS-1$
if (expectedValue instanceof Boolean) {
return ((Boolean) expectedValue).booleanValue() == isProxy;
}
}
if ("isValueAdd".equals(property)) { //$NON-NLS-1$
- String value = node.getAttributes().get("ValueAdd"); //$NON-NLS-1$
+ String value = peer.getAttributes().get("ValueAdd"); //$NON-NLS-1$
boolean isValueAdd = value != null && ("1".equals(value.trim()) || Boolean.parseBoolean(value.trim())); //$NON-NLS-1$
if (expectedValue instanceof Boolean) {
return ((Boolean) expectedValue).booleanValue() == isValueAdd;
@@ -160,7 +145,7 @@ public class LocatorModelPropertyTester extends PropertyTester {
}
if ("isOfType".equals(property)) { //$NON-NLS-1$
- String value = node.getAttributes().get(IPeerModelProperties.PROP_TYPE);
+ String value = peer.getAttributes().get(IPeerModelProperties.PROP_TYPE);
if (expectedValue instanceof String) {
return value != null ? ((String)expectedValue).equals(value) : ((String)expectedValue).equalsIgnoreCase("null"); //$NON-NLS-1$
}
@@ -168,7 +153,7 @@ public class LocatorModelPropertyTester extends PropertyTester {
if ("hasAttribute".equals(property)) { //$NON-NLS-1$
String name = args != null && args.length > 0 ? (String)args[0] : null;
- boolean hasAttribute = name != null && !"".equals(name) ? node.getAttributes().containsKey(name) : false; //$NON-NLS-1$
+ boolean hasAttribute = name != null && !"".equals(name) ? peer.getAttributes().containsKey(name) : false; //$NON-NLS-1$
if (expectedValue instanceof Boolean) {
return ((Boolean) expectedValue).booleanValue() == hasAttribute;
}
@@ -176,16 +161,22 @@ public class LocatorModelPropertyTester extends PropertyTester {
if ("isAttribute".equals(property)) { //$NON-NLS-1$
String name = args != null && args.length > 0 ? (String)args[0] : null;
- String value = name != null && !"".equals(name) ? node.getAttributes().get(name) : null; //$NON-NLS-1$
+ String value = name != null && !"".equals(name) ? peer.getAttributes().get(name) : null; //$NON-NLS-1$
if (expectedValue != null) {
return expectedValue.toString().equals(value);
}
}
if ("hasOfflineService".equals(property)) { //$NON-NLS-1$
- String services = node.getAttributes().get(IPeerModelProperties.PROP_OFFLINE_SERVICES);
- List<String> list = services != null ? Arrays.asList(services.split(",\\s*")) : Collections.EMPTY_LIST; //$NON-NLS-1$
- return list.contains(expectedValue);
+ String offlineServices = peer.getAttributes().get(IPeerModelProperties.PROP_OFFLINE_SERVICES);
+ String remoteServices = peerModel.getStringProperty(IPeerModelProperties.PROP_REMOTE_SERVICES);
+ List<String> offline = offlineServices != null ? Arrays.asList(offlineServices.split(",\\s*")) : Collections.EMPTY_LIST; //$NON-NLS-1$
+ List<String> remote = remoteServices != null ? Arrays.asList(remoteServices.split(",\\s*")) : null; //$NON-NLS-1$
+ boolean hasOfflineService = (remote == null) ? offline.contains(expectedValue) : remote.contains(expectedValue);
+ if (expectedValue instanceof Boolean) {
+ return ((Boolean) expectedValue).booleanValue() == hasOfflineService;
+ }
+ return hasOfflineService;
}
return false;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/services/PropertiesAccessService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/services/PropertiesAccessService.java
index 31367c2b8..f7020a334 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/services/PropertiesAccessService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/services/PropertiesAccessService.java
@@ -12,21 +12,16 @@ package org.eclipse.tcf.te.tcf.locator.internal.services;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.services.AbstractService;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
/**
* Peer model properties access service implementation.
*/
-public class PropertiesAccessService extends AbstractService implements IPropertiesAccessService {
+public class PropertiesAccessService extends org.eclipse.tcf.te.tcf.core.model.services.PropertiesAccessService {
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#getTargetAddress(java.lang.Object)
@@ -47,7 +42,6 @@ public class PropertiesAccessService extends AbstractService implements IPropert
if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
result.put(IPropertiesAccessServiceConstants.PROP_NAME, value);
}
-
value = attributes.get(IPeer.ATTR_IP_HOST);
if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
result.put(IPropertiesAccessServiceConstants.PROP_ADDRESS, value);
@@ -66,108 +60,4 @@ public class PropertiesAccessService extends AbstractService implements IPropert
return !result.isEmpty() ? Collections.unmodifiableMap(result) : null;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#getProperty(java.lang.Object, java.lang.String)
- */
- @Override
- public Object getProperty(final Object context, final String key) {
- Assert.isNotNull(context);
- Assert.isNotNull(key);
-
- final AtomicReference<Object> value = new AtomicReference<Object>();
- if (context instanceof IPeerModel) {
- final IPeerModel peerModel = (IPeerModel) context;
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- Object val = peerModel.getProperty(key);
- value.set(val);
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
- }
-
- return value.get();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#setProperty(java.lang.Object, java.lang.String, java.lang.Object)
- */
- @Override
- public boolean setProperty(final Object context, final String key, final Object value) {
- Assert.isNotNull(context);
- Assert.isNotNull(key);
-
- final AtomicBoolean result = new AtomicBoolean();
- if (context instanceof IPeerModel) {
- final IPeerModel peerModel = (IPeerModel) context;
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- result.set(peerModel.setProperty(key, value));
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
- }
-
- return result.get();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#isProperty(java.lang.Object, java.lang.String, java.lang.Object)
- */
- @Override
- public boolean isProperty(final Object context, final String key, final Object value) {
- Assert.isNotNull(context);
- Assert.isNotNull(key);
-
- final AtomicBoolean result = new AtomicBoolean();
- if (context instanceof IPeerModel) {
- final IPeerModel peerModel = (IPeerModel) context;
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- result.set(peerModel.isProperty(key, value));
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
- }
-
- return result.get();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#getParent(java.lang.Object)
- */
- @Override
- public Object getParent(final Object context) {
- Assert.isNotNull(context);
-
- final AtomicReference<Object> value = new AtomicReference<Object>();
- if (context instanceof IPeerModel) {
- final IPeerModel peerModel = (IPeerModel) context;
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- value.set(peerModel.getParent());
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
- }
-
- return value.get();
- }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
index acd2d1892..6c11319ed 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
@@ -30,7 +30,6 @@ Export-Package: org.eclipse.tcf.te.tcf.processes.core.activator;x-internal:=true
org.eclipse.tcf.te.tcf.processes.core.model.interfaces,
org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime,
org.eclipse.tcf.te.tcf.processes.core.model.internal.factory;x-internal:=true,
- org.eclipse.tcf.te.tcf.processes.core.model.internal.services;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.core.model.nodes,
org.eclipse.tcf.te.tcf.processes.core.model.properties,
org.eclipse.tcf.te.tcf.processes.core.model.runtime,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
index 437f7d1b0..d7914f7bd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
@@ -14,13 +14,16 @@
<!-- Service contributions -->
<extension point="org.eclipse.tcf.te.runtime.services.services">
<service
- class="org.eclipse.tcf.te.tcf.processes.core.model.internal.services.PropertiesAccessService"
+ class="org.eclipse.tcf.te.tcf.core.model.services.PropertiesAccessService"
id="org.eclipse.tcf.te.tcf.processes.services.tcf.propertiesAccess">
<serviceType
bundleId="org.eclipse.tcf.te.runtime.services"
class="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/>
<enablement>
- <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ <or>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.runtime.RuntimeModel"/>
+ </or>
</enablement>
</service>
</extension>

Back to the top