Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2019-07-24 17:53:28 -0400
committerThomas Watson2019-07-24 17:53:28 -0400
commitf0c079c8739042aa147df884e8474cc6c056ef35 (patch)
treefcfc951b3c016f948dca242bc20255d32fa4b37b
parentcd64087a195b97ef7ca3262e7e63d8f49d2daab0 (diff)
downloadrt.equinox.bundles-f0c079c8739042aa147df884e8474cc6c056ef35.tar.gz
rt.equinox.bundles-f0c079c8739042aa147df884e8474cc6c056ef35.tar.xz
rt.equinox.bundles-f0c079c8739042aa147df884e8474cc6c056ef35.zip
Change-Id: I06e7f89dd8c4c927afb14755e486c06df170cf2a Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraphPersistence.java11
-rw-r--r--bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilterBuilder.java25
2 files changed, 20 insertions, 16 deletions
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraphPersistence.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraphPersistence.java
index c26ecda0..79447a21 100644
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraphPersistence.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraphPersistence.java
@@ -159,7 +159,7 @@ public final class StandardRegionDigraphPersistence implements RegionDigraphPers
if (head == null)
throw new IOException("Could not find head region: " + headName); //$NON-NLS-1$
// read the sharing policy
- RegionFilterBuilder builder = digraph.createRegionFilterBuilder();
+ Map<String, Collection<Filter>> filters = new HashMap<>();
// read the number of name spaces
int numSpaces = in.readInt();
// read each name space policy
@@ -170,10 +170,15 @@ public final class StandardRegionDigraphPersistence implements RegionDigraphPers
int numFilters = in.readInt();
for (int j = 0; j < numFilters; j++) {
String filter = in.readUTF();
- builder.allow(namespace, filter);
+ Collection<Filter> namespaceFilters = filters.get(namespace);
+ if (namespaceFilters == null) {
+ namespaceFilters = new ArrayList<>(numFilters);
+ filters.put(namespace, namespaceFilters);
+ }
+ namespaceFilters.add(FrameworkUtil.createFilter(filter));
}
}
- digraph.connect(tail, builder.build(), head);
+ digraph.connect(tail, new StandardRegionFilter(filters), head);
}
/**
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilterBuilder.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilterBuilder.java
index befd8149..b6cf224f 100644
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilterBuilder.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilterBuilder.java
@@ -36,13 +36,7 @@ public final class StandardRegionFilterBuilder implements RegionFilterBuilder {
if (filter == null)
throw new IllegalArgumentException("The filter must not be null."); //$NON-NLS-1$
synchronized (this.monitor) {
- Collection<Filter> namespaceFilters = policy.get(namespace);
- if (namespaceFilters == null) {
- // use set to avoid duplicates
- namespaceFilters = new LinkedHashSet<Filter>();
- policy.put(namespace, namespaceFilters);
- }
-
+ Collection<Filter> namespaceFilters = getNamespaceFilters(namespace);
namespaceFilters.add(createFilter(filter));
}
if (VISIBLE_SERVICE_NAMESPACE.equals(namespace)) {
@@ -64,12 +58,7 @@ public final class StandardRegionFilterBuilder implements RegionFilterBuilder {
if (namespace == null)
throw new IllegalArgumentException("The namespace must not be null."); //$NON-NLS-1$
synchronized (this.monitor) {
- Collection<Filter> namespaceFilters = policy.get(namespace);
- if (namespaceFilters == null) {
- // use set to avoid duplicates
- namespaceFilters = new LinkedHashSet<Filter>();
- policy.put(namespace, namespaceFilters);
- }
+ Collection<Filter> namespaceFilters = getNamespaceFilters(namespace);
// remove any other filters since this will override them all.
namespaceFilters.clear();
namespaceFilters.add(StandardRegionFilter.ALL);
@@ -81,6 +70,16 @@ public final class StandardRegionFilterBuilder implements RegionFilterBuilder {
return this;
}
+ private Collection<Filter> getNamespaceFilters(String namespace) {
+ Collection<Filter> namespaceFilters = policy.get(namespace);
+ if (namespaceFilters == null) {
+ // use set to avoid duplicates
+ namespaceFilters = new LinkedHashSet<Filter>();
+ policy.put(namespace, namespaceFilters);
+ }
+ return namespaceFilters;
+ }
+
@Override
public RegionFilter build() {
synchronized (this.monitor) {

Back to the top