geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viol...@apache.org
Subject svn commit: r1084118 - in /geronimo/samples/trunk/samples/osgi: ./ wab-sample/ wab-sample/src/ wab-sample/src/main/ wab-sample/src/main/java/ wab-sample/src/main/java/org/ wab-sample/src/main/java/org/apache/ wab-sample/src/main/java/org/apache/geronim...
Date Tue, 22 Mar 2011 09:50:34 GMT
Author: violalu
Date: Tue Mar 22 09:50:34 2011
New Revision: 1084118

URL: http://svn.apache.org/viewvc?rev=1084118&view=rev
Log:
GERONIMO-5875 add standalone wab samples

Added:
    geronimo/samples/trunk/samples/osgi/wab-sample/
    geronimo/samples/trunk/samples/osgi/wab-sample/pom.xml
    geronimo/samples/trunk/samples/osgi/wab-sample/src/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/geronimo/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/geronimo/samples/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/geronimo/samples/wab/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/geronimo/samples/wab/WABServlet.java
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/resources/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/resources/WEB-INF/
    geronimo/samples/trunk/samples/osgi/wab-sample/src/main/resources/WEB-INF/web.xml
Modified:
    geronimo/samples/trunk/samples/osgi/pom.xml

Modified: geronimo/samples/trunk/samples/osgi/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/osgi/pom.xml?rev=1084118&r1=1084117&r2=1084118&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/osgi/pom.xml (original)
+++ geronimo/samples/trunk/samples/osgi/pom.xml Tue Mar 22 09:50:34 2011
@@ -16,10 +16,7 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
--->
-<!-- $Rev$ $Date$ -->
-
-<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">
+--><!-- $Rev$ $Date$ --><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>
         <groupId>org.apache.geronimo.samples</groupId>
@@ -110,6 +107,7 @@
             <modules>
                 <module>aries-datasource</module>
                 <module>showmethemoney</module>
+                <module>wab-sample</module>
                 <!--<module>ariestrader-jdbc</module>-->
             </modules>
         </profile>
@@ -127,5 +125,5 @@
             </modules>
         </profile>
         
-    </profiles>   
-</project>
+    </profiles>
+</project>
\ No newline at end of file

Added: geronimo/samples/trunk/samples/osgi/wab-sample/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/osgi/wab-sample/pom.xml?rev=1084118&view=auto
==============================================================================
--- geronimo/samples/trunk/samples/osgi/wab-sample/pom.xml (added)
+++ geronimo/samples/trunk/samples/osgi/wab-sample/pom.xml Tue Mar 22 09:50:34 2011
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <parent>
+    <artifactId>osgi</artifactId>
+    <groupId>org.apache.geronimo.samples</groupId>
+    <version>3.0-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>wab-sample</artifactId>
+  
+  <name>Geronimo Samples :: OSGI Sample :: wab-sample</name>
+  
+  <packaging>bundle</packaging>
+  
+  <description>
+        Geronimo Samples :: OSGI Sample :: Standalone WAB sample
+    </description>
+ 
+ <dependencies>
+     <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>       
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>        
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Web-ContextPath>/wab</Web-ContextPath>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Private-Package>org.apache.geronimo.samples.wab</Private-Package>
+                        <Export-Package>!org.apache.geronimo.samples.wab</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>    
+</project>

Added: geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/geronimo/samples/wab/WABServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/geronimo/samples/wab/WABServlet.java?rev=1084118&view=auto
==============================================================================
--- geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/geronimo/samples/wab/WABServlet.java
(added)
+++ geronimo/samples/trunk/samples/osgi/wab-sample/src/main/java/org/apache/geronimo/samples/wab/WABServlet.java
Tue Mar 22 09:50:34 2011
@@ -0,0 +1,73 @@
+/**
+ *  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.apache.geronimo.samples.wab;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+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 org.osgi.framework.BundleContext;
+
+//@WebServlet("/wabservlet")
+public class WABServlet extends HttpServlet
+{
+    private ServletContext sc;
+    private BundleContext bundleContext;
+    
+    
+    /**
+     * @see Servlet#init(ServletConfig)
+     */
+    public void init(ServletConfig config) throws ServletException {
+       sc = config.getServletContext();       
+    }
+    
+    /**
+     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
+     */
+    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
+        performTask(request, response);
+    }
+
+    /**
+     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
+        performTask(request, response);
+    }
+    
+    protected void performTask(HttpServletRequest request, HttpServletResponse response){
+        PrintWriter pw = null;
+        try {
+           pw = response.getWriter();
+           bundleContext = (BundleContext) sc.getAttribute("osgi-bundlecontext");
+           pw.println("Current wab id: " + bundleContext.getBundle().getBundleId() + "\n"
+ "wab symbolic name : " + bundleContext.getBundle().getSymbolicName() + "\n" + "wab version
:" + bundleContext.getBundle().getVersion() +"\n");
+           
+        } catch (IOException io){
+            
+        }
+    }
+   
+}

Added: geronimo/samples/trunk/samples/osgi/wab-sample/src/main/resources/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/osgi/wab-sample/src/main/resources/WEB-INF/web.xml?rev=1084118&view=auto
==============================================================================
--- geronimo/samples/trunk/samples/osgi/wab-sample/src/main/resources/WEB-INF/web.xml (added)
+++ geronimo/samples/trunk/samples/osgi/wab-sample/src/main/resources/WEB-INF/web.xml Tue
Mar 22 09:50:34 2011
@@ -0,0 +1,38 @@
+<?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 xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
+    metadata-complete="true">
+
+       <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+        <welcome-file>index.htm</welcome-file>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+    
+    <servlet>
+        <display-name>WABServlet</display-name>
+        <servlet-name>WABServlet</servlet-name>
+        <servlet-class>org.apache.geronimo.samples.wab.WABServlet</servlet-class>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>WABServlet</servlet-name>
+        <url-pattern>/WABServlet</url-pattern>
+       
+    </servlet-mapping>
+</web-app>



Mime
View raw message