Index: ether_ndacc/trunk/common/implementation/com/ether/DateUtils.java
===================================================================
--- ether_ndacc/trunk/common/implementation/com/ether/DateUtils.java	(revision 99)
+++ ether_ndacc/trunk/common/implementation/com/ether/DateUtils.java	(revision 99)
@@ -0,0 +1,157 @@
+package com.ether;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+public abstract class DateUtils
+{
+    /**
+     * Set the date with a default locale (french)
+     *
+     * @param date date to formate
+     * @return a new date set to midnight
+     */
+    public static Date to00h00m00s( final Date date )
+    {
+        assert ( null != date );
+        final Calendar calendar = Calendar.getInstance( Locale.FRENCH );
+
+        return setMinimumFields( date, calendar );
+    }
+
+    /**
+     * Set the date with a default locale (french)
+     *
+     * @param date date to formate
+     * @return a new date set to 23h 59m 59s
+     */
+    public static Date to23h59m59s( final Date date )
+    {
+        assert ( null != date );
+        final Calendar calendar = Calendar.getInstance( Locale.FRENCH );
+
+        return setMaximumFields( date, calendar );
+    }
+
+    /**
+     * Set the date using the given locale
+     *
+     * @param locale locale to use
+     * @param date   date to formate
+     * @return a new date set to midnight
+     */
+    public static Date to00h00m00s( final Locale locale, final Date date )
+    {
+        assert ( null != date );
+        final Calendar calendar = Calendar.getInstance( locale );
+
+        return setMinimumFields( date, calendar );
+    }
+
+    /**
+     * Set the date using the given locale
+     *
+     * @param locale locale to use
+     * @param date   date to formate
+     * @return a new date set to 23h 59m 59s
+     */
+    public static Date to23h59m59s( final Locale locale, final Date date )
+    {
+        assert ( null != date );
+        final Calendar calendar = Calendar.getInstance( locale );
+
+        return setMaximumFields( date, calendar );
+    }
+
+
+    private static Date setMinimumFields( final Date date, final Calendar calendar )
+    {
+        calendar.setTime( date );
+        calendar.set( Calendar.HOUR_OF_DAY, calendar.getMinimum( Calendar.HOUR_OF_DAY ) );
+        calendar.set( Calendar.MINUTE, calendar.getMinimum( Calendar.MINUTE ) );
+        calendar.set( Calendar.SECOND, calendar.getMinimum( Calendar.SECOND ) );
+
+        return calendar.getTime();
+    }
+
+    private static Date setMaximumFields( final Date date, final Calendar calendar )
+    {
+        calendar.setTime( date );
+        calendar.set( Calendar.HOUR_OF_DAY, calendar.getMaximum( Calendar.HOUR_OF_DAY ) );
+        calendar.set( Calendar.MINUTE, calendar.getMaximum( Calendar.MINUTE ) );
+        calendar.set( Calendar.SECOND, calendar.getMaximum( Calendar.SECOND ) );
+
+        return calendar.getTime();
+    }
+
+    public static String shortFormatFrench( final Date date )
+    {
+        return formatDate( date, FRENCH_DATE_PATTERN_SHORT );
+    }
+
+    public static String shortFormat( final Date date, final Locale locale )
+    {
+        if( date == null )
+            return "";
+
+        final DateFormat dateFormat = DateFormat.getDateInstance( DateFormat.SHORT, locale );
+
+        return dateFormat.format( date );
+    }
+
+    public static String orderedFormat( final Date date )
+    {
+        return formatDate( date, ORDERED_FORMAT );
+    }
+
+    public static String orderedFormatPlusGMT( final Date date )
+    {
+        return formatDate( date, ORDERED_FORMAT_PLUS_GMT );
+    }
+
+    public static String formatDate( final Date date, final String format )
+    {
+        if( date == null )
+            return "";
+
+        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat( format );
+        return simpleDateFormat.format( date );
+    }
+    
+    public static Date datesAddMonth(final Date inputDate, final int number) 
+    {
+        /*final DateFormat shortDateFormat = new SimpleDateFormat("MMyyyy");
+        final DateFormat completDateFormat = new SimpleDateFormat("dd-MM-yyyy");             
+        final Date firstMois = shortDateFormat.parse("102008");
+        final String firstMoisString = completDateFormat.format(firstMois);*/
+        
+        final Calendar calendar = Calendar.getInstance();
+        calendar.setTime(inputDate);
+        calendar.add(Calendar.MONTH, number);
+         
+        return calendar.getTime();
+        //final String secondMoisString = completDateFormat.format(secondMois);
+                 
+    } 
+
+    public static Date datesAddYear(final Date inputDate, final int number) 
+    {
+        
+        final Calendar calendar = Calendar.getInstance();
+        calendar.setTime(inputDate);
+        calendar.add(Calendar.YEAR, number);
+         
+        return calendar.getTime();
+        //final String secondMoisString = completDateFormat.format(secondMois);
+                 
+    } 
+    public static final String FRENCH_DATE_PATTERN_SHORT = "dd/MM/yyyy";
+    public static final String ENGLISH_DATE_PATTERN_SHORT = "MM/dd/yyyy";
+    public static final String CHINESE_DATE_PATTERN_SHORT = "yyyy/MM/dd";
+
+    public static final String ORDERED_FORMAT_PLUS_GMT = "yyyy-MM-dd HH:mm:ss.SSSS Z";
+    public static final String ORDERED_FORMAT = "yyyy-MM-dd HH:mm:ss.SSSS";
+}
Index: ether_ndacc/trunk/common/interface/com/ether/FormattedException.java
===================================================================
--- ether_ndacc/trunk/common/interface/com/ether/FormattedException.java	(revision 99)
+++ ether_ndacc/trunk/common/interface/com/ether/FormattedException.java	(revision 99)
@@ -0,0 +1,73 @@
+package com.ether;
+
+import java.util.Formatter;
+import java.util.Locale;
+
+@SuppressWarnings("serial")
+public class FormattedException extends Exception
+{
+    public FormattedException(final Object... parameters) {
+	this(Locale.getDefault(), DEFAULT_MESSAGE, DEFAULT_THROWABLE, parameters);
+    }
+
+    public FormattedException(final Locale locale, final Object... parameters) {
+	this(locale, DEFAULT_MESSAGE, DEFAULT_THROWABLE, parameters);
+    }
+
+    public FormattedException(final String message, final Object... parameters) {
+	this(Locale.getDefault(), message, DEFAULT_THROWABLE, parameters);
+    }
+
+    public FormattedException(final Locale locale, final String message, final Object... parameters) {
+	this(locale, message, null, parameters);
+    }
+
+    public FormattedException(final Throwable throwable, final Object... parameters) {
+	this(Locale.getDefault(), throwable.getMessage(), throwable, parameters);
+    }
+
+    public FormattedException(final String message, final Throwable throwable, final Object... parameters) {
+	this(Locale.getDefault(), message, throwable, parameters);
+    }
+
+    public FormattedException(final Locale locale, final String message, final Throwable throwable, final Object... parameters) {
+	super(format(locale, message, parameters), throwable);
+    }
+
+    private static String format(final Locale locale, final String message, final Object[] parameters)
+    {
+	final StringBuilder stringBuilder = new StringBuilder();
+	final Formatter formatter = new Formatter(stringBuilder);
+	formatter.format(locale, message, parameters);
+	return stringBuilder.toString();
+    }
+
+    /**
+     * Prefixes the message with code if not null.
+     */
+    public static String prefix(final Enum<? extends Code> code, final String message)
+    {
+	final StringBuffer stringBuffer = new StringBuffer();
+
+	if (code != null)
+	{
+	    stringBuffer.append(code.toString());
+	    stringBuffer.append(" - ");
+	}
+
+	stringBuffer.append(message);
+	return stringBuffer.toString();
+    }
+
+    /**
+     * The error code, it identifies the type of error. 
+     * The derived classes must creates their own code as enum and implements this interface. 
+     * If the subclass is not an enum it won't be recognized by the constructor.
+     */
+    public static interface Code
+    {
+    }
+
+    public static String DEFAULT_MESSAGE = "no message";
+    public static String DEFAULT_THROWABLE = null;
+}
Index: ether_ndacc/trunk/common/lo4j.xml
===================================================================
--- ether_ndacc/trunk/common/lo4j.xml	(revision 99)
+++ ether_ndacc/trunk/common/lo4j.xml	(revision 99)
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%p %d{ISO8601} - %c{1} - %m%n"/>
+        </layout>
+    </appender>
+
+    <appender name="file" class="org.apache.log4j.FileAppender">
+        <param name="file" value="${catalina.home}/logs/${app.name}.log"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%p %d{ISO8601} - %c{1} - %m%n"/>
+        </layout>
+    </appender>
+
+    <!-- library loggers -->
+    <logger name="oracle.jdbc" additivity="false">
+        <level value="info"/>
+        <appender-ref ref="file"/>
+    </logger>
+
+    <logger name="oracle.ons" additivity="false">
+        <level value="debug"/>
+        <appender-ref ref="file"/>
+    </logger>
+
+    <logger name="org.hibernate" additivity="false">
+        <level value="fatal"/>
+        <appender-ref ref="file"/>
+    </logger>
+
+    <logger name="org.hibernate.persister.entity" additivity="false">
+        <level value="debug"/>
+        <appender-ref ref="file"/>
+    </logger>
+
+    <logger name="net.sf.cglib" additivity="false">
+        <level value="warn"/>
+        <appender-ref ref="file"/>
+    </logger>
+
+    <logger name="javanet_filter" additivity="false">
+        <level value="warn"/>
+        <appender-ref ref="javanet_filter_appender"/>
+    </logger>
+
+    <!-- root logger -->
+    <root>
+        <level value="warn"/>
+        <appender-ref ref="console"/>
+        <appender-ref ref="file"/>
+    </root>
+    
+    <root>
+    	<level value="info"/>
+    	<appender-ref ref="console"/>
+    </root>
+
+</log4j:configuration>
Index: ether_ndacc/trunk/common/test/com/ether/TestUtils.java
===================================================================
--- ether_ndacc/trunk/common/test/com/ether/TestUtils.java	(revision 99)
+++ ether_ndacc/trunk/common/test/com/ether/TestUtils.java	(revision 99)
@@ -0,0 +1,119 @@
+package com.ether;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public abstract class TestUtils<BEAN>
+{
+    protected TestUtils(final String beanContextName, final String beanName, final String[] otherContextNames) {
+	_beanContextName = beanContextName;
+	_beanName = beanName;
+	_otherContextNames = otherContextNames;
+    }
+
+    protected abstract void beforeBeanTest() throws Exception;
+
+    protected abstract void afterBeanTest() throws Exception;
+
+    @Before
+    public final void beforeTest() throws Exception
+    {
+	Assert.assertNotNull(getApplicationContext());
+	Assert.assertNotNull(getBean());
+	beforeBeanTest();
+    }
+
+    @After
+    public final void afterTest() throws Exception
+    {
+	afterBeanTest();
+	_bean = null;
+    }
+    
+    @AfterClass
+    public static void afterAllTest() throws Exception
+    {
+	try
+	{
+	    if (_applicationContext != null) _applicationContext.close();
+	}
+	finally
+	{
+	    _applicationContext = null;
+	}
+    }
+
+    /**
+     * Builds context names from 2 context name arrays.
+     * 
+     * @param baseContextNames : the base context names.
+     * @param otherContextNames : the other context names.
+     * @return a context name array.
+     */
+    protected static String[] buildContextNames(
+	    final String[] baseContextNames, final String... otherContextNames)
+    {
+	int contextNameSize = baseContextNames == null ? 0 : baseContextNames.length;
+	contextNameSize += otherContextNames == null ? 0 : otherContextNames.length;
+
+	final String[] contextNames = new String[contextNameSize];
+
+	if (baseContextNames != null)
+	    System.arraycopy(baseContextNames, 0, contextNames, 0, baseContextNames.length);
+
+	if (otherContextNames != null)
+	{
+	    if (baseContextNames != null)
+		System.arraycopy(otherContextNames, 0, contextNames, baseContextNames.length, otherContextNames.length);
+	    else
+		System.arraycopy(otherContextNames, 0, contextNames, 0, otherContextNames.length);
+	}
+
+	return contextNames;
+    }
+
+    protected final ApplicationContext getApplicationContext()
+    {
+	if (_applicationContext == null)
+	{
+	    final String[] contextNames;
+
+	    if (_otherContextNames != null)
+	    {
+		if (_beanContextName != null)
+		    contextNames = buildContextNames(_otherContextNames, _beanContextName);
+		else
+		    contextNames = buildContextNames(_otherContextNames);
+	    }
+	    else
+	    {
+		contextNames = new String[] { _beanContextName };
+	    }
+
+	    _applicationContext = new ClassPathXmlApplicationContext(contextNames);
+	}
+
+	return _applicationContext;
+    }
+
+    @SuppressWarnings({ "unchecked" })
+    protected final BEAN getBean()
+    {
+	if (_bean == null)
+	    _bean = (BEAN) getApplicationContext().getBean(_beanName);
+
+	return _bean;
+    }
+
+    private static AbstractApplicationContext _applicationContext;
+
+    private String _beanContextName;
+    private String _beanName;
+    private String[] _otherContextNames;
+    private BEAN _bean;
+}
Index: ether_ndacc/trunk/lo4j.xml
===================================================================
--- ether_ndacc/trunk/lo4j.xml	(revision 98)
+++ 	(revision )
@@ -1,61 +1,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-    <appender name="console" class="org.apache.log4j.ConsoleAppender">
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%p %d{ISO8601} - %c{1} - %m%n"/>
-        </layout>
-    </appender>
-
-    <appender name="file" class="org.apache.log4j.FileAppender">
-        <param name="file" value="${catalina.home}/logs/${app.name}.log"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%p %d{ISO8601} - %c{1} - %m%n"/>
-        </layout>
-    </appender>
-
-    <!-- library loggers -->
-    <logger name="oracle.jdbc" additivity="false">
-        <level value="info"/>
-        <appender-ref ref="file"/>
-    </logger>
-
-    <logger name="oracle.ons" additivity="false">
-        <level value="debug"/>
-        <appender-ref ref="file"/>
-    </logger>
-
-    <logger name="org.hibernate" additivity="false">
-        <level value="fatal"/>
-        <appender-ref ref="file"/>
-    </logger>
-
-    <logger name="org.hibernate.persister.entity" additivity="false">
-        <level value="debug"/>
-        <appender-ref ref="file"/>
-    </logger>
-
-    <logger name="net.sf.cglib" additivity="false">
-        <level value="warn"/>
-        <appender-ref ref="file"/>
-    </logger>
-
-    <logger name="javanet_filter" additivity="false">
-        <level value="warn"/>
-        <appender-ref ref="javanet_filter_appender"/>
-    </logger>
-
-    <!-- root logger -->
-    <root>
-        <level value="warn"/>
-        <appender-ref ref="console"/>
-        <appender-ref ref="file"/>
-    </root>
-    
-    <root>
-    	<level value="info"/>
-    	<appender-ref ref="console"/>
-    </root>
-
-</log4j:configuration>
