- 浏览: 1124266 次
- 性别:
- 来自: 火星郊区
博客专栏
-
OSGi
浏览量:0
文章分类
- 全部博客 (695)
- 项目管理 (48)
- OSGi (122)
- java (79)
- Vaadin (5)
- RAP (47)
- mysql (40)
- Maven (22)
- SVN (8)
- 孔雀鱼 (10)
- hibernate (9)
- spring (10)
- css (3)
- 年审 (6)
- ant (1)
- jdbc (3)
- FusionCharts (2)
- struts (4)
- 决策分析 (2)
- 生活 (10)
- 架构设计 (5)
- 破解 (2)
- 狼文化 (4)
- JVM (14)
- J2EE (1)
- 应用服务器 (1)
- 我的链接 (5)
- 数学 (2)
- 报表 (1)
- 百科 (6)
- Flex (7)
- log4j (2)
- PHP (1)
- 系统 (2)
- Web前端 (7)
- linux (6)
- Office (1)
- 安全管理 (5)
- python (2)
- dom4j (1)
- 工作流 (3)
- 养生保健 (4)
- Eclipse (8)
- 监控开发 (1)
- 设计 (3)
- CAS (1)
- ZK (41)
- BluePrint (3)
- 工具 (1)
- SWT (7)
- google (2)
- NIO (1)
- 企业文化 (2)
- Windoes (0)
- RCP (7)
- JavaScript (10)
- UML (1)
- 产品经理 (2)
- Velocity (10)
- C (1)
- 单元测试 (1)
- 设计模式 (2)
- 系统分析师 (2)
- 架构 (4)
- 面试 (2)
- 代码走查 (1)
- MongoDB (1)
- 企业流程优化 (1)
- 模式 (1)
- EJB (1)
- Jetty (1)
- Git (13)
- IPV6 (1)
- JQuery (8)
- SSH (1)
- mybatis (10)
- SiteMesh (2)
- JSTL (1)
- veloctiy (1)
- Spring MVC (1)
- struts2 (3)
- Servlet (1)
- 权限管理 (1)
- Java Mina (1)
- java 系统信息 (6)
- OSGi 基础 (3)
- html (1)
- spring--security (6)
- HTML5 (1)
- java爬虫搜索 (1)
- mvc (3)
最新评论
-
Tom.X:
http://osgia.com/
将web容器置于OSGi框架下进行web应用的开发 -
chenyuguxing:
你好, 为什么我的bundle export到felix工程中 ...
在Apache Felix中运行bundle -
string2020:
<niceManifest>true</ni ...
Bundle Plugin for Maven -
jsonmong:
OSGI,是未来的主流,目前已相当成熟。应用OSGI比较好的, ...
基于OSGi的声明式服务 -
zyhui98:
貌似是翻译过来的,有很少人在linux上做开发吧
如何成为“10倍效率”开发者
RAP 介绍请见: http://www.eclipse.org/rap/
Spring 介绍请见: http://www.springsource.org/
Spring-osgi 介绍请见: http://www.springsource.org/osgi
RAP 也是完全的基于 OSGI ,只要对于 osgi 的概念以及 Spring-osgi 的具体用法能够完全理解的话,那么这里所谓的 RAP 整合 Spring ,就和网上常见的 OSGI 整合 Spring 没什么大的区别了。
Spring-osgi 就是在 Spring 的基础上,使得在 osgi 环境下也能够使用 Spring 。 osgi 下单 bundle 有其自己的生命周期, Spring-osig 需要相互注入分布在多个 bundle 间的 bean ,而这些 bean 又和自身所在的 bundle 拥有一致的生命周期。那么 Spring-Osgi 需要解决的难题正是 classloader 问题,以及将分布在不同生命周期的 bundle 的 bean 以一定的模式整合在一起(也就是所谓的注入, bean 的依赖关系)。
第一步 :下载 Spring ,下载 Spring-osgi
将下载的 Spring-osig 下的 dist 和 lib 下的所有 jar 放到 Eclipse 的 RAP 的 target 下。
需要注意的问题 : Spring-osgi 的 lib 内包含了一个 org.eclipse.osgi 包,同时 Eclipse 的 RAP 的 target 下也包含了一个 org.eclipse.osgi 包,由于 Spring-osig 提供的 org.eclipse.osgi 版本更新,你可以将原来 EclipseRap 的 Target 下的 org.eclipse.osgi 包删除(也就是选择版本低的删除即可)。
第二步 :创建基本的 RAP 项目
使用 EclipseRAP 提供的模板创建一个 mail 的项目。
需要注意的问题:需要选择基于 Eclipse ,添加 Activator ,这样点击‘下一步‘后,才可以选择 RAP 提供的几个模板来创建项目。
第三步 :创建 server 项目,创建 server.impl 项目
这里所谓的 server 项目,指的是: model ( bo , vo ), service 的 interface 。
server.impl 项目,指的是: service 的 interface 的实现。
server 项目内容比较少,具体内容见代码:
public interface IDemoService {
public void sayHello();
}
server.impl 项目中 .具体内容见代码:
public class DemoService implements IDemoService {
public void sayHello() {
System. out .println( "Hello OSGI" );
}
}
在 META-INF 文件下为 spring 创建一个 xml 文件 (xml 文件名称任意 ).
具体内容见代码 :
< bean id = "demoService" scope = "bundle" class = "lggege.rap.demo.server.impl.DemoService" >
</ bean >
< osgi:service ref = "demoService" interface = "lggege.rap.demo.server.IDemoService" />
第四步 : RAP 调用 implement 中的服务
<!---->1. <!---->将 launch 中的 Activator 的 BundleContext 对外暴露,具体内容见代码:
public class Activator extends AbstractUIPlugin {
private BundleContext context ;
public void start(BundleContext context) throws Exception {
super .start(context);
plugin = this ;
this . context = context;
}
public BundleContext getContext() {
return context ;
}
// .. 省略其他代码
}
<!---->2. <!---->这步就比较简单了,就是在 RAP 的某个控件的添加一个 listener ,通过从 bundleContext 中使用 Service 的 interface 的 class 来获得服务。
我是为 MessagePopupAction 添加了 listener, 具体内容见代码:
public void run() {
// MessageDialog.openInformation(window.getShell(), "Open", "Open Message Dialog!");
ServiceReference serviceReference = Activator.getDefault ().getContext().getServiceReference(IDemoService. class .getName());
IDemoService demoService = (IDemoService) Activator.getDefault ().getContext().getService(serviceReference);
demoService.sayHello();
}
第五步 :运行
需要在 run 中添加 spring-osgi 对应的几个 bundle 即可。进入 RAP 后,点击特定的控件去触发事件,通过在事件中调用外部的服务。
具体效果:控制台看到信息输出 .
第六步 :分析
就这么简单,通过使用 Spring-osgi ,我们能够通过配置的方式往 osgi 注册服务,这个服务是来自于 Spring 配置的 bean 。 RAP 通过从 BuncleContext 用 Service 的 interface 来获得服务。
后续文章的内容:
RAP 整合 Spring (基于 Spring-osgi )可下载源码和视频 URL:http://lggege.iteye.com/blog/314666
spring-osgi配置log4j(创建fragment project) 可下载视频 URL:http://lggege.iteye.com/blog/314874
Spring-osgi整合iBATIS 可下载代码和视频 URL:http://lggege.iteye.com/blog/315257
- rap_springosgi-demo.rar (36.9 KB)
- 下载次数: 6
- RapSpringOsgi.rar (6 MB)
- 下载次数: 15
发表评论
-
RCP开发者的好去处之ICON系列(持续更新中... ...)
2012-03-31 10:13 1091为了找个合适的图片是不是头大的不像样子了?OK,我现在就 ... -
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
2012-03-25 14:50 1423引用 在rcp的路径添加了mysql驱动,并添加之cla ... -
解决JFace Dialog中ScrollComposite无法滚动
2012-03-26 10:26 1550今天写了一个Jface的dialog,作为配置界面,其中有 ... -
SWT实现弹出日历控件
2012-03-27 08:00 2532实现像网页上的那种用户单击一个Text框然后框下面出现一个日历 ... -
JFace进度条
2012-03-27 08:01 1082Java代码 someB ... -
getConfigurationElementsFor 无法获得扩展点的信息
2012-03-26 10:27 1062做项目的时候RCP程序在eclipse调试环境下面运行正常 ... -
测试rcp 和 rap 何时触发 组建.addListener(SWT.xxx, new Listener() )的方法
2012-02-24 14:22 1234Java代码 直接通过反射让组建监 ... -
RAP 界面显示不完全的问题
2012-02-24 14:22 1177rap运行第一刷新界面总是刷新不完整,组件错位,后台报Layo ... -
Uploading files with RAP 1.4
2012-02-17 11:37 1581One of the new things in RAP 1. ... -
【RAP】CAS PIA 快速浏览入口地址
2012-02-07 08:23 1208下面的链接是访问RAP应用的入口。有2中方式,图片上已经注明。 ... -
RAP 与 RCP的区别
2012-02-07 08:23 1287RAP 可以让开发人员使用 JAVA API 和按照 E ... -
将Eclipse RAP部署到Tomcat中
2012-02-07 08:23 1094在上次成功将我的RCP项目迁移到浏览器中运行后,开始研究 ... -
RAP(Rich AJAX Platform)的可部署文件下载
2012-02-07 08:24 1108这是我自己做的RAP的可部署文件,可以下载下来解压到Tom ... -
Eclipse rcp/rap 开发经验总结(15) -rap如何使用js
2012-02-03 08:11 13991. 把输入的字符串当 javascript 执行 ... -
Eclipse rcp/rap 开发经验总结(14) -rap 图片、数据缓存处理
2012-02-03 08:10 1463一、概述 在进行了 rap 的基本学习之后,您对 rap ... -
Eclipse rcp/rap 开发经验总结(13) -Rap/Rcp保存按钮处理方式
2012-02-03 08:10 1047一、概述 在做项目的过程中,处理编辑区的保存机制的时候。发 ... -
Eclipse rcp/rap 开发经验总结(12) -Rap 优化之组件的销毁
2012-02-03 08:10 818一、概述 经过几个月的rap 项目实战,总结了一些小 ... -
Eclipse rcp/rap 开发经验总结(11) -rcp/rap与spring ibatis集成
2012-02-03 08:10 12661. rcp/rap 与 spring 集成 Activa ... -
Eclipse rcp/rap 开发经验总结(10) -Rap不同系统间的差异和处理方式
2012-02-01 08:01 1353平常进行 rap 程序开发一般都是在 win ... -
Eclipse rcp/rap 开发经验总结(9) - rap上传与下载
2012-02-01 08:01 995一 上传 上传即将文件上传到服务器上,在客户端需 ...
相关推荐
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-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-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-...
spring1.2的包文件 spring-osgi-1.2.0.zip
基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip ...
spring-dm整合osgi所需所有jar包
spring osgi所需的所有lib以及示例程序。
自制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...
Spring-DM指的是 Spring ...Spring-DM 的主要目的是能够方便地将 Spring 框架和OSGi框架结合在一起,使得使用Spring的应用程序可以方便简单地部署在OSGi环境中,利用OSGi框架提供的服务,将应用变得 更加模块化。
赠送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...
spring-osgi 入门手册和代码 spring-osgi 入门手册和代码 spring-osgi 入门手册和代码 spring-osgi 入门手册和代码
OSGI企业应用开发(十五)基于Spring、Mybatis、Spring MVC实现一个登录应用博文源码
spring-osgi.jar及其依赖包
Spring-DM指的是 Spring ...Spring-DM 的主要目的是能够方便地将 Spring 框架和OSGi框架结合在一起,使得使用Spring的应用程序可以方便简单地部署在OSGi环境中,利用OSGi框架提供的服务,将应用变得 更加模块化。
标签:atlassian-plugins-osgi-2.6.0.jar.zip,atlassian,plugins,osgi,2.6.0,jar.zip包下载,依赖包