Search in sources :

Example 6 with ProgressListener

use of org.hibernate.cfg.reveng.ProgressListener in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method collectDatabaseTables.

@Override
public Map<String, List<ITable>> collectDatabaseTables(Properties properties, IReverseEngineeringStrategy strategy, final IProgressListener progressListener) {
    Map<String, List<ITable>> result = new HashMap<String, List<ITable>>();
    JDBCReader jdbcReader = JDBCReaderFactory.newJDBCReader(properties, (ReverseEngineeringStrategy) ((IFacade) strategy).getTarget(), buildServiceRegistry(properties));
    MetaDataDialect metadataDialect = jdbcReader.getMetaDataDialect();
    DefaultDatabaseCollector databaseCollector = new DefaultDatabaseCollector(metadataDialect);
    ProgressListener progressListenerWrapper = new ProgressListener() {

        @Override
        public void startSubTask(String name) {
            progressListener.startSubTask(name);
        }
    };
    jdbcReader.readDatabaseSchema(databaseCollector, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA), progressListenerWrapper);
    Iterator<?> iterator = databaseCollector.getQualifierEntries();
    while (iterator.hasNext()) {
        Entry<?, ?> entry = (Entry<?, ?>) iterator.next();
        ArrayList<ITable> list = new ArrayList<ITable>();
        for (Object table : (Iterable<?>) entry.getValue()) {
            list.add(facadeFactory.createTable(table));
        }
        result.put((String) entry.getKey(), list);
    }
    return result;
}
Also used : MetaDataDialect(org.hibernate.cfg.reveng.dialect.MetaDataDialect) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Entry(java.util.Map.Entry) IProgressListener(org.jboss.tools.hibernate.runtime.spi.IProgressListener) ProgressListener(org.hibernate.cfg.reveng.ProgressListener) DefaultDatabaseCollector(org.hibernate.cfg.reveng.DefaultDatabaseCollector) List(java.util.List) ArrayList(java.util.ArrayList) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) JDBCReader(org.hibernate.cfg.reveng.JDBCReader)

Example 7 with ProgressListener

use of org.hibernate.cfg.reveng.ProgressListener in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method collectDatabaseTables.

@Override
public Map<String, List<ITable>> collectDatabaseTables(Properties properties, IReverseEngineeringStrategy strategy, final IProgressListener progressListener) {
    Map<String, List<ITable>> result = new HashMap<String, List<ITable>>();
    JDBCReader jdbcReader = JDBCReaderFactory.newJDBCReader(properties, (ReverseEngineeringStrategy) ((IFacade) strategy).getTarget(), buildServiceRegistry(properties));
    MetaDataDialect metadataDialect = jdbcReader.getMetaDataDialect();
    DefaultDatabaseCollector databaseCollector = new DefaultDatabaseCollector(metadataDialect);
    ProgressListener progressListenerWrapper = new ProgressListener() {

        @Override
        public void startSubTask(String name) {
            progressListener.startSubTask(name);
        }
    };
    jdbcReader.readDatabaseSchema(databaseCollector, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA), progressListenerWrapper);
    Iterator<?> iterator = databaseCollector.getQualifierEntries();
    while (iterator.hasNext()) {
        Entry<?, ?> entry = (Entry<?, ?>) iterator.next();
        ArrayList<ITable> list = new ArrayList<ITable>();
        for (Object table : (Iterable<?>) entry.getValue()) {
            list.add(facadeFactory.createTable(table));
        }
        result.put((String) entry.getKey(), list);
    }
    return result;
}
Also used : MetaDataDialect(org.hibernate.cfg.reveng.dialect.MetaDataDialect) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Entry(java.util.Map.Entry) IProgressListener(org.jboss.tools.hibernate.runtime.spi.IProgressListener) ProgressListener(org.hibernate.cfg.reveng.ProgressListener) DefaultDatabaseCollector(org.hibernate.cfg.reveng.DefaultDatabaseCollector) List(java.util.List) ArrayList(java.util.ArrayList) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) JDBCReader(org.hibernate.cfg.reveng.JDBCReader)

Example 8 with ProgressListener

use of org.hibernate.cfg.reveng.ProgressListener in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method collectDatabaseTables.

@Override
public Map<String, List<ITable>> collectDatabaseTables(Properties properties, IReverseEngineeringStrategy strategy, final IProgressListener progressListener) {
    Map<String, List<ITable>> result = new HashMap<String, List<ITable>>();
    JDBCReader jdbcReader = JDBCReaderFactory.newJDBCReader(properties, (ReverseEngineeringStrategy) ((IFacade) strategy).getTarget(), buildServiceRegistry(properties));
    MetaDataDialect metadataDialect = jdbcReader.getMetaDataDialect();
    DefaultDatabaseCollector databaseCollector = new DefaultDatabaseCollector(metadataDialect);
    ProgressListener progressListenerWrapper = new ProgressListener() {

        @Override
        public void startSubTask(String name) {
            progressListener.startSubTask(name);
        }
    };
    jdbcReader.readDatabaseSchema(databaseCollector, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA), progressListenerWrapper);
    Iterator<?> iterator = databaseCollector.getQualifierEntries();
    while (iterator.hasNext()) {
        Entry<?, ?> entry = (Entry<?, ?>) iterator.next();
        ArrayList<ITable> list = new ArrayList<ITable>();
        for (Object table : (Iterable<?>) entry.getValue()) {
            list.add(facadeFactory.createTable(table));
        }
        result.put((String) entry.getKey(), list);
    }
    return result;
}
Also used : MetaDataDialect(org.hibernate.cfg.reveng.dialect.MetaDataDialect) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Entry(java.util.Map.Entry) IProgressListener(org.jboss.tools.hibernate.runtime.spi.IProgressListener) ProgressListener(org.hibernate.cfg.reveng.ProgressListener) DefaultDatabaseCollector(org.hibernate.cfg.reveng.DefaultDatabaseCollector) List(java.util.List) ArrayList(java.util.ArrayList) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) JDBCReader(org.hibernate.cfg.reveng.JDBCReader)

Example 9 with ProgressListener

use of org.hibernate.cfg.reveng.ProgressListener in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method collectDatabaseTables.

@Override
public Map<String, List<ITable>> collectDatabaseTables(Properties properties, IReverseEngineeringStrategy strategy, final IProgressListener progressListener) {
    Map<String, List<ITable>> result = new HashMap<String, List<ITable>>();
    JDBCReader jdbcReader = JDBCReaderFactory.newJDBCReader(properties, new Configuration().setProperties(properties).buildSettings(), (ReverseEngineeringStrategy) ((IFacade) strategy).getTarget());
    MetaDataDialect metadataDialect = jdbcReader.getMetaDataDialect();
    DefaultDatabaseCollector databaseCollector = new DefaultDatabaseCollector(metadataDialect);
    ProgressListener progressListenerWrapper = new ProgressListener() {

        @Override
        public void startSubTask(String name) {
            progressListener.startSubTask(name);
        }
    };
    jdbcReader.readDatabaseSchema(databaseCollector, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA), progressListenerWrapper);
    Iterator<?> iterator = databaseCollector.getQualifierEntries();
    while (iterator.hasNext()) {
        Entry<?, ?> entry = (Entry<?, ?>) iterator.next();
        ArrayList<ITable> list = new ArrayList<ITable>();
        for (Object table : (Iterable<?>) entry.getValue()) {
            list.add(facadeFactory.createTable(table));
        }
        result.put((String) entry.getKey(), list);
    }
    return result;
}
Also used : Ejb3Configuration(org.hibernate.ejb.Ejb3Configuration) Configuration(org.hibernate.cfg.Configuration) JDBCMetaDataConfiguration(org.hibernate.cfg.JDBCMetaDataConfiguration) AnnotationConfiguration(org.hibernate.cfg.AnnotationConfiguration) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) MetaDataDialect(org.hibernate.cfg.reveng.dialect.MetaDataDialect) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Entry(java.util.Map.Entry) IProgressListener(org.jboss.tools.hibernate.runtime.spi.IProgressListener) ProgressListener(org.hibernate.cfg.reveng.ProgressListener) DefaultDatabaseCollector(org.hibernate.cfg.reveng.DefaultDatabaseCollector) List(java.util.List) ArrayList(java.util.ArrayList) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) JDBCReader(org.hibernate.cfg.reveng.JDBCReader)

Example 10 with ProgressListener

use of org.hibernate.cfg.reveng.ProgressListener in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method collectDatabaseTables.

@Override
public Map<String, List<ITable>> collectDatabaseTables(Properties properties, IReverseEngineeringStrategy strategy, final IProgressListener progressListener) {
    Map<String, List<ITable>> result = new HashMap<String, List<ITable>>();
    JDBCReader jdbcReader = JDBCReaderFactory.newJDBCReader(properties, (ReverseEngineeringStrategy) ((IFacade) strategy).getTarget(), buildServiceRegistry(properties));
    MetaDataDialect metadataDialect = jdbcReader.getMetaDataDialect();
    DefaultDatabaseCollector databaseCollector = new DefaultDatabaseCollector(metadataDialect);
    ProgressListener progressListenerWrapper = new ProgressListener() {

        @Override
        public void startSubTask(String name) {
            progressListener.startSubTask(name);
        }
    };
    jdbcReader.readDatabaseSchema(databaseCollector, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA), progressListenerWrapper);
    Iterator<?> iterator = databaseCollector.getQualifierEntries();
    while (iterator.hasNext()) {
        Entry<?, ?> entry = (Entry<?, ?>) iterator.next();
        ArrayList<ITable> list = new ArrayList<ITable>();
        for (Object table : (Iterable<?>) entry.getValue()) {
            list.add(facadeFactory.createTable(table));
        }
        result.put((String) entry.getKey(), list);
    }
    return result;
}
Also used : MetaDataDialect(org.hibernate.cfg.reveng.dialect.MetaDataDialect) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Entry(java.util.Map.Entry) IProgressListener(org.jboss.tools.hibernate.runtime.spi.IProgressListener) ProgressListener(org.hibernate.cfg.reveng.ProgressListener) DefaultDatabaseCollector(org.hibernate.cfg.reveng.DefaultDatabaseCollector) List(java.util.List) ArrayList(java.util.ArrayList) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) JDBCReader(org.hibernate.cfg.reveng.JDBCReader)

Aggregations

ArrayList (java.util.ArrayList)11 HashMap (java.util.HashMap)11 List (java.util.List)11 Entry (java.util.Map.Entry)11 DefaultDatabaseCollector (org.hibernate.cfg.reveng.DefaultDatabaseCollector)11 JDBCReader (org.hibernate.cfg.reveng.JDBCReader)11 ProgressListener (org.hibernate.cfg.reveng.ProgressListener)11 MetaDataDialect (org.hibernate.cfg.reveng.dialect.MetaDataDialect)11 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)11 IProgressListener (org.jboss.tools.hibernate.runtime.spi.IProgressListener)11 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)11 Configuration (org.hibernate.cfg.Configuration)3 JDBCMetaDataConfiguration (org.hibernate.cfg.JDBCMetaDataConfiguration)3 Ejb3Configuration (org.hibernate.ejb.Ejb3Configuration)3 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)3 AnnotationConfiguration (org.hibernate.cfg.AnnotationConfiguration)1 Settings (org.hibernate.cfg.Settings)1 ReverseEngineeringSettings (org.hibernate.cfg.reveng.ReverseEngineeringSettings)1 ServiceRegistry (org.hibernate.service.ServiceRegistry)1 IReverseEngineeringSettings (org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringSettings)1