ecm编程手册

本手册例程请在开发平台“视窗空间”找示例工程下载
在工程中的示例项目:
入口:
your.crop.examples.main项目中的TestEcmIOC类
your.crop.examples.chip1 芯片1 
your.crop.examples.chip2 芯片2
1.程序集的用法
装载、运行、停止、卸载,如下:

TestEcmIOC.java
public static void main(String... strings) {
		String cf1 = "/Users/carocean/studio/examples/build/your.crop.examples.chip1/your.crop.examples.chip1-1.0.jar";
		String cf2 = "/Users/carocean/studio/examples/build/your.crop.examples.chip2/your.crop.examples.chip2-1.0.jar";
		Assembly a1 = Assembly.loadAssembly(cf1);//装载一个程序集
		Assembly a2 = Assembly.loadAssembly(cf2);
		a2.dependency(a1);//由于a2程序集中的deptment依类于a1程序集的IDeptmemt接口,故而a2.要依赖于a1
		a2.start();//启动a2(依赖时a1自启)
		Object obj = a2.workbin().part("chip2main");//通过零件箱获取程序集a2中的开放服务
		IAdaptable a = (IAdaptable) obj;//开放服务均是适配器类型,它可以转换任意类型
		IActuator act = a.getAdapter(IActuator.class);//使用执行器执行弱类型调用方式
		act.exeCommand("testMyXmlService");
		act.exeCommand("testMyAnnoService");
		act.exeCommand("refMethodInXmlService");
		act.exeCommand("refXmlServiceByGridge");
		act.exeCommand("testMyJsonService");
		
		List<Class<?>> mys=a2.workbin().exotericalType("my");//通过外部类型分类搜索外部的类型
		for(Class<?> c:mys){
			ServiceCollection<?> col=a2.workbin().part(c);//根据类型查找外部服务
			System.out.println("-----这是按外部指定分类搜到的服务数:"+col.size());
		}
		a1.unload();//
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值