⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 activator.java

📁 OSGI_Opendoc, 基于OSGI框架Equinox的实战讲解
💻 JAVA
字号:
package org.riawork.opendoc.event;
/*
 * RIAWork.org
 * 
 * OSGI Opendoc Demo
 */
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.event.EventAdmin;
/**
 * desc: 事件发布Bundle Activator
 *
 * @author jerry
 */
public class Activator implements BundleActivator {

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		EventAdmin eventAdmin=(EventAdmin) context.getService(context.getServiceReference(EventAdmin.class.getName()));
		DemoEventPublisher eventPublisher=new DemoEventPublisher();
		eventPublisher.setEventAdmin(eventAdmin);
		eventPublisher.publishEvent("org/riawork/EQUINOXEVENT", null, true);
		eventPublisher.publishEvent("org/riawork/RIAWORKEVENT", null, true);
		eventPublisher.publishEvent("org/riawork/OSGIEVENT", null, false);
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -