summaryrefslogtreecommitdiffstats
path: root/.gitreview
blob: 3a5f50e02ff3268224dc31b28ab60f82ef498ca0 (plain)
1
2
3
4
[gerrit]
host=gerrit.onap.org
port=29418
project=so.git
36699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/bin/sh

# Common functions that can be used throughout multiple scripts
# In order to call these functions, this file needs to be sourced

# Sources the profile and sets the project home
source_profile(){
    : ${PROJECT_HOME:=/opt/app/aai-traversal}
}

# Runs the spring boot jar based on which main class
# to execute and which logback file to use for that class
execute_spring_jar(){

    className=$1;
    logbackFile=$2;

    shift 2;

    EXECUTABLE_JAR=$(ls ${PROJECT_HOME}/lib/*.jar);

    JAVA_OPTS="${JAVA_PRE_OPTS}";
    JAVA_OPTS="-DAJSC_HOME=$PROJECT_HOME";
    JAVA_OPTS="$JAVA_OPTS -DBUNDLECONFIG_DIR=resources";
    JAVA_OPTS="$JAVA_OPTS -Daai.home=$PROJECT_HOME ";
    JAVA_OPTS="$JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2";
    JAVA_OPTS="$JAVA_OPTS -Dloader.main=${className}";
    JAVA_OPTS="$JAVA_OPTS -Dlogback.configurationFile=${logbackFile}";
    JAVA_OPTS="${JAVA_OPTS} ${JAVA_POST_OPTS}";

    export SOURCE_NAME=$(grep '^schema.source.name=' ${PROJECT_HOME}/resources/application.properties | cut -d"=" -f2-);
    # Needed for the schema ingest library beans
    eval $(grep '^schema\.' ${PROJECT_HOME}/resources/application.properties | \
     sed 's/^\(.*\)$/JAVA_OPTS="$JAVA_OPTS -D\1"/g' | \
     sed 's/${server.local.startpath}/${PROJECT_HOME}\/resources/g'| \
     sed 's/${schema.source.name}/'${SOURCE_NAME}'/g'\
    )

    ${JAVA_HOME}/bin/java ${JVM_OPTS} ${JAVA_OPTS} -jar ${EXECUTABLE_JAR} "$@"
}

# Prints the start date and the script that the user called
start_date(){
    echo
    echo `date` "   Starting $0"
}

# Prints the end date and the script that the user called
end_date(){
    echo
    echo `date` "   Done $0"
}