tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1222439 - in /openejb/trunk/openejb/examples/simple-osgi: ./ simple-osgi-camel-client/ simple-osgi-client/ simple-osgi-local-lookup-client/ simple-osgi-local-lookup-client/src/ simple-osgi-local-lookup-client/src/main/ simple-osgi-local-lo...
Date Thu, 22 Dec 2011 20:41:48 GMT
Author: rmannibucau
Date: Thu Dec 22 20:41:47 2011
New Revision: 1222439

URL: http://svn.apache.org/viewvc?rev=1222439&view=rev
Log:
updating the osgi simple example with another bundle as client and with a remote client

Added:
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-camel-client/
      - copied from r1222314, openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-camel-client/pom.xml
      - copied, changed from r1222416, openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/pom.xml
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/superbiz/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/superbiz/calculator/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/superbiz/calculator/lookupclient/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/superbiz/calculator/lookupclient/SingletonCalculatorClient.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/pom.xml
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/org/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/org/superbiz/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/org/superbiz/calculator/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/org/superbiz/calculator/RemoteClientMain.java
Removed:
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/
Modified:
    openejb/trunk/openejb/examples/simple-osgi/pom.xml

Modified: openejb/trunk/openejb/examples/simple-osgi/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/pom.xml?rev=1222439&r1=1222438&r2=1222439&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/pom.xml (original)
+++ openejb/trunk/openejb/examples/simple-osgi/pom.xml Thu Dec 22 20:41:47 2011
@@ -28,7 +28,9 @@
   <modules>
     <module>simple-osgi-api</module>
     <module>simple-osgi-core</module>
-    <module>simple-osgi-client</module>
+    <module>simple-osgi-camel-client</module>
+    <module>simple-osgi-remote-client</module>
+    <module>simple-osgi-local-lookup-client</module>
   </modules>
   <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo</name>
   <properties>

Copied: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-camel-client/pom.xml (from
r1222416, openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml)
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-camel-client/pom.xml?p2=openejb/trunk/openejb/examples/simple-osgi/simple-osgi-camel-client/pom.xml&p1=openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml&r1=1222416&r2=1222439&rev=1222439&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml (original)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-camel-client/pom.xml Thu Dec 22
20:41:47 2011
@@ -27,9 +27,9 @@
     <version>1.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>simple-osgi-client</artifactId>
+  <artifactId>simple-osgi-camel-client</artifactId>
   <packaging>bundle</packaging>
-  <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo :: Client bundle</name>
+  <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo :: Camel Client</name>
 
   <build>
     <plugins>
@@ -56,16 +56,18 @@
       <artifactId>simple-osgi-api</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency> <!-- just to keep in mind camel and camel-osgi should be installed
-->
+
+    <!-- just to keep in mind camel and spring should be installed -->
+    <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
       <version>2.8.3</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.springframework.osgi</groupId>
-      <artifactId>spring-osgi-core</artifactId>
-      <version>1.2.1</version>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>3.0.3.RELEASE</version>
       <scope>provided</scope>
     </dependency>
   </dependencies>

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/pom.xml?rev=1222439&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/pom.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/pom.xml Thu
Dec 22 20:41:47 2011
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>simple-osgi</artifactId>
+    <groupId>org.superbiz</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>simple-osgi-local-lookup-client</artifactId>
+  <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo :: Local Lookup Client</name>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <!-- using scope compile to simplify the exec plugin usage -->
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>javaee-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>simple-osgi-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Import-Package>*</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/superbiz/calculator/lookupclient/SingletonCalculatorClient.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/superbiz/calculator/lookupclient/SingletonCalculatorClient.java?rev=1222439&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/superbiz/calculator/lookupclient/SingletonCalculatorClient.java
(added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-local-lookup-client/src/main/java/org/superbiz/calculator/lookupclient/SingletonCalculatorClient.java
Thu Dec 22 20:41:47 2011
@@ -0,0 +1,47 @@
+package org.superbiz.calculator.lookupclient;
+
+import org.superbiz.osgi.calculator.CalculatorLocal;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.Properties;
+
+@Singleton
+@Startup
+public class SingletonCalculatorClient {
+    @EJB
+    private CalculatorLocal calculator;
+
+    @PostConstruct
+    public void logInit() {
+        System.out.println();
+        checkCalculator();
+        tryLookup();
+        System.out.println();
+    }
+
+    private void tryLookup() {
+        Properties p = new Properties();
+        p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.localclient.LocalInitialContextFactory");
+        try {
+            Context ctx = new InitialContext(p);
+            CalculatorLocal local = (CalculatorLocal) ctx.lookup("CalculatorBeanLocal");
+            System.out.println("lookup OK: " + local.sayHello());
+        } catch (NamingException e) {
+            System.out.println("can't lookup bean: " + e.getMessage());
+        }
+    }
+
+    private void checkCalculator() {
+        if (calculator == null) {
+            System.out.println(calculator + " is null -> FAILED!");
+        } else {
+            System.out.println("calculator OK: " + calculator.sayHello());
+        }
+    }
+}

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/pom.xml?rev=1222439&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/pom.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/pom.xml Thu Dec 22
20:41:47 2011
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>simple-osgi</artifactId>
+    <groupId>org.superbiz</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>simple-osgi-remote-client</artifactId>
+  <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo :: Remote Client</name>
+
+  <dependencies>
+    <!-- using scope compile to simplify the exec plugin usage -->
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>javaee-api</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-client</artifactId>
+      <version>4.0.0-beta-2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>simple-osgi-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2.1</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>java</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <mainClass>org.superbiz.calculator.RemoteClientMain</mainClass>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/org/superbiz/calculator/RemoteClientMain.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/org/superbiz/calculator/RemoteClientMain.java?rev=1222439&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/org/superbiz/calculator/RemoteClientMain.java
(added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-remote-client/src/main/java/org/superbiz/calculator/RemoteClientMain.java
Thu Dec 22 20:41:47 2011
@@ -0,0 +1,22 @@
+package org.superbiz.calculator;
+
+import org.superbiz.osgi.calculator.CalculatorRemote;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Properties;
+
+public final class RemoteClientMain {
+    private RemoteClientMain() {
+        // no-op
+    }
+
+    public static void main(String[] args) throws Exception {
+        final Properties properties = new Properties();
+        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+        properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:4201");
+        Context remoteContext = new InitialContext(properties);
+        CalculatorRemote calculator = (CalculatorRemote) remoteContext.lookup("CalculatorBeanRemote");
+        System.out.println("Server answered: " + calculator.sayHello());
+    }
+}



Mime
View raw message