Question : Configuring a shared library for an application using Scripting (bat file)

Hi guys pls see this script providided by IBM for silent deplyoying.

I am want to edit it so that i can apply/configure an existing shared Library to the current deployed EAR application.  Can you please help. Completely new to this!!

I have seen examples like this:
set library [$AdminConfig getid /Library:mySharedLibrary/]
but dont know how to apply it to this script...

Thanks in advance..


@setlocal
@set DEPLOY_DIR=%~dp0
@set APP_NAME=AdderEAR
@set APP_EAR=%APP_NAME%.ear
@set APP_CONTEXT=EximBillWeb/SYS_index.htm

@rem ########################## SETUP: Admin+Target Servers #####################################
@rem ### my Target *local v5* Base Server (local 'WAS50')setup:
set WSADMIN_BIN=E:\Program Files\WebSphere\AppServer\bin
set ADMINHOST=localhost
set ADMINSOAP=8881
set SERVERNODE=localhost
set SERVERNAME=server2
set SERVERHOST=%ADMINHOST%
set SERVERPORT=9081




@rem ############################# cd wsadmin ########################################
@echo.
@set PARAM=%1
@if $%PARAM%$==$install$   goto wsadmin
@if $%PARAM%$==$uninstall$ goto wsadmin
@echo "ERROR: missing or invalid commandline parameter, must be: 'install' or 'uninstall'
@goto done

:wsadmin
@if not exist "%WSADMIN_BIN%\wsadmin*" echo ERROR: incorrect WSADMIN_BIN=%WSADMIN_BIN%, edit this TestDeployBase.bat and correct this envar
@if not exist "%WSADMIN_BIN%\wsadmin*" goto done
@cd /D %WSADMIN_BIN%
@copy /y "%DEPLOY_DIR%\dist\%APP_EAR%" %APP_EAR%

@set CONN=-conntype SOAP -host %ADMINHOST% -port %ADMINSOAP%
@if $%2$==$bypass$   goto adminType


@REM ################## Check ADMIN and TARGET Servers #######################
:adminState
@echo.
@echo CHECK SERVER...
@set CMD=$AdminControl getAttribute [$AdminControl queryNames node=[$AdminControl getNode],type=Server,*] state
call wsadmin %CONN% -c "%CMD%" -lang jacl > TestDeployBaseTemp
@sort TestDeployBaseTemp /O TestDeployBaseTemp
@set /P Admin_Server_State=ployBaseTemp
@echo.
@echo Check: Admin serverState must be "STARTED":
@echo Admin_Server_State: %Admin_Server_State%
@if $%Admin_Server_State%$==$STARTED$   goto adminType
echo ERROR: Admin_Server_State=%Admin_Server_State%
goto done

:adminType
@echo.
@set CMD=$AdminControl getAttribute [$AdminControl queryNames node=[$AdminControl getNode],type=Server,*] processType
call wsadmin %CONN% -c "%CMD%" -lang jacl > TestDeployBaseTemp
@sort TestDeployBaseTemp /O TestDeployBaseTemp
@set /P Admin_Server_Type=loyBaseTemp
@echo.
@echo Check: Admin processType must be "UnManagedProcess" or "DeploymentManager":
@echo Admin_Server_Type: %Admin_Server_Type%
@if $%Admin_Server_Type%$==$UnManagedProcess$   goto targetState
@if $%Admin_Server_Type%$==$DeploymentManager$  goto targetState
echo ERROR: Admin_Server_type=%Admin_Server_Type%
goto done

:targetState
@if $%2$==$bypass$   goto begin
@echo.
@set CONN=-conntype SOAP -host %ADMINHOST% -port %ADMINSOAP%
@set CMD=$AdminControl getAttribute [$AdminControl queryNames node=%SERVERNODE%,process=%SERVERNAME%,type=Server,*] state
call wsadmin %CONN% -c "%CMD%" -lang jacl > TestDeployBaseTemp
@sort TestDeployBaseTemp /O TestDeployBaseTemp
@set /P Target_Server_State=eployBaseTemp
@echo.
@echo Check: Target (either Local or Remote) serverState must be "STARTED":
@echo Target_Server_State: %Target_Server_State%
@if $%Target_Server_State%$==$STARTED$   goto targetType
echo ERROR: Target_Server_State=%Target_Server_State%
goto done

:targetType
@echo.
@set CMD=$AdminControl getAttribute [$AdminControl queryNames node=%SERVERNODE%,process=%SERVERNAME%,type=Server,*] processType
call wsadmin %CONN% -c "%CMD%" -lang jacl > TestDeployBaseTemp
@sort TestDeployBaseTemp /O TestDeployBaseTemp
@set /P Target_Server_Type=ployBaseTemp
@echo.
@echo Check: Target (either Local or Remote) processType must be "UnManagedProcess" or "ManagedProcess":
@echo Target_Server_Type: %Target_Server_Type%
@if $%Target_Server_Type%$==$UnManagedProcess$   goto begin
@if $%Target_Server_Type%$==$ManagedProcess$     goto begin
echo ERROR: Target_Server_type=%Target_Server_Type%
@echo.
goto done


@REM ################## begin #######################
:begin
@echo.
@echo LIST APPs...
@set CMD_OPTIONS=-verbose -node %SERVERNODE -server %SERVERNAME%
set CMD=$AdminApp list {%CMD_OPTIONS%}
call wsadmin %CONN% -c "%CMD%" -lang jacl

@echo.
@set PARAM=%1
@if $%PARAM%$==$install$   goto InstallStart
@if $%PARAM%$==$uninstall$ goto StopUninstall
@echo "ERROR: missing or invalid commandline parameter, must be: 'install' or 'uninstall'
@goto done


@REM ################## InstallStart #######################
:InstallStart
@echo.
@echo INSTALL APP...
@set CMD_OPTIONS=-verbose -node %SERVERNODE% -server %SERVERNAME% -distributeApp -nodeployejb
@set CMD=$AdminApp install %APP_EAR% {%CMD_OPTIONS%}
call wsadmin %CONN% -c "%CMD%" -lang jacl

@echo SAVE CONFIG...
@set library  =$AdminConfig getid/Library:/ce_shared_lib
call wsadmin %CONN% -c "%library %" -lang jacl
@set CMD=$AdminConfig save
call wsadmin %CONN% -c "%CMD%" -lang jacl

@echo LIST APPs...
@set CMD_OPTIONS=-verbose -node %SERVERNODE -server %SERVERNAME%
@set CMD=$AdminApp list {%CMD_OPTIONS%}
call wsadmin %CONN% -c "%CMD%" -lang jacl




@REM ###### Non-Base (Managed) Servers need NodeSync to distribute/install application
@echo.
@if $%Admin_Server_Type%$==$UnManagedProcess$   @echo Note: BaseServers do not need Dmgr NodeSync to distribute/install application into server.
@if $%Admin_Server_Type%$==$UnManagedProcess$   @goto StartApp
@echo SYNC NODE...   (Target Server is a Managed Server, *NOT* a Base Server)
@set CMD=$AdminControl invoke [$AdminControl completeObjectName type=NodeSync,node=%SERVERNODE%,*] sync
call wsadmin %CONN% -c "%CMD%" -lang jacl




:StartApp
@echo.
@echo START APP...
@set CMD=$AdminControl invoke [$AdminControl queryNames type=ApplicationManager,node=%SERVERNODE%,process=%SERVERNAME%,*] startApplication %APP_NAME%
call wsadmin %CONN% -c "%CMD%" -lang jacl

@echo Apllied shared lib
@set library=$AdminConfig getid /Library:ee_shared_lib/
@echo %library%

@echo.
@echo BROWSE APP...
call EXPLORER.EXE http://%SERVERHOST%:%SERVERPORT%/%APP_CONTEXT%

@goto done


@REM ################## StopUninstall #######################
:StopUninstall
@echo.
@set library [$AdminConfig getid /Library:ee_shared_lib/]
@echo %library%
@echo STOP APP...
@set CMD=$AdminControl invoke [$AdminControl queryNames type=ApplicationManager,node=%SERVERNODE%,process=%SERVERNAME%,*] stopApplication %APP_NAME%
call wsadmin %CONN% -c "%CMD%" -lang jacl

@echo UNINSTALL APP...
@set CMD=$AdminApp uninstall %APP_NAME%
call wsadmin %CONN% -c "%CMD%" -lang jacl

@echo SAVE CONFIG...
@set CMD=$AdminConfig save
call wsadmin %CONN% -c "%CMD%" -lang jacl

@echo LIST APPs...
@set CMD_OPTIONS=-verbose -node %SERVERNODE -server %SERVERNAME%
@set CMD=$AdminApp list {%CMD_OPTIONS%}
call wsadmin %CONN% -c "%CMD%" -lang jacl


@REM ################## Done #######################
:done
@if exist TestDeployBaseTemp del TestDeployBaseTemp
@if exist %APP_EAR% del %APP_EAR%
@cd /D "%DEPLOY_DIR%"
@echo.
@echo TestDeployBase DONE.
@echo.



Answer : Configuring a shared library for an application using Scripting (bat file)

Hi,

You can look at here and follow the instructions..

http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1//index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/rxml_applibrary.html
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/txml_applibrary.html

http://skywayradio.com/tech/WAS51/wsadmin_sharedlib.html
http://www.skywayradio.com/tech/WAS60/ND/Configure_a_shared_library_for_an_application_using_scripting.html

R.K
Random Solutions  
 
programming4us programming4us