felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1452205 - in /felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl: DefaultWebConsolePlugin.java InventoryPrinterManagerImpl.java webconsole/ConsoleConstants.java
Date Mon, 04 Mar 2013 08:16:23 GMT
Author: fmeschbe
Date: Mon Mar  4 08:16:22 2013
New Revision: 1452205

URL: http://svn.apache.org/r1452205
Log:
FELIX-3947 Fix ClassDefNotFoundError if Servlet API cannot be wired

* Move Web Console Plugin registration from DefaultWebConsolePlugin
  class (static method with DefaultWebConsolePlugin creation) to
  InventoryPrinterManagerImpl
* Define constants for the DefaultWebConsolePlugin in ConsoleConstants
  to prevent loading the class

Modified:
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConsoleConstants.java

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java?rev=1452205&r1=1452204&r2=1452205&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
(original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
Mon Mar  4 08:16:22 2013
@@ -5,9 +5,9 @@
  * 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.
@@ -18,16 +18,10 @@ package org.apache.felix.inventory.impl;
 
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.util.Dictionary;
-import java.util.Hashtable;
 import java.util.zip.ZipOutputStream;
 
 import org.apache.felix.inventory.PrinterMode;
 import org.apache.felix.inventory.impl.webconsole.ConsoleConstants;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
 
 /**
  * The web console plugin for a inventory printer.
@@ -39,7 +33,7 @@ public class DefaultWebConsolePlugin ext
 
     /**
      * Constructor
-     * 
+     *
      * @param inventoryPrinterAdapter The adapter
      */
     DefaultWebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager)
@@ -57,7 +51,7 @@ public class DefaultWebConsolePlugin ext
      */
     public String getTitle()
     {
-        return "Overview";
+        return ConsoleConstants.TITLE;
     }
 
     /**
@@ -65,7 +59,7 @@ public class DefaultWebConsolePlugin ext
      */
     public String getName()
     {
-        return "config";
+        return ConsoleConstants.NAME;
     }
 
     /**
@@ -110,28 +104,4 @@ public class DefaultWebConsolePlugin ext
     {
         // no attachments support
     }
-
-    public static ServiceRegistration register(final BundleContext context, final InventoryPrinterManagerImpl
manager)
-    {
-        final DefaultWebConsolePlugin dwcp = new DefaultWebConsolePlugin(manager);
-
-        final Dictionary props = new Hashtable();
-        props.put(ConsoleConstants.PLUGIN_LABEL, dwcp.getName());
-        props.put(ConsoleConstants.PLUGIN_TITLE, dwcp.getTitle());
-        props.put(ConsoleConstants.PLUGIN_CATEGORY, ConsoleConstants.WEB_CONSOLE_CATEGORY);
-        return context.registerService(ConsoleConstants.INTERFACE_SERVLET, new ServiceFactory()
-        {
-
-            public void ungetService(final Bundle bundle, final ServiceRegistration registration,
final Object service)
-            {
-                // nothing to do
-            }
-
-            public Object getService(final Bundle bundle, final ServiceRegistration registration)
-            {
-                return dwcp;
-            }
-
-        }, props);
-    }
 }
\ No newline at end of file

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java?rev=1452205&r1=1452204&r2=1452205&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
(original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
Mon Mar  4 08:16:22 2013
@@ -18,7 +18,9 @@ package org.apache.felix.inventory.impl;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Dictionary;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -29,8 +31,11 @@ import java.util.concurrent.ConcurrentSk
 
 import org.apache.felix.inventory.InventoryPrinter;
 import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.impl.webconsole.ConsoleConstants;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceFactory;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.log.LogService;
@@ -78,7 +83,22 @@ public class InventoryPrinterManagerImpl
             + InventoryPrinter.CONFIG_TITLE + "=*))"), this);
         this.cfgPrinterTracker.open();
 
-        this.pluginRegistration = DefaultWebConsolePlugin.register(btx, this);
+        final Dictionary props = new Hashtable();
+        props.put(ConsoleConstants.PLUGIN_LABEL, ConsoleConstants.NAME);
+        props.put(ConsoleConstants.PLUGIN_TITLE, ConsoleConstants.TITLE);
+        props.put(ConsoleConstants.PLUGIN_CATEGORY, ConsoleConstants.WEB_CONSOLE_CATEGORY);
+        this.pluginRegistration = btx.registerService(ConsoleConstants.INTERFACE_SERVLET,
new ServiceFactory()
+        {
+            public void ungetService(final Bundle bundle, final ServiceRegistration registration,
final Object service)
+            {
+                // nothing to do
+            }
+
+            public Object getService(final Bundle bundle, final ServiceRegistration registration)
+            {
+                return new DefaultWebConsolePlugin(InventoryPrinterManagerImpl.this);
+            }
+        }, props);
     }
 
     /**

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConsoleConstants.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConsoleConstants.java?rev=1452205&r1=1452204&r2=1452205&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConsoleConstants.java
(original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConsoleConstants.java
Mon Mar  4 08:16:22 2013
@@ -5,9 +5,9 @@
  * 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.
@@ -44,4 +44,8 @@ public class ConsoleConstants
     public static final String PROPERTY_MODES = "modes"; //$NON-NLS-1$
 
     public static final String WEB_CONSOLE_CATEGORY = "Status"; //$NON-NLS-1$
+
+    public static final String NAME = "config"; //$NON-NLS-1$
+
+    public static final String TITLE = "Overview"; //$NON-NLS-1$
 }



Mime
View raw message