Permalink
Browse files

some more component types, added a little helper to get a list of com…

…ponents by type.
  • Loading branch information...
1 parent e8fdbe5 commit 52fefcb9918d470be780ed73b91d08c628f31a16 Allen Fogleson committed Mar 12, 2012
Showing with 245 additions and 151 deletions.
  1. +4 −2 src/main/java/com/guidewire/accel/deployment/DeployableComponent.java
  2. +12 −2 src/main/java/com/guidewire/accel/deployment/Deployer.java
  3. +5 −0 src/main/java/com/guidewire/accel/deployment/impl/AntBuildComponent.java
  4. +13 −1 src/main/java/com/guidewire/accel/deployment/impl/DataExtensionComponent.java
  5. +51 −0 src/main/java/com/guidewire/accel/deployment/impl/DisplayKeyComponent.java
  6. +5 −0 src/main/java/com/guidewire/accel/deployment/impl/GosuComponent.java
  7. +4 −1 src/main/java/com/guidewire/accel/deployment/impl/LibraryComponent.java
  8. +5 −0 src/main/java/com/guidewire/accel/deployment/impl/MavenBuildComponent.java
  9. +11 −2 src/main/java/com/guidewire/accel/deployment/impl/MessagingComponent.java
  10. +5 −0 src/main/java/com/guidewire/accel/deployment/impl/PCFComponent.java
  11. +8 −1 src/main/java/com/guidewire/accel/deployment/impl/PluginComponent.java
  12. +6 −1 src/main/java/com/guidewire/accel/deployment/impl/WebServiceComponent.java
  13. +1 −1 src/main/java/com/guidewire/accel/deployment/impl/{ → enums}/MessageImplementationType.java
  14. +45 −0 src/main/java/com/guidewire/accel/deployment/util/ComponentList.java
  15. +6 −7 src/main/java/com/guidewire/accel/parser/AcceleratorParser.java
  16. +2 −2 src/main/java/com/guidewire/accel/parser/Messaging/MessagingConfigParser.java
  17. +11 −131 src/main/java/com/guidewire/accel/util/FileUtil.java
  18. +51 −0 src/test/java/com/guidewire/com/guidewire/accel/deployment/impl/ComponentListTest.java
@@ -1,11 +1,11 @@
package com.guidewire.accel.deployment;
/**
- * Created with IntelliJ IDEA.
+ *
* User: afogleson
* Date: 3/10/12
* Time: 12:25 PM
- * To change this template use File | Settings | File Templates.
+ *
*/
public interface DeployableComponent {
@@ -15,4 +15,6 @@
* @return true if the component deployed.
*/
public boolean deploy();
+
+ public String getComponentName();
}
@@ -12,12 +12,22 @@
*/
public class Deployer {
+ /**
+ *
+ * The parser is responsible for finding and creating all the components. The deployer is responsible
+ * for ordering them, then deploying them in the correct order.
+ *
+ * @param components a List of all the @DeployableComponents that were found through parsing.
+ * @throws InvalidComponentException
+ */
public void deploy(List<DeployableComponent> components) throws InvalidComponentException {
+
//I am not sure how to handle a failure mid stream....
+ //And we need some ordering here. we should probably not just run through the components
+ //Especially since you could have ant/ivy dependent on a maven build, and a library
+ //component dependent on ant or maven...
for (DeployableComponent component : components) {
component.deploy();
}
}
-
-
}
@@ -48,4 +48,9 @@ public boolean deploy() {
}
return success;
}
+
+ @Override
+ public String getComponentName() {
+ return "antBuildComponent";
+ }
}
@@ -9,8 +9,20 @@
*/
public class DataExtensionComponent implements DeployableComponent {
+ /**
+ *
+ * Deploying a data extension is a bit more arduous than just copying an eti or etx file.
+ *
+ *
+ * @return
+ */
@Override
public boolean deploy() {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
+ }
+
+ @Override
+ public String getComponentName() {
+ return "dataExtensionComponent";
}
}
@@ -0,0 +1,51 @@
+package com.guidewire.accel.deployment.impl;
+
+import com.guidewire.accel.deployment.DeployableComponent;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: afogleson
+ * Date: 3/12/12
+ * Time: 10:29 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class DisplayKeyComponent implements DeployableComponent {
+
+ private File displaykeys;
+
+ /**
+ * this is not that hard... the hardest thing is determining the available locales
+ *
+ * @return true if the displaykeys have been added/modified.
+ *
+ */
+ @Override
+ public boolean deploy() {
+ //figure out our displaykeys. Need to check for locales.
+
+ try {
+ Properties props = new Properties();
+ FileInputStream in = new FileInputStream(displaykeys);
+ props.load(in);
+ in.close();
+ Properties prodKeys = new Properties();
+
+
+ //we now have our displaykeys.
+
+ }
+ catch(Throwable t) {
+
+ }
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public String getComponentName() {
+ return "displayKeyComponent";
+ }
+}
@@ -31,4 +31,9 @@ public GosuComponent(File gosuFile) {
public boolean deploy() {
return false; //To change body of implemented methods use File | Settings | File Templates.
}
+
+ @Override
+ public String getComponentName() {
+ return "gosuComponent";
+ }
}
@@ -30,5 +30,8 @@ public boolean deploy() {
return false;
}
-
+ @Override
+ public String getComponentName() {
+ return "libraryComponent";
+ }
}
@@ -46,4 +46,9 @@ public boolean deploy() {
}
return deployed;
}
+
+ @Override
+ public String getComponentName() {
+ return "mavenBuildComponent";
+ }
}
@@ -1,6 +1,7 @@
package com.guidewire.accel.deployment.impl;
import com.guidewire.accel.deployment.DeployableComponent;
+import com.guidewire.accel.deployment.impl.enums.MessageImplementationType;
import com.guidewire.accel.parser.Messaging.MessagingConfigParser;
import com.guidewire.accel.parser.Messaging.pojo.Destination;
import com.guidewire.accel.parser.Messaging.pojo.MessagingConfig;
@@ -370,6 +371,8 @@ public boolean deploy() {
if (dest != null) {
//What are we going to do on this failure? there are likely efr that rely on this destinationID
}
+ //if we assume we fail when the destinationID is in use.....
+ //go ahead and get ready to deploy everything.
String requestPluginXml = null;
String transportPluginXml = null;
String replyPluginXml = null;
@@ -385,11 +388,17 @@ public boolean deploy() {
replyPluginXml = generatePluginXml(replyName, replyClass, replyParams, replyType, replyPluginDir, "Reply");
}
- //SO first lets
+ //So, now we have all the plugin.xml we need to create a new destination and add it to our messaging config.
- //plugins go in productRoot + registrydir + pluginName + .xml
+
+ //plugins go in productRoot + /modules/configuration/config/olugins/registry + pluginName + .xml
return false;
}
+
+ @Override
+ public String getComponentName() {
+ return "messagingComponent";
+ }
}
@@ -43,4 +43,9 @@ public boolean deploy() {
}
return deployed;
}
+
+ @Override
+ public String getComponentName() {
+ return "pcfComponent";
+ }
}
@@ -5,16 +5,23 @@
import java.util.HashMap;
/**
+ *
* User: afogleson
* Date: 3/10/12
* Time: 1:56 PM
+ *
*/
public class PluginComponent implements DeployableComponent {
private HashMap<String, String> paramValues;
@Override
public boolean deploy() {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
+ }
+
+ @Override
+ public String getComponentName() {
+ return "pluginComponent";
}
}
@@ -13,6 +13,11 @@
@Override
public boolean deploy() {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
+ }
+
+ @Override
+ public String getComponentName() {
+ return "webServiceComponent";
}
}
@@ -1,4 +1,4 @@
-package com.guidewire.accel.deployment.impl;
+package com.guidewire.accel.deployment.impl.enums;
/**
* User: afogleson
@@ -0,0 +1,45 @@
+package com.guidewire.accel.deployment.util;
+
+import com.guidewire.accel.deployment.DeployableComponent;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+/**
+ *
+ * User: afogleson
+ * Date: 3/12/12
+ * Time: 9:37 PM
+ *
+ */
+public class ComponentList {
+
+ HashMap<String, List> componentList = new HashMap<String, List>();
+
+ public void addComponent(DeployableComponent component) {
+ String key = component.getComponentName();
+ List l = componentList.get(key);
+ if(l == null) {
+ l = new ArrayList<DeployableComponent>();
+ }
+ l.add(component);
+ componentList.remove(key);
+ componentList.put(key, l);
+ }
+
+ public List<DeployableComponent> getComponentList(String componentName) {
+ return componentList.get(componentName);
+ }
+
+ public DeployableComponent[] getAllComponents() {
+ ArrayList<DeployableComponent> list = new ArrayList<DeployableComponent>();
+ Set<String> keys = componentList.keySet();
+ for(String key : keys) {
+ List<DeployableComponent> components = componentList.get(key);
+ list.addAll(components);
+ }
+ return list.toArray(new DeployableComponent[0]);
+ }
+}
@@ -5,6 +5,7 @@
import com.guidewire.accel.deployment.impl.GosuComponent;
import com.guidewire.accel.deployment.impl.MavenBuildComponent;
import com.guidewire.accel.deployment.impl.PCFComponent;
+import com.guidewire.accel.deployment.util.ComponentList;
import com.guidewire.accel.util.FileUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -25,13 +26,13 @@
public class AcceleratorParser {
private File accelRoot;
- private ArrayList<DeployableComponent> components;
+ private ComponentList components = new ComponentList();
public AcceleratorParser(File accelRoot) {
this.accelRoot = accelRoot;
}
- public ArrayList<DeployableComponent> getAcceleratorComponents() {
+ public ComponentList getAcceleratorComponents() {
return components;
}
@@ -92,7 +93,8 @@ private void parse(Node node) {
}
MavenBuildComponent component = new MavenBuildComponent(new File(directory), goals);
addToComponents(component);
- } else if (node.getNodeName().equals("antBuild")) {
+ }
+ else if (node.getNodeName().equals("antBuild")) {
String directory = accelRoot.getAbsolutePath() + File.separator;
File buildFile = new File(directory + "build.xml");
String target = "";
@@ -160,9 +162,6 @@ private void parse(Node node) {
}
private void addToComponents(DeployableComponent component) {
- if (components == null) {
- components = new ArrayList<DeployableComponent>();
- }
- components.add(component);
+ components.addComponent(component);
}
}
@@ -12,11 +12,11 @@
import java.io.File;
/**
- * Created by IntelliJ IDEA.
+ *
* User: tp23161
* Date: 12/03/12
* Time: 13:53
- * To change this template use File | Settings | File Templates.
+ *
*/
public class MessagingConfigParser {
Oops, something went wrong.

0 comments on commit 52fefcb

Please sign in to comment.