Search in sources :

Example 1 with DBType

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;
}
Also used : DBType(org.apache.rya.export.DBType) MongoRyaStatementStore(org.apache.rya.export.mongo.MongoRyaStatementStore) AccumuloRyaStatementStore(org.apache.rya.export.accumulo.AccumuloRyaStatementStore) TimestampPolicyAccumuloRyaStatementStore(org.apache.rya.export.accumulo.policy.TimestampPolicyAccumuloRyaStatementStore) RyaStatementStore(org.apache.rya.export.api.store.RyaStatementStore) TimestampPolicyMongoRyaStatementStore(org.apache.rya.export.mongo.policy.TimestampPolicyMongoRyaStatementStore)

Example 2 with DBType

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;
}
Also used : ConfigurationAdapter(org.apache.rya.export.api.conf.ConfigurationAdapter) MergePolicy(org.apache.rya.export.MergePolicy) DBType(org.apache.rya.export.DBType) MergeConfiguration(org.apache.rya.export.api.conf.MergeConfiguration) TimestampPolicyMergeConfiguration(org.apache.rya.export.api.conf.policy.TimestampPolicyMergeConfiguration) AccumuloMergeConfiguration(org.apache.rya.export.api.conf.AccumuloMergeConfiguration) File(java.io.File)

Example 3 with DBType

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();
}
Also used : AccumuloMergeToolConfiguration(org.apache.rya.export.AccumuloMergeToolConfiguration) AccumuloBuilder(org.apache.rya.export.api.conf.AccumuloMergeConfiguration.AccumuloBuilder) DBType(org.apache.rya.export.DBType)

Aggregations

DBType (org.apache.rya.export.DBType)3 File (java.io.File)1 AccumuloMergeToolConfiguration (org.apache.rya.export.AccumuloMergeToolConfiguration)1 MergePolicy (org.apache.rya.export.MergePolicy)1 AccumuloRyaStatementStore (org.apache.rya.export.accumulo.AccumuloRyaStatementStore)1 TimestampPolicyAccumuloRyaStatementStore (org.apache.rya.export.accumulo.policy.TimestampPolicyAccumuloRyaStatementStore)1 AccumuloMergeConfiguration (org.apache.rya.export.api.conf.AccumuloMergeConfiguration)1 AccumuloBuilder (org.apache.rya.export.api.conf.AccumuloMergeConfiguration.AccumuloBuilder)1 ConfigurationAdapter (org.apache.rya.export.api.conf.ConfigurationAdapter)1 MergeConfiguration (org.apache.rya.export.api.conf.MergeConfiguration)1 TimestampPolicyMergeConfiguration (org.apache.rya.export.api.conf.policy.TimestampPolicyMergeConfiguration)1 RyaStatementStore (org.apache.rya.export.api.store.RyaStatementStore)1 MongoRyaStatementStore (org.apache.rya.export.mongo.MongoRyaStatementStore)1 TimestampPolicyMongoRyaStatementStore (org.apache.rya.export.mongo.policy.TimestampPolicyMongoRyaStatementStore)1