Return-Path: Delivered-To: apmail-incubator-felix-commits-archive@www.apache.org Received: (qmail 97020 invoked from network); 21 Jul 2006 11:32:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jul 2006 11:32:13 -0000 Received: (qmail 27569 invoked by uid 500); 21 Jul 2006 11:32:13 -0000 Delivered-To: apmail-incubator-felix-commits-archive@incubator.apache.org Received: (qmail 27525 invoked by uid 500); 21 Jul 2006 11:32:13 -0000 Mailing-List: contact felix-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: felix-dev@incubator.apache.org Delivered-To: mailing list felix-commits@incubator.apache.org Received: (qmail 27513 invoked by uid 99); 21 Jul 2006 11:32:13 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jul 2006 04:32:13 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jul 2006 04:32:12 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 30FC11A981A; Fri, 21 Jul 2006 04:31:52 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: felix-commits@incubator.apache.org From: sfrenot@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060721113152.30FC11A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 @@ + + + org.apache.felix + felix + 0.8.0-SNAPSHOT + + 4.0.0 + osgi-bundle + MOSGi JMX Console GUI component + org.apache.felix.mosgi.console.component + + + ${pom.groupId} + org.osgi.core + ${pom.version} + provided + + + ${pom.groupId} + org.apache.felix.mosgi.console.ifc + ${pom.version} + provided + + + + + + org.apache.felix.plugins + maven-osgi-plugin + ${pom.version} + true + + + MOSGi JMX Console main GUI component + MOSGi JMX Console main GUI component + auto-detect + http://oscar-osgi.sf.net/obr2/${pom.artifactId}/ + http://oscar-osgi.sf.net/obr2/${pom.artifactId}/${pom.artifactId}-${pom.version}.jar + http://oscar-osgi.sf.net/obr2/${pom.artifactId}/${pom.artifactId}-${pom.version}-src.jar + ${pom.artifactId} + + 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" + + + + + + + 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); + } + +}