简体   繁体   中英

How to load a properties file into JBOSS 7 in domain mode

We did our early development in standalone mode where a property file could be included on the command line.

Now we are working on deployment and the server will be in domain mode, but the handy command line property doesn't do the trick any more.

I see that properties can be loaded with jboss-cli or placed in domain.xml, but those both have different forms than a standard properties file. I don't want to change the file because other programs use the same file.

Am I overlooking something?

Perl was my friend

#!/usr/bin/perl

# this perl script takes a standard property file and makes a jboss cli file to load properties

$machine = $ENV{'PHYSICAL_MACHINE'};

print "connect $ENV{'TARGET_HOSTNAME'}.domain.com\n";

while (<>)
{
 my($line) = $_;

chomp($line);
#remove DOS line endings
chop($line) if ($line =~ m/\r$/);

# skip commented lines
next if ( $line =~ /^#/);

if($line)
{ 
    my(@parts) = split /=/, $line;

    $propName=@parts[0];
    $propval=@parts[1];

    print "\nif (outcome != success) of /host=$machine/server-config=XXX-server/system-property=$propName:read-resource\n";
    print "    /host=$machine/server-config=XXX-server/system-property=$propName:add(value=$propval)\n";
    print "else\n";
    print "    /host=$machine/server-config=XXX-server/system-property=$propName:write-attribute(name=value, value=$propval)\n";
    print "end-if\n";
}
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM