/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This reads the config files passed by the user to apt
* and obtains a list of classes that need to be included
* for a particular config from the set of classes passed
* by the user to apt.
*
* @author Bhakti Mehta (bhakti.mehta@sun.com)
*/
public final class ConfigReader {
/**
* The set of classes to be passed to XJC
*
*/
/**
* The SchemaOutputResolver used to generate the schemas
*/
/**
*
* @param classes
* The set of classes passed to the AnnotationProcessor
* @param xmlFile
* The configuration file.
* @throws SAXException
* If this is thrown, the error has already been reported.
* @throws IOException
* If any IO errors occur.
*/
public ConfigReader( AnnotationProcessorEnvironment env, Collection <? extends TypeDeclaration> classes, File xmlFile, ErrorHandler errorHandler)throws SAXException,IOException{
}
/**
* This creates creates a regular expression
* for the user pattern , matches the input classes
* passed by the user and returns the final
* list of classes that need to be included for a config file
* after applying those patterns
*
*/
return classesToBeIncluded;
}
if (match)
continue OUTER; // excluded
}
if (match) {
break;
}
}
}
}
/**
* This returns the SchemaOutputResolver to generate the schemas
*/
return schemaOutputResolver;
}
}
return schemaOutputResolver;
}
/**
* This will check if the qualified name matches the pattern
*
* @param qualifiedName
* The qualified name of the TypeDeclaration
* @param pattern
* The pattern obtained from the users input
*
*/
}
/**
* Lazily parsed schema for the binding file.
*/
/**
* Parses an xml config file and returns a Config object.
*
* @param xmlFile
* The xml config file which is passed by the user to apt
* @return
* A non null Config object
*/
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
try {
factory.setNamespaceAware(true);
} catch (ParserConfigurationException e) {
// in practice this will never happen
throw new Error(e);
}
// set up validator
// the validator will receive events first, then the parser.
return config;
}
/**
* Controls where the JAXB RI puts the generates
* schema files.
* @author
* Bhakti Mehta (bhakti.mehta@sun.com)
*/
/**
* Directory to which we put the rest of the files.
* Never be null.
*/
/**
* Namespace URI to the location of the schema.
* This captures what the user specifies.
*/
/**
* Decides where the schema file (of the given namespace URI)
* will be written, and return it as a {@link Result} object.
*
*/
// the user's preference takes a precedence
// create directories if necessary. we've already checked that the baseDir
// exists, so this should be no surprise to users.
}
// if the user didn't say anything about this namespace,
// generate it into the default directory with a default name.
// The systemId for the result will be schemaFile
return new StreamResult(schemaFile);
}
}
if (namespaceUri == null )
//generate elements in no namespace
namespaceUri = "";
}
}
}