sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r595455 - in /incubator/sling/trunk/launcher/webapp: ./ src/main/java/org/apache/sling/launcher/servlet/ src/main/java/org/apache/sling/launcher/webapp/ src/main/webapp/WEB-INF/ src/test/webapp/WEB-INF/
Date Thu, 15 Nov 2007 20:57:03 GMT
Author: fmeschbe
Date: Thu Nov 15 12:57:01 2007
New Revision: 595455

URL: http://svn.apache.org/viewvc?rev=595455&view=rev
Log:
SLING-98 Repackage to match new packaging convention after the Sling API definition

Added:
    incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/
      - copied from r593045, incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/servlet/
Removed:
    incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/servlet/
Modified:
    incubator/sling/trunk/launcher/webapp/pom.xml
    incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingBridge.java
    incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingServlet.java
    incubator/sling/trunk/launcher/webapp/src/main/webapp/WEB-INF/web.xml
    incubator/sling/trunk/launcher/webapp/src/test/webapp/WEB-INF/web.xml

Modified: incubator/sling/trunk/launcher/webapp/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launcher/webapp/pom.xml?rev=595455&r1=595454&r2=595455&view=diff
==============================================================================
--- incubator/sling/trunk/launcher/webapp/pom.xml (original)
+++ incubator/sling/trunk/launcher/webapp/pom.xml Thu Nov 15 12:57:01 2007
@@ -28,7 +28,7 @@
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 
-    <artifactId>sling-servlet</artifactId>
+    <artifactId>org.apache.sling.launcher.webapp</artifactId>
     <packaging>war</packaging>
     <version>2.0.0-incubator-SNAPSHOT</version>
 
@@ -40,13 +40,13 @@
 
     <scm>
         <connection>
-            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/sling-servlet
+            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/launcher/webapp
         </connection>
         <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/sling-servlet
+            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/launcher/webapp
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/incubator/sling/trunk/sling-servlet
+            http://svn.apache.org/viewvc/incubator/sling/trunk/launcher/webapp
         </url>
     </scm>
 
@@ -95,11 +95,11 @@
                         </goals>
                         <configuration>
                             <includeArtifactIds>
-                                sling-app,servlet
+                                org.apache.sling.launcher.app,servlet
                             </includeArtifactIds>
                             <excludeTransitive>true</excludeTransitive>
                             <outputDirectory>
-                                ${project.build.directory}/sling-app
+                                ${project.build.directory}/launcher-app
                             </outputDirectory>
                             <overWriteReleases>false</overWriteReleases>
                             <overWriteSnapshots>
@@ -119,12 +119,12 @@
                         <!-- the classes (except unneeded Main) -->
                         <resource>
                             <directory>
-                                ${basedir}/target/sling-app
+                                ${basedir}/target/launcher-app
                             </directory>
                             <targetPath>WEB-INF/classes</targetPath>
                             <excludes>
                                 <exclude>
-                                    org/apache/sling/launcher/main/**
+                                    org/apache/sling/launcher/app/main/**
                                 </exclude>
                                 <exclude>
                                     resources/bundles/org.apache.felix.http.jetty*.jar
@@ -140,7 +140,7 @@
                         <!-- the configuration resources -->
                         <resource>
                             <directory>
-                                ${basedir}/target/sling-app
+                                ${basedir}/target/launcher-app
                             </directory>
                             <targetPath>WEB-INF</targetPath>
                             <includes>
@@ -188,7 +188,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>sling-app</artifactId>
+            <artifactId>org.apache.sling.launcher.app</artifactId>
             <version>2.0.0-incubator-SNAPSHOT</version>
             <scope>provided</scope>
             <exclusions>

Modified: incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingBridge.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingBridge.java?rev=595455&r1=593045&r2=595455&view=diff
==============================================================================
--- incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingBridge.java
(original)
+++ incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingBridge.java
Thu Nov 15 12:57:01 2007
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.launcher.servlet;
+package org.apache.sling.launcher.webapp;
 
 import java.util.Map;
 
-import org.apache.sling.launcher.Logger;
-import org.apache.sling.launcher.ResourceProvider;
-import org.apache.sling.launcher.Sling;
+import org.apache.sling.launcher.app.Logger;
+import org.apache.sling.launcher.app.ResourceProvider;
+import org.apache.sling.launcher.app.Sling;
 import org.eclipse.equinox.http.servlet.internal.Activator;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleException;
@@ -53,7 +53,7 @@
             try {
                 this.httpServiceActivator.stop(this.getBundleContext());
             } catch (Exception e) {
-                // TODO :log but don't care
+                logger.log("Unexpected problem stopping HttpService", e);
             }
             this.httpServiceActivator = null;
         }

Modified: incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingServlet.java?rev=595455&r1=593045&r2=595455&view=diff
==============================================================================
--- incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingServlet.java
(original)
+++ incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingServlet.java
Thu Nov 15 12:57:01 2007
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.launcher.servlet;
+package org.apache.sling.launcher.webapp;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -23,7 +23,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 
 import javax.servlet.GenericServlet;
@@ -35,11 +34,10 @@
 import javax.servlet.UnavailableException;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.sling.launcher.Logger;
-import org.apache.sling.launcher.ResourceProvider;
-import org.apache.sling.launcher.Sling;
+import org.apache.sling.launcher.app.Logger;
+import org.apache.sling.launcher.app.ResourceProvider;
+import org.apache.sling.launcher.app.Sling;
 import org.eclipse.equinox.http.servlet.HttpServiceServlet;
-import org.osgi.framework.ServiceEvent;
 
 /**
  * The <code>SlingServlet</code> serves as a basic servlet for Project Sling.
@@ -104,46 +102,9 @@
     private static final long serialVersionUID = 1L;
 
     /**
-     * The name of the servlet context attribute containing the
-     * <code>Felix</code> instance.
-     * <p>
-     * This context attribute must be used with utmost care ! It is not intended
-     * for this value to be used in generall applications of the framework.
-     */
-    public static final String CONTEXT_ATTR_SLING_FRAMEWORK = "org.apache.sling.framework";
-
-    /**
-     * The name of the configuration property defining the Sling home directory
-     * (value is "sling.home"). This is a Platform file system directory below
-     * which all runtime data, such as the Felix bundle archives, logfiles, JCR
-     * repository, etc., is located.
-     * <p>
-     * The value of this property, if missing from the web application
-     * deployment descriptor as an init-param, is "sling".
-     * <p>
-     * This configuration property is generally set in the web application
-     * configuration and may be referenced in all property files (default, user
-     * supplied and web application parameters) used to build the framework
-     * configuration.
-     */
-    public static final String SLING_HOME = "sling.home";
-
-    /**
-     * The name of the configuration property defining a properties file
-     * defining a list of bundles, which are installed into the framework when
-     * it has been launched (value is "org.apache.osgi.bundles").
-     * <p>
-     * This configuration property is generally set in the web application
-     * configuration and may be referenced in all property files (default, user
-     * supplied and web application parameters) used to build the framework
-     * configuration.
-     */
-    public static final String OSGI_FRAMEWORK_BUNDLES = "org.apache.osgi.bundles";
-
-    /**
      * The name of the configuration property defining the obr repository.
      */
-    public static final String OBR_REPOSITORY_URL = "obr.repository.url";
+    private static final String OBR_REPOSITORY_URL = "obr.repository.url";
 
     /**
      * The <code>Felix</code> instance loaded on {@link #init()} and stopped
@@ -173,33 +134,25 @@
     public final void init() throws ServletException {
         super.init();
 
-        if (this.getServletContext().getAttribute(CONTEXT_ATTR_SLING_FRAMEWORK) != null)
{
-            this.log("Has this framework already been started ???");
-            return;
-        }
-
         // read the default parameters
-        Map<String, String> props = this.loadConfigProperties();
+        Map<String, String> props = loadConfigProperties();
 
         try {
-            Logger logger = new ServletContextLogger(this.getServletContext());
+            Logger logger = new ServletContextLogger(getServletContext());
             ResourceProvider rp = new ServletContextResourceProvider(
-                this.getServletContext());
-            this.sling = new SlingBridge(logger, rp, props);
+                getServletContext());
+            sling = new SlingBridge(logger, rp, props);
         } catch (Exception ex) {
-            this.log("Cannot start the OSGi framework", ex);
+            log("Cannot start the OSGi framework", ex);
             throw new UnavailableException("Cannot start the OSGi Framework: "
                 + ex);
         }
 
-        // set the context attributes only if all setup has been successfull
-        this.getServletContext().setAttribute(CONTEXT_ATTR_SLING_FRAMEWORK, this.sling);
-
-        // set up the proxy servlet
-        this.delegatee = new HttpServiceServlet();
-        this.delegatee.init(this.getServletConfig());
+        // set up the OSGi HttpService proxy servlet
+        delegatee = new HttpServiceServlet();
+        delegatee.init(getServletConfig());
 
-        this.log("Servlet " + this.getServletName() + " initialized");
+        log("Servlet " + getServletName() + " initialized");
     }
 
     /**
@@ -221,7 +174,7 @@
             throws ServletException, IOException {
 
         // delegate the request to the registered delegatee servlet
-        Servlet delegatee = this.getDelegatee();
+        Servlet delegatee = getDelegatee();
         if (delegatee == null) {
             ((HttpServletResponse) res).sendError(HttpServletResponse.SC_NOT_FOUND);
         } else {
@@ -236,18 +189,15 @@
     public final void destroy() {
 
         // destroy the delegatee
-        if (this.delegatee != null) {
-            this.delegatee.destroy();
-            this.delegatee = null;
+        if (delegatee != null) {
+            delegatee.destroy();
+            delegatee = null;
         }
 
-        // remove the context attributes immediately
-        this.getServletContext().removeAttribute(CONTEXT_ATTR_SLING_FRAMEWORK);
-
         // shutdown the Felix container
-        if (this.sling != null) {
-            this.sling.destroy();
-            this.sling = null;
+        if (sling != null) {
+            sling.destroy();
+            sling = null;
         }
 
         // finally call the base class destroy method
@@ -255,7 +205,7 @@
     }
 
     Servlet getDelegatee() {
-        return this.delegatee;
+        return delegatee;
     }
 
     // ---------- Configuration Loading ----------------------------------------
@@ -293,27 +243,30 @@
         props.put("sling.include.jcr-client", "jcr-client.properties");
 
         // copy context init parameters
-        Enumeration<String> pe = this.getServletContext().getInitParameterNames();
+        Enumeration<String> pe = getServletContext().getInitParameterNames();
         while (pe.hasMoreElements()) {
             String name = pe.nextElement();
-            props.put(name, this.getServletContext().getInitParameter(name));
+            props.put(name, getServletContext().getInitParameter(name));
         }
 
         // copy servlet init parameters
-        pe = this.getInitParameterNames();
+        pe = getInitParameterNames();
         while (pe.hasMoreElements()) {
             String name = pe.nextElement();
-            props.put(name, this.getInitParameter(name));
+            props.put(name, getInitParameter(name));
         }
 
         // if the specified obr location is not a url and starts with a '/', we
-        // assume that this location is inside the webapp and create the correct full url
+        // assume that this location is inside the webapp and create the correct
+        // full url
         final String repoLocation = props.get(OBR_REPOSITORY_URL);
-        if ( repoLocation != null && repoLocation.indexOf(":/") < 1 &&
repoLocation.startsWith("/")) {
+        if (repoLocation != null && repoLocation.indexOf(":/") < 1
+            && repoLocation.startsWith("/")) {
             try {
-                final URL url = this.getServletContext().getResource(repoLocation);
+                final URL url = getServletContext().getResource(
+                    repoLocation);
                 // only if we get back a resource url, we update it
-                if ( url != null ) {
+                if (url != null) {
                     props.put(OBR_REPOSITORY_URL, url.toExternalForm());
                 }
             } catch (MalformedURLException e) {
@@ -332,9 +285,9 @@
 
         public void log(String message, Throwable throwable) {
             if (throwable == null) {
-                this.servletContext.log(message);
+                servletContext.log(message);
             } else {
-                this.servletContext.log(message, throwable);
+                servletContext.log(message, throwable);
             }
         }
     }
@@ -362,9 +315,9 @@
                 path = "/" + path;
             }
 
-            Set resources = this.servletContext.getResourcePaths(path); // unchecked
+            Set resources = servletContext.getResourcePaths(path); // unchecked
             if (resources.isEmpty()) {
-                resources = this.servletContext.getResourcePaths(WEB_INF + path); // unchecked
+                resources = servletContext.getResourcePaths(WEB_INF + path); // unchecked
             }
 
             return resources.iterator(); // unchecked
@@ -383,16 +336,16 @@
 
             try {
                 // try direct path
-                URL resource = this.servletContext.getResource(path);
+                URL resource = servletContext.getResource(path);
                 if (resource != null) {
                     return resource;
                 }
 
                 // otherwise try WEB-INF location
-                return this.servletContext.getResource(WEB_INF + path);
+                return servletContext.getResource(WEB_INF + path);
 
             } catch (MalformedURLException mue) {
-                this.servletContext.log("Failure to get resource " + path, mue);
+                servletContext.log("Failure to get resource " + path, mue);
             }
 
             // fall back to no resource found

Modified: incubator/sling/trunk/launcher/webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launcher/webapp/src/main/webapp/WEB-INF/web.xml?rev=595455&r1=595454&r2=595455&view=diff
==============================================================================
--- incubator/sling/trunk/launcher/webapp/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/sling/trunk/launcher/webapp/src/main/webapp/WEB-INF/web.xml Thu Nov 15 12:57:01
2007
@@ -25,7 +25,7 @@
         <servlet-name>sling</servlet-name>
         <display-name>Sling Servlet</display-name>
         <servlet-class>
-            org.apache.sling.launcher.servlet.SlingServlet
+            org.apache.sling.launcher.webapp.SlingServlet
         </servlet-class>
 
         <init-param>

Modified: incubator/sling/trunk/launcher/webapp/src/test/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launcher/webapp/src/test/webapp/WEB-INF/web.xml?rev=595455&r1=595454&r2=595455&view=diff
==============================================================================
--- incubator/sling/trunk/launcher/webapp/src/test/webapp/WEB-INF/web.xml (original)
+++ incubator/sling/trunk/launcher/webapp/src/test/webapp/WEB-INF/web.xml Thu Nov 15 12:57:01
2007
@@ -25,7 +25,7 @@
         <servlet-name>sling</servlet-name>
         <display-name>Sling Servlet</display-name>
         <servlet-class>
-            org.apache.sling.launcher.servlet.SlingServlet
+            org.apache.sling.launcher.webapp.SlingServlet
         </servlet-class>
 
         <!-- Home: For testing go to the target folder -->



Mime
View raw message