1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.internal.xjc.api;
  27 
  28 import java.io.IOException;
  29 
  30 import javax.xml.bind.SchemaOutputResolver;
  31 import javax.xml.namespace.QName;
  32 import javax.xml.transform.Result;
  33 
  34 /**
  35  * {@link JAXBModel} that exposes additional information available
  36  * only for the java->schema direction.
  37  *
  38  * @author Kohsuke Kawaguchi
  39  */
  40 public interface J2SJAXBModel extends JAXBModel {
  41     /**
  42      * Returns the name of the XML Type bound to the
  43      * specified Java type.
  44      *
  45      * @param javaType
  46      *      must not be null. This must be one of the {@link Reference}s specified
  47      *      in the {@link JavaCompiler#bind} method.
  48      *
  49      * @return
  50      *      null if it is not a part of the input to {@link JavaCompiler#bind}.
  51      *
  52      * @throws IllegalArgumentException
  53      *      if the parameter is null
  54      */
  55     QName getXmlTypeName(Reference javaType);
  56 
  57     /**
  58      * Generates the schema documents from the model.
  59      *
  60      * @param outputResolver
  61      *      this object controls the output to which schemas
  62      *      will be sent.
  63      *
  64      * @throws IOException
  65      *      if {@link SchemaOutputResolver} throws an {@link IOException}.
  66      */
  67     void generateSchema(SchemaOutputResolver outputResolver, ErrorListener errorListener) throws IOException;
  68 
  69     /**
  70      * Generates the episode file from the model.
  71      *
  72      * <p>
  73      * The "episode file" is really just a JAXB customization file (but with vendor extensions,
  74      * at this point), that can be used later with a schema compilation to support separate
  75      * compilation.
  76      *
  77      * @param output
  78      *      This receives the generated episode file.
  79      * @since 2.1
  80      */
  81     void generateEpisodeFile(Result output);
  82 }