felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfre...@apache.org
Subject svn commit: r424270 - in /incubator/felix/trunk/org.apache.felix.mosgi.console.component: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/mosgi/ src/main/java/...
Date Fri, 21 Jul 2006 11:31:51 GMT
Author: sfrenot
Date: Fri Jul 21 04:31:50 2006
New Revision: 424270

URL: http://svn.apache.org/viewvc?rev=424270&view=rev
Log:
This is a common graphical component of the console. That traps remotelogs notifications.


Added:
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/   (with props)
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/pom.xml
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/Activator.java
    incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/RemoteLogger.java

Propchange: incubator/felix/trunk/org.apache.felix.mosgi.console.component/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Jul 21 04:31:50 2006
@@ -0,0 +1,16 @@
+classes
+target
+*.log
+*.ipr
+*.iws
+*.iml
+lib
+bundle
+dist
+.project
+.classpath
+bin
+build
+.settings
+.wtpmodules
+.deployables

Added: incubator/felix/trunk/org.apache.felix.mosgi.console.component/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.console.component/pom.xml?rev=424270&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.console.component/pom.xml (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.console.component/pom.xml Fri Jul 21 04:31:50
2006
@@ -0,0 +1,53 @@
+<project>
+  <parent>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>felix</artifactId>
+    <version>0.8.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>osgi-bundle</packaging>
+  <name>MOSGi JMX Console GUI component</name>
+  <artifactId>org.apache.felix.mosgi.console.component</artifactId>
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>${pom.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.apache.felix.mosgi.console.ifc</artifactId>
+      <version>${pom.version}</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix.plugins</groupId>
+        <artifactId>maven-osgi-plugin</artifactId>
+        <version>${pom.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <osgiManifest>
+            <bundleName>MOSGi JMX Console main GUI component</bundleName>
+            <bundleDescription>MOSGi JMX Console main GUI component</bundleDescription>
+						<bundleActivator>auto-detect</bundleActivator>
+            <bundleDocUrl>http://oscar-osgi.sf.net/obr2/${pom.artifactId}/</bundleDocUrl>
+            <bundleUrl>http://oscar-osgi.sf.net/obr2/${pom.artifactId}/${pom.artifactId}-${pom.version}.jar</bundleUrl>
+            <bundleSource>http://oscar-osgi.sf.net/obr2/${pom.artifactId}/${pom.artifactId}-${pom.version}-src.jar</bundleSource>
+            <bundleSymbolicName>${pom.artifactId}</bundleSymbolicName>
+						<importPackage>
+						  org.apache.felix.mosgi.console.ifc;specification-version="1.0.0",
+						  javax.management;specification-version="1.0.0",
+						  javax.swing;specification-version="1.0.0",
+						  javax.swing.table;specification-version="1.0.0",
+						  org.osgi.framework;specification-version="1.0.0"
+						</importPackage>
+          </osgiManifest>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/Activator.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/Activator.java?rev=424270&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/Activator.java
(added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/Activator.java
Fri Jul 21 04:31:50 2006
@@ -0,0 +1,43 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.felix.mosgi.console.component;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.apache.felix.mosgi.console.ifc.CommonPlugin;
+
+public class Activator implements BundleActivator
+{
+    private BundleContext m_context = null;
+
+    public void start(BundleContext context) throws Exception
+    {
+        m_context = context;
+        m_context.registerService( CommonPlugin.class.getName(), new RemoteLogger(), null);
+//        m_context.registerService( Plugin.class.getName(), new NodeDetails(), null);
+//        m_context.registerService( Plugin.class.getName(), new BundleListPanel(), null);
+
+//        m_context.registerService( CommonPlugin.class.getName(), new OBRPlugin(context),
null);
+
+        //        m_context.registerService( Plugin.class.getName(), new MemoryLauncher(context),
null);
+//        m_context.registerService( Plugin.class.getName(), new LinuxDetails(), null);
+    }
+
+    public void stop(BundleContext context)
+    {
+    }
+}

Added: incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/RemoteLogger.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/RemoteLogger.java?rev=424270&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/RemoteLogger.java
(added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.console.component/src/main/java/org/apache/felix/mosgi/console/component/RemoteLogger.java
Fri Jul 21 04:31:50 2006
@@ -0,0 +1,102 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.felix.mosgi.console.component;
+
+import org.apache.felix.mosgi.console.ifc.CommonPlugin;
+import org.apache.felix.mosgi.console.ifc.Plugin;
+
+import javax.swing.table.DefaultTableModel;
+import javax.swing.JTable;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import java.awt.Component;
+
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.MBeanServerConnection;
+import javax.swing.ListSelectionModel;
+
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import java.beans.PropertyChangeEvent;
+
+public class RemoteLogger extends DefaultTableModel implements CommonPlugin, NotificationListener{
+  private JTable logList;
+  private JPanel jp;
+  private Hashtable nodes=new Hashtable();
+
+  public RemoteLogger (){
+    super(new String[]{"Src", "Level", "Id", "Text"},1);
+System.out.println("Remote logger v1");
+    this.jp=new JPanel();
+    
+    logList = new JTable(this);
+    logList.setPreferredScrollableViewportSize(new java.awt.Dimension(600, 70));
+    
+    logList.getColumnModel().getColumn(0).setPreferredWidth(130);
+    logList.getColumnModel().getColumn(1).setPreferredWidth(50);
+    logList.getColumnModel().getColumn(2).setPreferredWidth(10);
+    logList.getColumnModel().getColumn(3).setPreferredWidth(300);
+    
+
+    logList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+    logList.getTableHeader().setReorderingAllowed(false);
+    jp.add(new JScrollPane(logList));
+    
+  }
+
+  /////////////////////////////////////
+  //  Plugin Interface ////////////////
+  /////////////////////////////////////
+  public String getName(){ return "Remote Logger";}
+  public Component getGUI(){return this.jp;}
+
+/* a supprimer si on enleve l'heritage CommonPlugin -> Plugin */
+  public String pluginLocation(){
+    return null;
+  }
+  public void registerServicePlugin(){}
+  public void unregisterServicePlugin(){}
+/* fin a supprimer */
+
+  
+  public void propertyChange(PropertyChangeEvent e){
+    if (e.getPropertyName().equals(Plugin.NEW_NODE_CONNECTION)){
+      try{
+        MBeanServerConnection mbs=(MBeanServerConnection)e.getNewValue();
+        if (nodes.get(mbs)==null){
+System.out.println("Ajout d'un listener " +mbs);
+          ((MBeanServerConnection)e.getNewValue()).addNotificationListener(new ObjectName("OSGI:name=Remote
Logger"), this, null, e.getOldValue());
+          nodes.put(mbs, "ok");
+        }
+      }catch(Exception ex){
+        ex.printStackTrace();
+      }
+    }
+  }
+
+  public void handleNotification(Notification notification, Object handback) {
+    //int row=this.getRowCount();
+    StringTokenizer st=new StringTokenizer(notification.getMessage(), ":");
+    Object [] event=new Object []{handback, st.nextToken(), st.nextToken(), st.nextToken()};
+    this.insertRow(0,event);
+    this.fireTableRowsInserted(0, 0);
+  }
+  
+}



Mime
View raw message