2 Replies Latest reply on Jan 1, 2009 10:00 AM by gaohoward

    JBM 1.4 installation script

    timfox

      Howard - could you post here info about your installation script which you sent in a private message, so everyone can benefit?

        • 1. Re: JBM 1.4 installation script
          gaohoward

          OK Tim. I wrote a script to automate the JBM 1.4 installation process. Currently JBM 1.4 has an ant script release-admin.xml to help us do the installation. But it only does the half job. A lot configurations need to be done by hand. This is a time consuming process. The script I wrote is trying to make the whole installation process done automatically. It is written in perl as I think of perl to be very good at text file manipulation.

          To run the script,

          ./install_jbm14.pl --jbm14inst=<jbm14 installation dir> --jboss-home=<jboss home> --node-base=<node name> --n-node=<num of nodes> --clustered --db=<mysql>
          


          example:
          ./install_jbm14.pl --jbm14inst=/home/howard/apps/jboss-messaging-1.4.2.GA --jboss-home=/home/howard/jboss-4.2.3.GA --node-base=messaging-node --n-node=2 -clustered --db=mysql
          


          the above will install two clustered JBM nodes named messaging-node0 and messaging-node1, using mysql as the database.

          For details please look at the scripts itself, it's pretty straightforward.


          • 2. Re: JBM 1.4 installation script
            gaohoward

            The script need three more files to be in the same dir as the script itself, they are:

            jboss-remoting.jar -- the jboss remoting patch version for JBM14
            mysql-connector-java-5.0.8-bin.jar -- mysql jdbc driver
            jbm-sample-bindings.xml -- service port bindings configure file.

            The script only support mysql db, and max nodes for a cluster is 4 (limited by the jbm-sample-bindings.xml). The jbm-sample-bindings.xml and the scripts are given below.

            ==== install_jbm14.pl ====

            #!/usr/bin/perl
            
            # @ARGV
            
            use Getopt::Long;
            use File::Copy;
            use Archive::Extract;
            
            # print "$#ARGV\n";
            
            my $jbm14_home = '';
            my $jbhome = '';
            my $nodebase = '';
            my $nnode = '';
            my $clustered = '';
            my $db = '';
            my $help = '';
            
            GetOptions('help|?' => \$help, 'jbm14inst=s' => \$jbm14_home, 'jboss-home=s' => \$jbhome, 'node-base=s' => \$nodebase, 'n-node=i' => \$nnode, 'clustered' => \$clustered, 'db=s' => \$db);
            
            if ( ! $jbm14_home )
            {
             $jbm14_home = $ENV{JBM14_HOME};
            }
            
            if ( ! $jbhome )
            {
             $jbhome = $ENV{JBOSS_HOME};
            }
            
            if ( ! $nodebase )
            {
             $nodebase = 'messaging';
             if ( $clustered )
             {
             $nodebase = 'messaging-node';
             }
            }
            
            if ( ! $nnode )
            {
             if ( ! $clustered )
             {
             $nnode = 1;
             }
             else
             {
             $nnode = 2;
             }
            }
            
            if ( ! $db )
            {
             if ( $clustered )
             {
             #cluster must use mysql
             $db = 'mysql';
             }
            }
            
            &validateJBM($jbm14_home);
            &validateJBoss($jbhome);
            
            if ( $clustered )
            {
             setUpClustered($jbhome, $nodebase, $nnode, $jbm14_home, $db);
            }
            else
            {
             setUpSingleNode($jbhome, $nodebase, $jbm14_home, $db);
            }
            
            exit 0;
            
            
            #single node
            #args stored in @_, to access single arg: $_[0,1,2...]
            # $_[0] -- jboss home
            # $_[1] -- node name
            # $_[2] -- jbm home
            # $_[3] -- db name
            sub setUpSingleNode
            {
             print "----Setting up Single Node ----\n";
            
             my $jboss_home = $_[0];
             my $jboss_node = $_[1];
            
             my $nodedir = "$jboss_home/server/$jboss_node";
             createNodeDir($nodedir);
            
             &copyDefaultNodeFiles($jboss_home, $nodedir, $_[2]);
            
             &setupDBForSingleNode($_[2], $nodedir, $_[3], $_[0]);
            
             print "----DONE----\n";
            }
            
            #$_[0] -- jbm home
            #$_[1] -- node dir
            #$_[2] -- db name
            #$_[3] -- jboss home
            sub setupDBForSingleNode
            {
             if ( $_[2] eq 'mysql' )
             {
            
             # setup persistence file
             my $oldconfig = "$_[1]/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml";
             unlink $oldconfig;
            
             my $newconfig = "$_[0]/examples/config/mysql-persistence-service.xml";
             $newconfig =~ s/\/\//\//s;
            
             copy($newconfig, "$_[1]/deploy/jboss-messaging.sar") or die "error copy persistence file. $!\n";
            
             # jdbc driver
             my $jdbcDrv = "mysql-connector-java-5.0.8-bin.jar";
             copy($jdbcDrv, "$_[1]/lib") or die "error copy jdbc driver $!\n";
            
             # mysql-ds.xml
             my $mysqlds = "$_[3]/docs/examples/jca/mysql-ds.xml";
             $mysqlds =~ s/\/\//\//s;
            
             unlink "$_[1]/deploy/hsqldb-ds.xml";
             copy($mysqlds, "$_[1]/deploy") or die "error copying mysql-ds.xml. $!\n";
            
             my $dsfile = "$_[1]/deploy/mysql-ds.xml";
             open(my $h_dsfile, "<", $dsfile);
             local $/=undef;
             my $dscontent = <$h_dsfile>;
            
             $dscontent =~ s/MySqlDS/DefaultDS/s;
             $dscontent =~ s/mysql\-hostname:3306\/jbossdb/localhost:3306\/messaging/s;
             $dscontent =~ s/>x</>sa</s;
             $dscontent =~ s/>y</></s;
            
             close $h_dsfile;
             open($h_dsfile, ">", $dsfile);
             print $h_dsfile $dscontent;
             close $h_dsfile;
             }
             else
             {
             if ( $_[2] )
             {
             error("$_[2] is not supported yet.\n");
             }
             }
            }
            
            #clustered nodes
            # $_[0] -- jboss home
            # $_[1] -- node name
            # $_[2] -- node number
            # $_[3] -- jbm home
            # $_[4] -- db name
            sub setUpClustered
            {
             print "----Setting up Clustered nodes ----\n";
             my $jboss_home = $_[0];
             my $node_base_name = $_[1];
             my $node_num = $_[2];
             my $jbm_home = $_[3];
             my $db_name = $_[4];
            
             my $basedir = "$jboss_home/server";
             createNodeDirs($basedir, $node_base_name, $node_num);
            
             copy("jbm-sample-bindings.xml", "$jboss_home/docs/examples") or die "failed to copy jbm-sample-bindings.xml $!\n";
            
             &copyClusteredNodesFiles($jboss_home, $node_base_name, $node_num, $jbm_home);
            
             &setupDBForClusteredNodes($jboss_home, $node_base_name, $node_num, $jbm_home, $db_name);
            
             print "----DONE ----\n";
            }
            
            #$_[0] -- jboss home
            #$_[1] -- node base name
            #$_[2] -- node num
            #$_[3] -- jbm home
            #$_[4] -- db name
            sub setupDBForClusteredNodes
            {
             for (my $i = 0; $i < $_[2]; $i++)
             {
             my $nodename = sprintf("$_[1]%d", $i);
             my $nodedir = "$_[0]/server/$nodename";
            
             &setupDBForSingleClusteredNode($_[3], $nodedir, $_[4], $_[0]);
             }
            }
            
            #$_[0] -- jbm home
            #$_[1] -- node dir
            #$_[2] -- db name
            #$_[3] -- jboss home
            sub setupDBForSingleClusteredNode
            {
             if ( $_[2] eq 'mysql' )
             {
             # setup persistence file
             my $oldconfig = "$_[1]/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml";
             unlink $oldconfig;
            
             my $newconfig = "$_[0]/examples/config/mysql-persistence-service.xml";
             $newconfig =~ s/\/\//\//s;
             print "file: $newconfig\n";
             print "dest: $_[1]/deploy/jboss-messaging.sar\n";
             copy($newconfig, "$_[1]/deploy/jboss-messaging.sar") or die "error copy persistence file. $!\n";
            
             $newconfig = "$_[1]/deploy/jboss-messaging.sar/mysql-persistence-service.xml";
             open(my $h_newconfig, "<", $newconfig);
             local $/=undef;
             my $nccontent = <$h_newconfig>;
            
             #<attribute name="Clustered">false</attribute>
             $oldval = '<attribute name="Clustered">false</attribute>';
             $newval = '<attribute name="Clustered">true</attribute>';
             $nccontent =~ s/$oldval/$newval/s;
            
             close $h_newconfig;
             open($h_newconfig, ">", $newconfig);
             print $h_newconfig $nccontent;
             close $h_newconfig;
            
             # jdbc driver
             my $jdbcDrv = "mysql-connector-java-5.0.8-bin.jar";
             copy($jdbcDrv, "$_[1]/lib") or die "error copy jdbc driver $!\n";
            
             # mysql-ds.xml
             my $mysqlds = "$_[3]/docs/examples/jca/mysql-ds.xml";
             $mysqlds =~ s/\/\//\//s;
            
             unlink "$_[1]/deploy/hsqldb-ds.xml";
             copy($mysqlds, "$_[1]/deploy") or die "error copying mysql-ds.xml. $!\n";
            
             my $dsfile = "$_[1]/deploy/mysql-ds.xml";
             open(my $h_dsfile, "<", $dsfile);
             local $/=undef;
             my $dscontent = <$h_dsfile>;
            
             $dscontent =~ s/MySqlDS/DefaultDS/s;
             $dscontent =~ s/mysql\-hostname:3306\/jbossdb/localhost:3306\/messaging/s;
             $dscontent =~ s/>x</>sa</s;
             $dscontent =~ s/>y</></s;
            
             close $h_dsfile;
             open($h_dsfile, ">", $dsfile);
             print $h_dsfile $dscontent;
             close $h_dsfile;
             }
             else
             {
             error("$_[2] is not supported yet.\n");
             }
            }
            
            #$_[0] -- jboss home
            #$_[1] -- node base name
            #$_[2] -- node num
            #$_[3] -- jbm14_home
            sub copyClusteredNodesFiles
            {
             for (my $i = 0; $i < $_[2]; $i++)
             {
             my $nodename = sprintf("$_[1]%d", $i);
             my $basedir = "$_[0]/server/$nodename";
             &copyAllNodeFiles($_[0], $basedir, $_[3], $i);
             }
            }
            
            #$_[0] -- jboss home
            #$_[1] -- node dir
            #$_[2] -- jbm14_home
            #$_[3] -- node id
            sub copyAllNodeFiles
            {
             my $srcnodedir = "$_[0]/server/all";
             my $nodedir = $_[1];
            
             my %ex_dirs = ("jms" => "jms");
             # $hash_list{'jms'} = 'jms';
             my %ex_files = ("jbossmq.jar" => "jbossmq.jar");
            
             copyDir("$srcnodedir/conf", "$nodedir/conf");
             copyDir("$srcnodedir/deploy", "$nodedir/deploy", \%ex_dirs, \%ex_files);
             copyDir("$srcnodedir/lib", "$nodedir/lib", \%ex_dirs, \%ex_files);
             copyDir("$srcnodedir/farm", "$nodedir/farm");
             copyDir("$srcnodedir/deploy-hasingleton", "$nodedir/deploy-hasingleton", \%ex_dirs, \%ex_files);
            
             my $jbm14_dir = $_[2];
            
             copyFile("$jbm14_dir/jboss-messaging.jar", "$nodedir/lib/jboss-messaging.jar");
             copyFile("$jbm14_dir/src/etc/server/default/config", "$nodedir/conf/props");
             copyFile("$srcnodedir/deploy/jms/jms-ra.rar", "$nodedir/deploy/jms-ra.rar");
            # copyFile("$srcnodedir/deploy/jms/jms-ds.xml", "$nodedir/deploy/jms-ds.xml");
             copyFile("$srcnodedir/deploy/jms/hajndi-jms-ds.xml", "$nodedir/deploy/hajndi-jms-ds.xml");
            
             #apply remoting patch
             copy ("jboss-remoting.jar", "$nodedir/lib") or die ("can't copy remoting jar $!");
            
             &extractJarFile("$jbm14_dir/jboss-messaging.sar", "$nodedir/deploy/jboss-messaging.sar");
            
             &handleConfig_MessagingService_cluster("$nodedir/deploy/jboss-messaging.sar/messaging-service.xml", $_[3]);
            
             &handleConfig_JmsDs("$nodedir/deploy/hajndi-jms-ds.xml");
            
             &handleConfig_StandardJBoss("$nodedir/conf/standardjboss.xml");
            
             &handleConfig_JBossService_cluster("$nodedir/conf/jboss-service.xml", $_[3]);
            
             &handleConfig_LoginConfig("$nodedir/conf/login-config.xml");
            
            }
            
            #$_[0] -- jboss-service.xml
            #$_[1] -- node id
            sub handleConfig_JBossService_cluster
            {
             my $jsfile = $_[0];
             open(my $h_jsfile, "<", $jsfile);
            
             local $/=undef;
             my $contents = <$h_jsfile>;
            
             $contents =~ s/(<attribute\sname="JMSService">.*service=DestinationManager<\/attribute>\n)//sg;
            
             my $binding = ' <mbean code="org.jboss.services.binding.ServiceBindingManager"
             name="jboss.system:service=ServiceBindingManager">
             <attribute name="ServerName">portsXX</attribute>
             <attribute name="StoreURL">${jboss.home.url}/docs/examples/jbm-sample-bindings.xml</attribute>
             <attribute name="StoreFactoryClassName">
             org.jboss.services.binding.XMLServicesStoreFactory
             </attribute>
             </mbean>
            
             <!-- ==================================================================== -->
             <!-- Class Loading -->
             <!-- ==================================================================== -->';
            
             my $mark = ' <!-- ==================================================================== -->
             <!-- Class Loading -->
             <!-- ==================================================================== -->';
            
             $contents =~ s/$mark/$binding/s;
             my $port = sprintf("%02d", $_[1] + 1);
            
             $contents =~ s/portsXX/ports\-$port/s;
            
             close $h_jsfile;
             open($h_jsfile, ">", $jsfile);
             print $h_jsfile $contents;
             close $h_jsfile;
            }
            
            #$_[0] -- messaging-service.xml
            #$_[1] -- node id
            sub handleConfig_MessagingService_cluster
            {
             my $msfile = $_[0];
            
             open(my $h_msfile, "<", $msfile);
            
             local $/=undef; #make the whole contents into string.
             my $contents = <$h_msfile>;
             my $suckpasswd = '<attribute name="SuckerPassword">suckerforclusterjbm</attribute>';
             $contents =~ s/(<\!--\s*The password.*attribute>\s*-->)/$suckpasswd/s;
            
             #server peer id
             $contents =~ s/>\$\{jboss.messaging.ServerPeerID:0\}</>$_[1]</s;
            
             close $h_msfile;
             open($h_msfile, ">", $msfile);
            
             print $h_msfile $contents;
             close $h_msfile;
            }
            
            
            #$_[0] -- base dir
            #$_[1] -- node base
            #$_[2] -- node number
            sub createNodeDirs
            {
             for (my $i = 0; $i < $_[2]; $i++)
             {
             my $nodename = sprintf("$_[1]%d", $i);
             my $nodedir = "$_[0]/$nodename";
             &createNodeDir($nodedir);
             }
            }
            
            #$_[0] -- the dir
            sub createNodeDir
            {
             my $thedir = $_[0];
             if ( -e $thedir )
             {
             &error("the dir $thedir already exists!\n");
             }
             $result = mkdir $thedir;
            }
            
            #$_[0] -- JBoss Messaging 1.4 installation base
            sub validateJBM()
            {
             if ( ! $_[0] )
             {
             &error("JBoss Messaging 1.4 installation base is not specified!\n");
             }
             if ( (-e $_[0]) && (-d $_[0]) )
             {
             #jars and sars must exist
             if ( (-e "$_[0]/jboss-messaging.jar") && (-e "$_[0]/jboss-messaging.sar") && (-e "$_[0]/jboss-messaging-client.jar") )
             {
             print "JBM installation OK.\n";
             }
             else
             {
             &error("Not a valid JBM14 installation, the jboss-messaging.jar, jboss-messaging-client.jar and jboss-messaging.sar must exist!\n");
             }
             }
             else
             {
             &error("JBoss Messaging 1.4 installation base doesn't exist!\n");
             }
            }
            
            #check the right location and version
            #make sure the node not created alread, if so, exit.
            #usage: validateJBoss(jbosshome, nodename, num of nodes);
            sub validateJBoss
            {
             if ( ! -e "$_[0]/bin/run.jar" )
             {
             &error("$_[0] is Not a valid JBoss Installation!\n");
             }
            }
            
            sub error
            {
             print " \n*** $_[0]\n";
             &usage;
             exit 0;
            }
            
            #$_[0] -- jboss home
            #$_[1] -- node dir
            #$_[2] -- jbm14_home
            sub copyDefaultNodeFiles
            {
             my $srcnodedir = "$_[0]/server/default";
             my $nodedir = $_[1];
            
             my %ex_dirs = ("jms" => "jms");
            # $hash_list{'jms'} = 'jms';
             my %ex_files = ("jbossmq.jar" => "jbossmq.jar");
            
             copyDir("$srcnodedir/conf", "$nodedir/conf");
             copyDir("$srcnodedir/deploy", "$nodedir/deploy", \%ex_dirs, \%ex_files);
             copyDir("$srcnodedir/lib", "$nodedir/lib", \%ex_dirs, \%ex_files);
            
             my $jbm14_dir = $_[2];
            
             copyFile("$jbm14_dir/jboss-messaging.jar", "$nodedir/lib/jboss-messaging.jar");
             copyFile("$jbm14_dir/src/etc/server/default/config", "$nodedir/conf/props");
             copyFile("$srcnodedir/deploy/jms/jms-ra.rar", "$nodedir/deploy/jms-ra.rar");
             copyFile("$srcnodedir/deploy/jms/jms-ds.xml", "$nodedir/deploy/jms-ds.xml");
            # copyFile("$srcnodedir/deploy/jms/hajndi-jms-ds.xml", "$nodedir/deploy/hajndi-jms-ds.xml");
            
             #apply remoting patch
             copy ("jboss-remoting.jar", "$nodedir/lib") or die ("can't copy remoting jar $!");
            
             &extractJarFile("$jbm14_dir/jboss-messaging.sar", "$nodedir/deploy/jboss-messaging.sar");
            
             &handleConfig_MessagingService("$nodedir/deploy/jboss-messaging.sar/messaging-service.xml");
            
             &handleConfig_JmsDs("$nodedir/deploy/jms-ds.xml");
            
             &handleConfig_StandardJBoss("$nodedir/conf/standardjboss.xml");
            
             &handleConfig_JBossService("$nodedir/conf/jboss-service.xml");
            
             &handleConfig_LoginConfig("$nodedir/conf/login-config.xml");
            
            }
            
            #$_[0] -- login-config.xml
            sub handleConfig_LoginConfig
            {
             my $lcfile = $_[0];
             open(my $h_lcfile, "<", $lcfile);
            
             local $/=undef;
             my $contents = <$h_lcfile>;
            
             $contents =~ s/(<\!--\sSecurity\sdomain\sfor\sJBossMQ.*)(<\!--\sSecurity\sdomains\sfor\stesting\snew\sjca\sframework\s-->)/$2/sg;
            
             $msgseccfg = '
             <application-policy name = "messaging">
             <authentication>
             <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
             flag = "required" >
             <module-option name = "unauthenticatedIdentity">guest</module-option>
             <module-option name = "usersProperties">props/messaging-users.properties</module-option>
             <module-option name = "rolesProperties">props/messaging-roles.properties</module-option>
             </login-module>
             </authentication>
             </application-policy>
            ';
            
             $contents =~ s/(<policy>)/<policy>\n$msgseccfg/s;
            
             close $h_lcfile;
             open($h_lcfile, ">", $lcfile);
             print $h_lcfile $contents;
             close $h_lcfile;
            }
            
            #$_[0] -- jboss-service.xml
            sub handleConfig_JBossService
            {
             my $jsfile = $_[0];
             open(my $h_jsfile, "<", $jsfile);
            
             local $/=undef;
             my $contents = <$h_jsfile>;
            
             $contents =~ s/(<attribute\sname="JMSService">.*service=DestinationManager<\/attribute>\n)//sg;
            
             close $h_jsfile;
             open($h_jsfile, ">", $jsfile);
             print $h_jsfile $contents;
             close $h_jsfile;
            }
            
            #$_[0] -- standardjboss.xml
            sub handleConfig_StandardJBoss
            {
             my $sjfile = $_[0];
             open(my $h_sjfile, "<", $sjfile);
            
             local $/=undef;
             my $contents = <$h_sjfile>;
            
             $contents =~ s/(<CreateJBossMQDestination>true)/<CreateJBossMQDestination>false/sg;
            
             close $h_sjfile;
             open($h_sjfile, ">", $sjfile);
             print $h_sjfile $contents;
             close $h_sjfile;
            }
            
            #$_[0] -- jms-ds.xml
            sub handleConfig_JmsDs
            {
             my $jdfile = $_[0];
             open(my $h_jdfile, "<", $jdfile);
            
             local $/=undef;
             my $contents = <$h_jdfile>;
             $contents =~ s/(jboss.mq)/jboss.messaging/sg;
            
             close $h_jdfile;
             open($h_jdfile, ">", $jdfile);
             print $h_jdfile $contents;
             close $h_jdfile;
            }
            
            #$_[0] -- messaging-service.xml
            sub handleConfig_MessagingService
            {
             my $msfile = $_[0];
            
             open(my $h_msfile, "<", $msfile);
            
             local $/=undef; #make the whole contents into string.
             my $contents = <$h_msfile>;
             my $suckpasswd = '<attribute name="SuckerPassword">suckerforclusterjbm</attribute>';
             $contents =~ s/(<\!--\s*The password.*attribute>\s*-->)/$suckpasswd/s;
            
             close $h_msfile;
             open($h_msfile, ">", $msfile);
            
             print $h_msfile $contents;
             close $h_msfile;
            }
            
            #$_[0] -- jar file (zip file)
            #$_[1] -- target dir
            sub extractJarFile
            {
             $jarfile = $_[0];
             $targetDir = $_[1];
            
             if ( -e $targetDir )
             {
             if ( -f $targetDir )
             {
             #can't be a file
             &error("The target for extracting $jarfile can't be a existing file.\n");
             }
             }
             else
             {
             mkdir ($targetDir);
             }
             my $ae = Archive::Extract->new(archive => $jarfile, type => 'zip');
             $ae->extract( to => $targetDir ) or die $ae->error;
            }
            
            
            #$_[0] -- source, if dir, copy all its contents
            #$_[1] -- target, if dir, copy source to the dir.
            sub copyFile()
            {
             my $src = $_[0];
             my $target = $_[1];
            
             if ( not -e $src )
             {
             &error("$src not exist!\n");
             }
            
             #if src is dir, target must be.
             if ( -d $src )
             {
             if ( not -e $target )
             {
             mkdir ($target);
             }
             else
             {
             if ( not -d $target )
             {
             &error("$target must be a dir for dir copying.\n");
             }
             }
             &copyDir($src, $target);
             }
             else
             {
             #file copy
             if ( -e $target )
             {
             #if target is a file and exists
             if ( -f $target )
             {
             &error("$target exists, copy stopped. \n");
             }
             }
             copy($src, $target) or die "copy error $!\n";
             }
            }
            
            
            
            #copy the dir and its contents to a new dir recursively
            #$_[0] -- src dir
            #$_[1] -- dest dir
            sub copyDir()
            {
             my $srcdir = $_[0];
             my $targetdir = $_[1];
             my $exc_ref_dir = $_[2];
             my $exc_ref_file = $_[3];
            
             if ( not -e $targetdir )
             {
             mkdir ($targetdir);
             }
            
             local(*SRCDIR);
            
             opendir(SRCDIR, $srcdir);
            
             my @srcfiles = readdir(SRCDIR);
             for (<@srcfiles>)
             {
             my $sfile = "$srcdir/$_";
            
             if ( -d "$sfile" )
             {
             if ( ($_ ne ".") and ($_ ne "..") )
             {
             #if ( ${$exc_ref_dir}{$_} )
             if ( $exc_ref_dir->{$_} eq $_ )
             {
             print "ignoring $_\n";
             }
             else
             {
             &copyDir("$sfile", "$targetdir/$_");
             }
             }
             }
             else
             {
             if ( $exc_ref_file->{$_} eq $_ )
             {
             print "ignoring $_\n";
             }
             else
             {
             copy("$srcdir/$_", "$targetdir/$_");
             }
             }
             }
            
             close (SRCDIR);
            }
            
            sub usage
            {
             print "$0 --jbm14inst=<jbm14 installation dir> --jboss-home=<jboss.home> --node-base=<node name> --n-node=<num of nodes> --clustered --db=<mysql>\n";
            }
            
            


            ====jbm-sample-bindings.xml ====

            <!--
             $Id: sample-bindings.xml 75719 2008-07-11 20:16:03Z clebert.suconic@jboss.com $
            
             A sample configuration for the binding service which defines different
             port configurations (ports-default, ports-01, ports-02) for running multiple
             JBoss instances in parallel on the same machine.
            
             The actual port configuration can be selected within the jboss-service.xml
             file via ServiceBindingManager attribute ServerName.
            
             The following sample e.g. selects the jboss-default port configuration
            
             <mbean code="org.jboss.services.binding.ServiceBindingManager"
             name="jboss.system:service=ServiceBindingManager">
             <attribute name="ServerName">ports-default</attribute>
             <attribute name="StoreURL">file:../server/port-bindings.xml</attribute>
             <attribute name="StoreFactoryClassName">
             org.jboss.services.binding.XMLServicesStoreFactory
             </attribute>
             </mbean>
            
             For running a second server instance you have to change the port
             bindings of that instance by specifing an alternative port binding
             configuration in the jboss-service.xml of the second server, e.g.
            
             <attribute name="ServerName">ports-01</attribute>
            
             Additional documentation for running multiple JBoss instances on the
             same machine can be found at http://www.jboss.com/products/jbossas/docs
             in the offical JBoss Application Server Guide in chapter
             "MBean Service Miscellany - Services Binding Management"
            -->
            <service-bindings>
            
             <!-- ********************************************************** -->
             <!-- * ports-default * -->
             <!-- ********************************************************** -->
             <server name="ports-default">
            
             <!-- ********************* jboss-service.xml ****************** -->
            
             <service-config name="jboss:service=Naming"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port" hostName="BindAddress">
             <attribute name="RmiPort">1098</attribute>
             </delegate-config>
             <binding port="1099" host="${jboss.bind.address}"/>
             </service-config>
            
            
             <service-config name="jboss:service=WebService"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="8083"/>
             </service-config>
            
            
             <service-config name="jboss:service=invoker,type=jrmp"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="RMIObjectPort"/>
             <binding port="4444"/>
             </service-config>
            
             <service-config name="jboss:service=invoker,type=pooled"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="ServerBindPort"/>
             <binding port="4445"/>
             </service-config>
            
            
             <!-- ********************* cluster-service.xml **************** -->
            
             <service-config name="jboss:service=HAJNDI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="Port" hostName="BindAddress">
             <attribute name="RmiPort">1101</attribute>
             </delegate-config>
             <binding port="1100" host="${jboss.bind.address}"/>
             </service-config>
            
             <service-config name="jboss:service=invoker,type=jrmpha"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="RMIObjectPort"/>
             <binding port="4444"/>
             </service-config>
            
             <service-config name="jboss:service=invoker,type=pooledha"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="ServerBindPort"/>
             <binding port="4448"/>
             </service-config>
            
             <!-- ********************* iiop-service.xml ****************** -->
            
             <service-config name="jboss:service=CorbaORB"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="3528"/>
             </service-config>
            
            
             <!-- ********************* jmx-rmi-adaptor.sar **************** -->
            
             <service-config name="jboss.jmx:type=Connector,name=RMI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="RMIObjectPort"/>
             <binding port="19001"/>
             </service-config>
            
            
             <!-- ********************* snmp-adaptor.sar ****************** -->
            
             <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="1162"/>
             </service-config>
            
             <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="1161"/>
             </service-config>
            
            
             <!-- ********************* jbossmq-service.xml **************** -->
            
             <!-- JMS related services -->
             <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="ServerBindPort"/>
             <binding port="8093"/>
             </service-config>
            
            
             <!-- ********************* jbossmq-httpil.sar **************** -->
             <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="URLPort"/>
             <binding port="8080"/>
             </service-config>
            
             <!-- ********************* hajndi-jms-ds.xml **************** -->
            
             <!-- The JMS provider loader -->
             <service-config name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <!--
             MAKE SURE java.naming.provider.url
             PORT IS SAME AS HA-JNDI ABOVE !!!
             -->
             <delegate-config>
             <attribute name="Properties"><![CDATA[
             java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
             java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
             java.naming.provider.url=${jboss.bind.address:localhost}:1100
             jnp.disableDiscovery=false
             jnp.partitionName=${jboss.partition.name:DefaultPartition}
             jnp.discoveryGroup=${jboss.partition.udpGroup:230.0.0.4}
             jnp.discoveryPort=1102
             jnp.discoveryTTL=16
             jnp.discoveryTimeout=5000
             jnp.maxRetries=1
             ]]>
             </attribute>
             </delegate-config>
             <!-- NOTE: YOU MUST ADD THIS ELEMENT, BUT THE VALUE DOESN'T MATTER
             BE SURE THE CORRECT VALUE IS IN java.naming.provider.url ABOVE -->
             <binding port="1100"/>
             </service-config>
            
             <!-- **************** http-invoker.sar & httpha-invoker.sar*************** -->
             <!-- EJBInvoker -->
             <service-config name="jboss:service=invoker,type=http"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8080"/>
             </service-config>
            
             <!-- EJB3 Remoting Connector ejb3.deployer/META-INF/jboss-service.xml -->
            
             <service-config name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config>
             <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute>
             </delegate-config>
             <binding port="3873"/>
             </service-config>
            
             <!-- JMXInvoker -->
             <service-config name="jboss:service=invoker,type=http,target=Naming"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8080"/>
             </service-config>
            
             <!-- readonly JMXInvoker -->
             <service-config name="jboss:service=invoker,type=http,target=Naming,readonly=true"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8080"/>
             </service-config>
            
             <!-- **************** httpha-invoker.sar*************** -->
             <!-- EJBInvokerHA -->
             <service-config name="jboss:service=invoker,type=httpHA"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
             </delegate-config>
             <binding port="8080"/>
             </service-config>
            
             <!-- JMXInvokerHA -->
             <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
             </delegate-config>
             <binding port="8080"/>
             </service-config>
            
            
             <!-- ********************* jboss-ws4ee.sar **************** -->
            
             <!-- Web Service related services -->
             <service-config name="jboss.ws4ee:service=AxisService"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="WebServicePort" hostName="WebServiceHost"/>
             <binding port="8080" host="${jboss.bind.address}"/>
             </service-config>
            
             <!-- ********************* remoting **************** -->
            
             <!-- *** remoting connector *** -->
             <service-config name="jboss.remoting:service=Connector,transport=socket"
             delegateClass="org.jboss.services.binding.XSLTConfigDelegate">
             <delegate-config>
             <xslt-config configName="Configuration"><![CDATA[
             <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
            
             <xsl:output method="xml" />
             <xsl:param name="port"/>
            
             <xsl:template match="/">
             <xsl:apply-templates/>
             </xsl:template>
            
             <xsl:template match="attribute[@name='serverBindPort']">
             <attribute type="java.lang.String" name="serverBindPort"><xsl:value-of select='$port'/></attribute>
             </xsl:template>
            
             <xsl:template match="*|@*">
             <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
             </xsl:copy>
             </xsl:template>
             </xsl:stylesheet>
             ]]>
             </xslt-config>
             </delegate-config>
             <binding port="4446" />
             </service-config>
            
            
             <!-- ********************* hsqldb-ds.xml ********************** -->
            
             <!-- Hypersonic related services when using the tcp/ip access
             <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
             delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
             >
             <delegate-config>
             <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
            <xsl:stylesheet
             xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
            
             <xsl:output method="xml" />
             <xsl:param name="host"/>
             <xsl:param name="port"/>
            
             <xsl:template match="/">
             <xsl:apply-templates/>
             </xsl:template>
            
             <xsl:template match="config-property[@name='ConnectionURL']">
             <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
             </xsl:template>
            
             <xsl:template match="*|@*">
             <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
             </xsl:copy>
             </xsl:template>
            </xsl:stylesheet>
            ]]>
             </xslt-config>
             </delegate-config>
             <binding host="localhost" port="1701" />
             </service-config>
            
             <service-config name="jboss:service=Hypersonic"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port" />
             <binding port="1701" />
             </service-config>
             -->
            
            
             <!-- ********************* tomcat ********************** -->
            
             <service-config name="jboss.web:service=WebServer"
             delegateClass="org.jboss.services.binding.XSLTFileDelegate"
             >
             <delegate-config>
             <xslt-config configName="ConfigFile"><![CDATA[
             <xsl:stylesheet
             xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
            
             <xsl:output method="xml" />
             <xsl:param name="port"/>
            
             <xsl:variable name="portAJP" select="$port - 71"/>
             <xsl:variable name="portHttps" select="$port + 363"/>
            
             <xsl:template match="/">
             <xsl:apply-templates/>
             </xsl:template>
            
             <xsl:template match = "Connector">
             <Connector>
             <xsl:for-each select="@*">
             <xsl:choose>
             <xsl:when test="(name() = 'port' and . = '8080')">
             <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="(name() = 'port' and . = '8009')">
             <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="(name() = 'redirectPort')">
             <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="(name() = 'port' and . = '8443')">
             <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
             <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
             </xsl:otherwise>
             </xsl:choose>
             </xsl:for-each>
             <xsl:apply-templates/>
             </Connector>
             </xsl:template>
            
             <xsl:template match="*|@*">
             <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
             </xsl:copy>
             </xsl:template>
             </xsl:stylesheet>
             ]]>
             </xslt-config>
             </delegate-config>
             <binding port="8080"/>
             </service-config>
            
             <!-- ********************* jboss messaging ********************** -->
            
             <service-config name="jboss.messaging:service=Connector,transport=bisocket"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config>
             <attribute name="Configuration"><![CDATA[
             <config>
             <invoker transport="bisocket">
             <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
             <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
             <attribute name="dataType" isParam="true">jms</attribute>
             <attribute name="socket.check_connection" isParam="true">false</attribute>
             <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
             <attribute name="serverBindPort">4457</attribute>
             <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
             <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
             <attribute name="numberOfCallRetries" isParam="true">1</attribute>
             <attribute name="pingFrequency" isParam="true">214748364</attribute>
             <attribute name="pingWindowFactor" isParam="true">10</attribute>
             <attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>
             <attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
             <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
             <attribute name="timeout" isParam="true">0</attribute>
             <attribute name="numberOfRetries" isParam="true">10</attribute>
             <attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute>
             <attribute name="callbackTimeout">10000</attribute>
             </invoker>
             <handlers>
             <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
             </handlers>
             </config>
             ]]></attribute>
             </delegate-config>
             <binding port="4457"/>
             </service-config>
            
            
             </server>
            
             <!-- ********************************************************** -->
             <!-- * ports-01 * -->
             <!-- ********************************************************** -->
             <server name="ports-01">
            
             <!-- EJB3 Remoting Connector ejb3.deployer/META-INF/jboss-service.xml -->
            
             <service-config name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config>
             <attribute name="InvokerLocator">socket://${jboss.bind.address}:3973</attribute>
             </delegate-config>
             <binding port="3973"/>
             </service-config>
            
             <!-- ********************* jboss-service.xml ****************** -->
            
             <service-config name="jboss:service=Naming"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port" hostName="BindAddress">
             <attribute name="RmiPort">1198</attribute>
             </delegate-config>
             <binding port="1199" host="${jboss.bind.address}"/>
             </service-config>
            
            
             <service-config name="jboss:service=WebService"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="8183"/>
             </service-config>
            
            
             <service-config name="jboss:service=invoker,type=jrmp"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="RMIObjectPort"/>
             <binding port="4544"/>
             </service-config>
            
            
             <service-config name="jboss:service=invoker,type=pooled"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="ServerBindPort"/>
             <binding port="4545"/>
             </service-config>
            
            
             <!-- ********************* cluster-service.xml **************** -->
            
             <service-config name="jboss:service=HAJNDI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="Port" hostName="BindAddress">
             <attribute name="RmiPort">1201</attribute>
             </delegate-config>
             <binding port="1200" host="${jboss.bind.address}"/>
             </service-config>
            
             <service-config name="jboss:service=invoker,type=jrmpha"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="RMIObjectPort"/>
             <binding port="4544"/>
             </service-config>
            
             <service-config name="jboss:service=invoker,type=pooledha"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="ServerBindPort"/>
             <binding port="4548"/>
             </service-config>
            
             <!-- ********************* iiop-service.xml ****************** -->
            
             <service-config name="jboss:service=CorbaORB"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="3628"/>
             </service-config>
            
            
             <!-- ********************* jmx-rmi-adaptor.sar **************** -->
            
             <service-config name="jboss.jmx:type=Connector,name=RMI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="RMIObjectPort"/>
             <binding port="19101"/>
             </service-config>
            
            
             <!-- ********************* snmp-adaptor.sar ****************** -->
            
             <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="1262"/>
             </service-config>
            
             <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="1261"/>
             </service-config>
            
            
             <!-- ********************* jbossmq-service.xml **************** -->
            
             <!-- JMS related services -->
             <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="ServerBindPort"/>
             <binding port="8193"/>
             </service-config>
            
            
             <!-- ********************* jbossmq-httpil.sar **************** -->
             <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="URLPort"/>
             <binding port="8180"/>
             </service-config>
            
             <!-- ********************* hajndi-jms-ds.xml **************** -->
            
             <!-- The JMS provider loader -->
             <service-config name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <!--
             MAKE SURE java.naming.provider.url
             PORT IS SAME AS HA-JNDI ABOVE !!!
             -->
             <delegate-config>
             <attribute name="Properties"><![CDATA[
             java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
             java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
             java.naming.provider.url=${jboss.bind.address:localhost}:1200
             jnp.disableDiscovery=false
             jnp.partitionName=${jboss.partition.name:DefaultPartition}
             jnp.discoveryGroup=${jboss.partition.udpGroup:230.0.0.4}
             jnp.discoveryPort=1102
             jnp.discoveryTTL=16
             jnp.discoveryTimeout=5000
             jnp.maxRetries=1
             ]]>
             </attribute>
             </delegate-config>
             <!-- NOTE: YOU MUST ADD THIS ELEMENT, BUT THE VALUE DOESN'T MATTER
             BE SURE THE CORRECT VALUE IS IN java.naming.provider.url ABOVE -->
             <binding port="1200"/>
             </service-config>
            
             <!-- **************** http-invoker.sar & httpha-invoker.sar*************** -->
             <!-- EJBInvoker -->
             <service-config name="jboss:service=invoker,type=http"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8180"/>
             </service-config>
            
             <!-- JMXInvoker -->
             <service-config name="jboss:service=invoker,type=http,target=Naming"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8180"/>
             </service-config>
            
             <!-- readonly JMXInvoker -->
             <service-config name="jboss:service=invoker,type=http,target=Naming,readonly=true"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8180"/>
             </service-config>
            
             <!-- **************** httpha-invoker.sar*************** -->
             <!-- EJBInvokerHA -->
             <service-config name="jboss:service=invoker,type=httpHA"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
             </delegate-config>
             <binding port="8180"/>
             </service-config>
            
             <!-- JMXInvokerHA -->
             <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
             </delegate-config>
             <binding port="8180"/>
             </service-config>
            
            
            
            
             <!-- ********************* jboss-ws4ee.sar **************** -->
            
             <!-- Web Service related services -->
             <service-config name="jboss.ws4ee:service=AxisService"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="WebServicePort" hostName="WebServiceHost"/>
             <binding port="8180" host="${jboss.bind.address}"/>
             </service-config>
            
             <!-- ********************* remoting **************** -->
            
             <!-- *** remoting connector *** -->
             <service-config name="jboss.remoting:service=Connector,transport=socket"
             delegateClass="org.jboss.services.binding.XSLTConfigDelegate">
             <delegate-config>
             <xslt-config configName="Configuration"><![CDATA[
             <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
            
             <xsl:output method="xml" />
             <xsl:param name="port"/>
            
             <xsl:template match="/">
             <xsl:apply-templates/>
             </xsl:template>
            
             <xsl:template match="attribute[@name='serverBindPort']">
             <attribute type="java.lang.String" name="serverBindPort"><xsl:value-of select='$port'/></attribute>
             </xsl:template>
            
             <xsl:template match="*|@*">
             <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
             </xsl:copy>
             </xsl:template>
             </xsl:stylesheet>
             ]]>
             </xslt-config>
             </delegate-config>
             <binding port="5446" />
             </service-config>
            
             <!-- ********************* hsqldb-ds.xml ********************** -->
            
             <!-- Hypersonic related services
            
             Only if using TCP setup (local file setup by default)
            
             <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
             delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
             >
             <delegate-config>
             <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
            <xsl:stylesheet
             xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
            
             <xsl:output method="xml" />
             <xsl:param name="host"/>
             <xsl:param name="port"/>
            
             <xsl:template match="/">
             <xsl:apply-templates/>
             </xsl:template>
            
             <xsl:template match="config-property[@name='ConnectionURL']">
             <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
             </xsl:template>
            
             <xsl:template match="*|@*">
             <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
             </xsl:copy>
             </xsl:template>
            </xsl:stylesheet>
            ]]>
             </xslt-config>
             </delegate-config>
             <binding host="localhost" port="1801" />
             </service-config>
            
             <service-config name="jboss:service=Hypersonic"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port" />
             <binding port="1801" />
             </service-config>
            
             -->
            
            
             <!-- ********************* tomcat ********************** -->
            
             <service-config name="jboss.web:service=WebServer"
             delegateClass="org.jboss.services.binding.XSLTFileDelegate"
             >
             <delegate-config>
             <xslt-config configName="ConfigFile"><![CDATA[
             <xsl:stylesheet
             xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
            
             <xsl:output method="xml" />
             <xsl:param name="port"/>
            
             <xsl:variable name="portAJP" select="$port - 71"/>
             <xsl:variable name="portHttps" select="$port + 363"/>
            
             <xsl:template match="/">
             <xsl:apply-templates/>
             </xsl:template>
            
             <xsl:template match = "Connector">
             <Connector>
             <xsl:for-each select="@*">
             <xsl:choose>
             <xsl:when test="(name() = 'port' and . = '8080')">
             <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="(name() = 'port' and . = '8009')">
             <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="(name() = 'redirectPort')">
             <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="(name() = 'port' and . = '8443')">
             <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
             <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
             </xsl:otherwise>
             </xsl:choose>
             </xsl:for-each>
             <xsl:apply-templates/>
             </Connector>
             </xsl:template>
            
             <xsl:template match="*|@*">
             <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
             </xsl:copy>
             </xsl:template>
             </xsl:stylesheet>
             ]]>
             </xslt-config>
             </delegate-config>
             <binding port="8180"/>
             </service-config>
            
             <!-- ********************* jboss messaging ********************** -->
            
             <service-config name="jboss.messaging:service=Connector,transport=bisocket"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config>
             <attribute name="Configuration"><![CDATA[
             <config>
             <invoker transport="bisocket">
            
             <!-- There should be no reason to change these parameters - warning!
             Changing them may stop JBoss Messaging working correctly -->
             <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
             <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
             <attribute name="dataType" isParam="true">jms</attribute>
             <attribute name="socket.check_connection" isParam="true">false</attribute>
             <attribute name="timeout" isParam="true">0</attribute>
             <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
             <attribute name="serverBindPort">4557</attribute>
             <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
             <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
             <attribute name="numberOfCallRetries" isParam="true">1</attribute>
             <attribute name="pingFrequency" isParam="true">214748364</attribute>
             <attribute name="pingWindowFactor" isParam="true">10</attribute>
             <attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>
             <!-- End immutable parameters -->
            
             <!-- Periodicity of client pings. Server window by default is twice this figure -->
             <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
            
             <!-- Number of seconds to wait for a connection in the client pool to become free -->
             <attribute name="numberOfRetries" isParam="true">10</attribute>
            
             <!-- Max Number of connections in client pool. This should be significantly higher than
             the max number of sessions/consumers you expect -->
             <attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute>
            
             <!-- Use these parameters to specify values for binding and connecting control connections to
             work with your firewall/NAT configuration
             <attribute name="secondaryBindPort">xyz</attribute>
             <attribute name="secondaryConnectPort">abc</attribute>
             -->
            
             </invoker>
             <handlers>
             <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
             </handlers>
             </config>
             ]]></attribute>
             </delegate-config>
             <binding port="4557"/>
             </service-config>
            
            
             </server>
            
             <!-- ********************************************************** -->
             <!-- * ports-02 * -->
             <!-- ********************************************************** -->
             <server name="ports-02">
            
             <!-- EJB3 Remoting Connector ejb3.deployer/META-INF/jboss-service.xml -->
            
             <service-config name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config>
             <attribute name="InvokerLocator">socket://${jboss.bind.address}:4073</attribute>
             </delegate-config>
             <binding port="4073"/>
             </service-config>
            
             <!-- ********************* jboss-service.xml ****************** -->
            
             <service-config name="jboss:service=Naming"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port" hostName="BindAddress">
             <attribute name="RmiPort">1298</attribute>
             </delegate-config>
             <binding port="1299" host="${jboss.bind.address}"/>
             </service-config>
            
            
             <service-config name="jboss:service=WebService"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="8283"/>
             </service-config>
            
            
             <service-config name="jboss:service=invoker,type=jrmp"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="RMIObjectPort"/>
             <binding port="4644"/>
             </service-config>
            
            
             <service-config name="jboss:service=invoker,type=pooled"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="ServerBindPort"/>
             <binding port="4645"/>
             </service-config>
            
            
             <!-- ********************* cluster-service.xml **************** -->
            
             <service-config name="jboss:service=HAJNDI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="Port" hostName="BindAddress">
             <attribute name="RmiPort">1301</attribute>
             </delegate-config>
             <binding port="1300" host="${jboss.bind.address}"/>
             </service-config>
            
             <service-config name="jboss:service=invoker,type=jrmpha"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="RMIObjectPort"/>
             <binding port="4644"/>
             </service-config>
            
             <service-config name="jboss:service=invoker,type=pooledha"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <delegate-config portName="ServerBindPort"/>
             <binding port="4648"/>
             </service-config>
            
             <!-- ********************* iiop-service.xml ****************** -->
            
             <service-config name="jboss:service=CorbaORB"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="3728"/>
             </service-config>
            
            
             <!-- ********************* jmx-rmi-adaptor.sar **************** -->
            
             <service-config name="jboss.jmx:type=Connector,name=RMI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="RMIObjectPort"/>
             <binding port="19201"/>
             </service-config>
            
            
             <!-- ********************* snmp-adaptor.sar ****************** -->
            
             <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="1362"/>
             </service-config>
            
             <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="Port"/>
             <binding port="1361"/>
             </service-config>
            
            
             <!-- ********************* jbossmq-service.xml **************** -->
            
             <!-- JMS related services -->
             <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="ServerBindPort"/>
             <binding port="8293"/>
             </service-config>
            
            
             <!-- ********************* jbossmq-httpil.sar **************** -->
             <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="URLPort"/>
             <binding port="8280"/>
             </service-config>
            
             <!-- ********************* hajndi-jms-ds.xml **************** -->
            
             <!-- The JMS provider loader -->
             <service-config name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
             <!--
             MAKE SURE java.naming.provider.url
             PORT IS SAME AS HA-JNDI ABOVE !!!
             -->
             <delegate-config>
             <attribute name="Properties"><![CDATA[
             java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
             java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
             java.naming.provider.url=${jboss.bind.address:localhost}:1300
             jnp.disableDiscovery=false
             jnp.partitionName=${jboss.partition.name:DefaultPartition}
             jnp.discoveryGroup=${jboss.partition.udpGroup:230.0.0.4}
             jnp.discoveryPort=1102
             jnp.discoveryTTL=16
             jnp.discoveryTimeout=5000
             jnp.maxRetries=1
             ]]>
             </attribute>
             </delegate-config>
             <!-- NOTE: YOU MUST ADD THIS ELEMENT, BUT THE VALUE DOESN'T MATTER
             BE SURE THE CORRECT VALUE IS IN java.naming.provider.url ABOVE -->
             <binding port="1300"/>
             </service-config>
            
             <!-- **************** http-invoker.sar & httpha-invoker.sar*************** -->
             <!-- EJBInvoker -->
             <service-config name="jboss:service=invoker,type=http"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8280"/>
             </service-config>
            
             <!-- JMXInvoker -->
             <service-config name="jboss:service=invoker,type=http,target=Naming"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8280"/>
             </service-config>
            
             <!-- readonly JMXInvoker -->
             <service-config name="jboss:service=invoker,type=http,target=Naming,readonly=true"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
             </delegate-config>
             <!--
             MUST BE THE SAME AS
             TOMCAT HTTP CONNECTOR BELOW !!!
             -->
             <binding port="8280"/>
             </service-config>
            
             <!-- **************** httpha-invoker.sar*************** -->
             <!-- EJBInvokerHA -->
             <service-config name="jboss:service=invoker,type=httpHA"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
             </delegate-config>
             <binding port="8280"/>
             </service-config>
            
             <!-- JMXInvokerHA -->
             <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config>
             <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
             </delegate-config>
             <binding port="8280"/>
             </service-config>
            
            
            
            
             <!-- ********************* jboss-ws4ee.sar **************** -->
            
             <!-- Web Service related services -->
             <service-config name="jboss.ws4ee:service=AxisService"
             delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
             >
             <delegate-config portName="WebServicePort" hostName="WebServiceHost"/>
             <binding port="8280" host="${jboss.bind.address}"/>
             </service-config>
            
             <!-- ********************* remoting **************** -->
            
             <!-- *** remoting connector *** -->
             <service-config name="jboss.remoting:service=Connector,transport=socket"
             delegateClass="org.jboss.services.binding.XSLTConfigDelegate">
             <delegate-config>
             <xslt-config configName="Configuration"><![CDATA[
             <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
            
             <xsl:output method="xml" />
             <xsl:param name="port"/>
            
             <xsl:template match="/">
             <xsl:apply-templates/>
             </xsl:template>
            
             <xsl:template match="attribute[@name='serverBindPort']">
             <attribute type="java.lang.String" name="serverBindPort"><xsl:value-of select='$port'/></attribute>
             </xsl:template>
            
             <xsl:template match="*|@*">
             <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
             </xsl:copy>
             </xsl:template>
             </xsl:stylesheet>
             ]]>
             </xslt-config>
             </delegate-config>
             <binding port="6446" />
             </service-config>
            
            
             <!-- ********************* hsqldb-ds.xml ********************** -->
            
             <!-- Hypersonic related services
            
             Only if using TCP setup (local file setup by default)