← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7414: added local/ke/ for kenya specific dsl based camel route. also moved mfl2dxf2.xsl here (will prob...

 

------------------------------------------------------------
revno: 7414
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-27 10:06:47 +0300
message:
  added local/ke/ for kenya specific dsl based camel route. also moved mfl2dxf2.xsl here (will probably be moved back when xslt is confirmed working, and finished)
removed:
  dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/mfl2dxf2.xsl
added:
  local/ke/
  local/ke/mfl2dxf2/
  local/ke/mfl2dxf2/pom.xml
  local/ke/mfl2dxf2/src/
  local/ke/mfl2dxf2/src/main/
  local/ke/mfl2dxf2/src/main/java/
  local/ke/mfl2dxf2/src/main/java/org/
  local/ke/mfl2dxf2/src/main/java/org/hisp/
  local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/
  local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/integration/
  local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/integration/routes/
  local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/integration/routes/MFLTransformRoute.java
  local/ke/mfl2dxf2/src/main/resources/
  local/ke/mfl2dxf2/src/main/resources/log4j.properties
  local/ke/mfl2dxf2/src/main/resources/routes/
  local/ke/mfl2dxf2/src/main/resources/routes/mfl2dxf2.xml
  local/ke/mfl2dxf2/src/main/resources/transform/
  local/ke/mfl2dxf2/src/main/resources/transform/mfl2dxf2.xsl
  local/ke/mfl2dxf2/src/test/
  local/ke/mfl2dxf2/src/test/java/


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== removed file 'dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/mfl2dxf2.xsl'
--- dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/mfl2dxf2.xsl	2012-06-27 07:03:26 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/mfl2dxf2.xsl	1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:mfl="http://ehealth.or.ke/schema"; xmlns:dxf2="http://dhis2.org/schema/dxf/2.0";>
-
-  <xsl:template match="mfl:Facilities">
-
-    <xsl:element name="dxf2:metaData">
-      <xsl:element name="dxf2:organisationUnits">
-        <xsl:apply-templates />
-      </xsl:element>
-    </xsl:element>
-  </xsl:template>
-
-  <xsl:template match="mfl:Facility">
-    <xsl:element name="dxf2:organisationUnit">
-      <xsl:attribute name="name">
-        <xsl:value-of select="mfl:OfficialName" />
-      </xsl:attribute>
-      <xsl:attribute name="shortName">
-        <xsl:value-of select="substring(mfl:OfficialName, 0, 49)" />
-      </xsl:attribute>
-      <xsl:attribute name="code">
-        <xsl:value-of select="mfl:Code" />
-      </xsl:attribute>
-
-      <xsl:element name="dxf2:parent">
-        <xsl:attribute name="code">
-          <xsl:value-of select="mfl:District" />
-        </xsl:attribute>
-      </xsl:element>
-
-      <xsl:element name="dxf2:active">
-        <xsl:value-of select="mfl:Active" />
-      </xsl:element>
-
-      <xsl:if test="mfl:Latitude and mfl:Longitude">
-        <xsl:element name="dxf2:featureType">
-          <xsl:text>Point</xsl:text>
-        </xsl:element>
-
-        <xsl:element name="dxf2:coordinates">
-          <xsl:text>[</xsl:text>
-          <xsl:value-of select="mfl:Longitude" />
-          <xsl:text>,</xsl:text>
-          <xsl:value-of select="mfl:Latitude" />
-          <xsl:text>]</xsl:text>
-        </xsl:element>
-      </xsl:if>
-
-      <xsl:if test="string-length(mfl:OfficialEmail) > 0">
-        <xsl:element name="dxf2:email">
-          <xsl:value-of select="mfl:OfficialEmail" />
-        </xsl:element>
-      </xsl:if>
-
-      <xsl:choose>
-        <xsl:when test="string-length(mfl:OfficialLandline) > 0">
-          <xsl:element name="dxf2:phoneNumber">
-            <xsl:value-of select="mfl:OfficalLandline" />
-          </xsl:element>
-        </xsl:when>
-        <xsl:when test="string-length(mfl:OfficialMobile) > 0">
-          <xsl:element name="dxf2:phoneNumber">
-            <xsl:value-of select="mfl:OfficialMobile" />
-          </xsl:element>
-        </xsl:when>
-      </xsl:choose>
-
-      <xsl:if test="string-length(mfl:AddressBox) > 0 and string-length(mfl:AddressTown) > 0 and string-length(mfl:AddressPostCode) > 0">
-        <xsl:element name="dxf2:address">
-          <xsl:value-of select="mfl:AddressBox" />
-          <xsl:text>, </xsl:text>
-          <xsl:value-of select="mfl:AddressPostCode" />
-          <xsl:text> </xsl:text>
-          <xsl:value-of select="mfl:AddressTown" />
-        </xsl:element>
-      </xsl:if>
-
-    </xsl:element>
-  </xsl:template>
-
-</xsl:stylesheet>

=== added directory 'local/ke'
=== added directory 'local/ke/mfl2dxf2'
=== added file 'local/ke/mfl2dxf2/pom.xml'
--- local/ke/mfl2dxf2/pom.xml	1970-01-01 00:00:00 +0000
+++ local/ke/mfl2dxf2/pom.xml	2012-06-27 07:06:47 +0000
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>camel-mfl2dxf2</groupId>
+  <artifactId>camel-mfl2dxf2</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.3.2</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+          <showDeprecation>true</showDeprecation>
+          <showWarnings>true</showWarnings>
+          <fork>true</fork>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+  <dependencies>
+
+    <!-- Spring -->
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-jms</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <!-- Camel -->
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+      <version>${camel.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+      <version>${camel.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-context</artifactId>
+      <version>${camel.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-quartz</artifactId>
+      <version>${camel.version}</version>
+    </dependency>
+
+    <!-- Additional dependencies -->
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.10</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>cglib</groupId>
+      <artifactId>cglib</artifactId>
+      <version>2.2.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>1.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.16</version>
+    </dependency>
+
+  </dependencies>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <spring.version>3.1.1.RELEASE</spring.version>
+    <camel.version>2.9.2</camel.version>
+  </properties>
+
+</project>

=== added directory 'local/ke/mfl2dxf2/src'
=== added directory 'local/ke/mfl2dxf2/src/main'
=== added directory 'local/ke/mfl2dxf2/src/main/java'
=== added directory 'local/ke/mfl2dxf2/src/main/java/org'
=== added directory 'local/ke/mfl2dxf2/src/main/java/org/hisp'
=== added directory 'local/ke/mfl2dxf2/src/main/java/org/hisp/dhis'
=== added directory 'local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/integration'
=== added directory 'local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/integration/routes'
=== added file 'local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/integration/routes/MFLTransformRoute.java'
--- local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/integration/routes/MFLTransformRoute.java	1970-01-01 00:00:00 +0000
+++ local/ke/mfl2dxf2/src/main/java/org/hisp/dhis/integration/routes/MFLTransformRoute.java	2012-06-27 07:06:47 +0000
@@ -0,0 +1,23 @@
+package org.hisp.dhis.integration.routes;
+
+import org.apache.camel.builder.RouteBuilder;
+
+import java.io.InputStream;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class MFLTransformRoute
+    extends RouteBuilder
+{
+    @Override
+    public void configure() throws Exception
+    {
+        // from( "file:/Users/mortenoh/GDrive/HISP/ke/mfl/data/inbox?consumer.initialDelay=10000&consumer.delay=5000" ).
+        from( "quartz://every1minute?cron=0+0/1+*+*+*+%3F" ).
+            to( "http://api.ehealth.or.ke/api/facilities?lastApproved=1/1/2011&paging=off&scheme=on"; ).
+            to( "xslt:transform/mfl2dxf2.xsl" ).
+            convertBodyTo( InputStream.class ).inOut( "dhis2:metadata" ).
+            to( "log:org.hisp.dhis.camel?level=INFO" );
+    }
+}

=== added directory 'local/ke/mfl2dxf2/src/main/resources'
=== added file 'local/ke/mfl2dxf2/src/main/resources/log4j.properties'
--- local/ke/mfl2dxf2/src/main/resources/log4j.properties	1970-01-01 00:00:00 +0000
+++ local/ke/mfl2dxf2/src/main/resources/log4j.properties	2012-06-27 07:06:47 +0000
@@ -0,0 +1,40 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for eclipse testing, We want to see INFO output on the console.
+#
+log4j.rootLogger=INFO, out
+
+#log4j.logger.org.apache.activemq=DEBUG
+
+# uncomment the next line to debug Camel
+log4j.logger.org.apache.camel=INFO
+
+log4j.logger.org.apache.camel.impl.converter=INFO
+log4j.logger.org.apache.camel.util.ResolverUtil=INFO
+
+log4j.logger.org.springframework=WARN
+log4j.logger.org.hibernate=WARN
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%15.15t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file

=== added directory 'local/ke/mfl2dxf2/src/main/resources/routes'
=== added file 'local/ke/mfl2dxf2/src/main/resources/routes/mfl2dxf2.xml'
--- local/ke/mfl2dxf2/src/main/resources/routes/mfl2dxf2.xml	1970-01-01 00:00:00 +0000
+++ local/ke/mfl2dxf2/src/main/resources/routes/mfl2dxf2.xml	2012-06-27 07:06:47 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<route xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://camel.apache.org/schema/spring camel-spring-2.9.2.xsd"
+    xmlns="http://camel.apache.org/schema/spring"; id="mfl2dxf2">
+
+  <description>Synch with MFL every 5 second</description>
+
+  <!-- <from uri="file:/Users/mortenoh/GDrive/HISP/ke/mfl/data/inbox?consumer.initialDelay=10000&amp;consumer.delay=5000" /> -->
+  <from uri="quartz://every1minute?cron=0+0/1+*+*+*+%3F" />
+  <to uri="http://api.ehealth.or.ke/api/facilities?lastApproved=1/1/2011&amp;paging=off&amp;scheme=on"; />
+  <to uri="xslt:transform/mfl2dxf2.xsl" />
+  <convertBodyTo type="java.io.InputStream"/>
+  <inOut uri="dhis2:metadata" />
+  <to uri="log:org.hisp.dhis.camel?level=INFO" />
+</route>

=== added directory 'local/ke/mfl2dxf2/src/main/resources/transform'
=== added file 'local/ke/mfl2dxf2/src/main/resources/transform/mfl2dxf2.xsl'
--- local/ke/mfl2dxf2/src/main/resources/transform/mfl2dxf2.xsl	1970-01-01 00:00:00 +0000
+++ local/ke/mfl2dxf2/src/main/resources/transform/mfl2dxf2.xsl	2012-06-27 07:06:47 +0000
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:mfl="http://ehealth.or.ke/schema"; xmlns:dxf2="http://dhis2.org/schema/dxf/2.0";>
+
+  <xsl:template match="mfl:Facilities">
+
+    <xsl:element name="dxf2:metaData">
+      <xsl:element name="dxf2:organisationUnits">
+        <xsl:apply-templates />
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+
+  <xsl:template match="mfl:Facility">
+    <xsl:element name="dxf2:organisationUnit">
+      <xsl:attribute name="name">
+        <xsl:value-of select="mfl:OfficialName" />
+      </xsl:attribute>
+      <xsl:attribute name="shortName">
+        <xsl:value-of select="substring(mfl:OfficialName, 0, 49)" />
+      </xsl:attribute>
+      <xsl:attribute name="code">
+        <xsl:value-of select="mfl:Code" />
+      </xsl:attribute>
+
+      <xsl:element name="dxf2:parent">
+        <xsl:attribute name="code">
+          <xsl:value-of select="mfl:District" />
+        </xsl:attribute>
+      </xsl:element>
+
+      <xsl:element name="dxf2:active">
+        <xsl:value-of select="mfl:Active" />
+      </xsl:element>
+
+      <xsl:if test="mfl:Latitude and mfl:Longitude">
+        <xsl:element name="dxf2:featureType">
+          <xsl:text>Point</xsl:text>
+        </xsl:element>
+
+        <xsl:element name="dxf2:coordinates">
+          <xsl:text>[</xsl:text>
+          <xsl:value-of select="mfl:Longitude" />
+          <xsl:text>,</xsl:text>
+          <xsl:value-of select="mfl:Latitude" />
+          <xsl:text>]</xsl:text>
+        </xsl:element>
+      </xsl:if>
+
+      <xsl:if test="string-length(mfl:OfficialEmail) > 0">
+        <xsl:element name="dxf2:email">
+          <xsl:value-of select="mfl:OfficialEmail" />
+        </xsl:element>
+      </xsl:if>
+
+      <xsl:choose>
+        <xsl:when test="string-length(mfl:OfficialLandline) > 0">
+          <xsl:element name="dxf2:phoneNumber">
+            <xsl:value-of select="mfl:OfficalLandline" />
+          </xsl:element>
+        </xsl:when>
+        <xsl:when test="string-length(mfl:OfficialMobile) > 0">
+          <xsl:element name="dxf2:phoneNumber">
+            <xsl:value-of select="mfl:OfficialMobile" />
+          </xsl:element>
+        </xsl:when>
+      </xsl:choose>
+
+      <xsl:if test="string-length(mfl:AddressBox) > 0 and string-length(mfl:AddressTown) > 0 and string-length(mfl:AddressPostCode) > 0">
+        <xsl:element name="dxf2:address">
+          <xsl:value-of select="mfl:AddressBox" />
+          <xsl:text>, </xsl:text>
+          <xsl:value-of select="mfl:AddressPostCode" />
+          <xsl:text> </xsl:text>
+          <xsl:value-of select="mfl:AddressTown" />
+        </xsl:element>
+      </xsl:if>
+
+    </xsl:element>
+  </xsl:template>
+
+</xsl:stylesheet>

=== added directory 'local/ke/mfl2dxf2/src/test'
=== added directory 'local/ke/mfl2dxf2/src/test/java'