| Home » Eclipse Projects » Mylyn » Attach context for generic web connector based repostories
 Goto Forum:| 
| Attach context for generic web connector based repostories [message #58817] | Tue, 30 September 2008 19:08  |  | 
| Eclipse User  |  |  |  |  | Hi Is there a way to attach context for a task that was created using the
 templates for generic web connector based repository?
 My database has a way to save attachments, but if the genric web connector
 does not have a direct way to save it, is there a workaround?
 Thanks very much in advance
 Sunanda
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #58868 is a reply to message #58817] | Wed, 01 October 2008 02:21   |  | 
| Eclipse User  |  |  |  |  | On 10/01/08 01:08, Menon wrote: > Is there a way to attach context for a task that was created using the
 > templates for generic web connector based repository?
 > My database has a way to save attachments, but if the genric web
 > connector does not have a direct way to save it, is there a workaround?
 
 The answer is simply NO, unless you are going to contribute this change to the Mylyn project.
 I was missing this feature all the time. Therefore (and for other reasons) we move to Trac, which is
 very well supported and quite extensible.
 
 AFAIK, there is a generic JDBC connector in the works, which can directly query a database. So if
 you have access to the database tables of your issue tracker, this may be a much better solution.
 It also supports task editing, but I am not sure about attachments.
 
 Cheers, Jörg
 |  |  |  |  |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #58942 is a reply to message #58918] | Wed, 01 October 2008 15:04   |  | 
| Eclipse User  |  |  |  |  | Jörg Thönnes wrote: >> What is involved in adding this feature to generic web connector? How
 >> much effort is it?
 >>
 > No idea, some of the Mylyn guys could tell you...
 >
 I am no longed a "Mylyn guy" and won't have time to work on this, but
 I will try to answer question about what would it take to add such
 feature. Maybe you guys could stick that into a bug report in case
 someone would want to work on that.
 
 So, it is relatively easy to implement support for attaching the task
 context in the web connector. The only issue is how to generalize
 required configuration. Other then that, api on mylyn side is more or
 less straightforward.
 
 Basically, in most cases, attaching something would require http post
 call to some URL with content type set to multipart/form-data. The call
 would need to have number of fields specified and should also include
 field for the attachment body, which is usually declared in html like this:
 
 <input name="data" type="file">
 
 So, the easiest way to configure that would be to add additional
 parameters to the connector configuration. It need to be an url with
 number of parameters required by the web server in order to submit an
 attachment. Values for some of those parameters would need to be
 substituted from variables, such as ${Id} ${Description} and
 ${Attachment}, for example:
 
 
 ${serverUrl}/attach/?taskId=${Id}&description=${Descript ion}&data=${Attachment}&someOtherField=foo
 
 Then attachment submission can parse that url and construct the
 corresponding post request for submitting attachment. Generally not much
 different from submitting requests for task queries.
 
 regards,
 Eugene
 |  |  |  |  |  |  |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #61282 is a reply to message #60471] | Mon, 03 November 2008 16:51   |  | 
| Eclipse User  |  |  |  |  | Hi Eugene I have been trying to implement the "add attachment functionality to the
 web connector as you suggested for my repository.
 Curently I am stuck with this code, and not able to post the URL. Ilooked
 at the webconnector code where PostMethod is called and I have something
 like this code for postContent(..) in the webtaskttachmentHandler. Any
 idea what I am missing for the Post to succeed? I may be missing some
 critical function call. I am passing the URlwith the aparametrs and the
 Filename is from the source.
 Thanks
 Sunanda
 
 @Override
 public void postContent(TaskRepository repository, ITask task,
 AbstractTaskAttachmentSource source, String
 comment,
 TaskAttribute attachmentAttribute, IProgressMonitor
 monitor) throws CoreException {
 try {
 monitor.beginTask("Sending attachment",
 IProgressMonitor.UNKNOWN);
 String description = source.getDescription();
 String contentType = source.getContentType();
 String filename = source.getName();
 boolean isPatch = false;
 
 HttpClient client = new HttpClient();
 WebUtil.configureHttpClient(client, repository.getProperty
 (WebRepositoryConnector.getUserAgent()));
 AbstractWebLocation location = new TaskRepositoryLocationUiFactory
 ().createWebLocation(repository);
 HostConfiguration hostConfiguration = WebUtil.createHostConfiguration
 (client, location, null);
 String repositoryUrl = repository.getRepositoryUrl();
 int n = (repository.getProperty
 WebRepositoryConnector.PROPERTY_ATTACHMENT_URL)).indexOf
 ("}");
 int nl = (repository.getProperty
 (WebRepositoryConnector.PROPERTY_ATTACHMENT_URL)).length();
 String key = (repository.getProperty
 
 (WebRepositoryConnector.PROPERTY_ATTACHMENT_URL)).substring
 (n + 1, nl);
 String attachmentUrl = repositoryUrl + key;
 PostMethod postMethod = new PostMethod(attachmentUrl);
 
 postMethod.getParams().setBooleanParameter
 (HttpMethodParams.USE_EXPECT_CONTINUE, true);
 List<PartBase> parts = new ArrayList<PartBase>();
 parts.add(new StringPart("bug_id", task.getTaskId(), "UTF-8"));
 if (comment != null) {
 parts.add(new StringPart("comment", comment, "UTF-8"));
 }
 parts.add(new FilePart("data", new AttachmentPartSource(source,
 filename)));
 
 postMethod.setRequestEntity(new MultipartRequestEntity(parts.toArray
 (new Part[1]), postMethod.getParams()));
 postMethod.setDoAuthentication(true);
 
 try {
 try {
 int status = WebUtil.execute(client, hostConfiguration,
 postMethod, monitor);
 } catch (HttpException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 } catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 } finally {
 postMethod.releaseConnection();
 }
 
 }
 finally {
 }
 
 }
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #66285 is a reply to message #65741] | Mon, 09 March 2009 14:06  |  | 
| Eclipse User  |  |  |  |  | Hi Eugene What we are trying to do is to use the web connector to attach to an
 internal proprietary repositiory. It is not available extenal to our
 company. So the chnages that we do in the web connector is not useful to
 anyone else. Can you tell us if we want to replace the installed web
 connector plugin with our chnages, can we just copy over the package to
 the existing plugin? How can we point Mylyn to use this updated plugin
 instead of the one that we download?
 Thanks very much
 Sunanda
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #593715 is a reply to message #58817] | Wed, 01 October 2008 02:21  |  | 
| Eclipse User  |  |  |  |  | On 10/01/08 01:08, Menon wrote: > Is there a way to attach context for a task that was created using the
 > templates for generic web connector based repository?
 > My database has a way to save attachments, but if the genric web
 > connector does not have a direct way to save it, is there a workaround?
 
 The answer is simply NO, unless you are going to contribute this change to the Mylyn project.
 I was missing this feature all the time. Therefore (and for other reasons) we move to Trac, which is
 very well supported and quite extensible.
 
 AFAIK, there is a generic JDBC connector in the works, which can directly query a database. So if
 you have access to the database tables of your issue tracker, this may be a much better solution.
 It also supports task editing, but I am not sure about attachments.
 
 Cheers, Jörg
 |  |  |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #593735 is a reply to message #58893] | Wed, 01 October 2008 13:45  |  | 
| Eclipse User  |  |  |  |  | On 10/01/08 18:24, Menon wrote: > Thanks Jorg
 > What is involved in adding this feature to generic web connector? How
 > much effort is it?
 
 No idea, some of the Mylyn guys could tell you...
 
 > Using trac connector, can I use templates to connect to my database thru
 > my web interface?
 
 No, trac is an issue tracker on its own: trac.edgewall.org
 
 But if replacing your current issue tracker is not an option, then is information is of less use for
 you.
 
 Cheers, Jörg
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #593745 is a reply to message #58918] | Wed, 01 October 2008 15:04  |  | 
| Eclipse User  |  |  |  |  | Jörg Thönnes wrote: >> What is involved in adding this feature to generic web connector? How
 >> much effort is it?
 >>
 > No idea, some of the Mylyn guys could tell you...
 >
 I am no longed a "Mylyn guy" and won't have time to work on this, but
 I will try to answer question about what would it take to add such
 feature. Maybe you guys could stick that into a bug report in case
 someone would want to work on that.
 
 So, it is relatively easy to implement support for attaching the task
 context in the web connector. The only issue is how to generalize
 required configuration. Other then that, api on mylyn side is more or
 less straightforward.
 
 Basically, in most cases, attaching something would require http post
 call to some URL with content type set to multipart/form-data. The call
 would need to have number of fields specified and should also include
 field for the attachment body, which is usually declared in html like this:
 
 <input name="data" type="file">
 
 So, the easiest way to configure that would be to add additional
 parameters to the connector configuration. It need to be an url with
 number of parameters required by the web server in order to submit an
 attachment. Values for some of those parameters would need to be
 substituted from variables, such as ${Id} ${Description} and
 ${Attachment}, for example:
 
 
 ${serverUrl}/attach/?taskId=${Id}&description=${Descript ion}&data=${Attachment}&someOtherField=foo
 
 Then attachment submission can parse that url and construct the
 corresponding post request for submitting attachment. Generally not much
 different from submitting requests for task queries.
 
 regards,
 Eugene
 |  |  |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #594414 is a reply to message #59116] | Mon, 20 October 2008 17:10  |  | 
| Eclipse User  |  |  |  |  | Hi Eugene I am tryingt to see if I can add this feature to the web repository.
 I added the Attachment URL etc to the Websettings page and it shows up in
 the properties when I try to add a repository based on the web repository.
 I added WebRepositoryAttachnmentHAndler.java file based on the
 BugzillaAttachmentHandler.java file. Bugzilla has a clientManager
 implemented. Do I need to do that? Is this the right way to connect the
 Attachment Context UI- Finish Button to save the context?
 Thanks
 Sunanda
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #594426 is a reply to message #60451] | Mon, 20 October 2008 17:29  |  | 
| Eclipse User  |  |  |  |  | I don't have Mylyn code around, and it doesn't seem like Mylyn's integrator reference on the wiki have any information about attachment
 handling.
 http://wiki.eclipse.org/Mylyn/Integrator_Reference#Implement ing_core_extension_points
 So, you would have to look trough the code, e.g. start from the
 context attachment action.
 
 regards,
 Eugene
 
 
 Menon wrote:
 > Hi Eugene
 > I am tryingt to see if I can add this feature to the web repository.
 > I added the Attachment URL etc to the Websettings page and it shows up
 > in the properties when I try to add a repository based on the web
 > repository.
 > I added WebRepositoryAttachnmentHAndler.java file based on the
 > BugzillaAttachmentHandler.java file. Bugzilla has a clientManager
 > implemented. Do I need to do that? Is this the right way to connect
 > the Attachment Context UI- Finish Button to save the context?
 > Thanks
 > Sunanda
 >
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #594645 is a reply to message #60471] | Mon, 03 November 2008 16:51  |  | 
| Eclipse User  |  |  |  |  | Hi Eugene I have been trying to implement the "add attachment functionality to the
 web connector as you suggested for my repository.
 Curently I am stuck with this code, and not able to post the URL. Ilooked
 at the webconnector code where PostMethod is called and I have something
 like this code for postContent(..) in the webtaskttachmentHandler. Any
 idea what I am missing for the Post to succeed? I may be missing some
 critical function call. I am passing the URlwith the aparametrs and the
 Filename is from the source.
 Thanks
 Sunanda
 
 @Override
 public void postContent(TaskRepository repository, ITask task,
 AbstractTaskAttachmentSource source, String
 comment,
 TaskAttribute attachmentAttribute, IProgressMonitor
 monitor) throws CoreException {
 try {
 monitor.beginTask("Sending attachment",
 IProgressMonitor.UNKNOWN);
 String description = source.getDescription();
 String contentType = source.getContentType();
 String filename = source.getName();
 boolean isPatch = false;
 
 HttpClient client = new HttpClient();
 WebUtil.configureHttpClient(client, repository.getProperty
 (WebRepositoryConnector.getUserAgent()));
 AbstractWebLocation location = new TaskRepositoryLocationUiFactory
 ().createWebLocation(repository);
 HostConfiguration hostConfiguration = WebUtil.createHostConfiguration
 (client, location, null);
 String repositoryUrl = repository.getRepositoryUrl();
 int n = (repository.getProperty
 WebRepositoryConnector.PROPERTY_ATTACHMENT_URL)).indexOf
 ("}");
 int nl = (repository.getProperty
 (WebRepositoryConnector.PROPERTY_ATTACHMENT_URL)).length();
 String key = (repository.getProperty
 
 (WebRepositoryConnector.PROPERTY_ATTACHMENT_URL)).substring
 (n + 1, nl);
 String attachmentUrl = repositoryUrl + key;
 PostMethod postMethod = new PostMethod(attachmentUrl);
 
 postMethod.getParams().setBooleanParameter
 (HttpMethodParams.USE_EXPECT_CONTINUE, true);
 List<PartBase> parts = new ArrayList<PartBase>();
 parts.add(new StringPart("bug_id", task.getTaskId(), "UTF-8"));
 if (comment != null) {
 parts.add(new StringPart("comment", comment, "UTF-8"));
 }
 parts.add(new FilePart("data", new AttachmentPartSource(source,
 filename)));
 
 postMethod.setRequestEntity(new MultipartRequestEntity(parts.toArray
 (new Part[1]), postMethod.getParams()));
 postMethod.setDoAuthentication(true);
 
 try {
 try {
 int status = WebUtil.execute(client, hostConfiguration,
 postMethod, monitor);
 } catch (HttpException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 } catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 } finally {
 postMethod.releaseConnection();
 }
 
 }
 finally {
 }
 
 }
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #594652 is a reply to message #61282] | Mon, 03 November 2008 20:25  |  | 
| Eclipse User  |  |  |  |  | Can't suggest anything without debugging, but you can also ask about usage of apache http client in its own mailing list and google returns
 good pile of resources about http client.
 
 Note that you need to take into account that your web server may
 require user session to be present before it would accept attachments
 (i.e. call postMethod.setDoAuthentication(true); won't do any good),
 So it require investigation. There is some tracing http proxies that
 could be used to record conversation between the web browser and web
 server, after that you would just need to replicate the same
 conversation using http client. One of such tracing proxy is included in
 Eclipse WTP.
 
 Also note that there is bunch of methods for expanding substituted
 properties in the web connector class.
 
 regards,
 Eugene
 
 
 Menon wrote:
 > Hi Eugene
 > I have been trying to implement the "add attachment functionality to
 > the web connector as you suggested for my repository.
 > Curently I am stuck with this code, and not able to post the URL.
 > Ilooked at the webconnector code where PostMethod is called and I have
 > something like this code for postContent(..) in the
 > webtaskttachmentHandler. Any idea what I am missing for the Post to
 > succeed? I may be missing some critical function call. I am passing
 > the URlwith the aparametrs and the Filename is from the source.
 > Thanks
 > Sunanda
 >
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #596293 is a reply to message #61305] | Mon, 16 February 2009 03:01  |  | 
| Eclipse User  |  |  |  |  | Hi Eugene I was sucessful in adding the context to my repository using the generic
 web connector. Now the question is how can I retrieve the context?
 What should I do in the web connector to provide this support?
 Can the Mylyn Context support the retrieval automatically or do I need to
 provide the support in the web connector?
 When I tried to debug the bugzilla connector, it seems to display the
 context zip files from the local .metaData directory. I am overwriting the
 zip file in my repository every time a new context is added. But When I
 retrive it, Mylyn context Retrieve code seems to look at the local dir for
 the context zip file. Any ideas on how I can retrieve the saved context
 and files in the generic web connector?
 Thanks very much for your help
 -Sunanda
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #596313 is a reply to message #65508] | Mon, 16 February 2009 10:37  |  | 
| Eclipse User  |  |  |  |  | Out of the top of my head you will have to implement attachment retrieval API for the web connector.
 
 regards,
 Eugene
 
 
 Menon wrote:
 > Hi Eugene
 > I was sucessful in adding the context to my repository using the
 > generic web connector. Now the question is how can I retrieve the
 > context?
 > What should I do in the web connector to provide this support?
 > Can the Mylyn Context support the retrieval automatically or do I need
 > to provide the support in the web connector?
 > When I tried to debug the bugzilla connector, it seems to display the
 > context zip files from the local .metaData directory. I am overwriting
 > the zip file in my repository every time a new context is added. But
 > When I retrive it, Mylyn context Retrieve code seems to look at the
 > local dir for the context zip file. Any ideas on how I can retrieve
 > the saved context and files in the generic web connector?
 > Thanks very much for your help
 > -Sunanda
 >
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #596380 is a reply to message #65570] | Thu, 19 February 2009 17:08  |  | 
| Eclipse User  |  |  |  |  | Hi Eugene 
 Me and Sunanda Menon are working for the context retrieval for a web task
 repository.
 When we compare bugzilla with the web we see that when a new context is
 attached a zip file related to the context is beeing created in the
 offline folder with the taskid.zip name for the bugzilla and not for the
 web repositiory. Can you tell us where and how this is been created. And
 for retrieveal the attchment util.getContextAttachments refers to this
 file to fill in the table from which the context could be selected.And for
 our web repository since this file is not geting created its not filling
 in the table
 
 Regards
 Deepti
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #596387 is a reply to message #65719] | Thu, 19 February 2009 18:39  |  | 
| Eclipse User  |  |  |  |  | Deepti, 
 I'd suggest to ask this question in the developers mailing list and
 ask about the API that need to be implemented.
 
 regards,
 Eugene
 
 PS: are you talking about proprietary web connector you you are planning
 to contribute a patch for Mylyn's web connector.
 
 
 deepti wrote:
 > Hi Eugene
 >
 > Me and Sunanda Menon are working for the context retrieval for a web
 > task repository.
 > When we compare bugzilla with the web we see that when a new context
 > is attached a zip file related to the context is beeing created in the
 > offline folder with the taskid.zip name for the bugzilla and not for
 > the web repositiory. Can you tell us where and how this is been
 > created. And for retrieveal the attchment util.getContextAttachments
 > refers to this file to fill in the table from which the context could
 > be selected.And for our web repository since this file is not geting
 > created its not filling in the table
 >
 > Regards
 > Deepti
 >
 |  |  |  |  | 
| Re: Attach context for generic web connector based repostories [message #596606 is a reply to message #65741] | Mon, 09 March 2009 14:06  |  | 
| Eclipse User  |  |  |  |  | Hi Eugene What we are trying to do is to use the web connector to attach to an
 internal proprietary repositiory. It is not available extenal to our
 company. So the chnages that we do in the web connector is not useful to
 anyone else. Can you tell us if we want to replace the installed web
 connector plugin with our chnages, can we just copy over the package to
 the existing plugin? How can we point Mylyn to use this updated plugin
 instead of the one that we download?
 Thanks very much
 Sunanda
 |  |  |  | 
 
 
 Current Time: Fri Oct 31 08:19:22 EDT 2025 
 Powered by FUDForum . Page generated in 0.07464 seconds |