plugin.name = SunEE Reference Implementation
plugin.version = 1.0
plugin.message_tab = EJB Deployment
plugin.message_prefix = SunEE:\u0020

#
# WIZARD Section
#

#
# task is a checkbox on the 1st page of wizard
#
task.addImports.name = Add libraries, required for deployment, to the project Search/Classpath
task.addImports.order = 10
task.addImports = true

task.verify.name = Verify/Correct EJB sources for compliance with Sun EE requirements
task.verify.order = 15
task.verify = true

task.compile.name = Compile classes from the selected diagram
task.compile.order = 20
task.compile = true

task.generateDD.name = Generate Deployment Descriptor
task.generateDD.order = 30
task.generateDD = true

task.packEJBJAR.name = Pack EJB JAR using packager
task.packEJBJAR.order = 40
task.packEJBJAR = true

task.packEAR.name = Pack Application EAR using packager
task.packEAR.order = 50
task.packEAR = true

task.xmlEditor.name = Open XML Editor for generated DD
task.xmlEditor.order = 70
task.xmlEditor = true

task.hotdeploy.name = Deploy ready EAR file to the running Sun AS
task.hotdeploy.order = 80
task.hotdeploy = true

task.deleteTempBefore.name = Clear temp folder before start
task.deleteTempBefore.order = 100
task.deleteTempBefore = true

task.deleteTempAfter.name = Clear temp folder after finish
task.deleteTempAfter.order = 110
task.deleteTempAfter = true

task.correctTA = true
task.correctTA.name = Correct transaction attributes for the selected server
task.correctTA.order = 120

#
# Wizard pages
#
page.dirs.name = Common Properties
page.dirs.order = 1

page.deployment.name = Deployment properties
page.deployment.task = hotdeploy
page.deployment.order = 2

page.correcture.name = Verify/Correct sources
page.correcture.task = verify
page.correcture.order = 15

#
# Wizard properties
#

TEMP_OUT = c:\\temp
TEMP_OUT.name = Where to create folder for temp files
TEMP_OUT.type = DirectoryField
TEMP_OUT.page = dirs
TEMP_OUT.order = 1

RESULT_OUT = c:\\temp
RESULT_OUT.name = Where to put result JAR and EAR file
RESULT_OUT.type = DirectoryField
RESULT_OUT.page = dirs
RESULT_OUT.order = 2

JAVA_HOME = c:\\jdk1.2.2
JAVA_HOME.name = JDK 1.2 root directory
JAVA_HOME.type = DirectoryField
JAVA_HOME.page = dirs
JAVA_HOME.order = 3
JAVA_HOME.check.1 = %%JAVA_HOME%%
JAVA_HOME.check.1.type = DirExistence
JAVA_HOME.check.1.message = JDK directory '%%JAVA_HOME%%' does not exist
JAVA_HOME.check.2 = %%JAVA_HOME%%\\bin\\javac.exe
JAVA_HOME.check.2.type = FileExistence
JAVA_HOME.check.2.message = Unable to locate JAVAC.exe application under selected JDK root: %%JAVA_HOME%%\\bin\\javac.exe

J2EE_HOME = c:\\j2sdkee1.2.1
J2EE_HOME.name = Java 2 SDK, Enterprise Edition root directory
J2EE_HOME.type = DirectoryField
J2EE_HOME.page = dirs
J2EE_HOME.order = 4
J2EE_HOME.check.1 = %%J2EE_HOME%%
J2EE_HOME.check.1.type = DirExistence
J2EE_HOME.check.1.message = J2EESDK directory '%%J2EE_HOME%%' does not exist
J2EE_HOME.check.2 = %%J2EE_HOME%%\\repository
J2EE_HOME.check.2.type = DirExistence
J2EE_HOME.check.2.message = J2EESDK repository directory '%%J2EE_HOME%%\repository' does not exist

#=============== Start for Verify ==================
STOP_IF_NOT_COMPLIANT = true
STOP_IF_NOT_COMPLIANT.name = Stop deployment if verification fails
STOP_IF_NOT_COMPLIANT.type = BooleanField
STOP_IF_NOT_COMPLIANT.order = 10
STOP_IF_NOT_COMPLIANT.page = correcture

CORRECT_SRC = true
CORRECT_SRC.name = Correct sources to comply with Sun EE
CORRECT_SRC.type = BooleanField
CORRECT_SRC.order = 20
CORRECT_SRC.page = correcture

DO_BACKUP = true
DO_BACKUP.name = Backup original sources
DO_BACKUP.type = BooleanField
DO_BACKUP.order = 25
DO_BACKUP.page = correcture

BACKUP_DIR = c:\\temp\\backup
BACKUP_DIR.name = Backup directory for the source files (if "correct sources" is selected)
BACKUP_DIR.type = DirectoryField
BACKUP_DIR.order = 30
BACKUP_DIR.page = correcture
#=============== End for Verify ==================


HOST = localhost
HOST.name = Sun AS host name
HOST.type = StringField
HOST.page = deployment
HOST.order = 1

#
# Environments
#
env_DeployTemp = %%TEMP_OUT%%\\DeployEJB
env_JAVAC = %%JAVA_HOME%%\\bin\\javac.exe
env_PACKAGER = %%J2EE_HOME%%\\bin\\packager.bat
env_DEPLOYTOOL = %%J2EE_HOME%%\\bin\\deploytool.bat
env_CP = "%%J2EE_HOME%%\\lib\\j2ee.jar;\
          %%JAVA_HOME%%\\jre\\lib\\rt.jar"

ejb.ddprologue = <?xml version="1.0"?>\n\
	<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>

#
# Steps
#
write.step.10 = Start Export
write.step.10.type = ejbframework.step.DisplayMessage

write.step.25 = %%env_DeployTemp%%
write.step.25.label = >>>>>>>>>> Deleting previous temp files
write.step.25.type = ejbframework.step.RemoveDirSilent
write.step.25.task = task.deleteTempBefore

write.step.30 = %%env_DeployTemp%%
write.step.30.label = >>>>>>>>>> Creating folder for the temp files
write.step.30.type = ejbframework.step.CreateDir

# Verifying/correction section

# create backup dir if Verify task is selected and Backup checkbox is on
write.step.33 = CREATE_BACKUP_DIR
write.step.33.type = ejbframework.step.EvaluateLogicalExpr
write.step.33.param.oper = AND
write.step.33.param.arg1 = %%task.verify%%
write.step.33.param.arg2 = %%DO_BACKUP%%

write.step.34 = %%BACKUP_DIR%%
write.step.34.label = >>>>>>>>>> Creating folder for backup files
write.step.34.type = ejbframework.step.CreateDir
write.step.34.task = CREATE_BACKUP_DIR

write.step.35 = VERIFY_AND_CORRECT
write.step.35.type = ejbframework.step.EvaluateLogicalExpr
write.step.35.param.oper = AND
write.step.35.param.arg1 = %%task.verify%%
write.step.35.param.arg2 = %%CORRECT_SRC%%

# Step 1. Verify
write.step.36 = Verifying EJBs for compliance with Sun EE
write.step.36.type = ejbframework.step.DisplayMessage
write.step.36.task = task.verify

write.step.37 = Correct EJB if there are no interface classes
write.step.37.label = >>>>>>>>>> Creating classes for EJBs 
write.step.37.type = ejbframework.step.verify.VerificationRemouteHome
write.step.37.param.Backup = %%DO_BACKUP%%
write.step.37.param.BackupCmd = command.com /C copy %%file_name%% %%BACKUP_DIR%%
write.step.37.param.BackupType = ejbframework.step.ExecuteCommandLine
write.step.37.param.StopIfError = %%STOP_IF_NOT_COMPLIANT%%
write.step.37.task = task.verify

write.step.38 = Correct CMP ejbCreate methods to EJB1.1 Spec
write.step.38.label = >>>>>>>>>> Correcting CMP EJBs ejbCreate methods to EJB1.1
write.step.38.type = ejbframework.step.migrate.CorrectEjbCreateCMP11
write.step.38.param.Backup = %%DO_BACKUP%%
write.step.38.param.BackupCmd = command.com /C copy %%file_name%% %%BACKUP_DIR%%
write.step.38.param.BackupType = ejbframework.step.ExecuteCommandLine
write.step.38.param.StopIfError = %%STOP_IF_NOT_COMPLIANT%%
write.step.38.task = VERIFY_AND_CORRECT

write.step.39.label = >>>>>>>>>> Correct transaction attributes for the selected server
write.step.39.type = ejbframework.step.CorrectTransactions
write.step.39.param.Specification = 1.1
write.step.39.param.StopIfError = %%STOP_IF_NOT_COMPLIANT%%
write.step.39.task = task.correctTA

# check whether CMP ejbCreate methods return PK (not void as in EJB1.0)
write.step.40 = Check for CMP ejbCreate methods
write.step.40.label = >>>>>>>>>> Verifying CMP EJBs ejbCreate methods
write.step.40.type = ejbframework.step.verify.EjbCreateCMP11
write.step.40.param.StopIfError = %%STOP_IF_NOT_COMPLIANT%%
write.step.40.task = task.verify

env_CompiledClasses = %%env_DeployTemp%%\\classes
write.step.45 = %%env_CompiledClasses%%
write.step.45.label = >>>>>>>>>> Creating target folder for the compiled files: %%env_CompiledClasses%%
write.step.45.type = ejbframework.step.CreateDir
write.step.45.task = task.compile

write.step.50 = %%env_CP%%
write.step.50.label = >>>>>>>>>> Adding "%%env_CP%%" to the project Search/Classpath
write.step.50.type = ejbframework.step.AddToProjectClasspath
write.step.50.task = task.addImports

# compile bean. Pass source_path (calculated by the step) to javac to compile all dependend classes, if any, as well
write.step.100 = %%env_JAVAC%% -sourcepath "%%source_path%%" -d %%env_CompiledClasses%% \
			-classpath %%env_CP%% %%classes_to_compile%%
write.step.100.label = >>>>>>>>>> Compiling EJB(s) to %%env_CompiledClasses%%
write.step.100.type = ejbframework.step.Compile
write.step.100.task = task.compile

env_EjbJar = %%env_DeployTemp%%\\ejb-jar.xml
write.step.200 = %%env_EjbJar%%
write.step.200.label = >>>>>>>>>> Generate DeploymentDescriptor to %%env_EjbJar%%
write.step.200.type = ejbframework.step.ProviderDDGenerator11
write.step.200.task = task.generateDD

write.step.205 = %%env_EjbJar%%
write.step.205.label = >>>>>>>>>> Open XML Editor for generated %%env_EjbJar%%
write.step.205.type = ejbframework.xmleditor.CallXMLEditor
write.step.205.task = task.xmlEditor

env_LocalBat = %%$TG_HOME%%\\modules\\com\\togethersoft\\modules\\ejbframework\\plugins\\sunee\\pkg.bat

write.step.300 = -d %%env_DeployTemp%% %%env_LocalBat%% %%JAVA_HOME%% %%J2EE_HOME%% %%env_PACKAGER%% -ejbJar %%env_CompiledClasses%% %%list_of_files%% ejb-jar.xml %%RESULT_OUT%%\\EjbJar.JAR
write.step.300.label = >>>>>>>>>> Pack EjbJar.jar with the set of compiled classes and xml DD using packager utility
write.step.300.type = ejbframework.plugins.sunee.step.EJBJarPackager
write.step.300.param.RootDir = %%env_CompiledClasses%%
write.step.300.param.Separator = :
write.step.300.task = task.packEJBJAR

write.step.350 = -d %%env_DeployTemp%% %%env_LocalBat%% %%JAVA_HOME%% %%J2EE_HOME%% %%env_PACKAGER%% -enterpriseArchive %%RESULT_OUT%%\\EjbJar.JAR TogetherApplication %%RESULT_OUT%%\\Application.EAR
write.step.350.type = ejbframework.step.ExecuteCommandLine
write.step.350.task = task.packEAR

ri_Group = guest
ri_ServerName = SunEEAppServer
ri_Principal = j2ee
ri_defResourcePrincipleName = guest
ri_defResourcePrinciplePwd = test

env_sunRI = %%env_DeployTemp%%\\sun-j2ee-ri.xml
write.step.400 = %%env_sunRI%%
write.step.400.label = >>>>>>>>>> Generate Run-time DeploymentDescriptor to %%env_sunRI%%
write.step.400.type = ejbframework.plugins.sunee.step.SunJ2eeRIGenerator
write.step.400.task = task.generateDD

write.step.405 = %%env_sunRI%%
write.step.405.label = >>>>>>>>>> Open XML Editor for generated %%env_EjbJar%%
write.step.405.type = ejbframework.xmleditor.CallXMLEditor
write.step.405.param.DTD = %%$TG_HOME%%\\modules\\com\\togethersoft\\modules\\ejbframework\\plugins\\sunee\\sun-j2ee-ri.dtd
write.step.405.param.prologue = <?xml version="1.0" encoding="Cp1252"?>
write.step.405.param.encoding = Cp1252
write.step.405.task = task.xmlEditor

write.step.450 =  -d %%env_DeployTemp%% %%env_LocalBat%% %%JAVA_HOME%% %%J2EE_HOME%% %%env_PACKAGER%% -setRuntime %%RESULT_OUT%%\\Application.EAR sun-j2ee-ri.xml
write.step.450.label = >>>>>>>>>> Specify RI DD %%env_sunRI%% to the packed application EAR
write.step.450.type = ejbframework.step.ExecuteCommandLine
write.step.450.task = task.packEAR

write.step.500 = -d %%env_DeployTemp%% %%env_LocalBat%% %%JAVA_HOME%% %%J2EE_HOME%% %%env_DEPLOYTOOL%% -deploy %%RESULT_OUT%%\\Application.EAR %%HOST%%
write.step.500.label = >>>>>>>>>> Hot deploy application EAR to running server
write.step.500.type = ejbframework.step.ExecuteCommandLine
write.step.500.task = task.hotdeploy

# delete temp directory
write.step.1000 = %%env_DeployTemp%%
write.step.1000.type = ejbframework.step.RemoveDir
write.step.1000.label = >>>>>>>>>> Deleting temporary folder %%env_DeployTemp%%
write.step.1000.task = task.deleteTempAfter
