[
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,
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
--
Gunnar Wagenknecht
gunnar@xxxxxxxxxxxxxxx
http://wagenknecht.org/