summaryrefslogtreecommitdiffstats
path: root/Monitoring/MonitoringTool/PacketTracking/scripts/netview.sh
blob: 8612aacfce7cde8db926e17d2f6ef75e01c6aa7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh
# NetView helper script
#
CMD=$1

#
# Usage
#
usage () {
cat <<EOT
#
#  NetView maven helper script
#

USAGE:   netview.sh {clean|build|start}

EOT
}
#
# Clean all
#
cleanall() {
 save_dir=`pwd`
 cd $buildhome/pt-api
 if [ -r "./pom.xml" ]; then
    echo "# cleaning pt-api # "
    mvn clean
    echo "# cleaning NetView"
    cd $buildhome/netview
    mvn clean
 else
  curr_dir=`pwd`
  cat<<EOT 
ERROR: Could not find $curr_dir/pom.xml 
       Please checkout pt-api in the indicated location and try again. 

EOT
 fi
 cd $save_dir



}
#
# Build all dependencies using maven
#
buildall () {
 save_dir=`pwd`
 cd $buildhome/netview
 if [ -r "./pom.xml" ]; then
    echo "#####################"
    echo "# Building PT-API   #"
    echo "#####################"
    cd $buildhome/pt-api
    mvn compile install -Dmaven.test.skip=true
    echo ""
    echo "####################"
    echo "# Building NetView #"
    echo "####################"
    cd $buildhome/netview
    mvn compile exec:exec -Dmaven.test.skip=true
 else
  curr_dir=`pwd`
  cat<<EOT 
ERROR: Could not find $curr_dir/pom.xml 
       Please checkout netview in the indicated location and try again. 

EOT
 fi
 cd $save_dir

}
#
# Start NetView
#
start (){
 if [ -r $buildhome/netview/.m2classpath ]; then
  echo "Starting NetView"
  cd $buildhome/netview
   ../scripts/m2run de.fhg.fokus.net.netview.control.MainController 
 else
  cat <<EOT
ERROR: project not built. Assure you have mvn in the path and
       run "netview.sh build"
EOT
 fi
}


#
# MAIN
#
cd `dirname $0`/..;
buildhome=$PWD

case $CMD in
  build)
    buildall
  ;;
  clean)
    cleanall
  ;;
  start)
    start
  ;;
  *)
    usage
esac