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;
}
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;
}
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;
}
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>>();
Configuration cfg = new Configuration();
cfg.setProperties(properties);
ServiceRegistry serviceRegistry = buildServiceRegistry(properties);
Settings settings = cfg.buildSettings(serviceRegistry);
JDBCReader jdbcReader = JDBCReaderFactory.newJDBCReader(properties, settings, (ReverseEngineeringStrategy) ((IFacade) strategy).getTarget(), serviceRegistry);
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;
}
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;
}
Aggregations