Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347028

Summary: [region] Add an isAllowed method to RegionFilter that checks if a generic namespace/attributes are allowed
Product: [Eclipse Project] Equinox Reporter: Thomas Watson <tjwatson>
Component: ComponentsAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington, jwross
Version: 3.7   
Target Milestone: Juno M6   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
patch and small test
none
updated patch glyn.normington: review+

Description Thomas Watson CLA 2011-05-24 13:58:15 EDT
I will admit up front that this idea is not completely thought out, but I wanted to record an enhancement bug so I would not loose the work I have done so far on this.

Right now the RegionDigraph has a concept of a RegionDigraphVisitor which is great and allows for one to traverse the graph along the connection edges.  But in order to traverse the edges properly the visitor must have access to real objects that can be shared across the connection (i.e. Bundle, BundleCapability, BundleRevision, ServiceReference).  This is required because the RegionFilter method only has isAllowed methods that take these types and to follow a connection correctly you need to make sure the RegionFilter allows the thing you are trying to share.

But some scenarios exist where you want to traverse the graph but you don't have access to the real objects.  My idea is to add the following method to RegionFilter:

/**
 * Determines whether this filter allows the given name space with the given
 * attributes.
 * @param namespace the name space
 * @param attributes the attributes to check if they are allowed
 * @return <code>true</code> if the name space and attributes are allowed and 
 * <code>false</code> otherwise
 */
public boolean isAllowed(String namespace, Map<String, ?> attributes);

This would allow a visitor to traverse the graph for a specific name space and a map of attributes to match again.  This may be useful for things like subsystems where you want to determine if there are connections that allow visibility to specific things.  For example, does a Region have connections to other regions that would allow a specific bundle-symbolic-name and version threw?
Comment 1 Thomas Watson CLA 2011-05-24 13:59:56 EDT
Created attachment 196471 [details]
patch and small test

Here is the patch.  Again I am not sure this is a great idea.  Just do not want to loose my work.
Comment 2 Thomas Watson CLA 2012-02-21 16:07:27 EST
Created attachment 211368 [details]
updated patch

Here is an updated git patch.  It is pretty much the same as the original except I fixed up the testcase.

Glyn, I think we need to do something like this for subsystems.  We need the ability to traverse the digraph connection based on simple namespace and attributes in order to verify some existing or future capability would be visible to a given region based on the connections.  Could you have a closer look at the proposed API and provide feedback?
Comment 3 Glyn Normington CLA 2012-02-27 09:05:47 EST
Comment on attachment 211368 [details]
updated patch

The new API seems reasonable but I'd prefer it to summarise what is meant by a namespace.
Comment 4 Thomas Watson CLA 2012-02-27 11:02:29 EST
(In reply to comment #3)
> Comment on attachment 211368 [details]
> updated patch
> 
> The new API seems reasonable but I'd prefer it to summarise what is meant by a
> namespace.

I updated the javadoc in an attempt to clarify namespace:

http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/commit/?id=1f744506dfe032383827e8a14775106e188a2d1f
Comment 5 Thomas Watson CLA 2012-02-27 11:36:32 EST
I added another clarification to define name space in commit:

http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/commit/?id=7dcad19d3d9008f024ed6c247b67675ca56f3c7c
Comment 6 Glyn Normington CLA 2012-02-27 11:41:29 EST
Thanks Tom. That will job my memory and help newcomers.
Comment 7 Glyn Normington CLA 2012-02-27 11:41:44 EST
s /job/jog/