use of org.apache.rya.export.DBType in project incubator-rya by apache.
the class StatementStoreFactory method getParentStatementStore.
/**
* Builds and retrieves the Parent {@link RyaStatementStore}.
* @return The created {@link RyaStatementStore} that connects to the Parent rya.
* @throws Exception - Something went wrong creating the {@link RyaStatementStore}.
*/
public RyaStatementStore getParentStatementStore() throws Exception {
final DBType dbType = configuration.getParentDBType();
final String ryaInstanceName = configuration.getParentRyaInstanceName();
RyaStatementStore store = getBaseStatementStore(dbType, configuration.getParentHostname(), configuration.getParentPort(), ryaInstanceName, configuration.getParentTablePrefix(), configuration, true);
store = getMergePolicyStatementStore(store, configuration.getMergePolicy(), ryaInstanceName, dbType);
return store;
}
use of org.apache.rya.export.DBType in project incubator-rya by apache.
the class MergeConfigurationCLI method createConfiguration.
/**
* Attempts to create the {@link MergeConfiguration} based on the provided
* configuration file.
* @return The {@link MergeConfiguration} created.
* @throws MergeConfigurationException - Thrown when the provided file is
* not formatted properly for a {@link MergeConfiguration}.
*/
public MergeConfiguration createConfiguration() throws MergeConfigurationException {
if (configuration == null) {
// If the config option is present, ignore all other options.
if (cmd.hasOption(CONFIG_OPTION.getOpt())) {
final File xml = new File(cmd.getOptionValue(CONFIG_OPTION.getOpt()));
final ConfigurationAdapter adapter = new ConfigurationAdapter();
configuration = adapter.createConfig(createConfigurationFromFile(xml));
} else {
final DBType parentType = DBType.fromValue(cmd.getOptionValue(PARENT_DB_OPTION.getLongOpt()));
final DBType childType = DBType.fromValue(cmd.getOptionValue(CHILD_DB_OPTION.getLongOpt()));
final MergePolicy mergePolicy = MergePolicy.fromValue(cmd.getOptionValue(MERGE_OPTION.getLongOpt()));
MergeConfiguration.Builder builder = new MergeConfiguration.Builder().setParentHostname(cmd.getOptionValue(PARENT_HOST_OPTION.getLongOpt())).setParentUsername(cmd.getOptionValue(PARENT_USER_OPTION.getLongOpt())).setParentPassword(cmd.getOptionValue(PARENT_PSWD_OPTION.getLongOpt())).setParentRyaInstanceName(cmd.getOptionValue(PARENT_RYA_OPTION.getLongOpt())).setParentTablePrefix(cmd.getOptionValue(PARENT_PREFIX_OPTION.getLongOpt())).setParentTomcatUrl(cmd.getOptionValue(PARENT_TOMCAT_OPTION.getLongOpt())).setParentDBType(parentType).setParentPort(Integer.parseInt(cmd.getOptionValue(PARENT_PORT_OPTION.getLongOpt()))).setChildHostname(cmd.getOptionValue(CHILD_HOST_OPTION.getLongOpt())).setChildUsername(cmd.getOptionValue(CHILD_USER_OPTION.getLongOpt())).setChildPassword(cmd.getOptionValue(CHILD_PSWD_OPTION.getLongOpt())).setChildRyaInstanceName(cmd.getOptionValue(CHILD_RYA_OPTION.getLongOpt())).setChildTablePrefix(cmd.getOptionValue(CHILD_PREFIX_OPTION.getLongOpt())).setChildTomcatUrl(cmd.getOptionValue(CHILD_TOMCAT_OPTION.getLongOpt())).setChildDBType(childType).setChildPort(Integer.parseInt(cmd.getOptionValue(CHILD_PORT_OPTION.getLongOpt()))).setMergePolicy(mergePolicy);
if (mergePolicy == TIMESTAMP) {
builder = new TimestampPolicyMergeConfiguration.TimestampPolicyBuilder(builder).setToolStartTime(cmd.getOptionValue(TIME_OPTION.getLongOpt()));
}
if (parentType == DBType.ACCUMULO) {
builder = new AccumuloMergeConfiguration.AccumuloBuilder(builder).setParentZookeepers(cmd.getOptionValue(PARENT_ACCUMULO_ZOOKEEPERS_OPTION.getLongOpt())).setParentAuths(cmd.getOptionValue(PARENT_ACCUMULO_AUTHS_OPTION.getLongOpt())).setParentInstanceType(InstanceType.fromValue(cmd.getOptionValue(PARENT_ACCUMULO_TYPE_OPTION.getLongOpt())));
}
if (childType == DBType.ACCUMULO) {
builder = new AccumuloMergeConfiguration.AccumuloBuilder(builder).setChildZookeepers(cmd.getOptionValue(CHILD_ACCUMULO_ZOOKEEPERS_OPTION.getLongOpt())).setChildAuths(cmd.getOptionValue(CHILD_ACCUMULO_AUTHS_OPTION.getLongOpt())).setChildInstanceType(InstanceType.fromValue(cmd.getOptionValue(CHILD_ACCUMULO_TYPE_OPTION.getLongOpt())));
}
configuration = builder.build();
}
}
return configuration;
}
use of org.apache.rya.export.DBType in project incubator-rya by apache.
the class AccumuloConfigurationAdapter method createConfig.
/**
* @param genConfig - The JAXB generated configuration.
* @return The {@link MergeConfiguration} used in the application
* @throws MergeConfigurationException
*/
@Override
public MergeConfiguration createConfig(final MergeToolConfiguration genConfig) throws MergeConfigurationException {
final AccumuloMergeToolConfiguration aConfig = (AccumuloMergeToolConfiguration) genConfig;
final DBType parentType = aConfig.getParentDBType();
final DBType childType = aConfig.getChildDBType();
final MergeConfiguration.Builder configBuilder = super.getBuilder(aConfig);
final AccumuloBuilder builder = new AccumuloBuilder(configBuilder);
if (parentType == DBType.ACCUMULO) {
verifyParentInstanceType(aConfig);
builder.setParentZookeepers(aConfig.getParentZookeepers()).setParentAuths(aConfig.getParentAuths()).setParentInstanceType(aConfig.getParentInstanceType());
}
if (childType == DBType.ACCUMULO) {
verifyChildInstanceType(aConfig);
builder.setChildZookeepers(aConfig.getChildZookeepers()).setChildAuths(aConfig.getChildAuths()).setChildInstanceType(aConfig.getChildInstanceType());
}
return builder.build();
}
Aggregations