KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > jbuilder > build > DodsBuilder


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  */

22 package org.enhydra.kelp.jbuilder.build;
23
24 // ToolBox imports
25
import org.enhydra.tool.common.ToolException;
26
27 // JBuilder imports
28
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 // Kelp imports
38
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 /**
49  * This class controls building and maintaining properties for HTML/XML files
50  * using the Enhydra XMLC Compiler.
51  *
52  */

53 public class DodsBuilder implements Builder {
54
55     public DodsBuilder() {}
56
57     /**
58      * Register open tool
59      *
60      */

61     public static void initOpenTool(byte majorVersion, byte minorVersion) {
62         if (KelpInfo.isClassPathComplete()) {
63             BuilderManager.registerBuilder(new DodsBuilder());
64         }
65     }
66
67     /**
68      * Called by the Build System when make or rebuild occurs
69      */

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 JavaDoc 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          // There is both a map and a list
106
buildProcess.putTask(DodsBuildTask.SHARED_KEY, task);
107           buildProcess.getBuildTaskList().add(task);
108       }
109       return task;
110     }
111 }
112
Popular Tags