Index: lams_build/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_build/build.xml,v diff -u -r1.120.2.33 -r1.120.2.34 --- lams_build/build.xml 5 Aug 2014 11:40:57 -0000 1.120.2.33 +++ lams_build/build.xml 6 Aug 2014 14:37:01 -0000 1.120.2.34 @@ -179,20 +179,23 @@ ${ant.project.name}: Copying libraries + + + + + + + + - - - - - Copying lams-central.war @@ -205,7 +208,7 @@ /> Copying language files - + @@ -313,7 +316,7 @@ - + Index: lams_build/build_base.xml =================================================================== RCS file: /usr/local/cvsroot/lams_build/build_base.xml,v diff -u -r1.25.2.11 -r1.25.2.12 --- lams_build/build_base.xml 5 Aug 2014 09:55:53 -0000 1.25.2.11 +++ lams_build/build_base.xml 6 Aug 2014 14:37:01 -0000 1.25.2.12 @@ -303,7 +303,7 @@ ${ant.project.name}: Deploying JAR - + @@ -312,7 +312,7 @@ Copying language files for ${ant.project.name}, if exist - + Index: lams_build/conf/j2ee/application.xml =================================================================== RCS file: /usr/local/cvsroot/lams_build/conf/j2ee/Attic/application.xml,v diff -u -r1.35.2.4 -r1.35.2.5 --- lams_build/conf/j2ee/application.xml 4 Aug 2014 12:52:32 -0000 1.35.2.4 +++ lams_build/conf/j2ee/application.xml 6 Aug 2014 14:37:01 -0000 1.35.2.5 @@ -1,8 +1,4 @@ - - - + LAMS @@ -59,7 +55,7 @@ ======================================================== --> - + lams-tool-laasse10.war/lams/tool/laasse10lams-tool-labbb10.war/lams/tool/labbb10lams-tool-lachat11.war/lams/tool/lachat11lams-tool-ladaco10.war/lams/tool/ladaco10lams-tool-eueadv10.war/lams/tool/eueadv10lams-tool-lafrum11.war/lams/tool/lafrum11lams-tool-lagmap10.war/lams/tool/lagmap10lams-tool-laimag10.war/lams/tool/laimag10lams-tool-laimsc11.war/lams/tool/laimsc11lams-tool-lamc11.war/lams/tool/lamc11lams-tool-laqa11.war/lams/tool/laqa11lams-tool-larsrc11.war/lams/tool/larsrc11lams-tool-lalead11.war/lams/tool/lalead11lams-tool-lamind10.war/lams/tool/lamind10lams-tool-lanb11.war/lams/tool/lanb11lams-tool-lantbk11.war/lams/tool/lantbk11lams-tool-lapixl10.war/lams/tool/lapixl10lams-tool-lasbmt11.war/lams/tool/lasbmt11lams-tool-lascrt11.war/lams/tool/lascrt11lams-tool-lascrb11.war/lams/tool/lascrb11lams-tool-lasprd10.war/lams/tool/lasprd10lams-tool-lasurv11.war/lams/tool/lasurv11lams-tool-latask10.war/lams/tool/latask10lams-tool-lavidr10.war/lams/tool/lavidr10lams-tool-lavote11.war/lams/tool/lavote11lams-tool-lawiki10.war/lams/tool/lawiki10lams-tool-lawook10.war/lams/tool/lawook10lams-tool-lakalt11.war/lams/tool/lakalt11 Student LEARNER @@ -88,13 +84,9 @@ SYSADMIN - + lib + \ No newline at end of file Index: lams_central/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_central/build.xml,v diff -u -r1.60.2.3 -r1.60.2.4 --- lams_central/build.xml 1 Aug 2014 13:06:21 -0000 1.60.2.3 +++ lams_central/build.xml 6 Aug 2014 14:36:56 -0000 1.60.2.4 @@ -67,7 +67,7 @@ ${ant.project.name}: Copying language files - + Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployFilesTask.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployFilesTask.java,v diff -u -r1.9 -r1.9.12.1 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployFilesTask.java 17 Sep 2006 06:21:29 -0000 1.9 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployFilesTask.java 6 Aug 2014 14:36:55 -0000 1.9.12.1 @@ -23,30 +23,30 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.deploy; + import java.io.File; /** * Deploys required files to the lams ear. + * * @author chris */ -public class DeployFilesTask extends FilesTask -{ +public class DeployFilesTask extends FilesTask { - /** - * Copies files to lams.ear. + * Copies files to lams.ear. + * * @return Map containing key "numFiles", value Long */ - public void execute() throws DeployException - { - File lamsEar = getLamsEar(); - int size = deployFiles.size(); - for (int i = 0; i < size; i++) - { - copyFile(deployFiles.get(i), lamsEar); - } - + public void execute() throws DeployException { + File lamsEar = new File(lamsEarPath); + File lamsLib = new File(lamsLibPath); + for (String deployFile : deployFiles) { + if (deployFile.endsWith(".jar")) { + copyFile(deployFile, lamsLib); + } else { + copyFile(deployFile, lamsEar); + } + } } - - -} +} \ No newline at end of file Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployLanguageFilesTask.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployLanguageFilesTask.java,v diff -u -r1.6 -r1.6.12.1 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployLanguageFilesTask.java 17 Sep 2006 06:21:29 -0000 1.6 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployLanguageFilesTask.java 6 Aug 2014 14:36:55 -0000 1.6.12.1 @@ -23,19 +23,18 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.deploy; + import java.io.File; /** - * Deploys required language files to the lams ear. Copies all the language files - * in a particular directory to a given package name. + * Deploys required language files to the lams ear. Copies all the language files in a particular directory to a given + * package name. + * * @author chris */ -public class DeployLanguageFilesTask extends FilesTask -{ - public static final String NUM_FILES = "numFiles"; - - private static final String LANGUAGE_JAR_DIRECTORY = "lams-dictionary.jar"; - +public class DeployLanguageFilesTask extends FilesTask { + private static final String LANGUAGE_JAR_DIRECTORY = "lams-dictionary.jar"; + /** * Holds value of dictionary package i.e. the tool signature or a unique id for a complex activity. */ @@ -44,58 +43,43 @@ /** * Copy the application resources / language files to the lams-dictionary.jar folder */ - public void execute() throws DeployException - { - // check the lams ear is okay by getting the file object - this will check - // for any problems with the lams ear. - getLamsEar(); + public void execute() throws DeployException { + // Go through each language file and copy it into the directory named for the tool's signature. + // This means the file ends up as .ApplicationResources + File dictionaryDir = getLamsDictionary(); + for (String languageFilename : deployFiles) { + copyFile(languageFilename, dictionaryDir); + } + } - // Go through each language file and copy it into the directory named for the tool's signature. - // This means the file ends up as .ApplicationResources - File dictionaryDir = getLamsDictionary(); - int count = 0; - for (String languageFilename : deployFiles) - { - System.out.println("Copying file "+languageFilename+" to "+dictionaryDir); - copyFile(languageFilename, dictionaryDir); - count++; - } - } - - /** Gets the package directory in the dictionary directory in the LAMS ear directory and - * checks that it exists, is a directory and is writable. Assumes that lams.ear exists and it - * has already been checked to be directory, writable, etc. If it doesn't exist, it creates - * the directory (as long as the lams ear exists). */ + /** + * Gets the package directory in the dictionary directory in the LAMS ear directory and checks that it exists, is a + * directory and is writable. Assumes that lams.ear exists and it has already been checked to be directory, + * writable, etc. If it doesn't exist, it creates the directory (as long as the lams ear exists). + */ private File getLamsDictionary() throws DeployException { - - // convert dictionary packet org.lamsfoundation.lams.tool.web to org/lamsfoundation/lams/tool/web - if ( dictionaryPacket != null ) { - dictionaryPacket = dictionaryPacket.replace('.',File.separatorChar); - } - String packageName = lamsEarPath+File.separator+LANGUAGE_JAR_DIRECTORY+File.separator+dictionaryPacket; - File dictionaryDir = new File(packageName); - if (!dictionaryDir.exists()) - { - dictionaryDir.mkdirs(); - } - else if (!dictionaryDir.isDirectory()) - { - throw new DeployException("Dictionary package "+packageName+" exists but it is not a directory"); - } - else if (!dictionaryDir.canWrite()) - { - throw new DeployException("Dictionary package "+packageName+" exists but it is not writable"); - } - return dictionaryDir; + // convert dictionary packet org.lamsfoundation.lams.tool.web to org/lamsfoundation/lams/tool/web + if (dictionaryPacket != null) { + dictionaryPacket = dictionaryPacket.replace('.', File.separatorChar); + } + String packageName = lamsLibPath + File.separator + LANGUAGE_JAR_DIRECTORY + File.separator + dictionaryPacket; + File dictionaryDir = new File(packageName); + if (!dictionaryDir.exists()) { + dictionaryDir.mkdirs(); + } else if (!dictionaryDir.isDirectory()) { + throw new DeployException("Dictionary package " + packageName + " exists but it is not a directory"); + } else if (!dictionaryDir.canWrite()) { + throw new DeployException("Dictionary package " + packageName + " exists but it is not writable"); + } + return dictionaryDir; } /** Name of the dictionary package i.e. the tool signature or a unique id for a complex activity. */ - public String getDictionaryPacket() { - return dictionaryPacket; - } + public String getDictionaryPacket() { + return dictionaryPacket; + } - public void setDictionaryPacket(String dictionaryPacket) { - this.dictionaryPacket = dictionaryPacket; - } - -} + public void setDictionaryPacket(String dictionaryPacket) { + this.dictionaryPacket = dictionaryPacket; + } +} \ No newline at end of file Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/FilesTask.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/FilesTask.java,v diff -u -r1.6 -r1.6.12.1 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/FilesTask.java 17 Sep 2006 06:21:29 -0000 1.6 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/FilesTask.java 6 Aug 2014 14:36:55 -0000 1.6.12.1 @@ -23,89 +23,67 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.deploy; + import java.io.File; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import org.apache.commons.io.FileUtils; /** * Parent of Tasks that deal with the deploy files. + * * @author chris */ -public abstract class FilesTask implements Task -{ - +public abstract class FilesTask implements Task { + + private static final String EAR_LIB_DIRECTORY = "lib"; /** * Holds value of property lamsEarPath. */ protected String lamsEarPath; - + protected String lamsLibPath; + /** * Holds value of property deployFiles. */ protected List deployFiles; - + /** Creates a new instance of DeployWarTask */ - public FilesTask() - { + public FilesTask() { } - + /** * Sets the path to the lams ear. - * @param lamsEarPath New value of property lamsEarPath. + * + * @param lamsEarPath + * New value of property lamsEarPath. */ - public void setLamsEarPath(String lamsEarPath) - { - - this.lamsEarPath = lamsEarPath; + public void setLamsEarPath(String lamsEarPath) { + this.lamsEarPath = lamsEarPath; + this.lamsLibPath = lamsEarPath + File.separator + EAR_LIB_DIRECTORY; } - + /** * Sets the list of file paths to operate on. - * @param deployFiles New value of property deployFiles. + * + * @param deployFiles + * New value of property deployFiles. */ - public void setDeployFiles(List deployFiles) - { - - this.deployFiles = deployFiles; + public void setDeployFiles(List deployFiles) { + this.deployFiles = deployFiles; } /** - * Copy a file to a given directory - */ - protected void copyFile(String fileName, File directory) throws DeployException - { - try - { - File original = new File(fileName); - FileUtils.copyFileToDirectory(original, directory); - } - catch (IOException ioex) - { - throw new DeployException("Could not copy file "+fileName+" to "+directory.getAbsolutePath(), ioex); - } - - } - - /** Gets the LAMS ear directory and checks that it exists, is a directory and is writable. */ - protected File getLamsEar() throws DeployException { - - File lamsEar = new File(lamsEarPath); - if (!lamsEar.exists()) - { - throw new DeployException("Could not find "+lamsEarPath); - } - else if (!lamsEar.isDirectory()) - { - throw new DeployException(lamsEarPath+" is not a directory"); - } - else if (!lamsEar.canWrite()) - { - throw new DeployException(lamsEarPath+" is not writable"); - } - return lamsEar; - } - -} + * Copy a file to a given directory + */ + protected void copyFile(String fileName, File directory) throws DeployException { + try { + File original = new File(fileName); + System.out.println("Copying file " + fileName + " to " + directory.getAbsolutePath()); + FileUtils.copyFileToDirectory(original, directory); + } catch (IOException ioex) { + throw new DeployException("Could not copy file " + fileName + " to " + directory.getAbsolutePath(), ioex); + } + } +} \ No newline at end of file