Search in sources :

Example 1 with Editor

use of org.modeshape.schematic.document.Editor in project kylo by Teradata.

the class ElasticSearchRestModeShapeConfigurationService method build.

@Override
public RepositoryConfiguration build() {
    RepositoryConfiguration repositoryConfiguration;
    final String EMPTY_CONFIG = "{}";
    final String KYLO_CATEGORIES = "kylo-categories";
    final String KYLO_FEEDS = "kylo-feeds";
    final String INDEXES = "indexes";
    final String INDEX_PROVIDERS = "indexProviders";
    try {
        repositoryConfiguration = RepositoryConfiguration.read(EMPTY_CONFIG);
    } catch (ParsingException | FileNotFoundException e) {
        e.printStackTrace();
        return null;
    }
    Editor editor = repositoryConfiguration.edit();
    EditableDocument indexesDocument = editor.getOrCreateDocument(INDEXES);
    EditableDocument categoriesIndexDocument = indexesDocument.getOrCreateDocument(KYLO_CATEGORIES);
    EditableDocument feedsIndexDocument = indexesDocument.getOrCreateDocument(KYLO_FEEDS);
    categoriesIndexDocument.putAll(getCategoriesIndexConfiguration());
    feedsIndexDocument.putAll(getFeedsIndexConfiguration());
    EditableDocument indexProvidersDocument = editor.getOrCreateDocument(INDEX_PROVIDERS);
    EditableDocument elasticSearchIndexProviderDocument = indexProvidersDocument.getOrCreateDocument(ELASTIC_SEARCH);
    elasticSearchIndexProviderDocument.putAll(getElasticSearchIndexProviderConfiguration());
    repositoryConfiguration = new RepositoryConfiguration(editor, repositoryConfiguration.getName());
    return repositoryConfiguration;
}
Also used : EditableDocument(org.modeshape.schematic.document.EditableDocument) ParsingException(org.modeshape.schematic.document.ParsingException) FileNotFoundException(java.io.FileNotFoundException) RepositoryConfiguration(org.modeshape.jcr.RepositoryConfiguration) Editor(org.modeshape.schematic.document.Editor)

Example 2 with Editor

use of org.modeshape.schematic.document.Editor in project kylo by Teradata.

the class ElasticSearchModeShapeConfigurationService method build.

@Override
public RepositoryConfiguration build() {
    RepositoryConfiguration repositoryConfiguration;
    final String EMPTY_CONFIG = "{}";
    final String KYLO_CATEGORIES = "kylo-categories";
    final String KYLO_FEEDS = "kylo-feeds";
    final String INDEXES = "indexes";
    final String INDEX_PROVIDERS = "indexProviders";
    try {
        repositoryConfiguration = RepositoryConfiguration.read(EMPTY_CONFIG);
    } catch (ParsingException | FileNotFoundException e) {
        log.error("Error loading the repository configuration", e);
        return null;
    }
    Editor editor = repositoryConfiguration.edit();
    EditableDocument indexesDocument = editor.getOrCreateDocument(INDEXES);
    EditableDocument categoriesIndexDocument = indexesDocument.getOrCreateDocument(KYLO_CATEGORIES);
    EditableDocument feedsIndexDocument = indexesDocument.getOrCreateDocument(KYLO_FEEDS);
    categoriesIndexDocument.putAll(getCategoriesIndexConfiguration());
    feedsIndexDocument.putAll(getFeedsIndexConfiguration());
    EditableDocument indexProvidersDocument = editor.getOrCreateDocument(INDEX_PROVIDERS);
    EditableDocument elasticSearchIndexProviderDocument = indexProvidersDocument.getOrCreateDocument(ELASTIC_SEARCH);
    elasticSearchIndexProviderDocument.putAll(getElasticSearchIndexProviderConfiguration());
    repositoryConfiguration = new RepositoryConfiguration(editor, repositoryConfiguration.getName());
    return repositoryConfiguration;
}
Also used : EditableDocument(org.modeshape.schematic.document.EditableDocument) ParsingException(org.modeshape.schematic.document.ParsingException) FileNotFoundException(java.io.FileNotFoundException) RepositoryConfiguration(org.modeshape.jcr.RepositoryConfiguration) Editor(org.modeshape.schematic.document.Editor)

Example 3 with Editor

use of org.modeshape.schematic.document.Editor in project kylo by Teradata.

the class SolrSearchModeShapeConfigurationService method build.

@Override
public RepositoryConfiguration build() {
    RepositoryConfiguration repositoryConfiguration;
    final String EMPTY_CONFIG = "{}";
    final String KYLO_CATEGORIES_METADATA = "kylo-categories-metadata";
    final String KYLO_FEEDS_METADATA = "kylo-feeds-metadata";
    final String INDEXES = "indexes";
    final String INDEX_PROVIDERS = "indexProviders";
    try {
        repositoryConfiguration = RepositoryConfiguration.read(EMPTY_CONFIG);
    } catch (ParsingException | FileNotFoundException e) {
        e.printStackTrace();
        repositoryConfiguration = new RepositoryConfiguration();
    }
    Editor editor = repositoryConfiguration.edit();
    EditableDocument indexesDocument = editor.getOrCreateDocument(INDEXES);
    EditableDocument categoriesIndexDocument = indexesDocument.getOrCreateDocument(KYLO_CATEGORIES_METADATA);
    EditableDocument feedsIndexDocument = indexesDocument.getOrCreateDocument(KYLO_FEEDS_METADATA);
    categoriesIndexDocument.putAll(getCategoriesIndexConfiguration());
    feedsIndexDocument.putAll(getFeedsIndexConfiguration());
    EditableDocument indexProvidersDocument = editor.getOrCreateDocument(INDEX_PROVIDERS);
    EditableDocument localNamedIndexProviderDocument = indexProvidersDocument.getOrCreateDocument(LUCENE);
    localNamedIndexProviderDocument.putAll(getLuceneIndexProviderConfiguration());
    repositoryConfiguration = new RepositoryConfiguration(editor, repositoryConfiguration.getName());
    return repositoryConfiguration;
}
Also used : EditableDocument(org.modeshape.schematic.document.EditableDocument) ParsingException(org.modeshape.schematic.document.ParsingException) FileNotFoundException(java.io.FileNotFoundException) RepositoryConfiguration(org.modeshape.jcr.RepositoryConfiguration) Editor(org.modeshape.schematic.document.Editor)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)3 RepositoryConfiguration (org.modeshape.jcr.RepositoryConfiguration)3 EditableDocument (org.modeshape.schematic.document.EditableDocument)3 Editor (org.modeshape.schematic.document.Editor)3 ParsingException (org.modeshape.schematic.document.ParsingException)3