The ECF framework is the implementation of the osgi-remoteservice declaration. Its Dependency bundle includes:
Org. Eclipse. ECF
Org. Eclipse. ECF. osgi. Services. Distribution
Org. Eclipse. ECF. osgi. Services. remoteserviceadmin
Org. Eclipse. ECF. osgi. Services. remoteserviceadmin. Proxy
Org. Eclipse. Core. Runtime
Org. Eclipse. Equinox. app
Org. Eclipse. ECF. Identity
Org. Eclipse. ECF. Discovery
Org. Eclipse. Equinox. Concurrent
Org. Eclipse. Equinox. preferences
Org.eclipse.core.jobs
Org. Eclipse. Equinox. Registry
Org. Eclipse. osgi. Services. remoteserviceadmin
Org. Eclipse. Core. contenttype
Org. Eclipse. ECF. provider. jmdns
Org. Eclipse. ECF. Export dobject
Org. Eclipse. ECF. Provider
Org. Eclipse. ECF. remoteservice
Org. Eclipse. ECF. provider. remoteservice
Many plug-ins of the ECF framework are designed as the bundle-activationpolicy: lazy mode. Therefore, you must first modify the Virgo configuration file ($ VTS-HOME/lib/org. eclipse. virgo. kernel. launch. properties ). add osgi. compatibility. eagerstart. set the lazyactivation attribute to true to ensure that Virgo supports the delayed loading mechanism.
In addition, the declared service bundle (here Org. chen. test. service) and the bundle (Org. chen. test) also needs to be declared as the delayed loading mode (bundle-activationpolicy: lazy)
1. Deploy remoteservice through DS
The plan information is as follows:
<?xml version="1.0" encoding="UTF-8"?><plan name="ecf.plan" version="1.0.0" scoped="false" atomic="true" xmlns="http://www.eclipse.org/virgo/schema/plan"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.eclipse.org/virgo/schema/planhttp://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd"><artifact name="org.eclipse.ecf" type="bundle"/><artifact name="org.eclipse.ecf.osgi.services.distribution" type="bundle"/><artifact name="org.eclipse.ecf.osgi.services.remoteserviceadmin" type="bundle"/><artifact name="org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy" type="bundle"/><artifact name="org.eclipse.core.runtime" type="bundle"/><artifact name="org.eclipse.equinox.app" type="bundle"/><artifact name="org.eclipse.ecf.identity" type="bundle"/><artifact name="org.eclipse.ecf.discovery" type="bundle"/><artifact name="org.eclipse.equinox.concurrent" type="bundle"/><artifact name="org.eclipse.equinox.preferences" type="bundle"/><artifact name="org.eclipse.core.jobs" type="bundle"/><artifact name="org.eclipse.equinox.registry" type="bundle"/><artifact name="org.eclipse.osgi.services.remoteserviceadmin" type="bundle"/><artifact name="org.eclipse.core.contenttype" type="bundle"/><artifact name="org.eclipse.ecf.provider.jmdns" type="bundle"/><artifact name="org.eclipse.ecf.sharedobject" type="bundle"/><artifact name="org.eclipse.ecf.provider" type="bundle"/><artifact name="org.eclipse.ecf.remoteservice" type="bundle"/><artifact name="org.eclipse.ecf.provider.remoteservice" type="bundle"/><artifact name="org.chen.test.service" type="bundle"/><artifact name="org.chen.test" type="bundle"/></plan>
The service is released as follows:
<?xml version="1.0" encoding="UTF-8"?><scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="hello.ds.host"> <implementation class="org.chen.test.HelloComponent"/> <property name="service.exported.interfaces" type="String" value="*"/> <property name="service.exported.configs" type="String" value="ecf.generic.server"/> <property name="ecf.exported.containerfactoryargs" type="String" value="ecftcp://localhost:3787/server"/> <service> <provide interface="org.chen.test.service.IHelloService"/> </service></scr:component>
2. Publish and obtain services through Gemini
Add cn.com. Gei. krp. remoteservice Based on the DS release environment. This bundle is used to publish and obtain remote services.
1. remoteserviceexporter is used to publish remote services. The release configuration is as follows:
<? XML version = "1.0" encoding = "UTF-8"?> <Beans xmlns = "http://www.springframework.org/schema/beans" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: osgi = "http://www.springframework.org/schema/osgi" xsi: schemalocation = "http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> <Bean Id = "helloservice" class = "org. chen. test. hellocomponent "/> <osgi: Reference id =" containermanager "interface =" org. eclipse. ECF. core. icontainermanager "/> <bean id =" helloserviceexporter "class =" cn.com. gei. krp. remoteservice. remoteserviceexporter "init-method =" start "> <property name =" containermanager "ref =" containermanager "/> <! -- Service interface --> <property name = "serviceinterface" value = "org. Chen. Test. Service. ihelloservice"/> <! -- Service instance --> <property name = "serviceimplementation" ref = "helloservice"/> <! -- Service URL --> <property name = "servicehostaddress" value = "ecftcp: // localhost: 3788/Server"/> </bean> </beans>
2. remoteserviceimporter is used to obtain remote services. The configuration is as follows:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"><osgi:reference id="containerManager" interface="org.eclipse.ecf.core.IContainerManager" /><bean id="helloServiceImporter"class="cn.com.gei.krp.remoteservice.RemoteServiceImporter" init-method="start"><property name="containerManager" ref="containerManager" /><property name="serviceInterface"value="org.chen.test.service.IHelloService" /><property name="remoteServiceHostAddress" value="ecftcp://localhost:3788/server" /></bean><bean id="helloService" factory-bean="helloServiceImporter" factory-method="getRemoteService" /><bean id="consumer" class="proxy.remote.Consumer"><property name="service" ref="helloService"></property></bean></beans>
The plan information is as follows:
<?xml version="1.0" encoding="UTF-8"?><plan name="ecf.plan" version="1.0.0" scoped="false" atomic="true" xmlns="http://www.eclipse.org/virgo/schema/plan"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.eclipse.org/virgo/schema/plan http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd"><artifact name="org.eclipse.ecf" type="bundle"></artifact><artifact name="org.eclipse.ecf.osgi.services.distribution" type="bundle"></artifact><artifact name="org.eclipse.ecf.osgi.services.remoteserviceadmin" type="bundle"></artifact><artifact name="org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy" type="bundle"></artifact><artifact name="org.eclipse.core.runtime" type="bundle"/><artifact name="org.eclipse.equinox.app" type="bundle"></artifact><artifact name="org.eclipse.ecf.identity" type="bundle"/><artifact name="org.eclipse.ecf.discovery" type="bundle"/><artifact name="org.eclipse.equinox.concurrent" type="bundle"/><artifact name="org.eclipse.equinox.preferences" type="bundle"/><artifact name="org.eclipse.core.jobs" type="bundle"></artifact><artifact name="org.eclipse.equinox.registry" type="bundle"/><artifact name="org.eclipse.osgi.services.remoteserviceadmin" type="bundle"></artifact><artifact name="org.eclipse.core.contenttype" type="bundle"/><artifact name="org.eclipse.ecf.provider.jmdns" type="bundle"/><artifact name="org.eclipse.ecf.sharedobject" type="bundle"/><artifact name="org.eclipse.ecf.provider" type="bundle"/><artifact name="org.eclipse.ecf.remoteservice" type="bundle"/><artifact name="org.eclipse.ecf.provider.remoteservice" type="bundle"></artifact><artifact name="cn.com.gei.krp.remoteservice" type="bundle"/><artifact name="org.chen.test.service" type="bundle"></artifact><artifact name="org.chen.test" type="bundle"></artifact></plan>