Package PamController

Class PamControlledUnitSettings

java.lang.Object
PamController.PamControlledUnitSettings
All Implemented Interfaces:
Serializable, ManagedParameters

public class PamControlledUnitSettings extends Object implements Serializable, ManagedParameters
See Also:
  • Constructor Details

    • PamControlledUnitSettings

      public PamControlledUnitSettings(String unitType, String unitName, String ownerClass, long versionNo, Object settings)
      Make a settings object with unpacked data. This must still be used with old style psf files
      Parameters:
      unitType -
      unitName -
      ownerClass -
      versionNo -
      settings -
    • PamControlledUnitSettings

      public PamControlledUnitSettings(String unitType, String unitName, String ownerClass, long versionNo, byte[] serialisedData)
      Make a settings object with byte[] data from a psfx file or read from the database. These will only be deserialized at the moment they are needed.

      This is required by the new plugin system, whereby settings for plugins will be loaded from file before the java class for those settings has been loaded.

      Parameters:
      unitType -
      unitName -
      ownerClass -
      versionNo -
      serialisedData -
    • PamControlledUnitSettings

      public PamControlledUnitSettings(byte[] data)
  • Method Details

    • getSettings

      public Object getSettings()
      Returns:
      The unit settings.
    • setSettings

      public void setSettings(Object settings)
      Parameters:
      settings - the settings to set
    • getUnitName

      public String getUnitName()
      Returns:
      The unit name
    • setUnitName

      public void setUnitName(String unitName)
      Parameters:
      unitName - the unitName to set
    • getUnitType

      public String getUnitType()
      Returns:
      The unit type
    • getVersionNo

      public long getVersionNo()
      Returns:
      the version number for these unit settings.
    • isSettingsOf

      public boolean isSettingsOf(String unitType, String unitName)
      Find out if this settings unit is that for the given type and name
      Parameters:
      unitType - Unit Type
      unitName - Unit Name
      Returns:
      true if these settings correspond to that unit.
    • isSame

      public boolean isSame(PamControlledUnitSettings p)
      Find out if a set of settings are compatible with another set.
      Parameters:
      p - another set of PamControlledUnitSettings.
      Returns:
      true if they have the same name type and version number
    • getSerialisedByteArray

      public byte[] getSerialisedByteArray()
      Get a byte array of the serialised data in this object. Note that this is generally the entire object, not it's settings, though that may change in a future release.
      Returns:
      a byte array of the serialised data in this object
    • getNamedSerialisedByteArray

      public byte[] getNamedSerialisedByteArray()
      Get a byte array of the serialised data but with a small header giving the unitType, unitName, versionNO and the size of the serialised data object
      Returns:
      byte array.
    • createFromNamedByteArray

      public static PamControlledUnitSettings createFromNamedByteArray(byte[] byteArray)
      Used when unpacking data from psfx files. These seem to have the type, name, etc encoded, then repeated in the serialised data which is the entire PamControlledUnitSettings object, which contains those same data again. This will fail if loading a plugin module which is not actually present
      Parameters:
      byteArray -
      Returns:
    • unpackByteArray

      public static Object unpackByteArray(byte[] byteArray)
      Create an object from a serialised byte array
      Parameters:
      byteArray - byte array
      Returns:
      new object (or null if invalid byte array)
    • getOwnerClassName

      public String getOwnerClassName()
      Get the class type of the module that owned these settings. Gets used when importing settings so that modules can be easily identified.
      Returns:
      the ownerClass
    • getParameterSet

      public PamParameterSet getParameterSet()
      Description copied from interface: ManagedParameters
      Get a set of data that describes all of the parameters in a class
      Specified by:
      getParameterSet in interface ManagedParameters
      Returns:
      description of the parameters in a class.
    • toString

      public String toString()
      Overrides:
      toString in class Object