SpringDM笔记5-SpringDM开发步骤

1. Configuring a Container

    建立一个开发目录,在目录中加入:org.eclipse.osgi-3.5.1.R35x_v20090827.jar,并在该目录下建立configuration

    目录,在该目录中建立文件:config.ini,为解决在启动该容器时,Equino试图启动Eclipse的问题,需在config.ini中作以

    配置:

    eclipse.ignoreApp=true

    运行命令启动容器:java -jar org.eclipse.osgi-3.5.1.R35x_v20090827.jar –console

2. Provisioning a container for simple use

    建立一个bundles目录位于开发目录下,在该目录下分别建立目录:springdm,spring, log,以便分类管理

    SpringDM运行所需的依赖,最终目录结构:

    container/

org.eclipse.osgi-3.5.1.R35x_v20090827.jar

configuration/

config.ini

(Equinoxownfiles)

bundles/

springdm/

(SpringDMbundles)

spring/

(SpringFrameworkbundles)

log/

                (Log bundles)

    (1) The main Spring DM bundles:

    spring-osgi-io-2.0.0.M1.jar:Provides support for resource loading in OSGi environments

    spring-osgi-core-2.0.0.M1.jar:Provides OSGi-based Spring application contexts and service

    publishing/consuming facilities

    spring-osgi-io-2.0.0.M1.jar:Detects and bootstraps Spring-powered bundles

    (2)Spring dependencies needed by Spring DM:

    org.springframework.core-3.0.0.RC1.jar,org.springframework.beans-3.0.0.RC1.jar,

    org.springframework.context-3.0.0.RC1.jar,org.springframework.context.support-3.0.0.RC1.jar,

    org.springframework.core-3.0.0.RC1.jar,org.springframework.expression-3.0.0.RC1.jar,

    org.springframework.aop-3.0.0.RC1.jar,com.springsource.org.aopalliance-1.0.0.jar,

    com.springsource.net.sf.cglib-2.1.3.jar

    (3)Log libraries needed by Spring DM:

    com.springsource.org.apache.log4j-1.2.15.jar,com.springsource.slf4j.api-1.5.6.jar,

    com.springsource.slf4j.log4j-1.5.6.jar,com.springsource.slf4j.org.apache.commons.logging-1.5.6.jar,

    log4j-config.jar

3. Provisioning a container for web use

    Spring DM web support is also based on the extender pattern, through the web extender, which

    detects and installs web bundles. The web extender relies on another Spring DM bundle, which

    acts as the bridge between the web container and the OSGi world.

    在bundles目录下新建一个web目录。

    (1)Spring DM web bundles:

    spring-osgi-web-2.0.0.M1.jar:Provides deployment support for Tomcat and Jetty web containers,

    and a web application context class for OSGi environments

    spring-osgi-web-extender-2.0.0.M1.jar:Detects and deploys/undeploys web bundles

    这两个Bundle放入上述建立的springdm目录下。

    (2)Web bundles for minimal support of Tomcat(Version:5.5):

    com.springsource.javax.servlet-2.4.0.jar:OSGi-ified version of the 2.4 Servlet API

    catalina.osgi-5.5.23-SNAPSHOT.jar:OSGi-ified version of Apache Tomcat

    catalina.start.osgi-1.0.0.jar:OSGi activator; bootstraps Tomcat

    这几个Bundle放入在Bundles目录下的web目录下。

    (3) Bundles for JSP and taglib support:

    jsp-api.osgi-2.0-SNAPSHOT.jar:JSP standard API definition

    jasper.osgi-5.5.23-SNAPSHOT.jar:Tomcat JSP engine; compiles JSP

    commons-el.osgi-1.0-SNAPSHOT.jar:JSP 2.0 Expression Language interpreter

    jstl.osgi-1.1.2-SNAPSHOT.jar:Specific OSGi bundle with JSTL API and Apache Standard

    implementation

    这几个Bundle放入在Bundles目录下的web目录下。

    新的目录结构为:

    container/

org.eclipse.osgi-3.5.1.R35x_v20090827.jar

configuration/

config.ini

(Equinoxownfiles)

bundles/

springdm/

(SpringDMbundles)

spring/

(SpringFrameworkbundles)

log/

(Logbundles)

web/

               (Web bundles)

4. 支持Simple和web开发的config.in文件: 

    eclipse.ignoreApp=true

osgi.bundles=bundles/springdm/spring-osgi-io-2.0.0.M1.jar@start,\

bundles/springdm/spring-osgi-core-2.0.0.M1.jar@start,\

bundles/springdm/spring-osgi-extender-2.0.0.M1.jar@start,\

bundles/spring/org.springframework.aop-3.0.0.RC1.jar@start,\

bundles/spring/org.springframework.asm-3.0.0.RC1.jar@start,\

bundles/spring/org.springframework.beans-3.0.0.RC1.jar@start,\

bundles/spring/org.springframework.context-3.0.0.RC1.jar@start,\

bundles/spring/org.springframework.context.support-3.0.0.RC1.jar@start,\

bundles/spring/org.springframework.core-3.0.0.RC1.jar@start,\

bundles/spring/org.springframework.expression-3.0.0.RC1.jar@start,\

bundles/spring/com.springsource.org.aopalliance-1.0.0.jar@start,\

bundles/spring/com.springsource.net.sf.cglib-2.1.3.jar@start,\

bundles/log/com.springsource.slf4j.api-1.5.6.jar@start,\

bundles/log/com.springsource.slf4j.log4j-1.5.6.jar,\

bundles/log/com.springsource.slf4j.org.apache.commons.logging-1.5.6.jar@start,\

bundles/log/com.springsource.org.apache.log4j-1.2.15.jar@start,\

bundles/springdm/spring-osgi-web-2.0.0.M1.jar@start,\

bundles/springdm/spring-osgi-web-extender-2.0.0.M1.jar@start,\

bundles/web/com.springsource.javax.servlet-2.4.0.jar@start,\

bundles/web/catalina.osgi-5.5.23-SNAPSHOT.jar@start,\

bundles/web/catalina.start.osgi-1.0.0.jar@start,\

bundles/web/jsp-api.osgi-2.0-SNAPSHOT.jar@start,\

bundles/web/jasper.osgi-5.5.23-SNAPSHOT.jar@start,\

bundles/web/commons-el.osgi-1.0-SNAPSHOT.jar@start,\

bundles/web/jstl.osgi-1.1.2-SNAPSHOT.jar@start,\

    bundles/log/log4j-config.jar