Class XFSetup

java.lang.Object
de.xima.fc.setup.XFSetup
All Implemented Interfaces:
Serializable

public class XFSetup extends Object implements Serializable
Central class for managing the creating of clients and system-updates
Author:
XIMA MEDIA GmbH
See Also:
  • Constructor Details

    • XFSetup

      public XFSetup()
  • Method Details

    • storeDBSettings

      public static void storeDBSettings(DBConnectionData data, boolean suppressOpenListener, boolean suppressCloseListener) throws IOException, org.apache.commons.configuration2.ex.ConfigurationException
      Method to store the db-settings in the correct properties-file
      Parameters:
      data - DBConnectionData the data to store
      suppressOpenListener - true if the entity-manager-factory open-listener should be suppressed, false otherwise
      suppressCloseListener - true if the entity-manager-factory close-listener should be suppressed, false otherwise
      Throws:
      IOException - on i/o-errors
      org.apache.commons.configuration2.ex.ConfigurationException - on errors while saving the configuration
    • storeDBSettings

      public static void storeDBSettings(DBConnectionData data, boolean supressAllListener) throws IOException, org.apache.commons.configuration2.ex.ConfigurationException
      Method to store the db-settings in the correct properties-file
      Parameters:
      data - DBConnectionData the data to store
      supressAllListener - true if the entity-manager-factory listeners should be suppressed, false otherwise
      Throws:
      IOException - on i/o-errors
      org.apache.commons.configuration2.ex.ConfigurationException - on errors while saving the configuration
    • getMandantByFilterCriterion

      public static Mandant getMandantByFilterCriterion(IEntityContext ec, String filterCriterion, String filterValue)
      Method to read an client with the given filter-criterion
      Parameters:
      ec - IEntityContext for db-transations
      filterCriterion - String the key to filter for
      filterValue - String the value to filter for
      Returns:
      Mandant the found client or null
    • getMacAddress

      public static String getMacAddress() throws SocketException
      Returns:
      the mac-address of the current system
      Throws:
      SocketException - on errors while reading the mac-address
    • isDbConfigured

      public static Boolean isDbConfigured(UserContext uc)
      Checks if the database is configured and accessible
      Parameters:
      uc - UserContext
      Returns:
      Boolean if the database is accessible
    • createClient

      public static FCMessage createClient(IEntityContext ec, Mandant client, MandantMailData mailData, String adminMail, IUser creator)
      Creates a client with the current IClientCreator and current IClientCreateData
      Parameters:
      ec - IEntityContext for database-transactions
      client - Mandant the client to create
      mailData - Mail server settings for the new client.
      adminMail - email address of the admin user
      creator - the user that is creating the client (need for protocol purposes)
      Returns:
      FCMessage as result of the creation
    • migrateProperties

      public static boolean migrateProperties(File backupDir, boolean isOverwrite) throws org.apache.commons.configuration2.ex.ConfigurationException
      Method to migrate the location and layout of old property-files to the new one
      Parameters:
      backupDir - File to backup-folder to migrate the property-files from
      isOverwrite - true if existing properties should be overridden, false otherwise
      Returns:
      true if the migration was successful, false otherwise
      Throws:
      org.apache.commons.configuration2.ex.ConfigurationException - on errors while creating the configuration-files
    • setCustomMandantCreator

      public static void setCustomMandantCreator(IClientCreator customCreator)
      Parameters:
      customCreator - IClientCreator the client-creator to set. null will be ignored.
    • setMandantCreator

      public static void setMandantCreator(IClientCreator mandantCreator)
      Parameters:
      mandantCreator - IClientCreator the client-creator to set. null will not be ignored.
    • getMandantCreator

      public static IClientCreator getMandantCreator()
      Returns:
      IClientCreator the current client-creator. If not set, a new DefaultClientCreator-instance will be returned.
    • getDefaultMandantData

      public static IClientCreateData getDefaultMandantData()
      Returns:
      the current IClientCreateData. null will be ignored. If not set, a new DefaultClientData-instance will be returned.
    • setDefaultMandantData

      public static void setDefaultMandantData(IClientCreateData defaultData)
      Parameters:
      defaultData - IClientCreateData the client-create-date to set. null will not be ignored.
    • uploadLicense

      @Deprecated public static void uploadLicense(InputStream input) throws IOException, FileNotFoundException, Exception
      Deprecated.
      The new license management does not store the license file into the file system (will be removed in next major version).
      Uploads the license-file to the correct path
      Parameters:
      input - InputStream the source-stream of the license-file
      Throws:
      IOException - on i/o-errors
      FileNotFoundException - if the file could not be found
      Exception - on errors
    • createMandant

      @Deprecated public static FCMessage createMandant(IEntityContext ec, Mandant client, MandantMailData mailData, MandantLdapData ldapData, Benutzer user)
      Creates an client with the current IClientCreator and current IClientCreateData
      Parameters:
      ec - IEntityContext for database-transactions
      client - Mandant the client to create
      mailData - Mail server settings for the new client.
      ldapData - LDAP settings for the new client.
      user - Benutzer the admin-user for the client
      Returns:
      FCMessage as result of the creation