代码块 | ||||
---|---|---|---|---|
| ||||
package smartbi.framework; /** * 模块接口定义。 * 每个模块必须有一个对象实现这个接口,这个对象称为模块控制对象; * 除了实现这个接口,模块控制对象还应该实现一个服务定义接口。所以它的主要责任包括: * 1)作为模块的激活器 * 2)作为对外的服务对象 */ public interface IModule { void activate();//模块控制对象自己激活自己 } |
2、示例说明
打开"http://localhost:8080/smartbi/vision/test/extsample8.html"并点击页面中的按钮,将会看到类似下面的结果:
修改Spring声明文件applicationContext.xml 将自定义Module对象extSample8Service配置到扩展插件的spring声明文件中。通过自定义Module引用系统内部模块,实现系统内部方法的调用。
代码块 | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <bean id="rmi" class="smartbi.framework.rmi.RMIModule" factory-method="getInstance"> <property name="modules"> <map> <entry><key><value>ExtSample8Service</value></key><ref bean="extSample8Service" /></entry> </map> </property> </bean> <bean id="extSample8Service" class="smartbi.ext.sample8.ExtSample8Service" factory-method="getInstance"> </bean> </beans> |
3、示例代码下载
示例代码下载: Sample8.rar