felix
felix.auto.start.1=file:bundle/org.apache.felix.framework-3.0.9.jar
felix.auto.start.2= \
file:bundle/org.apache.felix.shell-1.4.1.jar \
file:bundle/org.apache.felix.shell.remote-1.1.2.jar
osgi.console=6666
java -jar bin/felix.jar
userManager
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: UserManager
Bundle-SymbolicName: com.example.usermanager
Bundle-Version: 1.0.0
Bundle-Activator: com.example.usermanager.Activator
Import-Package: javax.mail
package com.example.usermanager;
import javax.mail.Session;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class UserService {
public void sendEmail(String emailAddress, String message) {
try {
InitialContext ctx = new InitialContext();
Session session = (Session) ctx.lookup("java:comp/env/mail/Session");
} catch (NamingException e) {
e.printStackTrace();
}
}
}
lb
install file:/path/to/userManager.jar
provision <Bundle ID>
java:comp/env/mail/Session=javax.mail.Session