You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2019/04/25 19:48:51 UTC

[tomee] 18/26: updates readme

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 36879bdf2a843688a32bac940eb74c7afdf28182
Author: Otavio Santana <ot...@gmail.com>
AuthorDate: Mon Feb 25 12:28:26 2019 -0300

    updates readme
---
 examples/ejb-remote-call-2/README.adoc | 81 +++++++++++++++++++++++++++++++---
 1 file changed, 74 insertions(+), 7 deletions(-)

diff --git a/examples/ejb-remote-call-2/README.adoc b/examples/ejb-remote-call-2/README.adoc
index 6edc8fd..09b8c04 100644
--- a/examples/ejb-remote-call-2/README.adoc
+++ b/examples/ejb-remote-call-2/README.adoc
@@ -8,20 +8,66 @@ title=EJB Remote Call 2
 ## Calculator
 
 
-@Stateless(name = "Calculator", description = "Calculator", mappedName = "Calculator")
-@Remote(Calculator.class)
-public class DefaultCalculator implements Calculator {
+public interface Greetings extends javax.ejb.SessionBean {
+
+    String morning(String name);
+
+    String afternoon(String name);
+
+    String hello(String input) throws GreetingsException;
+}
+
+
+public class DefaultGreetings implements Greetings {
+
+
     @Override
-    public int sum(int add1, int add2) {
-        return add1 + add2;
+    public String morning(String name) {
+        return "Good Morning: " + name;
     }
 
     @Override
-    public int multiply(int mul1, int mul2) {
-        return mul1 * mul2;
+    public String afternoon(String name) {
+        return "Good Afternoon: " + name;
     }
 
+    @Override
+    public String hello(final String input) throws GreetingsException {
+        if ("CHECKED".equals(input)) {
+            throw new GreetingsException("This is a checked exception");
+        }
+
+        if ("RUNTIME".equals(input)) {
+            throw new RuntimeException("This is a runtime exception");
+        }
+
+        if (input == null) {
+            return "Input was null";
+        }
+
+        return "Input was: " + input;
+    }
+
+
+    @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 {
+
+    }
 }
 
 ## web.xml
@@ -34,3 +80,24 @@ public class DefaultCalculator implements Calculator {
     
     </web-app>
     
+
+## ejb-jar.xml
+
+<?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>Greetings</ejb-name>
+            <mapped-name>ejb/Greetings</mapped-name>
+            <business-local>org.superbiz.remote.Greetings</business-local>
+            <business-remote>org.superbiz.remote.Greetings</business-remote>
+            <ejb-class>org.superbiz.remote.DefaultGreetings</ejb-class>
+            <session-type>Stateless</session-type>
+            <transaction-type>Container</transaction-type>
+        </session>
+    </enterprise-beans>
+</ejb-jar>