Index: lams_build/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_build/build.xml,v diff -u -r1.57 -r1.58 --- lams_build/build.xml 5 May 2008 05:01:05 -0000 1.57 +++ lams_build/build.xml 10 Jun 2008 06:05:47 -0000 1.58 @@ -230,46 +230,57 @@ + + + + + + + + + + + @@ -279,6 +290,7 @@ + Index: lams_build/common.properties =================================================================== RCS file: /usr/local/cvsroot/lams_build/common.properties,v diff -u -r1.28 -r1.29 --- lams_build/common.properties 25 Jan 2008 08:55:27 -0000 1.28 +++ lams_build/common.properties 10 Jun 2008 06:06:13 -0000 1.29 @@ -100,3 +100,6 @@ #web application properties sessiontimeout=120 + +# are we generating the tool deploy packages for an upgrader. Normally this is false +generate.for.installers=false \ No newline at end of file Index: lams_build/deploy-tool/lib/lams-tool-deploy.jar =================================================================== RCS file: /usr/local/cvsroot/lams_build/deploy-tool/lib/lams-tool-deploy.jar,v diff -u -r1.16 -r1.17 Binary files differ Index: lams_tool_chat/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/build.xml,v diff -u -r1.21 -r1.22 --- lams_tool_chat/build.xml 17 Feb 2007 12:09:29 -0000 1.21 +++ lams_tool_chat/build.xml 10 Jun 2008 06:10:25 -0000 1.22 @@ -403,6 +403,7 @@ + *
  • (Optional) generateForInstallers: if true then the paths are prepended with @tool_build_dir@ + * rather than a full path.
  • *
  • (Optional) all other parameters go into the deploy.properties file.
  • * * @@ -88,7 +90,7 @@ // create the new configuration file, using the template //deployConfig = new DeployToolConfig(getTemplateDeployName()); - deployConfig = new DeployToolConfig(); + deployConfig = new DeployToolConfig(outputPath.toString()); // override with values from an optional config file if ( configFile != null && configFile.length() > 0 ) { log("Applying configuration file "+configFile.getAbsolutePath()); @@ -115,6 +117,7 @@ applyParameters(); applyFilesets(DeployToolConfig.LANGUAGE_FILES, filesets); deployConfig.validateProperties(); + deployConfig.convertForInstallers(); try { writeConfigFile(); Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Deploy.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Deploy.java,v diff -u -r1.20 -r1.21 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Deploy.java 22 Mar 2007 04:08:01 -0000 1.20 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Deploy.java 10 Jun 2008 06:02:42 -0000 1.21 @@ -73,8 +73,8 @@ System.out.println("Starting Tool Deploy"); try { - System.out.println("Reading Configuration File"+args[0]); - DeployToolConfig config = new DeployToolConfig(args[0]); + System.out.println("Reading Configuration File "+args[0]); + DeployToolConfig config = new DeployToolConfig(null, args[0]); String toolSignature = config.getToolSignature(); String toolVersionStr = config.getToolVersion(); Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployConfig.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployConfig.java,v diff -u -r1.16 -r1.17 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployConfig.java 14 Feb 2007 23:42:27 -0000 1.16 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployConfig.java 10 Jun 2008 06:02:42 -0000 1.17 @@ -75,6 +75,10 @@ protected transient String validationError = ""; protected transient XStream xstream; + protected transient boolean generateForInstallers = false; + protected transient String outputPath = null; + + /** * Holds value of property toolVersion. */ @@ -112,10 +116,12 @@ */ private String languageFilesPackage; - public DeployConfig() + public DeployConfig(String outputPath) { this.validationError = ""; xstream = new XStream(new DomDriver()); + + this.outputPath = outputPath != null ? outputPath : ""; } /** @@ -383,6 +389,23 @@ this.setLamsEarPath(config.getLamsEarPath()); } + public boolean isGenerateForInstallers() { + return generateForInstallers; + } + public void setGenerateForInstallers(boolean generateForInstallers) { + this.generateForInstallers = generateForInstallers; + } + + public String getOutputPath() { + return outputPath; + } + + public void setOutputPath(String outputPath) { + this.outputPath = outputPath; + } + + public abstract void convertForInstallers(); + } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployToolConfig.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployToolConfig.java,v diff -u -r1.14 -r1.15 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployToolConfig.java 1 Mar 2007 05:17:35 -0000 1.14 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployToolConfig.java 10 Jun 2008 06:02:42 -0000 1.15 @@ -58,6 +58,7 @@ private static final String TOOL_JAR_FILE_NAME = "toolJarFileName"; private static final String DEPLOY_FILES= "deployFiles"; private static final String MIN_SERVER_VERSION_NUMBER= "minServerVersionNumber"; + private static final String GENERATE_XML_FOR_INSTALLERS = "generateForInstallers"; protected static final String LANGUAGE_FILES= "languageFiles"; @@ -142,27 +143,26 @@ */ private ArrayList languageFiles; - - /** + /** * Creates an instance of DeployToolConfig object. */ - public DeployToolConfig() + public DeployToolConfig(String outputPath) { - super(); + super(outputPath); xstream.alias(ROOT_ELEMENT, DeployToolConfig.class); } /** * Creates an instance of DeployToolConfig object, with the values * of its properties, set to that specified by the Xml configuration file - * @param configurationFilePath + * @param configurationFilePath - only needed when generating the initial deploy.xml * @throws ParserConfigurationException * @throws IOException * @throws SAXException */ - public DeployToolConfig(String configurationFilePath) throws ParserConfigurationException, IOException, SAXException + public DeployToolConfig(String outputPath, String configurationFilePath) throws ParserConfigurationException, IOException, SAXException { - super(); + super(outputPath); xstream.alias(ROOT_ELEMENT, DeployToolConfig.class); updateConfigurationProperties(configurationFilePath); } @@ -173,7 +173,7 @@ String xml = readFile(configFilePath); DeployToolConfig config = (DeployToolConfig)deserialiseXML(xml); copyProperties(config); - //printObjectProperties(); //for testing purposes + printObjectProperties(); //for testing purposes } @@ -190,6 +190,11 @@ super.setProperty(key, value); //System.out.println("ToolConfig " + key + " is: " + value); + if ( key.equalsIgnoreCase(GENERATE_XML_FOR_INSTALLERS) ) { + generateForInstallers = java.lang.Boolean.parseBoolean(value); + System.out.print("generateForInstallers"+generateForInstallers); + } + if ( key.equalsIgnoreCase(TOOL_SIGNATURE) ) { toolSignature = value; @@ -576,5 +581,43 @@ this.toolJarFileName = toolJarFileName; } - + public void convertForInstallers() { + if ( isGenerateForInstallers() ) { + System.out.println("Stripping paths output path "+outputPath); + int lengthOfPath = outputPath.length(); + toolUpdateScriptPath = stripPath(toolUpdateScriptPath, outputPath, lengthOfPath); + toolInsertScriptPath = stripPath(toolInsertScriptPath, outputPath, lengthOfPath); + toolLibraryInsertScriptPath = stripPath(toolLibraryInsertScriptPath, outputPath, lengthOfPath); + toolActivityInsertScriptPath = stripPath(toolActivityInsertScriptPath, outputPath, lengthOfPath); + toolTablesScriptPath = stripPath(toolTablesScriptPath, outputPath, lengthOfPath); + toolTablesDeleteScriptPath = stripPath(toolTablesDeleteScriptPath, outputPath, lengthOfPath); + + ArrayList newLanguageFiles = new ArrayList(languageFiles.size()); + for ( String file : languageFiles ) { + newLanguageFiles.add(stripPath(file, outputPath, lengthOfPath)); + } + languageFiles = newLanguageFiles; + + ArrayList newDeployFiles = new ArrayList(deployFiles.size()); + for ( String file : deployFiles ) { + newDeployFiles.add(stripPath(file, outputPath, lengthOfPath)); + } + deployFiles = newDeployFiles;; + + setDbDriverClass("@dbDriverClass@"); + setDbDriverUrl("@dbDriverUrl@"); + setDbUsername("@dbUsername@"); + setDbPassword("@dbPassword@"); + setLamsEarPath("@lamsear@"); + } + } + + private String stripPath(String path, String outputPath, int lengthOfPath) { + System.out.println("script path "+path+" index of "+path.indexOf(outputPath) ); + if ( path.indexOf(outputPath) == 0 ) { + return "@toolDeployPackageDir@"+path.substring(lengthOfPath); + } else { + return path; + } + } } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/CreateLibraryPackageTask.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/CreateLibraryPackageTask.java,v diff -u -r1.5 -r1.6 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/CreateLibraryPackageTask.java 17 Sep 2006 06:21:29 -0000 1.5 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/CreateLibraryPackageTask.java 10 Jun 2008 06:02:42 -0000 1.6 @@ -75,7 +75,7 @@ // create the new configuration file, using the template //deployConfig = new DeployToolConfig(getTemplateDeployName()); - deployConfig = new DeployLibraryConfig(); + deployConfig = new DeployLibraryConfig(outputPath.toString()); // override with values from an optional config file if ( configFile != null && configFile.length() > 0 ) { log("Applying configuration file "+configFile.getAbsolutePath()); Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibraryConfig.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibraryConfig.java,v diff -u -r1.6 -r1.7 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibraryConfig.java 17 Sep 2006 06:21:29 -0000 1.6 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibraryConfig.java 10 Jun 2008 06:02:42 -0000 1.7 @@ -54,8 +54,9 @@ private ArrayList learningLibraryList; - public DeployLibraryConfig() + public DeployLibraryConfig(String outputPath) { + super(outputPath); xstream.alias(ROOT_ELEMENT, DeployLibraryConfig.class); xstream.alias(LEARNING_LIBRARY, LearningLibrary.class); xstream.alias(TOOL_ACTIVITY, ToolActivity.class); @@ -65,8 +66,10 @@ String dbPassword, String dbDriverClass, String dbDriverUrl, - ArrayList learningLibraries) + ArrayList learningLibraries, + String outputPath) { + super(outputPath); setDbUsername(dbUsername); setDbPassword(dbPassword); setDbDriverClass(dbDriverClass); @@ -78,9 +81,9 @@ xstream.alias(TOOL_ACTIVITY, ToolActivity.class); } - public DeployLibraryConfig(String configurationFilePath) throws ParserConfigurationException, IOException, SAXException + public DeployLibraryConfig(String configurationFilePath, String outputPath) throws ParserConfigurationException, IOException, SAXException { - super(); + super(outputPath); xstream.alias(ROOT_ELEMENT, DeployLibraryConfig.class); xstream.alias(LEARNING_LIBRARY, LearningLibrary.class); xstream.alias(TOOL_ACTIVITY, ToolActivity.class); @@ -223,4 +226,8 @@ public void setLearningLibraryList(ArrayList learningLibraryList) { this.learningLibraryList = learningLibraryList; } + + public void convertForInstallers() { + // No conversion being done at this stage as the updater doesn't use them. + } } Index: lams_tool_forum/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/build.xml,v diff -u -r1.51 -r1.52 --- lams_tool_forum/build.xml 15 Feb 2007 04:47:45 -0000 1.51 +++ lams_tool_forum/build.xml 10 Jun 2008 06:10:52 -0000 1.52 @@ -374,6 +374,7 @@