CentraSite 10.7 | CentraSite User’s Guide | Policy Management | Configuring Email Notifications | Using Email Templates with Policy Actions | Managing Email Templates through Java Class | Script File for EmailTemplateManager Utility
 
Script File for EmailTemplateManager Utility
The EmailTemplateManager is a Java class whose main() method executes when you execute the EmailTemplateManager from the command line. To ensure that the CLASSPATH and other environment variables are set properly when you execute this utility, you must create a script file that calls the EmailTemplateManager as described below.
Creating the EmailTemplateManager Script File for Windows (Batch file)
Create a script file that looks as follows if CentraSite is running under Windows.
@echo off
set JAVAEXE=fullPathToJava.exeset REDIST=CentraSiteHomeDirectory\redist
set BASEDIR=%~dp0
cd /d %REDIST%
 
REM build CLASSPATH with all files from jar directory
set LOCAL_CLASSPATH=
for %%I in (".\*.jar") do call
  "CentraSiteHomeDirectory\bin\cfg\lcp.cmd" %%I
%JAVAEXE% -cp %LOCAL_CLASSPATH% com.centrasite.util.EmailTemplateManager %*
cd /d %BASEDIR%
Example:
@echo off
REM
REM Run Email Template Manager Utility
REM
set JAVAEXE=D:\software\java\jdk1.5.0_12\bin\java
set REDIST=C:\SoftwareAG\CentraSite\redist
set BASEDIR=%~dp0
cd /d %REDIST%
REM build CLASSPATH with all files from jar directory
set LOCAL_CLASSPATH=
for %%I in (".\*.jar") do call "C:\SoftwareAG\CentraSite\bin\cfg\lcp.cmd" %%I
%JAVAEXE% -cp %LOCAL_CLASSPATH% com.centrasite.util.EmailTemplateManager %*
cd /d %BASEDIR%
Creating the EmailTemplateManager Script File for Unix (C-shell script)
Create a script file that looks as follows if CentraSite is running under Unix.
set javaexe="fullPathToJava.exe"
set redist="fullPathToJava.exe/redist"
set mainjar="CentraSiteUtils.jar"
set delim='\:'
cd "$redist"
set cl=""
foreach j ( `ls *.jar` )
if ($cl != "") set cl=${cl}${delim}
set cl=${cl}${j}
end
setenv CLASSPATH ${mainjar}${delim}${cl}
$javaexe com.centrasite.util.EmailTemplateManager $*
Example:
#!/bin/csh
#
# Run Email Template Manager Utility
#
set javaexe="/.../softwareag/cjp/v16/bin/java"
set redist="/.../softwareag/CentraSite/redist"
set mainjar="CentraSiteUtils.jar"
set delim='\:'
# build CLASSPATH with all files from jar directory
cd "$redist"
set cl=""
foreach j ( `ls *.jar` )
if ($cl != "") set cl=${cl}${delim}
set cl=${cl}${j}
end
setenv CLASSPATH ${mainjar}${delim}${cl}
$javaexe com.centrasite.util.EmailTemplateManager $*
Executing the EmailTemplateManager Script File
To run the EmailTemplateManager, execute your script file on the machine where CentraSite is installed.
Note:
CentraSite must be running when you execute the script file.
When you execute your script file, you must include input parameters on the command line to specify what you want the EmailTemplateManager to do. You must also include parameters to specify your CentraSite user ID and password. For example, to delete a template from the directory, you would run your script as follows:
yourScriptFile -delete templateName -dbuser yourCSUserID -dbpassword yourPassword
Example:
myScript -delete myEmailTemplate.html -dbuser jcallen -dbpassword j45Hk19a
The EmailTemplateManager utility assumes that the CentraSite registry/repository is running at http://localhost:53307 (that is, it assumes that it is installed on the same machine as the EmailTemplateManager utility). If you installed the registry/repository component on a different machine than the CentraSite Application Server Tier (CAST) or if you configured the registry/repository to run on a different port than 53307, you will need to use the -dburl parameter to specify the address of the registry/repository when you run your script.
myScript -delete myEmailTemplate.html -dburl http://rubicon:53307/CentraSite/CentraSite -dbuser jcallen -dbpassword j45Hk19a