use of org.apache.rya.export.accumulo.AccumuloRyaStatementStore in project incubator-rya by apache.
the class StoreToStoreIT method getChildAccumulo.
private static AccumuloRyaStatementStore getChildAccumulo() throws Exception {
final AccumuloInstanceDriver driver = new AccumuloInstanceDriver(RYA_INSTANCE, type, true, false, false, "TEST2", PASSWORD, RYA_INSTANCE + "_child", tablePrefix, auths, "");
driver.setUp();
drivers.add(driver);
return new AccumuloRyaStatementStore(driver.getDao(), tablePrefix, RYA_INSTANCE);
}
use of org.apache.rya.export.accumulo.AccumuloRyaStatementStore in project incubator-rya by apache.
the class StatementStoreFactory method getMergePolicyStatementStore.
private RyaStatementStore getMergePolicyStatementStore(final RyaStatementStore store, final MergePolicy policy, final String ryaInstanceName, final DBType dbType) {
RyaStatementStore policyStore = null;
if (policy == MergePolicy.TIMESTAMP) {
final TimestampPolicyMergeConfiguration timeConfig = (TimestampPolicyMergeConfiguration) configuration;
final Date timestamp = timeConfig.getToolStartTime();
if (dbType == DBType.MONGO) {
policyStore = new TimestampPolicyMongoRyaStatementStore((MongoRyaStatementStore) store, timestamp, ryaInstanceName);
} else {
policyStore = new TimestampPolicyAccumuloRyaStatementStore((AccumuloRyaStatementStore) store, timestamp);
}
}
return policyStore == null ? store : policyStore;
}
use of org.apache.rya.export.accumulo.AccumuloRyaStatementStore in project incubator-rya by apache.
the class StatementStoreFactory method getBaseAccumuloStore.
private AccumuloRyaStatementStore getBaseAccumuloStore(final String ryaInstanceName, final InstanceType type, final boolean isParent, final String username, final String password, final String tablePrefix, final String auths, final String zookeepers) throws Exception {
final AccumuloInstanceDriver aInstance = new AccumuloInstanceDriver(ryaInstanceName + "_driver", type, true, false, isParent, username, password, ryaInstanceName, tablePrefix, auths, zookeepers);
aInstance.setUp();
final AccumuloRyaDAO dao = aInstance.getDao();
return new AccumuloRyaStatementStore(dao, tablePrefix, ryaInstanceName);
}
use of org.apache.rya.export.accumulo.AccumuloRyaStatementStore in project incubator-rya by apache.
the class StoreToStoreIT method getParentAccumulo.
private static TimestampPolicyAccumuloRyaStatementStore getParentAccumulo() throws Exception {
final AccumuloInstanceDriver driver = new AccumuloInstanceDriver(RYA_INSTANCE, type, true, false, true, "TEST1", PASSWORD, RYA_INSTANCE, tablePrefix, auths, "");
driver.setUp();
final AccumuloRyaStatementStore store = new AccumuloRyaStatementStore(driver.getDao(), tablePrefix, RYA_INSTANCE);
drivers.add(driver);
return new TimestampPolicyAccumuloRyaStatementStore(store, currentDate);
}
use of org.apache.rya.export.accumulo.AccumuloRyaStatementStore in project incubator-rya by apache.
the class MergeDriverClient method main.
public static void main(final String[] args) throws ParseException, MergeConfigurationException, UnknownHostException, MergerException, java.text.ParseException, SailException, AccumuloException, AccumuloSecurityException, InferenceEngineException, RepositoryException, MalformedQueryException, UpdateExecutionException {
final String log4jConfiguration = System.getProperties().getProperty("log4j.configuration");
if (StringUtils.isNotBlank(log4jConfiguration)) {
final String parsedConfiguration = PathUtils.clean(StringUtils.removeStart(log4jConfiguration, "file:"));
final File configFile = new File(parsedConfiguration);
if (configFile.exists()) {
DOMConfigurator.configure(parsedConfiguration);
} else {
BasicConfigurator.configure();
}
}
final MergeConfigurationCLI config = new MergeConfigurationCLI(args);
try {
configuration = config.createConfiguration();
} catch (final MergeConfigurationException e) {
LOG.error("Configuration failed.", e);
}
final boolean useTimeSync = configuration.getUseNtpServer();
Optional<Long> offset = Optional.absent();
if (useTimeSync) {
final String tomcat = configuration.getChildTomcatUrl();
final String ntpHost = configuration.getNtpServerHost();
try {
offset = Optional.<Long>fromNullable(TimeUtils.getNtpServerAndMachineTimeDifference(ntpHost, tomcat));
} catch (final IOException e) {
LOG.error("Unable to get time difference between time server: " + ntpHost + " and the server: " + tomcat, e);
}
}
final StatementStoreFactory storeFactory = new StatementStoreFactory(configuration);
try {
final RyaStatementStore parentStore = storeFactory.getParentStatementStore();
final RyaStatementStore childStore = storeFactory.getChildStatementStore();
LOG.info("Starting Merge Tool");
if (configuration.getParentDBType() == ACCUMULO && configuration.getChildDBType() == ACCUMULO) {
final AccumuloRyaStatementStore childAStore = (AccumuloRyaStatementStore) childStore;
final AccumuloRyaStatementStore parentAStore = (AccumuloRyaStatementStore) parentStore;
// do map reduce merging.
// TODO: Run Merger
} else {
if (configuration.getMergePolicy() == TIMESTAMP) {
final TimestampPolicyMergeConfiguration timeConfig = (TimestampPolicyMergeConfiguration) configuration;
final Long timeOffset;
if (offset.isPresent()) {
timeOffset = offset.get();
} else {
timeOffset = 0L;
}
final MemoryTimeMerger merger = new MemoryTimeMerger(parentStore, childStore, new VisibilityStatementMerger(), timeConfig.getToolStartTime(), configuration.getParentRyaInstanceName(), timeOffset);
merger.runJob();
}
}
} catch (final Exception e) {
LOG.error("Something went wrong creating a Rya Statement Store connection.", e);
}
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(final Thread thread, final Throwable throwable) {
LOG.error("Uncaught exception in " + thread.getName(), throwable);
}
});
LOG.info("Finished running Merge Tool");
System.exit(1);
}
Aggregations