01: /* $Id: AbstractObjectCreationFactory.java 467222 2006-10-24 03:17:11Z markt $
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18: package org.apache.tomcat.util.digester;
19:
20: import org.xml.sax.Attributes;
21:
22: /**
23: * <p>Abstract base class for <code>ObjectCreationFactory</code>
24: * implementations.</p>
25: */
26: abstract public class AbstractObjectCreationFactory implements
27: ObjectCreationFactory {
28:
29: // ----------------------------------------------------- Instance Variables
30:
31: /**
32: * The associated <code>Digester</code> instance that was set up by
33: * {@link FactoryCreateRule} upon initialization.
34: */
35: protected Digester digester = null;
36:
37: // --------------------------------------------------------- Public Methods
38:
39: /**
40: * <p>Factory method called by {@link FactoryCreateRule} to supply an
41: * object based on the element's attributes.
42: *
43: * @param attributes the element's attributes
44: *
45: * @throws Exception any exception thrown will be propagated upwards
46: */
47: public abstract Object createObject(Attributes attributes)
48: throws Exception;
49:
50: /**
51: * <p>Returns the {@link Digester} that was set by the
52: * {@link FactoryCreateRule} upon initialization.
53: */
54: public Digester getDigester() {
55:
56: return (this .digester);
57:
58: }
59:
60: /**
61: * <p>Set the {@link Digester} to allow the implementation to do logging,
62: * classloading based on the digester's classloader, etc.
63: *
64: * @param digester parent Digester object
65: */
66: public void setDigester(Digester digester) {
67:
68: this.digester = digester;
69:
70: }
71:
72: }
|