htsDeployTool.sh 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. #!/bin/sh
  2. # *********************************************************************************************************************************
  3. # * Licensed Materials - Property of IBM *
  4. # * *
  5. # * IBM Cognos Products: HTS *
  6. # * *
  7. # * (C) Copyright IBM Corp. 2005, 2019 *
  8. # * *
  9. # * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
  10. # *********************************************************************************************************************************
  11. # *************** HTS Export *********************
  12. # ** This batch is designed to export Human task service task data
  13. # ** -exportFile
  14. # ** the exportFile will be created in deployment folder and given a .xml.gz extension if you dont provide one
  15. # ** -password
  16. # ** this file will be encrypted if you provide this argument, in which case it will necessary to supply the password when you import
  17. # ** -camNamespace, -camUsername, -camPassword
  18. # ** when running deploy from bin the server must be running and if a secure namespace is defined, the details entered with these parameters
  19. # ** -persistenceUnit
  20. # ** defaults to humanTaskService but can be annotations
  21. # ************************************************
  22. # *************** HTS Import *********************
  23. # ** This batch is designed to import Human task service task data
  24. # ** -importFile
  25. # ** the importFile must point to a valid Human task service export file
  26. # ** -password
  27. # ** this file may be encrypted, in which case it is necessary to supply the password with the -password argument
  28. # ** -camNamespace, -camUsername, -camPassword
  29. # ** when running deploy from bin the server must be running and if a secure namespace is defined, the details entered with these parameters
  30. # ** -overwrite
  31. # ** still a work in progress
  32. # ** -persistenceUnit
  33. # ** defaults to humanTaskService but can be annotations
  34. # ************************************************
  35. # ---------------------------------------------------------------------------
  36. # Shell script (Windows) to invoke jre and launch IBM Cognos Human task service import.
  37. #
  38. # When exporting, all human tasks will be sent to an xml file in the deployment folder.
  39. # at export time, cm is called to resolve all store ids into search paths.
  40. # use the htsExportAll batch to export
  41. #
  42. # to import the deployment file must be physically moved to the deployment folder of the target system
  43. # When importing all search paths will be resolved into store ids on the target system.
  44. # use the htsImporttAll batch to import
  45. #
  46. #
  47. # J_HOME is the location of the Java RE installation; if JAVA_HOME is
  48. # defined, use it. Otherwise default to the local distribution.
  49. # J_OPTS are the Java options to be passed into the JAVA VM (optional)
  50. # ---------------------------------------------------------------------------
  51. # If the argument -java:{env | local} is present as first argument then the required JRE will be
  52. # loaded: -java:env will force the script to look for JRE using JAVA_HOME environment variable.
  53. # If not found then it will end by an error. The argument -java:local will force it to look
  54. # for JRE within the local distribution. If not found then it will end by an error.
  55. # Otherwise, the script will default by looking for a JRE using the JAVA_HOME environment
  56. # variable, then if cannot find one, it will try to use the local distribution.
  57. function JavaHomeError {
  58. echo You have specified the argument '-java:env'.
  59. echo However, the environment variable JAVA_HOME is not defined or incorrectly defined.
  60. echo Please define JAVA_HOME first before using the argument '-java:env'.
  61. exit -100
  62. }
  63. function useLocal {
  64. # Using the local distribution either because -java:local was
  65. # specified or because the JAVA_HOME environment variable
  66. # is not defined or if the JAVA_HOME location doesn't have a JRE.
  67. export J_HOME=../ibm-jre/jre
  68. if [ -e "$J_HOME/bin/java" ]
  69. then
  70. gotJava $@
  71. else
  72. # Did not find a JRE in the local location, display error and exit.
  73. error
  74. fi
  75. }
  76. function useEnvVar {
  77. # Shift the first argument: -java:env
  78. if [ $1 == "-java:env" ]
  79. then
  80. echo shifting
  81. shift
  82. useEnvVarOnly $@
  83. fi
  84. # Using the distribution referred by JAVA_HOME because
  85. # -java:local was NOT specified and the JAVA_HOME environment
  86. # variable is defined.
  87. export J_HOME=$JAVA_HOME
  88. if [ -e $J_HOME/bin/java ]
  89. then
  90. gotJava $@
  91. else
  92. export J_HOME=$JAVA_HOME/jre
  93. if [ -e $J_HOME/bin/java ]
  94. then
  95. gotJava $@
  96. else
  97. error
  98. fi
  99. fi
  100. }
  101. function error {
  102. echo Could not find a JRE. Cannot run IBM Cognos Configuration.
  103. exit -101
  104. }
  105. function gotJava {
  106. # ----- Prepare Appropriate Java Execution Commands -------------------------
  107. export _RUNJAVA=$J_HOME/bin/java
  108. echo java is $_RUNJAVA
  109. export CP=../webapps/p2pd/WEB-INF/classes:../webapps/p2pd/WEB-INF/lib/hts.jar:../webapps/p2pd/WEB-INF/lib/JSQLConnect.jar:../webapps/p2pd/WEB-INF/lib/zipi.jar:../webapps/p2pd/WEB-INF/lib/activation.jar:../webapps/p2pd/WEB-INF/lib/axis.jar:../webapps/p2pd/WEB-INF/lib/axisCrnpClient.jar:../webapps/p2pd/WEB-INF/lib/cclcfgapi.jar:../webapps/p2pd/WEB-INF/lib/cclcoreutil.jar:../webapps/p2pd/WEB-INF/lib/CognosIPF.jar:../webapps/p2pd/WEB-INF/lib/commons-configuration-1.5.jar:../webapps/p2pd/WEB-INF/lib/commons-discovery-0.2.jar:../webapps/p2pd/WEB-INF/lib/commons-httpclient-3.1.jar:../webapps/p2pd/WEB-INF/lib/commons-codec-1.3.jar:../webapps/p2pd/WEB-INF/lib/commons-io-2.4.jar:../webapps/p2pd/WEB-INF/lib/commons-lang-2.6.jar:../webapps/p2pd/WEB-INF/lib/commons-logging-1.1.jar:../webapps/p2pd/WEB-INF/lib/commons-pool-1.3.jar:../webapps/p2pd/WEB-INF/lib/concurrent.jar:../webapps/p2pd/WEB-INF/lib/dom4j-1.6.1.jar:../webapps/p2pd/WEB-INF/lib/i18nj.jar:../webapps/p2pd/WEB-INF/lib/jakarta-oro-2.0.8.jar:../webapps/p2pd/WEB-INF/lib/javacc.jar:../webapps/p2pd/WEB-INF/lib/jaxrpc.jar:../webapps/p2pd/WEB-INF/lib/jcam_crypto.jar:./jcam_jni.jar:../webapps/p2pd/WEB-INF/lib/log4j-1.2.8.jar:../webapps/p2pd/WEB-INF/lib/logkit-1.2.jar:../webapps/p2pd/WEB-INF/lib/mail.jar:../webapps/p2pd/WEB-INF/lib/p2pd.jar:../webapps/p2pd/WEB-INF/lib/saaj.jar:../webapps/p2pd/WEB-INF/lib/soap.jar:../webapps/p2pd/WEB-INF/lib/geronimo-stax-api_1.0_spec-1.0.1.jar:../webapps/p2pd/WEB-INF/lib/wsdl4j-1.5.1.jar:../webapps/p2pd/WEB-INF/lib/wsif.jar:../webapps/p2pd/WEB-INF/lib/xalan.jar:../webapps/p2pd/WEB-INF/lib/xml-apis.jar:../webapps/p2pd/WEB-INF/lib/xmlsec-1.4.3.jar:../webapps/p2pd/WEB-INF/lib/xts.jar:../webapps/p2pd/WEB-INF/lib/xtsext.jar:../tomcat/lib/tools.jar:../tomcat/lib/servlet-api.jar:.//ant.jar:.//cclcfgapi.jar:../webapps/p2pd/WEB-INF/lib/rdsclient.jar:../webapps/p2pd/WEB-INF/lib/uddi4j.jar:../webapps/p2pd/WEB-INF/lib/serp-1.13.1.jar:../webapps/p2pd/WEB-INF/lib/commons-collections-3.2.1.jar:../webapps/p2pd/WEB-INF/lib/commons-pool-1.3.jar:../webapps/p2pd/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.jar:../webapps/p2pd/WEB-INF/lib/openjpa-1.2.1.jar:../webapps/p2pd/WEB-INF/lib/pf.jar:../webapps/p2pd/WEB-INF/lib/json.jar:../webapps/p2pd/WEB-INF/lib/caf.jar:../webapps/p2pd/WEB-INF/lib/jsm-common.jar:../webapps/p2pd/WEB-INF/lib/noticecast.jar:../webapps/p2pd/WEB-INF/lib/geronimo-jpa_3.0_spec-1.0.jar:../webapps/p2pd/WEB-INF/lib/cognos-ws-ht.jar:../webapps/p2pd/WEB-INF/lib/xmlbeans-2.3.0.jar:../bin/slf4j-api-1.7.23.jar:../bin/slf4j-nop-1.7.23.jar:./*.jar
  110. $_RUNJAVA -cp $CP $J_OPTS com.ibm.cognos.internal.hts.deployment.DeploymentTool $@
  111. exit 0
  112. }
  113. function useEnvVarOnly {
  114. # JAVA_HOME should be defined first.
  115. if [ $JAVA_HOME == "" ]
  116. then
  117. JavaHomeError
  118. fi
  119. echo Looking for JRE in: $J_HOME/bin
  120. export J_HOME=$JAVA_HOME
  121. if [ -e $J_HOME/bin/java ]
  122. then
  123. echo $J_HOME/bin/java
  124. gotJava $@
  125. fi
  126. echo Looking for JRE in: $J_HOME/jre/bin
  127. export J_HOME=$JAVA_HOME/jre
  128. if [-e $J_HOME/bin/java]
  129. then
  130. gotJava $@
  131. fi
  132. }
  133. # ----- Verify and Set Required Environment Variables -----------------------
  134. # check if we need to run the local jre
  135. #
  136. if [ $# -eq 0 ]
  137. then
  138. echo no arguments are passed
  139. exit -102
  140. fi
  141. echo JAVA_HOME is $JAVA_HOME
  142. if [ $1 = "-java:local" ]
  143. then
  144. shift
  145. useLocal $@
  146. else
  147. # Try first the use of JAVA_HOME
  148. useEnvVar $@
  149. fi