Community
Participate
Working Groups
The repository template mechanism (currently used only by WebRepositorySettingsPage) should be used by bugzilla too to provide tempates for bugs.eclispe.org and bugzilla.mozilla.org. The best way of doing this might be via an extension point so that additional plug-ins and connectors can define their own templates.
Rob, we'll need to do this before 0.6.1 goes out because the new drop-down on the settings page is a bit confusing.
Mik, why don't you precreate those repositories instead of adding templates?
I was wondering that too ;) Let's pre-create bugs.eclipse.org since that makes sense, especially now that we can report Mylar and Platform errors from the Error Log view. The bugzilla.mozilla.org repository can be a template because I still think that templates are a good idea because it's OK to have a dozen of them, but confusing to have a dozen potentially irrelevant pre-created repositories. Rob: we need this for today's dev build because the current UI is too wierd.
Sure thing. I'll get on it as soon as I'm synched up here.
I think it is a bit odd that the template combo is shown when editing an existing repository. There should also be a way to hide the combo in case a connector (e.g. Jira) does not support templates.
(In reply to comment #5) > I think it is a bit odd that the template combo is shown when editing an > existing repository. There should also be a way to hide the combo in case a > connector (e.g. Jira) does not support templates. Original idea was to use that dropdown for saving label's history that could be done in a super class (I think there is a todo for that).
Created attachment 46325 [details] mylar/context/zip in progress
Created attachment 46329 [details] mylar/context/zip Progress on "templates" extension point
I'll complete this tomorrow morning. Need to add additional fields to extension point for web templates (query url & regexp). Other than that it is all working well.
Committed: Trac, Bugzilla, and Web templates migrated to extension points (org.eclipse.mylar.tasks.ui.templates). The addAutomatically field is used to designate repositories to pre-load. Currently this has no effect as this functionality is not yet implemented.
Created attachment 46476 [details] mylar/context/zip repository template extention points
Should you use generic attributes instead of hardcoding repository-specific stuff? For example: <repository> <attribute name="label" value="Subclipse (IssueZilla)"/> <attribute name="newTaskUrl" value="http://subclipse.tigris.org/issues/enter_bug.cgi?component=subclipse"/> <attribute name="repositoryKind" value="web"/> <attribute name="repositoryUrl" value="http://subclipse.tigris.org/issues/"/> <attribute name="taskPrefixUrl" value="http://subclipse.tigris.org/issues/show_bug.cgi?id="/> <attribute name="taskQueryUrl" value="http://subclipse.tigris.org/issues/buglist.cgi?issue_status=NEW&issue_status=STARTED&issue_status=REOPENED&order=Issue+Number"/> <attribute name="taskRegexp" value="<a href=\"show_bug.cgi\\?id\\=(.+?)\">.+?<span class=\"summary\">(.+?)</span>"/> </repository> Also, it seem like a common pattern to lookup template by label/name, so that for loop should be moved into getTemplate(name) method in the abstract connector class.
Good suggestions. Other than label, repositoryKind, repositoryUrl, and addAutomatically perhaps some generic handling of attributes would be best. This would help resolve the problem of auto constructing the repository with connector specific attributes - we can just pass along those defined in the template ( I notice you are persisting a few for web task repositories). Perhaps we should move createTaskRepository() from the wizard page to the connector as well. I'll pull out template lookup as you suggest as well. Thanks.
(In reply to comment #13) > Perhaps we should move createTaskRepository() from the wizard page to the > connector as well. Reason that was made in a wizard is to use params from the UI to create new repository instance. BTW, are you going to fix issue with persisting custom attributes when editing repository settings after creation? It used to delegate to createTaskRepository(), but not anymore.
Just found the report (bug#150381) and will resolve it asap.
Hmm. After recent changes I don't see any templates even on web repository provider.
Any chance that your workspace didn't fully sync? I just bootstrapped and have templates.
Iit seems I had something really weird in launch configuration. For some reason it was saying that one of the Mylar plugins is out of sync and has build error, while Package Explorer didn't how any. It disappeared after I restarted Eclipse from which I bootstrap Mylar. Sorry for the false alarm.
Created attachment 46589 [details] fixed web templates This patch is fixing templates screwed when converted from java escaping to xml escaping. Test case is included. This test actually should be moved somewhere else, since it is quite generic and can iterate trough all available connectors. Though as a drawback it is now require to use plugin test, which is slover then plain junit test. Patch also fixes ordering, so templates would appear in the same order as declared in plugin.xml
Thanks Eugene. Patch applied.
(In reply to comment #20) > Thanks Eugene. Patch applied. What about my comment on moving this test somewhere else and run it against all templates?
I'm currently looking into this and making the change you suggested regarding template lookup.
Templates are now retrieved by label from the connector. TODO: - Investigate extraction of template tests as per comment#19 - Look into using generic attributes as per comment#12 - Once we can define generic attributes in extension point enable auto creation of repositories passing these generic attributes on to repository
(In reply to comment #23) > Templates are now retrieved by label from the connector. Hmm. I thought that I've included AbstractRepositoryConnector into last patch, but it doesn't seem so. Can you please change type of the templates field in this class to LinkedHashSet? That would allow to preserve the same iteration order trough templates as it is declared in plugin.xml
Done.
Where is this task at?
Comment#23 summarizes some outstanding issues. Templates work but auto creation of repositories is not implemented. Perhaps a new bug report is in order?
Yes, make the auto-addition a new task. To resolve this task make the web access stuff a part of repository as below since it is common to every repository we currently support, but note that many of the attributes are optional. Note that we could put that into an optional <webAccess .../> element but that seems like overkill. Then implement the custom attributes as Eugene has suggested and we should be all set. <repository <!-- required --> label="Eclipse Bugs" repositoryKind="bugzilla" urlRepository="https://bugs.eclipse.org/bugs" <!-- optional --> version="2.20" addAutomatically="true" urlNewAccount="https://bugs.eclipse.org/bugs/createaccount.cgi" urlNewTask="https://bugs.eclipse.org/bugs/enter_bug.cgi" urlTask="https://bugs.eclipse.org/bugs/show_bug.cgi?id=" urlQuery="https://bugs.eclipse.org/bugs/query.cgi"/> <!-- custom attributes, connector-sepcific --> <attribute name="taskRegexp" value="<a href=\"show_bug.cgi\\?id\\=(.+?)\">.+?<span class=\"summary\">(.+?)</span>"/> </repository>
(In reply to comment #28) > Yes, make the auto-addition a new task. To resolve this task make the web > access stuff a part of repository as below since it is common to every > repository we currently support, but note that many of the attributes are > optional. Note that we could put that into an optional <webAccess .../> > element but that seems like overkill. Then implement the custom attributes as > Eugene has suggested and we should be all set. > > <repository > <!-- required --> > label="Eclipse Bugs" > repositoryKind="bugzilla" > urlRepository="https://bugs.eclipse.org/bugs" > <!-- optional --> > version="2.20" > addAutomatically="true" > urlNewAccount="https://bugs.eclipse.org/bugs/createaccount.cgi" > urlNewTask="https://bugs.eclipse.org/bugs/enter_bug.cgi" > urlTask="https://bugs.eclipse.org/bugs/show_bug.cgi?id=" > urlQuery="https://bugs.eclipse.org/bugs/query.cgi"/> > <!-- custom attributes, connector-sepcific --> > <attribute > name="taskRegexp" value="<a > href=\"show_bug.cgi\\?id\\=(.+?)\">.+?<span class=\"summary\">(.+?)</span>"/> > </repository> > Should urlTask and urlQuery be defined in custom attributes? If I am not mistaken they only used by web connector.
urlTask will be used commonly because the hyperlink detectors should use it to match full URL references to tasks. urlQuery I was definitely borderline on, but since we allow pasting in custom URL based queries in Bugzilla it may make sense to have a mechanism that makes formulating them one click.
(In reply to comment #30) > urlTask will be used commonly because the hyperlink detectors should use it to > match full URL references to tasks. urlQuery I was definitely borderline on, > but since we allow pasting in custom URL based queries in Bugzilla it may make > sense to have a mechanism that makes formulating them one click. Mik, I stil think those are provider specific. For example, you can't have task prefx for GForge/SourceForge because it is different between bugs and enhancement requests. So, even query url is quite specific for bugzilla.
That's fine, GForge/SourceForge can omit this attribute and use custom ones like urlTaskEnhancement, or we can allow more than one value for urlTask, separated by a delimiter like ", ". But since they hyperlink detector is going to rely on urlTask it should be a common attribute. We can make urlQuery custom unitl we need it to be common for more than one connector.
(In reply to comment #32) > That's fine, GForge/SourceForge can omit this attribute and use custom ones > like urlTaskEnhancement, or we can allow more than one value for urlTask, > separated by a delimiter like ", ". But since they hyperlink detector is going > to rely on urlTask it should be a common attribute. We can make urlQuery > custom unitl we need it to be common for more than one connector. It would be more natural to have multiple custom attributes with the same names instead of ",". Pattern matching is still going to be in the connector implementation, so I don't see why it has to be standard attribute.
Template extension point updated as per comment#28. Todo: Investigate extraction WebRepositoryConnectorTest as per comment#19. Eugene do you have any particular recommendations regarding this?
(In reply to comment #34) > Todo: Investigate extraction WebRepositoryConnectorTest as per comment#19. > Eugene do you have any particular recommendations regarding this? I think it should be be moved into org.eclipse.mylar.tasks.tests and should iterate trough all registered connectors. It may also make sense to move delaration of org.eclipse.mylar.tasks.ui.templates extension to org.eclipse.mylar.tasks.core WebQueryWizardPage.TASK_REGEXP should be in the connector class instead, so test won't have dependency on the UI. You have replaced actual regexp in assertion with the key constant: assertTrue(template.taskQueryUrl+"\n"+WebQueryWizardPage.TASK_REGEXP+"\n"+Arrays.asList(queryStatus.getChildren()).toString(), queryStatus.isOK()); assertTrue("Expected non-empty query result\n"+template.taskQueryUrl+"\n"+WebQueryWizardPage.TASK_REGEXP, hits.size()>0); So, it would make sense to add toString() method to RepositoryTemplate class. Class WebRepositoryTemplate no need to be derecated and can be deleted.
Progress: - Moved TASK_REGEXP - Fixed test case to display regexp rather than key upon error - Deleted WebRepositoryTemplate Perhaps we can move WebRepositoryConnectorTest and use it to test performQuery(...) once I've had a chance to make the api changes discussed on bug#142783 comment#11?
Fixed. Added RepositoryConnectorsTest harness to integration test suite as place holder for iterating over connectors. Moved extension point to core but left extension reader as is in ui as there will be some split necessary there that Mik will likely address.