-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from eclipse/add_config_configuration
Support to Eclipse Config #203
- Loading branch information
Showing
149 changed files
with
3,678 additions
and
5,211 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...va/org/eclipse/jnosql/artemis/column/configuration/ColumnFamilyManagerAsyncConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2019 Otávio Santana and others | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
*/ | ||
package org.eclipse.jnosql.artemis.column.configuration; | ||
|
||
import jakarta.nosql.column.ColumnConfiguration; | ||
import jakarta.nosql.column.ColumnFamilyManagerAsync; | ||
import jakarta.nosql.column.ColumnFamilyManagerAsyncFactory; | ||
import org.eclipse.jnosql.artemis.configuration.SettingsConverter; | ||
import org.eclipse.jnosql.artemis.util.BeanManagers; | ||
import org.eclipse.microprofile.config.Config; | ||
import org.eclipse.microprofile.config.spi.Converter; | ||
|
||
/** | ||
* Converter the {@link String} to {@link ColumnFamilyManagerAsync} it will use the {@link SettingsConverter} and | ||
* find by the provider that should be an implementation of {@link ColumnConfiguration} | ||
*/ | ||
public class ColumnFamilyManagerAsyncConverter implements Converter<ColumnFamilyManagerAsync> { | ||
|
||
@Override | ||
public ColumnFamilyManagerAsync convert(String value) { | ||
Config config = BeanManagers.getInstance(Config.class); | ||
final ColumnFamilyManagerAsyncFactory managerFactory = config.getValue(value, ColumnFamilyManagerAsyncFactory.class); | ||
final String database = value + ".database"; | ||
final String entity = config.getValue(database, String.class); | ||
return managerFactory.getAsync(entity); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...eclipse/jnosql/artemis/column/configuration/ColumnFamilyManagerAsyncFactoryConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2019 Otávio Santana and others | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
*/ | ||
package org.eclipse.jnosql.artemis.column.configuration; | ||
|
||
import jakarta.nosql.Settings; | ||
import jakarta.nosql.column.ColumnConfigurationAsync; | ||
import jakarta.nosql.column.ColumnFamilyManagerAsyncFactory; | ||
import jakarta.nosql.mapping.reflection.Reflections; | ||
import org.eclipse.jnosql.artemis.configuration.ConfigurationException; | ||
import org.eclipse.jnosql.artemis.configuration.SettingsConverter; | ||
import org.eclipse.jnosql.artemis.util.BeanManagers; | ||
import org.eclipse.microprofile.config.Config; | ||
import org.eclipse.microprofile.config.spi.Converter; | ||
|
||
/** | ||
* Converter the {@link String} to {@link ColumnFamilyManagerAsyncFactory} it will use the {@link SettingsConverter} and | ||
* find by the provider that should be an implementation of {@link ColumnConfigurationAsync} | ||
*/ | ||
public class ColumnFamilyManagerAsyncFactoryConverter implements Converter<ColumnFamilyManagerAsyncFactory> { | ||
|
||
@Override | ||
public ColumnFamilyManagerAsyncFactory convert(String value) { | ||
final SettingsConverter settingsConverter = BeanManagers.getInstance(SettingsConverter.class); | ||
Config config = BeanManagers.getInstance(Config.class); | ||
final Settings settings = settingsConverter.convert(value); | ||
String provider = value + ".provider"; | ||
final Class<?> configurationClass = config.getValue(provider, Class.class); | ||
if (ColumnConfigurationAsync.class.isAssignableFrom(configurationClass)) { | ||
final Reflections reflections = BeanManagers.getInstance(Reflections.class); | ||
final ColumnConfigurationAsync configuration = (ColumnConfigurationAsync) reflections.newInstance(configurationClass); | ||
return configuration.get(settings); | ||
|
||
} | ||
throw new ConfigurationException("The class " + configurationClass + " is not valid to " + ColumnConfigurationAsync.class); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...in/java/org/eclipse/jnosql/artemis/column/configuration/ColumnFamilyManagerConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2019 Otávio Santana and others | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
*/ | ||
package org.eclipse.jnosql.artemis.column.configuration; | ||
|
||
import jakarta.nosql.column.ColumnConfiguration; | ||
import jakarta.nosql.column.ColumnFamilyManager; | ||
import jakarta.nosql.column.ColumnFamilyManagerFactory; | ||
import org.eclipse.jnosql.artemis.configuration.SettingsConverter; | ||
import org.eclipse.jnosql.artemis.util.BeanManagers; | ||
import org.eclipse.microprofile.config.Config; | ||
import org.eclipse.microprofile.config.spi.Converter; | ||
|
||
/** | ||
* Converter the {@link String} to {@link ColumnFamilyManager} it will use the {@link SettingsConverter} and | ||
* find by the provider that should be an implementation of {@link ColumnConfiguration} | ||
*/ | ||
public class ColumnFamilyManagerConverter implements Converter<ColumnFamilyManager> { | ||
|
||
@Override | ||
public ColumnFamilyManager convert(String value) { | ||
Config config = BeanManagers.getInstance(Config.class); | ||
final ColumnFamilyManagerFactory managerFactory = config.getValue(value, ColumnFamilyManagerFactory.class); | ||
final String database = value + ".database"; | ||
final String entity = config.getValue(database, String.class); | ||
return managerFactory.get(entity); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
.../org/eclipse/jnosql/artemis/column/configuration/ColumnFamilyManagerFactoryConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2019 Otávio Santana and others | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
*/ | ||
package org.eclipse.jnosql.artemis.column.configuration; | ||
|
||
import jakarta.nosql.Settings; | ||
import jakarta.nosql.column.ColumnConfiguration; | ||
import jakarta.nosql.column.ColumnFamilyManagerFactory; | ||
import jakarta.nosql.mapping.reflection.Reflections; | ||
import org.eclipse.jnosql.artemis.configuration.ConfigurationException; | ||
import org.eclipse.jnosql.artemis.configuration.SettingsConverter; | ||
import org.eclipse.jnosql.artemis.util.BeanManagers; | ||
import org.eclipse.microprofile.config.Config; | ||
import org.eclipse.microprofile.config.spi.Converter; | ||
|
||
/** | ||
* Converter the {@link String} to {@link ColumnFamilyManagerFactory} it will use the {@link SettingsConverter} and | ||
* find by the provider that should be an implementation of {@link ColumnConfiguration} | ||
*/ | ||
public class ColumnFamilyManagerFactoryConverter implements Converter<ColumnFamilyManagerFactory> { | ||
|
||
@Override | ||
public ColumnFamilyManagerFactory convert(String value) { | ||
final SettingsConverter settingsConverter = BeanManagers.getInstance(SettingsConverter.class); | ||
Config config = BeanManagers.getInstance(Config.class); | ||
final Settings settings = settingsConverter.convert(value); | ||
String provider = value + ".provider"; | ||
final Class<?> configurationClass = config.getValue(provider, Class.class); | ||
if (ColumnConfiguration.class.isAssignableFrom(configurationClass)) { | ||
final Reflections reflections = BeanManagers.getInstance(Reflections.class); | ||
final ColumnConfiguration configuration = (ColumnConfiguration) reflections.newInstance(configurationClass); | ||
return configuration.get(settings); | ||
|
||
} | ||
throw new ConfigurationException("The class " + configurationClass + " is not valid to " + ColumnConfiguration.class); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...in/java/org/eclipse/jnosql/artemis/column/configuration/ColumnTemplateAsyncConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2019 Otávio Santana and others | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
*/ | ||
package org.eclipse.jnosql.artemis.column.configuration; | ||
|
||
import jakarta.nosql.column.ColumnFamilyManagerAsync; | ||
import jakarta.nosql.mapping.column.ColumnTemplateAsync; | ||
import jakarta.nosql.mapping.column.ColumnTemplateAsyncProducer; | ||
import org.eclipse.jnosql.artemis.configuration.SettingsConverter; | ||
import org.eclipse.jnosql.artemis.util.BeanManagers; | ||
import org.eclipse.microprofile.config.Config; | ||
import org.eclipse.microprofile.config.spi.Converter; | ||
|
||
/** | ||
* Converter the {@link String} to {@link ColumnTemplateAsync} it will use the {@link SettingsConverter} and | ||
* find by the provider that should be an implementation of {@link jakarta.nosql.column.ColumnConfigurationAsync} | ||
*/ | ||
public class ColumnTemplateAsyncConverter implements Converter<ColumnTemplateAsync> { | ||
|
||
@Override | ||
public ColumnTemplateAsync convert(String value) { | ||
Config config = BeanManagers.getInstance(Config.class); | ||
final ColumnFamilyManagerAsync manager = config.getValue(value, ColumnFamilyManagerAsync.class); | ||
ColumnTemplateAsyncProducer producer = BeanManagers.getInstance(ColumnTemplateAsyncProducer.class); | ||
|
||
return producer.get(manager); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...rc/main/java/org/eclipse/jnosql/artemis/column/configuration/ColumnTemplateConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2019 Otávio Santana and others | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
*/ | ||
package org.eclipse.jnosql.artemis.column.configuration; | ||
|
||
import jakarta.nosql.column.ColumnFamilyManager; | ||
import jakarta.nosql.mapping.column.ColumnTemplate; | ||
import jakarta.nosql.mapping.column.ColumnTemplateProducer; | ||
import org.eclipse.jnosql.artemis.configuration.SettingsConverter; | ||
import org.eclipse.jnosql.artemis.util.BeanManagers; | ||
import org.eclipse.microprofile.config.Config; | ||
import org.eclipse.microprofile.config.spi.Converter; | ||
|
||
/** | ||
* Converter the {@link String} to {@link ColumnTemplate} it will use the {@link SettingsConverter} and | ||
* find by the provider that should be an implementation of {@link jakarta.nosql.column.ColumnConfiguration} | ||
*/ | ||
public class ColumnTemplateConverter implements Converter<ColumnTemplate> { | ||
|
||
@Override | ||
public ColumnTemplate convert(String value) { | ||
Config config = BeanManagers.getInstance(Config.class); | ||
final ColumnFamilyManager manager = config.getValue(value, ColumnFamilyManager.class); | ||
ColumnTemplateProducer producer = BeanManagers.getInstance(ColumnTemplateProducer.class); | ||
|
||
return producer.get(manager); | ||
} | ||
} |
105 changes: 0 additions & 105 deletions
105
...lumn/src/main/java/org/eclipse/jnosql/artemis/column/spi/ColumnConfigurationProducer.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.