Class PropertiesManager


  • public class PropertiesManager
    extends Object
    Manages the properties.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • PREFIX_PREFERRED_ARCHIVE_HANDLER

        public static final String PREFIX_PREFERRED_ARCHIVE_HANDLER
        the prefix for the preferred archive handler keys in the props file.
        See Also:
        Constant Field Values
      • PREFIX_PREFERRED_CONTENT_HANDLER

        public static final String PREFIX_PREFERRED_CONTENT_HANDLER
        the prefix for the preferred content handler keys in the props file.
        See Also:
        Constant Field Values
      • PREFIX_CUSTOM_CONTENT_HANDLER

        public static final String PREFIX_CUSTOM_CONTENT_HANDLER
        the prefix for the custom content handler keys in the props file.
        See Also:
        Constant Field Values
      • m_Properties

        protected static Properties m_Properties
        the properties.
      • m_Blacklisted

        protected static Set<String> m_Blacklisted
        the blacklisted handlers.
    • Constructor Detail

      • PropertiesManager

        public PropertiesManager()
    • Method Detail

      • getPreferredContentHandler

        public static ContentHandler getPreferredContentHandler​(File file)
        Returns the preferred content handler.
        Parameters:
        file - the file to get the preferred handler for
        Returns:
        the preferred handler
      • updatePreferredContentHandler

        public static boolean updatePreferredContentHandler​(String[] ext,
                                                            ContentHandler handler)
        Updates the preferred content handler.
        Parameters:
        ext - the extension to update
        handler - the preferred handler
        Returns:
        true if successfully updated
      • getPreferredArchiveHandler

        public static ArchiveHandler getPreferredArchiveHandler​(File file)
        Returns the preferred archive handler.
        Parameters:
        file - the file to get the preferred handler for
        Returns:
        the preferred handler
      • updatePreferredArchiveHandler

        public static boolean updatePreferredArchiveHandler​(String[] ext,
                                                            String handler)
        Updates the preferred archive handler.
        Parameters:
        ext - the extension to update
        handler - the preferred handler
        Returns:
        true if successfully updated
      • getCustomContentHandler

        public static ContentHandler getCustomContentHandler​(Class cls)
        Returns any custom content handler for the class. If not available, then just an instance of the class.
        Parameters:
        cls - the handler class to get the custom setup for
        Returns:
        the custom setup (or just an instance of the class), null if failed to instantiate
      • getCustomContentHandler

        public static ContentHandler getCustomContentHandler​(ContentHandler handler)
        Returns any custom content handler for the class. If not available, then just the provided instance.
        Parameters:
        handler - the handler to get the custom setup for
        Returns:
        the custom setup (or just the input)
      • setCustomContentHandler

        public static boolean setCustomContentHandler​(ContentHandler handler)
        Stores the custom setup of the handler. If just default options, then it gets ignored.
        Parameters:
        handler - the custom handler to update in props file
        Returns:
        true if updated
      • save

        protected static boolean save​(String action)
        Saves the properties.
        Parameters:
        action - what triggered the save action
        Returns:
        true if successful
      • getProperties

        public static Properties getProperties()
        Returns the properties that define the editor.
        Returns:
        the properties