KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > ecm > taskdefs > IR3TaskHelper


1 /*====================================================================
2
3   ECM: The Extensible Container Model Implementation
4   Copyright (C) 2004 THALES
5   Contact: openccm@objectweb.org
6
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public
9   License as published by the Free Software Foundation; either
10   version 2.1 of the License, or any later version.
11
12   This library is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   Lesser General Public License for more details.
16
17   You should have received a copy of the GNU Lesser General Public
18   License along with this library; if not, write to the Free Software
19   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20   USA
21
22   Initial developer(s): Mathieu Vadet.
23   Initial Funding: IST COACH European project (IST-2001-34445)
24                    http://www.ist-coach.org
25   Contributor(s):
26
27 ====================================================================*/

28
29 /**
30  ** <p>The 'ecm/taskdefs' namespace contains Apache Ant tasks implementation
31  ** which are used by the various components' build files.</p>
32  **
33  ** @author <a HREF="mailto:mathieu.vadet@fr.thalesgroup.com">Mathieu Vadet</a>
34  ** @version 0.1
35  **/

36 package org.objectweb.ecm.taskdefs;
37
38 /**
39  ** <p>Set of static operations for IR-related tasks.</p>
40  **
41  ** @author <a HREF="mailto:mathieu.vadet@fr.thalesgroup.com">Mathieu Vadet</a>
42  ** @version 0.1
43  **/

44 public class IR3TaskHelper
45 {
46     //
47
//
48
//
49

50     static public org.apache.tools.ant.types.Environment.Variable[]
51     buildEnv(org.apache.tools.ant.Project project)
52     {
53         return buildEnv(project, FileHelper.createTempDir());
54     }
55
56     static public org.apache.tools.ant.types.Environment.Variable[]
57     buildEnv(org.apache.tools.ant.Project project,
58              java.io.File JavaDoc cfgdir)
59     {
60         // NOTE: path is no more added to the returned variables
61

62         // create environment properties, we need:
63
// - OpenCCM_HOMEDIR (set to ${OpenCCM.install.dir})
64
// - OpenCCM_CONFIG_DIR (set to a temp dir)
65
// - PATH (set to "${OpenCCM_HOMEDIR}${FSEP}bin${PSEP}${ECM.install.bin.dir}${PSEP}${PATH})
66

67         // - OpenCCM_HOMEDIR (set to ${OpenCCM.install.dir})
68
OSHelper.pathConvert(project, "os.OpenCCM.install.dir", "OpenCCM.install.dir");
69         String JavaDoc homedir = project.getProperty("os.OpenCCM.install.dir");
70
71         // - OpenCCM_CONFIG_DIR (set externally)
72

73         // - PATH (set to "${OpenCCM_HOMEDIR}${FSEP}bin${PSEP}${ECM.install.bin.dir}${PSEP}${PATH})
74
// NOTE: the ECM.install.bin.dir property is only set in the case of the ECM executables (eg ir3_copi)
75
/*
76         String ecm_path = project.getProperty("ECM.install.bin.dir");
77         if (ecm_path==null) {
78             ecm_path="";
79         }
80         else {
81             ecm_path=ecm_path+java.io.File.pathSeparator;
82         }
83
84         String npath = homedir+java.io.File.separator+"bin"+java.io.File.pathSeparator+ecm_path+OSHelper.osPath();
85         */

86
87         //
88
org.apache.tools.ant.types.Environment.Variable[] env = new org.apache.tools.ant.types.Environment.Variable[2];
89         env[0] = new org.apache.tools.ant.types.Environment.Variable();
90         env[0].setKey("OpenCCM_HOMEDIR");
91         env[0].setValue(homedir);
92
93         env[1] = new org.apache.tools.ant.types.Environment.Variable();
94         env[1].setKey("OpenCCM_CONFIG_DIR");
95         env[1].setValue(cfgdir.getPath());
96
97         /*
98         env[2] = new org.apache.tools.ant.types.Environment.Variable();
99         env[2].setKey("PATH");
100         env[2].setValue(npath);
101         */

102
103         // project.log("[buildEnv] OpenCCM_HOMEDIR="+homedir);
104
// project.log("[buildEnv] OpenCCM_CONFIG_DIR="+cfgdir.getPath());
105
// project.log("[buildEnv] PATH="+npath);
106

107         return env;
108     }
109 }
110
Popular Tags