karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1478377 - in /karaf/trunk/webconsole/http/src/main: java/org/apache/karaf/webconsole/http/ resources/OSGI-INF/blueprint/
Date Thu, 02 May 2013 14:11:03 GMT
Author: jbonofre
Date: Thu May  2 14:11:01 2013
New Revision: 1478377

URL: http://svn.apache.org/r1478377
Log:
[KARAF-2285] Fix Http WebConsole plugin with Equinox

Modified:
    karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/HttpPlugin.java
    karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletDetails.java
    karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletEventHandler.java
    karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebDetail.java
    karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java
    karaf/trunk/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml

Modified: karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/HttpPlugin.java
URL: http://svn.apache.org/viewvc/karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/HttpPlugin.java?rev=1478377&r1=1478376&r2=1478377&view=diff
==============================================================================
--- karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/HttpPlugin.java
(original)
+++ karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/HttpPlugin.java
Thu May  2 14:11:01 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.karaf.webconsole.http;
 
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
@@ -45,106 +44,80 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * The <code>FeaturesPlugin</code>
+ * WebConsole plugin to use with HTTP service.
  */
-public class HttpPlugin extends AbstractWebConsolePlugin
-{
-
-    /** Pseudo class version ID to keep the IDE quite. */
-    private static final long serialVersionUID = 1L;
+public class HttpPlugin extends AbstractWebConsolePlugin {
 
     private final Logger log = LoggerFactory.getLogger(HttpPlugin.class);
 
     public static final String NAME = "http";
-
     public static final String LABEL = "Http";
-
     private ClassLoader classLoader;
-
     private String featuresJs = "/http/res/ui/http-contexts.js";
-
     private ServletEventHandler servletEventHandler;
-    
     private WebEventHandler webEventHandler;
-    
     private BundleContext bundleContext;
 
-
-    //
-    // Blueprint lifecycle callback methods
-    //
-    
     @Override
     protected boolean isHtmlRequest(HttpServletRequest request) {
         return false;
     }
 
-
-    public void start()
-    {
-        super.activate( bundleContext );
-
+    public void start() {
+        super.activate(bundleContext);
         this.classLoader = this.getClass().getClassLoader();
-
-        this.log.info( LABEL + " plugin activated" );
+        this.log.info(LABEL + " plugin activated");
     }
 
-
-    public void stop()
-    {
-        this.log.info( LABEL + " plugin deactivated" );
+    public void stop() {
+        this.log.info(LABEL + " plugin deactivated");
         super.deactivate();
     }
 
-
-    //
-    // AbstractWebConsolePlugin interface
-    //
-
-    public String getLabel()
-    {
+    @Override
+    public String getLabel() {
         return NAME;
     }
 
-
-    public String getTitle()
-    {
+    @Override
+    public String getTitle() {
         return LABEL;
     }
 
-    protected void renderContent( HttpServletRequest request, HttpServletResponse response
) throws IOException
-    {
+    @Override
+    protected void renderContent(HttpServletRequest request, HttpServletResponse response)
throws IOException {
 
         // get request info from request attribute
         final PrintWriter pw = response.getWriter();
 
         String appRoot = (String) request.getAttribute(WebConsoleConstants.ATTR_APP_ROOT);
         final String featuresScriptTag = "<script src='" + appRoot + this.featuresJs
-            + "' language='JavaScript'></script>";
-        pw.println( featuresScriptTag );
+                + "' language='JavaScript'></script>";
+        pw.println(featuresScriptTag);
 
-        pw.println( "<script type='text/javascript'>" );
-        pw.println( "// <![CDATA[" );
-        pw.println( "var imgRoot = '" + appRoot + "/res/imgs';" );
-        pw.println( "// ]]>" );
-        pw.println( "</script>" );
-
-        pw.println( "<div id='plugin_content'/>" );
-
-        pw.println( "<script type='text/javascript'>" );
-        pw.println( "// <![CDATA[" );
-        pw.print( "renderFeatures( " );
-        writeJSON( pw );
-        pw.println( " )" );
-        pw.println( "// ]]>" );
-        pw.println( "</script>" );
-    }
-    
-
-    protected URL getResource( String path )
-    {
-        path = path.substring( NAME.length() + 1 );
-        URL url = this.classLoader.getResource( path );
+        pw.println("<script type='text/javascript'>");
+        pw.println("// <![CDATA[");
+        pw.println("var imgRoot = '" + appRoot + "/res/imgs';");
+        pw.println("// ]]>");
+        pw.println("</script>");
+
+        pw.println("<div id='plugin_content'/>");
+
+        pw.println("<script type='text/javascript'>");
+        pw.println("// <![CDATA[");
+        pw.print("renderFeatures( ");
+        writeJSON(pw);
+        pw.println(" )");
+        pw.println("// ]]>");
+        pw.println("</script>");
+    }
+
+    protected URL getResource(String path) {
+        path = path.substring(NAME.length() + 1);
+        if (path == null || path.isEmpty()) {
+            return null;
+        }
+        URL url = this.classLoader.getResource(path);
         if (url != null) {
             InputStream ins = null;
             try {
@@ -168,205 +141,186 @@ public class HttpPlugin extends Abstract
         }
         return url;
     }
-    
 
-    
-    private void writeJSON( final PrintWriter pw ) throws IOException
-    {
-        
+    private void writeJSON(final PrintWriter pw) throws IOException {
+
         final List<ServletDetails> servlets = this.getServletDetails();
-        
         final List<WebDetail> web = this.getWebDetails();
+        final String statusLine = this.getStatusLine(servlets, web);
+        final JSONWriter jw = new JSONWriter(pw);
 
-        final String statusLine = this.getStatusLine( servlets, web );
-
-        final JSONWriter jw = new JSONWriter( pw );
-
-        try
-        {
+        try {
             jw.object();
 
-            jw.key( "status" );
-            jw.value( statusLine );
+            jw.key("status");
+            jw.value(statusLine);
 
-            jw.key( "contexts" );
+            jw.key("contexts");
             jw.array();
-            for (ServletDetails servlet : servlets)
-            {
+            for (ServletDetails servlet : servlets) {
                 jw.object();
-                jw.key( "id" );
-                jw.value( servlet.getId() );
-                jw.key( "servlet" );
-                jw.value( servlet.getServlet() );
-                jw.key( "servletName" );
-                jw.value( servlet.getServletName() );
-                jw.key( "state" );
-                jw.value( servlet.getState() );
-                jw.key( "alias" );
-                jw.value( servlet.getAlias() );
-                jw.key( "urls" );
+                jw.key("id");
+                jw.value(servlet.getId());
+                jw.key("servlet");
+                jw.value(servlet.getServlet());
+                jw.key("servletName");
+                jw.value(servlet.getServletName());
+                jw.key("state");
+                jw.value(servlet.getState());
+                jw.key("alias");
+                jw.value(servlet.getAlias());
+                jw.key("urls");
                 jw.array();
-                for (String url:servlet.getUrls() ) {
+                for (String url : servlet.getUrls()) {
                     jw.value(url);
                 }
                 jw.endArray();
                 jw.endObject();
             }
             jw.endArray();
-            
-            jw.key( "web" );
+
+            jw.key("web");
             jw.array();
             for (WebDetail webDetail : web) {
-				jw.object();
-				jw.key( "id" );
-				jw.value( webDetail.getBundleId() );
-				jw.key( "bundlestate" );
-				jw.value( webDetail.getState() );
-				jw.key( "contextpath" );
-				jw.value( webDetail.getContextPath() );
-				jw.key( "state" );
-				jw.value( webDetail.getWebState() );
-				jw.endObject();
-			}
+                jw.object();
+                jw.key("id");
+                jw.value(webDetail.getBundleId());
+                jw.key("bundlestate");
+                jw.value(webDetail.getState());
+                jw.key("contextpath");
+                jw.value(webDetail.getContextPath());
+                jw.key("state");
+                jw.value(webDetail.getWebState());
+                jw.endObject();
+            }
             jw.endArray();
-            
+
             jw.endObject();
-        }
-        catch ( JSONException je )
-        {
-            throw new IOException( je.toString() );
+        } catch (JSONException je) {
+            throw new IOException(je.toString());
         }
 
     }
 
-	protected List<ServletDetails> getServletDetails() {
-		
+    protected List<ServletDetails> getServletDetails() {
+
         Collection<ServletEvent> events = servletEventHandler.getServletEvents();
         List<ServletDetails> result = new ArrayList<ServletDetails>(events.size());
-        
-		for (ServletEvent event : events) {
-			Servlet servlet = event.getServlet();
-			String servletClassName = " ";
-			if (servlet != null) {
-				servletClassName = servlet.getClass().getName();
-				servletClassName = servletClassName.substring(servletClassName.lastIndexOf(".")+1, servletClassName.length());
-			} 
-			String servletName = event.getServletName() != null ? event.getServletName() : " ";
-			if (servletName.contains(".")) {
-				servletName = servletName.substring(servletName.lastIndexOf(".")+1, servletName.length());
-			}
-			
-			String alias = event.getAlias() != null ? event.getAlias() : " ";
-			
-			String[] urls = (String[]) (event.getUrlParameter() != null ? event.getUrlParameter()
: new String[] {""});
-            
+
+        for (ServletEvent event : events) {
+            Servlet servlet = event.getServlet();
+            String servletClassName = " ";
+            if (servlet != null) {
+                servletClassName = servlet.getClass().getName();
+                servletClassName = servletClassName.substring(servletClassName.lastIndexOf(".")
+ 1, servletClassName.length());
+            }
+            String servletName = event.getServletName() != null ? event.getServletName()
: " ";
+            if (servletName.contains(".")) {
+                servletName = servletName.substring(servletName.lastIndexOf(".") + 1, servletName.length());
+            }
+
+            String alias = event.getAlias() != null ? event.getAlias() : " ";
+
+            String[] urls = (String[]) (event.getUrlParameter() != null ? event.getUrlParameter()
: new String[]{""});
+
             ServletDetails details = new ServletDetails();
-            details.setId( event.getBundle().getBundleId() );
-            details.setAlias( alias );
-            details.setServlet( servletClassName );
-            details.setServletName( servletName );
-            details.setState( getStateString(event.getType()) );
-            details.setUrls( urls );
-            result.add( details );
-		}
-		return result;
-	}
-	
-	protected List<WebDetail> getWebDetails() {
-		Map<Long, WebEvent> bundleEvents = webEventHandler.getBundleEvents();
-		
-		List<WebDetail> result = new ArrayList<WebDetail>();
-		
-		for (WebEvent event : bundleEvents.values()) {
-			
-			WebDetail webDetail = new WebDetail();
-			webDetail.setBundleId(event.getBundle().getBundleId());
-			webDetail.setContextPath(event.getContextPath().trim().concat("/"));
-			int state = event.getBundle().getState();
-			String stateStr;
-	        if (state == Bundle.ACTIVE) {
-	        	stateStr = "Active";
-	        } else if (state == Bundle.INSTALLED) {
-	        	stateStr = "Installed";
-	        } else if (state == Bundle.RESOLVED) {
-	        	stateStr = "Resolved";
-	        } else if (state == Bundle.STARTING) {
-	        	stateStr = "Starting";
-	        } else if (state == Bundle.STOPPING) {
-	        	stateStr = "Stopping";
-	        } else {
-	        	stateStr = "Unknown";
-	        }
-	        webDetail.setState(stateStr);
-			
-			webDetail.setWebState(getStateString(event.getType()));
-			result.add(webDetail);
-		}
-		
-		return result;
-	}
-    
+            details.setId(event.getBundle().getBundleId());
+            details.setAlias(alias);
+            details.setServlet(servletClassName);
+            details.setServletName(servletName);
+            details.setState(getStateString(event.getType()));
+            details.setUrls(urls);
+            result.add(details);
+        }
+        return result;
+    }
+
+    protected List<WebDetail> getWebDetails() {
+        Map<Long, WebEvent> bundleEvents = webEventHandler.getBundleEvents();
+
+        List<WebDetail> result = new ArrayList<WebDetail>();
+
+        for (WebEvent event : bundleEvents.values()) {
+
+            WebDetail webDetail = new WebDetail();
+            webDetail.setBundleId(event.getBundle().getBundleId());
+            webDetail.setContextPath(event.getContextPath().trim().concat("/"));
+            int state = event.getBundle().getState();
+            String stateStr;
+            if (state == Bundle.ACTIVE) {
+                stateStr = "Active";
+            } else if (state == Bundle.INSTALLED) {
+                stateStr = "Installed";
+            } else if (state == Bundle.RESOLVED) {
+                stateStr = "Resolved";
+            } else if (state == Bundle.STARTING) {
+                stateStr = "Starting";
+            } else if (state == Bundle.STOPPING) {
+                stateStr = "Stopping";
+            } else {
+                stateStr = "Unknown";
+            }
+            webDetail.setState(stateStr);
+
+            webDetail.setWebState(getStateString(event.getType()));
+            result.add(webDetail);
+        }
+
+        return result;
+    }
+
     public String getStatusLine(List<ServletDetails> servlets, List<WebDetail>
web) {
-        Map<String,Integer> states = new HashMap<String,Integer>();
-        for ( ServletDetails servlet : servlets ) {
+        Map<String, Integer> states = new HashMap<String, Integer>();
+        for (ServletDetails servlet : servlets) {
             Integer count = states.get(servlet.getState());
             if (count == null) {
-                states.put(servlet.getState(), 1);                
+                states.put(servlet.getState(), 1);
             } else {
                 states.put(servlet.getState(), 1 + count);
             }
         }
         StringBuilder stateSummary = new StringBuilder();
         boolean first = true;
-        for(Entry<String,Integer> state : states.entrySet()) {
+        for (Entry<String, Integer> state : states.entrySet()) {
             if (!first) {
-                stateSummary.append(", ");                
+                stateSummary.append(", ");
             }
             first = false;
-            stateSummary.append(state.getValue()).append(" " ).append(state.getKey());
+            stateSummary.append(state.getValue()).append(" ").append(state.getKey());
         }
-        
+
         return "Http contexts: " + stateSummary.toString();
     }
-	
-	public String getStateString(int type)
-    {
-        switch(type) {
-		case WebEvent.DEPLOYING:
-			return "Deploying";
-		case WebEvent.DEPLOYED:
-			return "Deployed";
-		case WebEvent.UNDEPLOYING:
-			return "Undeploying";
-		case WebEvent.UNDEPLOYED:
-			return "Undeployed";
-		case WebEvent.FAILED:
-			return "Failed";
-		case WebEvent.WAITING:
-			return "Waiting";
-		default:
-			return "Failed";
-		}
-    }
 
+    public String getStateString(int type) {
+        switch (type) {
+            case WebEvent.DEPLOYING:
+                return "Deploying";
+            case WebEvent.DEPLOYED:
+                return "Deployed";
+            case WebEvent.UNDEPLOYING:
+                return "Undeploying";
+            case WebEvent.UNDEPLOYED:
+                return "Undeployed";
+            case WebEvent.FAILED:
+                return "Failed";
+            case WebEvent.WAITING:
+                return "Waiting";
+            default:
+                return "Failed";
+        }
+    }
 
-    //
-    // Dependency Injection setters
-    //
-
-    public void setServletEventHandler(ServletEventHandler eventHandler) 
-    {
+    public void setServletEventHandler(ServletEventHandler eventHandler) {
         this.servletEventHandler = eventHandler;
     }
-    
-    public void setWebEventHandler(WebEventHandler eventHandler) 
-    {
-    	this.webEventHandler = eventHandler;
-    }
 
+    public void setWebEventHandler(WebEventHandler eventHandler) {
+        this.webEventHandler = eventHandler;
+    }
 
-    public void setBundleContext(BundleContext bundleContext) 
-    {
+    public void setBundleContext(BundleContext bundleContext) {
         this.bundleContext = bundleContext;
     }
+
 }

Modified: karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletDetails.java
URL: http://svn.apache.org/viewvc/karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletDetails.java?rev=1478377&r1=1478376&r2=1478377&view=diff
==============================================================================
--- karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletDetails.java
(original)
+++ karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletDetails.java
Thu May  2 14:11:01 2013
@@ -16,18 +16,19 @@
 package org.apache.karaf.webconsole.http;
 
 public class ServletDetails {
-    private long  id;
-    private String  servlet;
-    private String  servletName;
-    private String  state;
-    private String  alias;
-    private String[]  urls;
+
+    private long id;
+    private String servlet;
+    private String servletName;
+    private String state;
+    private String alias;
+    private String[] urls;
 
     public String getAlias() {
         return alias;
     }
 
-    public void setAlias( String alias ) {
+    public void setAlias(String alias) {
         this.alias = alias;
     }
 
@@ -35,7 +36,7 @@ public class ServletDetails {
         return id;
     }
 
-    public void setId( long id ) {
+    public void setId(long id) {
         this.id = id;
     }
 
@@ -43,7 +44,7 @@ public class ServletDetails {
         return servlet;
     }
 
-    public void setServlet( String servlet ) {
+    public void setServlet(String servlet) {
         this.servlet = servlet;
     }
 
@@ -51,7 +52,7 @@ public class ServletDetails {
         return servletName;
     }
 
-    public void setServletName( String servletName ) {
+    public void setServletName(String servletName) {
         this.servletName = servletName;
     }
 
@@ -59,7 +60,7 @@ public class ServletDetails {
         return state;
     }
 
-    public void setState( String state ) {
+    public void setState(String state) {
         this.state = state;
     }
 
@@ -67,8 +68,8 @@ public class ServletDetails {
         return urls;
     }
 
-    public void setUrls( String[] urls ) {
+    public void setUrls(String[] urls) {
         this.urls = urls;
     }
-    
+
 }

Modified: karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletEventHandler.java?rev=1478377&r1=1478376&r2=1478377&view=diff
==============================================================================
--- karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletEventHandler.java
(original)
+++ karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/ServletEventHandler.java
Thu May  2 14:11:01 2013
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.karaf.webconsole.http;
 
 import java.util.Collection;
@@ -26,18 +25,15 @@ import org.ops4j.pax.web.service.spi.Ser
 
 public class ServletEventHandler implements ServletListener {
 
-	Map<String, ServletEvent> servletEvents =  new HashMap<String, ServletEvent>();
-	
-	@Override
-	public void servletEvent(ServletEvent event) {
-		servletEvents.put(event.getServletName(), event);
-	}
-
-	/**
-	 * @return the servletEvents
-	 */
-	public Collection<ServletEvent> getServletEvents() {
-		return servletEvents.values();
-	}
+    Map<String, ServletEvent> servletEvents = new HashMap<String, ServletEvent>();
+
+    @Override
+    public void servletEvent(ServletEvent event) {
+        servletEvents.put(event.getServletName(), event);
+    }
+
+    public Collection<ServletEvent> getServletEvents() {
+        return servletEvents.values();
+    }
 
 }

Modified: karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebDetail.java
URL: http://svn.apache.org/viewvc/karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebDetail.java?rev=1478377&r1=1478376&r2=1478377&view=diff
==============================================================================
--- karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebDetail.java
(original)
+++ karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebDetail.java
Thu May  2 14:11:01 2013
@@ -17,65 +17,41 @@ package org.apache.karaf.webconsole.http
 
 public class WebDetail {
 
-	private long bundleId;
-	private String contextPath;
-	private String state;
-	private String webState;
-
-	/**
-	 * @return the bundleId
-	 */
-	public long getBundleId() {
-		return bundleId;
-	}
-
-	/**
-	 * @param bundleId the bundleId to set
-	 */
-	public void setBundleId(long bundleId) {
-		this.bundleId = bundleId;
-	}
-
-	/**
-	 * @return the contextPath
-	 */
-	public String getContextPath() {
-		return contextPath;
-	}
-
-	/**
-	 * @param contextPath the contextPath to set
-	 */
-	public void setContextPath(String contextPath) {
-		this.contextPath = contextPath;
-	}
-
-	/**
-	 * @return the state
-	 */
-	public String getState() {
-		return state;
-	}
-
-	/**
-	 * @param state the state to set
-	 */
-	public void setState(String state) {
-		this.state = state;
-	}
-
-	/**
-	 * @return the webState
-	 */
-	public String getWebState() {
-		return webState;
-	}
-
-	/**
-	 * @param webState the webState to set
-	 */
-	public void setWebState(String webState) {
-		this.webState = webState;
-	}
+    private long bundleId;
+    private String contextPath;
+    private String state;
+    private String webState;
+
+    public long getBundleId() {
+        return bundleId;
+    }
+
+    public void setBundleId(long bundleId) {
+        this.bundleId = bundleId;
+    }
+
+    public String getContextPath() {
+        return contextPath;
+    }
+
+    public void setContextPath(String contextPath) {
+        this.contextPath = contextPath;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getWebState() {
+        return webState;
+    }
+
+    public void setWebState(String webState) {
+        this.webState = webState;
+    }
 
 }

Modified: karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java?rev=1478377&r1=1478376&r2=1478377&view=diff
==============================================================================
--- karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java
(original)
+++ karaf/trunk/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java
Thu May  2 14:11:01 2013
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.karaf.webconsole.http;
 
 import java.util.HashMap;
@@ -25,18 +24,15 @@ import org.ops4j.pax.web.service.spi.Web
 
 public class WebEventHandler implements WebListener {
 
-	private final Map<Long, WebEvent> bundleEvents = new HashMap<Long, WebEvent>();
-	
-	/* (non-Javadoc)
-	 * @see org.ops4j.pax.web.service.spi.WebListener#webEvent(org.ops4j.pax.web.service.spi.WebEvent)
-	 */
-	@Override
-	public void webEvent(WebEvent event) {
-		bundleEvents.put(event.getBundle().getBundleId(), event);
-	}
-	
-	public Map<Long, WebEvent> getBundleEvents() {
-		return bundleEvents;
-	}
+    private final Map<Long, WebEvent> bundleEvents = new HashMap<Long, WebEvent>();
+
+    @Override
+    public void webEvent(WebEvent event) {
+        bundleEvents.put(event.getBundle().getBundleId(), event);
+    }
+
+    public Map<Long, WebEvent> getBundleEvents() {
+        return bundleEvents;
+    }
 
 }

Modified: karaf/trunk/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml?rev=1478377&r1=1478376&r2=1478377&view=diff
==============================================================================
--- karaf/trunk/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
(original)
+++ karaf/trunk/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
Thu May  2 14:11:01 2013
@@ -20,13 +20,11 @@
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
 
 	<bean id="eaHandler" class="org.apache.karaf.webconsole.http.ServletEventHandler" />
-	
-	<bean id="webEaHandler" class="org.apache.karaf.webconsole.http.WebEventHandler"/>
+    <service id="servletListener"
+             interface="org.ops4j.pax.web.service.spi.ServletListener"
+             ref="eaHandler" />
 
-	<service id="servletListener"
-		interface="org.ops4j.pax.web.service.spi.ServletListener"
-		ref="eaHandler" />
-		
+	<bean id="webEaHandler" class="org.apache.karaf.webconsole.http.WebEventHandler"/>
 	<service id="webListener" interface="org.ops4j.pax.web.service.spi.WebListener" ref="webEaHandler"/>
 
     <bean id="httpPlugin" class="org.apache.karaf.webconsole.http.HttpPlugin" init-method="start"
destroy-method="stop">
@@ -34,7 +32,6 @@
         <property name="webEventHandler" ref="webEaHandler" />
         <property name="bundleContext" ref="blueprintBundleContext" />
     </bean>
-
     <service ref="httpPlugin" interface="javax.servlet.Servlet" >
         <service-properties>
             <entry key="felix.webconsole.label" value="http"/>



Mime
View raw message