use of com.emc.storageos.db.common.DataObjectScanner in project coprhd-controller by CoprHD.
the class LocalCassandraService method startDb.
private void startDb() throws IOException {
ServiceImpl service = new ServiceImpl();
service.setName("dbsvc");
service.setEndpoint(URI.create("thrift://localhost:9160"));
service.setId("foobar");
DataObjectScanner scanner = new DataObjectScanner();
scanner.setPackages("com.emc.sa.model");
scanner.init();
SchemaUtil util = new SchemaUtil();
util.setKeyspaceName(DEFAULT_KEYSPACE_NAME);
util.setClusterName(DEFAULT_CLUSTER_NAME);
util.setDataObjectScanner(scanner);
util.setService(service);
dbService = new DbServiceImpl();
dbService.setConfig(createConfig(configResource, rootDir.getAbsolutePath()));
dbService.setSchemaUtil(util);
dbService.setCoordinator(coordinator);
dbService.setService(service);
dbService.start();
}
use of com.emc.storageos.db.common.DataObjectScanner in project coprhd-controller by CoprHD.
the class GlobalGarbageCollectorTests method initGCExecutor.
private void initGCExecutor() throws IOException, URISyntaxException {
_scanner = new DataObjectScanner();
_scanner.setPackages("com.emc.storageos.db.client.model");
_scanner.init();
_localGCExecutor = new GarbageCollectionExecutor();
_localGCExecutor.setDataObjectScanner(_scanner);
_globalGCExecutor = new GarbageCollectionExecutor();
_globalGCExecutor.setDataObjectScanner(_scanner);
GarbageCollectionExecutorLoop localGCExecutorLoop = new LocalGCExecutorLoop();
localGCExecutorLoop.setDbClient(_dbClient);
localGCExecutorLoop.setCoordinator(geoRunner.getCoordinator());
localGCExecutorLoop.setGcDelayMins(0);
GarbageCollectionExecutorLoop globalGCExecutorLoop = new GlobalGCExecutorLoop();
globalGCExecutorLoop.setDbClient(_dbClient);
globalGCExecutorLoop.setCoordinator(geoRunner.getCoordinator());
globalGCExecutorLoop.setGcDelayMins(0);
_localGCExecutor.setGcExecutor(localGCExecutorLoop);
_globalGCExecutor.setGcExecutor(globalGCExecutorLoop);
}
use of com.emc.storageos.db.common.DataObjectScanner in project coprhd-controller by CoprHD.
the class DbServiceTestBase method startDb.
/**
* Start embedded DB
*/
protected void startDb(String schemaVersion, String extraModelsPkg) throws Exception {
List<String> packages = new ArrayList<String>();
packages.add("com.emc.storageos.db.client.model");
if (extraModelsPkg != null) {
packages.add(extraModelsPkg);
}
String[] pkgsArray = packages.toArray(new String[packages.size()]);
ServiceImpl service = new ServiceImpl();
service.setName("dbsvc");
service.setVersion(schemaVersion);
service.setEndpoint(URI.create("thrift://localhost:9160"));
service.setId("db-standalone");
DataObjectScanner scanner = new DataObjectScanner();
scanner.setPackages(pkgsArray);
scanner.init();
dbVersionInfo = new DbVersionInfo();
dbVersionInfo.setSchemaVersion(schemaVersion);
coordinator.setDbVersionInfo(dbVersionInfo);
DbServiceStatusChecker statusChecker = new DbServiceStatusChecker();
statusChecker.setCoordinator(coordinator);
statusChecker.setClusterNodeCount(1);
statusChecker.setDbVersionInfo(dbVersionInfo);
statusChecker.setServiceName(service.getName());
CoordinatorClientInetAddressMap coordinatorMap = new CoordinatorClientInetAddressMap();
coordinatorMap.setNodeId("localhost");
coordinatorMap.setDualInetAddress(DualInetAddress.fromAddress("127.0.0.1"));
Map<String, DualInetAddress> addressLookupMap = new HashMap<String, DualInetAddress>();
addressLookupMap.put(coordinatorMap.getNodeId(), coordinatorMap.getDualInetAddress());
coordinatorMap.setControllerNodeIPLookupMap(addressLookupMap);
coordinatorMap.setCoordinatorClient(coordinator);
coordinator.setInetAddessLookupMap(coordinatorMap);
SchemaUtil util = new SchemaUtil();
util.setKeyspaceName("Test");
util.setClusterName("Test");
util.setDataObjectScanner(scanner);
util.setService(service);
util.setStatusChecker(statusChecker);
util.setCoordinator(coordinator);
util.setVdcShortId("vdc1");
util.setClientContext(createLocalContext());
List<String> vdcHosts = new ArrayList();
vdcHosts.add("127.0.0.1");
util.setVdcNodeList(vdcHosts);
util.setDbCommonInfo(new java.util.Properties());
dbsvc = new InternalDbService();
dbsvc.setConfig("db-test.yaml");
dbsvc.setSchemaUtil(util);
dbsvc.setCoordinator(coordinator);
dbsvc.setStatusChecker(statusChecker);
dbsvc.setService(service);
dbsvc.setDbDir(".");
JmxServerWrapper jmx = new JmxServerWrapper();
jmx.setEnabled(false);
dbsvc.setJmxServerWrapper(jmx);
dbClient = getDbClientBase();
dbsvc.setDbClient(dbClient);
PasswordUtils passwordUtils = new PasswordUtils();
passwordUtils.setCoordinator(coordinator);
EncryptionProviderImpl provider = new EncryptionProviderImpl();
provider.setCoordinator(coordinator);
provider.start();
passwordUtils.setEncryptionProvider(provider);
passwordUtils.setDbClient(dbClient);
util.setPasswordUtils(passwordUtils);
StubBeaconImpl beacon = new StubBeaconImpl(service);
dbsvc.setBeacon(beacon);
MigrationHandlerImpl handler = new MigrationHandlerImpl();
handler.setPackages(pkgsArray);
handler.setService(service);
handler.setStatusChecker(statusChecker);
handler.setCoordinator(coordinator);
handler.setDbClient(dbClient);
handler.setSchemaUtil(util);
dbsvc.setMigrationHandler(handler);
dbsvc.setDisableScheduledDbRepair(true);
dbsvc.start();
}
use of com.emc.storageos.db.common.DataObjectScanner in project coprhd-controller by CoprHD.
the class LazyLoadTests method setup.
@BeforeClass
public static void setup() throws IOException {
sourceVersion = new DbVersionInfo();
sourceVersion.setSchemaVersion("1.1");
_dataDir = new File(dataDir);
if (_dataDir.exists() && _dataDir.isDirectory()) {
cleanDirectory(_dataDir);
}
_dataDir.mkdir();
DataObjectScanner scanner = new DataObjectScanner();
scanner.setPackages("com.emc.storageos.db.modelclient.model");
scanner.init();
// setting migration status to failed is a workaround for getting into
// an endless loop of trying to run migration; if it's set to failed, we
// simply by-pass migration; the other side affect is we don't start any
// of the dbsvc background tasks, but we don't need them for this test
setMigrationStatus(MigrationStatus.FAILED);
startDb(sourceVersion.getSchemaVersion(), sourceVersion.getSchemaVersion(), null, scanner, false);
}
use of com.emc.storageos.db.common.DataObjectScanner in project coprhd-controller by CoprHD.
the class DBClient method printDependencies.
public void printDependencies(String cfName, URI uri) {
final Class type = _cfMap.get(cfName);
if (type == null) {
System.err.println("Unknown Column Family: " + cfName);
return;
}
DataObjectScanner dataObjectscanner = (DataObjectScanner) ctx.getBean("dataObjectScanner");
DependencyTracker dependencyTracker = dataObjectscanner.getDependencyTracker();
String output = uri == null ? type.getSimpleName() : uri.toString();
printDependencies(type, uri, true, "", output, dependencyTracker);
if (uri != null) {
if (foundReference) {
System.out.println("\nFound references of this id: " + uri);
} else {
System.out.println("\nNo reference was found of this id: " + uri);
}
}
}
Aggregations