- iWay Service Manager;
- batchFile.bat to apply managed server specific options; [such as library selection, JVM options]
- configData.Properties to store managed server options for use by batchFile.bat
Assumptions:
- Ability to handle iWayXX batch file safely;
- Ability to handle ‘configData.properties’ file correctly;
This is a batch script fashioned
solution, designed to apply managed server specific options to meet situation
where every managed server in an iSM is expected to use libraries that are not
same. To use this solution, follow the steps as described without change.
Step-1:
Prepare library folder layout
Create a directory within
folder to name it ‘customLibs’. There may be several
sub-folders to it. Place the libraries as required accordingly.
Step-2:
Prepare configData.properties file
Prepare managed server specific
information and populate the cofigData.properties file. The file is allowed to
have any number of items which is expected to contain a key, which is the name
of the property, and a value, which is the option to be applied for that key.
In our example, it is the location of a jar file specific to a managed server.
A sample file will look like what is seen in the screen below:
configData.Properties |
Step-3: Modify
iWayXX.cmd file
Locate
the file named ‘iWayXX.cmd’, where XX is the version of the iSM in place, to
back it up. Open the file to add the following section of code right after the
section where IWAYXX [example for iSM version 6.1.X is IWAY61] variable is
defined:
@rem
================================================
@rem Start of setting Managed Server
Specific Options
@rem
================================================
@call %IWAY61%batchFile.bat %1 %IWAY61%
@set customPath=%IWAY61%%returnValue%
@rem
================================================
@rem End of setting Managed Server
Specific Options
@rem
================================================
This
section of code in the batch script will extract the managed server options
from the configData.properties that we defined previously.
Now
that we have the values needed for application during start-up of a managed
server, let’s set it up as described below:
Identify
local class path definition, which is by looking for a string ‘@set lcp’ and
add the following command to its definition:
;%customPath%
Sample
iWayXX.cmd file before modification:
@rem
================================================
@rem run it
@rem
================================================
@setlocal
@rem special stuff for jacorb ****
@if exist %IWAY61%lib\jacorb.jar set
remdbg= -Xbootclasspath/p:%IWAY61%lib\jacorb.jar %remdbg%
@set
lcp=%IWAY61%config\%1\lib\*;%IWAY61%lib\*;%IWAY61%etc\manager\extensions\*;%IWAY61%etc\manager\console\*;%IWAY61%etc\manager\transformations\custom_functions\*;%IWAY61%etc\manager\transformations\custom_functions\*;%lcp%
Sample
iWayXX.cmd file after modification:
@rem
================================================
@rem Start of setting Managed Server Specific
Options
@rem
================================================
@call %IWAY61%batchFile.bat %1 %IWAY61%
@set customPath=%IWAY61%%returnValue%
@rem
================================================
@rem End of setting Managed Server Specific
Options
@rem
================================================
@rem
================================================
@rem run it
@rem
================================================
@setlocal
@rem special stuff for jacorb ****
@if exist %IWAY61%lib\jacorb.jar set
remdbg= -Xbootclasspath/p:%IWAY61%lib\jacorb.jar %remdbg%
@set
lcp=%IWAY61%config\%1\lib\*;%IWAY61%lib\*;%IWAY61%etc\manager\extensions\*;%IWAY61%etc\manager\console\*;%IWAY61%etc\manager\transformations\custom_functions\*;%IWAY61%etc\manager\transformations\custom_functions\*;%lcp%;%customPath%
Step-4:
Start-up the server to verify whether or not the applied custom settings have taken effect. This can be done by launching iSM Web Console->Server->Java Properties and search for the jar file name or any other JVM options that were set.
Start-up the server to verify whether or not the applied custom settings have taken effect. This can be done by launching iSM Web Console->Server->Java Properties and search for the jar file name or any other JVM options that were set.
Sample:
batchFile.bat
@echo
off
@rem
setlocal
@FOR
/F "tokens=1,2 delims=#" %%G IN (%2\configData.Properties) DO ( if
%%G==%1 set returnValue=%%H)
call:rightTrim
%returnValue%
exit
/b %returnValue%
@rem
endlocal
:rightTrim
SETLOCAL
ENABLEDELAYEDEXPANSION
@for
/l %%a in (1,1,31) do if "!returnValue:~-1!"==" " set
returnValue=!returnValue:~0,-1!
ENDLOCAL
goto:eof
Isn’t that
easy? Good luck!