Index: lams_build/build.xml =================================================================== diff -u -r5a19a3587723f3e78a4f2cb3bd3810fb51a57ec2 -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_build/build.xml (.../build.xml) (revision 5a19a3587723f3e78a4f2cb3bd3810fb51a57ec2) +++ lams_build/build.xml (.../build.xml) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -329,7 +329,13 @@ - + + + + + + @@ -340,6 +346,9 @@ + + + @@ -365,8 +374,6 @@ dbDriverUrl="${db.url}" dbDriverClass="com.mysql.jdbc.Driver" /> - - Index: lams_build/deploy-tool/lib/lams-tool-deploy.jar =================================================================== diff -u -r5a19a3587723f3e78a4f2cb3bd3810fb51a57ec2 -r1ec30cb981a3c40c5fd75563afd3d27475ee918e Binary files differ Index: lams_build/librarypackages/nbsubmit/deployLibrary.xml =================================================================== diff -u -r5a19a3587723f3e78a4f2cb3bd3810fb51a57ec2 -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_build/librarypackages/nbsubmit/deployLibrary.xml (.../deployLibrary.xml) (revision 5a19a3587723f3e78a4f2cb3bd3810fb51a57ec2) +++ lams_build/librarypackages/nbsubmit/deployLibrary.xml (.../deployLibrary.xml) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -19,6 +19,8 @@ @assemblydir@/toolActivity2_insert.sql + @assemblylangdir@ + ApplicationResources Index: lams_build/librarypackages/nbsubmit/language/ApplicationResources.properties =================================================================== diff -u -r5a19a3587723f3e78a4f2cb3bd3810fb51a57ec2 -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_build/librarypackages/nbsubmit/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 5a19a3587723f3e78a4f2cb3bd3810fb51a57ec2) +++ lams_build/librarypackages/nbsubmit/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -1,174 +1,7 @@ # CVS ID: $Id$ # -# Language strings for the Forum tool. -# ========== Values for tool and library activity. Sent to Flash as part of the learning design toolkit. ====== -activity.title=Forum -activity.description=Online threaded discussion tool (asynchronous). -activity.helptext=Discussion tool useful for long running collaborations and situations where learners are not all on line at the same time. +# Language strings for the Dummy Parallel activity. -tool.display.name=Forum Tool -tool.description=Tool for forums, also known as message boards. - -#=========================labels===========================# -#-------------------------Authoring Labels-----------------# -label.authoring.heading.basic=Forum -label.authoring.heading.basic.desc=Basic input information for forum -label.authoring.heading.instructions.desc=Please input online and offline instructions -label.authoring.heading.advance.desc=Please input advance options for Forum -label.authoring.create.new.topic=Create a new topic - -label.authoring.basic.title=Title -label.authoring.basic.instruction=Instruction -label.authoring.online.instruction =Online Instructions -label.authoring.offline.instruction=Offline Instructions -label.authoring.online.file =Upload online file -label.authoring.offline.file=Upload offline file -label.authoring.advance.lock.on.finished=Lock on finished - -label.authoring.save.button=Save -label.authoring.cancel.button=Cancel -label.authoring.choosefile.button=Choose file -label.authoring.upload.online.button=Upload Online -label.authoring.upload.offline.button=Upload Offline -label.authoring.online.filelist=Online file list -label.authoring.offline.filelist=Offline file list -label.authoring.online.delete=Delete -label.authoring.offline.delete=Delete -label.authoring.advance.allow.edit=Allow Edit -label.authoring.advance.use.richeditor=Allow Rich Editor -label.authoring.advance.limited.input=Limitation of input characters - -lable.topic.title.subject=Subject -lable.topic.title.body=Body -lable.topic.title.update=Last post -lable.topic.title.author=Author -lable.topic.title.startedby=Start by -lable.topic.title.replies=Replies -lable.topic.title.mark=Mark -lable.topic.subject.by=By -label.back.to.forum=Go back to froum -lable.topic.title.message.number=# of Msg -lable.topic.title.average.mark= Aver mark -authoring.exception= There is a problem in forum authoring page, the reason is {0} -#-------------------------END Authoring Labels END-----------------# - -#---------------------------------Monitoring ----------------------------------# -page.title.monitoring.content.userlist=Summary -page.title.monitoring.view.user.mark=View user mark -page.title.monitoring.edit.user.mark=Edit user mark -page.title.monitoring.view.activity=View Activity -page.title.monitoring.edit.activity=Edit Activity -page.title.monitoring.view.instructions=View Instructions -page.title.monitoring.view.topic=View topic -page.title.monitoring.statistic=Statistic -page.title.monitoring.definelater=Forum Tool Define - -label.monitoring.edit.activity.cancel=Cancel -label.monitoring.edit.activity.update=Update -label.monitoring.edit.activity.edit=Edit - -label.monitoring.statistic.average.mark= Average message mark -lable.monitoring.statistic.total.message=# of total message - -message.monitoring.edit.activity.not.editable=This Activity is no longer editable -#------------------------------End Monitoring ----------------------------------# - -## errors -errors.header= -errors.footer= - -#error.title = System Error! -error.valueReqd = Value Required -error.inputFileTooLarge = Input File size is too large! -error.uploading = error uploading -error.mark.needNumber= Mark must be int value -error.mark.invalid.number= Mark is invalid number format -error.fail.get.forum=No Forum available -error.title.empty=Title can not be blank -#General Messages -message.msg.maxFileSize = Max 250K - -##Message -title.messageTopic.open = Topic Details - -title.message.add = Add Message -title.message.open = View Message -title.message.reply = Reply Message -title.message.edit = Edit Message -title.message.view=Message Board -title.message.view.topic=View Message -title.message.delete=Delete Message - -message.label.subject = Subject -message.label.body = Body -message.label.attachment = Attachment -message.label.postedOn = Posted On: -message.label.threadReplies = Thread Replies -message.link.reply = Reply - -##Labels -label.open = Open -label.delete = Delete -label.download = Download -label.view = View -label.edit = Edit -label.reply = Reply -label.done = Done -label.finish= Finish -label.newtopic= New Topic -label.refresh= Refresh -lable.char.left=Characters left -label.basic=Basic -label.advanced=Advanced -label.instructions=Instructions -##Buttons -button.upload = Upload -button.done = Done -button.submit = Submit -button.on = On -button.off = Off -button.add = Add -button.cancel = Cancel - -js.error.invalid.number=The input is invalid number format -js.error.min.number=The input must be greater than 0 -js.error.title=The following error(s) occurred: - -#not list in spanish yet -monitoring.tab.summary=Summary -monitoring.tab.instructions=Instruction -monitoring.tab.edit.activity=Edit Activity - -monitoring.user.post.topic=provides following posts: -lable.topic.title.comment=Comment -message.not.avaliable=Not Available -lable.update.mark=Update mark -message.assign.mark= Please assign a mark and a comment for the report by -message.session.name=Session Name -message.monitoring.summary.no.users=No users available -message.view.all.marks=View all marks -message.download.marks=Download marks -label.monitoring.summary.view.forum= View forum - -#new messages 6/3/06 -message.monitoring.summary.no.session=No Session Available - -#new messages 7/3/06 -topic.message.subject.hidden=Message subject hidden -topic.message.body.hidden=Message body hidden -label.show=Show -label.hide=Hide - -#new messages 10/3/06 -page.title.monitoring.init=Forum Monitoring -monitoring.tab.statistics=Statistics -# NB monitoring.tab.edit.statistics was removed -label.save=Save -label.cancel=Cancel - -#new messages 16/3/06 -authoring.tab.basic=Basic -authoring.tab.advanced=Advanced -authoring.tab.instructions=Instructions - -#new messages 17/03/06 -page.title.authoring.init=Forum Authoring +# ========== Values for tool and library activity. Sent to Flash as part of the learning design toolkit. ====== +activity.title=Dummy Parallel Activity +activity.description=Example parallel activity - noticeboard and file submission +activity.helptext=Dummy activity created to test the parallel functionality Index: lams_build/librarypackages/nbsubmit/learninglibrary1_insert.sql =================================================================== diff -u -r0373c5b5c5e80babb23c603c578ba141174ffbfc -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_build/librarypackages/nbsubmit/learninglibrary1_insert.sql (.../learninglibrary1_insert.sql) (revision 0373c5b5c5e80babb23c603c578ba141174ffbfc) +++ lams_build/librarypackages/nbsubmit/learninglibrary1_insert.sql (.../learninglibrary1_insert.sql) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -1 +1,2 @@ -insert into lams_learning_library (learning_library_id,description,title,create_date_time) values (null,'Parallel Activity Submit and NB','Parallel Activity 1', now()); +insert into lams_learning_library (learning_library_id,description,title,valid_flag,create_date_time) +values (null,'Parallel Activity Submit and NB','Parallel Activity 1',0,now()); Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DBTask.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DBTask.java (.../DBTask.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DBTask.java (.../DBTask.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -61,7 +61,7 @@ { } - public abstract Map execute() throws DeployException; + public abstract void execute() throws DeployException; /** * Setter for property jdbcDriver. Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployConfig.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployConfig.java (.../DeployConfig.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployConfig.java (.../DeployConfig.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -95,8 +95,6 @@ */ private String lamsEarPath; - - /** * Holds the value of the package where I8N files are store * Export format org.lamsfoundation.lams.tool.web @@ -327,5 +325,40 @@ this.lamsEarPath = lamsEarPath; } + /** Used for testing purposes only */ + public void printObjectProperties() + { + System.out.println("========Object Properties======="); + System.out.println("DbUsername: " + getDbUsername()); + System.out.println("DbPassword: " + getDbPassword()); + System.out.println("DbDriverClass: " + getDbDriverClass()); + System.out.println("DbDriverUrl: " + getDbDriverUrl()); + System.out.println("LanguageFilesPackage: " + getLanguageFilesPackage()); + System.out.println("LamsEarPath: " + getLamsEarPath()); + } + + /** + * Upon deserialisation of the xml string, a new object will be created. + * The properties of this object will be copied to the calling object. + * Only copy properties if the properties are not null + * @param config + */ + protected void copyProperties(DeployConfig config) + { + if (config.getDbUsername() != null) + this.setDbUsername(config.getDbUsername()); + if (config.getDbPassword() != null) + this.setDbPassword(config.getDbPassword()); + if (config.getDbDriverUrl() != null) + this.setDbDriverUrl(config.getDbDriverUrl()); + if (config.getDbDriverClass() != null) + this.setDbDriverClass(config.getDbDriverClass()); + if (config.getLanguageFilesPackage() != null) + this.setLanguageFilesPackage(config.getLanguageFilesPackage()); + if (config.getLamsEarPath() != null) + this.setLamsEarPath(config.getLamsEarPath()); + } + + } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployFilesTask.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployFilesTask.java (.../DeployFilesTask.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployFilesTask.java (.../DeployFilesTask.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -21,23 +21,20 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.deploy; import java.io.File; -import java.util.HashMap; -import java.util.Map; /** * Deploys required files to the lams ear. * @author chris */ public class DeployFilesTask extends FilesTask { - public static final String NUM_FILES = "numFiles"; /** * Copies files to lams.ear. * @return Map containing key "numFiles", value Long */ - public Map execute() throws DeployException + public void execute() throws DeployException { File lamsEar = getLamsEar(); int size = deployFiles.size(); @@ -46,10 +43,6 @@ copyFile(deployFiles.get(i), lamsEar); } - Map map = new HashMap(); - map.put(NUM_FILES, new Long(size)); - return map; - } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployLanguageFilesTask.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployLanguageFilesTask.java (.../DeployLanguageFilesTask.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployLanguageFilesTask.java (.../DeployLanguageFilesTask.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -21,8 +21,6 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.deploy; import java.io.File; -import java.util.HashMap; -import java.util.Map; /** * Deploys required language files to the lams ear. Copies all the language files @@ -42,9 +40,8 @@ /** * Copy the application resources / language files to the lams-dictionary.jar folder - * @return Map containing key "numFiles", value Long */ - public Map execute() throws DeployException + 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. @@ -60,9 +57,6 @@ copyFile(languageFilename, dictionaryDir); count++; } - Map map = new HashMap(); - map.put(NUM_FILES, new Long(count)); - return map; } /** Gets the package directory in the dictionary directory in the LAMS ear directory and @@ -98,7 +92,6 @@ } public void setDictionaryPacket(String dictionaryPacket) { - System.out.println("DeployLanguageFile: Setting dictionary packet to "+dictionaryPacket); this.dictionaryPacket = dictionaryPacket; } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployToolConfig.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployToolConfig.java (.../DeployToolConfig.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/DeployToolConfig.java (.../DeployToolConfig.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -52,7 +52,7 @@ private static final String TOOL_TABLES_SCRIPT_PATH = "toolTablesScriptPath"; private static final String TOOL_TABLES_DELETE_SCRIPT_PATH = "toolTablesDeleteScriptPath"; private static final String DEPLOY_FILES= "deployFiles"; - public static final String LANGUAGE_FILES= "languageFiles"; + protected static final String LANGUAGE_FILES= "languageFiles"; /** * Holds value of property toolSignature. @@ -104,6 +104,7 @@ */ private ArrayList languageFiles; + /** * Creates an instance of DeployToolConfig object. */ @@ -198,7 +199,7 @@ super.setFilenames(key, filenames); if ( key.equalsIgnoreCase(LANGUAGE_FILES) ) { - languageFiles = filenames; + setLanguageFiles(filenames); } } @@ -225,6 +226,7 @@ valid = validateStringProperty(toolWebUri, TOOL_WEB_URI); valid = valid && validateStringProperty(toolContext, TOOL_CONTEXT); valid = valid && validateStringProperty(getLamsEarPath(), LAMS_EAR_PATH); + valid = valid && validateListProperty(getLanguageFiles(),LANGUAGE_FILES); valid = valid && validateStringProperty(toolInsertScriptPath, TOOL_INSERT_SCRIPT_PATH); valid = valid && validateStringProperty(toolLibraryInsertScriptPath, TOOL_LIBRARY_INSERT_SCRIPT_PATH); valid = valid && validateStringProperty(toolActivityInsertScriptPath, TOOL_ACTIVITY_INSERT_SCRIPT_PATH); @@ -234,7 +236,6 @@ valid = valid && validateStringProperty(getDbDriverClass(), DB_PASSWORD); valid = valid && validateStringProperty(getDbDriverUrl(), DB_DRIVER_URL); valid = valid && validateListProperty(deployFiles,DEPLOY_FILES); - valid = valid && validateListProperty(deployFiles,LANGUAGE_FILES); if (!valid ) throw new DeployException("Invalid deployment properties: "+validationError); @@ -246,21 +247,9 @@ * Only copy properties if the properties are not null * @param config */ - private void copyProperties(DeployToolConfig config) + protected void copyProperties(DeployToolConfig config) { - if (config.getDbUsername() != null) - this.setDbUsername(config.getDbUsername()); - if (config.getDbPassword() != null) - this.setDbPassword(config.getDbPassword()); - if (config.getDbDriverUrl() != null) - this.setDbDriverUrl(config.getDbDriverUrl()); - if (config.getDbDriverClass() != null) - this.setDbDriverClass(config.getDbDriverClass()); - if (config.getLanguageFilesPackage() != null) - this.setLanguageFilesPackage(config.getLanguageFilesPackage()); - if (config.getLamsEarPath() != null) - this.setLamsEarPath(config.getLamsEarPath()); - + super.copyProperties(config); if (config.getToolSignature() != null) this.toolSignature = config.getToolSignature(); if (config.getToolWebUri() != null) @@ -280,13 +269,14 @@ if (config.getDeployFiles() != null) this.deployFiles = config.getDeployFiles(); if (config.getLanguageFiles() != null) - this.languageFiles = config.getLanguageFiles(); + this.setLanguageFiles(config.getLanguageFiles()); + } /** Used for testing purposes only */ public void printObjectProperties() { - System.out.println("========Object Properties======="); + super.printObjectProperties(); System.out.println("Tool Signature: " + this.toolSignature); System.out.println("ToolWebUri: " + this.toolWebUri); System.out.println("ToolContext: " + this.toolContext); @@ -295,25 +285,17 @@ System.out.println("ToolActivityInsertScriptPath: " + this.toolActivityInsertScriptPath); System.out.println("ToolTableScriptPath: " + this.toolTablesScriptPath); System.out.println("ToolTableDeleteScriptPath: " + this.toolTablesDeleteScriptPath); - System.out.println("DbUsername: " + getDbUsername()); - System.out.println("DbPassword: " + getDbPassword()); - System.out.println("DbDriverClass: " + getDbDriverClass()); - System.out.println("DbDriverUrl: " + getDbDriverUrl()); - System.out.println("LanguageFilesPackage: " + getLanguageFilesPackage()); - System.out.println("LamsEarPath: " + getLamsEarPath()); ArrayList list = this.deployFiles; for(int i=0; i languageFiles) { this.languageFiles = languageFiles; } + + } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Task.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Task.java (.../Task.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Task.java (.../Task.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -32,9 +32,6 @@ /** * Executes the task. * @throws DeployException if Task cannot be executed. - * @return Map of possibly useful values, such as the new ids - * created in the database. Values will vary from Task to Task. - * */ - public Map execute() throws DeployException; + public void execute() throws DeployException; } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBActivateTask.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBActivateTask.java (.../ToolDBActivateTask.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBActivateTask.java (.../ToolDBActivateTask.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -24,7 +24,6 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; -import java.util.Map; import org.apache.commons.dbutils.DbUtils; @@ -51,9 +50,8 @@ } /** Activates the tool and library. - * @return null; */ - public Map execute() throws DeployException + public void execute() throws DeployException { Connection conn = getConnection(); try @@ -92,7 +90,6 @@ { DbUtils.closeQuietly(conn); } - return null; } /** Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBDeployTask.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBDeployTask.java (.../ToolDBDeployTask.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBDeployTask.java (.../ToolDBDeployTask.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -38,9 +38,6 @@ */ public class ToolDBDeployTask extends DBTask { - public static final String TOOL_ID = "toolId"; - public static final String LIB_ID = "libId"; - /** * Holds value of property toolInsertScriptPath. */ @@ -115,7 +112,7 @@ this.toolTablesScriptPath = toolTablesScriptPath; } - public Map execute() throws DeployException + public void execute() throws DeployException { toolInsertScript = new File(toolInsertScriptPath); toolLibraryInsertScript = new File(toolLibraryInsertScriptPath); @@ -199,11 +196,6 @@ { DbUtils.closeQuietly(conn); } - - Map map = new HashMap(); - map.put(TOOL_ID, new Long(toolId)); - map.put(LIB_ID, new Long(learningLibraryId)); - return map; } /** Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBRemoveToolEntriesTask.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBRemoveToolEntriesTask.java (.../ToolDBRemoveToolEntriesTask.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/ToolDBRemoveToolEntriesTask.java (.../ToolDBRemoveToolEntriesTask.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -38,8 +38,6 @@ */ public class ToolDBRemoveToolEntriesTask extends DBTask { - public static final String TOOL_ID = "toolId"; - public static final String LIB_ID = "libId"; /** * Holds value of property toolTablesDeleteScriptPath - deletes @@ -80,9 +78,8 @@ } /** Remove the tool and the related library activity. - * @return Map with two keys "toolId" and "libId", with Long values **/ - public Map execute() throws DeployException + public void execute() throws DeployException { long toolId = 0; long libId = 0; @@ -141,10 +138,6 @@ { DbUtils.closeQuietly(conn); } - Map map = new HashMap(); - map.put(TOOL_ID, new Long(toolId)); - map.put(LIB_ID, new Long(libId)); - return map; } private void cleanupToolTables(long toolId, long libraryId, Connection conn) throws DeployException Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/UpdateApplicationXmlTask.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/UpdateApplicationXmlTask.java (.../UpdateApplicationXmlTask.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/UpdateApplicationXmlTask.java (.../UpdateApplicationXmlTask.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -103,17 +103,14 @@ /** * Execute the task * @throws org.apache.tools.ant.DeployException In case of any problems - * @return null */ - public Map execute() throws DeployException + public void execute() throws DeployException { Document doc = parseApplicationXml(); updateApplicationXml(doc); writeApplicationXml(doc); - - return null; } /** Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/ActivityDBLanguageUpdateTask.java =================================================================== diff -u --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/ActivityDBLanguageUpdateTask.java (revision 0) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/ActivityDBLanguageUpdateTask.java (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -0,0 +1,121 @@ +/* +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +http://www.gnu.org/licenses/gpl.txt +*/ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.deploy.libraryActivity; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +import org.apache.commons.dbutils.DbUtils; +import org.lamsfoundation.lams.tool.deploy.DBTask; +import org.lamsfoundation.lams.tool.deploy.DeployException; + +/** + * Task to update a learning activity's language file column with the + * appropriate generated value. + * + */ +public class ActivityDBLanguageUpdateTask extends DBTask { + + private long activityId; + private String languageFilename; + + /** Creates a new instance of InsertToolDBRecordsTask */ + public ActivityDBLanguageUpdateTask() + { + } + + /** Activates the tool and library. + */ + public void execute() throws DeployException + { + Connection conn = getConnection(); + try + { + conn.setAutoCommit(false); + updateActivity(conn); + conn.commit(); + } + catch (SQLException sqlex) + { + try + { + DbUtils.rollback(conn); + } + catch (SQLException sqlex2) + { + throw new DeployException("Attempted to rollback db update because of "+sqlex+" but failed - cleanup maybe required (see root cause)", sqlex2); + } + throw new DeployException("Execute failed", sqlex); + } + catch (DeployException dex) + { + try + { + DbUtils.rollback(conn); + } + catch (SQLException sqlex) + { + throw new DeployException("Attempted to rollback db update because of "+dex+" but failed - cleanup maybe required (see root cause)", sqlex); + } + throw dex; + } + finally + { + DbUtils.closeQuietly(conn); + } + } + + private void updateActivity(Connection conn) throws SQLException + { + PreparedStatement stmt = null; + try + { + stmt = conn.prepareStatement("UPDATE lams_learning_activity SET language_file = ? WHERE learning_library_id = ?"); + stmt.setString(1, languageFilename); + stmt.setLong(2, activityId); + stmt.execute(); + } + finally + { + DbUtils.closeQuietly(stmt); + } + + } + + public long getActivityId() { + return activityId; + } + + public void setActivityId(long activityId) { + this.activityId = activityId; + } + + public String getLanguageFilename() { + return languageFilename; + } + + public void setLanguageFilename(String languageFilename) { + this.languageFilename = languageFilename; + } + +} Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibrary.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibrary.java (.../DeployLibrary.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibrary.java (.../DeployLibrary.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -23,8 +23,8 @@ import java.io.File; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; -import java.util.Map; import org.lamsfoundation.lams.tool.deploy.DeployLanguageFilesTask; @@ -44,51 +44,65 @@ } + public static void main (String[] args) { if ((args.length < 1) || (args[0] == null)) { throw new IllegalArgumentException("Usage: Deployer ." ); } - String languageFileDirectoryName = args[1]; - File languageFileDirectory = null; - if ( languageFileDirectoryName != null && languageFileDirectoryName.trim().length() > 0) { - languageFileDirectory = new File(languageFileDirectoryName); - if ( ! languageFileDirectory.exists() || ! languageFileDirectory.isDirectory() - || ! languageFileDirectory.canRead() ) { - throw new IllegalArgumentException("Unable to access language files. Directory "+languageFileDirectory - +" is missing, is not a directory or is not readable."); - } - } - System.out.println("Starting Library Deploy"); try { DeployLibraryConfig config= new DeployLibraryConfig(args[0]); - LibraryDBDeployTask deployTask = new LibraryDBDeployTask(config); - Map deployValues = deployTask.execute(); - System.out.println("Updated database"); + LibraryDBDeployTask dbDeployTask = new LibraryDBDeployTask(config); + dbDeployTask.execute(); + System.out.println("Inserted activities into database"); - if ( languageFileDirectory != null ) { - String[] files = languageFileDirectory.list(); - if ( files != null && files.length > 0 ) { - // generate package name in which the language files are placed. - Long learningLibraryId = (Long) deployValues.get(LibraryDBDeployTask.LEARNING_LIBRARY_ID); - String packagePath = "org.lamsfoundation.lams.library.llid"+learningLibraryId.toString(); - - // copy the files to the lams-dictionary.jar + List libraries = dbDeployTask.getLearningLibraries(); + Iterator iter = libraries.iterator(); + while ( iter.hasNext() ) { + + LearningLibrary lib = (LearningLibrary) iter.next(); + String languageFileDirectory = lib.getLanguageFileDirectory(); + if ( languageFileDirectory != null ) { + + // generate package names in which the language files are placed. + String packagePath = "org.lamsfoundation.lams.library.llid"+lib.getLearningLibraryId(); + + // copy the files to the lams-dictionary.jar DeployLanguageFilesTask deployLanguageFilesTask = new DeployLanguageFilesTask(); deployLanguageFilesTask.setLamsEarPath(config.getLamsEarPath()); deployLanguageFilesTask.setDictionaryPacket(packagePath); - List fileList = createLanguageFilesList(languageFileDirectoryName,files); - deployLanguageFilesTask.setDeployFiles(fileList); + deployLanguageFilesTask.setDeployFiles(createLanguageFilesList(languageFileDirectory)); deployLanguageFilesTask.execute(); - } - System.out.println("Copied language files"); - } + + System.out.println("Updating activity with the language file path"); + ActivityDBLanguageUpdateTask activityDBTask = new ActivityDBLanguageUpdateTask(); + activityDBTask.setDbUsername(config.getDbUsername()); + activityDBTask.setDbPassword(config.getDbPassword()); + activityDBTask.setDbDriverClass(config.getDbDriverClass()); + activityDBTask.setDbDriverUrl(config.getDbDriverUrl()); + activityDBTask.setActivityId(lib.getParentActivityId()); + activityDBTask.setLanguageFilename(packagePath+'.'+lib.getLanguageFileRoot()); + activityDBTask.execute(); + } + + + System.out.println("Activating learning library "+lib.getLearningLibraryId()); + LibraryDBActivateTask libActivateTask = new LibraryDBActivateTask(); + libActivateTask.setDbUsername(config.getDbUsername()); + libActivateTask.setDbPassword(config.getDbPassword()); + libActivateTask.setDbDriverClass(config.getDbDriverClass()); + libActivateTask.setDbDriverUrl(config.getDbDriverUrl()); + libActivateTask.setLearningLibraryId(lib.getLearningLibraryId()); + libActivateTask.execute(); + + } + System.out.println("Library Deployed"); } @@ -106,13 +120,20 @@ * Sets the list of file paths to operate on. * @param deployFiles New value of property deployFiles. */ - private static List createLanguageFilesList(String path, String[] deployFilesArray) + private static List createLanguageFilesList(String path) { - List deployFiles = new ArrayList(deployFilesArray!=null?deployFilesArray.length:0); - for ( String filename: deployFilesArray ) { - deployFiles.add(path+File.separator+filename); - } - return deployFiles; + List deployFiles = new ArrayList(); + if ( path != null ) { + File dir = new File(path); + if ( ! dir.exists() || ! dir.isDirectory() || ! dir.canRead() ) { + System.err.println("Unable to copy language files - path is invalid: "+path); + } else { + for ( String filename: dir.list() ) { + deployFiles.add(path+File.separator+filename); + } + } + } + return deployFiles; } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibraryConfig.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibraryConfig.java (.../DeployLibraryConfig.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/DeployLibraryConfig.java (.../DeployLibraryConfig.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -50,6 +50,7 @@ private ArrayList learningLibraryList; + public DeployLibraryConfig() { xstream.alias(ROOT_ELEMENT, DeployLibraryConfig.class); @@ -106,29 +107,17 @@ * Only copy properties if the properties are not null * @param config */ - private void copyProperties(DeployLibraryConfig config) + protected void copyProperties(DeployLibraryConfig config) { - if (config.getDbUsername() != null) - this.setDbUsername(config.getDbUsername()); - if (config.getDbPassword() != null) - this.setDbPassword(config.getDbPassword()); - if (config.getDbDriverUrl() != null) - this.setDbDriverUrl(config.getDbDriverUrl()); - if (config.getDbDriverClass() != null) - this.setDbDriverClass(config.getDbDriverClass()); - if (config.getLearningLibraryList() != null) + super.copyProperties(config); + if (config.getLearningLibraryList() != null) this.setLearningLibraryList(config.getLearningLibraryList()); - if (config.getLamsEarPath() != null) - this.setLamsEarPath(config.getLamsEarPath()); + } public void printObjectProperties() { - System.out.println("========Object Properties======="); - System.out.println("DbUsername: " + getDbUsername()); - System.out.println("DbPassword: " + getDbPassword()); - System.out.println("DbDriverClass: " + getDbDriverClass()); - System.out.println("DbDriverUrl: " + getDbDriverUrl()); + super.printObjectProperties(); ArrayList learningLibraries = getLearningLibraryList(); for (int j=0; j ToolActivityScriptPath: " + a.getToolActivityInsertScriptPath()); } } - System.out.println("========End Object Properties======="); } public void validateProperties() throws DeployException { @@ -155,7 +143,6 @@ valid = valid && validateStringProperty(getDbPassword(), DB_PASSWORD); valid = valid && validateStringProperty(getDbDriverClass(), DB_PASSWORD); valid = valid && validateStringProperty(getDbDriverUrl(), DB_DRIVER_URL); - valid = valid && validateListProperty(getLearningLibraryList(),LEARNING_LIBRARY_LIST); valid = valid && validateStringProperty(getLamsEarPath(), LAMS_EAR_PATH); //iterate through learning libraries Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LearningLibrary.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LearningLibrary.java (.../LearningLibrary.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LearningLibrary.java (.../LearningLibrary.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -31,17 +31,25 @@ private String libraryInsertScriptPath; private String templateActivityInsertScriptPath; private ArrayList toolActivityList; + private long learningLibraryId; + private long parentActivityId; + private String languageFileDirectory; + private String languageFileRoot; + public LearningLibrary() { } - public LearningLibrary(String libraryInsertScript, String templateActivityInsertScript, ArrayList toolActivityList) + public LearningLibrary(String libraryInsertScript, String templateActivityInsertScript, + ArrayList toolActivityList, String languageFileDirectory, String languageFileRoot) { this.libraryInsertScriptPath = libraryInsertScript; this.templateActivityInsertScriptPath = templateActivityInsertScript; this.toolActivityList = toolActivityList; + this.languageFileDirectory = languageFileDirectory; + this.languageFileRoot = languageFileRoot; } @@ -83,4 +91,40 @@ public void setLibraryInsertScriptPath(String libraryInsertScriptPath) { this.libraryInsertScriptPath = libraryInsertScriptPath; } + + public long getLearningLibraryId() { + return learningLibraryId; + } + + public void setLearningLibraryId(long learningLibraryId) { + this.learningLibraryId = learningLibraryId; + } + + public String getLanguageFileDirectory() { + return languageFileDirectory; + } + + public void setLanguageFileDirectory(String languageFileDirectory) { + this.languageFileDirectory = languageFileDirectory; + } + + public long getParentActivityId() { + return parentActivityId; + } + + public void setParentActivityId(long parentActivityId) { + this.parentActivityId = parentActivityId; + } + + /** Get the "root" of the language file name. This will normally be "ApplicationResources". + * This is converted into __.properties by Java. + * @return + */ + public String getLanguageFileRoot() { + return languageFileRoot; + } + + public void setLanguageFileRoot(String languageFileRoot) { + this.languageFileRoot = languageFileRoot; + } } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LibraryDBActivateTask.java =================================================================== diff -u --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LibraryDBActivateTask.java (revision 0) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LibraryDBActivateTask.java (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -0,0 +1,118 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + * + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License + *along with this program; if not, write to the Free Software + *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + *USA + * + *http://www.gnu.org/licenses/gpl.txt + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.deploy.libraryActivity; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Map; + +import org.apache.commons.dbutils.DbUtils; +import org.lamsfoundation.lams.tool.deploy.DBTask; +import org.lamsfoundation.lams.tool.deploy.DeployException; + +/** + * Task activates tool records int the lams db. + * @author chris + * + * + */ +public class LibraryDBActivateTask extends DBTask +{ + /** + * Holds value of property learningLibraryId. + */ + private long learningLibraryId; + + /** Creates a new instance of InsertToolDBRecordsTask */ + public LibraryDBActivateTask() + { + } + + /** Activates the tool and library. + */ + public void execute() throws DeployException + { + Connection conn = getConnection(); + try + { + conn.setAutoCommit(false); + activateLibrary(learningLibraryId, conn); + conn.commit(); + } + catch (SQLException sqlex) + { + try + { + DbUtils.rollback(conn); + } + catch (SQLException sqlex2) + { + throw new DeployException("Attempted to rollback db activate because of "+sqlex+" but failed - cleanup maybe required (see root cause)", sqlex2); + } + throw new DeployException("Execute failed", sqlex); + } + catch (DeployException dex) + { + try + { + DbUtils.rollback(conn); + } + catch (SQLException sqlex) + { + throw new DeployException("Attempted to rollback db activate because of "+dex+" but failed - cleanup maybe required (see root cause)", sqlex); + } + throw dex; + } + finally + { + DbUtils.closeQuietly(conn); + } + } + + /** + * Sets the id of the tools library. + * @param learningLibraryId New value of property learningLibraryId. + */ + public void setLearningLibraryId(long learningLibraryId) + { + + this.learningLibraryId = learningLibraryId; + } + + private void activateLibrary(long libraryId, Connection conn) throws SQLException + { + PreparedStatement stmt = null; + try + { + stmt = conn.prepareStatement("UPDATE lams_learning_library SET valid_flag = 1 WHERE learning_library_id = ?"); + stmt.setLong(1, libraryId); + stmt.execute(); + } + finally + { + DbUtils.closeQuietly(stmt); + } + + } + +} Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LibraryDBDeployTask.java =================================================================== diff -u -rc96a2e5fb4ffc597565170852f722298900fafdb -r1ec30cb981a3c40c5fd75563afd3d27475ee918e --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LibraryDBDeployTask.java (.../LibraryDBDeployTask.java) (revision c96a2e5fb4ffc597565170852f722298900fafdb) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/libraryActivity/LibraryDBDeployTask.java (.../LibraryDBDeployTask.java) (revision 1ec30cb981a3c40c5fd75563afd3d27475ee918e) @@ -74,13 +74,10 @@ * a) Find the tool_id that matches the tool_signature * b) Update tool activity script with tool_id and parent_activity_id equal to the activity_id from step 3 * c) run the tool activity script - * - * @return Map with one key "learningLibraryId" a with Long value */ - public Map execute() throws DeployException + public void execute() throws DeployException { - long learningLibraryId = -1; Connection conn = getConnection(); try { @@ -94,7 +91,7 @@ String libraryInsertScriptPath = learningLibrary.getLibraryInsertScriptPath(); File libraryInsertScript = new File(libraryInsertScriptPath); - learningLibraryId = runLibraryScript(readFile(libraryInsertScript), conn, "lams_learning_library"); + long learningLibraryId = runLibraryScript(readFile(libraryInsertScript), conn, "lams_learning_library"); log.debug("The learning_library_id is learningLibraryId"); @@ -108,6 +105,9 @@ long parentActivityId = runLibraryScript(libraryActivityScriptSQL, conn, "lams_learning_activity"); log.debug("Parent Learning Activity ID is: " + parentActivityId); + learningLibrary.setLearningLibraryId(learningLibraryId); + learningLibrary.setParentActivityId(learningLibraryId); + ArrayList toolActivities = learningLibrary.getToolActivityList(); Iterator j = toolActivities.iterator(); @@ -163,10 +163,6 @@ DbUtils.closeQuietly(conn); } - Map map = new HashMap(); - map.put(LEARNING_LIBRARY_ID, new Long(learningLibraryId)); - return map; - } @@ -268,4 +264,5 @@ public void setLearningLibraries(ArrayList learningLibraries) { this.learningLibraries = learningLibraries; } + }