Class ZeroConfPlugin

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Plugin, org.apache.log4j.spi.OptionHandler

public class ZeroConfPlugin extends GUIPluginSkeleton
This plugin is designed to detect specific Zeroconf zones (Rendevouz/Bonjour, whatever people are calling it) and allow the user to double click on 'devices' to try and connect to them with no configuration needed.

TODO need to handle NON-log4j devices that may be broadcast in the interested zones TODO add the default Zone, and the list of user-specified zones to a preferenceModel

See Also:
  • Field Details

    • LOG

      private static final org.apache.log4j.Logger LOG
    • discoveredDevices

      private ZeroConfDeviceModel discoveredDevices
    • deviceTable

      private JTable deviceTable
    • scrollPane

      private final JScrollPane scrollPane
    • preferenceModel

      private ZeroConfPreferenceModel preferenceModel
    • serviceInfoToReceiveMap

      private final Map<javax.jmdns.ServiceInfo,Plugin> serviceInfoToReceiveMap
    • connectToMenu

      private JMenu connectToMenu
    • helpItem

      private JMenuItem helpItem
    • nothingToConnectTo

      private JMenuItem nothingToConnectTo
    • MULTICAST_APPENDER_SERVICE_NAME

      private static final String MULTICAST_APPENDER_SERVICE_NAME
      See Also:
    • UDP_APPENDER_SERVICE_NAME

      private static final String UDP_APPENDER_SERVICE_NAME
      See Also:
    • XML_SOCKET_APPENDER_SERVICE_NAME

      private static final String XML_SOCKET_APPENDER_SERVICE_NAME
      See Also:
    • TCP_APPENDER_SERVICE_NAME

      private static final String TCP_APPENDER_SERVICE_NAME
      See Also:
    • NEW_UDP_APPENDER_SERVICE_NAME

      private static final String NEW_UDP_APPENDER_SERVICE_NAME
      See Also:
    • jmDNS

      private javax.jmdns.JmDNS jmDNS
  • Constructor Details

    • ZeroConfPlugin

      public ZeroConfPlugin()
  • Method Details

    • shutdown

      public void shutdown()
      Description copied from interface: Plugin
      Call when the plugin should be stopped.
    • save

      private void save()
    • getPreferenceFileLocation

      private File getPreferenceFileLocation()
    • activateOptions

      public void activateOptions()
    • registerServiceListenersForAppenders

      private void registerServiceListenersForAppenders()
    • injectMenu

      private void injectMenu()
      Attempts to find a JFrame container as a parent,and addse a "Connect to" menu
    • insertToLeftOfHelp

      private void insertToLeftOfHelp(JMenuBar menuBar, JMenu item)
      Hack method to locate the JMenu that is the Help menu, and inserts the new menu just to the left of it.
      Parameters:
      menuBar -
      item -
    • deviceDiscovered

      private void deviceDiscovered(javax.jmdns.ServiceInfo info)
      When a device is discovered, we create a menu item for it so it can be connected to via that GUI mechanism, and also if the device is one of the auto-connect devices then a background thread is created to connect the device.
      Parameters:
      info -
    • deviceRemoved

      private void deviceRemoved(String name)
      When a device is removed or disappears we need to remove any JMenu item associated with it.
      Parameters:
      name -
    • disconnectFrom

      private void disconnectFrom(javax.jmdns.ServiceInfo info)
    • isConnectedTo

      boolean isConnectedTo(javax.jmdns.ServiceInfo info)
      returns true if the serviceInfo record already has a matching connected receiver
      Parameters:
      info -
      Returns:
    • connectTo

      private void connectTo(javax.jmdns.ServiceInfo info)
      Starts a receiver to the appender referenced within the ServiceInfo
      Parameters:
      info -
    • getReceiver

      private Receiver getReceiver(javax.jmdns.ServiceInfo info)
    • locateMatchingMenuItem

      private JMenuItem locateMatchingMenuItem(String name)
      Finds the matching JMenuItem based on name, may return null if there is no match.
      Parameters:
      name -
      Returns:
    • main

      public static void main(String[] args)