Skip to content

Commit 1a14180

Browse files
committed
Now using Operators to install complementary database.
Removing MongoDB, everything is PostgreSQL
1 parent 5cb8250 commit 1a14180

15 files changed

+155
-561
lines changed

Transformations.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// camel-k: language=java property-file=transformation.properties dependency=camel:jacksonxml dependency=camel:http
2-
// camel-k: source=customizers/MongoCustomizer.java source=customizers/CSVCustomizer.java source=customizers/PostgreSQLCustomizer.java
1+
// camel-k: language=java property-file=transformation.properties dependency=camel:jacksonxml dependency=camel:http dependency=camel:gson
2+
// camel-k: source=customizers/CSVCustomizer.java source=customizers/PostgreSQLCustomizer.java
33

44
import java.util.ArrayList;
55
import java.util.HashMap;
@@ -10,6 +10,7 @@
1010
import org.apache.camel.Exchange;
1111
import org.apache.camel.Processor;
1212
import org.apache.camel.builder.RouteBuilder;
13+
import org.apache.camel.model.dataformat.JsonLibrary;
1314
import org.apache.camel.processor.aggregate.AbstractListAggregationStrategy;
1415

1516
public class Transformations extends RouteBuilder {
@@ -64,13 +65,15 @@ public void configure() throws Exception {
6465
.aggregate(constant(true), aggregationStrategy)
6566
.completionSize(5)
6667
.process(buildGeoJSON)
68+
.marshal().json(JsonLibrary.Gson)
6769

68-
//and finally store the result on mongoDB
69-
.to("mongodb:mongoBean?database=example&collection=mySpatialObjects&operation=insert")
70+
.to("log:info?showBody=true")
71+
//and finally store the result on the postgres database
72+
.setBody(simple("INSERT INTO measurements (geojson) VALUES ('${body}')"))
73+
.to("jdbc:postgresBean")
7074

7175
//Write some log to know it finishes properly
72-
.log("Information stored")
73-
.to("log:info?showBodyType=true");
76+
.log("Information stored");
7477
}
7578

7679
private final class CollectToListStrategy

customizers/MongoCustomizer.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

images/flux_diagram.graphml

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -378,23 +378,6 @@
378378
</data>
379379
</node>
380380
<node id="n19">
381-
<data key="d6">
382-
<y:ShapeNode>
383-
<y:Geometry height="39.548611111111086" width="96.61111111111077" x="242.0138888888893" y="580.9861111111111"/>
384-
<y:Fill color="#CC99FF" transparent="false"/>
385-
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
386-
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="61.732421875" x="17.439344618055372" y="10.789930555555543">MongoDB<y:LabelModel>
387-
<y:SmartNodeLabelModel distance="4.0"/>
388-
</y:LabelModel>
389-
<y:ModelParameter>
390-
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
391-
</y:ModelParameter>
392-
</y:NodeLabel>
393-
<y:Shape type="parallelogram"/>
394-
</y:ShapeNode>
395-
</data>
396-
</node>
397-
<node id="n20">
398381
<data key="d6">
399382
<y:ShapeNode>
400383
<y:Geometry height="39.548611111111086" width="96.61111111111074" x="242.0138888888893" y="484.5277777777778"/>
@@ -419,7 +402,7 @@
419402
</y:ShapeNode>
420403
</data>
421404
</node>
422-
<node id="n21">
405+
<node id="n20">
423406
<data key="d6">
424407
<y:ShapeNode>
425408
<y:Geometry height="39.548611111111086" width="8.93749999999963" x="242.0138888888893" y="484.5277777777778"/>
@@ -437,7 +420,7 @@
437420
</y:ShapeNode>
438421
</data>
439422
</node>
440-
<node id="n22">
423+
<node id="n21">
441424
<data key="d6">
442425
<y:ShapeNode>
443426
<y:Geometry height="39.548611111111086" width="8.93749999999963" x="329.68750000000034" y="484.5277777777778"/>
@@ -455,7 +438,7 @@
455438
</y:ShapeNode>
456439
</data>
457440
</node>
458-
<node id="n23">
441+
<node id="n22">
459442
<data key="d6">
460443
<y:ShapeNode>
461444
<y:Geometry height="39.548611111111086" width="96.61111111111074" x="476.3888888888894" y="337.0347222222224"/>
@@ -480,7 +463,7 @@
480463
</y:ShapeNode>
481464
</data>
482465
</node>
483-
<node id="n24">
466+
<node id="n23">
484467
<data key="d6">
485468
<y:ShapeNode>
486469
<y:Geometry height="39.548611111111086" width="8.93749999999963" x="476.3888888888894" y="337.0347222222224"/>
@@ -498,7 +481,7 @@
498481
</y:ShapeNode>
499482
</data>
500483
</node>
501-
<node id="n25">
484+
<node id="n24">
502485
<data key="d6">
503486
<y:ShapeNode>
504487
<y:Geometry height="39.548611111111086" width="8.93749999999963" x="564.0625000000005" y="337.0347222222224"/>
@@ -516,7 +499,7 @@
516499
</y:ShapeNode>
517500
</data>
518501
</node>
519-
<node id="n26">
502+
<node id="n25">
520503
<data key="d6">
521504
<y:ShapeNode>
522505
<y:Geometry height="39.548611111111086" width="96.61111111111077" x="590.9722222222229" y="337.0347222222224"/>
@@ -533,7 +516,7 @@
533516
</y:ShapeNode>
534517
</data>
535518
</node>
536-
<node id="n27">
519+
<node id="n26">
537520
<data key="d6">
538521
<y:ShapeNode>
539522
<y:Geometry height="39.548611111111086" width="96.61111111111074" x="596.1805555555563" y="414.97916666666674"/>
@@ -558,7 +541,7 @@
558541
</y:ShapeNode>
559542
</data>
560543
</node>
561-
<node id="n28">
544+
<node id="n27">
562545
<data key="d6">
563546
<y:ShapeNode>
564547
<y:Geometry height="39.548611111111086" width="8.93749999999963" x="596.1805555555563" y="414.97916666666674"/>
@@ -576,7 +559,7 @@
576559
</y:ShapeNode>
577560
</data>
578561
</node>
579-
<node id="n29">
562+
<node id="n28">
580563
<data key="d6">
581564
<y:ShapeNode>
582565
<y:Geometry height="39.548611111111086" width="8.93749999999963" x="683.8541666666674" y="414.97916666666674"/>
@@ -594,7 +577,7 @@
594577
</y:ShapeNode>
595578
</data>
596579
</node>
597-
<node id="n30">
580+
<node id="n29">
598581
<data key="d6">
599582
<y:ShapeNode>
600583
<y:Geometry height="39.548611111111086" width="96.61111111111077" x="596.1805555555562" y="492.9236111111111"/>
@@ -611,7 +594,7 @@
611594
</y:ShapeNode>
612595
</data>
613596
</node>
614-
<node id="n31">
597+
<node id="n30">
615598
<data key="d6">
616599
<y:ShapeNode>
617600
<y:Geometry height="14.375" width="14.375" x="197.63888888888926" y="333.4131944444447"/>
@@ -629,7 +612,7 @@
629612
</y:ShapeNode>
630613
</data>
631614
</node>
632-
<node id="n32">
615+
<node id="n31">
633616
<data key="d6">
634617
<y:ShapeNode>
635618
<y:Geometry height="39.548611111111086" width="96.61111111111077" x="361.805555555556" y="337.0347222222224"/>
@@ -646,6 +629,23 @@
646629
</y:ShapeNode>
647630
</data>
648631
</node>
632+
<node id="n32">
633+
<data key="d6">
634+
<y:ShapeNode>
635+
<y:Geometry height="39.548611111111086" width="96.61111111111077" x="242.0138888888893" y="566.5347222222222"/>
636+
<y:Fill color="#FFFF99" transparent="false"/>
637+
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
638+
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="21.47265625" x="37.56922743055543" y="10.789930555555543">DB<y:LabelModel>
639+
<y:SmartNodeLabelModel distance="4.0"/>
640+
</y:LabelModel>
641+
<y:ModelParameter>
642+
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
643+
</y:ModelParameter>
644+
</y:NodeLabel>
645+
<y:Shape type="parallelogram"/>
646+
</y:ShapeNode>
647+
</data>
648+
</node>
649649
<edge id="e0" source="n0" target="n1">
650650
<data key="d10">
651651
<y:PolyLineEdge>
@@ -675,7 +675,7 @@
675675
</y:PolyLineEdge>
676676
</data>
677677
</edge>
678-
<edge id="e2" source="n32" target="n6">
678+
<edge id="e2" source="n31" target="n6">
679679
<data key="d10">
680680
<y:PolyLineEdge>
681681
<y:Path sx="45.498488888888744" sy="-8.395833333333258" tx="0.0" ty="0.0"/>
@@ -695,7 +695,7 @@
695695
</y:PolyLineEdge>
696696
</data>
697697
</edge>
698-
<edge id="e4" source="n25" target="n9">
698+
<edge id="e4" source="n24" target="n9">
699699
<data key="d10">
700700
<y:PolyLineEdge>
701701
<y:Path sx="4.486349999999902" sy="-8.395833333333258" tx="0.0" ty="0.0"/>
@@ -715,7 +715,7 @@
715715
</y:PolyLineEdge>
716716
</data>
717717
</edge>
718-
<edge id="e6" source="n27" target="n15">
718+
<edge id="e6" source="n26" target="n15">
719719
<data key="d10">
720720
<y:PolyLineEdge>
721721
<y:Path sx="-5.208333333333599" sy="19.793727777777633" tx="0.0" ty="0.0"/>
@@ -735,13 +735,13 @@
735735
</y:PolyLineEdge>
736736
</data>
737737
</edge>
738-
<edge id="e8" source="n20" target="n19">
738+
<edge id="e8" source="n19" target="n32">
739739
<data key="d10">
740740
<y:PolyLineEdge>
741741
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
742742
<y:LineStyle color="#808080" type="line" width="1.0"/>
743743
<y:Arrows source="none" target="standard"/>
744-
<y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" hasText="false" height="4.0" horizontalTextPosition="center" iconTextGap="4" modelName="custom" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="4.0" x="-32.000013563367816" y="26.454833984375">
744+
<y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" hasText="false" height="4.0" horizontalTextPosition="center" iconTextGap="4" modelName="custom" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="4.0" x="-32.000013563367816" y="19.229139539930543">
745745
<y:LabelModel>
746746
<y:SmartEdgeLabelModel autoRotationEnabled="false" defaultAngle="0.0" defaultDistance="10.0"/>
747747
</y:LabelModel>
@@ -754,7 +754,7 @@
754754
</y:PolyLineEdge>
755755
</data>
756756
</edge>
757-
<edge id="e9" source="n14" target="n20">
757+
<edge id="e9" source="n14" target="n19">
758758
<data key="d10">
759759
<y:PolyLineEdge>
760760
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@@ -764,7 +764,7 @@
764764
</y:PolyLineEdge>
765765
</data>
766766
</edge>
767-
<edge id="e10" source="n26" target="n11">
767+
<edge id="e10" source="n25" target="n11">
768768
<data key="d10">
769769
<y:PolyLineEdge>
770770
<y:Path sx="-4.569589711839171" sy="19.772766158678394" tx="0.0" ty="0.0"/>
@@ -774,7 +774,7 @@
774774
</y:PolyLineEdge>
775775
</data>
776776
</edge>
777-
<edge id="e11" source="n23" target="n26">
777+
<edge id="e11" source="n22" target="n25">
778778
<data key="d10">
779779
<y:PolyLineEdge>
780780
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@@ -784,7 +784,7 @@
784784
</y:PolyLineEdge>
785785
</data>
786786
</edge>
787-
<edge id="e12" source="n27" target="n30">
787+
<edge id="e12" source="n26" target="n29">
788788
<data key="d10">
789789
<y:PolyLineEdge>
790790
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@@ -794,7 +794,7 @@
794794
</y:PolyLineEdge>
795795
</data>
796796
</edge>
797-
<edge id="e13" source="n26" target="n27">
797+
<edge id="e13" source="n25" target="n26">
798798
<data key="d10">
799799
<y:PolyLineEdge>
800800
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@@ -804,7 +804,7 @@
804804
</y:PolyLineEdge>
805805
</data>
806806
</edge>
807-
<edge id="e14" source="n32" target="n23">
807+
<edge id="e14" source="n31" target="n22">
808808
<data key="d10">
809809
<y:PolyLineEdge>
810810
<y:Path sx="43.472941080729015" sy="0.0" tx="0.0" ty="0.0"/>
@@ -814,7 +814,7 @@
814814
</y:PolyLineEdge>
815815
</data>
816816
</edge>
817-
<edge id="e15" source="n10" target="n27">
817+
<edge id="e15" source="n10" target="n26">
818818
<data key="d10">
819819
<y:PolyLineEdge>
820820
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@@ -824,7 +824,7 @@
824824
</y:PolyLineEdge>
825825
</data>
826826
</edge>
827-
<edge id="e16" source="n30" target="n16">
827+
<edge id="e16" source="n29" target="n16">
828828
<data key="d10">
829829
<y:PolyLineEdge>
830830
<y:Path sx="0.0" sy="0.0" tx="-11.025462962963047" ty="8.395833333333258"/>
@@ -834,7 +834,7 @@
834834
</y:PolyLineEdge>
835835
</data>
836836
</edge>
837-
<edge id="e17" source="n31" target="n1">
837+
<edge id="e17" source="n30" target="n1">
838838
<data key="d10">
839839
<y:PolyLineEdge>
840840
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@@ -844,8 +844,7 @@
844844
</y:PolyLineEdge>
845845
</data>
846846
</edge>
847-
<edge id="e18" source="n3" target="n32">
848-
<data key="d9"/>
847+
<edge id="e18" source="n3" target="n31">
849848
<data key="d10">
850849
<y:PolyLineEdge>
851850
<y:Path sx="4.493349999999907" sy="8.395833333333258" tx="0.0" ty="0.0"/>

0 commit comments

Comments
 (0)