DZone
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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Frameworks
  4. Gemini Blueprint – Converting from Spring OSGi

Gemini Blueprint – Converting from Spring OSGi

Gordon Dickens user avatar by
Gordon Dickens
·
Jun. 21, 12 · Interview
Like (0)
Save
Tweet
Share
8.37K 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 Elasticsearch Works
  • mTLS Everywere
  • Introduction to Container Orchestration
  • Getting a Private SSL Certificate Free of Cost

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • 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: