-
Notifications
You must be signed in to change notification settings - Fork 3
/
blackedition_lib.sh
executable file
·1931 lines (1662 loc) · 76.3 KB
/
blackedition_lib.sh
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Copyright 2024 Xyna GmbH, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Diese datei wird von install_black_edition.sh geladen.
# Alle Funktionen befinden sich hier.
# Namen der einzelnen Komponenten muessen eindeutig sein!
#+ Es wird mit grep der CSV-String geprueft...
ALL_COMPONENTS=("filter" "trigger" "services" "xynacluster" "oraclecluster" "xynafactory", "fractalmodellerh5en", "fractalmodellerh5de")
ALL_FILTERS=("nsnhix5600" "dhcp_v4" "radius")
ALL_TRIGGERS=("nsnhix5600" "dhcp_v4" "radius")
ALL_SERVICES=("nsnhix5600" "templatemechanism" "sipuseragent" "jmsforwarding" "dhcp_v4")
ALL_DEPLOY_TARGETS=("geronimo" "tomcat" "oracle")
ALL_DATAMODELTYPES=("mib","tr069","xsd");
#ACHTUNG: Version auch bei addRequirement zu default workspace berücksichtigen
ALL_APPLICATIONS="Base Processing"; #Default-Applications, die immer installiert sein sollten
APPMGMTVERSION=1.0.10
GUIHTTPVERSION=1.3.5
SNMPSTATVERSION=1.0.3
PROCESSINGVERSION=1.0.22
ALL_REPOSITORYACCESSES=("svn");
INSTANCE_NUMBER="1" #1 ist default
parse_commandline_arguments () {
MERGE_MODE="merge";
BASH_COMPLETION="true";
LOG4J2_MERGE="true";
CHECK_THIRD_PARTY_LICENSES="none";
COMPONENT_APPLICATIONS="true";
while getopts ":nvhH?ablpABLP3:c:d:f:g:i:m:r:s:t:w:x:C:D:F:G:R:S:T:W:X:" OPTION
do
if [[ "x${OPTARG:0:1}" == "x-" ]]; then DISPLAY_USAGE="true"; echo "optarg ${OPTARG:0:1}"; fi
case ${OPTION} in
n) DRY_RUN="true";;
v) VERBOSE="true";;
b) BASH_COMPLETION="true";;
B) BASH_COMPLETION="false";;
l) LOG4J2_MERGE="true";;
L) LOG4J2_MERGE="false";;
p) SET_XYNA_PROPERTIES="true";;
P) SET_XYNA_PROPERTIES="false";;
3) parse_third_party_mode "${OPTARG}";;
i) parse_instance_number "${OPTARG}";;
m) parse_merge_mode "${OPTARG}";;
a) parse_components "ALL" "true";;
A) parse_components "ALL" "false";;
c) parse_components "${OPTARG}" "true";;
C) parse_components "${OPTARG}" "false";;
d) parse_deploy_targets "${OPTARG}" "true";;
D) parse_deploy_targets "${OPTARG}" "false";;
f) parse_filters "${OPTARG}" "true";;
F) parse_filters "${OPTARG}" "false";;
g) parse_datamodeltypes "${OPTARG}" "true";;
G) parse_datamodeltypes "${OPTARG}" "false";;
r) parse_repositoryaccesses "${OPTARG}" "true";;
R) parse_repositoryaccesses "${OPTARG}" "false";;
s) parse_services "${OPTARG}" "true";;
S) parse_services "${OPTARG}" "false";;
t) parse_triggers "${OPTARG}" "true";;
T) parse_triggers "${OPTARG}" "false";;
x) parse_applications "${OPTARG}" "true";;
X) parse_applications "${OPTARG}" "false";;
h|H) DISPLAY_USAGE="true";;
?) if [[ ${OPTARG} == "?" ]] ; then
DISPLAY_USAGE="true";
else
#unbekannte Option, daher mit Fehler abbrechen
display_usage;
exit 1;
fi
;;
*) #unimplementierte Option, daher mit Fehler abbrechen
display_usage;
exit 1;
;;
esac
done
}
# Parameter 1: String der geprueft werden soll, Parameter 2: Wert, den die Variable bekommen soll ("true" oder "false")
parse_components () {
for v in $(f_split_to_array "${1}") ; do
case $v in
filter) parse_filters "ALL" "${2}";;
services) parse_services "ALL" "${2}";;
trigger) parse_triggers "ALL" "${2}";;
repositories) parse_repositoryaccesses "ALL" "${2}";;
datamodeltypes) parse_datamodeltypes "ALL" "${2}";;
applications) parse_applications "ALL" "${2}";;
xynacluster) COMPONENT_XYNACLUSTER="${2}";;
oraclecluster) COMPONENT_ORACLECLUSTER="${2}";;
xynafactory) COMPONENT_XYNAFACTORY="${2}";;
fractalmodellerh5en)COMPONENT_FRACTALMODELLERH5EN="${2}";;
fractalmodellerh5de)COMPONENT_FRACTALMODELLERH5DE="${2}";;
ALL)
parse_filters "ALL" "${2}";
parse_services "ALL" "${2}";
parse_triggers "ALL" "${2}";
parse_repositoryaccesses "ALL" "${2}";
parse_datamodeltypes "ALL" "${2}";
parse_applications "ALL" "${2}";
COMPONENT_XYNAFACTORY="${2}";
COMPONENT_FRACTALMODELLERH5EN="${2}";
COMPONENT_FRACTALMODELLERH5DE="${2}";
parse_deploy_targets "${1}" "${2}"
SET_XYNA_PROPERTIES="${2}"
;;
*) attention_msg "Ignoring unknown component \"$v\"";
esac
done;
}
# Parameter 1: String der geprueft werden soll, Parameter 2: Wert, den die Variable bekommen soll ("true" oder "false")
parse_filters () {
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c nsnhix5600 ) -gt 0 ]]; then FILTER_NSN_HIX5600="${2}"; fi
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c dhcp_v4 ) -gt 0 ]]; then FILTER_DHCP_V4="${2}"; fi
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c radius ) -gt 0 ]]; then FILTER_RADIUS="${2}"; fi
}
# Parameter 1: String der geprueft werden soll, Parameter 2: Wert, den die Variable bekommen soll ("true" oder "false")
parse_services () {
for v in $(f_split_to_array "${1}") ; do
case $v in
nsnhix5600) SERVICE_NSN_HIX5600="${2}";;
templatemechanism) SERVICE_TEMPLATEMECHANISM="${2}";;
sipuseragent) SERVICE_SIPUSERAGENT="${2}";;
jmsforwarding) SERVICE_JMSFORWARDING="${2}";;
dhcp_v4) SERVICE_DHCP_V4="${2}";;
ALL)
SERVICE_NSN_HIX5600="${2}";
SERVICE_TEMPLATEMECHANISM="${2}";
SERVICE_SIPUSERAGENT="${2}";
SERVICE_JMSFORWARDING="${2}";
SERVICE_DHCP_V4="${2}";
;;
*) attention_msg "Ignoring unknown service \"$v\"";
esac
done;
}
# Parameter 1: String der geprueft werden soll, Parameter 2: Wert, den die Variable bekommen soll ("true" oder "false")
parse_triggers () {
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c nsnhix5600 ) -gt 0 ]]; then TRIGGER_NSN_HIX5600="${2}"; fi
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c dhcp_v4 ) -gt 0 ]]; then TRIGGER_DHCP_V4="${2}"; fi
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c radius ) -gt 0 ]]; then TRIGGER_RADIUS="${2}"; fi
}
# Parameter 1: String der geprueft werden soll, Parameter 2: Wert, den die Variable bekommen soll ("true" oder "false")
parse_deploy_targets () {
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c geronimo ) -gt 0 ]]; then DEPLOY_TARGET_GERONIMO="${2}"; fi
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c oracle ) -gt 0 ]]; then DEPLOY_TARGET_ORACLE="${2}"; fi
if [[ "x${1}" == "xALL" || $(echo "${1}" | ${VOLATILE_GREP} -c tomcat ) -gt 0 ]]; then DEPLOY_TARGET_TOMCAT="${2}"; fi
}
# Parameter 1: String der geprueft werden soll, Parameter 2: Wert, den die Variable bekommen soll ("true" oder "false")
parse_repositoryaccesses () {
for v in $(f_split_to_array "${1}") ; do
case $v in
svn) REPOSITORYACCESS_SVN="${2}";;
ALL)
REPOSITORYACCESS_SVN="${2}";
;;
*) attention_msg "Ignoring unknown repositoryaccess \"$v\"";
esac
done;
}
# Parameter 1: String der geprueft werden soll, Parameter 2: Wert, den die Variable bekommen soll ("true" oder "false")
parse_datamodeltypes () {
for v in $(f_split_to_array "${1}") ; do
case $v in
mib) DATAMODELTYPE_MIB="${2}";;
tr069) DATAMODELTYPE_TR069="${2}";;
xsd) DATAMODELTYPE_XSD="${2}"; SERVICE_TYPEGENERATION="${2}";;
ALL)
DATAMODELTYPE_MIB="${2}";
DATAMODELTYPE_TR069="${2}";
DATAMODELTYPE_XSD="${2}"; SERVICE_TYPEGENERATION="${2}";
;;
*) attention_msg "Ignoring unknown datamodeltype \"$v\"";
esac
done;
}
# Parameter 1: String der geprueft werden soll, Parameter 2: Wert, den die Variable bekommen soll ("true" oder "false")
parse_applications () {
local APP_LIST=$(echo ${1} | ${VOLATILE_TR} ',' ' ' );
#echo "APP_LIST=${APP_LIST}";
if f_is_in_list APP_LIST "ALL" ; then
#ALL
if f_is_true $2 ; then
ALL_APPLICATIONS=$(f_list_applications_in_components);
else
ALL_APPLICATIONS="";
COMPONENT_APPLICATIONS="false";
fi;
else
#Einzel-Apps
for v in ${APP_LIST} ; do
if ! f_application_exists_in_components $v ; then
attention_msg "Ignoring unknown application \"$v\"";
else
if f_is_true $2 ; then
ALL_APPLICATIONS=$(f_add_to_list ALL_APPLICATIONS ${v});
else
ALL_APPLICATIONS=$(f_remove_from_list ALL_APPLICATIONS ${v});
fi;
fi;
done;
fi;
}
parse_instance_number () {
export INSTANCE_NUMBER="${1}"
if [[ 1 -le ${INSTANCE_NUMBER} && ${INSTANCE_NUMBER} -le ${BLACK_EDITION_INSTANCES} ]]; then
# nichts machen, alles bestens
:
else
# Parameter nicht richtig; Hilfe ausgeben.
echo "Error: Instance number '-i' is not in the allowed range [1..${BLACK_EDITION_INSTANCES}]"
DISPLAY_USAGE="true"
fi
}
parse_merge_mode () {
export MERGE_MODE="${1}"
case ${MERGE_MODE} in
merge|customized|new|abort)
;;
*)
# Parameter nicht richtig; Hilfe ausgeben.
echo "Error: Merge mode not in [merge|customized|new|abort]"
DISPLAY_USAGE="true"
;;
esac
}
parse_third_party_mode () {
CHECK_THIRD_PARTY_LICENSES="${1}"
case ${CHECK_THIRD_PARTY_LICENSES} in
server|revision|delivery|none|dir=*|app=*)
;;
*)
# Parameter nicht richtig; Hilfe ausgeben.
echo "Error: Check-Third-Party-License mode not in [server|revision|delivery|none|dir=*|app=*]"
DISPLAY_USAGE="true"
;;
esac
}
# print all variables for debugging, then exit
debug_variables () {
echo "instance_number : ${INSTANCE_NUMBER}"
case ${MERGE_MODE} in
merge) echo "merge-mode : merge: in case of conflict installation halts, user has to resolve conflict and continue" ;;
customized) echo "merge-mode : customized: in case of conflict customized version will be kept" ;;
new) echo "merge-mode : new: in case of conflict customized version will be replaced" ;;
abort) echo "merge-mode : abort: in case of conflict installation will be aborted" ;;
*) ;; #kann nicht vorkommen
esac
echo "verbose : ${VERBOSE:-false}"
echo "bash-completion : ${BASH_COMPLETION:-false}"
echo "log4j2-merge : ${LOG4J2_MERGE:-false}"
echo "== Components =="
echo "xynafactory : ${COMPONENT_XYNAFACTORY:-false}"
echo "fractalmodellerh5de : ${COMPONENT_FRACTALMODELLERH5DE:-false}"
echo "fractalmodellerh5en : ${COMPONENT_FRACTALMODELLERH5EN:-false}"
echo "xynacluster : ${COMPONENT_XYNACLUSTER:-false}"
echo "oraclecluster : ${COMPONENT_ORACLECLUSTER:-false}"
echo "set_xyna_properties : ${SET_XYNA_PROPERTIES:-false}"
echo "== Filter =="
echo "nsnhix5600 : ${FILTER_NSN_HIX5600:-false}"
echo "dhcp v4 : ${FILTER_DHCP_V4:-false}"
echo "radius : ${FILTER_RADIUS:-false}"
echo "== Services =="
echo "nsnhix5600 : ${SERVICE_NSN_HIX5600:-false}"
echo "templatemechanism : ${SERVICE_TEMPLATEMECHANISM:-false}"
echo "sipuseragent : ${SERVICE_SIPUSERAGENT:-false}"
echo "jmsforwarding : ${SERVICE_JMSFORWARDING:-false}"
echo "dhcp v4 : ${SERVICE_DHCP_V4:-false}"
echo "radius : ${SERVICE_RADIUS:-false}"
echo "== Trigger =="
echo "nsnhix5600 : ${TRIGGER_NSN_HIX5600:-false}"
echo "dhcp v4 : ${TRIGGER_DHCP_V4:-false}"
echo "radius : ${TRIGGER_RADIUS:-false}"
echo "== Deploy-Targets =="
echo "geronimo : ${DEPLOY_TARGET_GERONIMO:-false}"
echo "oracle : ${DEPLOY_TARGET_ORACLE:-false}"
echo "tomcat : ${DEPLOY_TARGET_TOMCAT:-false}"
echo "== RepositoryAccess =="
echo "svn : ${REPOSITORYACCESS_SVN:-false}"
echo "== DataModelTypes =="
echo "mib : ${DATAMODELTYPE_MIB:-false}"
echo "tr069 : ${DATAMODELTYPE_TR069:-false}"
echo "xsd : ${DATAMODELTYPE_XSD:-false}"
echo "== Applications =="
echo "The following applications are selected: ${ALL_APPLICATIONS}"
}
display_usage () {
local DONOT="[don't]";
${VOLATILE_CAT} << A_HERE_DOCUMENT
usage: "$(basename "$0")" -nvabpABEP -cdfgqrstCDFGQRST [csv list] -i instance -m merge -3 check
-n dry-run, display the evaluated commandline parameters
-v verbose mode, display factory commands
-i specify instancenumber; default is 1
-m specify merge-mode for merging configuration files, e.g. server.policy, log4j2.xml
possible values are merge, customized, new, abort; default is merge
-3 specify check-mode for checking third party licenses
possible values are server, revision, delivery, none
-aA include / exclude all components except 'xynacluster', 'oraclecluster'
-bB ${DONOT} configure bash_completion
-lL ${DONOT} merge log4j2.xml
-pP ${DONOT} set xyna properties
-dD ${DONOT} deploy in one or more of the following application servers:
ALL ${ALL_DEPLOY_TARGETS[@]}
-cC ${DONOT} install one or more of the following components:
ALL ${ALL_COMPONENTS[@]}
-fF ${DONOT} install one or more of the following filters:
ALL ${ALL_FILTERS[@]}
-gG ${DONOT} install one or more of the following datamodeltypes:
ALL ${ALL_DATAMODELTYPES[@]}
-rR ${DONOT} install one or more of the following repositoryaccesses:
ALL ${ALL_REPOSITORYACCESSES[@]}
-sS ${DONOT} install one or more of the following services:
ALL ${ALL_SERVICES[@]}
-tT ${DONOT} install one or more of the following triggers:
ALL ${ALL_TRIGGERS[@]}
-xX ${DONOT} install one or more of the following applications:
ALL $(f_list_applications_in_components);
* lower-case letters mean to include the specific component
* UPPER-CASE letters mean to exclude the specific component
* Global component name means 'ALL' for specific componnent
* subsequent arguments override prior arguments
Examples:
(1) "$(basename "$0")" -a -C fractalmodellerh5de
install everything, but exclude the FractalModeller
(2) "$(basename "$0")" -A -c fractalmodellerh5en,fractalmodellerh5de
install nothing, but include the FractalModeller
(3) "$(basename "$0")" -c filter
"$(basename "$0")" -f ALL
both calls are identical
(4) "$(basename "$0")" -c filter,trigger -F snmp -f ALL
install filter and trigger
The prior exclusion of snmp filter is overridden by the subsequent
inclusion of all filters.
A_HERE_DOCUMENT
}
f_indent () {
local INDENT=${1};
shift 1
local OUTPUT="$@"
echo "${OUTPUT}" | sed "s+^+${INDENT}+" #Einrücken
}
f_deploy_war () {
if f_selected ${DEPLOY_TARGET_TOMCAT} ; then
f_deploy_war_into_tomcat "$@" true true false
fi;
if f_selected ${DEPLOY_TARGET_GERONIMO} ; then
f_deploy_war_into_geronimo "$@"
fi;
if f_selected ${DEPLOY_TARGET_ORACLE} ; then
f_deploy_war_into_oracle "$@"
fi;
}
f_deploy_target () {
if f_selected ${DEPLOY_TARGET_TOMCAT} ; then
echo "Apache Tomcat"
fi;
if f_selected ${DEPLOY_TARGET_GERONIMO} ; then
echo "Apache Geronimo"
fi;
if f_selected ${DEPLOY_TARGET_ORACLE} ; then
echo "Oracle AS"
fi;
}
f_install_license () {
echo -e "\n + Install licenses"
local WAR_DELIVERY="${1}"
local STR_DELIVERY_NAME=$(basename ${WAR_DELIVERY} .war)
local STR_DELIVERY_PATH=$(dirname ${WAR_DELIVERY})
local STR_TMP_UNPACK_DIR="/tmp/${STR_DELIVERY_NAME}"
local OUTPUT=$(${VOLATILE_UNZIP} -C ${WAR_DELIVERY} "*.jar" -d ${STR_TMP_UNPACK_DIR})
for JAR in $(${VOLATILE_FIND} ${STR_TMP_UNPACK_DIR} -name "*.jar" | ${VOLATILE_SORT}) ; do
copy_license ${JAR} " | "
done;
rm -rf ${STR_TMP_UNPACK_DIR}
}
deploy_xfracmodh5de () {
FILE_TO_DEPLOY="${PWD}/server/xfracmod/modeller_de-DE.war"
if [[ -f "${FILE_TO_DEPLOY}" ]]; then
echo -e "\n* Deploying HTML5-Modeller (de-DE) into $(f_deploy_target)"
if f_selected ${DEPLOY_TARGET_GERONIMO} ; then
# not supported
echo "ERROR: Only tomcat is supported"
exit 4
fi;
if f_selected ${DEPLOY_TARGET_ORACLE} ; then
# not supported
echo "ERROR: Only tomcat is supported"
exit 4
fi;
f_deploy_war "${FILE_TO_DEPLOY}" "modeller_de-DE"
fi
}
deploy_xfracmodh5en () {
FILE_TO_DEPLOY="${PWD}/server/xfracmod/modeller_en-US.war"
if [[ -f "${FILE_TO_DEPLOY}" ]]; then
echo -e "\n* Deploying HTML5-Modeller (en-US) into $(f_deploy_target)"
if f_selected ${DEPLOY_TARGET_GERONIMO} ; then
# not supported
echo "ERROR: Only tomcat is supported"
exit 4
fi;
if f_selected ${DEPLOY_TARGET_ORACLE} ; then
# not supported
echo "ERROR: Only tomcat is supported"
exit 4
fi;
f_deploy_war "${FILE_TO_DEPLOY}" "modeller_en-US"
fi
}
check_oc4j_container_status () {
if [[ "x${1}" == "x" ]]; then
# kein Instanzname angegeben: Erste Installation oder Container geloescht.
echo "NEW"
else
VOLATILE_OPMNCTL=$(get_full_path_to_executable opmnctl)
# Liste laufender OC4J-Instanzen bestimmen:
# opmnctl status -fmt %prt50%sta8
# process-type | status
# ---------------------------------------------------+---------
# OC4J:Project7 | Alive
# OC4J:Project6 | Down
# HTTP_Server | Alive
#
# Zeile mit dem Container filtern und den Status aus der letzten Spalte ausgeben
echo "$(${VOLATILE_OPMNCTL} status -fmt %prt50%sta8 | ${VOLATILE_AWK} '/^OC4J:'"${1}"'/ {print $NF}')"
fi
}
select_running_oc4j_container () {
VOLATILE_OPMNCTL=$(get_full_path_to_executable opmnctl)
# Liste laufender OC4J-Instanzen bestimmen:
# opmnctl status -fmt %prt50%sta8
# process-type | status
# ---------------------------------------------------+---------
# OC4J:Project7 | Alive
# OC4J:Project6 | Down
# HTTP_Server | Alive
#
# Zeile beginnt mit OC4J, Status ist 'Alive', dann erste Spalte mit Trenner ':' nochmal durchsuchen, danach ist das Ergebnis in der letzten Spalte
ORACLE_OC4J_CONTAINER=$(${VOLATILE_OPMNCTL} status -fmt %prt50%sta8 | ${VOLATILE_AWK} '/^OC4J/ && $NF == "Alive" {print $1}' | ${VOLATILE_AWK} 'BEGIN { FS=":"} {print $2}')
# Benutzer muss einen der laufenden Container auswaehlen
number_of_matches=$(echo "${ORACLE_OC4J_CONTAINER}" | ${VOLATILE_AWK} 'END {print NR}')
if [[ "x" == "x${ORACLE_OC4J_CONTAINER}" ]]; then number_of_matches="0"; fi
case ${number_of_matches} in
0) err_msg "Unable to determine running OC4J instances."
echo
echo "Hint: Check Application Server status using 'opmnctl status'..."
echo
return
;;
1) # nothing to be done, instance found only once
;;
*) # multiple entries matched - choose one
OWN_OC4J_SELECTION="0"
until [[ ${OWN_OC4J_SELECTION} -ge 1 && ${OWN_OC4J_SELECTION} -le ${number_of_matches} ]]; do
echo "Following OC4J instances found:"
let OWN_OC4J_INDEX=1
for i in ${ORACLE_OC4J_CONTAINER}; do
echo " (${OWN_OC4J_INDEX}): ${i}"
let OWN_OC4J_INDEX=OWN_OC4J_INDEX+1
done
echo; echo -n "Enter number to choose one: "
read OWN_OC4J_SELECTION
if [[ -z ${OWN_OC4J_SELECTION} ]]; then OWN_OC4J_SELECTION=0; fi
done
let OWN_OC4J_INDEX=1
for i in ${ORACLE_OC4J_CONTAINER}; do
if [[ ${OWN_OC4J_SELECTION} -eq ${OWN_OC4J_INDEX} ]]; then
ORACLE_OC4J_CONTAINER="${i}"
fi
let OWN_OC4J_INDEX=OWN_OC4J_INDEX+1
done
;;
esac
}
deploy_war_into_oracle () {
COMPONENT_WAR_FILE="${1}"
COMPONENT_NAME="${2}"
if [[ "x${COMPONENT_WAR_FILE}" == "x" || "x" == "x${ORACLE_HOME}" || ! -d "${ORACLE_HOME}/opmn" ]]; then
if [[ "x" != "x${ORACLE_HOME}" || -d "${ORACLE_HOME}/opmn" ]]; then
err_msg "ORACLE_HOME ${ORACLE_HOME} is not set or does not point to an Application Server - skipping deployment"
else
err_msg "Unable to work without war-file."
fi
else
echo -e "\n* Deploying ${COMPONENT_NAME} into Oracle Application Server"
if [[ "x" == "x${ORACLE_HOME}" ]]; then
echo " + \$ORACLE_HOME is not set - skipping"
return
fi
if [[ ! -d "${ORACLE_HOME}/opmn" ]]; then
echo " + \$ORACLE_HOME does not point to an Application Server - skipping"
return
fi
choose_interface "Oracle AS" "network.interface.oracle.as"
VOLATILE_JAVA=$(get_full_path_to_executable java)
VOLATILE_OPMNCTL=$(get_full_path_to_executable opmnctl)
# bugz 10345: ORACLE_HOME speichern und nachfragen, ob trotzdem deplyoed werden soll, falls es sich geaendert hat
PROPERTY_NAME="env.oracle.home"
get_property ${PROPERTY_NAME} "${INSTANCE_PROP_FILE}"
if [[ "x" == "x${CURRENT_PROPERTY}" ]]; then
set_property "${PROPERTY_NAME}" "${ORACLE_HOME}" "${INSTANCE_PROP_FILE}"
else
if [[ "x${CURRENT_PROPERTY}" != "x${ORACLE_HOME}" ]]; then
echo "\$ORACLE_HOME is set to: ${ORACLE_HOME}"
echo "Last run was : ${CURRENT_PROPERTY}"
echo; echo -n "Continue with installation anyway (y/[n]) ? "
read INSTALL_WITH_DIFFERENT_ORACLE_HOME
if [[ ${INSTALL_WITH_DIFFERENT_ORACLE_HOME:0:1} == "y" || ${INSTALL_WITH_DIFFERENT_ORACLE_HOME:0:1} == "Y" ]]; then
set_property "${PROPERTY_NAME}" "${ORACLE_HOME}" "${INSTANCE_PROP_FILE}"
else
# Antwort war negativ, dann Abbruch
return
fi
fi
fi
# bugz 10345: OC4J-Container speichern, in den deployed werden soll
#
# Fallunterscheidung fuer den gespeicherten Container:
# a) Container ist Alive => o.k., deployen
# b) Container ist Down => o.k., nicht deployen, Meldung an den User, Hint: der Container muss wieder gestartet werden.
# c) Container ist nicht mehr aufzufinden, kann 2 Gruende haben:
# 1) Falsches $ORACLE_HOME => kann vom Skript nicht erkannt werden.
# 2) Container geloescht => o.k., User darf neu auswaehlen.
PROPERTY_NAME="oracle.oc4j.container"
get_property ${PROPERTY_NAME} "${INSTANCE_PROP_FILE}"
OC4J_STATUS=$(check_oc4j_container_status "${CURRENT_PROPERTY}")
case ${OC4J_STATUS} in
Alive)
ORACLE_OC4J_CONTAINER="${CURRENT_PROPERTY}"
;;
Down|Init)
err_msg "Oracle OC4J instance '${CURRENT_PROPERTY}' is not running. Start instance and try again!"
return
;;
*)
select_running_oc4j_container
set_property "${PROPERTY_NAME}" "${ORACLE_OC4J_CONTAINER}" "${INSTANCE_PROP_FILE}"
;;
esac
# Request-Port fuer bestimmen:
#+ Zeile mit 'request=' aus $ORACLE_HOME/opmn/conf/opmn.xml entnehmen und mit sed die Portnummer filtern:
#+ <port local="6102" remote="6202" request="6002"/>
ORACLE_REQUEST_PORT=$(${VOLATILE_GREP} request "${ORACLE_HOME}/opmn/conf/opmn.xml" | ${VOLATILE_SED} -e "s+\(.*request=\"\)\([0-9]*\)\(\".*\)+\2+")
if [[ ${ORACLE_REQUEST_PORT:-0} -ge 1024 && ${ORACLE_REQUEST_PORT:-0} -lt 65536 ]]; then
echo " + deploying ${COMPONENT_NAME}"
${VOLATILE_JAVA} -jar ${ORACLE_HOME}/j2ee/home/admin_client.jar deployer:oc4j:opmn://${CHOOSEN_INTERFACE}:${ORACLE_REQUEST_PORT}/${ORACLE_OC4J_CONTAINER} ${ORACLE_AS_USERID} ${ORACLE_AS_PASSWORD} -deploy -file ${COMPONENT_WAR_FILE} -deploymentName ${COMPONENT_NAME} -contextRoot ${COMPONENT_NAME} -bindAllWebApps
else
err_msg "Unable to determine OPMN request port from '${ORACLE_HOME}/opmn/conf/opmn.xml'."
fi
fi
}
configure_persistence_layer_for_radius_service () {
echo -e "\n* Configuring persistence layer for XynaRadiusService"
TOKEN_RADIUS_PERSISTENCELAYERINSTANCE="radius"
local XML_PERSISTENCE_LAYER_NAME="${TOKEN_RADIUS_PERSISTENCELAYERINSTANCE}Xml"
local MEMORY_PERSISTENCE_LAYER_NAME="${TOKEN_RADIUS_PERSISTENCELAYERINSTANCE}Memory"
f_instantiate_named_persistencelayer "${INSTALL_PREFIX}" "${XML_PERSISTENCE_LAYER_NAME}" "xml" "HISTORY" "xact" "${TOKEN_RADIUS_PERSISTENCELAYERINSTANCE}"
f_instantiate_named_persistencelayer "${INSTALL_PREFIX}" "${MEMORY_PERSISTENCE_LAYER_NAME}" "memory" "HISTORY" "xact"
if [[ ! -d "${INSTALL_PREFIX}/server/storage/${TOKEN_RADIUS_PERSISTENCELAYERINSTANCE}" ]]; then ${VOLATILE_MKDIR} -p "${INSTALL_PREFIX}/server/storage/${TOKEN_RADIUS_PERSISTENCELAYERINSTANCE}"; fi
install_file "components/xact/radius/storage/radiustlv.xml" "${INSTALL_PREFIX}/server/storage/${TOKEN_RADIUS_PERSISTENCELAYERINSTANCE}/."
f_register_table_by_name "${INSTALL_PREFIX}" "${XML_PERSISTENCE_LAYER_NAME}" "radiustlv" "HISTORY"
f_register_table_by_name "${INSTALL_PREFIX}" "${MEMORY_PERSISTENCE_LAYER_NAME}" "radiususer" "HISTORY"
}
deploy_trigger () {
if ! f_selected ${TRIGGER_NSN_HIX5600} ${TRIGGER_DHCP_V4} ${TRIGGER_RADIUS}; then
return;
fi;
echo -e "\n* Deploying trigger"
if [[ "x${TRIGGER_NSN_HIX5600}" == "xtrue" ]] && [[ -d revisions/rev_workingset/saved/trigger/SNMPTrigger ]] && [[ -d revisions/rev_workingset/saved/filter/NSN_HiX5630_SNMPFilter ]]; then
echo " + SNMPTrigger for DSLAM NSN 5600 series"
choose_interface "SNMP Trigger" "network.interface.nsnhix5600trigger"
# Trigger installieren
trigger_copy SNMPTrigger revisions/rev_workingset/saved/trigger/SNMPTrigger/*
f_xynafactory deploysharedlib snmplibs
f_xynafactory addtrigger SNMP com.gip.xyna.xact.trigger.SNMPTrigger snmplibs ../revisions/rev_workingset/saved/trigger/SNMPTrigger/SNMPTrigger.jar
f_xynafactory deploytrigger SNMP SNMP${SNMP_NSNHIX_PORT} ${CHOOSEN_INTERFACE_NAME} ${SNMP_NSNHIX_PORT} 10 30 200 600 3
add_to_server_policy \
'//SocketPermission for SNMPTrigger '${SNMP_NSNHIX_PORT} \
'permission java.net.SocketPermission "*:'${SNMP_NSNHIX_PORT}'", "accept, listen, connect, resolve";'
fi
if [[ "x${TRIGGER_DHCP_V4}" == "xtrue" ]] && [[ -d revisions/rev_workingset/saved/trigger/DHCPTrigger ]]; then
echo " + DHCPTrigger v4"
choose_interface "DHCP Trigger v4" "network.interface.dhcptrigger_v4"
# Trigger installieren
trigger_copy DHCPTrigger revisions/rev_workingset/saved/trigger/DHCPTrigger/*
f_xynafactory deploysharedlib dhcplibs
f_xynafactory addtrigger DHCP com.gip.xyna.xact.trigger.DHCPTrigger dhcplibs ../revisions/rev_workingset/saved/trigger/DHCPTrigger/DHCPTrigger.jar
f_xynafactory deploytrigger DHCP DHCPv4 ${CHOOSEN_INTERFACE} 67,68,67
fi
if [[ "x${TRIGGER_RADIUS}" == "xtrue" ]] && [[ -d revisions/rev_workingset/saved/trigger/XynaRadiusTrigger ]]; then
echo " + XynaRadiusTrigger"
choose_interface "XynaRadiusTrigger" "network.interface.xynaradiustrigger"
# Trigger installieren
trigger_copy XynaRadiusTrigger revisions/rev_workingset/saved/trigger/XynaRadiusTrigger/*
configure_persistence_layer_for_radius_service
f_xynafactory defineip -ip ${CHOOSEN_INTERFACE} -name "radius" -f
f_xynafactory addtrigger -fqClassName com.gip.xyna.xact.trigger.XynaRadiusTrigger -sharedLibs : -triggerName XynaRadiusTrigger -jarFiles ../revisions/rev_workingset/saved/trigger/XynaRadiusTrigger/XynaRadiusTrigger.jar
f_xynafactory deploytrigger -triggerInstanceName XynaRadiusTriggerInstance -triggerName XynaRadiusTrigger -startParameters radius
fi
}
deploy_filter () {
if ! f_selected ${FILTER_NSN_HIX5600} ${FILTER_DHCP_V4} ${FILTER_RADIUS} ; then
return;
fi;
echo -e "\n* Deploying filter"
if [[ "x${FILTER_NSN_HIX5600}" == "xtrue" ]] && [[ -d components/xact/dslam/nsn/5600series/filterimpl/NSN_HiX5630_SNMP ]]; then
echo " + DSLAM NSN 5600 series"
xmom_copy . components/xact/dslam/nsn/5600series/XMOM/*
filter_copy NSN_HiX5630_SNMPFilter components/xact/dslam/nsn/5600series/filterimpl/NSN_HiX5630_SNMP/*
f_xynafactory deploysharedlib NSNHiX5630
f_xynafactory addfilter nsnhix5600 com.gip.xyna.xact.trigger.NSN_HiX5630_SNMPFilter SNMP NSNHiX5630 ../revisions/rev_workingset/saved/filter/NSN_HiX5630_SNMPFilter/NSN_HiX5630_SNMPFilter.jar
f_xynafactory deployfilter nsnhix5600 nsnhix5600_${SNMP_NSNHIX_PORT} SNMP${SNMP_NSNHIX_PORT}
fi
if [[ "x${FILTER_DHCP_V4}" == "xtrue" ]] && [[ -d revisions/rev_workingset/saved/filter/DHCPFilter ]]; then
echo " + DHCPFilter v4"
filter_copy DHCPFilter revisions/rev_workingset/saved/filter/DHCPFilter/*
f_xynafactory addfilter DHCPFilterv4 com.gip.xyna.xact.trigger.DHCPFilter DHCP : ../revisions/rev_workingset/saved/filter/DHCPFilter/DHCPFilter.jar
f_xynafactory deployfilter DHCPFilterv4 DHCPFilter DHCPv4
fi
if [[ "x${FILTER_RADIUS}" == "xtrue" ]] && [[ -d revisions/rev_workingset/saved/filter/XynaRadiusFilter ]]; then
echo " + XynaRadiusFilter"
xmom_copy xact components/xact/radius/XMOM/*
filter_copy XynaRadiusFilter components/xact/radius/filter/XynaRadiusFilter/*
f_xynafactory addfilter -filterName XynaRadiusFilter -fqClassName com.gip.xyna.xact.trigger.XynaRadiusFilter -jarFiles ../revisions/rev_workingset/saved/filter/XynaRadiusFilter/XynaRadiusFilter.jar -triggerName XynaRadiusTrigger -sharedLibs :
f_xynafactory deployfilter -filterInstanceName XynaRadiusFilterInstance -filterName XynaRadiusFilter -triggerInstanceName XynaRadiusTriggerInstance
fi
}
deploy_services () {
if ! f_selected ${SERVICE_TEMPLATEMECHANISM} ${SERVICE_NSN_HIX5600} ${SERVICE_SIPUSERAGENT} ${SERVICE_JMSFORWARDING} ${SERVICE_DHCP_V4} ; then
return;
fi;
echo -e "\n* Deploying services"
local DEPLOY_DATATYPES;
local DEPLOY_WORKFLOWS;
if [[ "x${SERVICE_TEMPLATEMECHANISM}" == "xtrue" ]] && [[ -d components/xact/configserver/mdmimpl/TemplateProvider ]] && [[ -d components/xact/configserver/mdmimpl/VelocityTemplate ]]; then
echo " + Template Mechanism"
xmom_copy xact/templates components/xact/configserver/XMOM/xact/templates/*
service_copy xact.templates.TemplateProvider components/xact/configserver/mdmimpl/TemplateProvider/*
service_copy xact.templates.VelocityService components/xact/configserver/mdmimpl/VelocityTemplate/*
sharedlib_copy templatestorables components/xact/configserver/sharedLibs/*
f_xynafactory deploysharedlib templatestorables
f_xynafactory deploydatatype xact.templates.VelocityTemplate
f_xynafactory deployexception xact.templates.VelocityTemplateEvaluationException
f_xynafactory set velocity.parser.pool.size 5
f_xynafactory set xact.acs.velocity.aliases ""
f_xynafactory deploydatatype xact.templates.VelocityService
#fuer das Deployment des TemplateProviders muss vorher die Persistence fuer die Tabelle velocitytemplate konfiguriert werden
#f_xynafactory deploydatatype xact.templates.TemplateProvider
fi
if [[ "x${SERVICE_SIPUSERAGENT}" == "xtrue" ]] && [[ -d components/xact/sip/mdmimpl/SipUserAgentService ]]; then
echo " + SIP User Agent Service"
xmom_copy xact/sip components/xact/sip/XMOM/*
service_copy xact.sip.SipUserAgent components/xact/sip/mdmimpl/SipUserAgentService/*
f_xynafactory deploydatatype xact.sip.SipUserAgent
fi
if [[ "x${SERVICE_NSN_HIX5600}" == "xtrue" ]] && [[ -d components/xact/dslam/nsn/5600series/mdmimpl/SNMPHelper ]] && [[ -d components/xact/dslam/nsn/5600series/mdmimpl/DSLAMHelper ]]; then
echo " + DSLAM NSN 5600 series"
xmom_copy . components/xact/dslam/nsn/5600series/XMOM/*
sharedlib_copy NSNHiX5630 components/xact/dslam/nsn/5600series/sharedLibs/*
service_copy xact.dslam.nsn._5600series.helper.DSLAMHelper components/xact/dslam/nsn/5600series/mdmimpl/DSLAMHelper/*
service_copy xact.dslam.nsn._5600series.storage.NSNDSLAMPortGroupStorage components/xact/dslam/nsn/5600series/mdmimpl/NSNDSLAMPortGroupStorage/*
service_copy xact.dslam.nsn._5600series.storage.NSNDSLAMStorage components/xact/dslam/nsn/5600series/mdmimpl/NSNDSLAMStorage/*
service_copy xact.dslam.nsn._5600series.traphandling.TrapCollectionService components/xact/dslam/nsn/5600series/mdmimpl/TrapCollectionService/*
service_copy xact.snmp.helpers.SNMPHelper components/xact/dslam/nsn/5600series/mdmimpl/SNMPHelper/*
f_xynafactory deploysharedlib NSNHiX5630
f_xynafactory deploy xact.dslam.nsn.5600series.traphandling.OnSuccessfulGBondCreation
f_xynafactory deploy xact.dslam.nsn.5600series.traphandling.OnTrapReceivedNoData
fi
if [[ "x${SERVICE_JMSFORWARDING}" == "xtrue" ]] && [[ -d components/xact/jms/filterimpl/JMSForwarding ]]; then
echo " + ForwardDequeuedJMSMessage"
xmom_copy xact/jms components/xact/jms/XMOM/*
filter_copy JMSForwardingFilter components/xact/jms/filterimpl/JMSForwarding/*
f_xynafactory deploy xact.jms.ForwardDequeuedJMSMessage
fi
if [[ "x${SERVICE_DHCP_V4}" == "xtrue" ]] && [[ -d revisions/rev_workingset/saved/filter/DHCPFilter ]]; then
echo " + DHCPv4"
f_xynafactory deploy xact.dhcp.LeaseQuery_v4
f_xynafactory addcapacity -cardinality 5 -name LeaseQueryCapacity_v4 -state ACTIVE
f_xynafactory requirecapacityforwf -capacityName LeaseQueryCapacity_v4 -cardinality 1 -workflowName xact.dhcp.LeaseQuery_v4
fi
}
set_properties () {
echo -e "\n* Setting properties"
if [[ -d revisions/rev_workingset/saved/services/xact.templates.TemplateProvider ]] && [[ -d revisions/rev_workingset/saved/services/xact.templates.VelocityTemplate ]]; then
echo " + Template Mechanism"
f_xynafactory set velocity.parser.pool.size ${VELOCITY_PARSER_POOL_SIZE}
fi
if [[ -d revisions/rev_workingset/saved/services/xact.sip.SipUserAgent ]]; then
echo " + SipUserAgent"
choose_interface "SipUserAgent" "network.interface.sipuseragent"
f_xynafactory set xact.sip.localip ${CHOOSEN_INTERFACE}
f_xynafactory set xact.sip.localportrange ${SIPADAPTER_LOW_PORT}-${SIPADAPTER_HIGH_PORT}
f_xynafactory set xact.sip.username.black xynablack
f_xynafactory set xact.sip.notify.responsetimeout ${SIPADAPTER_NOTIFY_RESPONSETIMEOUT}
fi
if [[ -d revisions/rev_workingset/saved/filter/NSN_HiX5630_SNMPFilter ]]; then
echo " + DSLAM NSN 5600 series"
f_xynafactory set xact.snmp.exceptionmapping.file NSNDSLAMExceptionmappings.xml
fi
if [[ -d revisions/rev_workingset/saved/filter/DHCPFilter ]]; then
echo " + DHCPv4"
f_xynafactory set xact.dhcp.hashv4 false
f_xynafactory set xact.dhcp.hashv4passval 0
fi
echo " + Monitoring"
f_xynafactory set xyna.default.monitoringlevel ${DEFAULT_MONITORINGLEVEL}
echo " + Miscellaneous"
f_xynafactory set xyna.scheduler.stop.timeout.offset ${SCHEDULER_STOP_TIMEOUT_OFFSET}
f_xynafactory set xyna.scheduler.orderbackupwaitingforscheduling true
f_xynafactory set xyna.xnwh.persistence.xmlshell.greppath ${VOLATILE_GREP}
echo " + Exception-Code Groups"
f_xynafactory set xyna.exceptions.codegroup.extension.automatic true
f_xynafactory set xyna.exceptions.codegroup.extension.defaultpadding 5
f_xynafactory set xyna.exceptions.codegroup.extension.defaultpattern ${PROJECT_PREFIX_UPPERCASE}-[[]]
echo " + RMI-Hostname"
f_xynafactory set xyna.rmi.hostname.registry "${XYNA_RMI_IPADDRESS}"
}
install_xynafactory () {
echo -e "\n* Installing Xyna Factory into '${INSTALL_PREFIX}'."
PRODUCT_INSTANCE=$(printf "%03g" ${INSTANCE_NUMBER:-1})
PORT_OFFSET=$(( ($((10#${PRODUCT_INSTANCE})) - 1) * 10 ))
exit_if_dir_not_found revisions
exit_if_dir_not_found server
echo -e "\n + Copy delivery items to ${INSTALL_PREFIX}/{revisions,server}/."
${VOLATILE_MKDIR} -p ${INSTALL_PREFIX}/revisions/rev_workingset/saved/{services,sharedLibs,XMOM}
${VOLATILE_CP} -rp server ${INSTALL_PREFIX}/.
${VOLATILE_CP} -rp "./func_lib/" ${INSTALL_PREFIX}/server/.
#Lizenzen
install_license ${INSTALL_PREFIX}/server/lib
#Anpassen von log4j2.xml und xynafactory.sh
configure_log4j2_xml "${INSTALL_PREFIX}/server/log4j2.xml"
configure_xynafactory_sh "${INSTALL_PREFIX}/server/xynafactory.sh"
${VOLATILE_MKDIR} -p ${INSTALL_PREFIX}/server/installDefaults/
${VOLATILE_CP} ${INSTALL_PREFIX}/server/{log4j2.xml,server.policy,xynafactory.sh} ${INSTALL_PREFIX}/server/installDefaults
#Anpassen des RMI-Ports, damit Factory korrekt starten kann
set_rmi_port
#Schreibschutz für xynafactory.sh
${VOLATILE_CHMOD} 550 "${INSTALL_PREFIX}/server/xynafactory.sh"
#Bash-Completion auf jeden Fall einrichten
BASH_COMPLETION="true";
#Erstanlage der XynaProperties
f_install_properties
}
update_xynafactory () {
echo -e "\n* Updating Xyna Factory in '${INSTALL_PREFIX}'."
PRODUCT_INSTANCE=$(printf "%03g" ${INSTANCE_NUMBER:-1})
PORT_OFFSET=$(( ($((10#${PRODUCT_INSTANCE})) - 1) * 10 ))
exit_if_dir_not_found revisions
exit_if_dir_not_found server
#hier schon Berechtigung ändern, damit schreibbar im Backup
${VOLATILE_CHMOD} 750 ${INSTALL_PREFIX}/server/xynafactory.sh
echo -e "\n + Backup."
backup_dir ${INSTALL_PREFIX} revisions
backup_dir ${INSTALL_PREFIX} saved optional
backup_dir ${INSTALL_PREFIX} server
if [ -d ${INSTALL_PREFIX}/NetworkAvailability ] ; then
backup_dir ${INSTALL_PREFIX} NetworkAvailability
fi
echo -e "\n + Copy delivery items to ${INSTALL_PREFIX}/{revisions,server}/."
replace_child_dirs server/clusterproviders
replace_child_versioned_files server/conpooltypes
replace_child_dirs server/datamodeltypes
replace_dir server/lib ${INSTALL_PREFIX}/server/lib
replace_child_dirs server/orderinputsourcetypes
replace_child_dirs server/persistencelayers
copy_dir server/storage ${INSTALL_PREFIX}/server/storage
copy_dir server/resources ${INSTALL_PREFIX}/server/resources
copy_dir server/exceptions ${INSTALL_PREFIX}/server/exceptions
copy_dir func_lib ${INSTALL_PREFIX}/server/func_lib
copy_file server/product_lib.sh ${INSTALL_PREFIX}/server
copy_file server/Exceptions.xml ${INSTALL_PREFIX}/server
copy_file server/TemplateImplNew.zip ${INSTALL_PREFIX}/server
copy_file server/TemplateImpl.zip ${INSTALL_PREFIX}/server
${VOLATILE_MKDIR} -p ${INSTALL_PREFIX}/revisions/rev_workingset/saved/{services,sharedLibs,XMOM}
#persistencelayers.xml aus backup wiederherstellen
restore_file_from_dir ${INSTALL_PREFIX} server/storage/persistence persistencelayers.xml
#Lizenzen
install_license ${INSTALL_PREFIX}/server/lib
#Konfigurieren und Mergen von log4j2.xml, server.policy, xynafactory.sh
NEW_FILE_DIR="$(basename $HOSTNAME)"
if f_selected ${LOG4J2_MERGE} ; then
${VOLATILE_CP} server/log4j2.xml "$NEW_FILE_DIR/log4j2.xml"
configure_log4j2_xml "$NEW_FILE_DIR/log4j2.xml" "$NEW_FILE_DIR/log4j2.xml_configured"
merge_files ${INSTALL_PREFIX}/server log4j2.xml "$NEW_FILE_DIR" log4j2.xml_configured
fi;
merge_files ${INSTALL_PREFIX}/server server.policy server server.policy
${VOLATILE_CP} server/xynafactory.sh "$NEW_FILE_DIR/xynafactory.sh"
configure_xynafactory_sh "$NEW_FILE_DIR/xynafactory.sh" "$NEW_FILE_DIR/xynafactory.sh_configured"
merge_files ${INSTALL_PREFIX}/server xynafactory.sh "$NEW_FILE_DIR" xynafactory.sh_configured
# Fall es networkAvailability.properties gibt, dann werden die jetzt konfiguriert und gemixt
if [ -f ${INSTALL_PREFIX}/NetworkAvailability/config/networkAvailability.properties ]; then
${VOLATILE_CP} components/xact/NetworkAvailability/config/networkAvailability.properties "$NEW_FILE_DIR/networkAvailability.properties"
configure_networkAvailability_properties "$NEW_FILE_DIR/networkAvailability.properties" "$NEW_FILE_DIR/networkAvailability.properties_configured"
merge_files ${INSTALL_PREFIX}/NetworkAvailability/config networkAvailability.properties "$NEW_FILE_DIR" networkAvailability.properties_configured
# Da spaeter der ganze NA nochmal rekursiv kopiert wird, werden die bereits konfigurierten Werte wieder zurueckkopiert
${VOLATILE_CP} -rp ${INSTALL_PREFIX}/NetworkAvailability/config/networkAvailability.properties "$NEW_FILE_DIR/networkAvailability.properties"
fi
#für Umstieg auf log4j2 muss die Property 'jvm.option.log4j" angepasst werden
update_log4j_property
#Schreibschutz für xynafactory.sh
${VOLATILE_CHMOD} 550 ${INSTALL_PREFIX}/server/xynafactory.sh
echo -e "\n Updating server directory finished.\n"
}
replace_dir () {
local SOURCE_DIR=$1
local TARGET_DIR=$2
rm -rf ${TARGET_DIR}
${VOLATILE_CP} -rp ${SOURCE_DIR} ${TARGET_DIR}
}
copy_dir () {
local SOURCE_DIR=$1
local TARGET_DIR=$2
${VOLATILE_MKDIR} -p ${TARGET_DIR}
${VOLATILE_CP} -rp ${SOURCE_DIR} ${TARGET_DIR}
}
copy_file () {
local SOURCE_FILE=$1
local TARGET_DIR=$2
${VOLATILE_MKDIR} -p ${TARGET_DIR}
${VOLATILE_CP} -rp ${SOURCE_FILE} ${TARGET_DIR}
}
replace_versioned_file () {
local SOURCE_FILE=$1
local TARGET_DIR=$2
local SOURCE_BASE_FILE=$(basename -- "$SOURCE_FILE")
local TARGET_BASE_FILE=${SOURCE_BASE_FILE//[0-9]\.[0-9]\.[0-9]/*}
rm -f ${TARGET_DIR}/${TARGET_BASE_FILE}
${VOLATILE_CP} -rp ${SOURCE_FILE} ${TARGET_DIR}
}
replace_child_dirs () {
local SOURCE_DIR=$1
${VOLATILE_MKDIR} -p ${INSTALL_PREFIX}/${SOURCE_DIR}
for dir in ${SOURCE_DIR}/*; do
if [ -d "${dir}" ]; then
replace_dir ${dir} ${INSTALL_PREFIX}/${dir}
fi
done
}
replace_child_versioned_files () {
local SOURCE_DIR=$1
${VOLATILE_MKDIR} -p ${INSTALL_PREFIX}/${SOURCE_DIR}
for file in ${SOURCE_DIR}/*; do
if [ -f "${file}" ]; then
replace_versioned_file ${file} ${INSTALL_PREFIX}/${SOURCE_DIR}