Activation bundle - switching between CommandMaps

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Activation bundle - switching between CommandMaps

M. D.
Hello group,

Since recently we started using the latest servicemix bundle for javax.activation with the intend to fix mailcap loading issue in an OSGi environment. Prior to that, we had used some jar embedding techniques in order to correctly fix various class/resource loading issues regarding all this mail/activation jar mess.

So far all was looking good - we no longer had embedded dependencies and all kinds of hacks, until we realized that for some of our legacy components we do still use  custom CommandMaps instead of mailcap files, i.e:

 public void setReceipt(MimeBodyPart receipt)  
 
 
 
 throws MessagingException  
 
 {  
 
 
 
 this.receipt = receipt;  
 
 
 
 this.receipt.getDataHandler().setCommandMap(new MDNCommandMap()); // Custom impl of a CommandMap  
 
 
 
 this.needsUpdate = true;  
 
 }  
  This custom ComandMap contains some pretty exotic mime parts that are not found in the original mailcap file from javamail.

It also contains some custom handlers for already known parts that are already found in the original mailcap file.
So seems that simply adding new mailcap files in these legacy components will not work for us because we will have duplicate pars which are handled by different handlers, depending on the component.  
  Looking at the code of the DataHandler:
https://github.com/apache/servicemix-specs/blob/master/activation-api-1.1/src/main/java/javax/activation/DataHandler.java
... I see that there is the option to set a global
 DataContentHandlerFactory    but a global factory will break our components in case they work simultaneously (multi threaded).

So do you think there is another option for us which we fail to see? Is there a way to extend the functionality of the servicemix activation in order for it to support custom command maps?

Thank you in advance for the responses!

Best regards,
M.D
Reply | Threaded
Open this post in threaded view
|

Re: Activation bundle - switching between CommandMaps

M. D.
Hello group,

I found a small bug in the activation servicemix code that is causing the aforementioned issue.
I have created a pull request with a fix:
https://github.com/apache/servicemix-specs/pull/9

I would appreciate it if you could review it and give me an ETA for a release.

Thank you very much!

Best regards,
Marin








 >-------- Оригинално писмо --------

 >От: "M. D." [hidden email]

 >Относно: Activation bundle - switching between CommandMaps

 >До: [hidden email]

 >Изпратено на: 25.05.2017 16:12


Hello group,



Since recently we started using the latest servicemix bundle for javax.activation with the intend to fix mailcap loading issue in an OSGi environment. Prior to that, we had used some jar embedding techniques in order to correctly fix various class/resource loading issues regarding all this mail/activation jar mess.



So far all was looking good - we no longer had embedded dependencies and all kinds of hacks, until we realized that for some of our legacy components we do still use  custom CommandMaps instead of mailcap files, i.e:



 public void setReceipt(MimeBodyPart receipt)  

 

 

 

 throws MessagingException  

 

 {  

 

 

 

 this.receipt = receipt;  

 

 

 

 this.receipt.getDataHandler().setCommandMap(new MDNCommandMap()); // Custom impl of a CommandMap  

 

 

 

 this.needsUpdate = true;  

 

 }  

  This custom ComandMap contains some pretty exotic mime parts that are not found in the original mailcap file from javamail.



It also contains some custom handlers for already known parts that are already found in the original mailcap file.

So seems that simply adding new mailcap files in these legacy components will not work for us because we will have duplicate pars which are handled by different handlers, depending on the component.  

  Looking at the code of the DataHandler:

 https://github.com/apache/servicemix-specs/blob/master/activation-api-1.1/src/main/java/javax/activation/DataHandler.java 

... I see that there is the option to set a global

 DataContentHandlerFactory    but a global factory will break our components in case they work simultaneously (multi threaded).



So do you think there is another option for us which we fail to see? Is there a way to extend the functionality of the servicemix activation in order for it to support custom command maps?



Thank you in advance for the responses!



Best regards,

M.D