DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Gemini Blueprint – Converting from Spring OSGi

Gemini Blueprint – Converting from Spring OSGi

Gordon Dickens user avatar by
Gordon Dickens
·
Jun. 21, 12 · Java Zone · Interview
Like (0)
Save
Tweet
8.19K Views

Join the DZone community and get the full member experience.

Join For Free

Eclipse Virgo OSGi Enthusiasts, like myself, can now switch from the Spring OSGi namespace to the Eclipse Gemini Blueprint namespaces for bundles.

Maven Dependencies

<!-- Gemini Blueprint OSGi -->
<properties>
  <gemini.blueprint.version>1.0.0.RELEASE</gemini.blueprint.version>
</properties>
...
 
<dependency>
  <groupId>org.eclipse.gemini</groupId>
  <artifactId>org.eclipse.gemini.blueprint.extender</artifactId>
  <version>${gemini.blueprint.version}</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.beans</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.core</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.context</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.eclipse.gemini.blueprint</groupId>
  <artifactId>gemini-blueprint-mock</artifactId>
  <version>${gemini.blueprint.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.eclipse.gemini</groupId>
  <artifactId>org.eclipse.gemini.blueprint.core</artifactId>
  <version>${gemini.blueprint.version}</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.aop</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.beans</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.core</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.context</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.eclipse.gemini</groupId>
  <artifactId>org.eclipse.gemini.blueprint.io</artifactId>
  <version>${gemini.blueprint.version}</version>
</dependency>

Repositories

<repository>
  <id>com.springsource.repository.bundle.external</id>
  <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
  <url>http://repository.springsource.com/maven/bundles/external</url>
</repository>

Eclipse Gemini Blueprint Config

XML Tag Attributes Description
<bean /> id, activation, depends-on, class, init-method, destroy-method, factory-method, factory-ref, scope The type definition for a component. The bean’s attributes provide the characteristics for how to create the bean instance. Constructor arguments and injected properties are specified via child <argument> and <property> elements
<blueprint /> default-activation, default-timeout, default-availability, The root element for a blueprint configuration file with two sections. The first section (contained within the <type-converters> element) identifies components that are used for converting values into different target types. The type converters are optional. The second section contains component definitions. Components are <bean>, <service>, <reference>, and <reference-list> elements that identify the bundle components that will be managed by the blueprint service
<description />   A generic element type to allow documentation to be added to the blueprint configuration
<compendium:cm-properties /> id, persistent-id, local-override, dynamic, init-lazy, init-timeout Exposes the properties found in the Configuration Admin service under the given <persistent-id>
<compendium:managed-properties /> persistent-id, autowire-on-update, update-method Defines a bean based on the given class name and configuration, with properties autowired-by-name based on the configuration stored under the given <persistent-id>
<compendium:managed-service-factory /> auto-export, autowire-on-update, context-class-loader, depends-on, factory-pid, interface, update-method Defines a collection of beans based on the given class name, with properties <autowired-by-name> based on the configuration sets stored under the given factory <persistent-id>
<ref /> component-id Defines a required <component-id> for the reference component
<reference /> id, activation, depends-on, interface, filter, component-name, availability Defines the instances of a registered <service>, with a <timeout>. If the <timeout> is not specified, the <default-timeout> value is inherited from the encapsulating <blueprint> definition
<reference-list /> id, activation, depends-on, interface, filter, component-name, availability, member-type Builds in the characteristics of the <service> type to define characteristics of the <reference-list>. This adds in the characteristics that only apply to collections of references via <member-type>. Subnodes can be <description >, <compendium:cm-properties >, <compendium:managed-properties >, <compendium:managed-service-factory >, <reference-listener >
<reference-listener /> ref, bind-method, unbind-method A definition of a listener that will watch for bind/unbind events associated with the <service> reference. The listener can be a <ref> to a <bean> or <reference> element, or an inline <bean> or <reference>
<service /> id, activation, depends-on, interface, ref, auto-export, ranking Defines the type for services exported by this blueprint bundle. Services are sourced by either a <ref> to a <bean> component or an <inline> bean component
<type-converters />   Defines a set of <bean>, <ref>, or <reference> elements that identify the type converter components

Examples

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
    http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"
  default-activation="eager">
 
  <!-- import the DataSource from OSGi -->
  <reference id="dataSource" interface="javax.sql.DataSource"/>
 
  <!-- export the directory bean to OSGi under the Directory interface -->
  <service ref="directory" interface="greenpages.Directory"/>
</blueprint>
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:compendium="http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium"
  xsi:schemaLocation="http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium
 
http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium/gemini-blueprint-compendium.xsd
 
http://www.osgi.org/xmlns/blueprint/v1.0.0
 
  http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"
  default-activation="eager">
 
  <compendium:cm-properties id="database.props"
    persistent-id="greenpages.db.config"/>
 
  <!-- Export the JDBC DataSource with the Service Name 'dataSource' -->
  <service ref="dataSource" interface="javax.sql.DataSource"/>
</blueprint>

 

Resources

  • Blueprint Migration – note: Repository referenced in article is not useful
  • My Code Samples
  • Gemini Blueprint
  • Eclipse Virgo

 

Spring Framework

Published at DZone with permission of Gordon Dickens, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How To Evaluate Software Quality Assurance Success: KPIs, SLAs, Release Cycles, and Costs
  • Quantum Computers Explained
  • Building Reactive Java Applications with Spring Framework
  • What Are Microservices?

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo