/** * Indicates that a Mock instance of Accumulo is being used to back the Rya instance. * * @param conf - The configuration object that will be interrogated. (not null) * @return {@code true} if the Rya instance is backed by a mock Accumulo; otherwise {@code false}. */ public static boolean useMockInstance(final Configuration conf) { return new AccumuloRdfConfiguration(conf).useMockInstance(); }
/** * Indicates that a Mock instance of Accumulo is being used to back the Rya instance. * * @param conf - The configuration object that will be interrogated. (not null) * @return {@code true} if the Rya instance is backed by a mock Accumulo; otherwise {@code false}. */ public static boolean useMockInstance(final Configuration conf) { return new AccumuloRdfConfiguration(conf).useMockInstance(); }
config.useMockInstance(true); config.setTablePrefix("rya_"); config.setUsername("user");
/** * Create a {@link Connector} that connects to an Accumulo instance. The {@link AccumuloRdfConfiguration#USE_MOCK_INSTANCE} * flag must be set if the configuration information needs to connect to a mock instance of Accumulo. If this is * the case, then the Zookeepers information should not be set. * * @param config - The configuration that will be used to initialize the connector. (not null) * @return The {@link Connector} that was created by {@code config}. * @throws AccumuloException The connector couldn't be created because of an Accumulo problem. * @throws AccumuloSecurityException The connector couldn't be created because of an Accumulo security violation. */ public static Connector connect(AccumuloRdfConfiguration config) throws AccumuloException, AccumuloSecurityException { requireNonNull(config); // Wrap the configuration as the Accumulo configuration so that we may have access // to Accumulo specific configuration values. final AccumuloRdfConfiguration accConf = new AccumuloRdfConfiguration(config); // Create the Mock or Zookeeper backed Instance depending on the configuration. final Instance instance; if(accConf.useMockInstance()) { instance = new MockInstance(accConf.getInstanceName()); } else { instance = new ZooKeeperInstance(accConf.getInstanceName(), accConf.getZookeepers()); } // Return a connector using the configured username and password. return instance.getConnector(accConf.getUsername(), new PasswordToken(accConf.getPassword())); } }
/** * Create a {@link Connector} that connects to an Accumulo instance. The {@link AccumuloRdfConfiguration#USE_MOCK_INSTANCE} * flag must be set if the configuration information needs to connect to a mock instance of Accumulo. If this is * the case, then the Zookeepers information should not be set. * * @param config - The configuration that will be used to initialize the connector. (not null) * @return The {@link Connector} that was created by {@code config}. * @throws AccumuloException The connector couldn't be created because of an Accumulo problem. * @throws AccumuloSecurityException The connector couldn't be created because of an Accumulo security violation. */ public static Connector connect(AccumuloRdfConfiguration config) throws AccumuloException, AccumuloSecurityException { requireNonNull(config); // Wrap the configuration as the Accumulo configuration so that we may have access // to Accumulo specific configuration values. final AccumuloRdfConfiguration accConf = new AccumuloRdfConfiguration(config); // Create the Mock or Zookeeper backed Instance depending on the configuration. final Instance instance; if(accConf.useMockInstance()) { instance = new MockInstance(accConf.getInstanceName()); } else { instance = new ZooKeeperInstance(accConf.getInstanceName(), accConf.getZookeepers()); } // Return a connector using the configured username and password. return instance.getConnector(accConf.getUsername(), new PasswordToken(accConf.getPassword())); } }