public interface UsbInfoService { public String getVendorId(); public String getProductId(); } public class UsbInfoServiceImpl implements UsbInfoService { public String getVendorId() { } public String getProductId() { } } import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; public class Activator implements BundleActivator { private ServiceRegistration registration; public void start(BundleContext context) throws Exception { UsbInfoService usbInfoService = new UsbInfoServiceImpl(); registration = context.registerService(UsbInfoService.class.getName(), usbInfoService, null); } public void stop(BundleContext context) throws Exception { registration.unregister(); } }


上一篇:
下一篇:
切换中文