本手册例程请在开发平台“视窗空间”找示例工程下载 在工程中的示例项目: 入口: 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();//
ecm编程手册
最新推荐文章于 2023-04-04 17:22:56 发布