dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20692
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9591: Added project for adhoc tasks for java hackers
------------------------------------------------------------
revno: 9591
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-01-23 15:05:25 +0100
message:
Added project for adhoc tasks for java hackers
added:
tools/dhis-adhoc/
tools/dhis-adhoc/pom.xml
tools/dhis-adhoc/src/
tools/dhis-adhoc/src/main/
tools/dhis-adhoc/src/main/java/
tools/dhis-adhoc/src/main/java/org/
tools/dhis-adhoc/src/main/java/org/hisp/
tools/dhis-adhoc/src/main/java/org/hisp/dhis/
tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/
tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/Command.java
tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/CustomFormWriter.java
tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java
tools/dhis-adhoc/src/main/resources/
tools/dhis-adhoc/src/main/resources/META-INF/
tools/dhis-adhoc/src/main/resources/META-INF/dhis/
tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml
tools/dhis-adhoc/src/main/resources/log4j.properties
--
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 'tools/dhis-adhoc'
=== added file 'tools/dhis-adhoc/pom.xml'
--- tools/dhis-adhoc/pom.xml 1970-01-01 00:00:00 +0000
+++ tools/dhis-adhoc/pom.xml 2013-01-23 14:05:25 +0000
@@ -0,0 +1,46 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-services</artifactId>
+ <version>2.11-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>dhis-adhoc</artifactId>
+ <packaging>jar</packaging>
+ <name>DHIS Ad-hoc</name>
+
+ <dependencies>
+
+ <!-- DHIS -->
+
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-service-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-service-reporting</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-service-analytics</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-service-administration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-support-system</artifactId>
+ </dependency>
+
+ </dependencies>
+</project>
=== added directory 'tools/dhis-adhoc/src'
=== added directory 'tools/dhis-adhoc/src/main'
=== added directory 'tools/dhis-adhoc/src/main/java'
=== added directory 'tools/dhis-adhoc/src/main/java/org'
=== added directory 'tools/dhis-adhoc/src/main/java/org/hisp'
=== added directory 'tools/dhis-adhoc/src/main/java/org/hisp/dhis'
=== added directory 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc'
=== added file 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/Command.java'
--- tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/Command.java 1970-01-01 00:00:00 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/Command.java 2013-01-23 14:05:25 +0000
@@ -0,0 +1,6 @@
+package org.hisp.dhis.adhoc;
+
+public interface Command
+{
+ void execute();
+}
=== added file 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/CustomFormWriter.java'
--- tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/CustomFormWriter.java 1970-01-01 00:00:00 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/CustomFormWriter.java 2013-01-23 14:05:25 +0000
@@ -0,0 +1,20 @@
+package org.hisp.dhis.adhoc;
+
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSetService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class CustomFormWriter
+ implements Command
+{
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Override
+ public void execute()
+ {
+ }
+}
=== added file 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java'
--- tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java 1970-01-01 00:00:00 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java 2013-01-23 14:05:25 +0000
@@ -0,0 +1,60 @@
+package org.hisp.dhis.adhoc;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * This class should be executed. You can do this e.g. by choosing "Run as" -
+ * "Java application" in your IDE.
+ *
+ * To add tasks you should implement the Command interface, add your implementation
+ * class as a bean in beans.xml under src/main/resources/META-INF/dhis, and add
+ * the bean identifier to the list in the commands() method int this class.
+ */
+public class RunMe
+{
+ private static final Log log = LogFactory.getLog( RunMe.class );
+
+ private static final String DHIS2_HOME = "/home/larshelg/dev/config/dhis2"; // Change this
+
+ private static ApplicationContext context;
+
+ public static void main( String[] args )
+ {
+ System.setProperty( "dhis2.home", DHIS2_HOME );
+
+ log.info( "Initializing Spring context" );
+
+ context = new ClassPathXmlApplicationContext( "classpath*:/META-INF/dhis/beans.xml" );
+
+ log.info( "Spring context initialized" );
+
+ for ( String id : commands() )
+ {
+ Command command = get( id );
+
+ log.info( "Executing: " + id );
+
+ command.execute();
+
+ log.info( "Done: " + id );
+ }
+
+ log.info( "Completed" );
+ }
+
+ private static Command get( String id )
+ {
+ return (Command) context.getBean( id );
+ }
+
+ private static List<String> commands()
+ {
+ return Arrays.asList( "customFormWriter" );
+ }
+}
=== added directory 'tools/dhis-adhoc/src/main/resources'
=== added directory 'tools/dhis-adhoc/src/main/resources/META-INF'
=== added directory 'tools/dhis-adhoc/src/main/resources/META-INF/dhis'
=== added file 'tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml'
--- tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml 1970-01-01 00:00:00 +0000
+++ tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml 2013-01-23 14:05:25 +0000
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
+
+ <bean id="customFormWriter" class="org.hisp.dhis.adhoc.CustomFormWriter"/>
+
+</beans>
=== added file 'tools/dhis-adhoc/src/main/resources/log4j.properties'
--- tools/dhis-adhoc/src/main/resources/log4j.properties 1970-01-01 00:00:00 +0000
+++ tools/dhis-adhoc/src/main/resources/log4j.properties 2013-01-23 14:05:25 +0000
@@ -0,0 +1,33 @@
+
+# Configuration file for log4j
+
+# Log to file setup
+log4j.appender.file = org.apache.log4j.RollingFileAppender
+log4j.appender.file.File = dhis.log
+log4j.appender.file.MaxFileSize = 100KB
+log4j.appender.file.MaxBackupIndex = 3
+log4j.appender.file.layout = org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern = * %-5p %d{ISO8601} %m (%F [%t])%n
+
+# 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{ISO8601} %m (%F [%t])%n
+
+# Categories (order: DEBUG, INFO, WARN, ERROR, FATAL)
+
+# Default logging level and appender
+log4j.rootCategory = WARN, console
+
+# DHIS 2 logging level
+log4j.logger.org.hisp.dhis = INFO
+
+# SMS lib logging level
+log4j.logger.smslib = INFO
+
+# Ehcache logging level
+log4j.logger.org.hibernate.cache=ERROR
+
+# Spring framework logging level
+log4j.logger.org.springframework = WARN
+log4j.logger.org.springframework.web = WARN