1 22 package org.enhydra.kelp.jbuilder.build; 23 24 import org.enhydra.tool.common.ToolException; 26 27 import com.borland.primetime.node.TextFileNode; 29 import com.borland.primetime.node.FileNode; 30 import com.borland.primetime.node.Node; 31 import com.borland.primetime.node.Project; 32 import com.borland.primetime.build.Builder; 33 import com.borland.primetime.build.BuildProcess; 34 import com.borland.primetime.build.BuilderManager; 35 36 37 import org.enhydra.kelp.KelpInfo; 39 import org.enhydra.kelp.common.PathUtil; 40 import org.enhydra.kelp.common.PropUtil; 41 import org.enhydra.kelp.common.node.OtterTextFileNode; 42 import org.enhydra.kelp.common.node.OtterTemplateNode; 43 import org.enhydra.kelp.jbuilder.node.PrimeTemplateNode; 44 import org.enhydra.kelp.jbuilder.node.PrimeTextFileNode; 45 import org.enhydra.kelp.jbuilder.properties.DeployProperties; 46 47 48 53 public class DeployBuilder implements Builder { 54 55 56 public DeployBuilder() {} 57 58 62 public static void initOpenTool(byte majorVersion, byte minorVersion) { 63 64 if (KelpInfo.isClassPathComplete()) { 65 BuilderManager.registerBuilder(new DeployBuilder()); 66 } 67 } 68 69 72 public void updateBuildProcess(BuildProcess buildProcess, 73 Node nativeNode) { 74 75 DeployBuildTask task = null; 76 TextFileNode nativeTextNode = null; 77 OtterTemplateNode otterTemplateNode = null; 78 OtterTextFileNode otterTextNode = null; 79 String stringIn = null; 80 boolean selected = false; 81 if (nativeNode instanceof Project) { 82 task = findTask(buildProcess); 83 task.setNodeOnly(false); 84 85 } else if (nativeNode instanceof TextFileNode) { 86 nativeTextNode = (TextFileNode) nativeNode; 87 otterTextNode = new PrimeTextFileNode(nativeTextNode); 88 if (PathUtil.isTemplate(otterTextNode)) { 89 try { 90 otterTemplateNode = new PrimeTemplateNode(nativeTextNode); 91 } catch (ToolException e) { 92 e.printStackTrace(); 93 } 94 } 95 } 96 if (otterTemplateNode != null && otterTemplateNode.isSelected()) { 97 task = findTask(buildProcess); 98 task.addNode(otterTemplateNode); 99 } 100 } 101 102 private DeployBuildTask findTask(BuildProcess buildProcess) { 103 DeployBuildTask task = null; 104 task = (DeployBuildTask) buildProcess.getTask(DeployBuildTask.SHARED_KEY); 105 if (task == null) { 106 task = new DeployBuildTask(); 107 buildProcess.putTask(DeployBuildTask.SHARED_KEY, task); 109 buildProcess.getBuildTaskList().add(task); 110 } 111 return task; 112 } 113 } 114 | Popular Tags |