Class CoreProvider

java.lang.Object
org.ka2ddo.yaac.pluginapi.Provider
org.ka2ddo.yaac.core.provider.CoreProvider

public class CoreProvider extends Provider
This class defines the core functionality to be provided by the YAAC application. In essence, this is the root plugin that all other plugins augment and extend. This is the only Provider subclass explicitly coded into YAAC; all others are loaded from JAR files as defined by the Provider class's documentation.
Author:
Andrew Pavlin, KA2DDO
  • Field Details

    • TOP_MENU

      public static final String[] TOP_MENU
      The pre-localization hierarchy of sub-menu names for a menu at the top level, made available for use by plugins creating new menus.
    • EXIT_ACTION

      public static final AbstractMenuAction EXIT_ACTION
      This Action performs the operations needed to cleanly shut down YAAC and free up the system resources it is using.
  • Method Details

    • getInstance

      public static CoreProvider getInstance()
      Get the core instance of Provider for YAAC.
      Returns:
      singleton CoreProvider
    • getPortConnectorTypes

      public Provider.PortEntry[] getPortConnectorTypes()
      Get PortConnector drivers provided by this Provider.
      Overrides:
      getPortConnectorTypes in class Provider
      Returns:
      array of PortEntry objects pairing port type names to drivers
    • getConfigurationPanels

      public Map<String,String> getConfigurationPanels()
      Get any panels needed by this Provider to provision or configure the services offered by the Provider. The class names are expected to have a wildcard '*' in then to indicate where a platform-specific package variation should be plugged in (such as 'gui' for a conventional Java AWT/Swing GUI, or 'android' for an Android configuration view.
      Overrides:
      getConfigurationPanels in class Provider
      Returns:
      Map of localized tab names to class names of GUI-displayable components to add to the expert-mode ConfigurationDialog when it is invoked (usually, a LinkedHashMap, so the tabs can be provided in a specific order)
      See Also:
    • getFilters

      public Filter[] getFilters()
      Get any filters to add to the main CumulativeBooleanAndFilter in the main class of YAAC.
      Overrides:
      getFilters in class Provider
      Returns:
      array of Filter implementations
    • getOSMChangeSetIds

      public static ChangeSet[] getOSMChangeSetIds(boolean getBoth, boolean announceErrors)
      Get the local and remote OSM ChangeSet records for the versions of the OpenStreetMap data stored locally and available on the tile server website.
      Parameters:
      getBoth - boolean true if both local and server changesets should be obtained, false if only local
      announceErrors - boolean true if this method should raise GUI displays to announce fatal errors
      Returns:
      array of local and server ChangeSet records, or null if either the local tile directory is not available or writeable, or the remote webserver won't answer the query for its current changeset
    • getServerOSMChangeset

      public static ChangeSet getServerOSMChangeset(String webTileDir)
      Query the author's website for the currently available changeset of the pre-imported OpenStreetMap tile files. The subdirectory of the website containing the tileset can be changed from the default with the Java JVM property dated.tile.dir specified as the relative subdirectory name within the website.
      Parameters:
      webTileDir - String of subdirectory on webserver where tile files are located, or null to use default of property value of dated.tile.dir property, or just "tiledir"
      Returns:
      ChangeSet, or null if server could not be reached or changeset file could not be read
    • getMenuItems

      public AbstractMenuAction[] getMenuItems()
      Get Actions to define new menu items from this Provider. Actions define the following properties:
      • PRE_LOCALIZE_MENU_TAG_NAME - the pre-ResourceBundle.getString() lookup of NAME that potential overriding menu entries can be identified (i.e., "menu.View.Weather.Wind")
      • PRE_LOCALIZED_MENU_HIERARCHY - the array of localization tag names for the menu names in hierarchical order to contain this menu entry (i.e., { "menu.View", "menu.View.Weather" })
      • SMALL_ICON (optional) - to label the menu entry
      Other properties defined by Action or this class may also be specified. In particular, "selected" triggers use of JCheckBoxMenuItem or JRadioButtonMenuItem, and "BUTTON_GROUP_NAME" differentiates between them (JRadioButtonMenuItems are always associated with ButtonGroups).
      Overrides:
      getMenuItems in class Provider
      Returns:
      array of Action objects
      See Also:
    • getAboutAttributions

      public String[] getAboutAttributions()
      Specify attributions, credits/acknowledgements, and license references to be displayed in the About dialog box. This method is called when the Help->About menu choice is selected.
      Overrides:
      getAboutAttributions in class Provider
      Returns:
      array of localized Strings, each containing one attribution or acknowledgement
    • getHelpSet

      public javax.help.HelpSet getHelpSet()
      Provide the base HelpSet for complete online documentation.
      Overrides:
      getHelpSet in class Provider
      Returns:
      a JavaHelp HelpSet to merge if this Provider has one
    • getImageIconPath

      public String getImageIconPath()
      Return an icon image associated with this Provider.
      Overrides:
      getImageIconPath in class Provider
      Returns:
      String relative pathname for this Provider's icon image, or null for no icon
    • runInitializersAfter

      public void runInitializersAfter()
      Execute this function after calling all of the other functions of the CoreProvider. This allows any Provider-specific initialization to run after menus and drivers are loaded, such as registering the standard query handlers, starting the mini-webserver, and connecting some of the core event listeners to their\ event generators.
      Overrides:
      runInitializersAfter in class Provider
      See Also:
    • getCoreWebServer

      public HttpServer getCoreWebServer()
      Get the web server instance associated with the core services of YAAC.
      Returns:
      HttpServer instance
    • hasRXTX

      public boolean hasRXTX()
      Report whether this plugin was able to load the (now obsolete) RXTX native library for accessing serial ports. Note this will only report a meaningful value after the getPortConnectorTypes() method has been called.
      Returns:
      boolean true if RXTX native library was loaded successfully
      See Also:
    • getUserAgent

      public String getUserAgent()
      Return a standard string for identifying this installation of YAAC to a web server in the User-Agent HTTP header property. This will provide operating system, Java runtime version, and locale information to the author to help him direct internationalization support for future YAAC development; the personal identity of the user in that country using that operating system will not be reported.
      Returns:
      String to specify as the value of User-Agent
    • isNonencryptedHTTPForced

      public boolean isNonencryptedHTTPForced()
      Indicate if YAAC is configured to support Internet networks prohibiting encrypted traffic (such as the Amateur Radio HSMM [High-Speed MultiMedia] networks). If so, only plain HTTP will be used instead of HTTPS; if the requested service only operates over HTTPS, the user will be informed that encrypted requests cannot be made.
      Returns:
      boolean true if only unencrypted HTTP may be used for web requests
    • setNonencryptedHTTPForced

      public void setNonencryptedHTTPForced(boolean onlyHTTP)
      Specify if YAAC is configured to support Internet networks prohibiting encrypted traffic. If so, only plain HTTP will be used instead of HTTPS; if the requested service only operates over HTTPS, the user will be informed that encrypted requests cannot be made.
      Parameters:
      onlyHTTP - boolean true if only unencrypted HTTP may be used for web requests
    • isIPv4Forced

      public static boolean isIPv4Forced()
      Indicate if YAAC is configured to support Internet networks supporting IPv6. Some Internet Service Providers are not up-to-date and only support IPv4 network addresses and protocols.
      Returns:
      boolean true if only IPv4 addresses will be used for socket connections
    • setIPv4Forced

      public static void setIPv4Forced(boolean onlyIPv4)
      Specify if YAAC is configured to support Internet networks supporting IPv6. Some Internet Service Providers are not up-to-date and only support IPv4 network addresses and protocols.
      Parameters:
      onlyIPv4 - boolean true if only IPv4 addresses will be used for socket connections
    • main

      public static void main(String[] args)
      Method to allow printing out version of YAAC (alternative to YAAC class's -version command-line option).
      Parameters:
      args - ignored