Search in sources :

Example 16 with IExporter

use of org.jboss.tools.hibernate.runtime.spi.IExporter in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testCreateExporter.

@Test
public void testCreateExporter() {
    IExporter exporter = service.createExporter("org.hibernate.tool.hbm2x.POJOExporter");
    Assert.assertNotNull(exporter);
    Object target = ((IFacade) exporter).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof POJOExporter);
}
Also used : POJOExporter(org.hibernate.tool.hbm2x.POJOExporter) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.Test)

Example 17 with IExporter

use of org.jboss.tools.hibernate.runtime.spi.IExporter in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testCreateExporter.

@Test
public void testCreateExporter() {
    IExporter exporter = service.createExporter("org.hibernate.tool.hbm2x.POJOExporter");
    Assert.assertNotNull(exporter);
    Object target = ((IFacade) exporter).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof POJOExporter);
}
Also used : POJOExporter(org.hibernate.tool.hbm2x.POJOExporter) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.Test)

Example 18 with IExporter

use of org.jboss.tools.hibernate.runtime.spi.IExporter in project jbosstools-hibernate by jbosstools.

the class NewConfigurationWizard method openContentStream.

/**
 * We will initialize file contents with a sample text.
 * @throws UnsupportedEncodingException
 */
private InputStream openContentStream(Properties props) {
    StringWriter stringWriter = new StringWriter();
    IService service = ServiceLookup.findService(connectionInfoPage.getHibernateVersion());
    // $NON-NLS-1$
    IExporter hce = service.createExporter("org.hibernate.tool.hbm2x.HibernateConfigurationExporter");
    hce.setCustomProperties(props);
    hce.setOutput(stringWriter);
    hce.start();
    try {
        // $NON-NLS-1$
        return new ByteArrayInputStream(stringWriter.toString().getBytes("UTF-8"));
    } catch (UnsupportedEncodingException uec) {
        HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.NewConfigurationWizard_problems_converting_to_utf8, uec);
        return new ByteArrayInputStream(stringWriter.toString().getBytes());
    }
}
Also used : StringWriter(java.io.StringWriter) ByteArrayInputStream(java.io.ByteArrayInputStream) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) IService(org.jboss.tools.hibernate.runtime.spi.IService)

Aggregations

IExporter (org.jboss.tools.hibernate.runtime.spi.IExporter)18 Test (org.junit.Test)12 IGenericExporter (org.jboss.tools.hibernate.runtime.spi.IGenericExporter)10 IHbm2DDLExporter (org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter)10 Exporter (org.hibernate.tool.hbm2x.Exporter)9 IHibernateMappingExporter (org.jboss.tools.hibernate.runtime.spi.IHibernateMappingExporter)9 IQueryExporter (org.jboss.tools.hibernate.runtime.spi.IQueryExporter)9 PersistentClass (org.hibernate.mapping.PersistentClass)8 RootClass (org.hibernate.mapping.RootClass)8 GenericExporter (org.hibernate.tool.hbm2x.GenericExporter)8 Hbm2DDLExporter (org.hibernate.tool.hbm2x.Hbm2DDLExporter)8 HibernateMappingExporter (org.hibernate.tool.hbm2x.HibernateMappingExporter)8 QueryExporter (org.hibernate.tool.hbm2x.QueryExporter)8 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)8 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)8 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)8 Properties (java.util.Properties)4 POJOExporter (org.hibernate.tool.hbm2x.POJOExporter)4 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)4 CoreException (org.eclipse.core.runtime.CoreException)3