Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 193856 Details for
Bug 343570
[region] Need a way to access the hooks associated with a digraph
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
343570.txt (text/plain), 8.60 KB, created by
Thomas Watson
on 2011-04-21 12:11:33 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Thomas Watson
Created:
2011-04-21 12:11:33 EDT
Size:
8.60 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.region >Index: src/org/eclipse/equinox/internal/region/RegionManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/RegionManager.java,v >retrieving revision 1.1 >diff -u -r1.1 RegionManager.java >--- src/org/eclipse/equinox/internal/region/RegionManager.java 19 Apr 2011 16:20:33 -0000 1.1 >+++ src/org/eclipse/equinox/internal/region/RegionManager.java 21 Apr 2011 16:11:01 -0000 >@@ -11,16 +11,12 @@ > > package org.eclipse.equinox.internal.region; > >-import org.eclipse.equinox.internal.region.management.StandardManageableRegionDigraph; >- >-import org.eclipse.equinox.internal.region.hook.*; >- >-import org.eclipse.equinox.region.Region; >-import org.eclipse.equinox.region.RegionDigraph; >- > import java.io.*; > import java.util.ArrayList; > import java.util.Collection; >+import org.eclipse.equinox.internal.region.management.StandardManageableRegionDigraph; >+import org.eclipse.equinox.region.Region; >+import org.eclipse.equinox.region.RegionDigraph; > import org.osgi.framework.*; > import org.osgi.framework.hooks.bundle.EventHook; > import org.osgi.framework.hooks.bundle.FindHook; >@@ -121,15 +117,13 @@ > } > > private void registerRegionHooks(RegionDigraph regionDigraph) { >- registerResolverHookFactory(new RegionResolverHookFactory(regionDigraph)); >+ registerResolverHookFactory(regionDigraph.getResolverHookFactory()); >+ >+ registerBundleFindHook(regionDigraph.getBundleFindHook()); >+ registerBundleEventHook(regionDigraph.getBundleEventHook()); > >- RegionBundleFindHook bundleFindHook = new RegionBundleFindHook(regionDigraph, bundleContext.getBundle().getBundleId()); >- registerBundleFindHook(bundleFindHook); >- registerBundleEventHook(new RegionBundleEventHook(regionDigraph, bundleFindHook, this.threadLocal)); >- >- RegionServiceFindHook serviceFindHook = new RegionServiceFindHook(regionDigraph); >- registerServiceFindHook(serviceFindHook); >- registerServiceEventHook(new RegionServiceEventHook(serviceFindHook)); >+ registerServiceFindHook(regionDigraph.getServiceFindHook()); >+ registerServiceEventHook(regionDigraph.getServiceEventHook()); > } > > private void registerRegionDigraph(RegionDigraph regionDigraph) { >Index: src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java,v >retrieving revision 1.2 >diff -u -r1.2 StandardRegionDigraph.java >--- src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java 20 Apr 2011 14:39:15 -0000 1.2 >+++ src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java 21 Apr 2011 16:11:01 -0000 >@@ -12,8 +12,12 @@ > package org.eclipse.equinox.internal.region; > > import java.util.*; >+import org.eclipse.equinox.internal.region.hook.*; > import org.eclipse.equinox.region.*; > import org.osgi.framework.*; >+import org.osgi.framework.hooks.bundle.EventHook; >+import org.osgi.framework.hooks.bundle.FindHook; >+import org.osgi.framework.hooks.resolver.ResolverHookFactory; > > /** > * {@link StandardRegionDigraph} is the default implementation of {@link RegionDigraph}. >@@ -45,6 +49,13 @@ > > private final SubgraphTraverser subgraphTraverser; > >+ private final org.osgi.framework.hooks.bundle.EventHook bundleEventHook; >+ private final org.osgi.framework.hooks.bundle.FindHook bundleFindHook; >+ @SuppressWarnings("deprecation") >+ private final org.osgi.framework.hooks.service.EventHook serviceEventHook; >+ private final org.osgi.framework.hooks.service.FindHook serviceFindHook; >+ private final ResolverHookFactory resolverHookFactory; >+ > StandardRegionDigraph() { > this(null, null); > } >@@ -53,6 +64,15 @@ > this.subgraphTraverser = new SubgraphTraverser(); > this.bundleContext = bundleContext; > this.threadLocal = threadLocal; >+ >+ // Note we are safely escaping this only because we know the hook impls >+ // do not escape the digraph to other threads on construction. >+ this.resolverHookFactory = new RegionResolverHookFactory(this); >+ this.bundleFindHook = new RegionBundleFindHook(this, bundleContext == null ? 0 : bundleContext.getBundle().getBundleId()); >+ this.bundleEventHook = new RegionBundleEventHook(this, this.bundleFindHook, this.threadLocal); >+ >+ this.serviceFindHook = new RegionServiceFindHook(this); >+ this.serviceEventHook = new RegionServiceEventHook(serviceFindHook); > } > > /** >@@ -368,4 +388,30 @@ > } > } > >+ @Override >+ public ResolverHookFactory getResolverHookFactory() { >+ return resolverHookFactory; >+ } >+ >+ @Override >+ public EventHook getBundleEventHook() { >+ return bundleEventHook; >+ } >+ >+ @Override >+ public FindHook getBundleFindHook() { >+ return bundleFindHook; >+ } >+ >+ @SuppressWarnings("deprecation") >+ @Override >+ public org.osgi.framework.hooks.service.EventHook getServiceEventHook() { >+ return serviceEventHook; >+ } >+ >+ @Override >+ public org.osgi.framework.hooks.service.FindHook getServiceFindHook() { >+ return serviceFindHook; >+ } >+ > } >Index: src/org/eclipse/equinox/region/RegionDigraph.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/region/RegionDigraph.java,v >retrieving revision 1.1 >diff -u -r1.1 RegionDigraph.java >--- src/org/eclipse/equinox/region/RegionDigraph.java 19 Apr 2011 16:20:33 -0000 1.1 >+++ src/org/eclipse/equinox/region/RegionDigraph.java 21 Apr 2011 16:11:01 -0000 >@@ -12,9 +12,9 @@ > package org.eclipse.equinox.region; > > import java.util.Set; >- > import org.osgi.framework.Bundle; > import org.osgi.framework.BundleException; >+import org.osgi.framework.hooks.resolver.ResolverHookFactory; > > /** > * {@link RegionDigraph} is a <a href="http://en.wikipedia.org/wiki/Directed_graph">directed graph</a>, or >@@ -180,4 +180,36 @@ > * @throws BundleException if the digraph could not be replaced > */ > void replace(RegionDigraph digraph) throws BundleException; >+ >+ /** >+ * Gets the resolver hook factory associated with this digraph. >+ * @return the resolver hook factory >+ */ >+ ResolverHookFactory getResolverHookFactory(); >+ >+ /** >+ * Gets the bundle event hook associated with this digraph. >+ * @return the bundle event hook >+ */ >+ org.osgi.framework.hooks.bundle.EventHook getBundleEventHook(); >+ >+ /** >+ * Gets the bundle find hook associated with this digraph. >+ * @return the bundle find hook >+ */ >+ org.osgi.framework.hooks.bundle.FindHook getBundleFindHook(); >+ >+ /** >+ * Gets the service event hook associated with this digraph. >+ * @return the service event hook >+ */ >+ @SuppressWarnings("deprecation") >+ org.osgi.framework.hooks.service.EventHook getServiceEventHook(); >+ >+ /** >+ * Gets the service find hook associated with this digraph. >+ * @return the service find hook >+ */ >+ org.osgi.framework.hooks.service.FindHook getServiceFindHook(); >+ > } >#P org.eclipse.equinox.region.tests >Index: src/org/eclipse/equinox/internal/region/StandardRegionDigraphTests.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/internal/region/StandardRegionDigraphTests.java,v >retrieving revision 1.1 >diff -u -r1.1 StandardRegionDigraphTests.java >--- src/org/eclipse/equinox/internal/region/StandardRegionDigraphTests.java 19 Apr 2011 16:20:32 -0000 1.1 >+++ src/org/eclipse/equinox/internal/region/StandardRegionDigraphTests.java 21 Apr 2011 16:11:02 -0000 >@@ -230,4 +230,24 @@ > testDigraph.replace(testCopy); > StandardRegionDigraphPeristenceTests.assertEquals(testDigraph, testCopy); > } >+ >+ @Test >+ public void testGetHooks() throws InvalidSyntaxException, BundleException { >+ setDefaultFilters(); >+ replayMocks(); >+ >+ assertNotNull("Resolver Hook is null", digraph.getResolverHookFactory()); >+ assertNotNull("Bundle Event Hook is null", digraph.getBundleEventHook()); >+ assertNotNull("Bundle Find Hook is null", digraph.getBundleFindHook()); >+ assertNotNull("Servie Event Hook is null", digraph.getServiceEventHook()); >+ assertNotNull("Service Find Hook is null", digraph.getServiceFindHook()); >+ >+ RegionDigraph copy = digraph.copy(); >+ assertNotNull("Resolver Hook is null", copy.getResolverHookFactory()); >+ assertNotNull("Bundle Event Hook is null", copy.getBundleEventHook()); >+ assertNotNull("Bundle Find Hook is null", copy.getBundleFindHook()); >+ assertNotNull("Servie Event Hook is null", copy.getServiceEventHook()); >+ assertNotNull("Service Find Hook is null", copy.getServiceFindHook()); >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 343570
: 193856