@Test public void Execute() throws SecurityException, NoSuchFieldException, IllegalAccessException, MojoExecutionException, MojoFailureException { JavaBeanGenMojo mojo = new JavaBeanGenMojo(); Properties properties = new Properties(); properties.put("http: set(mojo, "schemaFile", new File("src/test/resources/wine.owl")); set(mojo, "targetFolder", new File("target/JavaBeanGenMojoTest")); set(mojo, "nsToPackage", properties); mojo.execute(); assertTrue(new File("target/JavaBeanGenMojoTest/com/example/wine/Wine.java").exists()); }
@Override public void execute() throws MojoExecutionException, MojoFailureException { MemoryRepository repository = new MemoryRepository(); Format format = useTurtle ? Format.TURTLE : Format.RDFXML; try { repository.setSources(new RDFSource(schemaFile.getAbsoluteFile().toURI().toURL().toString(), format, "http: } catch (MalformedURLException e1) { throw new MojoExecutionException(e1.getMessage(), e1); } DefaultConfiguration configuration = new DefaultConfiguration(); configuration.addPackages(RDFSClass.class.getPackage(), OWLClass.class.getPackage()); SessionFactoryImpl sessionFactory = new SessionFactoryImpl(); sessionFactory.setConfiguration(configuration); sessionFactory.setRepository(repository); sessionFactory.initialize(); Session session = sessionFactory.openSession(); try { JavaBeanExporter exporter = new JavaBeanExporter(true); for (Map.Entry<Object, Object> entry : nsToPackage.entrySet()) { exporter.addPackage(entry.getKey().toString(), entry.getValue().toString()); } exporter.export(session, targetFolder); } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } finally { try { session.close(); } finally { sessionFactory.close(); } } }
JavaBeanGenMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { MemoryRepository repository = new MemoryRepository(); Format format = useTurtle ? Format.TURTLE : Format.RDFXML; try { repository.setSources(new RDFSource(schemaFile.getAbsoluteFile().toURI().toURL().toString(), format, "http: } catch (MalformedURLException e1) { throw new MojoExecutionException(e1.getMessage(), e1); } DefaultConfiguration configuration = new DefaultConfiguration(); configuration.addPackages(RDFSClass.class.getPackage(), OWLClass.class.getPackage()); SessionFactoryImpl sessionFactory = new SessionFactoryImpl(); sessionFactory.setConfiguration(configuration); sessionFactory.setRepository(repository); sessionFactory.initialize(); Session session = sessionFactory.openSession(); try { JavaBeanExporter exporter = new JavaBeanExporter(true); for (Map.Entry<Object, Object> entry : nsToPackage.entrySet()) { exporter.addPackage(entry.getKey().toString(), entry.getValue().toString()); } exporter.export(session, targetFolder); } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } finally { try { session.close(); } finally { sessionFactory.close(); } } } }
JavaBeanGenMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { MemoryRepository repository = new MemoryRepository(); Format format = useTurtle ? Format.TURTLE : Format.RDFXML; try { repository.setSources(new RDFSource(schemaFile.getAbsoluteFile().toURI().toURL().toString(), format, "http: } catch (MalformedURLException e1) { throw new MojoExecutionException(e1.getMessage(), e1); } DefaultConfiguration configuration = new DefaultConfiguration(); configuration.addPackages(RDFSClass.class.getPackage(), OWLClass.class.getPackage()); SessionFactoryImpl sessionFactory = new SessionFactoryImpl(); sessionFactory.setConfiguration(configuration); sessionFactory.setRepository(repository); sessionFactory.initialize(); Session session = sessionFactory.openSession(); try { JavaBeanExporter exporter = new JavaBeanExporter(true); for (Map.Entry<Object, Object> entry : nsToPackage.entrySet()) { exporter.addPackage(entry.getKey().toString(), entry.getValue().toString()); } exporter.export(session, targetFolder); } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } finally { try { session.close(); } finally { sessionFactory.close(); } } }  }
JavaBeanGenMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { MemoryRepository repository = new MemoryRepository(); Format format = useTurtle ? Format.TURTLE : Format.RDFXML; try { repository.setSources(new RDFSource(schemaFile.getAbsoluteFile().toURI().toURL().toString(), format, "http: } catch (MalformedURLException e1) { throw new MojoExecutionException(e1.getMessage(), e1); } DefaultConfiguration configuration = new DefaultConfiguration(); configuration.addPackages(RDFSClass.class.getPackage(), OWLClass.class.getPackage()); SessionFactoryImpl sessionFactory = new SessionFactoryImpl(); sessionFactory.setConfiguration(configuration); sessionFactory.setRepository(repository); sessionFactory.initialize(); Session session = sessionFactory.openSession(); try { JavaBeanExporter exporter = new JavaBeanExporter(true); for (Map.Entry<Object, Object> entry : nsToPackage.entrySet()) { exporter.addPackage(entry.getKey().toString(), entry.getValue().toString()); } exporter.export(session, targetFolder); } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } finally { try { session.close(); } finally { sessionFactory.close(); } } }  @Override void execute(); }
JavaBeanGenMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { MemoryRepository repository = new MemoryRepository(); Format format = useTurtle ? Format.TURTLE : Format.RDFXML; try { repository.setSources(new RDFSource(schemaFile.getAbsoluteFile().toURI().toURL().toString(), format, "http: } catch (MalformedURLException e1) { throw new MojoExecutionException(e1.getMessage(), e1); } DefaultConfiguration configuration = new DefaultConfiguration(); configuration.addPackages(RDFSClass.class.getPackage(), OWLClass.class.getPackage()); SessionFactoryImpl sessionFactory = new SessionFactoryImpl(); sessionFactory.setConfiguration(configuration); sessionFactory.setRepository(repository); sessionFactory.initialize(); Session session = sessionFactory.openSession(); try { JavaBeanExporter exporter = new JavaBeanExporter(true); for (Map.Entry<Object, Object> entry : nsToPackage.entrySet()) { exporter.addPackage(entry.getKey().toString(), entry.getValue().toString()); } exporter.export(session, targetFolder); } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } finally { try { session.close(); } finally { sessionFactory.close(); } } }  @Override void execute();  }