2. Custom 绔嬌鐢?/strong>
鏂板緩鎻掍歡宸ョ▼錛孖mport瀛楀吀鏈嶅姟Exprot鐨勫寘銆?br />
浠g爜鐗囨錛?br />
package demo.dictionary.custom;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import demo.dictionary.DictionaryService;
public class Activator implements BundleActivator {
ServiceReference serviceReference = null;
public void start(BundleContext context) throws Exception {
serviceReference = context.getServiceReference(DictionaryService.class.getName());
if(null != serviceReference){
DictionaryService dictionaryService = (DictionaryService)context.getService(serviceReference);
System.out.println("check word:" + dictionaryService.check("word"));
System.out.println("check osgi:" + dictionaryService.check("osgi"));
System.out.println("check equinox:" + dictionaryService.check("equinox"));
System.out.println("check eclipse:" + dictionaryService.check("eclipse"));
}
}
public void stop(BundleContext context) throws Exception {
serviceReference = null;
}
}
3. Custom 绔嬌鐢?/strong>
濡傛灉娌¤緭鍑烘樉紺猴紝鍙湪console涓?update custom 鎻掍歡銆?br />
緇撴灉錛?br />

4.宸ョ▼鏂囦歡涓嬭澆
demo.dictionary.custom.rar

]]>