01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.xml.transform;
17:
18: import org.geotools.xml.transform.TransformerBase.SchemaLocationSupport;
19: import org.xml.sax.helpers.NamespaceSupport;
20:
21: /**
22: * A Translator is used in an XMLEncoding process by the FeatureTransformer
23: * class.
24: * @author Ian Schneider
25: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/xml/transform/Translator.java $
26: */
27: public interface Translator {
28:
29: /**
30: * Obtain the namespace prefixes and URIs to be included in the output
31: * document.
32: * @return An instance of NamespaceSupport.
33: */
34: NamespaceSupport getNamespaceSupport();
35:
36: /**
37: * Get the default URI used by this Translator for encoding. Optional.
38: */
39: String getDefaultNamespace();
40:
41: /**
42: * Get the default prefix used by this Translator for encoding. Optional.
43: */
44: String getDefaultPrefix();
45:
46: /**
47: * Encode the object.
48: * @param o The Object to encode.
49: * @throws IllegalArgumentException if the Object is not encodeable.
50: */
51: void encode(Object o) throws IllegalArgumentException;
52:
53: /**
54: * Gets the location of the schemas used in this translator. Optional.
55: */
56: SchemaLocationSupport getSchemaLocationSupport();
57:
58: /** Abort any translating activity.
59: * This is needed as some translators iterate internally on a data structure.
60: * The abort method should silently fail or succeed based upon the state of
61: * a translation.
62: */
63: void abort();
64:
65: }
|