Resource references and the Blueprint Container
Blueprint components can access WebSphere Application Server resource references using resource reference declarations.
You declare each resource reference in a Blueprint XML file. Each bundle in an OSGi application can contain any number of resource reference declarations in its various Blueprint XML files. We can secure each resource reference using a Java EE Connector Architecture (JCA) authentication alias.
Blueprint resource reference bindings are configured when we add the enterprise bundle archive (EBA) asset to a business-level application.
To use resource references, we use the following Blueprint namespace, which contains the resource-reference, res-auth, and res-sharing-scope elements:
http://www.ibm.com/appserver/schemas/8.0/blueprint/resourcereference
The following example defines a Blueprint component with a component ID of resourceRef. The component is like a service reference. This component will be bound to a JNDI resource that has the JNDI name jdbc/Account and type javax.resource.cci.ConnectionFactory.
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:rr="http://www.ibm.com/appserver/schemas/8.0/blueprint/resourcereference"> <rr:resource-reference id="resourceRef" interface="javax.resource.cci.ConnectionFactory" filter="(osgi.jndi.service.name=jdbc/Account)"> <rr:res-auth>Application</rr:res-auth> <rr:res-sharing-scope>Shareable</rr:res-sharing-scope> </rr:resource-reference> </blueprint>To declare a resource reference, we must specify both the interface and filter attributes. The filter must contain a JNDI resource in the form osgi.jndi.service.name=name, where name is the JNDI name of the resource.
Use the res-auth element to set whether authorization is application-managed or container-managed. The res-auth element takes the following values:
- Application
- Authorization is application-managed.
- Container
- Authorization is container-managed. This is the default value.
Use the res-sharing-scope element to set whether a resource reference can be shared. The res-sharing-scope element takes the following values:
- Shareable
- A resource reference can be shared
- Unshareable
- A resource reference cannot be shared. This is the default value.
We can also use a resource reference to configure a data source for a persistence bundle using a blueprint:comp/resource_ref_id JNDI name. See JPA and OSGi Applications.
When we secure resource references, those resource references can be bound only to JCA authentication aliases that exist on every server or cluster that the OSGi application is deployed to. An OSGi application can be deployed to multiple servers and clusters in the same security domain. Therefore, each JCA authentication alias must exist in either the security domain of the target servers and clusters, or the global security domain.
Related:
Blueprint bundles Blueprint XML Beans and the Blueprint Container Services and the Blueprint Container References and the Blueprint Container Scopes and the Blueprint Container Object values and the Blueprint Container Object life cycles and the Blueprint Container Dynamism and the Blueprint Container Type converters and the Blueprint Container JNDI lookup for blueprint components JPA and OSGi Applications Enterprise OSGi standards Developing an OSGi application OSGi Service Platform Release 4 Version 4.2 Enterprise Specification Building OSGi applications with the Blueprint Container specification
File name: was316.html
prettyPrint();