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 DodsBuilder implements Builder { 54 55 public DodsBuilder() {} 56 57 61 public static void initOpenTool(byte majorVersion, byte minorVersion) { 62 if (KelpInfo.isClassPathComplete()) { 63 BuilderManager.registerBuilder(new DodsBuilder()); 64 } 65 } 66 67 70 public void updateBuildProcess(BuildProcess buildProcess, 71 Node nativeNode) { 72 73 DodsBuildTask task = null; 74 TextFileNode nativeTextNode = null; 75 OtterTemplateNode otterTemplateNode = null; 76 OtterTextFileNode otterTextNode = null; 77 String stringIn = null; 78 boolean selected = false; 79 if (nativeNode instanceof Project) { 80 task = findTask(buildProcess); 81 task.setNodeOnly(false); 82 83 } else if (nativeNode instanceof TextFileNode) { 84 nativeTextNode = (TextFileNode) nativeNode; 85 otterTextNode = new PrimeTextFileNode(nativeTextNode); 86 if (PathUtil.isTemplate(otterTextNode)) { 87 try { 88 otterTemplateNode = new PrimeTemplateNode(nativeTextNode); 89 } catch (ToolException e) { 90 e.printStackTrace(); 91 } 92 } 93 } 94 if (otterTemplateNode != null && otterTemplateNode.isSelected()) { 95 task = findTask(buildProcess); 96 task.addNode(otterTemplateNode); 97 } 98 } 99 100 private DodsBuildTask findTask(BuildProcess buildProcess) { 101 DodsBuildTask task = null; 102 task = (DodsBuildTask) buildProcess.getTask(DodsBuildTask.SHARED_KEY); 103 if (task == null) { 104 task = new DodsBuildTask(); 105 buildProcess.putTask(DodsBuildTask.SHARED_KEY, task); 107 buildProcess.getBuildTaskList().add(task); 108 } 109 return task; 110 } 111 } 112 | Popular Tags |