Package org.apache.log4j.plugins

Examples of org.apache.log4j.plugins.Receiver


            int port = noReceiversWarningPanel.getModel().getSimplePort();
            Class receiverClass =
              noReceiversWarningPanel.getModel().getSimpleReceiverClass();

            try {
              Receiver simpleReceiver = (Receiver) receiverClass.newInstance();
              simpleReceiver.setName("Simple Receiver");

              Method portMethod =
                simpleReceiver.getClass().getMethod(
                  "setPort", new Class[] { int.class });
              portMethod.invoke(
                simpleReceiver, new Object[] { new Integer(port) });

              simpleReceiver.setThreshold(Level.TRACE);

              pluginRegistry.addPlugin(simpleReceiver);
              simpleReceiver.activateOptions();
              receiversPanel.updateReceiverTreeInDispatchThread();
            } catch (Exception e) {
              MessageCenter.getInstance().getLogger().error(
                "Error creating Receiver", e);
              MessageCenter.getInstance().getLogger().info(
View Full Code Here


    shutdownReceiverButtonAction.setEnabled(false);
    restartReceiverButtonAction =
        new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              Receiver selectedReceiver = getCurrentlySelectedReceiver();
              if(selectedReceiver == null){
                return;
              }
              selectedReceiver.shutdown();
              selectedReceiver.activateOptions();
            }
          };

      restartReceiverButtonAction.putValue(
        Action.SHORT_DESCRIPTION,
        "Restarts the selected Receiver");
      restartReceiverButtonAction.putValue(Action.NAME, "Restart");

      restartReceiverButtonAction.putValue(
        Action.SMALL_ICON, new ImageIcon(ChainsawIcons.ICON_RESTART));
      restartReceiverButtonAction.putValue(
        Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R));

      restartReceiverButtonAction.setEnabled(false);

    showReceiverHelpAction =
      new AbstractAction("Help") {
          public void actionPerformed(ActionEvent e) {
            Receiver receiver = getCurrentlySelectedReceiver();

            if (receiver != null) {
              HelpManager.getInstance().showHelpForClass(receiver.getClass());
            }
          }
        };

    showReceiverHelpAction.putValue(
      Action.SMALL_ICON, new ImageIcon(ChainsawIcons.HELP));
    showReceiverHelpAction.putValue(
      Action.SHORT_DESCRIPTION, "Displays the JavaDoc page for this Plugin");

    startAllAction =
      new AbstractAction(
        "(Re)start All Receivers", new ImageIcon(ChainsawIcons.ICON_RESTART_ALL)) {
          public void actionPerformed(ActionEvent e) {
            if (
              JOptionPane.showConfirmDialog(
                  null,
                  "This will cause any active Receiver to stop, and disconnect.  Is this ok?",
                  "Confirm", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
              new Thread(
                new Runnable() {
                  public void run() {
                    Collection allReceivers =
                        pluginRegistry.getPlugins(Receiver.class);

                    for (Iterator iter = allReceivers.iterator();
                        iter.hasNext();) {
                      Receiver item = (Receiver) iter.next();
                      item.shutdown();
                      item.activateOptions();
                    }

                    updateReceiverTreeInDispatchThread();
                    MessageCenter.getInstance().getLogger().info(
                      "All Receivers have been (re)started");
View Full Code Here

      add(pauseReceiverButtonAction);
      add(restartReceiverButtonAction);
      add(shutdownReceiverButtonAction);
      addSeparator();

      final Receiver r = getCurrentlySelectedReceiver();
      add(createLevelRadioButton(r, Level.TRACE));
      add(createLevelRadioButton(r, Level.DEBUG));
      add(createLevelRadioButton(r, Level.INFO));
      add(createLevelRadioButton(r, Level.WARN));
      add(createLevelRadioButton(r, Level.ERROR));
View Full Code Here

    if (receivers.size() == 0) {
      getRootNode().add(NoReceiversNode);
    } else {
      for (Iterator iter = receivers.iterator(); iter.hasNext();) {
        final Receiver item = (Receiver) iter.next();
        final DefaultMutableTreeNode receiverNode = new DefaultMutableTreeNode(item);

        item.addPropertyChangeListener(creatPluginPropertyChangeListener(item, receiverNode));
        if (item instanceof SocketReceiver) {
          for (
            Iterator iterator =
              ((SocketReceiver) item).getConnectedSocketDetails().iterator();
              iterator.hasNext();) {
View Full Code Here

        getRootNode().remove(NoReceiversNode);
        nodesWereRemoved(
          getRootNode(), new int[] { index }, new Object[] { NoReceiversNode });
      }

      Receiver receiver = (Receiver) e.getPlugin();
      DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(receiver);
      getRootNode().add(newNode);
      receiver.addPropertyChangeListener(creatPluginPropertyChangeListener(receiver, newNode));
      nodesWereInserted(
        getRootNode(), new int[] { getRootNode().getIndex(newNode) });
    }
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.apache.log4j.plugins.PluginListener#pluginStopped(org.apache.log4j.plugins.PluginEvent)
   */
  public void pluginStopped(PluginEvent e) {
    if (e.getPlugin() instanceof Receiver) {
      Receiver receiver = (Receiver) e.getPlugin();
      DefaultMutableTreeNode node =
        (DefaultMutableTreeNode) resolvePluginNode(receiver);
        if (node != null) {
            int index = getRootNode().getIndex(node);
            getRootNode().remove(node);
View Full Code Here

    shutdownReceiverButtonAction.setEnabled(false);
    restartReceiverButtonAction =
        new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              Receiver selectedReceiver = getCurrentlySelectedReceiver();
              if(selectedReceiver == null){
                return;
              }
              selectedReceiver.shutdown();
              selectedReceiver.activateOptions();
            }
          };

      restartReceiverButtonAction.putValue(
        Action.SHORT_DESCRIPTION,
        "Restarts the selected Receiver");
      restartReceiverButtonAction.putValue(Action.NAME, "Restart");

      restartReceiverButtonAction.putValue(
        Action.SMALL_ICON, new ImageIcon(ChainsawIcons.ICON_RESTART));
      restartReceiverButtonAction.putValue(
        Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R));

      restartReceiverButtonAction.setEnabled(false);

    showReceiverHelpAction =
      new AbstractAction("Help") {
          public void actionPerformed(ActionEvent e) {
            Receiver receiver = getCurrentlySelectedReceiver();

            if (receiver != null) {
              HelpManager.getInstance().showHelpForClass(receiver.getClass());
            }
          }
        };

    showReceiverHelpAction.putValue(
      Action.SMALL_ICON, new ImageIcon(ChainsawIcons.HELP));
    showReceiverHelpAction.putValue(
      Action.SHORT_DESCRIPTION, "Displays the JavaDoc page for this Plugin");

    startAllAction =
      new AbstractAction(
        "(Re)start All Receivers", new ImageIcon(ChainsawIcons.ICON_RESTART_ALL)) {
          public void actionPerformed(ActionEvent e) {
            if (
              JOptionPane.showConfirmDialog(
                  null,
                  "This will cause any active Receiver to stop, and disconnect.  Is this ok?",
                  "Confirm", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
              new Thread(
                new Runnable() {
                  public void run() {
                    Collection allReceivers =
                        pluginRegistry.getPlugins(Receiver.class);

                    for (Iterator iter = allReceivers.iterator();
                        iter.hasNext();) {
                      Receiver item = (Receiver) iter.next();
                      item.shutdown();
                      item.activateOptions();
                    }

                    updateReceiverTreeInDispatchThread();
                    MessageCenter.getInstance().getLogger().info(
                      "All Receivers have been (re)started");
View Full Code Here

      add(pauseReceiverButtonAction);
      add(restartReceiverButtonAction);
      add(shutdownReceiverButtonAction);
      addSeparator();

      final Receiver r = getCurrentlySelectedReceiver();
      add(createLevelRadioButton(r, Level.DEBUG));
      add(createLevelRadioButton(r, Level.INFO));
      add(createLevelRadioButton(r, Level.WARN));
      add(createLevelRadioButton(r, Level.ERROR));
      addSeparator();
View Full Code Here

        if (!Receiver.class.isAssignableFrom(receiverClass)) {
            throw new IllegalArgumentException(receiverClass.getName() +
                " is not a Receiver");
        }

        Receiver receiverInstance = null;

        try {
            receiverInstance = (Receiver) receiverClass.newInstance();

        } catch (Exception e) {
View Full Code Here

            int port = noReceiversWarningPanel.getModel().getSimplePort();
            Class receiverClass =
              noReceiversWarningPanel.getModel().getSimpleReceiverClass();

            try {
              Receiver simpleReceiver = (Receiver) receiverClass.newInstance();
              simpleReceiver.setName("Simple Receiver");

              Method portMethod =
                simpleReceiver.getClass().getMethod(
                  "setPort", new Class[] { int.class });
              portMethod.invoke(
                simpleReceiver, new Object[] { new Integer(port) });

              simpleReceiver.setThreshold(Level.DEBUG);

              pluginRegistry.addPlugin(simpleReceiver);
              simpleReceiver.activateOptions();
              receiversPanel.updateReceiverTreeInDispatchThread();
            } catch (Exception e) {
              MessageCenter.getInstance().getLogger().error(
                "Error creating Receiver", e);
              MessageCenter.getInstance().getLogger().info(
View Full Code Here

TOP

Related Classes of org.apache.log4j.plugins.Receiver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.