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

Bug 247275

Summary: [plan] Rework IGridElementCreator and the corresponding extension point
Product: z_Archived Reporter: Mathias Stümpert <mathias.stuempert>
Component: GeclipseAssignee: Mathias Stümpert <mathias.stuempert>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aog-ecl, mael, pawelw
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Mathias Stümpert CLA 2008-09-15 07:35:56 EDT
The IGridElementCreator interface and the eu.geclipse.core.gridElementCreator extension point should be reworked in order to move the canCreate functionality from the interface to the extension point. The corresponding work will be tracked in this bug item.
Comment 1 Mathias Stümpert CLA 2008-09-15 07:48:53 EDT
The IGridElementCreator interface defined two methods that should be removed:

1) public boolean canCreate( final Class< ? extends IGridElement > elementType );
This method is used to determine if the specific element creator can create elements of the specified type.

2) public boolean canCreate( final Object fromObject );
This method is used to determine if the specific element creator can create new grid model elements from the specified object.

Some months ago the eu.geclipse.core.gridElementCreator extension point was already extended by a mechanism that nearly completely replaces the above functionalities. In the following I give a short description of this extension.

The "creator" element of the extension point has now a sequence as child element. This sequence has to contain at least one "source" element and exactly one "target" element. The "source" element replaces above mentioned method 2 whereas the "target" element replaces method 1.

The target element simply specifies a type that has to extend IGridElement and that corresponds to the type of elements the corresponding creator can create. If am IGridElementCreator implementation can create elements of more than one type then also more than one extensions of the extension point have to exist, one for each target type.

The source element contains a source class which inherits from java.lang.Object. Furthermore it contains a string that may be matched against the toString() method of the source object. For instance this can be used to match file extensions against the filename. A JSDL creator could therefore check the object against IFile and the pattern could be defined as "*.jsdl".

The definition is nearly complete. Nevertheless the original implementation is completely free in selecting the source objects. The extension point is limited to the type of the source and the toString()-method matching. In order to overcome this problem a new field will be defined that let the implementer define an optional class that takes over the matching similar to the original mechanism. This is the first step towards the aim of this plan item.
Comment 2 Mathias Stümpert CLA 2008-09-15 08:02:59 EDT
Just committed a change to the core that

1) defines eu.geclipse.core.model.ICreatorSourceMatcher
2) Includes this matcher as optional and last step in matching a source object in the eu.geclipse.core.gridElementCreator extension point

Next step is to change all extensions of the extension point to make use of the new mechanism instead of relying on the IGridElementCreator#canCreate() methods.
Comment 3 Mathias Stümpert CLA 2008-09-15 11:48:35 EDT
Some more commits:

1) eu.geclipse.core.internal.model.CreatorElementRegistry acts as a cached registry for element creators. Supports lazy loading and hot-plugging of plug-ins.
2) VoManager#loadElements uses now the registry to load the VOs from their extensions.
3) Some minor changes for the various VO creators that were necessary but should not break anything.

I started with the VO creators since this is a central point in our model. If the new methods are working for them they should also work for other elements ;-)
Comment 4 Mathias Stümpert CLA 2008-09-15 12:16:45 EDT
Removed unnecessary implementations of IStorableElementCreator, no more dependencies left over. If this turns out to cause no problems I will remove the interface itself soon.
Comment 5 Mathias Stümpert CLA 2008-09-16 07:59:59 EDT
The IGridElementCreator was reworked. The canCreate methods are now deprecated. In order to nevertheless be able to pass the source object to the creator new methods setSource and getSource were defined. Modifications to the AbstractGridElementCreator and the VO creators were necessary.
Comment 6 Mathias Stümpert CLA 2008-09-17 07:23:39 EDT
Just to keep this bug up to date...

The non-critical methods for querying the element creators were shifted from the GridModel and Extensions classes to the ElementCreatorRegistry which is available from GridModel.getCreatorRegistry(). Furthermore the concept of standard creators has been reworked and the GridProjectCreator's functionality was added to LocalResourceCreator.
Comment 7 Mathias Stümpert CLA 2008-09-18 05:38:27 EDT
The model tree creation was change to make use of the extension point information rather than to use the IGridElementCreator#canCreate methods. This is a critical change since its proper funtionality requires all element creator extensions to be well defined.
Comment 8 Mathias Stümpert CLA 2008-09-18 09:07:50 EDT
The last methods for querying element creators with their canCreate methods were removed. Next and last step is to remove the methods itself and to cleanup the IGridElementCreator interface and its implementations.
Comment 9 Mathias Stümpert CLA 2008-09-19 08:33:40 EDT
The canCreate methods in IGridElementCreator are history. The whole framework makes now use of the extension point information for source objects and target element. All creators are adapted to these changes. So I mark this one as fixed but leave it open until it is clear that these changes to not mess up everything :)
Comment 10 Mathias Stümpert CLA 2008-09-29 05:14:42 EDT
No new issues arised due to the changes, so closing this bug.