felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1238474 - in /felix/trunk/webconsole-plugins/gogo: ./ src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/
Date Tue, 31 Jan 2012 13:03:33 GMT
Author: fmeschbe
Date: Tue Jan 31 13:03:33 2012
New Revision: 1238474

URL: http://svn.apache.org/viewvc?rev=1238474&view=rev
Log:
FELIX-2625 Small improvements
 - Remove Declarative Services dependency (use plain old Activator)
 - Remove unneeded logging

Modified:
    felix/trunk/webconsole-plugins/gogo/pom.xml
    felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Activator.java
    felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Console.java
    felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/GogoPlugin.java

Modified: felix/trunk/webconsole-plugins/gogo/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/gogo/pom.xml?rev=1238474&r1=1238473&r2=1238474&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/gogo/pom.xml (original)
+++ felix/trunk/webconsole-plugins/gogo/pom.xml Tue Jan 31 13:03:33 2012
@@ -58,38 +58,6 @@
 			</plugin>
             
             <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-                <version>1.7.2</version>
-                <!-- As QDox is trying to inspect/load the classes
-                     we have to add a slf4j implementation to the
-                     class path of the plugin - we usually use
-                     a static field for the logger and during class
-                     loading this field requires an slf4j implementation!
-                 -->
-                <dependencies>
-                    <dependency>
-                        <groupId>org.slf4j</groupId>
-                        <artifactId>slf4j-simple</artifactId>
-                        <version>1.5.2</version>
-                    </dependency>
-                </dependencies>
-                <executions>
-                    <execution>
-                        <id>generate-scr-scrdescriptor</id>
-                        <goals>
-                            <goal>scr</goal>
-                        </goals>
-                        <configuration>
-                            <properties>
-                                <service.vendor>The Apache Software Foundation</service.vendor>
-                            </properties>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            
-            <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
                     <source>1.5</source>
@@ -116,9 +84,11 @@
                         <Bundle-NativeCode>
                             META-INF/native/windows32/jansi.dll;osname=Win32;processor=x86,
                             META-INF/native/windows64/jansi.dll;osname=Win32;processor=x86-64,
+                            <!--
                             META-INF/native/linux32/libjansi.so;osname=Linux;processor=x86,
                             META-INF/native/linux64/libjansi.so;osname=Linux;processor=x86-64,
                             META-INF/native/osx/libjansi.jnilib;osname=MacOSX,
+                            -->
                             *
                         </Bundle-NativeCode>
 					</instructions>
@@ -147,12 +117,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>1.5.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.webconsole</artifactId>
             <version>3.0.0</version>
@@ -170,11 +134,5 @@
             <version>2.5</version>
             <scope>provided</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.scr.annotations</artifactId>
-            <version>1.6.0</version>
-            <scope>provided</scope>
-        </dependency>
  	</dependencies>
 </project>

Modified: felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Activator.java?rev=1238474&r1=1238473&r2=1238474&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Activator.java
(original)
+++ felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Activator.java
Tue Jan 31 13:03:33 2012
@@ -24,11 +24,21 @@ import org.osgi.framework.BundleContext;
 
 public class Activator implements BundleActivator {
 
+    private GogoPlugin plugin;
+
     public void start(BundleContext context) throws Exception {
         AnsiConsole.systemInstall();
+
+        this.plugin = new GogoPlugin();
+        this.plugin.register(context);
     }
 
     public void stop(BundleContext context) throws Exception {
+        if (this.plugin != null) {
+            this.plugin.unregister();
+            this.plugin = null;
+        }
+
         AnsiConsole.systemUninstall();
     }
 

Modified: felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Console.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Console.java?rev=1238474&r1=1238473&r2=1238474&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Console.java
(original)
+++ felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/Console.java
Tue Jan 31 13:03:33 2012
@@ -45,8 +45,6 @@ import org.apache.felix.service.command.
 import org.apache.felix.service.command.CommandSession;
 import org.apache.felix.service.command.Converter;
 import org.fusesource.jansi.Ansi;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class Console implements Runnable {
 
@@ -62,8 +60,6 @@ public class Console implements Runnable
 
     public static final String IGNORE_INTERRUPTS = "karaf.ignoreInterrupts";
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(Console.class);
-
     protected CommandSession session;
 
     private ConsoleReader reader;
@@ -160,7 +156,6 @@ public class Console implements Runnable
                 }
                 session.execute(new String(w.toCharArray()));
             } catch (Exception e) {
-                LOGGER.debug("Error in initialization script", e);
                 System.err.println("Error in initialization script: " + e.getMessage());
             } finally {
                 if (r != null) {
@@ -216,7 +211,6 @@ public class Console implements Runnable
                 break;
             } catch (Exception t) {
                 try {
-                    LOGGER.info("Exception caught while executing command", t);
                     session.put(LAST_EXCEPTION, t);
                     session.getConsole().print(Ansi.ansi().fg(Ansi.Color.RED).toString());
                     session.getConsole().println(

Modified: felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/GogoPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/GogoPlugin.java?rev=1238474&r1=1238473&r2=1238474&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/GogoPlugin.java
(original)
+++ felix/trunk/webconsole-plugins/gogo/src/main/java/org/apache/felix/webconsole/plugins/gogo/impl/GogoPlugin.java
Tue Jan 31 13:03:33 2012
@@ -24,6 +24,7 @@ package org.apache.felix.webconsole.plug
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.InterruptedIOException;
 import java.io.PipedInputStream;
@@ -32,42 +33,29 @@ import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.util.zip.GZIPOutputStream;
 
-import javax.servlet.Servlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.felix.service.command.CommandProcessor;
 import org.apache.felix.service.command.CommandSession;
 import org.apache.felix.webconsole.SimpleWebConsolePlugin;
-import org.apache.felix.webconsole.WebConsoleConstants;
 import org.osgi.framework.BundleContext;
 
 /**
  * The <code>GogoPlugin</code>
  */
-@Component
-@Service(Servlet.class)
 public class GogoPlugin extends SimpleWebConsolePlugin {
 
     /** Pseudo class version ID to keep the IDE quite. */
     private static final long serialVersionUID = 1L;
 
-    @Property(name=WebConsoleConstants.PLUGIN_LABEL)
     public static final String LABEL = "gogo";
 
-    @Property(name=WebConsoleConstants.PLUGIN_TITLE)
     public static final String TITLE = "Gogo";
 
     public static final int TERM_WIDTH = 120;
     public static final int TERM_HEIGHT = 39;
 
-    @Reference
     private CommandProcessor commandProcessor;
 
     public GogoPlugin() {
@@ -75,14 +63,18 @@ public class GogoPlugin extends SimpleWe
     }
 
     @Override
-    @Activate
     public void activate(BundleContext bundleContext) {
         super.activate(bundleContext);
+        this.commandProcessor = new CommandProcessor() {
+            public CommandSession createSession(InputStream in, PrintStream out, PrintStream
err) {
+                return ((CommandProcessor) getService(CommandProcessor.class.getName())).createSession(in,
out, err);
+            }
+        };
     }
 
     @Override
-    @Deactivate
     public void deactivate() {
+        this.commandProcessor = null;
         super.deactivate();
     }
 



Mime
View raw message