This is an automated email from the ASF dual-hosted git repository.

jgallimore pushed a commit to branch tomee-1.7.x
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 114c8d52470c71135e2b81f327cccf4315b47f1e
Author: Otavio Santana <[email protected]>
AuthorDate: Mon Feb 25 11:58:30 2019 -0300

    downgrade the code to EJB 2.0
---
 examples/ejb-remote-call-2/README.adoc              |  2 +-
 .../main/java/org/superbiz/remote/Calculator.java   |  4 ++--
 .../java/org/superbiz/remote/DefaultCalculator.java | 21 +++++++++++++++++++++
 .../src/main/webapp/WEB-INF/ejb-jar.xml             | 18 ++++++++++++++++++
 .../src/test/java/org/superbiz/remote/App.java      |  2 +-
 5 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/examples/ejb-remote-call-2/README.adoc 
b/examples/ejb-remote-call-2/README.adoc
index 752d7d9..6edc8fd 100644
--- a/examples/ejb-remote-call-2/README.adoc
+++ b/examples/ejb-remote-call-2/README.adoc
@@ -1,7 +1,7 @@
 :index-group: Misc
 :jbake-type: page
 :jbake-status: published
-title=EJB Remote Call
+title=EJB Remote Call 2
 ~~~~~~
 
 
diff --git 
a/examples/ejb-remote-call-2/src/main/java/org/superbiz/remote/Calculator.java 
b/examples/ejb-remote-call-2/src/main/java/org/superbiz/remote/Calculator.java
index c238b9b..aa10279 100644
--- 
a/examples/ejb-remote-call-2/src/main/java/org/superbiz/remote/Calculator.java
+++ 
b/examples/ejb-remote-call-2/src/main/java/org/superbiz/remote/Calculator.java
@@ -16,9 +16,9 @@
  */
 package org.superbiz.remote;
 
-public interface Calculator   {
+public interface Calculator extends javax.ejb.SessionBean {
 
-     int sum(int add1, int add2);
+    int sum(int add1, int add2);
 
     int multiply(int mul1, int mul2);
 
diff --git 
a/examples/ejb-remote-call-2/src/main/java/org/superbiz/remote/DefaultCalculator.java
 
b/examples/ejb-remote-call-2/src/main/java/org/superbiz/remote/DefaultCalculator.java
index a030188..6a8dc83 100644
--- 
a/examples/ejb-remote-call-2/src/main/java/org/superbiz/remote/DefaultCalculator.java
+++ 
b/examples/ejb-remote-call-2/src/main/java/org/superbiz/remote/DefaultCalculator.java
@@ -16,8 +16,11 @@
  */
 package org.superbiz.remote;
 
+import javax.ejb.EJBException;
 import javax.ejb.Remote;
+import javax.ejb.SessionContext;
 import javax.ejb.Stateless;
+import java.rmi.RemoteException;
 
 @Stateless(name = "Calculator", description = "Calculator", mappedName = 
"Calculator")
 @Remote(Calculator.class)
@@ -50,5 +53,23 @@ public class DefaultCalculator implements Calculator {
     }
 
 
+    @Override
+    public void ejbActivate() throws EJBException, RemoteException {
+
+    }
+
+    @Override
+    public void ejbPassivate() throws EJBException, RemoteException {
+
+    }
 
+    @Override
+    public void ejbRemove() throws EJBException, RemoteException {
+
+    }
+
+    @Override
+    public void setSessionContext(SessionContext ctx) throws EJBException, 
RemoteException {
+
+    }
 }
diff --git a/examples/ejb-remote-call-2/src/main/webapp/WEB-INF/ejb-jar.xml 
b/examples/ejb-remote-call-2/src/main/webapp/WEB-INF/ejb-jar.xml
new file mode 100644
index 0000000..1b9a8ae
--- /dev/null
+++ b/examples/ejb-remote-call-2/src/main/webapp/WEB-INF/ejb-jar.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                 http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd";
+         version="3.0">
+    <enterprise-beans>
+        <session>
+            <ejb-name>Calculator</ejb-name>
+            <mapped-name>ejb/Calculator</mapped-name>
+            <business-local>org.superbiz.remote.Calculator</business-local>
+            <business-remote>org.superbiz.remote.Calculator</business-remote>
+            <ejb-class>org.superbiz.remote.DefaultCalculator</ejb-class>
+            <session-type>Stateless</session-type>
+            <transaction-type>Container</transaction-type>
+        </session>
+    </enterprise-beans>
+</ejb-jar>
diff --git 
a/examples/ejb-remote-call-2/src/test/java/org/superbiz/remote/App.java 
b/examples/ejb-remote-call-2/src/test/java/org/superbiz/remote/App.java
index b60ce0f..9998237 100644
--- a/examples/ejb-remote-call-2/src/test/java/org/superbiz/remote/App.java
+++ b/examples/ejb-remote-call-2/src/test/java/org/superbiz/remote/App.java
@@ -29,7 +29,7 @@ public class App {
         properties.put(Context.PROVIDER_URL, 
"http://localhost:8080/tomee/ejb";);
 
         Context ctx = new InitialContext(properties);
-        Object ref = 
ctx.lookup("global/ejb-remote-call-8.0.0-SNAPSHOT/Calculator!org.superbiz.remote.Calculator");
+        Object ref = 
ctx.lookup("global/ejb_remote_call_war/Calculator!org.superbiz.remote.Calculator");
 
         Calculator calculator = Calculator.class.cast(ref);
         System.out.println(calculator.sum(1, 2));

Reply via email to