use of com.sun.jersey.spi.scanning.AnnotationScannerListener in project coprhd-controller by CoprHD.
the class DBClient method init.
public void init() {
try {
System.out.println("Initializing db client ...");
ctx = new ClassPathXmlApplicationContext("/dbutils-conf.xml");
InternalDbClientImpl dbClient = (InternalDbClientImpl) ctx.getBean("dbclient");
_geodbContext = (DbClientContext) ctx.getBean("geodbclientcontext");
vdcConfHelper = (VdcConfigHelper) ctx.getBean("vdcConfHelper");
geoEncryptionProvider = (EncryptionProviderImpl) ctx.getBean("geoEncryptionProvider");
encryptionProvider = (EncryptionProviderImpl) ctx.getBean("encryptionProvider");
dbClient.setBypassMigrationLock(skipMigrationCheck);
dbClient.start();
_dbClient = dbClient;
// scan for classes with @Cf annotation
System.out.println("Initializing column family map ...");
AnnotationScannerListener scannerListener = new AnnotationScannerListener(Cf.class);
String[] packages = { pkgs };
PackageNamesScanner scanner = new PackageNamesScanner(packages);
scanner.scan(scannerListener);
Iterator<Class<?>> it = scannerListener.getAnnotatedClasses().iterator();
while (it.hasNext()) {
Class clazz = it.next();
// The fields of SchemaRecord don't have Name annotation either.
if (DataObject.class.isAssignableFrom(clazz)) {
DataObjectType doType = TypeMap.getDoType(clazz);
_cfMap.put(doType.getCF().getName(), clazz);
}
}
} catch (Exception e) {
System.err.println("Caught Exception: " + e);
log.error("Caught Exception: ", e);
}
}
Aggregations