[3/5] incubator-unomi git commit: UNOMI-102 : Refactor import code to avoid code duplication with export features

2017-06-27 Thread amidani
UNOMI-102 : Refactor import code to avoid code duplication with export features


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/c62f91d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/c62f91d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/c62f91d4

Branch: refs/heads/master
Commit: c62f91d4bec9ef723f9af4e50c7506cb88ec02d9
Parents: fe8fbef
Author: Abdelkader Midani 
Authored: Wed Jun 28 02:28:17 2017 +0200
Committer: Abdelkader Midani 
Committed: Wed Jun 28 02:28:17 2017 +0200

--
 .../api/services/ConfigSharingService.java  |  32 +++
 .../unomi/router/api/ExportConfiguration.java   |  45 
 .../unomi/router/api/ImportConfiguration.java   | 182 +-
 .../router/api/ImportExportConfiguration.java   | 203 
 .../unomi/router/api/RouterConstants.java   |  44 
 .../services/ImportConfigurationService.java|  60 -
 .../ImportExportConfigurationService.java   |  61 +
 extensions/router/router-core/pom.xml   |   7 +
 .../unomi/router/core/RouterConstants.java  |  41 
 .../core/config/ConfigSharingServiceImpl.java   |  77 ++
 .../core/context/ProfileImportCamelContext.java | 187 --
 .../router/core/context/RouterCamelContext.java | 243 +++
 .../core/processor/ConfigUpdateProcessor.java   |  12 +-
 .../ImportConfigByFileNameProcessor.java|   8 +-
 .../core/processor/LineSplitFailureHandler.java |   2 +-
 .../core/processor/LineSplitProcessor.java  |   2 +-
 .../processor/RouteCompletionProcessor.java |   8 +-
 .../core/route/ConfigUpdateRouteBuilder.java|  73 ++
 .../route/ProfileExportCollectRouteBuilder.java |  81 +++
 .../ProfileImportAbstractRouteBuilder.java  |   2 +-
 .../ProfileImportConfigUpdateRouteBuilder.java  |  62 -
 .../ProfileImportFromSourceRouteBuilder.java| 104 
 .../route/ProfileImportOneShotRouteBuilder.java |   2 +-
 .../route/ProfileImportToUnomiRouteBuilder.java |   2 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  39 ++-
 .../main/resources/org.apache.unomi.router.cfg  |   8 +-
 extensions/router/router-karaf-feature/pom.xml  |   2 +-
 .../AbstractConfigurationServiceEndpoint.java   |  92 +++
 .../ExportConfigurationServiceEndPoint.java |  86 +++
 .../ImportConfigurationServiceEndPoint.java |  92 ++-
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  46 ++--
 .../AbstractConfigurationServiceImpl.java   |  73 ++
 .../ExportConfigurationServiceImpl.java |  61 +
 .../ImportConfigurationServiceImpl.java |  56 +
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  17 +-
 35 files changed, 1363 insertions(+), 749 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c62f91d4/api/src/main/java/org/apache/unomi/api/services/ConfigSharingService.java
--
diff --git 
a/api/src/main/java/org/apache/unomi/api/services/ConfigSharingService.java 
b/api/src/main/java/org/apache/unomi/api/services/ConfigSharingService.java
new file mode 100644
index 000..1bfb050
--- /dev/null
+++ b/api/src/main/java/org/apache/unomi/api/services/ConfigSharingService.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.unomi.api.services;
+
+/**
+ * A service to share cfg properties with other bundles.
+ */
+public interface ConfigSharingService {
+
+String getOneshotImportUploadDir();
+
+void setOneshotImportUploadDir(String oneshotImportUploadDir);
+
+String getInternalServerPort();
+
+void setInternalServerPort(String internalServerPort);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c62f91d4/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ExportConfiguration.java
--
diff --git 

incubator-unomi git commit: UNOMI-106 : Expose a service to share cfg properties with other bundles

2017-06-27 Thread amidani
Repository: incubator-unomi
Updated Branches:
  refs/heads/feature-UNOMI-102 c62f91d4b -> cb83301ff


UNOMI-106 : Expose a service to share cfg properties with other bundles


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/cb83301f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/cb83301f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/cb83301f

Branch: refs/heads/feature-UNOMI-102
Commit: cb83301ffdaa6fb0fef9969fbaf4582c0d1df2b4
Parents: c62f91d4
Author: Abdelkader Midani 
Authored: Wed Jun 28 02:31:06 2017 +0200
Committer: Abdelkader Midani 
Committed: Wed Jun 28 02:31:06 2017 +0200

--
 .../services/ConfigSharingServiceImpl.java  | 80 
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 11 +++
 2 files changed, 91 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/cb83301f/services/src/main/java/org/apache/unomi/services/services/ConfigSharingServiceImpl.java
--
diff --git 
a/services/src/main/java/org/apache/unomi/services/services/ConfigSharingServiceImpl.java
 
b/services/src/main/java/org/apache/unomi/services/services/ConfigSharingServiceImpl.java
new file mode 100644
index 000..2b7da8a
--- /dev/null
+++ 
b/services/src/main/java/org/apache/unomi/services/services/ConfigSharingServiceImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.unomi.services.services;
+
+import org.apache.unomi.api.services.ConfigSharingService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Created by amidani on 27/06/2017.
+ */
+public class ConfigSharingServiceImpl implements ConfigSharingService, 
SynchronousBundleListener {
+
+private static final Logger logger = 
LoggerFactory.getLogger(ConfigSharingServiceImpl.class);
+
+private String internalServerPort;
+
+private BundleContext bundleContext;
+
+public void setBundleContext(BundleContext bundleContext) {
+this.bundleContext = bundleContext;
+}
+
+@Override
+public String getInternalServerPort() {
+return this.internalServerPort;
+}
+
+@Override
+public void setInternalServerPort(String internalServerPort) {
+this.internalServerPort = internalServerPort;
+}
+
+/**
+ * Methods below not used in services bundle implementation of the 
ConfigSharingService
+ **/
+
+@Override
+public String getOneshotImportUploadDir() {
+return null;
+}
+
+@Override
+public void setOneshotImportUploadDir(String oneshotImportUploadDir) {
+}
+
+public void preDestroy() throws Exception {
+bundleContext.removeBundleListener(this);
+logger.info("Config sharing service for Service is shutdown.");
+}
+
+private void processBundleStartup(BundleContext bundleContext) {
+if (bundleContext == null) {
+return;
+}
+}
+
+@Override
+public void bundleChanged(BundleEvent bundleEvent) {
+
+}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/cb83301f/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
--
diff --git a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml 
b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index fa2d3dd..b6c4f6c 100644
--- a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -235,4 +235,15 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
 



[2/3] incubator-unomi git commit: UNOMI-102 : Refactor import code to avoid code duplication with export features

2017-06-27 Thread amidani
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c62f91d4/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
--
diff --git 
a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
 
b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
index 94c1cef..d75977b 100644
--- 
a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
+++ 
b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
@@ -20,7 +20,7 @@ import org.apache.camel.LoggingLevel;
 import org.apache.camel.component.jackson.JacksonDataFormat;
 import org.apache.camel.component.kafka.KafkaEndpoint;
 import org.apache.camel.model.RouteDefinition;
-import org.apache.unomi.router.core.RouterConstants;
+import org.apache.unomi.router.api.RouterConstants;
 import org.apache.unomi.router.core.processor.RouteCompletionProcessor;
 import org.apache.unomi.router.core.processor.UnomiStorageProcessor;
 import org.apache.unomi.router.core.strategy.ArrayListAggregationStrategy;

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c62f91d4/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
--
diff --git 
a/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
 
b/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 86bcf47..aa39b15 100644
--- 
a/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ 
b/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -25,7 +25,9 @@
 
 
 
-
+
+
+
 
 
 
@@ -37,6 +39,17 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -59,6 +72,11 @@
 
 
 
+
+
+
+
+
 
 
 
@@ -67,7 +85,7 @@
 
-
+
 
 
 
@@ -75,9 +93,10 @@
 
 
 
-
-
+
+
 
 
 
@@ -93,20 +112,24 @@
 
 
 
+
+
 
 
 
 
 http://camel.apache.org/schema/blueprint;>
-
+
 
 
-
-
+
+
 
 
 
 
-
+
+
+
 
 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c62f91d4/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
--
diff --git 
a/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg 
b/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
index e301b58..2aa385f 100644
--- 
a/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
+++ 
b/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
@@ -32,4 +32,10 @@ import.config.type=nobroker
 import.oneshot.uploadDir=${karaf.data}/tmp/unomi_oneshot_import_configs/
 
 #Import executions history size
-import.executionsHistory.size=5
\ No newline at end of file
+import.executionsHistory.size=5
+
+#Allowed source endpoints
+config.allowedEndpoints=file,ftp
+
+#Internal Camel REST services port (Not public - DO NOT OPEN TO PUBLIC)
+config.internalPort=8233
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c62f91d4/extensions/router/router-karaf-feature/pom.xml
--
diff --git a/extensions/router/router-karaf-feature/pom.xml 
b/extensions/router/router-karaf-feature/pom.xml
index 213f607..0bb1b11 100644
--- a/extensions/router/router-karaf-feature/pom.xml
+++ b/extensions/router/router-karaf-feature/pom.xml
@@ -147,7 +147,7 @@
 org.apache.karaf.tooling
 karaf-maven-plugin
 
-90
+77
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c62f91d4/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
--
diff --git 
a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
 
b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
new file mode 100644
index 000..195cd68

incubator-unomi git commit: UNOMI-106 Infinite loop on startup - Removed CXF bus configuration that might be causing CXF restarts that were noticed in some of the logs.

2017-06-27 Thread shuber
Repository: incubator-unomi
Updated Branches:
  refs/heads/master 74fdd9ce6 -> 8860ddffa


UNOMI-106 Infinite loop on startup
- Removed CXF bus configuration that might be causing CXF restarts that were 
noticed in some of the logs.

Signed-off-by: Serge Huber 


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/8860ddff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/8860ddff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/8860ddff

Branch: refs/heads/master
Commit: 8860ddffa9bc4387f3e9b7a7973a8345102562a2
Parents: 74fdd9c
Author: Serge Huber 
Authored: Tue Jun 27 11:09:37 2017 +0200
Committer: Serge Huber 
Committed: Tue Jun 27 11:09:37 2017 +0200

--
 .../src/main/resources/OSGI-INF/blueprint/blueprint.xml  | 11 ++-
 .../src/main/resources/OSGI-INF/blueprint/blueprint.xml  | 11 ++-
 .../src/main/resources/OSGI-INF/blueprint/blueprint.xml  | 11 ++-
 .../src/main/resources/OSGI-INF/blueprint/blueprint.xml  | 10 ++
 rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml |  2 +-
 5 files changed, 9 insertions(+), 36 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8860ddff/extensions/geonames/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
--
diff --git 
a/extensions/geonames/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml 
b/extensions/geonames/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 590fef7..47036b0 100644
--- 
a/extensions/geonames/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ 
b/extensions/geonames/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -17,17 +17,10 @@
   -->
 
 http://www.w3.org/2001/XMLSchema-instance;
-   xmlns:cxf="http://cxf.apache.org/blueprint/core; 
xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs;
+   xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs;
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0;
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
-  http://cxf.apache.org/blueprint/jaxrs 
http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
-  http://cxf.apache.org/blueprint/core 
http://cxf.apache.org/schemas/blueprint/core.xsd;>
-
-
-
-
-
-
+  http://cxf.apache.org/blueprint/jaxrs 
http://cxf.apache.org/schemas/blueprint/jaxrs.xsd;>
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8860ddff/extensions/lists-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
--
diff --git 
a/extensions/lists-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
 
b/extensions/lists-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 7b7e626..01762ad 100644
--- 
a/extensions/lists-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ 
b/extensions/lists-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -17,17 +17,10 @@
   -->
 
 http://www.w3.org/2001/XMLSchema-instance;
-   xmlns:cxf="http://cxf.apache.org/blueprint/core; 
xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs;
+   xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs;
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0;
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
-  http://cxf.apache.org/blueprint/jaxrs 
http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
-  http://cxf.apache.org/blueprint/core 
http://cxf.apache.org/schemas/blueprint/core.xsd;>
-
-
-
-
-
-
+  http://cxf.apache.org/blueprint/jaxrs 
http://cxf.apache.org/schemas/blueprint/jaxrs.xsd;>
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8860ddff/extensions/privacy-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
--
diff --git 
a/extensions/privacy-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
 
b/extensions/privacy-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index c7089e6..772f348 100644
--- 
a/extensions/privacy-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ 
b/extensions/privacy-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -17,17 +17,10 @@
   -->
 
 http://www.w3.org/2001/XMLSchema-instance;
-   xmlns:cxf="http://cxf.apache.org/blueprint/core; 

[jira] [Updated] (UNOMI-106) Infinite loop on startup

2017-06-27 Thread Serge Huber (JIRA)

 [ 
https://issues.apache.org/jira/browse/UNOMI-106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Serge Huber updated UNOMI-106:
--
Summary: Infinite loop on startup  (was: Infinite loop with on startup)

> Infinite loop on startup
> 
>
> Key: UNOMI-106
> URL: https://issues.apache.org/jira/browse/UNOMI-106
> Project: Apache Unomi
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.2.0-incubating
>Reporter: Serge Huber
>Priority: Critical
> Fix For: 1.2.0-incubating
>
> Attachments: karaf_unomi_logs.zip, unomi 1_2_0-SNAPSHOT first start 
> stacktrace infinite loop try to restart no debug.txt, unomi log debug 
> level.zip
>
>
> Given I start a freshly compile Unomi 1.2.0-incubating-SNAPSHOT
> Then it should be started
> Instead it run in an infinite loop of stop and start
> first startup without debug mode = infinite loop
> second startup without debug mode = seems ok
> see attached stacktrace at every stop



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (UNOMI-106) Infinite loop with on startup

2017-06-27 Thread Serge Huber (JIRA)

 [ 
https://issues.apache.org/jira/browse/UNOMI-106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Serge Huber updated UNOMI-106:
--
Attachment: karaf_unomi_logs.zip
unomi 1_2_0-SNAPSHOT first start stacktrace infinite loop try 
to restart no debug.txt
unomi log debug level.zip

> Infinite loop with on startup
> -
>
> Key: UNOMI-106
> URL: https://issues.apache.org/jira/browse/UNOMI-106
> Project: Apache Unomi
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.2.0-incubating
>Reporter: Serge Huber
>Priority: Critical
> Fix For: 1.2.0-incubating
>
> Attachments: karaf_unomi_logs.zip, unomi 1_2_0-SNAPSHOT first start 
> stacktrace infinite loop try to restart no debug.txt, unomi log debug 
> level.zip
>
>
> Given I start a freshly compile Unomi 1.2.0-incubating-SNAPSHOT
> Then it should be started
> Instead it run in an infinite loop of stop and start
> first startup without debug mode = infinite loop
> second startup without debug mode = seems ok
> see attached stacktrace at every stop



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)