You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2011/12/21 15:28:40 UTC
svn commit: r1221740 - in /openejb/trunk/openejb/examples/simple-osgi: ./
simple-osgi-api/ simple-osgi-api/src/ simple-osgi-api/src/main/
simple-osgi-api/src/main/java/ simple-osgi-api/src/main/java/org/
simple-osgi-api/src/main/java/org/superbiz/ simp...
Author: jlmonteiro
Date: Wed Dec 21 14:28:39 2011
New Revision: 1221740
URL: http://svn.apache.org/viewvc?rev=1221740&view=rev
Log:
OPENEJB-1726 first draft to create an OSGi example
Added:
openejb/trunk/openejb/examples/simple-osgi/
openejb/trunk/openejb/examples/simple-osgi/pom.xml
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorLocal.java
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorRemote.java
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/
openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/CalculatorBean.java
Added: openejb/trunk/openejb/examples/simple-osgi/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/pom.xml?rev=1221740&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/pom.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/pom.xml Wed Dec 21 14:28:39 2011
@@ -0,0 +1,114 @@
+<?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 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>simple-osgi</artifactId>
+ <packaging>pom</packaging>
+ <version>1.1-SNAPSHOT</version>
+ <modules>
+ <module>simple-osgi-api</module>
+ <module>simple-osgi-core</module>
+ <module>simple-osgi-client</module>
+ </modules>
+ <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo</name>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.5</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <repositories>
+ <repository>
+ <id>apache-m2-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ </repository>
+ </repositories>
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>6.0-3-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--
+ The <scope>test</scope> guarantees that non of your runtime
+ code is dependent on any OpenEJB classes.
+ -->
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>4.0.0-beta-2-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <!--
+ 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>
+
Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml?rev=1221740&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml Wed Dec 21 14:28:39 2011
@@ -0,0 +1,51 @@
+<?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 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>
+ <parent>
+ <artifactId>simple-osgi</artifactId>
+ <groupId>org.superbiz</groupId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>simple-osgi-api</artifactId>
+ <packaging>bundle</packaging>
+ <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo :: API bundle</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorLocal.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorLocal.java?rev=1221740&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorLocal.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorLocal.java Wed Dec 21 14:28:39 2011
@@ -0,0 +1,32 @@
+/**
+ * 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.superbiz.osgi;
+
+import javax.ejb.Local;
+
+@Local
+public interface CalculatorLocal {
+ int add(int a, int b);
+
+ int subtract(int a, int b);
+
+ int multiply(int a, int b);
+
+ int divide(int a, int b);
+
+ int remainder(int a, int b);
+}
Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorRemote.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorRemote.java?rev=1221740&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorRemote.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorRemote.java Wed Dec 21 14:28:39 2011
@@ -0,0 +1,32 @@
+/**
+ * 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.superbiz.osgi;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface CalculatorRemote {
+ int add(int a, int b);
+
+ int subtract(int a, int b);
+
+ int multiply(int a, int b);
+
+ int divide(int a, int b);
+
+ int remainder(int a, int b);
+}
Added: 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-client/pom.xml?rev=1221740&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml Wed Dec 21 14:28:39 2011
@@ -0,0 +1,56 @@
+<?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 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>
+ <parent>
+ <artifactId>simple-osgi</artifactId>
+ <groupId>org.superbiz</groupId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>simple-osgi-client</artifactId>
+ <packaging>bundle</packaging>
+ <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo :: Client bundle</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Include-Resource>${pom.basedir}/src/main/resources</Include-Resource>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>simple-osgi-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml?rev=1221740&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml Wed Dec 21 14:28:39 2011
@@ -0,0 +1,53 @@
+<?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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:p="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
+
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="timer://foo?fixedRate=true&period=5s"/>
+ <setBody>
+ <constant>4</constant>
+ <constant>3</constant>
+ </setBody>
+ <to uri="ejb:CalculatorImplRemote?method=sum"/>
+ <log message=">>> Result : ${body}"/>
+ </route>
+ </camelContext>
+
+ <!-- setup Camel EJB component -->
+ <bean id="ejb" class="org.apache.camel.component.ejb.EjbComponent">
+ <property name="properties" ref="jndiProperties"/>
+ </bean>
+
+ <!-- use OpenEJB context factory -->
+ <p:properties id="jndiProperties">
+ <prop key="java.naming.factory.initial">org.apache.openejb.client.RemoteInitialContextFactory</prop>
+ <prop key="java.naming.provider.url">ejbd://127.0.0.1:4201</prop>
+ <prop key="java.naming.security.principal">daniel</prop>
+ <prop key="java.naming.security.credentials">password</prop>
+ </p:properties>
+
+
+</beans>
\ No newline at end of file
Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml?rev=1221740&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml Wed Dec 21 14:28:39 2011
@@ -0,0 +1,55 @@
+<?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 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>
+ <parent>
+ <artifactId>simple-osgi</artifactId>
+ <groupId>org.superbiz</groupId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>simple-osgi-core</artifactId>
+ <packaging>bundle</packaging>
+ <name>OpenEJB :: Examples :: Simple OSGi Stateless Pojo :: Core bundle</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <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>
+
+</project>
\ No newline at end of file
Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/CalculatorBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/CalculatorBean.java?rev=1221740&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/CalculatorBean.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/CalculatorBean.java Wed Dec 21 14:28:39 2011
@@ -0,0 +1,44 @@
+/**
+ * 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.superbiz.osgi;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class CalculatorBean implements CalculatorLocal, CalculatorRemote {
+
+ public int add(int a, int b) {
+ return a + b;
+ }
+
+ public int subtract(int a, int b) {
+ return a - b;
+ }
+
+ public int multiply(int a, int b) {
+ return a * b;
+ }
+
+ public int divide(int a, int b) {
+ return a / b;
+ }
+
+ public int remainder(int a, int b) {
+ return a % b;
+ }
+
+}
\ No newline at end of file