Class BackendConfiguration

  • All Implemented Interfaces:
    org.tentackle.validate.ScopeConfigurator, org.tentackle.validate.Validateable

    public class BackendConfiguration
    extends AbstractSessionConfiguration
    Configuration for a database backend.
    The configuration is stored via the standard Preferences and provides the paramaters necessary to connect to the database backend.
    The config refers to a DriverConfiguration that loads the corresponding driver.

    Whether username and password are optional depends on the use case. If the configuration is used by a standard DesktopApplication (see fx-rdc module), the user/password is mandatory for local sessions (with driver) and ignored for remote sessions (without driver).
    Other application types may enforce their own rules.

    Notice that the implementation does not depend on the tentackle-database or tentackle-sql module!

    • Constructor Detail

      • BackendConfiguration

        public BackendConfiguration​(java.lang.String application,
                                    java.lang.String name,
                                    java.lang.String url,
                                    java.lang.String options,
                                    DriverConfiguration driver,
                                    java.lang.String user,
                                    java.lang.String password)
        Creates a backend configuration.
        Parameters:
        application - the application name
        name - the symbolic backend name
        url - the host- or service url
        driver - the symbolic driver name, see DriverConfiguration, null or empty if remote
        user - the optional username, null or empty if none
        password - the optional password, null or empty if none
    • Method Detail

      • getBackendConfigurations

        public static java.util.Map<java.lang.String,​BackendConfiguration> getBackendConfigurations​(java.lang.String application,
                                                                                                          boolean system)
        Loads all backend configurations for a given application.
        Parameters:
        application - the application name
        system - true if load from system preferences, else user preferences
        Returns:
        the backend configurations
      • removeBackendConfigurations

        public static void removeBackendConfigurations​(java.lang.String application,
                                                       boolean system)
        Removes all backend configurations for given application.
        Parameters:
        application - the application name
        system - true if load from system preferences, else user preferences
      • getApplication

        @Bindable
        @NotNull
        public java.lang.String getApplication()
        Gets the application name.
        Returns:
        the application name
      • setApplication

        @Bindable
        public void setApplication​(java.lang.String application)
        Sets the application name.
        Parameters:
        application - the application name
      • getUrl

        @Bindable
        @NotNull
        public java.lang.String getUrl()
        Gets the host- or service url.
        Returns:
        the url
      • setUrl

        @Bindable
        public void setUrl​(java.lang.String url)
        Sets the host- or service url.
        Parameters:
        url - the url
      • getOptions

        @Bindable
        public java.lang.String getOptions()
        Gets other options.
        Each option goes into a separate line.
        Returns:
        the options
      • setOptions

        @Bindable
        public void setOptions​(java.lang.String options)
        Sets the options.
        Parameters:
        options - the options, null if none
      • getDriver

        @Bindable
        public DriverConfiguration getDriver()
        Gets the driver configuration.
        Returns:
        the driver, null if remote or from classpath
      • setDriver

        @Bindable
        public void setDriver​(DriverConfiguration driver)
        Sets the driver configuration.
        Parameters:
        driver - the driver, null if remote or from classpath
      • getUser

        @Bindable
        public java.lang.String getUser()
        Gets the optional username.
        Returns:
        the username
      • setUser

        @Bindable
        public void setUser​(java.lang.String user)
        Gets the username.
        Parameters:
        user - the username
      • getPassword

        @Bindable
        public java.lang.String getPassword()
        Gets the optional password.
        Returns:
        the password
      • setPassword

        @Bindable
        public void setPassword​(java.lang.String password)
        Sets the password.
        Parameters:
        password - the password
      • persist

        public void persist​(boolean system)
        Persists this configuration.
        Parameters:
        system - true if store in system preferences (requires extra permission), else user preferences
      • remove

        public void remove​(boolean system)
        Removes this configuration.
        Parameters:
        system - true if store in system preferences (requires extra permission), else user preferences
      • equals

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

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