KickJava   Java API By Example, From Geeks To Geeks.

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


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.PathHandle;
26
27 // JBuilder imports
28
import com.borland.jbuilder.node.JBProject;
29 import com.borland.primetime.ide.Browser;
30 import com.borland.primetime.node.Node;
31 import com.borland.primetime.node.TextFileNode;
32 import com.borland.primetime.build.Builder;
33 import com.borland.primetime.build.BuildProcess;
34 import com.borland.primetime.build.BuilderManager;
35
36 // Kelp imports
37
import org.enhydra.kelp.KelpInfo;
38 import org.enhydra.kelp.common.node.OtterDocumentNode;
39 import org.enhydra.kelp.common.node.OtterProject;
40 import org.enhydra.kelp.common.node.OtterXMLCNode;
41 import org.enhydra.kelp.jbuilder.node.PrimeDocumentNode;
42 import org.enhydra.kelp.jbuilder.node.PrimeProject;
43
44 // Standard imports
45
import java.util.List JavaDoc;
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 XMLCBuilder implements Builder {
54
55     public XMLCBuilder() {}
56
57     /**
58      * Register open tool
59      *
60      */

61     public static void initOpenTool(byte majorVersion, byte minorVersion) {
62         try {
63           KelpInfo.verifyIDEClassPath();
64           BuilderManager.registerBuilder(new XMLCBuilder());
65         } catch (Exception JavaDoc e) {
66           System.err.println(e.getMessage());
67         }
68     }
69
70     /**
71      * Called by the Build System when make or rebuild occurs
72      */

73     public void updateBuildProcess(BuildProcess buildProcess,
74                                    Node nativeNode) {
75
76         OtterDocumentNode docNode = null;
77         OtterProject otterProject = null;
78         TextFileNode textNode = null;
79         OtterXMLCNode xmlcNode = null;
80         PathHandle path = null;
81         XMLCBuildTask task = null;
82
83         task = (XMLCBuildTask) buildProcess.getTask(XMLCBuildTask.SHARED_KEY);
84         if (task == null) {
85             task = new XMLCBuildTask();
86
87             // There is both a map and a list
88
buildProcess.putTask(XMLCBuildTask.SHARED_KEY, task);
89
90             // Add xmlc task to top of list so genrated DOM
91
// classes are available when dependent classes
92
// are compiled.
93
List JavaDoc list = buildProcess.getBuildTaskList();
94
95             list.add(0, task);
96         }
97         task.increment();
98         //
99
if (nativeNode instanceof TextFileNode) {
100             textNode = (TextFileNode) nativeNode;
101             otterProject =
102                 new PrimeProject((JBProject) textNode.getProject());
103             path =
104                 PathHandle.createPathHandle(textNode.getUrl().getFileObject());
105             if (path.hasExtension(otterProject.getDocTypes())) {
106                 docNode = new PrimeDocumentNode(textNode);
107
108                 // Check if we want to build this specific HTML file.
109
if (docNode.isSelected()) {
110                     xmlcNode = new OtterXMLCNode(docNode);
111                     task.addNode(xmlcNode);
112                 }
113             }
114         }
115     }
116
117 }
118
Popular Tags