#!/usr/local/bin/perl # # $Header: rdbms/src/common/java/oc4j/aqxmlctl.pl /main/3 2008/10/05 21:25:31 rbhyrava Exp $ # # aqxmlctl.pl # # Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. # # NAME # aqxmlctl.pl - Single controller script for start and # stop aqxml access # # DESCRIPTION # Single entry point script for start and shutdown isqlplus server # This perl script is called by shell script aqxmlctl # All the system variables are set from the shell script aqxmlctl # # The usage of this script is: # sh aqxmlctl start|stop|deploy # # NOTES # # # MODIFIED (MM/DD/YY) # rbhyrava 10/03/08 - XbranchMerge rbhyrava_bug-7445175 from # st_rdbms_11.1.0 # rbhyrava 10/03/08 - bug fix 7445175&7432282 # rbhyrava 05/13/08 - pwd from commandline # rbhyrava 11/04/04 - rbhyrava_aqxml_demo_oc4jdoc # rbhyrava 10/29/04 - Creation # # # get the action, component and argument count ... $action = $ARGV[0]; $pwd = $ARGV[1]; $argCount = scalar(@ARGV); $SD="\/"; $SP=":"; $OS = $ENV{'OS'}; $SD="\\" if($os =~ /Win/i); $SP=";" if($os =~ /Win/i); $JAVA_HOME = $ENV{'JAVA_HOME'}; $ORACLE_HOME = $ENV{'ORACLE_HOME'}; $DB_SID = $ENV{'ORACLE_SID'}; $DB_HOST = $ENV{'HOST'}; $DB_PORT = getdblistenerport(); $AQXML_OC4J_HOME = "${ORACLE_HOME}${SD}oc4j"; $AQXML_RMI_FILE= "${AQXML_OC4J_HOME}${SD}j2ee${SD}OC4J_AQ${SD}config${SD}rmi.xml"; $J2EE_HOME = "${AQXML_OC4J_HOME}${SD}j2ee${SD}home"; banner(); # print the banner. if ($argCount ge 1) #isqlplusctl start/stop { if ($action eq "start") { startaqxml(); } elsif ($action eq "stop") { stopaqxml(); } elsif ($action eq "deploy") { deployaqxml(); } else { displayHelp(); } } else { displayHelp(); } # subroutine to display banner sub banner() { print "AQXML 10.2.0.0\n"; print "Copyright (c) 2004 Oracle. All rights reserved.\n"; } # subroutine to display help sub displayHelp() { print "Invalid arguments\n"; print "\nUnknown command option $action\n"; print "Usage:: \n"; print " aqxmlctl start|stop \n"; } # # Sub routine to stop the AQXML Instance # sub stopaqxml() { # # Get rmi port from rmi.xml # $rmiportno = getrmiport(); $AQ_RMI_PORT = "$rmiportno"; print $rmiportno; my($timeinmills) = time(); print "\nStopping AQXML ...\n"; chdir("$J2EE_HOME"); system("${JAVA_HOME}${SD}bin${SD}java -jar ${J2EE_HOME}${SD}admin.jar ". " ormi://localhost:$AQ_RMI_PORT/aqxmldemo admin $pwd " . " -shutdown force"); # Give JAVA enough time to stop aqxml instance sleep(30); print "AQXML instance stopped.\n"; exit 0; } sub getdblistenerport() { $_=`lsnrctl stat | grep "PROTOCOL=tcp"`; /(.*)PORT=(.*)\)\)\)/; $dblistenport=$2; return $dblistenport; } sub getrmiport() { # Open the rmi.xml file open(AQXMLRMI,"$AQXML_RMI_FILE") || die "Cannot open ${AQXML_RMI_FILE}.\n"; # Read the file line by line while () { # Check for the line containing the word "port=" if (/^\s*$fl" ) ; system("echo 'CMP_NAME=OC4J_AQ' >>$fl" ) ; system("echo 'HTTP_PORT=5760'>>$fl" ) ; system("echo 'JMS_PORT=5740'>>$fl" ) ; system("echo 'RMI_PORT=5720'>>$fl" ) ; system("echo 'RMIS_PORT=5710'>>$fl" ) ; system("echo 'DISTRIBUTED=false\n\n'>>$fl" ) ; system("echo '[application]'>>$fl" ) ; system("echo 'CMP_NAME=OC4J_AQ'>>$fl" ) ; system("echo 'APP_DEPLOYMENT_NAME=aqxmldemo'>>$fl" ) ; system("echo 'APP_LOCATION=$ORACLE_HOME/rdbms/demo/aqxmldemo.ear'>>$fl" ) ; system("echo 'WEB_APP_NAME=aqxmldemo_web'>>$fl" ) ; system("echo 'CONTEXT_ROOT=/aqserv/servlet\n\n'>>$fl" ) ; } sub make_secure { print "Secure website ....\n"; $file = "${AQXML_OC4J_HOME}${SD}j2ee${SD}OC4J_AQ${SD}config${SD}http-web-site.xml"; $keystorefile= "${ORACLE_HOME}${SD}rdbms${SD}demo${SD}keystore"; system ("cp $file $file.prot") ; open(IN, "< $file.prot"); open(OUT, ">$file"); while () { s!port=!secure="true" port=!; s!load-on-startup!max-inactivity-time="200" shared="true" load-on-startup!; s!!\n!; print OUT; } close IN ; close OUT; }