org.ka2ddo.yaac.core.provider
Class CoreProvider

java.lang.Object
  extended by org.ka2ddo.yaac.pluginapi.Provider
      extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.ka2ddo.yaac.pluginapi.Provider
Provider.PortEntry
 
Field Summary
static AbstractMenuAction ABOUT_ACTION
          This Action performs the operations needed to open the About dialog, identifying and describing the YAAC application.
static AbstractMenuAction CONFIGURE_ACTION
          This Action performs the operations needed to open the expert-mode Configuration dialog.
static AbstractMenuAction EXIT_ACTION
          This Action performs the operations needed to cleanly shut down YAAC and free up the system resources it is using.
static java.lang.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.
 
Fields inherited from class org.ka2ddo.yaac.pluginapi.Provider
PROVIDER_API_VERSION
 
Method Summary
 java.lang.String[] getAboutAttributions()
          Specify attributions, credits/acknowledgements, and license references to be displayed in the About dialog box.
 java.util.Map<java.lang.String,java.lang.String> getConfigurationPanels()
          Get any panels needed by this Provider to provision or configure the services offered by the Provider.
 HttpServer getCoreWebServer()
          Get the web server instance associated with the core services of YAAC.
 Filter[] getFilters()
          Get any filters to add to the main CumulativeBooleanAndFilter in the main class of YAAC.
 javax.help.HelpSet getHelpSet()
          Provide the base HelpSet for complete online documentation.
 java.lang.String getImageIconPath()
          Return an icon image associated with this Provider.
static CoreProvider getInstance()
          Get the core instance of Provider for YAAC.
 AbstractMenuAction[] getMenuItems()
          Get Actions to define new menu items from this Provider.
static ChangeSet[] getOSMChangeSetIds(boolean getBoth)
          Get the local and remote OSM ChangeSet records for the versions of the OpenStreetMap data stored locally and available on the tile server website.
 Provider.PortEntry[] getPortConnectorTypes()
          Get PortConnector drivers provided by this Provider.
static ChangeSet getServerOSMChangeset()
          Query the author's website for the currently available changeset of the pre-imported OpenStreetMap tile files.
 java.lang.String getUserAgent()
          Return a standard string for identifying this installation of YAAC to a web server in the User-Agent HTTP header property.
 boolean hasRXTX()
          Report whether this plugin was able to load the RXTX native library for accessing serial ports.
static void logCurrentStateToPrefs(java.util.prefs.Preferences prefs)
          Checkpoint a description of YAAC's current execution environment into the Preferences so that the information can be saved in a configuration save file.
 void runInitializersAfter()
          Execute this function after calling all of the other functions of the CoreProvider.
 boolean runInitializersBefore(int providerApiVersion)
          Execute this function before calling any of the other functions of the Provider.
 
Methods inherited from class org.ka2ddo.yaac.pluginapi.Provider
findHelpSet, getAuthor, getInfo, getName, getVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOP_MENU

public static final java.lang.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.


CONFIGURE_ACTION

public static final AbstractMenuAction CONFIGURE_ACTION
This Action performs the operations needed to open the expert-mode Configuration dialog.


ABOUT_ACTION

public static final AbstractMenuAction ABOUT_ACTION
This Action performs the operations needed to open the About dialog, identifying and describing the YAAC application.

Method Detail

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 java.util.Map<java.lang.String,java.lang.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:
YAAC.getMsg(String), YAAC.getMsg(String, String), YAAC.getMsgBundle(), YAAC.getMsgBundle(String)

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)
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
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()
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.

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: 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:
AbstractMenuAction, AbstractPopupMenuAction

logCurrentStateToPrefs

public static void logCurrentStateToPrefs(java.util.prefs.Preferences prefs)
Checkpoint a description of YAAC's current execution environment into the Preferences so that the information can be saved in a configuration save file. Also dump the current thread states to the YAAC.out log file to help debug.

Parameters:
prefs - Preferences node to write the descriptive information to

getAboutAttributions

public java.lang.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 java.lang.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

runInitializersBefore

public boolean runInitializersBefore(int providerApiVersion)
Execute this function before calling any of the other functions of the Provider. This allows any Provider-specific initialization to run before menus and drivers are loaded, and also permits the Provider to block usage of the plugin (for example, if the plugin provides services only available on Microsoft Windows, but YAAC is being executed on Mac OS X).

Overrides:
runInitializersBefore in class Provider
Parameters:
providerApiVersion - the int version of the Provider API supported by the build of YAAC trying to load this plugin
Returns:
boolean false if this plugin cannot be loaded for some reason (such as missing pre-requisite software on the executing platform, or requiring a version of YAAC newer than the executing one)

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

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 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:
getPortConnectorTypes()

getUserAgent

public java.lang.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 identify of the user in that country using that operating system will not be reported.

Returns:
String to specify as the value of User-Agent