← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7146: WIP - camel routes for importing datavaluesets in different formats (currently sdmx CrossSectiona...

 

------------------------------------------------------------
revno: 7146
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-01 22:56:18 +0100
message:
  WIP - camel routes for importing datavaluesets in different formats (currently sdmx CrossSectionalData)
added:
  dhis-2/dhis-services/dhis-service-integration/errors/
  dhis-2/dhis-services/dhis-service-integration/errors/ID-bobs-laptop-45863-1334770249602-0-3
  dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/DefaultIntegrationService.java
  dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/IntegrationService.java
  dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java
  dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java
  dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java
  dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/
  dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/dataValueSetA.xml
  dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/sdmx_test.xml
  dhis-2/dhis-services/dhis-service-integration/src/test/resources/log4j.properties
modified:
  dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java
  dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataProducer.java
  dhis-2/dhis-services/dhis-service-integration/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl
  dhis-2/dhis-services/dhis-service-integration/src/test/resources/test-context.xml


--
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
=== added directory 'dhis-2/dhis-services/dhis-service-integration/errors'
=== added file 'dhis-2/dhis-services/dhis-service-integration/errors/ID-bobs-laptop-45863-1334770249602-0-3'
--- dhis-2/dhis-services/dhis-service-integration/errors/ID-bobs-laptop-45863-1334770249602-0-3	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/errors/ID-bobs-laptop-45863-1334770249602-0-3	2012-06-01 21:56:18 +0000
@@ -0,0 +1,1 @@
+i Bureh Memorial Hospital" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/BH7rDkWjUqc"; internalId="255019" id="BH7rDkWjUqc"/><wstxns1:organisationUnit name="Bai Largo MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/Rll4VmTDRiE"; internalId="246994" id="Rll4VmTDRiE"/><wstxns1:organisationUnit name="Baiama CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/XtuhRhmbrJM"; internalId="233331" id="XtuhRhmbrJM"/><wstxns1:organisationUnit name="Baiima CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/c41XRVOYNJm"; internalId="204914" id="c41XRVOYNJm"/><wstxns1:organisationUnit name="Bailor CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/Eyj2kiEJ7M3"; internalId="254996" id="Eyj2kiEJ7M3"/><wstxns1:organisationUnit name="Baiwala CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/HFyjUvMjQ8H"; internalId="204923" id="HFyjUvMjQ8H"/><wstxns1:organisationUnit name="Bakeloko CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/MHAWZr2Caxw"; internalId="268228" id="MHAWZr2Caxw"/><wstxns1:organisationUnit name="Bambara Kaima CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/LOpWauwwghf"; internalId="222633" id="LOpWauwwghf"/><wstxns1:organisationUnit name="Bambara MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/mUuCjQWMaOc"; internalId="222679" id="mUuCjQWMaOc"/><wstxns1:organisationUnit name="Bambawolo CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/TNbHYOuQi8s"; internalId="222723" id="TNbHYOuQi8s"/><wstxns1:organisationUnit name="Bambuibu Tommy MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/aSfF9kuNINJ"; internalId="247021" id="aSfF9kuNINJ"/><wstxns1:organisationUnit name="Bambukoro MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/wYLjA4vN6Y9"; internalId="758923" id="wYLjA4vN6Y9"/><wstxns1:organisationUnit name="Banana Island MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/jjtzkzrmG7s"; internalId="278384" id="jjtzkzrmG7s"/><wstxns1:organisationUnit name="Bandajuma Clinic CHC" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/FNnj3jKGS7i"; internalId="260387" id="FNnj3jKGS7i"/><wstxns1:organisationUnit name="Bandajuma Kpolihun CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/ABM75Q1UfoP"; internalId="204882" id="ABM75Q1UfoP"/><wstxns1:organisationUnit name="Bandajuma MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/rx9ubw0UCqj"; internalId="1029" id="rx9ubw0UCqj"/><wstxns1:organisationUnit name="Bandajuma Sinneh MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/OZ1olxsTyNa"; internalId="204896" id="OZ1olxsTyNa"/><wstxns1:organisationUnit name="Bandajuma Yawei CHC" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/MpcMjLmbATv"; internalId="204938" id="MpcMjLmbATv"/><wstxns1:organisationUnit name="Bandakarifaia MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/qO2JLjYrg91"; internalId="758919" id="qO2JLjYrg91"/><wstxns1:organisationUnit name="Bandaperie CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/U7yKrx2QVet"; internalId="758913" id="U7yKrx2QVet"/><wstxns1:organisationUnit name="Bandasuma CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/uPshwz3B3Uu"; internalId="260436" id="uPshwz3B3Uu"/><wstxns1:organisationUnit name="Bandasuma Fiama MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/aF6iPGbrcRk"; internalId="233360" id="aF6iPGbrcRk"/><wstxns1:organisationUnit name="Bandawor MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/lpAPY3QOY2D"; internalId="222649" id="lpAPY3QOY2D"/><wstxns1:organisationUnit name="Bandusuma MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/t1aAdpBbDB3"; internalId="233318" id="t1aAdpBbDB3"/><wstxns1:organisationUnit name="Bangambaya MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/xQIU41mR69s"; internalId="233374" id="xQIU41mR69s"/><wstxns1:organisationUnit name="Bangoma MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/pdF4XIHIGPx"; internalId="543045" id="pdF4XIHIGPx"/><wstxns1:organisationUnit name="Banka Makuloh MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/rxc497GUdDt"; internalId="211259" id="rxc497GUdDt"/><wstxns1:organisationUnit name="Baoma" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/vWbkYPRmKyS"; internalId="540" id="vWbkYPRmKyS"/><wstxns1:organisationUnit name="Baoma (Koya) CHC" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/Yj2ni275yPJ"; internalId="222647" id="Yj2ni275yPJ"/><wstxns1:organisationUnit name="Baoma (Luawa) MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/TQ5DSmdliN7"; internalId="204909" id="TQ5DSmdliN7"/><wstxns1:organisationUnit name="Baoma Kpenge CHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/a1dP5m3Clw4"; internalId="197446" id="a1dP5m3Clw4"/><wstxns1:organisationUnit name="Baoma MCHP" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/t52CJEyLhch"; internalId="233393" id="t52CJEyLhch"/></wstxns1:organisationUnits></wstxns1:dxf2>
\ No newline at end of file

=== added file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/DefaultIntegrationService.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/DefaultIntegrationService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/DefaultIntegrationService.java	2012-06-01 21:56:18 +0000
@@ -0,0 +1,68 @@
+package org.hisp.dhis.integration;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.InputStream;
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import org.hisp.dhis.integration.routes.SDMXDataIn;
+import org.hisp.dhis.integration.routes.XMLDataIn;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ *
+ * @author bobj
+ */
+public class DefaultIntegrationService implements IntegrationService
+{
+    @Autowired
+    CamelContext camelContext;
+    
+    @EndpointInject(uri = XMLDataIn.XMLDATA_IN)
+    private ProducerTemplate xmlIn;
+
+    @EndpointInject(uri = SDMXDataIn.SDMXDATA_IN)
+    private ProducerTemplate sdmxIn;
+
+
+    @Override
+    public ImportSummary importXMLDataValueSet( InputStream in, ImportOptions importOptions )
+    {
+       return (ImportSummary) xmlIn.requestBodyAndHeader( in, "ImportOptions", importOptions);
+    }
+
+    @Override
+    public ImportSummary importSDMXDataValueSet( InputStream in, ImportOptions importOptions )
+    {
+       return (ImportSummary) sdmxIn.requestBodyAndHeader( in, "ImportOptions", importOptions);
+    }
+    
+}

=== added file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/IntegrationService.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/IntegrationService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/IntegrationService.java	2012-06-01 21:56:18 +0000
@@ -0,0 +1,43 @@
+package org.hisp.dhis.integration;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.InputStream;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+
+/**
+ *
+ * @author bobj
+ */
+public interface IntegrationService
+{
+    ImportSummary importXMLDataValueSet(InputStream in, ImportOptions options);
+
+    ImportSummary importSDMXDataValueSet(InputStream in, ImportOptions options);
+}

=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java	2012-04-16 15:48:50 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java	2012-06-01 21:56:18 +0000
@@ -72,6 +72,16 @@
         importOptions.setDryRun( dryRun );
     }
 
+    public void setDataElementIdScheme( String dataElementIdScheme )
+    {
+        importOptions.setDataElementIdScheme( dataElementIdScheme );
+    }
+
+    public void setOrgUnitIdScheme( String orgUnitIdScheme )
+    {
+        importOptions.setOrgUnitIdScheme( orgUnitIdScheme );
+    }
+    
     public Dxf2DataEndpoint( String uri, Dxf2Component component, DataValueSetService dataValueSetService )
     {
         super( uri, component );

=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataProducer.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataProducer.java	2012-04-16 15:40:44 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataProducer.java	2012-06-01 21:56:18 +0000
@@ -54,6 +54,8 @@
         ImportSummary summary = endpoint.getDataValueSetService().saveDataValueSet( (InputStream)exchange.getIn().getBody(), 
              endpoint.getImportOptions() );
         
-        exchange.getOut().setBody(JacksonUtils.toXmlAsString( summary ) );
+        //exchange.getOut().setBody(JacksonUtils.toXmlAsString( summary ) );
+        exchange.getOut().setBody( summary );
+        log.info( this.getEndpoint().getEndpointUri() + " : " + JacksonUtils.toXmlAsString(exchange.getOut().getBody()) );
     }
 }

=== added file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java	2012-06-01 21:56:18 +0000
@@ -0,0 +1,63 @@
+package org.hisp.dhis.integration.routes;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.DescriptionDefinition;
+
+/**
+ * SDMXDataIn route takes an SDMX cross-sectional message, transforms to dxf2 datavalueset
+ * and sends to dxf2 endpoint
+ * 
+ * @author bobj
+ */
+public class SDMXDataIn extends RouteBuilder
+{
+ 
+    // DataInput endpoint
+
+    public static final String SDMXDATA_IN = "direct:sdmxDataIn";
+    
+    // Route description texts
+    
+    public static final String SDMXDATA_IN_DESC = "Internal: SDMX Data to DXF2 Input";
+ 
+    
+    @Override
+    public void configure() throws Exception
+    {
+        DescriptionDefinition desc = new DescriptionDefinition();
+        desc.setText( "SDMX Data to DXF2 Input");
+        
+        from(SDMXDATA_IN).
+            convertBodyTo( java.lang.String.class, "UTF-8" ).to( "log:org.hisp.dhis.integration?level=INFO").
+            to("xslt:transform/cross2dxf2.xsl").convertBodyTo( java.io.InputStream.class).
+            to("dhis2:data?orgUnitIdScheme=CODE&dataElementIdScheme=CODE&importStrategy=NEW_AND_UPDATES").
+            setDescription( desc );
+    }    
+}
\ No newline at end of file

=== added file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java	2012-06-01 21:56:18 +0000
@@ -0,0 +1,70 @@
+package org.hisp.dhis.integration.routes;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.builder.xml.Namespaces;
+import org.apache.camel.model.DescriptionDefinition;
+
+/**
+ * XMLDataIn route implements a Content Based Routing pattern
+ * 
+ * 
+ * @author bobj
+ */
+public class XMLDataIn extends RouteBuilder
+{
+
+    // DataInput endpoint
+    
+    public static final String XMLDATA_IN = "direct:xmlDataIn"; 
+
+    // Route description texts
+    
+    public static final String XMLDATA_IN_DESC = "Internal: XML Data to DXF2 Input";
+    
+    // Route definitions
+    @Override
+    public void configure() throws Exception
+    {
+        // add namespaces to the XPath context
+        Namespaces ns = new Namespaces( "m", "http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message";);
+        ns.add( "d", "http://dhis2.org/schema/dxf/2.0";);
+        
+        DescriptionDefinition xmlDesc = new DescriptionDefinition();
+        xmlDesc.setText( XMLDATA_IN_DESC);
+        
+        from(XMLDATA_IN).convertBodyTo(java.lang.String.class, "UTF-8")
+            .choice()
+            .when().xpath( "boolean(/d:dataValueSet)", ns).convertBodyTo( java.io.InputStream.class).to("dhis2:data")
+            .when().xpath( "boolean(/m:CrossSectionalData)", ns).to("direct:sdmxDataIn")
+            .otherwise().to("log:org.hisp.dhis.integration?level=DEBUG" )
+            .end()
+            .setDescription( xmlDesc );
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-integration/src/main/resources/META-INF/dhis/beans.xml	2012-04-16 21:39:05 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/resources/META-INF/dhis/beans.xml	2012-06-01 21:56:18 +0000
@@ -7,18 +7,24 @@
 
   <bean id="importService" class="org.hisp.dhis.dxf2.metadata.DefaultImportService" />
   
+  <bean id="integrationService" class="org.hisp.dhis.integration.DefaultIntegrationService" />
+  
   <!-- Custom lifecycle strategy -->
   
   <bean id="lifecyclestrategy" class="org.hisp.dhis.integration.management.DHIS2LifecycleStrategy" />
   
   <camel:camelContext id="camel-builtin">
-
+    
+    <!-- route scanner -->
     <camel:packageScan>
       <camel:package>org.hisp.dhis.integration.routes</camel:package>
       <camel:excludes>**.*Excluded*</camel:excludes>
       <camel:includes>**.*</camel:includes>
     </camel:packageScan>
 
+    <!--  producer templates -->
+    <camel:template id="web-api"/>
+    
   </camel:camelContext>
 
 </beans>

=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl'
--- dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl	2012-04-08 11:39:56 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl	2012-06-01 21:56:18 +0000
@@ -16,10 +16,10 @@
 
             <xsl:for-each select="*[local-name()='Section']">
               <xsl:for-each select="*[local-name()='OBS_VALUE']">
-                <xsl:variable name="orgunit" select="@*[local-name()='FACILITY']"/>
+                <xsl:variable name="orgUnit" select="@*[local-name()='FACILITY']"/>
                 <xsl:variable name="dataElement" select="@*[local-name()='DATAELEMENT']"/>
                 <xsl:variable name="value" select="@*[local-name()='value']"/>
-                <d:dataValue dataElement='{$dataElement}' orgunit='{$orgunit}' value='{$value}' />
+                <d:dataValue dataElement='{$dataElement}' orgUnit='{$orgUnit}' value='{$value}' />
               </xsl:for-each>
             </xsl:for-each>
           </d:dataValueSet>

=== added file 'dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java'
--- dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java	2012-06-01 21:56:18 +0000
@@ -0,0 +1,160 @@
+package org.hisp.dhis.integration;
+
+/*
+ * Copyright (c) 2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import static junit.framework.Assert.assertNotNull;
+import static org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty.*;
+import static org.hisp.dhis.importexport.ImportStrategy.*;
+
+
+import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+
+public class RoutesTest
+    extends DhisTest
+{
+    @Autowired
+    private DataElementService dataElementService;
+    
+    @Autowired
+    private DataElementCategoryService categoryService;
+    
+    @Autowired
+    private DataSetService dataSetService;
+
+    @Autowired
+    private OrganisationUnitService organisationUnitService;
+    
+    @Autowired
+    private PeriodService periodService;
+    
+    @Autowired
+    private IntegrationService integrationService;
+    
+    @Autowired
+    private DataValueService dataValueService;
+    
+    @Autowired
+    private CompleteDataSetRegistrationService registrationService;
+    
+    private DataElement deA;
+    private DataElement deB;
+    private DataElement deC;
+    private DataSet dsA;
+    private OrganisationUnit ouA;
+    private OrganisationUnit ouB;
+    private Period peA;
+    private Period peB;
+    private DataElementCategoryOptionCombo optionComboA;
+    
+    @Override
+    public boolean emptyDatabaseAfterTest()
+    {
+        return true;
+    }
+    
+    @Override
+    public void setUpTest()
+    {
+        deA = createDataElement( 'A' );
+        deB = createDataElement( 'B' );
+        deC = createDataElement( 'C' );
+        dsA = createDataSet( 'A', new MonthlyPeriodType() );
+        ouA = createOrganisationUnit( 'A' );
+        ouB = createOrganisationUnit( 'B' );
+        peA = createPeriod( getDate( 2012, 1, 1 ), getDate( 2012, 1, 31 ) );
+        peB = createPeriod( getDate( 2012, 2, 1 ), getDate( 2012, 2, 29 ) );
+        optionComboA = categoryService.getDefaultDataElementCategoryOptionCombo();
+        
+        deA.setUid( "f7n9E0hX8qk" );
+        deB.setUid( "Ix2HsbDMLea" );
+        deC.setUid( "eY5ehpbEsB7" );
+        dsA.setUid( "pBOMPrpg1QX" );
+        ouA.setUid( "DiszpKrYNg8" );
+        ouB.setUid( "BdfsJfj87js" );
+
+        deA.setCode( "DE_A" );
+        deB.setCode( "DE_B" );
+        deC.setCode( "DE_C" );
+        dsA.setCode( "DS_A" );
+        ouA.setCode( "OU_A" );
+        ouB.setCode( "OU_B" );
+        
+        dataElementService.addDataElement( deA );
+        dataElementService.addDataElement( deB );
+        dataElementService.addDataElement( deC );
+        dataSetService.addDataSet( dsA );
+        organisationUnitService.addOrganisationUnit( ouA );
+        organisationUnitService.addOrganisationUnit( ouB );
+        periodService.addPeriod( peA );
+        periodService.addPeriod( peB );
+    }
+    
+    @Test
+    public void testImportDataValueSetSDMX()
+        throws Exception
+    {
+        ImportOptions options = new ImportOptions( CODE, CODE, false, NEW_AND_UPDATES, false );
+        ImportSummary summary = integrationService.importSDMXDataValueSet( new ClassPathResource( "data/sdmx_test.xml" ).getInputStream(),options );
+        
+        assertNotNull( summary );
+        assertNotNull( summary.getDataValueCount() );
+        
+    }
+
+    @Test
+    public void testImportDataValueSetXML()
+        throws Exception
+    {
+        ImportOptions options = new ImportOptions( CODE, CODE, false, NEW_AND_UPDATES, false );
+        ImportSummary summary = integrationService.importXMLDataValueSet( new ClassPathResource( "data/dataValueSetA.xml" ).getInputStream(),options );
+        
+        assertNotNull( summary );
+        assertNotNull( summary.getDataValueCount() );
+        
+    }
+    
+
+}

=== added directory 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/data'
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/dataValueSetA.xml'
--- dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/dataValueSetA.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/dataValueSetA.xml	2012-06-01 21:56:18 +0000
@@ -0,0 +1,5 @@
+<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0"; dataSet="pBOMPrpg1QX" completeDate="2012-01-09" period="201201" orgUnit="DiszpKrYNg8">
+    <dataValue dataElement="f7n9E0hX8qk" value="10001" storedBy="john" timestamp="2012-01-01" comment="comment" followup="false"/>
+    <dataValue dataElement="Ix2HsbDMLea" value="10002" storedBy="john" timestamp="2012-01-02" comment="comment" followup="false"/>
+    <dataValue dataElement="eY5ehpbEsB7" value="10003" storedBy="john" timestamp="2012-01-03" comment="comment" followup="false"/>
+</dataValueSet>
\ No newline at end of file

=== added file 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/sdmx_test.xml'
--- dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/sdmx_test.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/sdmx_test.xml	2012-06-01 21:56:18 +0000
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<CrossSectionalData xmlns="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message"; 
+                    xmlns:ns="urn:sdmx:org.sdmx.infomodel.keyfamily.KeyFamily=HP_MOH:OPENMRS:1.0:cross" >
+
+    <Header>
+        <ID>SDMX-HD-CSD</ID>
+        <Test>false</Test>
+        <Truncated>false</Truncated>
+        <Name xml:lang="en">Monthly Facility Report</Name>
+        <Prepared>2012-05-25</Prepared>
+        <Sender id="OpenMRS">
+            <Name>DDU</Name>
+        </Sender>
+    </Header>
+    <ns:DataSet datasetID="DS_A" >
+            <ns:Group VALUE_TYPE="0" FREQ="M" TIME_PERIOD="201201">
+                <ns:Section>
+                  <ns:OBS_VALUE FACILITY="OU_A" DATAELEMENT="DE_A" value="180"/>			
+                  <ns:OBS_VALUE FACILITY="OU_A" DATAELEMENT="DE_B" value="180"/>			
+                  <ns:OBS_VALUE FACILITY="OU_A" DATAELEMENT="DE_C" value="180"/>			
+                  <ns:OBS_VALUE FACILITY="OU_B" DATAELEMENT="DE_A" value="180"/>			
+                  <ns:OBS_VALUE FACILITY="OU_B" DATAELEMENT="DE_B" value="180"/>			
+                  <ns:OBS_VALUE FACILITY="OU_B" DATAELEMENT="DE_C" value="180"/>			
+                </ns:Section>
+            </ns:Group>
+    </ns:DataSet>
+</CrossSectionalData>
\ No newline at end of file

=== added file 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/log4j.properties'
--- dhis-2/dhis-services/dhis-service-integration/src/test/resources/log4j.properties	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/resources/log4j.properties	2012-06-01 21:56:18 +0000
@@ -0,0 +1,12 @@
+
+# Configuration file for log4j
+
+# Log to console setup
+log4j.appender.console = org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout = org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern = * %-5p %d{ABSOLUTE} %m (%F [%t])%n
+
+# Categories (order: DEBUG, INFO, WARN, ERROR, FATAL)
+log4j.rootCategory = WARN, console 
+log4j.category.org.hisp.dhis = INFO, console
+log4j.category.smslib = INFO
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/test-context.xml'
--- dhis-2/dhis-services/dhis-service-integration/src/test/resources/test-context.xml	2012-04-16 15:12:08 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/resources/test-context.xml	2012-06-01 21:56:18 +0000
@@ -9,6 +9,8 @@
   <!-- custom lifecycle strategy -->
   <bean id="lifecyclestrategy" class="org.hisp.dhis.integration.management.DHIS2LifecycleStrategy" />
   
+  <bean id="integrationService" class="org.hisp.dhis.integration.DefaultIntegrationService" />
+
   <camel:camelContext id="camel-builtin">
 
     <camel:packageScan>