Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change 
notification.

The following page has been changed by JeremyBoynes:
http://wiki.apache.org/ws/Tuscany/SpecProposals/Resources

------------------------------------------------------------------------------
  
  The OSOA @Resource annotation has semantics aligned with the OSOA programming 
model such as the specification of authentication through Policy declaration; 
the semantics of javax.annotation.Resource are specified by JSR-250 Common 
Annotations.
  
- The set of resources dependencoes declared by an implementation is the union 
of all resources declared through these mechanisms. It is an error for two 
resource declarations to have the same name.
+ The set of resources dependencies declared by an implementation is the union 
of all resources declared through these mechanisms. It is an error for two 
resource declarations to have the same name.
  
  == OSOA @Resource Annotation ==
  
@@ -47, +47 @@

  
  '''TODO we should have a way of declaring resource dependencies for 
implementations without using annotations'''
  
- = Use of JNDI =
+ == Use of JNDI ==
  
  A SCA Implementation type is not required to provide components with a 
default JNDI Naming Context or to bind Resources into JNDI. Portable 
applications must not assume that they have access to the JNDI contexts 
provided by Java Enterprise Edition.
  
@@ -63, +63 @@

       }
  }}}
  
+ = Configuring Resources =
+ 
+ A SCA Runtime environment may support the definition of resources that it 
should make available to applications that it is running. This definition may 
be part of the configuration of the runtime or may be part of the environment 
in which SCA is running. For example, an SCA Runtime associated with a Java 
Enterprise Edition managed environment may provided access to its resources. 
Every resource made available in this way must have a name that is unique 
within the scope of the runtime.
+ 
+ The configuration of these resources, including the mapping to any provided 
by other local environments, is outside the scope of this specification.
+ 
+ References to these resources can be bound in the following ways:
+  * Through configuration of the Component being implemented
+  * Through defaulting mechanisms in the resource dependency declaration
+ 
+ == Configuring Resources for a Component ==
+ 
+ The resources declared by an implementation may be defined in the SCDL used 
to define a component that it is implementing. The SCDL schema is modified as 
follows:
+ 
+ {{{
+   <complexType name="Resource" abstract="true">
+     <attribute name="name" type="NCName" use="required"/>
+     <attribute name="mappedName" type="string" use="optional"/>
+     <anyAttribute namespace="##any" processContents="lax"/>
+   </complexType>
+ }}}
+ 
+ The value of the @name attribute denotes the name of the resource declared by 
the implementation.
+ 
+ The value of the @mappedName attribute denotes the name of the resource 
provided by the runtime environment. If not value is supplied, a default 
service must be provided by the runtime environment; it is recommended that the 
runtime use the value of the @name attribute to locate a suitable resource. The 
format of the mapped name is specific to the runtime environment.
+ 
+ The Java implementation type is extended as follows:
+ {{{
+     <complexType name="JavaImplementation">
+         <complexContent>
+             <extension base="sca:Implementation">
+                 <sequence>
+                     <element name="resource" type="sca:Resource" 
minOccurs="0" maxOccurs="unbounded" />
+                     <any namespace="##other" processContents="lax" 
minOccurs="0" maxOccurs="unbounded" />
+                 </sequence>
+                 <attribute name="class" type="NCName" use="required" />
+                 <anyAttribute namespace="##any" processContents="lax" />
+             </extension>
+         </complexContent>
+     </complexType>
+ }}}
+ 
+ === Example showing how a Java implementation can be connected to DataSource 
===
+ 
+ {{{
+   public class MyImpl {
+     @Resource public DataSource myDS;
+   }
+ }}}
+ 
+ {{{
+   <component name="MyComponent">
+     <implementation.java class="example.MyImpl">
+       <resource name="myDS" mappedName="java:comp/env/LocalDB"/>
+     </implementation.java>
+   </component>
+ }}}
+ 
+ == Configuration by Default ==
+ 
+ An implementation may provide default values for the mapping in the 
declaration using the "mappedName" attribute of the annotation or XML 
definition.
+ 
+ {{{
+   public class MyImpl {
+     @org.osoa.annotation.Resource(mappedName="SomeDB")
+     public DataSource myDS;
+ 
+     @javax.annotation.Resource(mappedName="java:comp/env/EntityManager")
+     public EntityManager em;
+   }
+ }}}
+ 
+ Any value specified in this manner is overridden by configuration at the 
Component level.
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to