geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r724810 - in /geronimo/plugins/tuscany/trunk/samples/helloworld-ejb: pom.xml src/main/java/sample/ejb3/HelloworldServiceBean.java src/main/resources/META-INF/HelloworldServiceBean.componentType src/main/resources/META-INF/ejb-jar.composite
Date Tue, 09 Dec 2008 18:34:56 GMT
Author: vamsic007
Date: Tue Dec  9 10:34:56 2008
New Revision: 724810

URL: http://svn.apache.org/viewvc?rev=724810&view=rev
Log:
Update the sample to add properties and references using componentType side file.

Added:
    geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/HelloworldServiceBean.componentType
  (with props)
Modified:
    geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/pom.xml
    geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/java/sample/ejb3/HelloworldServiceBean.java
    geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/ejb-jar.composite

Modified: geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/pom.xml?rev=724810&r1=724809&r2=724810&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/pom.xml (original)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/pom.xml Tue Dec  9 10:34:56 2008
@@ -41,6 +41,11 @@
 
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-annotation_1.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-ejb_3.0_spec</artifactId>
             <scope>provided</scope>
         </dependency>

Modified: geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/java/sample/ejb3/HelloworldServiceBean.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/java/sample/ejb3/HelloworldServiceBean.java?rev=724810&r1=724809&r2=724810&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/java/sample/ejb3/HelloworldServiceBean.java
(original)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/java/sample/ejb3/HelloworldServiceBean.java
Tue Dec  9 10:34:56 2008
@@ -17,6 +17,7 @@
 
 package sample.ejb3;
 
+import javax.annotation.PostConstruct;
 import javax.ejb.Stateless;
 
 import org.osoa.sca.ComponentContext;
@@ -58,6 +59,8 @@
     @Reference(required=true)
     protected Helloworld service6;
 
+    private Helloworld service0;
+    
     @Property
     protected String property1;
     
@@ -81,6 +84,9 @@
 
     @Property(required=true)
     protected String property6;
+
+    private String property0;
+    private String property0D;
     
     @ComponentName
     protected String scaComponentName;
@@ -102,6 +108,14 @@
         componentContext1 = ctx;
     }
 
+    @PostConstruct
+    private void init() {
+        // This method assumes that componentContext is injected.
+        service0 = componentContext.getService(Helloworld.class, "service0");
+        property0 = componentContext.getProperty(String.class, "property0");
+        property0D = componentContext.getProperty(String.class, "property0D");
+    }
+    
 	public String getGreetings(String name) {
 		System.out.println(scaComponentName+": HelloworldServiceBean.getGreetings: "+name);
 		return prepareResponse(name);
@@ -109,12 +123,14 @@
 	
 	private String prepareResponse(String name) {
 		StringBuffer sb = new StringBuffer();
+        String greeting0 = service0.sayHello(name);
         String greeting = service1.sayHello(name);
         String greeting2 = ser2.sayHello(name);
         String greeting3 = ser3.sayHello(name);
         
         sb.append("<h3>@Reference</h3>");
-        sb.append("<br>Injected into field. <br><strong>Result: </strong>"
+ greeting);
+        sb.append("<br>Reference defined in componentType side file. <br><strong>Result:
</strong>" + greeting0);
+        sb.append("<br><br>Injected into field. <br><strong>Result:
</strong>" + greeting);
         sb.append("<br><br>Injected into field with reference name specified
in the annotation. <br><strong>Result: </strong>" + greeting2);
         sb.append("<br><br>Injected using setter method. <br><strong>Result:
</strong>" + greeting3);
         sb.append("<br><br>Required is false. Reference is not specified. "+service4);
@@ -123,6 +139,8 @@
         sb.append("<hr>");
         
         sb.append("<h3>@Property</h3>");
+        sb.append("<br>Property defined in componentType side file: property0 = "+property0);
+        sb.append("<br>Property with default value defined in componentType side file:
property0D = "+property0D);
         sb.append("<br>Injected into field: property1 = "+property1);
         sb.append("<br>Injected into field with property name specified in the annotation:
property2 = "+prop2);
         sb.append("<br>Injected using setter method: Property3 = "+prop3);

Added: geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/HelloworldServiceBean.componentType
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/HelloworldServiceBean.componentType?rev=724810&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/HelloworldServiceBean.componentType
(added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/HelloworldServiceBean.componentType
Tue Dec  9 10:34:56 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <reference name="service0">
+        <interface.java interface="sample.Helloworld"/>
+    </reference>
+
+    <property name="property0D" type="xsd:string">Prop0DefaultVal</property>
+    <property name="property0" type="xsd:string"/>
+</componentType>

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/HelloworldServiceBean.componentType
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/HelloworldServiceBean.componentType
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/HelloworldServiceBean.componentType
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/ejb-jar.composite
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/ejb-jar.composite?rev=724810&r1=724809&r2=724810&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/ejb-jar.composite
(original)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-ejb/src/main/resources/META-INF/ejb-jar.composite
Tue Dec  9 10:34:56 2008
@@ -17,6 +17,9 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
+
+<!-- $Rev$ $Date$ -->
+
 <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
            targetNamespace="http://sample"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
@@ -25,6 +28,7 @@
     <component name="helloworldEjbComponent">
         <implementation.ejb ejb-link="HelloworldServiceBean"/>
 
+        <reference name="service0" target="HelloworldComponent" />
         <reference name="service1" target="HelloworldComponent" />
         <reference name="service2" target="HelloworldTeluguComponent" />
         <reference name="Service3" target="HelloworldFrenchComponent" />
@@ -32,6 +36,7 @@
         <reference name="service5" target="HelloworldComponent"/>
         <reference name="service6" target="HelloworldComponent"/>
 
+        <property name="property0" type="xsd:string">Prop0</property>
         <property name="property1" type="xsd:string">Prop1</property>
         <property name="property2" type="xsd:int">7</property>
         <property name="Property3" type="xsd:double">0.7</property>



Mime
View raw message