Class SysPrefType

  • All Implemented Interfaces:
    CacheHint
    Direct Known Subclasses:
    SysDefaultPrefType

    public class SysPrefType
    extends java.util.Observable
    implements CacheHint

    SysPrefType manages the PreferenceLevel.SYSTEM definitions file for application user preferences (object instance: getDefinition(), while its subclass getDefault() manages the PreferenceLevel.SYSTEM definitions file for administrative defaults.

    The Observable parent class allows the cache/backing store to be informed when setFilePath(String) is called.

    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.Long getCacheStateId​(java.lang.String name)
      Returns a value for the current state of the cache hint This value is used in maintaining cache consistency across different caches using the same hint object (for instance, session based cache across a web cluster where each machine in the cluster holds a copy of the cache) Whenever a change is made to the cached value in one cache, the stateId is incremented
      static SysDefaultPrefType getDefault()
      This returns the SysPrefType for the server default definitions.
      static SysDefaultPrefType getDefault​(WebIServerSession session)
      The session object is used as a container for the server name, and either the project name or DSS ID.
      static SysDefaultPrefType getDefault​(java.lang.String serverName)
      Returns the definitions for the given server
      static SysDefaultPrefType getDefault​(java.lang.String serverName, java.lang.String projectName)
      static SysPrefType getDefinition()
      This returns the SysPrefType for the application user default definitions.
      java.lang.String getFilePath()
      Retrieve the location of the file persisting this system level preference.
      java.lang.String getHint()
      An identifier associated with this class, and identifying itself in the cache.
      static SysDefaultPrefType getUnsessionedDefaults()  
      int hashCode()  
      void setCacheStateId​(java.lang.String name, java.lang.Long stateId)
      Sets the stateId - see CacheHint.getCacheStateId(String).
      void setFilePath​(java.lang.String path)
      Set the file location of the file persisting this system level preference.
      java.lang.String toString()  
      • Methods inherited from class java.util.Observable

        addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • USER_SYSTEM_DEFAULTS_FILE

        protected static final java.lang.String USER_SYSTEM_DEFAULTS_FILE
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • _label

        protected java.lang.String _label
      • _filepath

        protected java.lang.String _filepath
    • Method Detail

      • getDefinition

        public static SysPrefType getDefinition()
        This returns the SysPrefType for the application user default definitions.
        Returns:
        SysPrefType user application definitions CacheHint.
      • getUnsessionedDefaults

        public static SysDefaultPrefType getUnsessionedDefaults()
        Since:
        MicroStrategy Web 7.5.3
      • getDefault

        public static SysDefaultPrefType getDefault()
                                             throws PreferencesException
        This returns the SysPrefType for the server default definitions. SysDefaultPrefType extends SysPrefType, and adds information about the designated server level preferences.
        Returns:
        SysDefaultPrefType server configuration definitions.
        Throws:
        PreferencesException - error obtaining CacheHint.
      • getDefault

        public static SysDefaultPrefType getDefault​(java.lang.String serverName)
                                             throws PreferencesException
        Returns the definitions for the given server
        Parameters:
        serverName - server name
        Returns:
        SysDefaultPrefType server configuration definitions CacheHint
        Throws:
        PreferencesException - error obtaining CacheHint
      • getDefault

        public static SysDefaultPrefType getDefault​(WebIServerSession session)
                                             throws PreferencesException

        The session object is used as a container for the server name, and either the project name or DSS ID. WebIServerSession is used to perform the lookup from project name to DSS ID, the latter of which is used as a unique key since project names can now be localized. No user login is required, i.e. no user session is required, but a valid server name, server port, and a valid connection (or ability to auto-connect) is required to enable the project name to DSS ID lookup. Auto-connect is configurable via WebClusterAdmin.setAutoConnect(boolean)).

        Parameters:
        session - a container for server name, server port, and either project name or project DSS ID.
        Returns:
        the CacheHint.
        Throws:
        PreferencesException - thrown if an error occurs.
        Since:
        MicroStrategy Web 9.0.0
      • getFilePath

        public java.lang.String getFilePath()
                                     throws java.lang.IllegalStateException
        Retrieve the location of the file persisting this system level preference.
        Returns:
        path of the definitions file.
        Throws:
        java.lang.IllegalStateException - if path not configured
      • setFilePath

        public void setFilePath​(java.lang.String path)
                         throws java.io.FileNotFoundException,
                                java.io.IOException,
                                java.lang.IllegalArgumentException
        Set the file location of the file persisting this system level preference. In a distributed environment (e.g. application clustering), this file should be set to a shared location.
        Parameters:
        path - the file path.
        Throws:
        java.io.IOException - if an error occurs locating the file.
        java.io.FileNotFoundException - if the file cannot be found.
        java.lang.IllegalArgumentException - if the file path is empty.
      • getHint

        public java.lang.String getHint()
        An identifier associated with this class, and identifying itself in the cache.
        Returns:
        CacheHint identifier
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getCacheStateId

        public java.lang.Long getCacheStateId​(java.lang.String name)
        Description copied from interface: CacheHint
        Returns a value for the current state of the cache hint This value is used in maintaining cache consistency across different caches using the same hint object (for instance, session based cache across a web cluster where each machine in the cluster holds a copy of the cache) Whenever a change is made to the cached value in one cache, the stateId is incremented
        Specified by:
        getCacheStateId in interface CacheHint
        Parameters:
        name - cache name
        Returns:
        current state of the cache hint
        See Also:
        CacheHint.getCacheStateId(String)