tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject [tomee] 03/10: creates adicional structure
Date Fri, 22 Feb 2019 14:48:56 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 898af3bf7ae1877aa2f59ea19c4b337af4707112
Author: Otavio Santana <otaviopolianasantana@gmail.com>
AuthorDate: Fri Feb 22 10:18:07 2019 -0300

    creates adicional structure
---
 examples/ejb-remote-call/README.md                 | 39 +++++++++
 examples/ejb-remote-call/client.pl                 | 34 ++++++++
 examples/ejb-remote-call/pom.xml                   | 98 ++++++++++++++++++++++
 .../src/main/java/org/superbiz/ws/App.java         | 23 +++++
 .../src/main/java/org/superbiz/ws/Calculator.java  | 26 ++++++
 .../java/org/superbiz/ws/DefaultCalculator.java    | 20 +++++
 .../src/main/webapp/WEB-INF/web.xml                | 27 ++++++
 7 files changed, 267 insertions(+)

diff --git a/examples/ejb-remote-call/README.md b/examples/ejb-remote-call/README.md
new file mode 100644
index 0000000..379925d
--- /dev/null
+++ b/examples/ejb-remote-call/README.md
@@ -0,0 +1,39 @@
+index-group=Misc
+type=page
+status=published
+title=EJB Remote Call
+~~~~~~
+
+*Help us document this example! Click the blue pencil icon in the upper right to edit this
page.*
+
+## Calculator
+
+    package org.superbiz.ws;
+    
+    import javax.ejb.Stateless;
+    import javax.jws.WebService;
+    
+    @Stateless
+    @WebService(portName = "CalculatorPort",
+            serviceName = "CalculatorWebService",
+            targetNamespace = "http://superbiz.org/wsdl")
+    public class Calculator {
+        public int sum(int add1, int add2) {
+            return add1 + add2;
+        }
+    
+        public int multiply(int mul1, int mul2) {
+            return mul1 * mul2;
+        }
+    }
+
+## web.xml
+
+    <web-app 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/web-app_2_5.xsd"
+             metadata-complete="false"
+             version="2.5">
+    
+    </web-app>
+    
diff --git a/examples/ejb-remote-call/client.pl b/examples/ejb-remote-call/client.pl
new file mode 100644
index 0000000..be0a632
--- /dev/null
+++ b/examples/ejb-remote-call/client.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/env perl -w
+#============================================================
+# 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.
+#============================================================
+
+use SOAP::Lite;
+
+my $namespace = 'http://superbiz.org/wsdl';
+
+my $service = SOAP::Lite-> uri($namespace) 
+    ->proxy('http://localhost:8080/Calculator') 
+    ->on_action (sub { return '' } ); 
+
+my $method = SOAP::Data->name("ns1:multiply") 
+    ->attr({'xmlns:ns1' => $namespace}); 
+
+my @params = (
+    SOAP::Data->name('arg0'=>3), 
+    SOAP::Data->name('arg1'=>4)); 
+
+print $service->call($method=>@params)->result; 
diff --git a/examples/ejb-remote-call/pom.xml b/examples/ejb-remote-call/pom.xml
new file mode 100644
index 0000000..f93fc57
--- /dev/null
+++ b/examples/ejb-remote-call/pom.xml
@@ -0,0 +1,98 @@
+<?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: 684173 $ $Date: 2008-08-08 20:13:24 -0700 (Fri, 08 Aug 2008) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.superbiz</groupId>
+    <artifactId>ejb-remote-call</artifactId>
+    <packaging>war</packaging>
+    <version>8.0.0-SNAPSHOT</version>
+    <name>OpenEJB :: Web Examples :: EJB Remote Call</name>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <repositories>
+        <repository>
+            <id>apache-m2-snapshot</id>
+            <name>Apache Snapshot Repository</name>
+            <url>https://repository.apache.org/content/groups/snapshots</url>
+        </repository>
+    </repositories>
+    <build>
+        <defaultGoal>install</defaultGoal>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.1.0</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.5.1</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tomee</groupId>
+            <artifactId>javaee-api</artifactId>
+            <version>8.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>openejb-client</artifactId>
+            <version>4.7.2</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <!--
+    This section allows you to configure where to publish libraries for sharing.
+    It is not required and may be deleted.  For more information see:
+    http://maven.apache.org/plugins/maven-deploy-plugin/
+    -->
+    <distributionManagement>
+        <repository>
+            <id>localhost</id>
+            <url>file://${basedir}/target/repo/</url>
+        </repository>
+        <snapshotRepository>
+            <id>localhost</id>
+            <url>file://${basedir}/target/snapshot-repo/</url>
+        </snapshotRepository>
+    </distributionManagement>
+</project>
diff --git a/examples/ejb-remote-call/src/main/java/org/superbiz/ws/App.java b/examples/ejb-remote-call/src/main/java/org/superbiz/ws/App.java
new file mode 100644
index 0000000..e3661bf
--- /dev/null
+++ b/examples/ejb-remote-call/src/main/java/org/superbiz/ws/App.java
@@ -0,0 +1,23 @@
+package org.superbiz.ws;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.Properties;
+
+public class App {
+
+    public static void main(String[] args) throws NamingException {
+        Properties properties = new Properties();
+        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+        properties.put(Context.PROVIDER_URL, "http://localhost:8080/tomee/ejb");
+
+        Context ctx = new InitialContext(properties);
+        Object ref = ctx.lookup("global/ejb_remote_call_war/Calculator!org.superbiz.ws.Calculator");
+
+        Calculator calculator = Calculator.class.cast(ref);
+        System.out.println(calculator.sum(1, 2));
+
+
+    }
+}
diff --git a/examples/ejb-remote-call/src/main/java/org/superbiz/ws/Calculator.java b/examples/ejb-remote-call/src/main/java/org/superbiz/ws/Calculator.java
new file mode 100644
index 0000000..176a856
--- /dev/null
+++ b/examples/ejb-remote-call/src/main/java/org/superbiz/ws/Calculator.java
@@ -0,0 +1,26 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.ws;
+
+public interface Calculator   {
+
+     int sum(int add1, int add2);
+
+    int multiply(int mul1, int mul2);
+
+}
+
diff --git a/examples/ejb-remote-call/src/main/java/org/superbiz/ws/DefaultCalculator.java
b/examples/ejb-remote-call/src/main/java/org/superbiz/ws/DefaultCalculator.java
new file mode 100644
index 0000000..49d9e8a
--- /dev/null
+++ b/examples/ejb-remote-call/src/main/java/org/superbiz/ws/DefaultCalculator.java
@@ -0,0 +1,20 @@
+package org.superbiz.ws;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+@Stateless(name = "Calculator", description = "Calculator", mappedName = "Calculator")
+@Remote(Calculator.class)
+public class DefaultCalculator implements Calculator {
+    @Override
+    public int sum(int add1, int add2) {
+        return add1 + add2;
+    }
+
+    @Override
+    public int multiply(int mul1, int mul2) {
+        return mul1 * mul2;
+    }
+
+
+}
diff --git a/examples/ejb-remote-call/src/main/webapp/WEB-INF/web.xml b/examples/ejb-remote-call/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..addbd2d
--- /dev/null
+++ b/examples/ejb-remote-call/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,27 @@
+<?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: 634170 $ $Date: 2008-03-05 21:30:10 -0800 (Wed, 05 Mar 2008) $ -->
+
+<web-app 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/web-app_2_5.xsd"
+         metadata-complete="false"
+         version="2.5">
+</web-app>


Mime
View raw message