#!/bin/bash

source /var/onap/functions

hbase_version=1.2.0

# install_hadoop() - Function that installs Hadoop
function install_hadoop {
    local release=titan
    local version=1.0.0
    local filename=$release-$version-hadoop1
    local dest_folder=/opt/hadoop/current

    if [ ! -d $dest_folder ]; then
        curl http://s3.thinkaurelius.com/downloads/$release/$filename.zip -o /tmp/${filename}.zip
        install_package unzip
        mkdir -p $dest_folder
        unzip /tmp/${filename}.zip -d $dest_folder
    fi

    pushd $dest_folder/${filename}
    # Change commitlog_directory and data_file_directories values (https://stackoverflow.com/a/26856246/1707651)
    sed -i "s|db/cassandra/data|/tmp/data|g" conf/cassandra/cassandra.yaml
    sed -i "s|db/cassandra/commitlog|/tmp/commitlog|g" conf/cassandra/cassandra.yaml

    install_java
    ./bin/titan.sh start
    popd
}

# install_haproxy() - Function that install HAProxy
function install_haproxy {
    if is_package_installed haproxy; then
        return
    fi
    install_package software-properties-common
    add-apt-repository -y ppa:vbernat/haproxy-1.7
    update_repos
    install_package haproxy
    cp /var/onap/files/haproxy.cfg /etc/haproxy/
    cp /var/onap/files/aai.pem /etc/ssl/private/
    chmod 640 /etc/ssl/private/aai.pem
    chown root:ssl-cert /etc/ssl/private/aai.pem
    mkdir -p /usr/local/etc/haproxy
    #echo "127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org" >> /etc/hosts

    service haproxy restart
}

# compile_aai_repos() - Function that compiles AAI source repo.
function compile_aai_repos {
    local repos="aai/aai-common aai/resources aai/logging-service aai/traversal"
    if [[ "$compile_repo" == "True" ]]; then
        repos="${repos[aai]}"
    fi

    for repo in ${repos[@]}; do
        compile_src ${src_folders[aai]}${repo#*aai}
    done
}

# setup_titan() - Function that configures AAI services to connect to Hadoop Titan
function setup_titan {
    local subdirectory="bundleconfig-local/etc/appprops"
    install_python_package crudini

    for dirc in resources/aai-resources traversal/aai-traversal; do
        for file in titan-cached.properties titan-realtime.properties; do
            crudini --set "${src_folders[aai]}/$dirc/$subdirectory/$file" "" "storage.backend" "cassandra"
            crudini --set "${src_folders[aai]}/$dirc/$subdirectory/$file" "" "storage.hostname" "localhost"
        done
    done

    # Add the schema to the local instance
    compile_src ${src_folders[aai]}/resources/aai-resources/
    uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless
    pushd ${src_folders[aai]}
    java -DAJSC_HOME=${src_folders[aai]}/resources/aai-resources -DBUNDLECONFIG_DIR="bundleconfig-local" -cp aai-common/aai-core/target/aai-core-*.jar:resources/aai-resources/target/aai-resources.jar:resources/aai-resources/target/userjars/* org.onap.aai.dbgen.GenTester
    popd
}

# _start_data_managment() - Funtion that start a data management service
function _start_data_managment {
    local service=$1
    local debug_port=$2

    install_maven
    pushd ${src_folders[aai]}/$service
    export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$debug_port,server=y,suspend=n"
    mvn -P runAjsc &
    popd
}

# start_aai_microservices() - Function that starts AAI microservices
function start_aai_microservices {
    _start_data_managment resources 9446
    sleep 360
    _start_data_managment traversal 9447
}

# install_aai() - Install AAI Services
function install_aai {
    install_docker_compose
    pushd ${src_folders[aai]}/test-config
    ./deploy_vm2.sh
    ./deploy_vm1.sh
    popd
}

# get_aai_images() - Function that pulls or creates AAI docker images
function get_aai_images {
    pull_docker_image elasticsearch:2.4.1
    docker_openecomp_login
    pull_docker_image ${nexus_docker_repo:-nexus3.onap.org:10001}/aaionap/hbase:${hbase_version}

    if [[ "$build_image" == "True" ]]; then
        unset MAVEN_OPTS
        for project in resources/aai-resources traversal/aai-traversal search-data-service data-router model-loader sparky-be; do
            build_docker_image ${src_folders[aai]}/$project
        done
    else
        for image in aai-resources aai-traversal search-data-service data-router model-loader sparky-be; do
            pull_onap_image $image
        done
    fi
}

# init_aai() - Function that initialize AAI services
function init_aai {
    install_hadoop
    install_haproxy

    if [[ "$clone_repo" == "True" ]]; then
        clone_repos "aai"
    fi
    compile_aai_repos

    setup_titan
    #start_aai_microservices

    if [[ "$skip_get_images" == "False" ]]; then
        get_aai_images
    fi
    if [[ "$skip_install" == "False" ]]; then
        install_aai
    fi
}
