incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r609964 - in /incubator/sling/trunk/usling: usling-servlets/ usling-servlets/src/ usling-servlets/src/main/ usling-servlets/src/main/java/ usling-servlets/src/main/java/org/ usling-servlets/src/main/java/org/apache/ usling-servlets/src/main...
Date Tue, 08 Jan 2008 13:16:45 GMT
Author: bdelacretaz
Date: Tue Jan  8 05:16:38 2008
New Revision: 609964

URL: http://svn.apache.org/viewvc?rev=609964&view=rev
Log:
SLING-149 - usling-servlets module added, OSGi bundle meant for usling standard servlets

Added:
    incubator/sling/trunk/usling/usling-servlets/
    incubator/sling/trunk/usling/usling-servlets/pom.xml   (with props)
    incubator/sling/trunk/usling/usling-servlets/src/
    incubator/sling/trunk/usling/usling-servlets/src/main/
    incubator/sling/trunk/usling/usling-servlets/src/main/java/
    incubator/sling/trunk/usling/usling-servlets/src/main/java/org/
    incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/
    incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/
    incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/
    incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/
    incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java
  (with props)
    incubator/sling/trunk/usling/usling-servlets/src/main/resources/
    incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/
    incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/
    incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties
  (with props)
Modified:
    incubator/sling/trunk/usling/usling-webapp/   (props changed)
    incubator/sling/trunk/usling/usling-webapp/pom.xml

Added: incubator/sling/trunk/usling/usling-servlets/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-servlets/pom.xml?rev=609964&view=auto
==============================================================================
--- incubator/sling/trunk/usling/usling-servlets/pom.xml (added)
+++ incubator/sling/trunk/usling/usling-servlets/pom.xml Tue Jan  8 05:16:38 2008
@@ -0,0 +1,78 @@
+<?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>
+    <groupId>org.apache.sling</groupId>
+    <artifactId>sling</artifactId>
+    <version>1-incubator-SNAPSHOT</version>
+    <relativePath>../../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>org.apache.sling.usling.servlets</artifactId>
+  <packaging>bundle</packaging>
+  <version>2.0.0-incubator-SNAPSHOT</version>
+
+  <name>µsling Web Application</name>
+  <description>The µsling servlets implement the standard µsling behaviour. See
SLING-149.</description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/usling/usling-servlets</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/usling/usling-servlets</developerConnection>
+    <url>http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-servlets</url>
+  </scm>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-scr-plugin</artifactId>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Private-Package>org.apache.sling.usling.servlets.*</Private-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi_R4_core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi_R4_compendium</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>

Propchange: incubator/sling/trunk/usling/usling-servlets/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java?rev=609964&view=auto
==============================================================================
--- incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java
(added)
+++ incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java
Tue Jan  8 05:16:38 2008
@@ -0,0 +1,95 @@
+package org.apache.sling.usling.servlets;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.Dictionary;
+
+import javax.servlet.GenericServlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.log.LogService;
+
+/** usling main servlet
+ * 
+ * @scr.component immediate="true" 
+ *      label="%UslingMainServlet.name"
+ *      description="%UslingMainServlet.description"
+ * @scr.property name="service.vendor" value="The Apache Software Foundation"
+ * @scr.property name="service.description" value="usling main servlet"
+ * 
+ */
+public class UslingMainServlet extends GenericServlet {
+
+    private static final long serialVersionUID = 6895263078698789849L;
+
+    /**
+     *  HttpService, provided by OSGi, with which we register
+     *  this servlet.
+     *   
+     * @scr.reference
+     */
+    private HttpService httpService;
+    
+    /**
+     * OSGi LogService
+     * @scr.reference
+     */
+    private LogService logService;
+    
+    /**
+     * @scr.property value="/"
+     */
+    private static final String PROP_SERVLET_MOUNT_POINT = "servlet.mount.point";
+    private String mountPoint;
+
+    /** Process a servlet request */
+    public void service(ServletRequest sReq, ServletResponse sResp)
+            throws ServletException, IOException {
+
+        final HttpServletRequest req = (HttpServletRequest) sReq;
+        final HttpServletResponse resp = (HttpServletResponse) sResp;
+        
+        resp.setContentType("text/plain");
+        String msg = getClass().getName() + " - this Servlet does nothing useful yet";
+        msg += " - it is now " + new Date();
+        resp.getOutputStream().write(msg.getBytes());
+        resp.getOutputStream().flush();
+    }
+    
+    /** Called by OSGi to activate this service */
+    protected void activate(ComponentContext context) throws Exception {
+        final Dictionary<String, Object> config = context.getProperties();
+        mountPoint = getProperty(config, PROP_SERVLET_MOUNT_POINT, "/");
+        logService.log(LogService.LOG_INFO, "Registering " + getClass().getSimpleName() +
" on mount point " + mountPoint);
+        httpService.registerServlet(mountPoint, this, config, null);
+    }
+    
+    /** Called by OSGi to deactivate this service */
+    protected void deactivate(ComponentContext context) throws Exception {
+        logService.log(LogService.LOG_INFO, "Unregistering " + getClass().getSimpleName()
+ " from mount point " + mountPoint);
+        httpService.unregister(mountPoint);
+    }
+    
+    /**
+     * Returns the named property from the given configuration, or
+     * def if the value does not exist.
+     */
+    private String getProperty(Dictionary<String, Object> config, String name, String
def) {
+        final Object value = config.get(name);
+        if (value instanceof String) {
+            return (String) value;
+        }
+
+        if (value == null) {
+            return def;
+        }
+
+        return String.valueOf(value);
+    }
+}

Propchange: incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=609964&view=auto
==============================================================================
--- incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties
(added)
+++ incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties
Tue Jan  8 05:16:38 2008
@@ -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.
+#
+
+#
+# This file contains localization strings for configuration labels and
+# descriptions as used in the metatype.xml descriptor generated by the
+# the Sling SCR plugin
+
+UslingMainServlet.name = µsling main servlet
+UslingMainServlet.description = Routes HTTP request to the µsling default servlets  
\ No newline at end of file

Propchange: incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/usling/usling-webapp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan  8 05:16:38 2008
@@ -3,3 +3,4 @@
 .classpath
 sling
 target
+.externalToolBuilders

Modified: incubator/sling/trunk/usling/usling-webapp/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-webapp/pom.xml?rev=609964&r1=609963&r2=609964&view=diff
==============================================================================
--- incubator/sling/trunk/usling/usling-webapp/pom.xml (original)
+++ incubator/sling/trunk/usling/usling-webapp/pom.xml Tue Jan  8 05:16:38 2008
@@ -57,7 +57,23 @@
 
   <build>
     <plugins>
-      <plugin>
+
+    <plugin>
+      <!-- 
+        The clean plugin deletes the sling work directory as well,
+        to avoid confusion with leftovers from previous runs
+      -->
+      <artifactId>maven-clean-plugin</artifactId>
+      <configuration>
+        <filesets>
+          <fileset>
+            <directory>sling</directory>
+          </fileset>
+        </filesets>
+      </configuration>
+    </plugin>
+
+    <plugin>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>maven-jetty-plugin</artifactId>
         <version>6.1.5</version>
@@ -81,12 +97,12 @@
         </configuration>
       </plugin>
 
-      <!-- Unpack the sling-app launcher for inclusion in the web app -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <executions>
           <execution>
+            <!-- Unpack the sling-app launcher for inclusion in the web app -->
             <id>unpack-dependencies</id>
             <goals>
               <goal>unpack-dependencies</goal>
@@ -99,6 +115,20 @@
               <overWriteSnapshots>true</overWriteSnapshots>
             </configuration>
           </execution>
+          <execution>
+            <!-- Copy bundles that must be initially installed to WEB-INF/resources/bundles
-->
+            <id>copy-dependencies</id>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/resources/bundles</outputDirectory>
+              <excludeTransitive>true</excludeTransitive>
+              
+              <!-- List artifact names of bundles to install here -->
+              <includeArtifactIds>org.apache.sling.usling.servlets</includeArtifactIds>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
 
@@ -139,6 +169,7 @@
           </webResources>
         </configuration>
       </plugin>
+      
     </plugins>
   </build>
 
@@ -170,7 +201,6 @@
       <artifactId>org.apache.sling.launcher.app</artifactId>
       <version>2.0.0-incubator-SNAPSHOT</version>
     </dependency>
-
     <dependency>
       <groupId>org.eclipse.equinox.http</groupId>
       <artifactId>servlet</artifactId>
@@ -184,13 +214,12 @@
       <artifactId>servlet-api</artifactId>
     </dependency>
 
-    <!-- Load the Sling web console bundle -->
     <dependency>
       <groupId>org.apache.sling</groupId>
-      <artifactId>org.apache.sling.osgi.console.web</artifactId>
+      <artifactId>org.apache.sling.usling.servlets</artifactId>
       <version>2.0.0-incubator-SNAPSHOT</version>
     </dependency>
-
+    
   </dependencies>
 
 </project>



Mime
View raw message