use of jodd.db.oom.DbOomException in project jodd by oblac.
the class AutomagicDbOomConfigurator method onEntry.
/**
* Scans all classes and registers only those annotated with {@link DbTable}.
* Because of performance purposes, classes are not dynamically loaded; instead, their
* file content is examined.
*/
@Override
protected void onEntry(EntryData entryData) {
String entryName = entryData.getName();
InputStream inputStream = entryData.openInputStream();
if (!isTypeSignatureInUse(inputStream, dbTableAnnotationBytes)) {
return;
}
Class<?> beanClass;
try {
beanClass = loadClass(entryName);
} catch (ClassNotFoundException cnfex) {
throw new DbOomException("Entry class not found: " + entryName, cnfex);
}
if (beanClass == null) {
return;
}
DbTable dbTable = beanClass.getAnnotation(DbTable.class);
if (dbTable == null) {
return;
}
if (registerAsEntities) {
dbOomManager.registerEntity(beanClass);
} else {
dbOomManager.registerType(beanClass);
}
}
use of jodd.db.oom.DbOomException in project jodd by oblac.
the class AutomagicDbOomConfigurator method configure.
/**
* Configures {@link DbOomManager} with specified class path.
* @see AutomagicDbOomConfigurator#configure(jodd.db.oom.DbOomManager)
*/
public void configure(DbOomManager dbOomManager, File[] classpath) {
this.dbOomManager = dbOomManager;
rulesEntries.smartMode();
elapsed = System.currentTimeMillis();
try {
scanPaths(classpath);
} catch (Exception ex) {
throw new DbOomException("Scan classpath error", ex);
}
elapsed = System.currentTimeMillis() - elapsed;
if (log.isInfoEnabled()) {
log.info("DbOomManager configured in " + elapsed + " ms. Total entities: " + dbOomManager.getTotalNames());
}
}
Aggregations