我的 10_channel_jpos.xml 中有一个通道配置,我希望能够从属性文件中获取 ip 和端口并从我的代码中设置它,因为这些值可能会改变
<channel-adaptor
name="mybank-channel-adaptor-pri"
class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel name="ServerA-Channel" class="org.jpos.iso.channel.NACChannel"
logger="Q2" realm="ServerA-Channel"
packager="org.jpos.iso.packager.ISO87APackager">
<property name="timeout" value="3600000"/>
<property name="host" value="${myBankHostPrimary}"/>
<property name="port" value="${myBankPortPrimary}"/>
<property name="packager-config" value="cfg/base1.xml" />
<property name="keep-alive" value="true" />
</channel>
<in>from-mybank-pri</in>
<out>to-mybank-pri</out>
<reconnect-delay>5000</reconnect-delay>
</channel-adaptor>
和一个属性文件
###### GENERAL INFO
NODE = NODE001
###### Environment
env=DEV
###### Ports we listens to
server_listen_port = 9999
###### Target host information
myBankHostPrimary=127.0.0.1
myBankPortPrimary=8001
###### DEBUG STUFF
debugParticipant=true
和一个主要课程
public static void main (String[] args) throws Exception {
ChannelAdaptor channel= (ChannelAdaptor) NameRegistrar.get ("mybank-channel-adaptor-pri");
channel.setHost = "127.0.0.1"; // Value gotten from the property file
System.out.println(channel.getHost());
}
请问如何设置属性主机值和端口值?
我的文件夹结构是
bin
.....bsh
.....q2.bat
.....start.bat
.....stop
build
......META-INF
.......org
.......jpos
........config
......Q2-decorator.property
.....cfg
.....config.properties (my property file)