You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2011/09/27 20:40:59 UTC

svn commit: r1176510 - in /openejb/trunk/openejb3/examples/webapps: ./ resources-declared-in-webapp/ resources-declared-in-webapp/src/ resources-declared-in-webapp/src/main/ resources-declared-in-webapp/src/main/java/ resources-declared-in-webapp/src/m...

Author: rmannibucau
Date: Tue Sep 27 18:40:58 2011
New Revision: 1176510

URL: http://svn.apache.org/viewvc?rev=1176510&view=rev
Log:
adding resources-declared-in-webapp example

Added:
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/README.md
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/pom.xml
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/bean/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/bean/Manager.java
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/resource/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/resource/ManagerResource.java
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/servlet/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/servlet/ManagerServlet.java
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/ejb-jar.xml
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/openejb.xml
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/org.superbiz/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/org.superbiz/service-jar.xml
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/tomcat/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/tomcat/conf/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/tomcat/conf/logging.properties
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/webapp/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/webapp/WEB-INF/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/webapp/WEB-INF/web.xml
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/test/
    openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/test/java/
Modified:
    openejb/trunk/openejb3/examples/webapps/pom.xml

Modified: openejb/trunk/openejb3/examples/webapps/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/pom.xml?rev=1176510&r1=1176509&r2=1176510&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/pom.xml (original)
+++ openejb/trunk/openejb3/examples/webapps/pom.xml Tue Sep 27 18:40:58 2011
@@ -35,6 +35,7 @@
     <module>struts</module>
     <module>moviefun</module>
     <module>rest-example</module>
+    <module>resources-declared-in-webapp</module>
   </modules>
 
   <!--

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/README.md?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/README.md (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/README.md Tue Sep 27 18:40:58 2011
@@ -0,0 +1,7 @@
+
+
+run the command:
+$ mvn clean install t7:run
+
+then go to http://localhost:1234/resources-declared-in-webapp-1.1-SNAPSHOT/
+

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/pom.xml?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/pom.xml (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/pom.xml Tue Sep 27 18:40:58 2011
@@ -0,0 +1,108 @@
+<?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>resources-declared-in-webapp</artifactId>
+  <packaging>war</packaging>
+  <version>1.1-SNAPSHOT</version>
+  <name>OpenEJB :: Web Examples :: Resource Declared In A Webapp</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <openejb.version>4.0.0-beta-1-SNAPSHOT</openejb.version>
+  </properties>
+
+  <repositories>
+    <repository>
+      <id>apache-m2-snapshot</id>
+      <name>Apache Snapshot Repository</name>
+      <url>http://repository.apache.org/snapshots</url>
+    </repository>
+    <repository>
+      <id>tomcat-m2-repo</id>
+      <name>Tomcat Dev Repository</name>
+      <url>http://tomcat.apache.org/dev/dist/m2-repository/</url>
+    </repository>
+  </repositories>
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache-m2-snapshot</id>
+      <name>Apache Snapshot Repository</name>
+      <url>http://repository.apache.org/snapshots</url>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <build>
+    <defaultGoal>package</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>
+      <plugin>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>2.1.1</version>
+        <configuration>
+          <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>com.googlecode.t7mp</groupId>
+        <artifactId>maven-t7-plugin</artifactId>
+        <version>0.9.7</version>
+        <configuration>
+          <tomcatHttpPort>1234</tomcatHttpPort>
+          <tomcatShutdownPort>13245</tomcatShutdownPort>
+          <tomcatVersion>7.0.21</tomcatVersion>
+          <libs>
+            <jarArtifact>
+              <groupId>org.apache.openejb</groupId>
+              <artifactId>openejb-logging</artifactId>
+              <version>${openejb.version}</version>
+            </jarArtifact>
+          </libs>
+          <webapps>
+            <webappArtifact>
+              <groupId>org.apache.openejb</groupId>
+              <artifactId>openejb-tomcat-plus-webapp</artifactId>
+              <version>${openejb.version}</version>
+              <contextPath>openejb</contextPath>
+            </webappArtifact>
+          </webapps>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>javaee-api</artifactId>
+      <version>6.0-2-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/bean/Manager.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/bean/Manager.java?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/bean/Manager.java (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/bean/Manager.java Tue Sep 27 18:40:58 2011
@@ -0,0 +1,34 @@
+/*
+ *     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.bean;
+
+import org.superbiz.resource.ManagerResource;
+
+import javax.annotation.Resource;
+import javax.ejb.Singleton;
+
+/**
+ * @author rmannibucau
+ */
+@Singleton
+public class Manager {
+    @Resource(name = "My Manager Team", type = ManagerResource.class) private ManagerResource resource;
+
+    public String work() {
+        return "manage a resource of type " + resource.resourceType();
+    }
+}

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/resource/ManagerResource.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/resource/ManagerResource.java?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/resource/ManagerResource.java (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/resource/ManagerResource.java Tue Sep 27 18:40:58 2011
@@ -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
+ *
+ *        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.resource;
+
+/**
+ * @author rmannibucau
+ */
+public class ManagerResource {
+    public String resourceType() {
+        return "team";
+    }
+}

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/servlet/ManagerServlet.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/servlet/ManagerServlet.java?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/servlet/ManagerServlet.java (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/java/org/superbiz/servlet/ManagerServlet.java Tue Sep 27 18:40:58 2011
@@ -0,0 +1,39 @@
+/*
+ * 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.servlet;
+
+import org.superbiz.bean.Manager;
+
+import javax.ejb.EJB;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author rmannibucau
+ */
+@WebServlet(name = "manager servlet", urlPatterns = "/")
+public class ManagerServlet extends HttpServlet {
+    @EJB private Manager manager;
+
+    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        resp.getOutputStream().print(manager.work());
+    }
+}

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/ejb-jar.xml?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/ejb-jar.xml (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/ejb-jar.xml Tue Sep 27 18:40:58 2011
@@ -0,0 +1,18 @@
+<?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.
+-->
+<ejb-jar />

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/openejb.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/openejb.xml?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/openejb.xml (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/openejb.xml Tue Sep 27 18:40:58 2011
@@ -0,0 +1,21 @@
+<?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.
+-->
+<openejb>
+  <Resource id="My Manager Team" type="org.superbiz.resource.ManagerResource" provider="org.superbiz#ManagerResource" />
+</openejb>

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/org.superbiz/service-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/org.superbiz/service-jar.xml?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/org.superbiz/service-jar.xml (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/resources/META-INF/org.superbiz/service-jar.xml Tue Sep 27 18:40:58 2011
@@ -0,0 +1,25 @@
+<?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$ -->
+<ServiceJar>
+  <ServiceProvider id="ManagerResource" service="Resource"
+           type="org.superbiz.resource.ManagerResource"
+           class-name="org.superbiz.resource.ManagerResource" />
+</ServiceJar>

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/tomcat/conf/logging.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/tomcat/conf/logging.properties?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/tomcat/conf/logging.properties (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/tomcat/conf/logging.properties Tue Sep 27 18:40:58 2011
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2010 Joerg Bellmann <jo...@googlemail.com>
+#
+# Licensed 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.
+#
+
+#
+# OpenEJB logs
+#
+log4j.rootLogger = INFO, stdout
+log4j.appender.stdout = org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout = org.apache.openejb.logging.SimpleJULLikeLayout

Added: openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/webapp/WEB-INF/web.xml?rev=1176510&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/webapp/WEB-INF/web.xml (added)
+++ openejb/trunk/openejb3/examples/webapps/resources-declared-in-webapp/src/main/webapp/WEB-INF/web.xml Tue Sep 27 18:40:58 2011
@@ -0,0 +1,20 @@
+<?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.
+-->
+<web-app version="3.0" 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_3_0.xsd" />