Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 174358 - [api] need to support dynamic attribute factory construction
Summary: [api] need to support dynamic attribute factory construction
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Shawn Minto CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 171722
  Show dependency tree
 
Reported: 2007-02-15 14:24 EST by Shawn Minto CLA
Modified: 2007-02-20 20:48 EST (History)
2 users (show)

See Also:


Attachments
patch (7.28 KB, patch)
2007-02-15 14:24 EST, Shawn Minto CLA
no flags Details | Diff
Dynamic Attribute Factory Creation (65.62 KB, patch)
2007-02-20 12:22 EST, Shawn Minto CLA
no flags Details | Diff
mylar/context/zip (34.62 KB, application/octet-stream)
2007-02-20 12:25 EST, Shawn Minto CLA
no flags Details
getAttributeFactory Patch (62.54 KB, patch)
2007-02-20 19:01 EST, Shawn Minto CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shawn Minto CLA 2007-02-15 14:24:12 EST
I need support for the attribute factory to be dynamically created based on the RepositoryTaskData since the attributes and their mappings could be specific to an installation of a repository (such as different attributes for different versions).
Comment 1 Shawn Minto CLA 2007-02-15 14:24:44 EST
Created attachment 59085 [details]
patch
Comment 2 Mik Kersten CLA 2007-02-15 15:47:39 EST
Rob: please review after 2.0M1 goes out (tomorrow).
Comment 3 Shawn Minto CLA 2007-02-15 16:15:10 EST
Comment on attachment 59085 [details]
patch

It turns out that the simple solution provided does not entirely fix this problem since the ITaskDataHandler has the method getDateForAttributeType which is dependent on the attributes.  Maybe these methods should be moved to within the RepositoryTaskData or should both take the RepositoryTaskData so that they can provide the best result.
Comment 4 Shawn Minto CLA 2007-02-20 12:22:56 EST
Created attachment 59392 [details]
Dynamic Attribute Factory Creation

I have created a new patch for this issue.  Now, to get the AbstractAttributeFactory, you must pass in the repository url, repository kind, and artifact type.  There is a DEFAULT_ARTIFACT_TYPE that is used when there are no differences between artifact types.  Also, I have moved the getDateForAttributeType method to the AbstractAttributeFactory since each of the artifact types may have different date representations.

Could you please apply this patch soon as it can quickly become obsolete since it affects a large number of projects
Comment 5 Shawn Minto CLA 2007-02-20 12:25:15 EST
Created attachment 59394 [details]
mylar/context/zip
Comment 6 Steffen Pingel CLA 2007-02-20 12:46:22 EST
Does the factory really need to be task specific? Wouldn't it suffice to have one per repository?
Comment 7 Shawn Minto CLA 2007-02-20 13:07:29 EST
The connector that I am working on has many different artifact types per repository. By allowing multiple artifact types mylar will be able to better support more different systems for contributing tasks to mylar.
Comment 8 Robert Elves CLA 2007-02-20 16:18:29 EST
Looking good, just a couple thoughts...  You need to differentiate taskData on what we call task 'kind' (see Task.java's getKind, setKind). So method/parameter names need to reflect this i.e. taskData.getArtifactType() should be .getTaskKind(). So that said I guess the 'default' kind is Task.REPOSITORY_KIND_LOCAL but each connector should be setting their's to some logical value (i.e. Bugizlla's is 'Bug' now). 
Comment 9 Steffen Pingel CLA 2007-02-20 16:36:20 EST
I have no objects against the patch but we there has been some discussion about refactoring the AttributeFactory API (bug 150680) in order to separate the presentation from the data model.

I think the attribute factory should only provide a mapping from Mylar attribute keys to repository attribute keys. The actual attributes should be constructed by connectors when the task data is initialized (and not through the factory).
Comment 10 Shawn Minto CLA 2007-02-20 19:01:53 EST
Created attachment 59434 [details]
getAttributeFactory Patch

Here is the new patch.  I updated the name to be taskKind
Comment 11 Robert Elves CLA 2007-02-20 20:23:06 EST
Patch applied and ip log updated.  I'll update the porting guide. 
 
 (In reply to comment #9)
> I have no objects against the patch but we there has been some discussion about
> refactoring the AttributeFactory API (bug 150680) in order to separate the
> presentation from the data model.
For a number of reasons this patch highlighted the need to re-architect this completely. TaskData holding onto options and the factory must be stopped.
Comment 12 Robert Elves CLA 2007-02-20 20:40:57 EST
A couple classes didn't get committed on last attempt (weren't in change set). They are now committed.

Further to your comment Steffen, lets schedule this refactoring for after EclipseCon since it is (more-or-less) implementation detail and is going to require -major- changes. 
Comment 13 Steffen Pingel CLA 2007-02-20 20:48:31 EST
Yes, that will give us a chance to do some more brainstorming about this at EclipseCon :).