01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.components.language.programming;
18:
19: import org.apache.avalon.framework.component.Component;
20:
21: import java.io.IOException;
22: import java.util.List;
23:
24: /**
25: * This interface defines a compiler's functionality for all
26: * (Java-based) compiled languages
27: *
28: * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
29: * @version CVS $Id: LanguageCompiler.java 433543 2006-08-22 06:22:54Z crossley $
30: * @since 2.0
31: */
32: public interface LanguageCompiler extends Component {
33:
34: /**
35: * Set the name of the file containing the source program
36: *
37: * @param file The name of the file containing the source program
38: */
39: void setFile(String file);
40:
41: /**
42: * Set the name of the directory containing the source program file
43: *
44: * @param srcDir The name of the directory containing the source program file
45: */
46: void setSource(String srcDir);
47:
48: /**
49: * Set the name of the directory to contain the resulting object program file
50: *
51: * @param destDir The name of the directory to contain the resulting object
52: * program file
53: */
54: void setDestination(String destDir);
55:
56: /**
57: * Set the classpath to be used for this compilation
58: *
59: * @param classpath The classpath to be used for this compilation
60: */
61: void setClasspath(String classpath);
62:
63: /**
64: * Set the encoding of the input source file or <code>null</code> to use the
65: * platform's default encoding
66: *
67: * @param encoding The encoding of the input source file or <code>null</code>
68: * to use the platform's default encoding
69: */
70: void setEncoding(String encoding);
71:
72: /**
73: * Set the version of the java source code to be compiled
74: *
75: * @param level The version of the JVM for wich the code was written.
76: * i.e: Posible level's values are:
77: * 130 = for Java 1.3, 140 = for Java 1.4 and 150 = for Java 1.5
78: *
79: * @since 2.1.7
80: */
81: void setCompilerComplianceLevel(int level);
82:
83: /**
84: * Compile a source file yielding a loadable program file.
85: *
86: * @exception IOException If an error occurs during compilation
87: */
88: boolean compile() throws IOException;
89:
90: /**
91: * Return the list of errors generated by this compilation
92: *
93: * @return The list of errors generated by this compilation
94: * @exception IOException If an error occurs during message collection
95: */
96: List getErrors() throws IOException;
97: }
|