01: package javax.xml.bind;
02:
03: import javax.xml.transform.Result;
04: import java.io.IOException;
05:
06: /**
07: * Controls where a JAXB implementation puts the generates
08: * schema files.
09: *
10: * <p>
11: * An implementation of this abstract class has to be provided by the calling
12: * application to generate schemas.
13: *
14: * <p>
15: * This is a class, not an interface so as to allow future versions to evolve
16: * without breaking the compatibility.
17: *
18: * @author
19: * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
20: */
21: public abstract class SchemaOutputResolver {
22: /**
23: * Decides where the schema file (of the given namespace URI)
24: * will be written, and return it as a {@link Result} object.
25: *
26: * <p>
27: * This method is called only once for any given namespace.
28: * IOW, all the components in one namespace is always written
29: * into the same schema document.
30: *
31: * @param namespaceUri
32: * The namespace URI that the schema declares.
33: * Can be the empty string, but never be null.
34: * @param suggestedFileName
35: * A JAXB implementation generates an unique file name (like "schema1.xsd")
36: * for the convenience of the callee. This name can be
37: * used for the file name of the schema, or the callee can just
38: * ignore this name and come up with its own name.
39: * This is just a hint.
40: *
41: * @return
42: * a {@link Result} object that encapsulates the actual destination
43: * of the schema.
44: *
45: * If the {@link Result} object has a system ID, it must be an
46: * absolute system ID. Those system IDs are relativized by the caller and used
47: * for <xs:import> statements.
48: *
49: * If the {@link Result} object does not have a system ID, a schema
50: * for the namespace URI is generated but it won't be explicitly
51: * <xs:import>ed from other schemas.
52: *
53: * If {@code null} is returned, the schema generation for this
54: * namespace URI will be skipped.
55: */
56: public abstract Result createOutput(String namespaceUri,
57: String suggestedFileName) throws IOException;
58: }
|