01: /*
02: * Copyright 1999-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.apache.jk.ant;
18:
19: import org.apache.tools.ant.Project;
20:
21: /**
22: * Set platform specific data. Can be used to specify files (fileName="value")
23: * symbols (symbol="value") or generic values (value="value"). A platform
24: * can also be set on the object so that platform specific compilers can
25: * determine if they want to use the values.
26: * XXX will use apxs query to detect the flags.
27: *
28: * @author Mike Anderson
29: */
30: public class JkData {
31:
32: private String value;
33: private boolean isfile = false;
34: private String ifCond;
35: String unlessCond;
36: Project project;
37:
38: public JkData() {
39: }
40:
41: public void setProject(Project p) {
42: project = p;
43: }
44:
45: public void setFileName(String s) {
46: value = s;
47: isfile = true;
48: }
49:
50: public void setSymbol(String s) {
51: value = s;
52: isfile = false;
53: }
54:
55: public void setValue(String s) {
56: value = s;
57: }
58:
59: public void setIsFile(boolean isf) {
60: isfile = isf;
61: }
62:
63: public void setIf(String s) {
64: ifCond = s;
65: }
66:
67: public void setUnless(String s) {
68: unlessCond = s;
69: }
70:
71: public String getValue() {
72: if (ifCond != null && project.getProperty(ifCond) == null)
73: return null;
74: if (unlessCond != null
75: && project.getProperty(unlessCond) != null)
76: return null;
77: return value;
78: }
79:
80: public boolean isFile() {
81: return isfile;
82: }
83: }
|