incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1227218 - in /sling/trunk/contrib/extensions: startup-filter-disabler/ startup-filter-disabler/src/ startup-filter-disabler/src/main/ startup-filter-disabler/src/main/java/ startup-filter-disabler/src/main/java/org/ startup-filter-disabler...
Date Wed, 04 Jan 2012 16:45:05 GMT
Author: bdelacretaz
Date: Wed Jan  4 16:45:04 2012
New Revision: 1227218

URL: http://svn.apache.org/viewvc?rev=1227218&view=rev
Log:
SLING-2347 - startup filter disabler bundle added

Added:
    sling/trunk/contrib/extensions/startup-filter-disabler/   (with props)
    sling/trunk/contrib/extensions/startup-filter-disabler/pom.xml
    sling/trunk/contrib/extensions/startup-filter-disabler/src/
    sling/trunk/contrib/extensions/startup-filter-disabler/src/main/
    sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/
    sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/
    sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/
    sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/sling/
    sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/sling/startupfilterdisabler/
    sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/sling/startupfilterdisabler/impl/
    sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/sling/startupfilterdisabler/impl/Activator.java
Modified:
    sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java

Propchange: sling/trunk/contrib/extensions/startup-filter-disabler/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jan  4 16:45:04 2012
@@ -0,0 +1,10 @@
+target
+bin
+*.iml
+*.ipr
+*.iws
+.settings
+.project
+.classpath
+.externalToolBuilders
+maven-eclipse.xml

Added: sling/trunk/contrib/extensions/startup-filter-disabler/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/startup-filter-disabler/pom.xml?rev=1227218&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/startup-filter-disabler/pom.xml (added)
+++ sling/trunk/contrib/extensions/startup-filter-disabler/pom.xml Wed Jan  4 16:45:04 2012
@@ -0,0 +1,80 @@
+<?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>11</version>
+    <relativePath>../../../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>org.apache.sling.startupfilter.disabler</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <name>Apache Sling Startup Filter Disabler</name>
+  <description> 
+    The Activator of this bundle disables the Sling Startup Filter.
+    Configure this bundle with a high enough run level to remove the
+    startup filter once the system is ready. 
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/startup-filter-disabler</connection>
+    <developerConnection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/startup-filter-disabler</developerConnection>
+    <url>http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/startup-filter-disabler</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.startupfilterdisabler.impl.*</Private-Package>
+            <Bundle-Activator>org.apache.sling.startupfilterdisabler.impl.Activator</Bundle-Activator>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.startupfilter</artifactId>
+      <version>0.0.1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>

Added: sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/sling/startupfilterdisabler/impl/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/sling/startupfilterdisabler/impl/Activator.java?rev=1227218&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/sling/startupfilterdisabler/impl/Activator.java
(added)
+++ sling/trunk/contrib/extensions/startup-filter-disabler/src/main/java/org/apache/sling/startupfilterdisabler/impl/Activator.java
Wed Jan  4 16:45:04 2012
@@ -0,0 +1,49 @@
+/*
+ * 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.sling.startupfilterdisabler.impl;
+
+import org.apache.sling.startupfilter.StartupFilter;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Activator implements BundleActivator {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    
+    public void start(BundleContext context) throws Exception {
+        final ServiceReference ref = context.getServiceReference(StartupFilter.class.getName());
+        if(ref == null) {
+            log.warn("No StartupFilter service found to disable");
+        } else {
+            final StartupFilter filter = (StartupFilter)context.getService(ref);
+            if(filter.isEnabled()) {
+                filter.disable();
+                log.info("StartupFilter disabled: {}", filter);
+            } else {
+                log.info("StartupFilter already disabled, nothing to do: {}", filter);
+            }
+        }
+    }
+
+    public void stop(BundleContext context) throws Exception {
+    }
+}

Modified: sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java?rev=1227218&r1=1227217&r2=1227218&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java
(original)
+++ sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java
Wed Jan  4 16:45:04 2012
@@ -83,6 +83,11 @@ public class StartupFilterImpl implement
         }
         ((HttpServletResponse)response).sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
sb.toString());
     }
+    
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + ": " + (isEnabled() ? "enabled" : "disabled");

+    }
 
     /** @inheritDoc */
     public void destroy() {



Mime
View raw message