[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [orbit-dev] Is there any bundle in orbit with both mail and activation package??
|
Hi Andrea,
The orbit project strives to package libraries as well as possible to accommodate the maximum number of situations. This being said libraries are packaged with a strong bias to support well designed OSGi environments. Orbit libraries themselves follow best practices and conventions as defined in the eclipse wiki.
Until now a given library is packaged in a single manner at orbit. This certainly makes it simpler for the consumers of the orbit repository.
The situation you are facing sounds quite specific. You might be better off packaging this library specifically for your project. You could also suggest to the owner of the client code to patch their code so that it can be used in OSGi nicely. This type of contribution is welcome my experience.
Please correct me if my understanding of orbit is misleading.
I hope this helps,
Hugues.
2010/7/12 Andrea Zoppello
<andrea.zoppello@xxxxxx>
Hi Gunnar,
Thx for the suggestion.
BTW ( maybe it was not clear as i've not specify it in my previous
messages ):
1) i'm not using javax.activation and mail packages *only for
sending/receive mail* but in general to handle
*attachments in general..
2) this would work if you've the total control on your client code...
but if for example you're usinf
third pard libraries it would not.
Looking around in the net the problem is in the implementation details
of activation and mail packages.
The solution of keeping activation and mail together was a suggestion
that has been confirmed
on osgi-dev mailing list too... so would make sense for me.
Andrea
Il 12/07/2010 11:23, Gunnar Wagenknecht ha scritto:
Hi Andrea,
Am 12.07.2010 10:19, schrieb Andrea Zoppello:
The only solution i've found is to merge activation and mail packages in
the same bundle and make this bundle exporting a specific
version of the two packages and then adjust all my client bundles to
import this version.
I'm using a different approach. Basically, javax.activation allows to
set a custom CommandMap. This allows to inject an OSGi-aware CommandMap.
private void doSend(final Email email) throws EmailException {
final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try {
// make sure to use *our* bundle class loader
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
CommandMap.setDefaultCommandMap(getMyCommandMap());
email.send();
} finally {
CommandMap.setDefaultCommandMap(null);
Thread.currentThread().setContextClassLoader(tccl);
}
}
Then I re-used the CommandMap implementation from Geronimo
(org.apache.geronimo.javax.activation.GeronimoMailcapCommandMap).
-Gunnar
--
Andrea Zoppello
Spagic Architect
|
Respect
the environment. Please don't print this e-mail unless you really need
to. |
The information transmitted is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the intended
recipient is prohibited. If you received this in error, please contact
the sender and delete the material from any computer.
_______________________________________________
orbit-dev mailing list
orbit-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orbit-dev