common/src/main/java/gr/ntua/ece/cslab/selis/bda/common/Configuration.java
public static Configuration parseConfiguration(String configurationFile){
        Properties properties = new Properties();
        try {
            properties.load(new FileReader(configurationFile));
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, e.getMessage());
            return null;
        }

        Configuration conf = new Configuration();

        // Server Configuration.
        conf.server.address = properties.getProperty("server.address");
        try {
            conf.server.port = Integer.valueOf(properties.getProperty("server.port"));
        } catch (NumberFormatException e) {
            LOGGER.log(Level.SEVERE, e.getMessage());
            return null;
        }

        // Dimension Tables Configuration.
        conf.storageBackend.dbUsername = properties.getProperty("backend.db.dimension.username");
        conf.storageBackend.dbPassword = properties.getProperty("backend.db.dimension.password");
        conf.storageBackend.dbPrivilegedUsername = properties.getProperty("backend.db.dimension.privileged_username");
        conf.storageBackend.dbPrivilegedPassword = properties.getProperty("backend.db.dimension.privileged_password");
        conf.storageBackend.dimensionTablesURL = properties.getProperty("backend.db.dimension.url");

        // BDA Database Configuration.

        // TODO: Should add username/password for every StorageBackend.
        // conf.storageBackend.bdaDatabaseUsername = properties.getProperty("backend.db.bda.username");
        // conf.storageBackend.bdaDatabasePassword = properties.getProperty("backend.db.bda.password");

        conf.storageBackend.bdaDatabaseURL = properties.getProperty("backend.db.bda.url");

        // Event Log Configuration.

        // TODO: Should add username/password for every StorageBackend.
        // conf.storageBackend.eventLogUsername = properties.getProperty("backend.db.event.username");
        // conf.storageBackend.eventLogPassword = properties.getProperty("backend.db.event.password");

        conf.storageBackend.eventLogURL = properties.getProperty("backend.db.event.url");
        conf.storageBackend.eventLogMaster = properties.getProperty("backend.db.event.master.host");
        conf.storageBackend.eventLogQuorum = properties.getProperty("backend.db.event.quorum");

        conf.storageBackend.hdfsMasterURL = properties.getProperty("backend.hdfs.master.url");

        // Pub/Sub Configuration.
        conf.pubsub.authHash = properties.getProperty("pubsub.authhash");
        conf.pubsub.certificateLocation = properties.getProperty("pubsub.certificate.location");

        // Pub/Sub Subscriber Configuration.
        conf.subscriber.url = properties.getProperty("pubsub.subscriber.url");
        conf.externalSubscriber.url = properties.getProperty("pubsub.external.subscriber.url");

        // Keycloak Auth Configuration.
        conf.authClientBackend.authEnabled = Boolean.valueOf(properties.getProperty("keycloak.enabled"));
        conf.authClientBackend.authServerUrl = properties.getProperty("keycloak.bda.url");
        conf.authClientBackend.realm = properties.getProperty("keycloak.bda.realm");
        conf.authClientBackend.clientId = properties.getProperty("keycloak.bda.pubsub.client_id");
        conf.authClientBackend.clientSecret = properties.getProperty("keycloak.bda.pubsub.client_secret");
        conf.authClientBackend.bdaUsername = properties.getProperty("keycloak.bda.username");
        conf.authClientBackend.bdaPassword = properties.getProperty("keycloak.bda.password");

        // KPIDB configuration
        conf.kpiBackend.dbUrl = properties.getProperty("kpi.db.url");
        conf.kpiBackend.dbUsername = properties.getProperty("kpi.db.username");
        conf.kpiBackend.dbPassword = properties.getProperty("kpi.db.password");

        // Execution engine configuration
        conf.execEngine.sparkMaster = properties.getProperty("spark.master");
        conf.execEngine.sparkDeployMode = properties.getProperty("spark.deploy_mode");
        conf.execEngine.sparkConfJars = properties.getProperty("spark.conf.jars");
        conf.execEngine.sparkConfPackages = properties.getProperty("spark.conf.packages");
        conf.execEngine.sparkConfRepositories = properties.getProperty("spark.conf.repositories");
        conf.execEngine.sparkConfDriverMemory = properties.getProperty("spark.conf.driver_memory");
        conf.execEngine.sparkConfExecutorCores = properties.getProperty("spark.conf.executor_cores");
        conf.execEngine.sparkConfExecutorMemory = properties.getProperty("spark.conf.executor_memory");
        conf.execEngine.recipeStorageLocation = properties.getProperty("engines.recipe.storage.prefix");
        conf.execEngine.recipeStorageType = properties.getProperty("engines.recipe.storage.type");
        conf.execEngine.livyURL = properties.getProperty("spark.livy.url");

        configuration = conf;

        return conf;
    }
/**
     * parseConfiguration constructs a Configuration object through reading the provided configuration file.
     * @param configurationFile the path of the configuration file
     * @return the Configuration object
     */
parseConfiguration constructs a Configuration object through reading the provided configuration file.
@param configurationFile the path of the configuration file
@return the Configuration object
parseConfiguration constructs a Configuration object through reading the provided configuration file . @param configurationFile the path of the configuration file @return the Configuration object
public static Configuration parseConfiguration(String configurationFile){
        Properties properties = new Properties();
        try {
            properties.load(new FileReader(configurationFile));
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, e.getMessage());
            return null;
        }
        Configuration conf = new Configuration();
        conf.server.address = properties.getProperty("server.address");
        try {
            conf.server.port = Integer.valueOf(properties.getProperty("server.port"));
        } catch (NumberFormatException e) {
            LOGGER.log(Level.SEVERE, e.getMessage());
            return null;
        }
        conf.storageBackend.dbUsername = properties.getProperty("backend.db.dimension.username");
        conf.storageBackend.dbPassword = properties.getProperty("backend.db.dimension.password");
        conf.storageBackend.dbPrivilegedUsername = properties.getProperty("backend.db.dimension.privileged_username");
        conf.storageBackend.dbPrivilegedPassword = properties.getProperty("backend.db.dimension.privileged_password");
        conf.storageBackend.dimensionTablesURL = properties.getProperty("backend.db.dimension.url");
        conf.storageBackend.bdaDatabaseURL = properties.getProperty("backend.db.bda.url");
        conf.storageBackend.eventLogURL = properties.getProperty("backend.db.event.url");
        conf.storageBackend.eventLogMaster = properties.getProperty("backend.db.event.master.host");
        conf.storageBackend.eventLogQuorum = properties.getProperty("backend.db.event.quorum");
        conf.storageBackend.hdfsMasterURL = properties.getProperty("backend.hdfs.master.url");
        conf.pubsub.authHash = properties.getProperty("pubsub.authhash");
        conf.pubsub.certificateLocation = properties.getProperty("pubsub.certificate.location");
        conf.subscriber.url = properties.getProperty("pubsub.subscriber.url");
        conf.externalSubscriber.url = properties.getProperty("pubsub.external.subscriber.url");
        conf.authClientBackend.authEnabled = Boolean.valueOf(properties.getProperty("keycloak.enabled"));
        conf.authClientBackend.authServerUrl = properties.getProperty("keycloak.bda.url");
        conf.authClientBackend.realm = properties.getProperty("keycloak.bda.realm");
        conf.authClientBackend.clientId = properties.getProperty("keycloak.bda.pubsub.client_id");
        conf.authClientBackend.clientSecret = properties.getProperty("keycloak.bda.pubsub.client_secret");
        conf.authClientBackend.bdaUsername = properties.getProperty("keycloak.bda.username");
        conf.authClientBackend.bdaPassword = properties.getProperty("keycloak.bda.password");
        conf.kpiBackend.dbUrl = properties.getProperty("kpi.db.url");
        conf.kpiBackend.dbUsername = properties.getProperty("kpi.db.username");
        conf.kpiBackend.dbPassword = properties.getProperty("kpi.db.password");
        conf.execEngine.sparkMaster = properties.getProperty("spark.master");
        conf.execEngine.sparkDeployMode = properties.getProperty("spark.deploy_mode");
        conf.execEngine.sparkConfJars = properties.getProperty("spark.conf.jars");
        conf.execEngine.sparkConfPackages = properties.getProperty("spark.conf.packages");
        conf.execEngine.sparkConfRepositories = properties.getProperty("spark.conf.repositories");
        conf.execEngine.sparkConfDriverMemory = properties.getProperty("spark.conf.driver_memory");
        conf.execEngine.sparkConfExecutorCores = properties.getProperty("spark.conf.executor_cores");
        conf.execEngine.sparkConfExecutorMemory = properties.getProperty("spark.conf.executor_memory");
        conf.execEngine.recipeStorageLocation = properties.getProperty("engines.recipe.storage.prefix");
        conf.execEngine.recipeStorageType = properties.getProperty("engines.recipe.storage.type");
        conf.execEngine.livyURL = properties.getProperty("spark.livy.url");
        configuration = conf;
        return conf;
    }
public static Configuration parseConfiguration ( String configurationFile ) { Properties properties = new Properties ( ) ; try { properties . load ( new FileReader ( configurationFile ) ) ; } catch ( IOException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) ) ; return null ; } Configuration conf = new Configuration ( ) ; conf . server . address = properties . getProperty ( "server.address" ) ; try { conf . server . port = Integer . valueOf ( properties . getProperty ( "server.port" ) ) ; } catch ( NumberFormatException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) ) ; return null ; } conf . storageBackend . dbUsername = properties . getProperty ( "backend.db.dimension.username" ) ; conf . storageBackend . dbPassword = properties . getProperty ( "backend.db.dimension.password" ) ; conf . storageBackend . dbPrivilegedUsername = properties . getProperty ( "backend.db.dimension.privileged_username" ) ; conf . storageBackend . dbPrivilegedPassword = properties . getProperty ( "backend.db.dimension.privileged_password" ) ; conf . storageBackend . dimensionTablesURL = properties . getProperty ( "backend.db.dimension.url" ) ; conf . storageBackend . bdaDatabaseURL = properties . getProperty ( "backend.db.bda.url" ) ; conf . storageBackend . eventLogURL = properties . getProperty ( "backend.db.event.url" ) ; conf . storageBackend . eventLogMaster = properties . getProperty ( "backend.db.event.master.host" ) ; conf . storageBackend . eventLogQuorum = properties . getProperty ( "backend.db.event.quorum" ) ; conf . storageBackend . hdfsMasterURL = properties . getProperty ( "backend.hdfs.master.url" ) ; conf . pubsub . authHash = properties . getProperty ( "pubsub.authhash" ) ; conf . pubsub . certificateLocation = properties . getProperty ( "pubsub.certificate.location" ) ; conf . subscriber . url = properties . getProperty ( "pubsub.subscriber.url" ) ; conf . externalSubscriber . url = properties . getProperty ( "pubsub.external.subscriber.url" ) ; conf . authClientBackend . authEnabled = Boolean . valueOf ( properties . getProperty ( "keycloak.enabled" ) ) ; conf . authClientBackend . authServerUrl = properties . getProperty ( "keycloak.bda.url" ) ; conf . authClientBackend . realm = properties . getProperty ( "keycloak.bda.realm" ) ; conf . authClientBackend . clientId = properties . getProperty ( "keycloak.bda.pubsub.client_id" ) ; conf . authClientBackend . clientSecret = properties . getProperty ( "keycloak.bda.pubsub.client_secret" ) ; conf . authClientBackend . bdaUsername = properties . getProperty ( "keycloak.bda.username" ) ; conf . authClientBackend . bdaPassword = properties . getProperty ( "keycloak.bda.password" ) ; conf . kpiBackend . dbUrl = properties . getProperty ( "kpi.db.url" ) ; conf . kpiBackend . dbUsername = properties . getProperty ( "kpi.db.username" ) ; conf . kpiBackend . dbPassword = properties . getProperty ( "kpi.db.password" ) ; conf . execEngine . sparkMaster = properties . getProperty ( "spark.master" ) ; conf . execEngine . sparkDeployMode = properties . getProperty ( "spark.deploy_mode" ) ; conf . execEngine . sparkConfJars = properties . getProperty ( "spark.conf.jars" ) ; conf . execEngine . sparkConfPackages = properties . getProperty ( "spark.conf.packages" ) ; conf . execEngine . sparkConfRepositories = properties . getProperty ( "spark.conf.repositories" ) ; conf . execEngine . sparkConfDriverMemory = properties . getProperty ( "spark.conf.driver_memory" ) ; conf . execEngine . sparkConfExecutorCores = properties . getProperty ( "spark.conf.executor_cores" ) ; conf . execEngine . sparkConfExecutorMemory = properties . getProperty ( "spark.conf.executor_memory" ) ; conf . execEngine . recipeStorageLocation = properties . getProperty ( "engines.recipe.storage.prefix" ) ; conf . execEngine . recipeStorageType = properties . getProperty ( "engines.recipe.storage.type" ) ; conf . execEngine . livyURL = properties . getProperty ( "spark.livy.url" ) ; configuration = conf ; return conf ; }
parseConfiguration constructs a Configuration object through reading the provided configuration file.
parseConfiguration constructs a Configuration object through reading the provided configuration file .
// Server Configuration. // Dimension Tables Configuration. // BDA Database Configuration. // TODO: Should add username/password for every StorageBackend. // conf.storageBackend.bdaDatabaseUsername = properties.getProperty("backend.db.bda.username"); // conf.storageBackend.bdaDatabasePassword = properties.getProperty("backend.db.bda.password"); // Event Log Configuration. // TODO: Should add username/password for every StorageBackend. // conf.storageBackend.eventLogUsername = properties.getProperty("backend.db.event.username"); // conf.storageBackend.eventLogPassword = properties.getProperty("backend.db.event.password"); // Pub/Sub Configuration. // Pub/Sub Subscriber Configuration. // Keycloak Auth Configuration. // KPIDB configuration // Execution engine configuration