Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2013-09-13 17:48:55 -0400
committerslewis2013-09-13 17:48:55 -0400
commitd8d23d32d4352843172bd414d9f6bdc9e0fa84b8 (patch)
tree8d9ca5e3ad5cee3e841d509408defe0af57a1fe6
parentc3e3bf1c4877246410f6223c499538d0600e2beb (diff)
downloadorg.eclipse.ecf-d8d23d32d4352843172bd414d9f6bdc9e0fa84b8.tar.gz
org.eclipse.ecf-d8d23d32d4352843172bd414d9f6bdc9e0fa84b8.tar.xz
org.eclipse.ecf-d8d23d32d4352843172bd414d9f6bdc9e0fa84b8.zip
Improvement for https://bugs.eclipse.org/bugs/show_bug.cgi?id=259387
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientComponent.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/model/SharedModel.java29
2 files changed, 30 insertions, 1 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientComponent.java b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientComponent.java
index fe3cb2028..be9b44b67 100644
--- a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientComponent.java
+++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientComponent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2010 Composent, Inc. and others. All rights reserved. This
+ Copyright (c) 2010 Composent, 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
diff --git a/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/model/SharedModel.java b/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/model/SharedModel.java
index cea7a4022..ce39b7ae8 100644
--- a/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/model/SharedModel.java
+++ b/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/model/SharedModel.java
@@ -67,6 +67,15 @@ public class SharedModel extends OptimisticSharedObject {
private Map<String, Property> properties = new HashMap<String, Property>();
+ protected Collection<Property> copyProperties() {
+ List<Property> results = new ArrayList<Property>();
+ synchronized (properties) {
+ for (String name : properties.keySet())
+ results.add(properties.get(name));
+ }
+ return results;
+ }
+
protected Property addProperty(String name) {
return addProperty(name, null);
}
@@ -143,11 +152,31 @@ public class SharedModel extends OptimisticSharedObject {
Property p = getProperty(key);
if (p != null)
result.put(key, p.getValue());
+ else
+ result.put(key, null);
}
}
return result;
}
+ protected void setPropertiesFromMap(Map<String, ?> map) {
+ if (map == null)
+ return;
+ synchronized (properties) {
+ for (String key : map.keySet()) {
+ Property p = getProperty(key);
+ // If the property already exists, change/set it's value
+ Object val = map.get(key);
+ if (p != null) {
+ p.setValue(val);
+ } else {
+ // add property
+ addProperty(key, val);
+ }
+ }
+ }
+ }
+
protected final String SEND_PROPERTY_TO_MSG = ".sendPropertyTo."; //$NON-NLS-1$
public class Property implements Serializable {

Back to the top