本文介绍如何在Equinox中集成Tuscany,Tuscany容器作为OSGI环境中的一个Bundle存在。同时一个Contribution也对应为一个Bundle,此种方式使Tuscany的Contribution具有了热部署和动态修改替换的能力。这也是Tuscany邮件组中目前正在讨论的问题。
修改Tuscany:
1. 创建OsgiSCADomain,继承自SCADomain. OsgiSCADoamin参照DefaultSCADomain,做了少许改动。
| a) DefaultSCADomain是在构造方法中加载Contribution的资源。修改OsgiSCADomain,添加initContribution(Bundle bundle)方法。代码片断如下: ContributionService contributionService = runtime.getContributionService(); URL contributionURL; try { contributionURL = getContributionLocation(bundle); if (contributionURL != null) { // Make sure the URL is correctly encoded (for example, escape the space characters) contributionURL = contributionURL.toURI().toURL(); } } catch (Exception e) { thrownew ServiceRuntimeException(e); } |

