logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r1030851 - in /logging/chainsaw/trunk/src/main: java/org/apache/log4j/chainsaw/ java/org/apache/log4j/chainsaw/helper/ java/org/apache/log4j/chainsaw/receivers/ resources/org/apache/log4j/chainsaw/help/
Date Thu, 04 Nov 2010 08:12:54 GMT
Author: sdeboy
Date: Thu Nov  4 08:12:54 2010
New Revision: 1030851

URL: http://svn.apache.org/viewvc?rev=1030851&view=rev
Log:
Added ability to save the receiver configuration defined through the initial receiver configuration
panel with a user-specified file path and name

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileLoadAction.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversHelper.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
    logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java?rev=1030851&r1=1030850&r2=1030851&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
Thu Nov  4 08:12:54 2010
@@ -560,7 +560,7 @@ public static void main(String[] args) {
                   }
               }
           }
-      File selectedFile = SwingHelper.promptForFile(this, defaultPath, "Select a Chainsaw
configuration file");
+      File selectedFile = SwingHelper.promptForFile(this, defaultPath, "Select a Chainsaw
configuration file", true);
       if (selectedFile != null) {
               try
               {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileLoadAction.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileLoadAction.java?rev=1030851&r1=1030850&r2=1030851&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileLoadAction.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileLoadAction.java Thu
Nov  4 08:12:54 2010
@@ -80,7 +80,7 @@ class FileLoadAction extends AbstractAct
 
       if (!remoteURL) {
             try {
-              File selectedFile = SwingHelper.promptForFile(parent, null, "Load Events from
XML file or zipped XML file...");
+              File selectedFile = SwingHelper.promptForFile(parent, null, "Load Events from
XML file or zipped XML file...", true);
               if (selectedFile != null) {
                 url = selectedFile.toURI().toURL();
                 name = selectedFile.getName();

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=1030851&r1=1030850&r2=1030851&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Thu Nov  4 08:12:54
2010
@@ -106,6 +106,7 @@ import org.apache.log4j.chainsaw.prefs.M
 import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
 import org.apache.log4j.chainsaw.prefs.SettingsListener;
 import org.apache.log4j.chainsaw.prefs.SettingsManager;
+import org.apache.log4j.chainsaw.receivers.ReceiversHelper;
 import org.apache.log4j.chainsaw.receivers.ReceiversPanel;
 import org.apache.log4j.chainsaw.vfs.VFSLogFilePatternReceiver;
 import org.apache.log4j.net.SocketNodeEventListener;
@@ -1418,16 +1419,17 @@ public class LogUI extends JFrame implem
               public void actionPerformed(ActionEvent e) {
                 dialog.setVisible(false);
 
+            if (receiverConfigurationPanel.getModel().isCancelled()) {
+              return;
+            }
             applicationPreferenceModel.setShowNoReceiverWarning(!receiverConfigurationPanel.isDontWarnMeAgain());
-            //using this config next time - stop all plugins
-            if (receiverConfigurationPanel.isDontWarnMeAgain()) {
-                List plugins = pluginRegistry.getPlugins();
-                for (Iterator iter = plugins.iterator();iter.hasNext();) {
-                    Plugin plugin = (Plugin)iter.next();
-                    //don't stop ZeroConfPlugin if it is registered
-                    if (!plugin.getName().toLowerCase().contains("zeroconf")) {
-                      pluginRegistry.stopPlugin(plugin.getName());
-                    }
+            //remove existing plugins
+            List plugins = pluginRegistry.getPlugins();
+            for (Iterator iter = plugins.iterator();iter.hasNext();) {
+                Plugin plugin = (Plugin)iter.next();
+                //don't stop ZeroConfPlugin if it is registered
+                if (!plugin.getName().toLowerCase().contains("zeroconf")) {
+                  pluginRegistry.stopPlugin(plugin.getName());
                 }
             }
             URL configURL = null;
@@ -1525,6 +1527,10 @@ public class LogUI extends JFrame implem
                     }
                   }).start();
               }
+                File saveConfigFile = receiverConfigurationPanel.getModel().getSaveConfigFile();
+                if (saveConfigFile != null) {
+                  ReceiversHelper.getInstance().saveReceiverConfiguration(saveConfigFile);
+                }
           }
         });
 

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java?rev=1030851&r1=1030850&r2=1030851&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
Thu Nov  4 08:12:54 2010
@@ -46,7 +46,6 @@ import javax.swing.JPanel;
 import javax.swing.JRadioButton;
 import javax.swing.JTextField;
 import javax.swing.JTextPane;
-import javax.swing.SwingUtilities;
 import javax.swing.text.SimpleAttributeSet;
 import javax.swing.text.StyleConstants;
 import javax.swing.text.StyledDocument;
@@ -93,6 +92,7 @@ class ReceiverConfigurationPanel extends
     //don't warn again widgets
     private JCheckBox dontwarnIfNoReceiver;
 
+    private JButton saveButton;
     private JButton okButton;
     private JButton cancelButton;
 
@@ -214,6 +214,14 @@ class ReceiverConfigurationPanel extends
         dontwarnIfNoReceiver = new JCheckBox("Always start Chainsaw with this configuration");
         panel.add(dontwarnIfNoReceiver, c);
 
+        saveButton = new JButton(" Save configuration as... ");
+        c = new GridBagConstraints();
+        c.fill = GridBagConstraints.HORIZONTAL;
+        c.gridx = 1;
+        c.gridy = 0;
+        c.insets = new Insets(0, 0, 0, 10);
+        panel.add(saveButton, c);
+
         okButton = new JButton(" OK ");
         cancelButton = new JButton(" Cancel ");
 
@@ -221,14 +229,14 @@ class ReceiverConfigurationPanel extends
 
         c = new GridBagConstraints();
         c.fill = GridBagConstraints.HORIZONTAL;
-        c.gridx = 1;
+        c.gridx = 2;
         c.gridy = 0;
         c.insets = new Insets(0, 0, 0, 10);
         panel.add((JButton)okCancelButtons.get(0), c);
 
         c = new GridBagConstraints();
         c.fill = GridBagConstraints.HORIZONTAL;
-        c.gridx = 2;
+        c.gridx = 3;
         c.gridy = 0;
         panel.add((JButton)okCancelButtons.get(1), c);
 
@@ -249,10 +257,27 @@ class ReceiverConfigurationPanel extends
                 if (logFileFormatComboBox.getSelectedItem() != null && !(logFileFormatComboBox.getSelectedItem().toString().trim().equals("")))
{
                   panelModel.setLogFormat(logFileFormatComboBox.getSelectedItem().toString());
                 }
-                completionActionListener.actionPerformed(new ActionEvent(this, -1, "cancelled"));
+                completionActionListener.actionPerformed(new ActionEvent(this, -1, "ok"));
             }
         });
-        return panel;
+
+      saveButton.addActionListener(new ActionListener()
+      {
+          public void actionPerformed(ActionEvent e)
+          {
+            try {
+                URL url = browseFile("Choose a path and file name to save", false);
+                if (url != null) {
+                  File file = new File(url.toURI());
+                  panelModel.setSaveConfigFile(file);
+                }
+            } catch (Exception ex) {
+                logger.error(
+                    "Error browsing for log file", ex);
+            }
+          }
+      });
+      return panel;
     }
 
     private JPanel buildBottomDescriptionPanel() {
@@ -323,8 +348,7 @@ class ReceiverConfigurationPanel extends
         browseLogFileButton = new JButton(new AbstractAction(" Open File... ") {
             public void actionPerformed(ActionEvent e) {
                 try {
-
-                    URL url = browseLogFile();
+                    URL url = browseFile("Select a log file", true);
                     if (url != null) {
                         String item = url.toURI().toString();
                         logFileURLTextField.setText(item);
@@ -564,7 +588,7 @@ class ReceiverConfigurationPanel extends
     private URL browseConfig() throws MalformedURLException {
         //hiding and showing the dialog to avoid focus issues with 2 dialogs
         dialog.setVisible(false);
-        File selectedFile = SwingHelper.promptForFile(dialog, null, "Choose a Chainsaw configuration
file");
+        File selectedFile = SwingHelper.promptForFile(dialog, null, "Choose a Chainsaw configuration
file", true);
         URL result = null;
         if (selectedFile == null) {
             result = null;
@@ -587,10 +611,10 @@ class ReceiverConfigurationPanel extends
      * Returns the URL chosen by the user for a Configuration file
      * or null if they cancelled.
      */
-    private URL browseLogFile() throws MalformedURLException {
+    private URL browseFile(String title, boolean loadDialog) throws MalformedURLException
{
         //hiding and showing the dialog to avoid focus issues with 2 dialogs
         dialog.setVisible(false);
-        File selectedFile = SwingHelper.promptForFile(dialog, null, "Select a log file");
+        File selectedFile = SwingHelper.promptForFile(dialog, null, title, loadDialog);
         URL result = null;
         if (selectedFile == null) {
             result = null;
@@ -641,6 +665,7 @@ class ReceiverConfigurationPanel extends
     //default to cancelled
     private boolean cancelled = true;
     private String lastLogFormat;
+    private File saveConfigFile;
 
     public PanelModel(){
             file = new File(SettingsManager.getInstance().getSettingsDirectory(), "receiver-config.xml");
@@ -666,7 +691,6 @@ class ReceiverConfigurationPanel extends
         }
 
         boolean isLoadSavedConfigs() {
-
             return !cancelled && useAutoSavedConfigRadioButton.isSelected();
         }
 
@@ -695,6 +719,14 @@ class ReceiverConfigurationPanel extends
             return null;
         }
 
+        File getSaveConfigFile() {
+          return saveConfigFile;
+        }
+
+        void setSaveConfigFile(File file) {
+          this.saveConfigFile = file;
+        }
+
         URL getLogFileURL() {
             try
             {
@@ -746,5 +778,9 @@ class ReceiverConfigurationPanel extends
           logFileFormatComboBoxModel.insertElementAt(lastLogFormat, 0);
           logFileFormatComboBox.setSelectedIndex(0);
         }
-    }
+
+        public boolean isCancelled() {
+          return cancelled;
+        }
+  }
 }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java?rev=1030851&r1=1030850&r2=1030851&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java
Thu Nov  4 08:12:54 2010
@@ -107,7 +107,7 @@ public final class SwingHelper {
     return result;
   }
 
-  public static File promptForFile(Container parent, String defaultPath, String title) {
+  public static File promptForFile(Container parent, String defaultPath, String title, boolean
loadDialog) {
         if (SwingHelper.isMacOSX()) {
             //use filedialog on mac
             Component root = SwingUtilities.getRoot(parent);
@@ -118,6 +118,7 @@ public final class SwingHelper {
 
             FileDialog fileDialog = new FileDialog(frame, title);
             fileDialog.setModal(true);
+            fileDialog.setMode(loadDialog ? FileDialog.LOAD : FileDialog.SAVE);
             if (defaultPath != null) {
               fileDialog.setDirectory(defaultPath);
             }
@@ -144,7 +145,13 @@ public final class SwingHelper {
 
                 chooser.setAcceptAllFileFilterUsed(true);
 
-                int i = chooser.showOpenDialog(parent);
+                int i;
+                if (loadDialog) {
+                  i = chooser.showOpenDialog(parent);
+                } else {
+                  i = chooser.showSaveDialog(parent);
+                }
+
                 if (i != JFileChooser.APPROVE_OPTION) {
                     return null;
                 }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversHelper.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversHelper.java?rev=1030851&r1=1030850&r2=1030851&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversHelper.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversHelper.java
Thu Nov  4 08:12:54 2010
@@ -17,17 +17,39 @@
 package org.apache.log4j.chainsaw.receivers;
 
 
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
 import org.apache.log4j.chainsaw.plugins.PluginClassLoaderFactory;
+import org.apache.log4j.plugins.Plugin;
+import org.apache.log4j.plugins.PluginRegistry;
+import org.apache.log4j.plugins.Receiver;
+import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 
 /**
@@ -108,6 +130,81 @@ public class ReceiversHelper {
     public List getKnownReceiverClasses() {
       return Collections.unmodifiableList(receiverClassList);
     }
-    
 
+
+  public void saveReceiverConfiguration(File file) {
+    LoggerRepository repo = LogManager.getLoggerRepository();
+    PluginRegistry pluginRegistry = ((LoggerRepositoryEx) repo).getPluginRegistry();
+    List fullPluginList = pluginRegistry.getPlugins();
+    List pluginList = new ArrayList();
+    for (Iterator iter = fullPluginList.iterator();iter.hasNext();) {
+        Plugin thisPlugin = (Plugin)iter.next();
+        if (thisPlugin instanceof Receiver) {
+            pluginList.add(thisPlugin);
+        }
+    }
+    //remove everything that isn't a receiver..otherwise, we'd create an empty config file
+    try {
+        if (pluginList.size() > 0) {
+            //we programmatically register the ZeroConf plugin in the plugin registry
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setNamespaceAware(true);
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            Document document = builder.newDocument();
+            Element rootElement = document.createElementNS("http://jakarta.apache.org/log4j/",
"configuration");
+            rootElement.setPrefix("log4j");
+            rootElement.setAttribute("xmlns:log4j", "http://jakarta.apache.org/log4j/");
+            rootElement.setAttribute("debug", "true");
+
+            for (int i = 0; i < pluginList.size(); i++) {
+                Receiver receiver;
+
+                if (pluginList.get(i) instanceof Receiver) {
+                    receiver = (Receiver) pluginList.get(i);
+                } else {
+                    continue;
+                }
+
+                Element pluginElement = document.createElement("plugin");
+                pluginElement.setAttribute("name", receiver.getName());
+                pluginElement.setAttribute("class", receiver.getClass().getName());
+
+                BeanInfo beanInfo = Introspector.getBeanInfo(receiver.getClass());
+                List list = new ArrayList(Arrays.asList(beanInfo.getPropertyDescriptors()));
+
+                for (int j = 0; j < list.size(); j++) {
+                    PropertyDescriptor d = (PropertyDescriptor) list.get(j);
+                    //don't serialize the loggerRepository property for subclasses of componentbase..
+                    //easier to change this than tweak componentbase right now..
+                    if (d.getReadMethod().getName().equals("getLoggerRepository")) {
+                        continue;
+                    }
+                    Object o = d.getReadMethod().invoke(receiver, new Object[] {} );
+                    if (o != null) {
+                        Element paramElement = document.createElement("param");
+                        paramElement.setAttribute("name", d.getName());
+                        paramElement.setAttribute("value", o.toString());
+                        pluginElement.appendChild(paramElement);
+                    }
+                }
+
+                rootElement.appendChild(pluginElement);
+
+            }
+
+            TransformerFactory transformerFactory = TransformerFactory.newInstance();
+            Transformer transformer = transformerFactory.newTransformer();
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+            DOMSource source = new DOMSource(rootElement);
+            FileOutputStream stream = new FileOutputStream(file);
+            StreamResult result = new StreamResult(stream);
+            transformer.transform(source, result);
+            stream.close();
+        }
+
+    } catch (Exception e) {
+        e.printStackTrace();
+    }
+  }
 }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java?rev=1030851&r1=1030850&r2=1030851&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
Thu Nov  4 08:12:54 2010
@@ -22,17 +22,12 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
 import java.io.File;
-import java.io.FileOutputStream;
 
 import javax.swing.AbstractAction;
 import javax.swing.Action;
@@ -62,13 +57,6 @@ import javax.swing.event.TreeWillExpandL
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.ExpandVetoException;
 import javax.swing.tree.TreePath;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
 
 import org.apache.log4j.Level;
 import org.apache.log4j.LogManager;
@@ -95,8 +83,6 @@ import org.apache.log4j.plugins.PluginRe
 import org.apache.log4j.plugins.Receiver;
 import org.apache.log4j.spi.LoggerRepository;
 import org.apache.log4j.spi.LoggerRepositoryEx;
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
 
 
 /**
@@ -642,80 +628,8 @@ public class ReceiversPanel extends JPan
     */
 
   public void saveSettings(SaveSettingsEvent event){
-      List fullPluginList = pluginRegistry.getPlugins();
-      List pluginList = new ArrayList();
-      for (Iterator iter = fullPluginList.iterator();iter.hasNext();) {
-          Plugin thisPlugin = (Plugin)iter.next();
-          if (thisPlugin instanceof Receiver) {
-              pluginList.add(thisPlugin);
-          }
-      }
-      //remove everything that isn't a receiver..otherwise, we'd create an empty config file
-      try {
-          if (pluginList.size() > 0) {
-              //we programmatically register the ZeroConf plugin in the plugin registry
-              File file = new File(SettingsManager.getInstance().getSettingsDirectory(),
"receiver-config.xml");
-              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-              factory.setNamespaceAware(true);
-              DocumentBuilder builder = factory.newDocumentBuilder();
-              Document document = builder.newDocument();
-              Element rootElement = document.createElementNS("http://jakarta.apache.org/log4j/",
"configuration");
-              rootElement.setPrefix("log4j");
-              rootElement.setAttribute("xmlns:log4j", "http://jakarta.apache.org/log4j/");
-              rootElement.setAttribute("debug", "true");
-
-              for (int i = 0; i < pluginList.size(); i++) {
-                  Receiver receiver;
-
-                  if (pluginList.get(i) instanceof Receiver) {
-                      receiver = (Receiver) pluginList.get(i);
-                  } else {
-                      continue;
-                  }
-
-                  Element pluginElement = document.createElement("plugin");
-                  pluginElement.setAttribute("name", receiver.getName());
-                  pluginElement.setAttribute("class", receiver.getClass().getName());
-
-                  BeanInfo beanInfo = Introspector.getBeanInfo(receiver.getClass());
-                  List list = new ArrayList(Arrays.asList(beanInfo.getPropertyDescriptors()));
-
-                  for (int j = 0; j < list.size(); j++) {
-                      PropertyDescriptor d = (PropertyDescriptor) list.get(j);
-                      //don't serialize the loggerRepository property for subclasses of componentbase..
-                      //easier to change this than tweak componentbase right now..
-                      if (d.getReadMethod().getName().equals("getLoggerRepository")) {
-                          continue;
-                      }
-                      Object o = d.getReadMethod().invoke(receiver, new Object[] {} );
-                      if (o != null) {
-                          Element paramElement = document.createElement("param");
-                          paramElement.setAttribute("name", d.getName());
-                          paramElement.setAttribute("value", o.toString());
-                          pluginElement.appendChild(paramElement);
-                      }
-                  }
-
-                  rootElement.appendChild(pluginElement);
-
-              }
-
-              TransformerFactory transformerFactory = TransformerFactory.newInstance();
-              Transformer transformer = transformerFactory.newTransformer();
-              transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-              transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
"4");
-              DOMSource source = new DOMSource(rootElement);
-              FileOutputStream stream = new FileOutputStream(file);
-              StreamResult result = new StreamResult(stream);
-              transformer.transform(source, result);
-              stream.close();
-          }
-
-      } catch (Exception e) {
-          e.printStackTrace();
-          logger.error("Error while writing receiver configurations to the configuration
file");
-      }
-
+     File file = new File(SettingsManager.getInstance().getSettingsDirectory(), "receiver-config.xml");
+     ReceiversHelper.getInstance().saveReceiverConfiguration(file);
   }
 
   /**

Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html?rev=1030851&r1=1030850&r2=1030851&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
(original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
Thu Nov  4 08:12:54 2010
@@ -12,6 +12,7 @@
 <h1>2.1</h1>
 <h2>4 Nov 2010</h2>
 <ul>
+<li>Added ability to save the receiver configuration defined through the initial receiver
configuration panel with a user-specified file path and name</li>
 <li>Added ability to define which columns are displayed by default when a new tab is
created by clicking the 'Use selected columns as default visible columns' button on the logpanel
preferences column selection screen</li>
 </ul>
 <h2>22 Oct 2010</h2>



Mime
View raw message