Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddWebAppToApplicationXmlTask.java =================================================================== diff -u -ra174a94fcb9db22380a89926f460afbef0216c91 -ra4ffc995ef80182d5703c580c641f69a4b9a8250 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddWebAppToApplicationXmlTask.java (.../AddWebAppToApplicationXmlTask.java) (revision a174a94fcb9db22380a89926f460afbef0216c91) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddWebAppToApplicationXmlTask.java (.../AddWebAppToApplicationXmlTask.java) (revision a4ffc995ef80182d5703c580c641f69a4b9a8250) @@ -46,12 +46,12 @@ //create new web-uri element in the web element Element webUriElement = doc.createElement("web-uri"); - webUriElement.appendChild(doc.createTextNode(weburi)); + webUriElement.appendChild(doc.createTextNode(webUri)); webElement.appendChild(webUriElement); //create new context root element in the web element Element contextRootElement = doc.createElement("context-root"); - contextRootElement.appendChild(doc.createTextNode(contextroot)); + contextRootElement.appendChild(doc.createTextNode(contextRoot)); webElement.appendChild(contextRootElement); } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Deploy.java =================================================================== diff -u -r5a1e4424a7fee54a37abf1504b699077bd9f41fa -ra4ffc995ef80182d5703c580c641f69a4b9a8250 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Deploy.java (.../Deploy.java) (revision 5a1e4424a7fee54a37abf1504b699077bd9f41fa) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/Deploy.java (.../Deploy.java) (revision a4ffc995ef80182d5703c580c641f69a4b9a8250) @@ -23,8 +23,28 @@ */ public static void main(String[] args) throws Exception { - + if (args.length != 1) + { + throw new Exception("Usage: Deployer "); + } DeployConfig config = new DeployConfig(args[1]); + + //db deploy + + //add required elements to the application xml + AddWebAppToApplicationXmlTask addWebAppTask = new AddWebAppToApplicationXmlTask(); + addWebAppTask.setLamsEarPath(config.getLamsEarPath()); + addWebAppTask.setContextRoot(config.getToolContextRoot()); + addWebAppTask.setWebUri(config.getToolWebUri()); + addWebAppTask.execute(); + + //deploy files + DeployFilesTask deployFilesTask = new DeployFilesTask(); + deployFilesTask.setLamsEarPath(config.getLamsEarPath()); + deployFilesTask.setDeployFiles(config.getDeployFiles()); + deployFilesTask.execute(); + + //db activation } } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/RemoveWebAppFromApplicationXmlTask.java =================================================================== diff -u -ra174a94fcb9db22380a89926f460afbef0216c91 -ra4ffc995ef80182d5703c580c641f69a4b9a8250 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/RemoveWebAppFromApplicationXmlTask.java (.../RemoveWebAppFromApplicationXmlTask.java) (revision a174a94fcb9db22380a89926f460afbef0216c91) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/RemoveWebAppFromApplicationXmlTask.java (.../RemoveWebAppFromApplicationXmlTask.java) (revision a4ffc995ef80182d5703c580c641f69a4b9a8250) @@ -46,12 +46,12 @@ //find & remove web uri element NodeList webUriNodeList = webElement.getElementsByTagName("web-uri"); - Element matchingWebUriElement = findElementWithMatchingText(weburi, webUriNodeList); + Element matchingWebUriElement = findElementWithMatchingText(webUri, webUriNodeList); webElement.removeChild(matchingWebUriElement); //find & remove context root element NodeList contextRootNodeList = webElement.getElementsByTagName("context-root"); - Element matchingContextRootElement = findElementWithMatchingText(contextroot, contextRootNodeList); + Element matchingContextRootElement = findElementWithMatchingText(contextRoot, contextRootNodeList); webElement.removeChild(matchingContextRootElement); } Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/UpdateApplicationXmlTask.java =================================================================== diff -u -ra174a94fcb9db22380a89926f460afbef0216c91 -ra4ffc995ef80182d5703c580c641f69a4b9a8250 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/UpdateApplicationXmlTask.java (.../UpdateApplicationXmlTask.java) (revision a174a94fcb9db22380a89926f460afbef0216c91) +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/UpdateApplicationXmlTask.java (.../UpdateApplicationXmlTask.java) (revision a4ffc995ef80182d5703c580c641f69a4b9a8250) @@ -49,18 +49,21 @@ /** * The application.xml file. */ - protected File appxml; + protected File lamsEarPath; /** * The value of the web-uri element. */ - protected String weburi; + protected String webUri; /** * The value of the context root element. */ - protected String contextroot; + protected String contextRoot; + + private String applicationXmlPath; + /** Creates a new instance of UpdateApplicationXmlTask */ public UpdateApplicationXmlTask() { @@ -71,31 +74,30 @@ * Sets the location of the application xml file to be modified. * @param appxml New value of property appxml. */ - public void setAppxml(final File appxml) - + public void setLamsEarPath(final String lasmEarPath) { - - this.appxml = appxml; + this.lamsEarPath = lamsEarPath; + this.applicationXmlPath = lamsEarPath+"/META-INF/application.xml"; } /** * Sets the uri of the web app to be added. * @param weburi New value of property weburi. */ - public void setWeburi(final String weburi) - { - - this.weburi = weburi; + public void setWebUri(final java.lang.String webUri) + { + this.webUri = webUri; } /** * Sets the context root of the web app to be added. * @param contextroot New value of property contextroot. */ - public void setContextroot(final String contextroot) + public void setContextRoot(final java.lang.String contextRoot) + { - this.contextroot = contextroot; + this.contextRoot = contextRoot; } /** @@ -128,7 +130,7 @@ DOMSource source = new DOMSource(doc); // Prepare the output file - StreamResult result = new StreamResult(appxml); + StreamResult result = new StreamResult(applicationXmlPath); // Write the DOM document to the file // Get Transformer @@ -175,7 +177,7 @@ //get application xml as dom doc DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); - return builder.parse(appxml); + return builder.parse(applicationXmlPath); } catch (ParserConfigurationException pex) { @@ -248,4 +250,6 @@ * @throws org.apache.tools.ant.DeployException in case of errors */ protected abstract void updateApplicationXml(Document doc, Element webElement) throws DeployException; + + }