class OrmGenerationMojo extends AbstractMojo {

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        // Initialize fileSystemManager.
        try {
            fileSystemManager = VFS.getManager();
        } catch (FileSystemException e) {
            throw new MojoExecutionException("Issue initializing VFS system to fetch ontologies!", e);
        }

        // Load the reference ontology data.
        final List<ReferenceOntology> referenceOntologies = gatherReferenceOntologies();
        // Generate each of the generation ontologies.
        for (final Ontology generate : generates) {
            try {
                final FileObject fileObject = fileSystemManager.resolveFile(generate.getOntologyFile());
                // Check that the file exists!
                if (fileObject.isFile()) {
                    try {
                        // Read the ontology file into our Model.
                        final Model ontology = readOntology(fileObject, generate.getOntologyFile());
                        // If the destination package already exists, remove the previous version.
                        FileUtils.deleteQuietly(new File(outputLocation + (outputLocation.endsWith(File.separator) ? "" : File.separator) + generate.getOutputPackage().replace('.', File.separatorChar)));
                        // Generate the source in the targeted output package.
                        SourceGenerator.toSource(ontology, generate.getOutputPackage(), generate.getOntologyName(), outputLocation, referenceOntologies);
                    } catch (Exception e) {
                        // Catch an exception during source generation and throw MojoFailureException.
                        throw new MojoFailureException(String.format("Issue generating source from ontology specified: {%s} {%s} {%s}",
                                generate.getOntologyFile(), generate.getOutputPackage(), outputLocation), e);
                    }
                } else {
                    // Throw an exception if that ontology file doesn't exist
                    String msg = "Issue generating source from ontology specified. No ontology found at specified location: "
                            + generate.getOntologyFile();
                    throw new MojoExecutionException(msg);
                }
            } catch (IOException e) {
                throw new MojoExecutionException("Issue fetching configured ontology", e);
            }
        }
    }

}