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.generator;
18:
19: import org.apache.avalon.framework.component.Component;
20: import org.apache.avalon.framework.component.ComponentManager;
21: import org.apache.excalibur.source.Source;
22:
23: import org.apache.cocoon.environment.SourceResolver;
24:
25: /**
26: * This interface defines a loader for programs automatically built from XML
27: * documents written in a <code>MarkupLanguage</code>
28: *
29: * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
30: * @version CVS $Id: ProgramGenerator.java 433543 2006-08-22 06:22:54Z crossley $
31: */
32: public interface ProgramGenerator extends Component {
33:
34: String ROLE = ProgramGenerator.class.getName();
35:
36: /**
37: * Load a program built from an XML document written in a
38: * <code>MarkupLanguage</code>
39: *
40: * @param newManager The ComponentManager that it will be loaded with
41: * @param fileName The input document's <code>File</code> name
42: * @param markupLanguage The <code>MarkupLanguage</code> in which the input
43: * document is written
44: * @param programmingLanguage The <code>ProgrammingLanguage</code> in which
45: * the program must be written
46: * @return The loaded object
47: * @exception Exception If an error occurs during generation or loading
48: * @deprecated Pass Source object instead of file name.
49: */
50: CompiledComponent load(ComponentManager newManager,
51: String fileName, String markupLanguage,
52: String programmingLanguage, SourceResolver resolver)
53: throws Exception;
54:
55: /**
56: * Load a program built from an XML document written in a
57: * <code>MarkupLanguage</code>
58: *
59: * @param newManager The ComponentManager that it will be loaded with
60: * @param source The input document's <code>File</code> name
61: * @param markupLanguage The <code>MarkupLanguage</code> in which the input
62: * document is written
63: * @param programmingLanguage The <code>ProgrammingLanguage</code> in which
64: * the program must be written
65: * @return The loaded object
66: * @exception Exception If an error occurs during generation or loading
67: */
68: CompiledComponent load(ComponentManager newManager, Source source,
69: String markupLanguage, String programmingLanguage,
70: SourceResolver resolver) throws Exception;
71:
72: /**
73: * Release a program instance built from an XML document written in a
74: * <code>MarkupLanguage</code>.
75: *
76: * @param component to be released.
77: */
78: void release(CompiledComponent component);
79:
80: /**
81: * Remove a program from the generator's cache and dipose all
82: * instances of this program.
83: *
84: * @param source of the program to be removed.
85: */
86: void remove(Source source);
87: }
|