<?xml version="1.0"?>
<!DOCTYPE configuration SYSTEM "dtd/Configuration.dtd">
<configuration name="Tasks" version="1.0">
  <package name="com.sap.sdt.tools" version="1.0"/>

  <task name="READ_SYSTEM_PROPERTIES" type="detect">

	<!-- Warning: when reading the profiles of remote instances, any file paths might be invalid on the local host -->
	
    <!-- Read data in SCS instance profile -->
    <readProfile type="ProfileReader">
      <param name="file" value="$(/J2EE/StandardSystem/ServiceInstance/InstanceProfilePath)" />
    
      <get path="INSTANCE_NAME" varname="/J2EE/StandardSystem/ServiceInstance/ServiceInstanceName"/>
      <get path="SAPSYSTEM" varname="/J2EE/StandardSystem/ServiceInstance/ServiceInstanceID"/>
      <get path="DIR_GLOBAL" varname="/J2EE/StandardSystem/CentralInstance/GlobalDirectory"/>
      <get path="rdisp/msserv_internal" varname="/J2EE/StandardSystem/ServiceInstance/MessagePort"/>
      <get path="j2ee/ms/host" varname="/J2EE/StandardSystem/ServiceInstance/MessageHost"/>
      <get path="enque/encni/port" varname="/J2EE/StandardSystem/ServiceInstance/EnqueuePort"/>
      <get path="DIR_EXECUTABLE" varname="/J2EE/StandardSystem/ServiceInstance/ExecutableDirectory"/>
      <get path="DIR_CT_RUN" varname="/J2EE/StandardSystem/ServiceInstance/CTRunDirectory"/>
    </readProfile>

    <!-- Read data in Central Instance profile -->
    <readProfile type="ProfileReader">
      <param name="file" value="$(/J2EE/StandardSystem/CentralInstance/InstanceProfilePath)" />

      <get path="secstorefs/keyfile" varname="/J2EE/StandardSystem/J2EEEngineSCS/KeyFile"/>
      <get path="secstorefs/secfile" varname="/J2EE/StandardSystem/J2EEEngineSCS/SecFile"/>
      <get path="secstorefs/DIR_LIB" varname="/J2EE/StandardSystem/J2EEEngineSCS/LibDir"/>
      <get path="j2ee/dbname" varname="/J2EE/DBSystem/DBName"/>
      <get path="j2ee/dbtype" varname="/J2EE/DBSystem/DBTypeForSAP"/>
      <get path="j2ee/dbhost" varname="/J2EE/DBSystem/SystemHome"/>
      <get path="j2ee/dbdriver" varname="/J2EE/DBSystem/JDBCDriverClasspath"/>
      <get path="DIR_EPS_ROOT" varname="/EpsRootDirectory"/>
    </readProfile>

    <!-- Read data in Java Instance profiles -->
    <for-each variable="/J2EE/StandardSystem/Instances" into="Instance">
      <readProfile type="ProfileReader">
        <param name="file" value="$(Instance@InstanceProfilePath)" />
      
        <get path="DIR_EXECUTABLE" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/ExecutableDirectory"/>
        <get path="DIR_CT_RUN" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/CTRunDirectory"/>
        <get path="INSTANCE_NAME" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/InstanceName"/>
        <get path="SAPSYSTEM" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/InstanceID"/>
        <get path="DIR_PROFILE" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/ProfileDirectory"/>
        <get path="DIR_GLOBAL" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/GlobalDirectory"/>
        <get path="INSTANCE_NAME" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/InstanceName"/>
        <get path="DIR_SAPJVM" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/SapJvmDirectory"/>
        <get path="DIR_CT_SAPJVM" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/SapJvmCentralDirectory" mandatory="false"/>
        <get path="SAPJVM_VERSION" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/SapJvmVersion" mandatory="false"/>
        <get path="j2ee/instance_id" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/InstancePrefix"/>
        <get path="jstartup/vm/home" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/JDKHomeDirectory"/>

        <get path="icm/server_port_0" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_1" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_2" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_3" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_4" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_5" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_6" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_7" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_8" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
        <get path="icm/server_port_9" varname="/J2EE/StandardSystem/Instances[$(Instance@INDEX)]/DispatcherNode/ServerPort" mandatory="false"/>
      </readProfile>
    </for-each>
    
  </task>

</configuration>
