/** * Get a single index configuration (as stored in zookeeper). */ @GET @Path("{name}/config") @Produces("application/json") public Response getConfig(@PathParam("name") String name) throws IndexerNotFoundException, IOException { IndexerDefinition index = getModel().getIndexer(name); ObjectMapper m = new ObjectMapper(); ObjectNode json = m.createObjectNode(); json.put("occVersion", index.getOccVersion()); json.put("config", new String(index.getConfiguration(), Charsets.UTF_8)); return Response.ok(m.writeValueAsString(json), new MediaType("application", "json")).build(); }
/** * Get a single index configuration (as stored in zookeeper). */ @GET @Path("{name}/config") @Produces("application/json") public Response getConfig(@PathParam("name") String name) throws IndexerNotFoundException, IOException { IndexerDefinition index = getModel().getIndexer(name); ObjectMapper m = new ObjectMapper(); ObjectNode json = m.createObjectNode(); json.put("occVersion", index.getOccVersion()); json.put("config", new String(index.getConfiguration(), Charsets.UTF_8)); return Response.ok(m.writeValueAsString(json), new MediaType("application", "json")).build(); }
public IndexInfo(IndexerDefinition indexDefinition, IndexerConf indexerConf, RepositoryManager repositoryManager) throws IndexerConfException, RepositoryException, InterruptedException { this.indexDefinition = indexDefinition; this.indexerConf = indexerConf; String repoParam = indexDefinition.getConnectionParams().get(LResultToSolrMapper.REPO_KEY); LRepository repository = repositoryName == null ? repositoryManager.getDefaultRepository() : repositoryManager.getRepository(repositoryName); repositoryName = repoParam == null ? RepoAndTableUtil.DEFAULT_REPOSITORY : repoParam; this.lilyIndexerConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(indexDefinition.getConfiguration()), repository); }
private void restartIndexer(IndexerDefinition indexerDef) { IndexerHandle handle = indexers.get(indexerDef.getName()); if (handle.indexerDef.getOccVersion() >= indexerDef.getOccVersion()) { return; } boolean relevantChanges = !Arrays.equals(handle.indexerDef.getConfiguration(), indexerDef.getConfiguration()) || Objects.equal(handle.indexerDef.getConnectionType(), indexerDef.getConnectionType()) || !Objects.equal(handle.indexerDef.getConnectionParams(), indexerDef.getConnectionParams()); if (!relevantChanges) { return; } if (stopIndexer(indexerDef.getName())) { startIndexer(indexerDef); } }
private void restartIndexer(IndexerDefinition indexerDef) { IndexerHandle handle = indexers.get(indexerDef.getName()); if (handle.indexerDef.getOccVersion() >= indexerDef.getOccVersion()) { return; } boolean relevantChanges = !Arrays.equals(handle.indexerDef.getConfiguration(), indexerDef.getConfiguration()) || Objects.equal(handle.indexerDef.getConnectionType(), indexerDef.getConnectionType()) || !Objects.equal(handle.indexerDef.getConnectionParams(), indexerDef.getConnectionParams()); if (!relevantChanges) { return; } if (stopIndexer(indexerDef.getName())) { startIndexer(indexerDef); } }
private String fetchIndexerTableName(String indexerName) throws Exception{ // best effort since this could be a pattern ... IndexerDefinition indexerDefinition = get(indexerName); IndexerComponentFactory factory = IndexerComponentFactoryUtil.getComponentFactory(indexerDefinition.getIndexerComponentFactory(), new ByteArrayInputStream(indexerDefinition.getConfiguration()), indexerDefinition.getConnectionParams()); String tableName = factory.createIndexerConf().getTable(); // TODO we should fail if the table does not exist return tableName; }
private String fetchIndexerTableName(String indexerName) throws Exception{ // best effort since this could be a pattern ... IndexerDefinition indexerDefinition = get(indexerName); IndexerComponentFactory factory = IndexerComponentFactoryUtil.getComponentFactory(indexerDefinition.getIndexerComponentFactory(), new ByteArrayInputStream(indexerDefinition.getConfiguration()), indexerDefinition.getConnectionParams()); String tableName = factory.createIndexerConf().getTable(); // TODO we should fail if the table does not exist return tableName; }
IndexerDefinition indexerDefinition = indexerModel.getIndexer(hbaseIndexerName); hbaseIndexerComponentFactory = indexerDefinition.getIndexerComponentFactory(); configuration = indexerDefinition.getConfiguration(); if (indexerDefinition.getConnectionParams() != null) { indexConnectionParams.putAll(indexerDefinition.getConnectionParams());
byte[] indexerConfXml = indexDef.getConfiguration(); IndexerConf indexerConf = null; IndexerComponentFactory factory = IndexerComponentFactoryUtil.getComponentFactory(indexDef.getIndexerComponentFactory(), new ByteArrayInputStream(indexDef.getConfiguration()), indexDef.getConnectionParams()); factory.configure(new ByteArrayInputStream(indexerConfXml), indexDef.getConnectionParams()); indexerConf = factory.createIndexerConf();
printConf(indexer.getConfiguration(), 6, ps, options.has("dump")); ps.println(" + Indexer component factory: " + indexer.getIndexerComponentFactory()); ps.println(" + Additional batch index CLI arguments:");
IndexerDefinition indexerDefinition = indexerModel.getIndexer(hbaseIndexerName); hbaseIndexerComponentFactory = indexerDefinition.getIndexerComponentFactory(); configuration = indexerDefinition.getConfiguration(); if (indexerDefinition.getConnectionParams() != null) { indexConnectionParams.putAll(indexerDefinition.getConnectionParams());
printConf(indexer.getConfiguration(), 6, ps, options.has("dump")); ps.println(" + Indexer component factory: " + indexer.getIndexerComponentFactory()); ps.println(" + Additional batch index CLI arguments:");
IndexerComponentFactory factory = IndexerComponentFactoryUtil.getComponentFactory(indexerDef.getIndexerComponentFactory(), new ByteArrayInputStream(indexerDef.getConfiguration()), indexerDef.getConnectionParams()); IndexerConf indexerConf = factory.createIndexerConf();
IndexerComponentFactory factory = IndexerComponentFactoryUtil.getComponentFactory(indexer.getIndexerComponentFactory(), new ByteArrayInputStream(indexer.getConfiguration()), indexer.getConnectionParams()); IndexerConf indexerConf = factory.createIndexerConf(); if (indexerConf.tableNameIsRegex()) {
public IndexerDefinitionBuilder startFrom(IndexerDefinition existingDefinition) { this.name = existingDefinition.getName(); this.lifecycleState = existingDefinition.getLifecycleState(); this.batchIndexingState = existingDefinition.getBatchIndexingState(); this.incrementalIndexingState = existingDefinition.getIncrementalIndexingState(); this.subscriptionId = existingDefinition.getSubscriptionId(); this.configuration = existingDefinition.getConfiguration(); this.indexerComponentFactory = existingDefinition.getIndexerComponentFactory(); this.connectionType = existingDefinition.getConnectionType(); this.connectionParams = existingDefinition.getConnectionParams(); this.defaultBatchIndexCliArguments = existingDefinition.getDefaultBatchIndexCliArguments(); this.batchIndexCliArguments = existingDefinition.getBatchIndexCliArguments(); this.lastBatchBuildInfo = existingDefinition.getLastBatchBuildInfo(); this.activeBatchBuildInfo = existingDefinition.getActiveBatchBuildInfo(); this.subscriptionTimestamp = existingDefinition.getSubscriptionTimestamp(); this.occVersion = existingDefinition.getOccVersion(); return this; }
public IndexerDefinitionBuilder startFrom(IndexerDefinition existingDefinition) { this.name = existingDefinition.getName(); this.lifecycleState = existingDefinition.getLifecycleState(); this.batchIndexingState = existingDefinition.getBatchIndexingState(); this.incrementalIndexingState = existingDefinition.getIncrementalIndexingState(); this.subscriptionId = existingDefinition.getSubscriptionId(); this.configuration = existingDefinition.getConfiguration(); this.indexerComponentFactory = existingDefinition.getIndexerComponentFactory(); this.connectionType = existingDefinition.getConnectionType(); this.connectionParams = existingDefinition.getConnectionParams(); this.defaultBatchIndexCliArguments = existingDefinition.getDefaultBatchIndexCliArguments(); this.batchIndexCliArguments = existingDefinition.getBatchIndexCliArguments(); this.lastBatchBuildInfo = existingDefinition.getLastBatchBuildInfo(); this.activeBatchBuildInfo = existingDefinition.getActiveBatchBuildInfo(); this.subscriptionTimestamp = existingDefinition.getSubscriptionTimestamp(); this.occVersion = existingDefinition.getOccVersion(); return this; }
throw new IndexerValidityException("Name should not be null or zero-length"); if (indexer.getConfiguration() == null) throw new IndexerValidityException("Configuration should not be null.");
throw new IndexerValidityException("Name should not be null or zero-length"); if (indexer.getConfiguration() == null) throw new IndexerValidityException("Configuration should not be null.");
node.put("indexerComponentFactory", indexer.getIndexerComponentFactory()); setByteArrayProperty(node, "configuration", indexer.getConfiguration());
node.put("indexerComponentFactory", indexer.getIndexerComponentFactory()); setByteArrayProperty(node, "configuration", indexer.getConfiguration());