You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/02/24 07:26:58 UTC
svn commit: r511225 [4/4] - in
/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb: ./
binding/ binding/src/ binding/src/main/ binding/src/main/java/
binding/src/main/java/org/ binding/src/main/java/org/apache/
binding/src/main/java/org...
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/java/org/apache/tuscany/binding/ejb/util/MethodInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/java/org/apache/tuscany/binding/ejb/util/MethodInfo.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/java/org/apache/tuscany/binding/ejb/util/NamingEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/java/org/apache/tuscany/binding/ejb/util/NamingEndpoint.java?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/java/org/apache/tuscany/binding/ejb/util/NamingEndpoint.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/java/org/apache/tuscany/binding/ejb/util/NamingEndpoint.java Fri Feb 23 22:26:55 2007
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.binding.ejb.util;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public class NamingEndpoint {
+ private String jndiName;
+ private EJBLocator locator;
+ private boolean managed = true;
+
+ public NamingEndpoint(String hostName, int port, String jndiName) {
+ this.jndiName = jndiName;
+ this.locator = new EJBLocator(hostName, port);
+ }
+
+ public NamingEndpoint(String name) {
+
+ /**
+ * by default it's a managed environment means SCA composite with ref
+ * binding is running on an AppServer. If running on J2SE, pass
+ * -Dmanaged=false for the VM
+ */
+ final String managedEnv = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty("managed");
+ }
+ });
+
+ if (managedEnv != null) {
+ managed = Boolean.valueOf(managedEnv);
+ }
+
+ if ((!managed) && name.startsWith("corbaname:iiop:")) {
+ /**
+ * if (name.startsWith("corbaname:iiop:")) { corbaname:iiop:<hostName>:<port>/<root>#name
+ * For exmaple,
+ * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome";
+ */
+
+ String[] parts = split(name, '#');
+ if (parts.length != 2) {
+ throw new IllegalArgumentException("Invalid corbaname: " + name);
+ }
+
+ this.jndiName = parts[1]; // The logical jndi name
+ this.locator = new EJBLocator(parts[0], managed);
+
+ } else {
+ this.jndiName = name;
+ this.locator = new EJBLocator(managed);
+ }
+
+ }
+
+ private static String[] split(String str, char ch) {
+ int index = str.lastIndexOf(ch);
+ if (index == -1) {
+ return new String[] {str, ""};
+ } else {
+ return new String[] {str.substring(0, index), str.substring(index + 1)};
+ }
+ }
+
+ /**
+ * @return Returns the jndiName.
+ */
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public EJBLocator getLocator() {
+ return locator;
+ }
+
+ public String getCorbaname() {
+ return locator.getCorbaname(jndiName);
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof NamingEndpoint) {
+ NamingEndpoint endpoint = (NamingEndpoint)obj;
+ return jndiName.equals(endpoint.jndiName);
+ }
+ return false;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return jndiName.hashCode();
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return jndiName;
+ }
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/java/org/apache/tuscany/binding/ejb/util/NamingEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/java/org/apache/tuscany/binding/ejb/util/NamingEndpoint.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/resources/META-INF/sca/default.scdl?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/resources/META-INF/sca/default.scdl (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/resources/META-INF/sca/default.scdl Fri Feb 23 22:26:55 2007
@@ -0,0 +1,37 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT" name="org.apache.tuscany.binding.ejb">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services.bindings</group>
+ <name>ejb</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="ejb.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.ejb.EJBBindingLoader" />
+ </component>
+
+ <component name="ejb.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.ejb.EJBBindingBuilder" />
+ </component>
+
+</composite>
\ No newline at end of file
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/resources/META-INF/sca/extension.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/resources/META-INF/sca/extension.composite?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/resources/META-INF/sca/extension.composite (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/binding/src/main/resources/META-INF/sca/extension.composite Fri Feb 23 22:26:55 2007
@@ -0,0 +1,37 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT" name="org.apache.tuscany.binding.ejb">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services.bindings</group>
+ <name>ejb</name>
+ <version>1.0-incubator-M2-SNAPSHOT</version>
+ </dependency>
+
+ <component name="ejb.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.ejb.EJBBindingLoader" />
+ </component>
+
+ <component name="ejb.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.ejb.EJBBindingBuilder" />
+ </component>
+
+</composite>
\ No newline at end of file
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/pom.xml?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/pom.xml (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/pom.xml Fri Feb 23 22:26:55 2007
@@ -0,0 +1,66 @@
+<?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.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.ejb</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Extensions for EJB</name>
+
+ <profiles>
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>binding</module>
+ <module>samples</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <dependencyManagement>
+ <dependencies>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 23 22:26:55 2007
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/pom.xml?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/pom.xml (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/pom.xml Fri Feb 23 22:26:55 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *
+ * (C) Copyright IBM Corp. 2004, 2006 All Rights Reserved
+ *
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.ejb.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-ejb-reference</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany EJB reference binding Sample</name>
+ <description>uscany EJB reference binding Sample</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-test</artifactId>
+ <version>${scaImplVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.ejb</groupId>
+ <artifactId>tuscany-ejb</artifactId>
+ <version>${scaImplVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>account.AccountClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/readme.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/readme.txt?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/readme.txt (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/readme.txt Fri Feb 23 22:26:55 2007
@@ -0,0 +1,58 @@
+Tuscany - EJB Reference Binding Sample
+
+Overview:
+This is a Stateless Session Bean Reference binding sample. This sample demonstrates how SCA composite can invoke Stateless Session Bean.
+In this sample Stateless Session Bean is running on Geronimo application server.
+
+Location:
+This sample is located under samples\sca\ejb-reference
+
+Jar can be found under target sub-directory of the samples/sca/ejb-reference project, if you have downloaded the source and have built Tuscany
+Java SCA. This is also found under local Maven repository under org/apache/tuscany/samples/sca/ejb-reference
+
+Setup:
+Setup involves two steps.
+ 1) Install Geronimo and deploy Stateless EJB sample application
+ 2) Setup and run EJB reference binding sample in J2SE env. This readme outlines steps to run the sample inside Eclipse.
+
+Install Geronimo and deploy EJB sample application
+ 1) Download and install Geronimo application server
+ 2) Go to http://cwiki.apache.org/GMOxDOC11/ejb-sample-application.html#EJBsampleapplication-overview
+ 3) Follow all steps under sections
+ a) "Configuring, Building and Deploying the Sample Application
+ b) Make sure EJB is deployed and running correctly by following "Testing of the Sample Application" section.
+ Above steps will install sample bank EJB application on Geronimo.
+
+Setup for running EJB reference binding sample
+ 1) Run mvn -Peclipse eclipse:eclipse at the top level to create eclipse projects for all Tuscany projects.
+ 2) Import all projects into eclipse.
+ 3) Select sample-ejb-reference project from list of projects.
+ 4) Click on menu Run --> Run ... Run dialog box will be open.
+ 5) Create a new configuration for junit test case. Make sure the class is account.AccountTestCase and project is sample-ejb-reference
+ 5) Click on Arguments tab and enter VM arguments as below
+ -Dmanaged=false -Djava.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
+ -Djava.naming.provider.url=localhost:4201 -Djava.naming.security.principal=system -Djava.naming.security.credentials=manager
+ 6) Click on Classpath tab
+ 7) Add below jar under "Bootstrap Entries"
+ %GERONIMO_HOME%\repository\geronimo\geronimo-security\1.1.1\geronimo-security-1.1.1.jar
+ (GERONIMO_HOME is where Geronimo is installed.)
+ 8) Add below jars under "User entries"
+ a) %GERONIMO_HOME%\lib\geronimo-kernel-1.1.1.jar
+ b) %GERONIMO_HOME%\lib\geronimo-common-1.1.1.jar
+ c) %GERONIMO_HOME%\repository\openejb\openejb-core\2.1.1\openejb-core-2.1.1.jar
+ d) %GERONIMO_HOME%\repository\samples\Bank\1.0\Bank-1.0.car\BankEJB.jar. Or extract just home (BankManagerFacadeHome) and bean
+ interface (BankmanagerFacade) to include it the classpath. If the Reference interface in SCDL, is same as EJB interface, including EJB interface
+ is not needed. Including home class in the callers (composite with reference binding) classpath is needed if EJB is running Geronimo (openEJB).
+ This step (step d) ) is not needed if EJB is running on application servers like WebSphere.
+ 9) Click on "Run"
+
+Result:
+Composite invokes external Bank EJB which is running on Geronimo and prints out the current bank balance on the console.
+Message printed on console:
+ " In component implementation. Invoking external EJB through EJB reference binding
+ Balance amount for account 1234567890 is $xxxx.xx"
+
+
+
+
+
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/readme.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/AccountClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/AccountClient.java?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/AccountClient.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/AccountClient.java Fri Feb 23 22:26:55 2007
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package account;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This shows how to test ejb reference bidning sample in J2SE env
+ */
+
+public class AccountClient {
+
+ public static void main(String[] args) throws Exception {
+ CompositeContext context = CurrentCompositeContext.getContext();
+ Customer customer = (Customer)context.locateService(Customer.class, "CustomerComponent");
+ String accountNo = "1234567890"; // This is one of the customer
+ // numbers in bank application
+ // running on Geronimo
+ // invoke composite method
+ Double balance = customer.depositAmount(accountNo, new Double(100));
+ System.out.println("Balance amount for account " + accountNo + " is $" + balance);
+ }
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/AccountClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/AccountClient.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/BankManagerFacade.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/BankManagerFacade.java?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/BankManagerFacade.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/BankManagerFacade.java Fri Feb 23 22:26:55 2007
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+package account;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Compatible EJB interface
+ */
+@Remotable
+public interface BankManagerFacade {
+ public java.lang.Double getAccountBalance(java.lang.String accountNo);
+
+ public void changeAccountBalance(java.lang.String accountNo, java.lang.Double balance);
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/BankManagerFacade.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/BankManagerFacade.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/Customer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/Customer.java?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/Customer.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/Customer.java Fri Feb 23 22:26:55 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package account;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface Customer {
+
+ /**
+ * This method deposits the amount. method accesses external EJB to get the
+ * current balance and add the amount to existing balance.
+ *
+ * @param String amount to be deposited
+ * @return total amount in customer accound after deposit
+ */
+ Double depositAmount(java.lang.String accountNo, Double amount);
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/Customer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/Customer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/CustomerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/CustomerImpl.java?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/CustomerImpl.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/CustomerImpl.java Fri Feb 23 22:26:55 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+package account;
+
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(Customer.class)
+public class CustomerImpl implements Customer {
+
+ private BankManagerFacade extEJBService = null;
+
+ public BankManagerFacade getExtEJBService() {
+ return extEJBService;
+ }
+
+ @Reference
+ public void setExtEJBService(BankManagerFacade extEJBService) {
+ this.extEJBService = extEJBService;
+ }
+
+ // this method invokes external EJB through EJB reference binding
+ public Double depositAmount(java.lang.String accountNo, Double amount) {
+
+ Double total = null;
+
+ System.out.println("In component implementation. Invoking external EJB through EJB reference binding ");
+
+ try {
+ Double balance = extEJBService.getAccountBalance(accountNo); // invoke
+ // external
+ // ejb
+ // through
+ // ejb
+ // reference
+ // binding
+ total = balance + amount;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return total;
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/CustomerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/java/account/CustomerImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/resources/META-INF/sca/application.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/resources/META-INF/sca/application.composite?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/resources/META-INF/sca/application.composite (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/main/resources/META-INF/sca/application.composite Fri Feb 23 22:26:55 2007
@@ -0,0 +1,34 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:v="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" name="Account">
+
+ <!-- composite's component -->
+ <component name="CustomerComponent">
+ <implementation.java class="account.CustomerImpl" />
+ <reference name="extEJBService">AccountExtEJBService</reference>
+ </component>
+
+ <!-- composite refrence with ejb binding. Modify host and port number in uri attribute based on where you have installed target ResumeBank EJB -->
+ <reference name="AccountExtEJBService">
+ <interface.java interface="account.BankManagerFacade" />
+ <binding.ejb uri="corbaname:iiop:1.2@localhost:4201#ejb/BankManagerFacadeBean" />
+ </reference>
+</composite>
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/test/java/account/AccountTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/test/java/account/AccountTestCase.java?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/test/java/account/AccountTestCase.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/test/java/account/AccountTestCase.java Fri Feb 23 22:26:55 2007
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+package account;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import org.apache.tuscany.test.SCATestCase;
+
+import account.Customer;
+import account.AccountClient;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate
+ * Customer component which invokes external EJB through EJB reference binding
+ * invoke it.
+ */
+public class AccountTestCase extends SCATestCase {
+
+ Customer customer = null;
+
+ protected void setUp() throws Exception {
+ addExtension("ejb.binding", getClass().getClassLoader().getResource("META-INF/sca/extension.composite"));
+ super.setUp();
+
+ CompositeContext context = CurrentCompositeContext.getContext();
+ customer = context.locateService(Customer.class, "CustomerComponent");
+ }
+
+ public void test() throws Exception {
+ String accountNo = "1234567890"; // This is one of the customer
+ // numbers in bank application
+ // running on Geronimo
+ // invoke composite method
+ Double balance = customer.depositAmount(accountNo, new Double(100));
+ System.out.println("Balance amount for account " + accountNo + " is $" + balance);
+ }
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/test/java/account/AccountTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/ejb-reference/src/test/java/account/AccountTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/pom.xml?view=auto&rev=511225
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/pom.xml (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/pom.xml Fri Feb 23 22:26:55 2007
@@ -0,0 +1,129 @@
+<?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.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.ejb</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.ejb.samples</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Samples for the EJB extension</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>ejb-reference</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>test</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.ejb</groupId>
+ <artifactId>tuscany-ejb</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-test</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>standalone</artifactId>
+ <version>${scaImplVersion}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/distribution</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/ejb/samples/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org