- 浏览: 544992 次
- 性别:
- 来自: 西安
文章分类
- 全部博客 (251)
- UML/RUP/软件工程 (0)
- DDD:领域驱动设计 (1)
- IaaS/Paas/SaaS (1)
- Hadoop/YARN (10)
- PBDP项目 (2)
- OSGi-基础 (7)
- OSGi-Aries (2)
- OSGi-SpringDM (32)
- Oracle/MySQL/SS (8)
- Felix/Equinox/Bnd (14)
- Virgo Server/Gemini (7)
- Weblogic/JBoss/Tomcat (10)
- ActiveMQ (14)
- Camel (1)
- Spring Roo/Eclipse (7)
- Java/JSP/JSF (10)
- Maven (19)
- ESB-Mule (1)
- ESB-ServiceMix (18)
- SOA/SCA/SDO (12)
- WebService/RESTful (17)
- JS/jQuery/ExtJS (4)
- Spring/JPA/MVC (15)
- SpringSecurity (5)
- BPM/jBPM (3)
- Hudson/SVN/CI (0)
- LinuxOS/虚拟化 (25)
- Office/OpenOffice (1)
- 项目管理 (5)
- POI/jFreeChart (1)
最新评论
-
panamera:
请问JMS Transport 发布的webservice 是 ...
CXF 提供的Service Transport-JMS Transpor -
jianyi296:
where is attachment.
CXF WebService Dynamic Client -
hj01kkk:
您好,我用jdbc-user-service为什么每次验证时都 ...
SpringSecurity笔记3-Authenticating Users:Authenticaton Strategy -
wufenglin1231:
你好,我在实现Mapping exceptions to re ...
RESTful 异常处理 -
xchd:
[echo] Project: common
[echo ...
Hive安装配置学习笔记
1. Service registration and unregistration events
Spring DM provides two ways to implement and configure listeners:
■ Make the service implement the OsgiServiceRegistrationListener interface. When this interface
is present, Spring DM will automatically register the bean as a listener of the service’s lifecycle.
This is a reasonable approach, but it ties your implementation to the Spring DM API.
■ Specify a service listener configuration in the service tag. This approach is preferred because it
allows you to use a POJO as a listener. The association between events and callback methods is
specified through the service listener configuration.
Spring DM provides a registration-listener element to be used as an inner tag of the service tag.
Attributes of the registration-listener element:
(1)Attribute:ref
Description:Specifies the identifier of the bean to be used as a service listener.
(2)Attribute: registrationmethod
Description:Specifies the method of the listener bean to be called when the service is registered.
The method must have exactly two parameters: One of the type of the service and corresponds
to the service that’s being listened to. A second which corresponds to the service’s properties
and can be of type Map or Dictionary.
(3)Attribute: unregistrationmethod
Description:Specifies the method of the listener bean to be called when the service is
unregistered. The method signature follows the same rules as for registration-method.
示例:
Contents of a registration service listener:
public class TestRegistrationServiceListener {
public void onServiceRegistered(TestService service, Map properties) {
(...)
}
public void onServiceUnregistered(TestService service, Map properties) {
(...)
}
}
<bean id="testListener"
class="com.manning.sdmia.springdm.service.impl.TestRegistrationServiceListener"/>
<osgi:service id="testService" ref="testServiceBean"
interface="com.manning.sdmia.springdm.service.TestService">
<registration-listener ref="testListener" registration-method="onServiceRegistered"
unregistration-method="onServiceUnregistered"/>
</osgi:service>
2. Service bind and unbind events
Spring DM provides two different methods for receiving notifications when the configured service
is bound or unbound by Spring DM.
■ Make the listener implement the OsgiServiceLifecyleListener interface. When this interface is
present, Spring DM will automatically use the interface’s methods when binding and unbinding
occur.
■ Specify a service reference listener configuration in the reference
tag. This approach is
preferred because it allows you to use a POJO as a listener. The association between events
and callback methods is specified through the service reference listener’s configuration.
Attributes of the listener tag:
(1)ref:Specifies the identifier of the bean to be used as a service listener.
(2)bind-method:Specifies the method of the listener to be called when a reference to the
service is bound. The method must have two parameters: The first is of the type of the
service and corresponds to the service. The second corresponds to the service properties
and can be of type Map or Dictionary.
(3)unbind-method:Specifies the method of the listener to be called when a reference to the
service is unbound. The method signature follows the same rules as for the bindmethod
attribute.
示例:
public interface OsgiServiceLifecycleListener {
void bind(Object service, Map properties);
void unbind(Object service, Map properties);
}
public class TestServiceListener {
public void onServiceBound
(TestService service, Map properties) {
(...)
}
public void onServiceUnbound
(TestService service, Map properties) {
(...)
}
}
<bean id="testListener"
class="com.manning.sdmia.springdm.service.impl.TestRegistrationServiceListener"/>
<osgi:reference id="testService"
interface="com.manning.sdmia.springdm.service.TestService">
<listener ref="testListener" bind-method="onServiceBound" unbind-
method="onServiceUnbound"/>
</osgi:service>
发表评论
-
SpringDM笔记31-Testing with OSGi and SpringDM
2011-11-22 10:27 12461. 创建一个SpringDM测试类 SpringD ... -
SpringDM笔记30-OSGi中使用SSL/STL
2011-11-21 11:55 1319SSL:Secure Sockets Layer ... -
SpringDM笔记29-Require-Bundle与Import-Package的区别
2011-11-21 10:31 2238具体可参考:http://www.osgi.org/bl ... -
SpringDM笔记28-OSGi Bundle Activities with Spring-DM
2011-11-17 10:19 1159OSGi框架中也支持搞层次的模块交互:bundles.例如 ... -
SpringDM笔记28-Spring And OSGi:Layers of Integration
2011-11-15 11:00 11761. Application Design:Service和B ... -
SpringDM笔记27-Extending The Stand Extender and Configure
2011-09-02 09:38 8691. -
SpringDM笔记25-Using AJAX frameworks with Spring DM:GWT
2011-09-01 08:53 12001. Using Spring DM with AJAX fr ... -
SpringDM笔记24-Using action-based web frameworks with Spring DM:SpringMVC
2011-08-30 09:33 1478■ Action-based web frameworks ... -
SpringDM笔记23-Using the open EntityManager in view pattern实现延迟加载
2011-08-30 09:27 15671. The open EntityManager in vi ... -
SpringDM笔记22-Transactions Support With SpringDM
2011-08-29 21:24 12101. Spring’s transactional suppo ... -
SpringDM笔记21-Using ORM within OSGi with Spring DM
2011-08-25 10:31 2096Version 1.Object/relational ma ... -
SpringDM笔记20-Using JDBC within OSGi with Spring DM
2011-08-25 09:08 1776The public API for interact ... -
SpringDM笔记19-SpringDM如何处理OSGi应用的动态行为
2011-08-24 08:51 1143ServiceTracker 1. Dealing ... -
SpringDM笔记18-Designing OSGi Enterprise Applications
2011-08-22 11:08 11221. Organizing OSGi components ... -
SpringDM笔记17-Handling Collections of OSGi Services
2011-08-20 09:12 15421.Configuring collections:the l ... -
SpringDM笔记15-通过声明特定的属性注册和引用服务
2011-08-18 11:01 14071. Configuration for registerin ... -
SpringDM笔记14-The thread context classloader 及在OSGi中的运用
2011-08-18 10:40 22481. Using the thread context cla ... -
SpringDM笔记13-OSGi服务注册与引用
2011-08-18 09:28 34501. Combining OSGi services and ... -
SpringDM笔记12-Spring DM’s web Extender运行机制
2011-08-17 11:04 2087SpringDM把一个WAR作为一个Bundle, 其实 ... -
SpringDM笔记11-Hard dependencies on the OSGi environment
2011-08-17 10:50 1414Any bean in a Spring DM app ...
相关推荐
NULL 博文链接:https://springsfeng.iteye.com/blog/1152012
NULL 博文链接:https://springsfeng.iteye.com/blog/1271565
NULL 博文链接:https://springsfeng.iteye.com/blog/1259203
spring-osgi-1.2.1-with-dependencies.zip spring-osgi-1.2.1-with-dependencies.zip spring-osgi-1.2.1-with-dependencies.zip
spring-dm整合osgi所需所有jar包
spring-osgi-1.2.0-rc1-with-dependencies.zip
spring-osgi-1.2.0-with-dependencies.zip spring-osgi-1.2.0-with-dependencies.zip spring-osgi-1.2.0-with-dependencies.zip
spring-osgi-1.2.1-with-dependencies完整包
Spring-DM指的是 Spring ...Spring-DM 的主要目的是能够方便地将 Spring 框架和OSGi框架结合在一起,使得使用Spring的应用程序可以方便简单地部署在OSGi环境中,利用OSGi框架提供的服务,将应用变得 更加模块化。
Spring Boot应用程序将这些程序包作为OSGI框架的额外程序包公开(以便能够使用公开的服务)。 有关请参见stackoverflow的帖子。嵌入式OSGI中的日志记录解决方案添加了描述的日志记录解决方案。
spring1.2的包文件 spring-osgi-1.2.0.zip
spring 3.0已经全面支持OSGi了。 各发行包的大致描述如下: org.springframework.asm-3.0.0.M4.jar: 提供对ASM(一个字节码框架)的简单封装 org.springframework.expression-3.0.0.M4.jar: spring表达式语言 ...
osig与spring:springDM开发环境配置,eclipse配置osgi开发环境,及命令
基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip ...
spring-osgi-core-1.2.1.jar spring-osgi-core-1.2.1-sources.jar spring-osgi-extender-1.2.1.jar spring-osgi-extender-1.2.1-sources.jar spring-osgi-io-1.2.1.jar spring-osgi-io-1.2.1-sources.jar spring-...
spring osgi所需的所有lib以及示例程序。
学习SpringDM+OSGI的一些总结,自我学习,上传文档防止丢失。
自制CHM版的API文档,带索引。 注:如果各位下载后打开或无法显示页面,请在CHM文件右键—属性—解除锁定即可。
赠送jar包:osgi-resource-locator-1.0.1.jar; 赠送原API文档:osgi-resource-locator-1.0.1-javadoc.jar; 赠送源代码:osgi-resource-locator-1.0.1-sources.jar; 赠送Maven依赖信息文件:osgi-resource-locator...
felix-on-androidfelix-on-android osgi androidsee:优点:在有限情况下,实现静黙升级;快速分发,升级;动态加载(扩展)应用功能(需要定义良好的框架);向第三方开放接口,我们成为平台;缺点:更加复杂的升级方案...