KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > java > JavacConfig


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.java;
30
31 import com.caucho.loader.EnvironmentLocal;
32
33 import javax.annotation.PostConstruct;
34
35 public class JavacConfig {
36   private static final EnvironmentLocal<JavacConfig> _localJavac =
37   new EnvironmentLocal<JavacConfig>();
38
39   private String JavaDoc _compiler = "internal";
40   private String JavaDoc _args;
41   private String JavaDoc _encoding;
42   private int _maxBatch = 64;
43
44   /**
45    * Returns the environment configuration.
46    */

47   public static JavacConfig getLocalConfig()
48   {
49     JavacConfig config;
50
51     config = _localJavac.get();
52
53     if (config != null)
54       return config;
55     else
56       return new JavacConfig();
57   }
58
59   /**
60    * Sets the compiler.
61    */

62   public void setCompiler(String JavaDoc compiler)
63   {
64     _compiler = compiler;
65   }
66
67   /**
68    * Gets the compiler.
69    */

70   public String JavaDoc getCompiler()
71   {
72     return _compiler;
73   }
74
75   /**
76    * Sets the args.
77    */

78   public void setArgs(String JavaDoc args)
79   {
80     _args = args;
81   }
82
83   /**
84    * Gets the args.
85    */

86   public String JavaDoc getArgs()
87   {
88     return _args;
89   }
90
91   /**
92    * Sets the encoding.
93    */

94   public void setEncoding(String JavaDoc encoding)
95   {
96     _encoding = encoding;
97   }
98
99   /**
100    * Gets the encoding.
101    */

102   public String JavaDoc getEncoding()
103   {
104     return _encoding;
105   }
106
107   /**
108    * Sets the number of files to batch.
109    */

110   public void setMaxBatch(int max)
111   {
112     _maxBatch = max;
113   }
114
115   /**
116    * Sets the number of files to batch.
117    */

118   public int getMaxBatch()
119   {
120     return _maxBatch;
121   }
122
123   /**
124    * Sets the compiler args (backwards compat)
125    */

126   public void setCompilerArgs(String JavaDoc args)
127   {
128     setArgs(args);
129   }
130
131   /**
132    * Stores self.
133    */

134   @PostConstruct
135   public void init()
136   {
137     _localJavac.set(this);
138   }
139 }
140
141
Popular Tags