Package jmri.profile

Class ProfileUtils

java.lang.Object
jmri.profile.ProfileUtils

public class ProfileUtils
extends Object
Utility methods to get information about Profiles.
  • Constructor Details

  • Method Details

    • getAuxiliaryConfiguration

      Get the XMl configuration container for a given configuration profile.
      Parameters:
      project - The project to get the configuration container for, or null to get a configuration container that can apply to all projects on this computer
      Returns:
      An XML configuration container, possibly empty
    • getPreferences

      public static Preferences getPreferences​(Profile project, Class<?> clazz, boolean shared)
      Get the preferences needed by a class for a given configuration profile.
      Parameters:
      project - The project to get the configuration for, or null to get a preferences object that can apply to all projects on this computer
      clazz - The class requesting preferences
      shared - True if the preferences are for all nodes (computers) this project may run on, false if the preferences are only for this node; ignored if the value of project is null
      Returns:
      The preferences
    • getUserInterfaceConfiguration

      Get the XMl configuration container for a given configuration profile's user interface state.
      Parameters:
      project - The project to get the configuration container for, or null to get a configuration container that can apply to all projects on this computer
      Returns:
      An XML configuration container, possibly empty
    • getCacheDirectory

      public static File getCacheDirectory​(Profile project, Class<?> owner)
      Get the local cache directory for the given profile.

      This cache is outside the profile for which the cache exists to prevent the possibility that different JMRI installations have different contents that would invalidate the cache if copied from one computer to another.

      Parameters:
      project - the project to get the cache directory for, or null to get the cache directory for all projects on this computer
      owner - The class owning the cached information, or null to get the cache directory for the project
      Returns:
      a directory in which data can be cached
    • copy

      public static void copy​(@Nonnull Profile source, @Nonnull Profile destination) throws IllegalArgumentException, IOException
      Copy one profile configuration to another profile.
      Parameters:
      source - The source profile.
      destination - The destination profile.
      Throws:
      IllegalArgumentException - If the destination profile is the active profile.
      IOException - If the copy cannot be completed.
    • copyPrivateContentToCurrentIdentity

      public static boolean copyPrivateContentToCurrentIdentity​(@Nonnull Profile profile) throws IOException
      Copy the most recently modified former identity, if any, for the current computer in the given profile to the current storage identity of the current computer for the given profile.
      Parameters:
      profile - the profile containing identities to copy
      Returns:
      true if an existing identity is copied, false otherwise
      Throws:
      IOException - if unable to a copy an existing identity