DMF-1343 Import profiles from CSV through API
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/c95c6d3e Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/c95c6d3e Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/c95c6d3e Branch: refs/heads/feature-DMF-1343 Commit: c95c6d3e2db1dad13405985b661ea9f146291490 Parents: 90bf7f8 Author: Abdelkader Midani <amid...@apache.org> Authored: Wed May 24 08:36:19 2017 +0200 Committer: Abdelkader Midani <amid...@apache.org> Committed: Tue Jun 6 17:35:46 2017 +0200 ---------------------------------------------------------------------- package/pom.xml | 11 +++++ ...g.apache.unomi.persistence.elasticsearch.cfg | 2 +- router/pom.xml | 2 +- router/router-api/pom.xml | 2 +- .../unomi/router/api/ImportConfiguration.java | 47 ++++++++++++++++++++ router/router-core/pom.xml | 2 +- .../core/context/ProfileImportCamelContext.java | 4 +- .../ProfileImportConfigUpdateRouteBuilder.java | 5 --- router/router-karaf-feature/pom.xml | 9 +--- router/router-rest/pom.xml | 2 +- router/router-service/pom.xml | 2 +- 11 files changed, 67 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/package/pom.xml ---------------------------------------------------------------------- diff --git a/package/pom.xml b/package/pom.xml index ae7c17e..2e7e479 100644 --- a/package/pom.xml +++ b/package/pom.xml @@ -269,6 +269,17 @@ </outputDirectory> <destFileName>org.apache.unomi.plugins.mail.cfg</destFileName> </artifactItem> + <artifactItem> + <groupId>org.apache.unomi</groupId> + <artifactId>unomi-router-core</artifactId> + <version>${project.version}</version> + <classifier>routercfg</classifier> + <type>cfg</type> + <outputDirectory> + ${project.build.directory}/assembly/etc + </outputDirectory> + <destFileName>org.apache.unomi.router.cfg</destFileName> + </artifactItem> <!-- UNOMI-75 : We install the blueprint core bundle in a different version to fix a problem with offline startup --> <artifactItem> <groupId>org.apache.aries.blueprint</groupId> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg index 77eb091..12980e1 100644 --- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg +++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg @@ -15,7 +15,7 @@ # limitations under the License. # -cluster.name=contextElasticSearch +cluster.name=contextElasticSearch_amidani # The elasticSearchAddresses may be a comma seperated list of host names and ports such as # hostA:9300,hostB:9300 # Note: the port number must be repeated for each host. http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/pom.xml ---------------------------------------------------------------------- diff --git a/router/pom.xml b/router/pom.xml index 73e9953..5bf43ea 100644 --- a/router/pom.xml +++ b/router/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>unomi-root</artifactId> <groupId>org.apache.unomi</groupId> - <version>1.2.0-incubating-SNAPSHOT</version> + <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version> </parent> <artifactId>unomi-router</artifactId> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/router-api/pom.xml ---------------------------------------------------------------------- diff --git a/router/router-api/pom.xml b/router/router-api/pom.xml index 9085a30..06207b3 100644 --- a/router/router-api/pom.xml +++ b/router/router-api/pom.xml @@ -21,7 +21,7 @@ <parent> <artifactId>unomi-router</artifactId> <groupId>org.apache.unomi</groupId> - <version>1.2.0-incubating-SNAPSHOT</version> + <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java ---------------------------------------------------------------------- diff --git a/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java b/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java index 38d139f..770a7b5 100644 --- a/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java +++ b/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java @@ -17,6 +17,7 @@ package org.apache.unomi.router.api; import org.apache.unomi.api.Item; +import org.apache.unomi.api.MetadataItem; import java.util.HashMap; import java.util.List; @@ -33,6 +34,9 @@ public class ImportConfiguration extends Item { * @see Item for a discussion of ITEM_TYPE */ public static final String ITEM_TYPE = "importConfig"; + private String name; + private String description; + private String configType; private Map<String, Object> properties = new HashMap<>(); private String mergingProperty; private boolean overwriteExistingProfiles = false; @@ -51,6 +55,49 @@ public class ImportConfiguration extends Item { } /** + * Retrieves the name of the import configuration + * @return the name of the import configuration + */ + public String getName() { return this.name; } + + /** + * Sets the name of the import configuration + * @param name the name of the import configuration + */ + public void setName(String name) { + this.name = name; + } + + /** + * Retrieves the description of the import configuration + * @return the description of the import configuration + */ + public String getDescription() { return this.description; } + + /** + * Sets the description of the import configuration + * @param description the description of the import configuration + */ + public void setDescription(String description) { + this.description = description; + } + + + /** + * Retrieves the config type of the import configuration + * @return the config type of the import configuration + */ + public String getConfigType() { return this.configType; } + + /** + * Sets the config type of the import configuration + * @param configType the config type of the import configuration + */ + public void setConfigType(String configType) { + this.configType = configType; + } + + /** * Retrieves the property identified by the specified name. * * @param name the name of the property to retrieve http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/router-core/pom.xml ---------------------------------------------------------------------- diff --git a/router/router-core/pom.xml b/router/router-core/pom.xml index d1574e9..b0b97c4 100644 --- a/router/router-core/pom.xml +++ b/router/router-core/pom.xml @@ -21,7 +21,7 @@ <parent> <artifactId>unomi-router</artifactId> <groupId>org.apache.unomi</groupId> - <version>1.2.0-incubating-SNAPSHOT</version> + <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java ---------------------------------------------------------------------- diff --git a/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java b/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java index 13d6630..2f3eaad 100644 --- a/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java +++ b/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java @@ -61,7 +61,7 @@ public class ProfileImportCamelContext implements SynchronousBundleListener { } public void initCamelContext() throws Exception { - logger.info("------INIT Camel Context..."); + logger.info("Initialize Camel Context..."); camelContext = new DefaultCamelContext(); List<ImportConfiguration> importConfigurationList = importConfigurationService.getImportConfigurations(); ProfileImportSourceToKafkaRouteBuilder builderReader = new ProfileImportSourceToKafkaRouteBuilder(kafkaProps); @@ -96,7 +96,7 @@ public class ProfileImportCamelContext implements SynchronousBundleListener { } } bundleContext.addBundleListener(this); - logger.info("Import configuration service initialized."); + logger.info("Camel Context {} initialized successfully."); } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java ---------------------------------------------------------------------- diff --git a/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java b/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java index 0dff8ec..ac71798 100644 --- a/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java +++ b/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java @@ -41,11 +41,6 @@ public class ProfileImportConfigUpdateRouteBuilder extends RouteBuilder { .enableCORS(true) .bindingMode(RestBindingMode.json) .dataFormatProperty("prettyPrint", "true"); - rest("/say") - .get("/hello/{me}") - .to("direct:hello"); - from("direct:hello") - .transform().constant("Hello World"); rest().put("/").consumes("application/json").type(ImportConfiguration.class) .to("direct:importConfigRestDeposit"); http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/router-karaf-feature/pom.xml ---------------------------------------------------------------------- diff --git a/router/router-karaf-feature/pom.xml b/router/router-karaf-feature/pom.xml index 3a1d2fd..8a8e62c 100644 --- a/router/router-karaf-feature/pom.xml +++ b/router/router-karaf-feature/pom.xml @@ -21,7 +21,7 @@ <parent> <artifactId>unomi-router</artifactId> <groupId>org.apache.unomi</groupId> - <version>1.2.0-incubating-SNAPSHOT</version> + <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> @@ -111,13 +111,6 @@ </dependency> <dependency> <groupId>org.apache.unomi</groupId> - <artifactId>unomi-router-core</artifactId> - <version>${project.version}</version> - <type>cfg</type> - <classifier>routercfg</classifier> - </dependency> - <dependency> - <groupId>org.apache.unomi</groupId> <artifactId>unomi-router-service</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/router-rest/pom.xml ---------------------------------------------------------------------- diff --git a/router/router-rest/pom.xml b/router/router-rest/pom.xml index fc1065f..e39e919 100644 --- a/router/router-rest/pom.xml +++ b/router/router-rest/pom.xml @@ -21,7 +21,7 @@ <parent> <artifactId>unomi-router</artifactId> <groupId>org.apache.unomi</groupId> - <version>1.2.0-incubating-SNAPSHOT</version> + <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c95c6d3e/router/router-service/pom.xml ---------------------------------------------------------------------- diff --git a/router/router-service/pom.xml b/router/router-service/pom.xml index 750cd1e..0aed70e 100644 --- a/router/router-service/pom.xml +++ b/router/router-service/pom.xml @@ -21,7 +21,7 @@ <parent> <artifactId>unomi-router</artifactId> <groupId>org.apache.unomi</groupId> - <version>1.2.0-incubating-SNAPSHOT</version> + <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>