You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/04/17 18:08:47 UTC

[35/50] [abbrv] zest-qi4j git commit: Replaced Joda Time with Java 8 Time API.

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/alarm/src/main/java/org/qi4j/library/alarm/StandardAlarmModelService.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/qi4j/library/alarm/StandardAlarmModelService.java b/libraries/alarm/src/main/java/org/qi4j/library/alarm/StandardAlarmModelService.java
index 1911398..906cd45 100644
--- a/libraries/alarm/src/main/java/org/qi4j/library/alarm/StandardAlarmModelService.java
+++ b/libraries/alarm/src/main/java/org/qi4j/library/alarm/StandardAlarmModelService.java
@@ -17,9 +17,9 @@
  */
 package org.qi4j.library.alarm;
 
+import java.time.ZonedDateTime;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
@@ -274,7 +274,7 @@ public interface StandardAlarmModelService extends AlarmModel, ServiceComposite
             ValueBuilder<AlarmStatus> builder = vbf.newValueBuilder( AlarmStatus.class );
             AlarmStatus.State prototype = builder.prototypeFor( AlarmStatus.State.class );
             prototype.name().set( status );
-            prototype.creationDate().set( new Date() );
+            prototype.creationDate().set( ZonedDateTime.now() );
             return builder.newInstance();
         }
 
@@ -287,7 +287,7 @@ public interface StandardAlarmModelService extends AlarmModel, ServiceComposite
             ValueBuilder<AlarmEvent> builder = vbf.newValueBuilder( AlarmEvent.class );
             AlarmEvent prototype = builder.prototype();
             prototype.alarmIdentity().set( alarmId.identity().get() );
-            prototype.eventTime().set( new Date() );
+            prototype.eventTime().set( ZonedDateTime.now() );
             prototype.newStatus().set( newStatus );
             prototype.oldStatus().set( oldStatus );
             prototype.systemName().set( eventSystemName );

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/alarm/src/test/java/org/qi4j/library/alarm/ExtendedAlarmModelTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/qi4j/library/alarm/ExtendedAlarmModelTest.java b/libraries/alarm/src/test/java/org/qi4j/library/alarm/ExtendedAlarmModelTest.java
index 07dd367..9012a8a 100644
--- a/libraries/alarm/src/test/java/org/qi4j/library/alarm/ExtendedAlarmModelTest.java
+++ b/libraries/alarm/src/test/java/org/qi4j/library/alarm/ExtendedAlarmModelTest.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.library.alarm;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import java.util.List;
 import java.util.Locale;
 import org.junit.Test;
@@ -970,7 +970,7 @@ public class ExtendedAlarmModelTest
         ValueBuilder<AlarmStatus> builder = module.newValueBuilder( AlarmStatus.class );
         AlarmStatus.State statePrototype = builder.prototypeFor( AlarmStatus.State.class );
         statePrototype.name().set( status );
-        statePrototype.creationDate().set( new Date() );
+        statePrototype.creationDate().set( ZonedDateTime.now() );
         return builder.newInstance();
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/alarm/src/test/java/org/qi4j/library/alarm/SimpleAlarmModelTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/qi4j/library/alarm/SimpleAlarmModelTest.java b/libraries/alarm/src/test/java/org/qi4j/library/alarm/SimpleAlarmModelTest.java
index 5276ac1..e328bdc 100644
--- a/libraries/alarm/src/test/java/org/qi4j/library/alarm/SimpleAlarmModelTest.java
+++ b/libraries/alarm/src/test/java/org/qi4j/library/alarm/SimpleAlarmModelTest.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.library.alarm;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import java.util.List;
 import java.util.Locale;
 import org.junit.Test;
@@ -355,7 +355,7 @@ public class SimpleAlarmModelTest
         ValueBuilder<AlarmStatus> builder = module.newValueBuilder( AlarmStatus.class );
         AlarmStatus.State statePrototype = builder.prototypeFor( AlarmStatus.State.class );
         statePrototype.name().set( status );
-        statePrototype.creationDate().set( new Date() );
+        statePrototype.creationDate().set( ZonedDateTime.now() );
         return builder.newInstance();
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/alarm/src/test/java/org/qi4j/library/alarm/StandardAlarmModelTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/qi4j/library/alarm/StandardAlarmModelTest.java b/libraries/alarm/src/test/java/org/qi4j/library/alarm/StandardAlarmModelTest.java
index 59e32f5..7f6c8d3 100644
--- a/libraries/alarm/src/test/java/org/qi4j/library/alarm/StandardAlarmModelTest.java
+++ b/libraries/alarm/src/test/java/org/qi4j/library/alarm/StandardAlarmModelTest.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.library.alarm;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import java.util.List;
 import java.util.Locale;
 import org.junit.Assert;
@@ -481,7 +481,7 @@ public class StandardAlarmModelTest
         ValueBuilder<AlarmStatus> builder = module.newValueBuilder( AlarmStatus.class );
         AlarmStatus.State statePrototype = builder.prototypeFor( AlarmStatus.State.class );
         statePrototype.name().set( status );
-        statePrototype.creationDate().set( new Date() );
+        statePrototype.creationDate().set( ZonedDateTime.now() );
         return builder.newInstance();
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java b/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java
index 00ed41e..8228454 100644
--- a/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java
+++ b/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java
@@ -2,7 +2,7 @@ package org.qi4j.library.appbrowser;
 
 import java.io.StringWriter;
 import java.io.Writer;
-import org.joda.time.DateTime;
+import java.time.temporal.ChronoUnit;
 import org.junit.Test;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.association.ManyAssociation;
@@ -106,7 +106,7 @@ public class AppBrowserTest extends AbstractQi4jTest
     @Mixins( Age.AgeMixin.class )
     public interface Age
     {
-        Property<Integer> birthYear();
+        Property<Year> birthYear();
 
         int numberOfYearsOld();
 
@@ -117,7 +117,7 @@ public class AppBrowserTest extends AbstractQi4jTest
             @Override
             public int numberOfYearsOld()
             {
-                return DateTime.now().getYearOfEra() - birthYear().get();
+                return birthYear().get().until( Year.now(), ChronoUnit.YEARS );
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/CircuitBreaker.java
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/CircuitBreaker.java b/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/CircuitBreaker.java
index 2e53b46..b588665 100644
--- a/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/CircuitBreaker.java
+++ b/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/CircuitBreaker.java
@@ -21,7 +21,7 @@ import java.beans.PropertyChangeSupport;
 import java.beans.PropertyVetoException;
 import java.beans.VetoableChangeListener;
 import java.beans.VetoableChangeSupport;
-import java.util.Date;
+import java.time.ZonedDateTime;
 import java.util.function.Predicate;
 import org.qi4j.functional.Specifications;
 
@@ -43,8 +43,8 @@ public class CircuitBreaker
     private Predicate<Throwable> allowedThrowables;
 
     private int countDown;
-    private long trippedOn = -1;
-    private long enableOn = -1;
+    private ZonedDateTime trippedOn = null;
+    private ZonedDateTime enableOn = null;
 
     private Status status = Status.on;
 
@@ -86,8 +86,8 @@ public class CircuitBreaker
             status = Status.off;
             pcs.firePropertyChange( "status", Status.on, Status.off );
 
-            trippedOn = System.currentTimeMillis();
-            enableOn = trippedOn + timeout;
+            trippedOn = ZonedDateTime.now();
+            enableOn = trippedOn.plusNanos( timeout * 1000000 );
         }
     }
 
@@ -101,8 +101,8 @@ public class CircuitBreaker
                 vcs.fireVetoableChange( "status", Status.off, Status.on );
                 status = Status.on;
                 countDown = threshold;
-                trippedOn = -1;
-                enableOn = -1;
+                trippedOn = null;
+                enableOn = null;
                 lastThrowable = null;
 
                 pcs.firePropertyChange( "status", Status.off, Status.on );
@@ -110,7 +110,7 @@ public class CircuitBreaker
             catch( PropertyVetoException e )
             {
                 // Reset timeout
-                enableOn = System.currentTimeMillis() + timeout;
+                enableOn = ZonedDateTime.now().plusNanos( timeout * 1000000 );
 
                 if( e.getCause() != null )
                 {
@@ -144,7 +144,7 @@ public class CircuitBreaker
     {
         if( status == Status.off )
         {
-            if( System.currentTimeMillis() > enableOn )
+            if( ZonedDateTime.now().isAfter( enableOn ) )
             {
                 try
                 {
@@ -167,14 +167,14 @@ public class CircuitBreaker
         return status;
     }
 
-    public Date trippedOn()
+    public ZonedDateTime trippedOn()
     {
-        return trippedOn == -1 ? null : new Date( trippedOn );
+        return trippedOn;
     }
 
-    public Date enabledOn()
+    public ZonedDateTime enabledOn()
     {
-        return enableOn == -1 ? null : new Date( enableOn );
+        return enableOn;
     }
 
     public boolean isOn()

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/jmx/CircuitBreakerJMX.java
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/jmx/CircuitBreakerJMX.java b/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/jmx/CircuitBreakerJMX.java
index 72a9fd2..a557c78 100644
--- a/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/jmx/CircuitBreakerJMX.java
+++ b/libraries/circuitbreaker/src/main/java/org/qi4j/library/circuitbreaker/jmx/CircuitBreakerJMX.java
@@ -19,8 +19,6 @@ package org.qi4j.library.circuitbreaker.jmx;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyVetoException;
-import java.text.DateFormat;
-import java.util.Date;
 import javax.management.MBeanNotificationInfo;
 import javax.management.Notification;
 import javax.management.NotificationBroadcasterSupport;
@@ -31,96 +29,101 @@ import org.qi4j.library.circuitbreaker.CircuitBreaker;
  * MBean for circuit breakers. Exposes CB properties and also the property changes as notifications.
  */
 public class CircuitBreakerJMX
-        extends NotificationBroadcasterSupport
-        implements org.qi4j.library.circuitbreaker.jmx.CircuitBreakerJMXMBean
+    extends NotificationBroadcasterSupport
+    implements org.qi4j.library.circuitbreaker.jmx.CircuitBreakerJMXMBean
 {
-   CircuitBreaker circuitBreaker;
-
-   public CircuitBreakerJMX(CircuitBreaker circuitBreaker, final ObjectName mbeanObjectName)
-   {
-      super(new MBeanNotificationInfo(new String[]{"serviceLevel", "status"}, Notification.class.getName(), "Circuit breaker notifications"));
-
-      this.circuitBreaker = circuitBreaker;
-      circuitBreaker.addPropertyChangeListener(new PropertyChangeListener()
-      {
-         long sequenceNr = System.currentTimeMillis();
-
-         @Override
-         public void propertyChange(PropertyChangeEvent evt)
-         {
-            Notification notification = new Notification(evt.getPropertyName(), mbeanObjectName, sequenceNr++, System.currentTimeMillis(), evt.getNewValue().toString());
-            sendNotification(notification);
-         }
-      });
-   }
-
-   @Override
-   public String getStatus()
-   {
-      return circuitBreaker.status().name();
-   }
-
-   @Override
-   public int getThreshold()
-   {
-      return circuitBreaker.threshold();
-   }
-
-   @Override
-   public double getServiceLevel()
-   {
-      return circuitBreaker.serviceLevel();
-   }
-
-   @Override
-   public String getLastErrorMessage()
-   {
-      return circuitBreaker.lastThrowable() == null ? "" : errorMessage(circuitBreaker.lastThrowable());
-   }
-
-   private String errorMessage(Throwable throwable)
-   {
-      String message = throwable.getMessage();
-      if (message == null)
-         message = throwable.getClass().getSimpleName();
-
-      if (throwable.getCause() != null)
-      {
-         return message + ":" + errorMessage(throwable.getCause());
-      } else
-         return message;
-   }
-
-   @Override
-   public String getTrippedOn()
-   {
-      Date trippedOn = circuitBreaker.trippedOn();
-      return trippedOn == null ? "" : DateFormat.getDateTimeInstance().format(trippedOn);
-   }
-
-   @Override
-   public String getEnableOn()
-   {
-      Date trippedOn = circuitBreaker.enabledOn();
-      return trippedOn == null ? "" : DateFormat.getDateTimeInstance().format(trippedOn);
-   }
-
-   @Override
-   public String turnOn()
-   {
-      try
-      {
-         circuitBreaker.turnOn();
-         return "Circuit breaker has been turned on";
-      } catch (PropertyVetoException e)
-      {
-         return "Could not turn on circuit breaker:" + getLastErrorMessage();
-      }
-   }
-
-   @Override
-   public void trip()
-   {
-      circuitBreaker.trip();
-   }
+    CircuitBreaker circuitBreaker;
+
+    public CircuitBreakerJMX( CircuitBreaker circuitBreaker, final ObjectName mbeanObjectName )
+    {
+        super( new MBeanNotificationInfo( new String[]{ "serviceLevel", "status" }, Notification.class.getName(), "Circuit breaker notifications" ) );
+
+        this.circuitBreaker = circuitBreaker;
+        circuitBreaker.addPropertyChangeListener( new PropertyChangeListener()
+        {
+            long sequenceNr = System.currentTimeMillis();
+
+            @Override
+            public void propertyChange( PropertyChangeEvent evt )
+            {
+                Notification notification = new Notification( evt.getPropertyName(), mbeanObjectName, sequenceNr++, System
+                    .currentTimeMillis(), evt.getNewValue().toString() );
+                sendNotification( notification );
+            }
+        } );
+    }
+
+    @Override
+    public String getStatus()
+    {
+        return circuitBreaker.status().name();
+    }
+
+    @Override
+    public int getThreshold()
+    {
+        return circuitBreaker.threshold();
+    }
+
+    @Override
+    public double getServiceLevel()
+    {
+        return circuitBreaker.serviceLevel();
+    }
+
+    @Override
+    public String getLastErrorMessage()
+    {
+        return circuitBreaker.lastThrowable() == null ? "" : errorMessage( circuitBreaker.lastThrowable() );
+    }
+
+    private String errorMessage( Throwable throwable )
+    {
+        String message = throwable.getMessage();
+        if( message == null )
+        {
+            message = throwable.getClass().getSimpleName();
+        }
+
+        if( throwable.getCause() != null )
+        {
+            return message + ":" + errorMessage( throwable.getCause() );
+        }
+        else
+        {
+            return message;
+        }
+    }
+
+    @Override
+    public String getTrippedOn()
+    {
+        return circuitBreaker.trippedOn().toString();
+    }
+
+    @Override
+    public String getEnableOn()
+    {
+        return circuitBreaker.enabledOn().toString();
+    }
+
+    @Override
+    public String turnOn()
+    {
+        try
+        {
+            circuitBreaker.turnOn();
+            return "Circuit breaker has been turned on";
+        }
+        catch( PropertyVetoException e )
+        {
+            return "Could not turn on circuit breaker:" + getLastErrorMessage();
+        }
+    }
+
+    @Override
+    public void trip()
+    {
+        circuitBreaker.trip();
+    }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/conversion/src/test/java/org/qi4j/library/conversion/values/EntityToValueTest.java
----------------------------------------------------------------------
diff --git a/libraries/conversion/src/test/java/org/qi4j/library/conversion/values/EntityToValueTest.java b/libraries/conversion/src/test/java/org/qi4j/library/conversion/values/EntityToValueTest.java
index 3b15258..437cfa6 100644
--- a/libraries/conversion/src/test/java/org/qi4j/library/conversion/values/EntityToValueTest.java
+++ b/libraries/conversion/src/test/java/org/qi4j/library/conversion/values/EntityToValueTest.java
@@ -17,10 +17,10 @@
  */
 package org.qi4j.library.conversion.values;
 
-import java.util.Calendar;
-import java.util.Date;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
 import java.util.List;
-import java.util.TimeZone;
 import java.util.function.Function;
 import org.junit.Test;
 import org.qi4j.api.association.Association;
@@ -213,7 +213,7 @@ public class EntityToValueTest
     {
         String firstName = "Niclas";
         String lastName = "Hedhman";
-        Date birthTime = createBirthDate( 1964, 9, 25 );
+        ZonedDateTime birthTime = createBirthDate( 1964, 9, 25 );
         return createPerson( uow, firstName, lastName, birthTime );
     }
 
@@ -221,7 +221,7 @@ public class EntityToValueTest
     {
         String firstName = "Lis";
         String lastName = "Gazi";
-        Date birthTime = createBirthDate( 1976, 2, 19 );
+        ZonedDateTime birthTime = createBirthDate( 1976, 2, 19 );
         return createPerson( uow, firstName, lastName, birthTime );
     }
 
@@ -229,11 +229,11 @@ public class EntityToValueTest
     {
         String firstName = "Eric";
         String lastName = "Hedman";
-        Date birthTime = createBirthDate( 2004, 4, 8 );
+        ZonedDateTime birthTime = createBirthDate( 2004, 4, 8 );
         return createPerson( uow, firstName, lastName, birthTime );
     }
 
-    private PersonEntity createPerson( UnitOfWork uow, String firstName, String lastName, Date birthTime )
+    private PersonEntity createPerson( UnitOfWork uow, String firstName, String lastName, ZonedDateTime birthTime )
     {
         EntityBuilder<PersonEntity> builder = uow.newEntityBuilder( PersonEntity.class, "id:" + firstName );
         PersonState state = builder.instanceFor( PersonState.class );
@@ -243,12 +243,9 @@ public class EntityToValueTest
         return builder.newInstance();
     }
 
-    private Date createBirthDate( int year, int month, int day )
+    private ZonedDateTime createBirthDate( int year, int month, int day )
     {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
-        calendar.set( year, month - 1, day, 12, 0, 0 );
-        return calendar.getTime();
+        return ZonedDateTime.of( year, month, day, 0, 0, 0, 0, ZoneId.systemDefault() );
     }
 
     // START SNIPPET: state
@@ -259,7 +256,7 @@ public class EntityToValueTest
 
         Property<String> lastName();
 
-        Property<Date> dateOfBirth();
+        Property<ZonedDateTime> dateOfBirth();
 
     }
     // END SNIPPET: state
@@ -322,9 +319,7 @@ public class EntityToValueTest
         @Override
         public Integer age()
         {
-            long now = System.currentTimeMillis();
-            long birthdate = state.dateOfBirth().get().getTime();
-            return (int) ( ( now - birthdate ) / 1000 / 3600 / 24 / 365.25 );
+            return (int) state.dateOfBirth().get().until(ZonedDateTime.now(), ChronoUnit.YEARS );
         }
 
         // START SNIPPET: entity
@@ -341,7 +336,7 @@ public class EntityToValueTest
 
         Property<String> lastName();
 
-        Property<Date> dateOfBirth();
+        Property<ZonedDateTime> dateOfBirth();
 
         @Optional
         Property<String> spouse();
@@ -361,7 +356,7 @@ public class EntityToValueTest
 
         Property<String> lastName();
 
-        Property<Date> dateOfBirth();
+        Property<ZonedDateTime> dateOfBirth();
 
         @Optional
         Property<String> spouse();
@@ -380,7 +375,7 @@ public class EntityToValueTest
 
         Property<String> lastName();
 
-        Property<Date> dateOfBirth();
+        Property<ZonedDateTime> dateOfBirth();
 
         @Optional
         Property<String> spouse();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java
----------------------------------------------------------------------
diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java
index 19e4c42..bb2492f 100644
--- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java
+++ b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java
@@ -21,7 +21,7 @@ package org.qi4j.library.cxf.divs;
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.util.Date;
+import java.time.LocalDate;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
@@ -47,7 +47,7 @@ public class DividendsTest
         "<issueId>PC10YZNZC100</issueId>" +
         "<divPoints>" +
         "<ns3:anyType xmlns:ns3=\"http://cxf.apache.org/arrays\" xsi:type=\"ns2:DivPoint\">" +
-        "<updateTS>" + new Date( 2010, 10, 10 ).toString() + "</updateTS>" +
+        "<updateTS>" + LocalDate.of( 2010, 10, 10 ) + "</updateTS>" +
         "<divTypeCD></divTypeCD>" +
         "<valCcy>USD</valCcy>" +
         "<recType>A</recType>" +
@@ -62,7 +62,7 @@ public class DividendsTest
         "<lastUpdater>niclas</lastUpdater>" +
         "</ns3:anyType>" +
         "<ns3:anyType xmlns:ns3=\"http://cxf.apache.org/arrays\" xsi:type=\"ns2:DivPoint\">" +
-        "<updateTS>" + new Date( 2010, 10, 10 ).toString() + "</updateTS>" +
+        "<updateTS>" + LocalDate.of( 2010, 10, 10 ) + "</updateTS>" +
         "<divTypeCD></divTypeCD>" +
         "<valCcy>USD</valCcy>" +
         "<recType>A</recType>" +
@@ -77,9 +77,9 @@ public class DividendsTest
         "<lastUpdater>niclas</lastUpdater>" +
         "</ns3:anyType>" +
         "</divPoints>" +
-        "<systemUpdateTS>" + new Date( 2010, 10, 10 ).toString() + "</systemUpdateTS>" +
+        "<systemUpdateTS>" + LocalDate.of( 2010, 10, 10 ) + "</systemUpdateTS>" +
         "<streamName>PRIVATE_niclas</streamName>" +
-        "<userUpdateTS>" + new Date( 2010, 10, 10 ).toString() + "</userUpdateTS>" +
+        "<userUpdateTS>" + LocalDate.of( 2010, 10, 10 ) + "</userUpdateTS>" +
         "<consolidate>N</consolidate>" +
         "<mdSymbol>bt.l</mdSymbol>" +
         "</ns1:value>" +

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java
----------------------------------------------------------------------
diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java
index 6736b69..dae45d2 100644
--- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java
+++ b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java
@@ -18,8 +18,8 @@
 
 package org.qi4j.library.cxf.divs;
 
+import java.time.LocalDate;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -75,8 +75,8 @@ public interface ProjectedDividends
             prototype.divPoints().set( divPoints );
             prototype.consolidate().set( "N" );
             prototype.streamName().set( "PRIVATE_niclas" );
-            prototype.systemUpdateTS().set( new Date( 2010, 10, 10 ).toString() );
-            prototype.userUpdateTS().set( new Date( 2010, 10, 10 ).toString() );
+            prototype.systemUpdateTS().set( LocalDate.of( 2010, 10, 10 ).toString() );
+            prototype.userUpdateTS().set( LocalDate.of( 2010, 10, 10 ).toString() );
             prototype.issueId().set( "PC10YZNZC100" );
             prototype.mdSymbol().set( "bt.l" );
             return builder.newInstance();
@@ -99,7 +99,7 @@ public interface ProjectedDividends
             prototype.paydate().set( createRandomDate() );
             prototype.divTypeCD().set( "" );
             prototype.comment().set( "Silly comment" );
-            prototype.updateTS().set( new Date( 2010, 10, 10 ).toString() );
+            prototype.updateTS().set( LocalDate.of( 2010, 10, 10 ).toString() );
             prototype.lastUpdater().set( "niclas" );
             return builder.newInstance();
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing-rest/src/main/java/org/qi4j/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-rest/src/main/java/org/qi4j/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java b/libraries/eventsourcing-rest/src/main/java/org/qi4j/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java
index 4c59747..083694d 100644
--- a/libraries/eventsourcing-rest/src/main/java/org/qi4j/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java
+++ b/libraries/eventsourcing-rest/src/main/java/org/qi4j/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java
@@ -189,8 +189,8 @@ public class DomainEventSourceResource
         {
             Entry entry = new Entry();
             entry.setTitle( new Text( eventsValue.usecase().get() + "(" + eventsValue.user().get() + ")" ) );
-            entry.setPublished( new Date( eventsValue.timestamp().get() ) );
-            entry.setModificationDate( lastModified = new Date( eventsValue.timestamp().get() ) );
+            entry.setPublished( new Date( eventsValue.timestamp().get().toEpochMilli() ) );
+            entry.setModificationDate( lastModified = new Date( eventsValue.timestamp().get().toEpochMilli() ) );
             entry.setId( Long.toString( startEvent + 1 ) );
             startEvent++;
             Content content = new Content();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/api/ApplicationEvent.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/api/ApplicationEvent.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/api/ApplicationEvent.java
index efd02d8..88df274 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/api/ApplicationEvent.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/api/ApplicationEvent.java
@@ -16,7 +16,7 @@
 
 package org.qi4j.library.eventsourcing.application.api;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.qi4j.api.entity.Identity;
 import org.qi4j.api.property.Property;
 import org.qi4j.api.value.ValueComposite;
@@ -37,7 +37,7 @@ import org.qi4j.api.value.ValueComposite;
  * </p>
  */
 public interface ApplicationEvent
-        extends ValueComposite, Identity
+    extends ValueComposite, Identity
 {
     // Usecase
     Property<String> usecase();
@@ -46,7 +46,7 @@ public interface ApplicationEvent
     Property<String> name();
 
     // When the event was created
-    Property<Date> on();
+    Property<ZonedDateTime> on();
 
     // Method parameters as JSON
     Property<String> parameters();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
index 675f6ba..393043a 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
@@ -16,7 +16,7 @@
 
 package org.qi4j.library.eventsourcing.application.factory;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.json.JSONStringer;
@@ -73,7 +73,7 @@ public interface ApplicationEventFactoryService
 
             ApplicationEvent prototype = builder.prototype();
             prototype.name().set( name );
-            prototype.on().set( new Date() );
+            prototype.on().set( ZonedDateTime.now() );
 
             prototype.identity().set( idGenerator.generate( ApplicationEvent.class ) );
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/replay/ApplicationEventPlayerService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/replay/ApplicationEventPlayerService.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/replay/ApplicationEventPlayerService.java
index 51f892e..01ae017 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/replay/ApplicationEventPlayerService.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/replay/ApplicationEventPlayerService.java
@@ -18,8 +18,20 @@ package org.qi4j.library.eventsourcing.application.replay;
 
 import java.lang.reflect.Method;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.MonthDay;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.Period;
+import java.time.Year;
+import java.time.YearMonth;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
 import org.json.JSONObject;
 import org.json.JSONTokener;
 import org.qi4j.api.Qi4j;
@@ -54,8 +66,6 @@ public interface ApplicationEventPlayerService
         @Structure
         Qi4j api;
 
-        SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy" );
-
         @Override
         public void playEvent( ApplicationEvent applicationEvent, Object object )
                 throws ApplicationEventReplayException
@@ -118,9 +128,48 @@ public interface ApplicationEventPlayerService
             } else if (parameterType.equals( Integer.class ) || parameterType.equals( Integer.TYPE ))
             {
                 return ((Number) value).intValue();
-            } else if (parameterType.equals( Date.class ))
+            } else if (parameterType.equals( LocalDate.class ))
+            {
+                return LocalDate.parse( (String) value );
+            } else if (parameterType.equals( LocalDateTime.class ))
+            {
+                return LocalDateTime.parse( (String) value );
+            } else if (parameterType.equals( LocalTime.class ))
+            {
+                return LocalTime.parse( (String) value );
+            } else if (parameterType.equals( OffsetTime.class ))
+            {
+                return OffsetTime.parse( (String) value );
+            } else if (parameterType.equals( OffsetDateTime.class ))
+            {
+                return OffsetDateTime.parse( (String) value );
+            } else if (parameterType.equals( ZonedDateTime.class ))
+            {
+                return ZonedDateTime.parse( (String) value );
+            } else if (parameterType.equals( ZoneId.class ))
+            {
+                return ZoneId.of( (String) value );
+            } else if (parameterType.equals( ZoneOffset.class ))
+            {
+                return ZoneOffset.of( (String) value );
+            } else if (parameterType.equals( MonthDay.class ))
+            {
+                return MonthDay.parse( (String) value );
+            } else if (parameterType.equals( YearMonth.class ))
+            {
+                return YearMonth.parse( (String) value );
+            } else if (parameterType.equals( Year.class ))
+            {
+                return Year.parse( (String) value );
+            } else if (parameterType.equals( Instant.class ))
+            {
+                return Instant.parse( (String) value );
+            } else if (parameterType.equals( Duration.class ))
+            {
+                return Duration.parse( (String) value );
+            } else if (parameterType.equals( Period.class ))
             {
-                return dateFormat.parse( (String) value );
+                return Period.parse( (String) value );
             } else if (ValueComposite.class.isAssignableFrom( parameterType ))
             {
                 return module.newValueFromSerializedState( parameterType, (String) value );

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/helper/ApplicationEvents.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/helper/ApplicationEvents.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/helper/ApplicationEvents.java
index c79f130..c2d1d13 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/helper/ApplicationEvents.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/helper/ApplicationEvents.java
@@ -17,8 +17,8 @@
 package org.qi4j.library.eventsourcing.application.source.helper;
 
 import java.lang.reflect.Method;
+import java.time.ZonedDateTime;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.function.Function;
 import java.util.function.Predicate;
@@ -114,26 +114,26 @@ public class ApplicationEvents
         }, Iterables.toList( Methods.METHODS_OF.apply( eventClass ) ) ));
     }
 
-    public static Predicate<ApplicationEvent> afterDate( final Date afterDate )
+    public static Predicate<ApplicationEvent> afterDate( final ZonedDateTime afterDate )
     {
         return new Predicate<ApplicationEvent>()
         {
             @Override
             public boolean test( ApplicationEvent event )
             {
-                return event.on().get().after( afterDate );
+                return event.on().get().isAfter( afterDate );
             }
         };
     }
 
-    public static Predicate<ApplicationEvent> beforeDate( final Date beforeDate )
+    public static Predicate<ApplicationEvent> beforeDate( final ZonedDateTime beforeDate )
     {
         return new Predicate<ApplicationEvent>()
         {
             @Override
             public boolean test( ApplicationEvent event )
             {
-                return event.on().get().before( beforeDate );
+                return event.on().get().isBefore( beforeDate );
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java
index a587ac8..c81a8d1 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java
@@ -17,6 +17,8 @@
 
 package org.qi4j.library.eventsourcing.domain.api;
 
+import java.time.Instant;
+import java.time.ZonedDateTime;
 import java.util.List;
 import org.qi4j.api.common.Optional;
 import org.qi4j.api.common.UseDefaults;
@@ -41,7 +43,7 @@ public interface UnitOfWorkDomainEventsValue
     Property<String> usecase();
 
     // When the event occurred
-    Property<Long> timestamp();
+    Property<Instant> timestamp();
 
     // Who performed the event. Taken from CurrentUser service.
     @Optional

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java
index fda2a61..84ece96 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java
@@ -18,6 +18,7 @@
 package org.qi4j.library.eventsourcing.domain.factory;
 
 import java.io.IOException;
+import java.time.Instant;
 import org.qi4j.api.Qi4j;
 import org.qi4j.api.concern.ConcernOf;
 import org.qi4j.api.entity.EntityComposite;
@@ -111,7 +112,7 @@ public class UnitOfWorkNotificationConcern
 
                         ValueBuilder<UnitOfWorkDomainEventsValue> builder = vbf.newValueBuilder( UnitOfWorkDomainEventsValue.class );
                         builder.prototype().user().set( user );
-                        builder.prototype().timestamp().set( System.currentTimeMillis() );
+                        builder.prototype().timestamp().set( Instant.now() );
                         builder.prototype().usecase().set( unitOfWork.usecase().name() );
                         builder.prototype().version().set( version );
                         builder.prototype().events().get().addAll( events.getEventValues() );

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/replay/DomainEventPlayerService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/replay/DomainEventPlayerService.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/replay/DomainEventPlayerService.java
index c51cf5c..449beab 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/replay/DomainEventPlayerService.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/replay/DomainEventPlayerService.java
@@ -18,9 +18,20 @@
 package org.qi4j.library.eventsourcing.domain.replay;
 
 import java.lang.reflect.Method;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.MonthDay;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.Period;
+import java.time.Year;
+import java.time.YearMonth;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
 import org.json.JSONObject;
 import org.json.JSONTokener;
 import org.qi4j.api.entity.EntityComposite;
@@ -43,12 +54,12 @@ import org.slf4j.LoggerFactory;
 /**
  * DomainEventValue player
  */
-@Mixins(DomainEventPlayerService.Mixin.class)
+@Mixins( DomainEventPlayerService.Mixin.class )
 public interface DomainEventPlayerService
-        extends DomainEventPlayer, ServiceComposite
+    extends DomainEventPlayer, ServiceComposite
 {
     class Mixin
-            implements DomainEventPlayer
+        implements DomainEventPlayer
     {
         final Logger logger = LoggerFactory.getLogger( DomainEventPlayer.class );
 
@@ -61,17 +72,15 @@ public interface DomainEventPlayerService
         @Structure
         Qi4jSPI spi;
 
-        SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy" );
-
         @Override
         public void playTransaction( UnitOfWorkDomainEventsValue unitOfWorkDomainValue )
-                throws EventReplayException
+            throws EventReplayException
         {
             UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Event replay" ) );
             DomainEventValue currentEventValue = null;
             try
             {
-                for (DomainEventValue domainEventValue : unitOfWorkDomainValue.events().get())
+                for( DomainEventValue domainEventValue : unitOfWorkDomainValue.events().get() )
                 {
                     currentEventValue = domainEventValue;
                     // Get the entity
@@ -81,7 +90,8 @@ public interface DomainEventPlayerService
                     try
                     {
                         entity = uow.get( entityType, id );
-                    } catch( NoSuchEntityException e )
+                    }
+                    catch( NoSuchEntityException e )
                     {
                         // Event to play for an entity that doesn't yet exist - create a default instance
                         entity = uow.newEntity( entityType, id );
@@ -89,7 +99,7 @@ public interface DomainEventPlayerService
 
                     // check if the event has already occured
                     EntityState state = spi.entityStateOf( (EntityComposite) entity );
-                    if (state.lastModified() > unitOfWorkDomainValue.timestamp().get())
+                    if( state.lastModified().isAfter( unitOfWorkDomainValue.timestamp().get() ) )
                     {
                         break; // don't rerun event in this unitOfWorkDomainValue
                     }
@@ -97,19 +107,24 @@ public interface DomainEventPlayerService
                     playEvent( domainEventValue, entity );
                 }
                 uow.complete();
-            } catch (Exception e)
+            }
+            catch( Exception e )
             {
                 uow.discard();
-                if (e instanceof EventReplayException)
-                    throw ((EventReplayException) e);
+                if( e instanceof EventReplayException )
+                {
+                    throw ( (EventReplayException) e );
+                }
                 else
+                {
                     throw new EventReplayException( currentEventValue, e );
+                }
             }
         }
 
         @Override
         public void playEvent( DomainEventValue domainEventValue, Object object )
-                throws EventReplayException
+            throws EventReplayException
         {
             UnitOfWork uow = uowf.currentUnitOfWork();
             Class entityType = object.getClass();
@@ -117,9 +132,10 @@ public interface DomainEventPlayerService
             // Get method
             Method eventMethod = getEventMethod( entityType, domainEventValue.name().get() );
 
-            if (eventMethod == null)
+            if( eventMethod == null )
             {
-                logger.warn( "Could not find event method " + domainEventValue.name().get() + " in entity of type " + entityType.getName() );
+                logger.warn( "Could not find event method " + domainEventValue.name()
+                    .get() + " in entity of type " + entityType.getName() );
                 return;
             }
 
@@ -128,60 +144,123 @@ public interface DomainEventPlayerService
             {
                 String jsonParameters = domainEventValue.parameters().get();
                 JSONObject parameters = (JSONObject) new JSONTokener( jsonParameters ).nextValue();
-                Object[] args = new Object[eventMethod.getParameterTypes().length];
-                for (int i = 1; i < eventMethod.getParameterTypes().length; i++)
+                Object[] args = new Object[ eventMethod.getParameterTypes().length ];
+                for( int i = 1; i < eventMethod.getParameterTypes().length; i++ )
                 {
-                    Class<?> parameterType = eventMethod.getParameterTypes()[i];
+                    Class<?> parameterType = eventMethod.getParameterTypes()[ i ];
 
                     String paramName = "param" + i;
 
                     Object value = parameters.get( paramName );
 
-                    args[i] = getParameterArgument( parameterType, value, uow );
+                    args[ i ] = getParameterArgument( parameterType, value, uow );
                 }
 
-                args[0] = domainEventValue;
+                args[ 0 ] = domainEventValue;
 
                 // Invoke method
                 logger.debug( "Replay:" + domainEventValue + " on:" + object );
 
                 eventMethod.invoke( object, args );
-            } catch (Exception e)
+            }
+            catch( Exception e )
             {
                 throw new EventReplayException( domainEventValue, e );
             }
         }
 
-        private Object getParameterArgument( Class<?> parameterType, Object value, UnitOfWork uow ) throws ParseException
+        private Object getParameterArgument( Class<?> parameterType, Object value, UnitOfWork uow )
         {
-            if (value.equals( JSONObject.NULL ))
+            if( value.equals( JSONObject.NULL ) )
+            {
                 return null;
+            }
 
-            if (parameterType.equals( String.class ))
+            if( parameterType.equals( String.class ) )
             {
                 return (String) value;
-            } else if (parameterType.equals( Boolean.class ) || parameterType.equals( Boolean.TYPE ))
+            }
+            else if( parameterType.equals( Boolean.class ) || parameterType.equals( Boolean.TYPE ) )
             {
                 return (Boolean) value;
-            } else if (parameterType.equals( Long.class ) || parameterType.equals( Long.TYPE ))
+            }
+            else if( parameterType.equals( Long.class ) || parameterType.equals( Long.TYPE ) )
+            {
+                return ( (Number) value ).longValue();
+            }
+            else if( parameterType.equals( Integer.class ) || parameterType.equals( Integer.TYPE ) )
+            {
+                return ( (Number) value ).intValue();
+            }
+            else if( parameterType.equals( LocalDate.class ) )
+            {
+                return LocalDate.parse( (String) value );
+            }
+            else if( parameterType.equals( LocalDateTime.class ) )
+            {
+                return LocalDateTime.parse( (String) value );
+            }
+            else if( parameterType.equals( LocalTime.class ) )
+            {
+                return LocalTime.parse( (String) value );
+            }
+            else if( parameterType.equals( OffsetTime.class ) )
+            {
+                return OffsetTime.parse( (String) value );
+            }
+            else if( parameterType.equals( OffsetDateTime.class ) )
+            {
+                return OffsetDateTime.parse( (String) value );
+            }
+            else if( parameterType.equals( ZonedDateTime.class ) )
+            {
+                return ZonedDateTime.parse( (String) value );
+            }
+            else if( parameterType.equals( Instant.class ) )
+            {
+                return Instant.parse( (String) value );
+            }
+            else if( parameterType.equals( Period.class ) )
+            {
+                return Period.parse( (String) value );
+            }
+            else if( parameterType.equals( Duration.class ) )
             {
-                return ((Number) value).longValue();
-            } else if (parameterType.equals( Integer.class ) || parameterType.equals( Integer.TYPE ))
+                return Duration.parse( (String) value );
+            }
+            else if( parameterType.equals( MonthDay.class ) )
             {
-                return ((Number) value).intValue();
-            } else if (parameterType.equals( Date.class ))
+                return MonthDay.parse( (String) value );
+            }
+            else if( parameterType.equals( YearMonth.class ) )
             {
-                return dateFormat.parse( (String) value );
-            } else if (ValueComposite.class.isAssignableFrom( parameterType ))
+                return YearMonth.parse( (String) value );
+            }
+            else if( parameterType.equals( Year.class ) )
+            {
+                return Year.parse( (String) value );
+            }
+            else if( parameterType.equals( ZoneId.class ) )
+            {
+                return ZoneId.of( (String) value );
+            }
+            else if( parameterType.equals( ZoneOffset.class ) )
+            {
+                return ZoneOffset.of( (String) value );
+            }
+            else if( ValueComposite.class.isAssignableFrom( parameterType ) )
             {
                 return module.newValueFromSerializedState( parameterType, (String) value );
-            } else if (parameterType.isInterface())
+            }
+            else if( parameterType.isInterface() )
             {
                 return uow.get( parameterType, (String) value );
-            } else if (parameterType.isEnum())
+            }
+            else if( parameterType.isEnum() )
             {
                 return Enum.valueOf( (Class<? extends Enum>) parameterType, value.toString() );
-            } else
+            }
+            else
             {
                 throw new IllegalArgumentException( "Unknown parameter type:" + parameterType.getName() );
             }
@@ -189,13 +268,15 @@ public interface DomainEventPlayerService
 
         private Method getEventMethod( Class<?> aClass, String eventName )
         {
-            for (Method method : aClass.getMethods())
+            for( Method method : aClass.getMethods() )
             {
-                if (method.getName().equals( eventName ))
+                if( method.getName().equals( eventName ) )
                 {
                     Class[] parameterTypes = method.getParameterTypes();
-                    if (parameterTypes.length > 0 && parameterTypes[0].equals( DomainEventValue.class ))
+                    if( parameterTypes.length > 0 && parameterTypes[ 0 ].equals( DomainEventValue.class ) )
+                    {
                         return method;
+                    }
                 }
             }
             return null;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/source/helper/Events.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/source/helper/Events.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/source/helper/Events.java
index 3d1d1a0..f0dcd6f 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/source/helper/Events.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/domain/source/helper/Events.java
@@ -17,7 +17,7 @@
 package org.qi4j.library.eventsourcing.domain.source.helper;
 
 import java.lang.reflect.Method;
-import java.util.Date;
+import java.time.ZonedDateTime;
 import java.util.function.Function;
 import java.util.function.Predicate;
 import org.qi4j.api.util.Methods;
@@ -50,26 +50,26 @@ public class Events
     }
 
     // Common specifications
-    public static Predicate<UnitOfWorkDomainEventsValue> afterDate( final Date afterDate )
+    public static Predicate<UnitOfWorkDomainEventsValue> afterDate( final ZonedDateTime afterDate )
     {
         return new Predicate<UnitOfWorkDomainEventsValue>()
         {
             @Override
             public boolean test( UnitOfWorkDomainEventsValue eventValue )
             {
-                return eventValue.timestamp().get() > afterDate.getTime();
+                return eventValue.timestamp().get().isAfter( afterDate.toInstant() );
             }
         };
     }
 
-    public static Predicate<UnitOfWorkDomainEventsValue> beforeDate( final Date afterDate )
+    public static Predicate<UnitOfWorkDomainEventsValue> beforeDate( final ZonedDateTime beforeDate )
     {
         return new Predicate<UnitOfWorkDomainEventsValue>()
         {
             @Override
             public boolean test( UnitOfWorkDomainEventsValue eventValue )
             {
-                return eventValue.timestamp().get() < afterDate.getTime();
+                return eventValue.timestamp().get().isBefore( beforeDate.toInstant() );
             }
         };
     }
@@ -81,10 +81,12 @@ public class Events
             @Override
             public boolean test( UnitOfWorkDomainEventsValue eventValue )
             {
-                for (String name : names)
+                for( String name : names )
                 {
-                    if (eventValue.usecase().get().equals( name ))
+                    if( eventValue.usecase().get().equals( name ) )
+                    {
                         return true;
+                    }
                 }
                 return false;
             }
@@ -98,10 +100,12 @@ public class Events
             @Override
             public boolean test( UnitOfWorkDomainEventsValue eventValue )
             {
-                for (String user : by)
+                for( String user : by )
                 {
-                    if (eventValue.user().get().equals( user ))
+                    if( eventValue.user().get().equals( user ) )
+                    {
                         return true;
+                    }
                 }
                 return false;
             }
@@ -115,10 +119,12 @@ public class Events
             @Override
             public boolean test( DomainEventValue eventValue )
             {
-                for (String name : names)
+                for( String name : names )
                 {
-                    if (eventValue.name().get().equals( name ))
+                    if( eventValue.name().get().equals( name ) )
+                    {
                         return true;
+                    }
                 }
                 return false;
             }
@@ -132,10 +138,12 @@ public class Events
             @Override
             public boolean test( DomainEventValue eventValue )
             {
-                for (String name : names)
+                for( String name : names )
                 {
-                    if (eventValue.name().get().equals( name ))
+                    if( eventValue.name().get().equals( name ) )
+                    {
                         return true;
+                    }
                 }
                 return false;
             }
@@ -151,7 +159,7 @@ public class Events
             {
                 return method.getName();
             }
-        }, Iterables.toList( Methods.METHODS_OF.apply( eventClass ) ) ));
+        }, Iterables.toList( Methods.METHODS_OF.apply( eventClass ) ) ) );
     }
 
     public static Predicate<DomainEventValue> onEntities( final String... entities )
@@ -161,10 +169,12 @@ public class Events
             @Override
             public boolean test( DomainEventValue eventValue )
             {
-                for (String entity : entities)
+                for( String entity : entities )
                 {
-                    if (eventValue.entityId().get().equals( entity ))
+                    if( eventValue.entityId().get().equals( entity ) )
+                    {
                         return true;
+                    }
                 }
                 return false;
             }
@@ -178,10 +188,12 @@ public class Events
             @Override
             public boolean test( DomainEventValue eventValue )
             {
-                for (String entityType : entityTypes)
+                for( String entityType : entityTypes )
                 {
-                    if (eventValue.entityType().get().equals( entityType ))
+                    if( eventValue.entityType().get().equals( entityType ) )
+                    {
                         return true;
+                    }
                 }
                 return false;
             }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventRouterTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventRouterTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventRouterTest.java
index 76921fd..08c733f 100644
--- a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventRouterTest.java
+++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventRouterTest.java
@@ -16,6 +16,7 @@
 package org.qi4j.library.eventsourcing.domain.source.helper;
 
 import java.io.IOException;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.List;
 import org.json.JSONException;
@@ -59,7 +60,7 @@ public class EventRouterTest
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test2" ) );
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test3" ) );
             builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( System.currentTimeMillis() );
+            builder.prototype().timestamp().set( Instant.now() );
             builder.prototype().usecase().set( "Test" );
             list.add( builder.newInstance() );
         }
@@ -69,7 +70,7 @@ public class EventRouterTest
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test5" ) );
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test6" ) );
             builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( System.currentTimeMillis() );
+            builder.prototype().timestamp().set( Instant.now() );
             builder.prototype().usecase().set( "Test2" );
             list.add( builder.newInstance() );
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventsTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventsTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventsTest.java
index 12ce6ac..3d81e40 100644
--- a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventsTest.java
+++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/EventsTest.java
@@ -1,5 +1,6 @@
 package org.qi4j.library.eventsourcing.domain.source.helper;
 
+import java.time.Instant;
 import org.junit.Before;
 import org.junit.Test;
 import org.qi4j.api.activation.ActivationException;
@@ -47,7 +48,7 @@ public class EventsTest
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test2" ) );
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test3" ) );
             builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( System.currentTimeMillis() );
+            builder.prototype().timestamp().set( Instant.now() );
             builder.prototype().usecase().set( "Test" );
             list.add( builder.newInstance() );
         }
@@ -57,7 +58,7 @@ public class EventsTest
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test5" ) );
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test6" ) );
             builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( System.currentTimeMillis() );
+            builder.prototype().timestamp().set( Instant.now() );
             builder.prototype().usecase().set( "Test2" );
             list.add( builder.newInstance() );
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java
index f3286ff..89d7333 100644
--- a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java
+++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java
@@ -1,5 +1,6 @@
 package org.qi4j.library.eventsourcing.domain.source.helper;
 
+import java.time.Instant;
 import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 import org.junit.Before;
@@ -45,7 +46,7 @@ public class UnitOfWorkRouterTest
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test2" ));
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test3" ));
             builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( System.currentTimeMillis() );
+            builder.prototype().timestamp().set( Instant.now() );
             builder.prototype().usecase().set( "Test" );
             list.add( builder.newInstance() );
         }
@@ -55,7 +56,7 @@ public class UnitOfWorkRouterTest
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test5" ));
             builder.prototype().events().get().add( newDomainEvent( assembler, "Test6" ));
             builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( System.currentTimeMillis() );
+            builder.prototype().timestamp().set( Instant.now() );
             builder.prototype().usecase().set( "Test2" );
             list.add( builder.newInstance() );
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/rdf/src/main/java/org/qi4j/library/rdf/entity/EntityTypeSerializer.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/qi4j/library/rdf/entity/EntityTypeSerializer.java b/libraries/rdf/src/main/java/org/qi4j/library/rdf/entity/EntityTypeSerializer.java
index a7c8aca..8934296 100644
--- a/libraries/rdf/src/main/java/org/qi4j/library/rdf/entity/EntityTypeSerializer.java
+++ b/libraries/rdf/src/main/java/org/qi4j/library/rdf/entity/EntityTypeSerializer.java
@@ -18,12 +18,14 @@
 package org.qi4j.library.rdf.entity;
 
 import java.math.BigDecimal;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.ZonedDateTime;
 import java.util.HashMap;
 import java.util.Map;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
-import org.joda.time.LocalDateTime;
 import org.openrdf.model.Graph;
 import org.openrdf.model.Statement;
 import org.openrdf.model.URI;
@@ -59,10 +61,14 @@ public class EntityTypeSerializer
         dataTypes.put( Double.class.getName(), XMLSchema.DOUBLE );
         dataTypes.put( Long.class.getName(), XMLSchema.LONG );
         dataTypes.put( Short.class.getName(), XMLSchema.SHORT );
-        dataTypes.put( Date.class.getName(), XMLSchema.DATETIME );
-        dataTypes.put( DateTime.class.getName(), XMLSchema.DATETIME );
+//        dataTypes.put( Date.class.getName(), XMLSchema.DATETIME );
+
+        dataTypes.put( ZonedDateTime.class.getName(), XMLSchema.DATETIME );
+        dataTypes.put( OffsetDateTime.class.getName(), XMLSchema.DATETIME );
+        dataTypes.put( OffsetTime.class.getName(), XMLSchema.TIME );
         dataTypes.put( LocalDateTime.class.getName(), XMLSchema.DATETIME );
         dataTypes.put( LocalDate.class.getName(), XMLSchema.DATE );
+        dataTypes.put( LocalTime.class.getName(), XMLSchema.TIME );
     }
 
     public Iterable<Statement> serialize( final EntityDescriptor entityDescriptor )

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/rdf/src/test/java/org/qi4j/library/rdf/entity/EntitySerializerTest.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/qi4j/library/rdf/entity/EntitySerializerTest.java b/libraries/rdf/src/test/java/org/qi4j/library/rdf/entity/EntitySerializerTest.java
index d41466d..c60762e 100644
--- a/libraries/rdf/src/test/java/org/qi4j/library/rdf/entity/EntitySerializerTest.java
+++ b/libraries/rdf/src/test/java/org/qi4j/library/rdf/entity/EntitySerializerTest.java
@@ -15,6 +15,7 @@
 package org.qi4j.library.rdf.entity;
 
 import java.io.PrintWriter;
+import java.time.Instant;
 import org.junit.Before;
 import org.junit.Test;
 import org.openrdf.model.Statement;
@@ -72,7 +73,7 @@ public class EntitySerializerTest
     public void testEntitySerializer() throws RDFHandlerException
     {
         EntityReference entityReference = new EntityReference( "test2" );
-        EntityState entityState = entityStore.newUnitOfWork( UsecaseBuilder.newUsecase( "Test" ), module, System.currentTimeMillis() ).entityStateOf( entityReference );
+        EntityState entityState = entityStore.newUnitOfWork( UsecaseBuilder.newUsecase( "Test" ), module, Instant.now() ).entityStateOf( entityReference );
 
         Iterable<Statement> graph = serializer.serialize( entityState );
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/ClientCache.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/ClientCache.java b/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/ClientCache.java
index ce3dc89..c52b5ba 100644
--- a/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/ClientCache.java
+++ b/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/ClientCache.java
@@ -17,6 +17,7 @@
 
 package org.qi4j.library.rest.client;
 
+import java.time.Instant;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -32,118 +33,127 @@ import org.restlet.data.Tag;
  */
 public class ClientCache
 {
-   Map<String, CacheInfo> identityToTimestamp = new HashMap<String, CacheInfo>( );
-   Map<String, String> pathToIdentity = new HashMap<String, String>( );
-
-   public void updateCache( Response response)
-   {
-      if (response.getRequest().getMethod().equals( Method.DELETE ))
-      {
-         String path = getIdentityPath( response.getRequest().getResourceRef() );
-         String id = pathToIdentity.get( path );
-         if (id != null)
-         {
-            // Clear anything related to this id from cache
-            identityToTimestamp.remove( id );
-            Iterator<Map.Entry<String, String>> paths = pathToIdentity.entrySet().iterator();
-            while (paths.hasNext())
+    Map<String, CacheInfo> identityToTimestamp = new HashMap<String, CacheInfo>();
+    Map<String, String> pathToIdentity = new HashMap<String, String>();
+
+    public void updateCache( Response response )
+    {
+        if( response.getRequest().getMethod().equals( Method.DELETE ) )
+        {
+            String path = getIdentityPath( response.getRequest().getResourceRef() );
+            String id = pathToIdentity.get( path );
+            if( id != null )
             {
-               Map.Entry<String, String> entry = paths.next();
-               if (entry.getValue().equals( id ))
-                  paths.remove();
+                // Clear anything related to this id from cache
+                identityToTimestamp.remove( id );
+                Iterator<Map.Entry<String, String>> paths = pathToIdentity.entrySet().iterator();
+                while( paths.hasNext() )
+                {
+                    Map.Entry<String, String> entry = paths.next();
+                    if( entry.getValue().equals( id ) )
+                    {
+                        paths.remove();
+                    }
+                }
             }
-         }
-      } else if (response.getRequest().getMethod().equals( Method.PUT ) || response.getRequest().getMethod().equals( Method.POST ))
-      {
-         Tag tag = response.getEntity().getTag();
-         if (tag != null)
-         {
-            Reference ref = response.getRequest().getResourceRef().clone();
+        }
+        else if( response.getRequest().getMethod().equals( Method.PUT ) || response.getRequest()
+            .getMethod()
+            .equals( Method.POST ) )
+        {
+            Tag tag = response.getEntity().getTag();
+            if( tag != null )
+            {
+                Reference ref = response.getRequest().getResourceRef().clone();
 
-            CacheInfo value = new CacheInfo( response.getEntity().getModificationDate(), tag, ref );
-            identityToTimestamp.put( value.getEntity(), value );
+                Date modificationDate = response.getEntity().getModificationDate();
+                CacheInfo value = new CacheInfo( Instant.ofEpochMilli( modificationDate.getTime() ), tag, ref );
+                identityToTimestamp.put( value.getEntity(), value );
 
-            String path = getIdentityPath( ref );
+                String path = getIdentityPath( ref );
 
-            pathToIdentity.put( path, value.getEntity() );
+                pathToIdentity.put( path, value.getEntity() );
 
 //            LoggerFactory.getLogger( ClientCache.class ).info( "Update:"+value.getEntity()+" ("+ref.toString()+") -> "+value.getLastModified() );
-         }
-      } else
-      {
-          // TODO GET caching goes here
-      }
-   }
-
-   public void updateQueryConditions( Request request)
-   {
-      String identity = pathToIdentity.get( getIdentityPath( request.getResourceRef() ));
-      if (identity != null)
-      {
-         CacheInfo cacheInfo = identityToTimestamp.get( identity );
-         if (cacheInfo != null)
-         {
+            }
+        }
+        else
+        {
+            // TODO GET caching goes here
+        }
+    }
+
+    public void updateQueryConditions( Request request )
+    {
+        String identity = pathToIdentity.get( getIdentityPath( request.getResourceRef() ) );
+        if( identity != null )
+        {
+            CacheInfo cacheInfo = identityToTimestamp.get( identity );
+            if( cacheInfo != null )
+            {
 //            LoggerFactory.getLogger( ClientCache.class ).info( "Send:  "+cacheInfo.getEntity()+" ("+request.getMethod().getName()+":"+request.getResourceRef()+") -> "+cacheInfo.getLastModified() );
-            request.getConditions().setModifiedSince( cacheInfo.getLastModified() );
-         }
-      }
-   }
-
-   public void updateCommandConditions( Request request)
-   {
-      String identity = pathToIdentity.get( getIdentityPath( request.getResourceRef() ));
-      if (identity != null)
-      {
-         CacheInfo cacheInfo = identityToTimestamp.get( identity );
-         if (cacheInfo != null)
-         {
+                request.getConditions().setModifiedSince( new Date( cacheInfo.getLastModified().toEpochMilli() ) );
+            }
+        }
+    }
+
+    public void updateCommandConditions( Request request )
+    {
+        String identity = pathToIdentity.get( getIdentityPath( request.getResourceRef() ) );
+        if( identity != null )
+        {
+            CacheInfo cacheInfo = identityToTimestamp.get( identity );
+            if( cacheInfo != null )
+            {
 //            LoggerFactory.getLogger( ClientCache.class ).info( "Send:  "+cacheInfo.getEntity()+" ("+request.getMethod().getName()+":"+request.getResourceRef()+") -> "+cacheInfo.getLastModified() );
-            request.getConditions().setUnmodifiedSince( cacheInfo.getLastModified() );
-         }
-      }
-   }
-
-   private String getIdentityPath( Reference ref )
-   {
-      String path = ref.getPath();
-      if (!path.endsWith( "/" ))
-         path = path.substring( 0, path.lastIndexOf('/' )+1);
-      return path;
-   }
-
-   static class CacheInfo
-   {
-      private Reference ref;
-      private Date lastModified;
-      private Tag tag;
-      private String entity;
-
-      CacheInfo( Date lastModified, Tag tag, Reference ref )
-      {
-         this.lastModified = lastModified;
-         this.tag = tag;
-         this.ref = ref;
-         entity = tag.getName().split( "/" )[0];
-      }
-
-      public Reference getRef()
-      {
-         return ref;
-      }
-
-      public Date getLastModified()
-      {
-         return lastModified;
-      }
-
-      public Tag getTag()
-      {
-         return tag;
-      }
-
-      public String getEntity()
-      {
-         return entity;
-      }
-   }
+                request.getConditions().setUnmodifiedSince( new Date( cacheInfo.getLastModified().toEpochMilli() ) );
+            }
+        }
+    }
+
+    private String getIdentityPath( Reference ref )
+    {
+        String path = ref.getPath();
+        if( !path.endsWith( "/" ) )
+        {
+            path = path.substring( 0, path.lastIndexOf( '/' ) + 1 );
+        }
+        return path;
+    }
+
+    static class CacheInfo
+    {
+        private Reference ref;
+        private Instant lastModified;
+        private Tag tag;
+        private String entity;
+
+        CacheInfo( Instant lastModified, Tag tag, Reference ref )
+        {
+            this.lastModified = lastModified;
+            this.tag = tag;
+            this.ref = ref;
+            entity = tag.getName().split( "/" )[ 0 ];
+        }
+
+        public Reference getRef()
+        {
+            return ref;
+        }
+
+        public Instant getLastModified()
+        {
+            return lastModified;
+        }
+
+        public Tag getTag()
+        {
+            return tag;
+        }
+
+        public String getEntity()
+        {
+            return entity;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/responsereader/TableResponseReader.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/responsereader/TableResponseReader.java b/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/responsereader/TableResponseReader.java
index 21e13ef..6e00f8b 100644
--- a/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/responsereader/TableResponseReader.java
+++ b/libraries/rest-client/src/main/java/org/qi4j/library/rest/client/responsereader/TableResponseReader.java
@@ -17,14 +17,14 @@
 
 package org.qi4j.library.rest.client.responsereader;
 
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.ZonedDateTime;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.structure.Module;
-import org.qi4j.api.util.Dates;
 import org.qi4j.library.rest.client.spi.ResponseReader;
 import org.qi4j.library.rest.common.table.Table;
 import org.qi4j.library.rest.common.table.TableBuilder;
@@ -37,74 +37,86 @@ import org.restlet.resource.ResourceException;
  * JAVADOC
  */
 public class TableResponseReader
-   implements ResponseReader
+    implements ResponseReader
 {
-   @Structure
-   Module module;
+    @Structure
+    Module module;
 
     @Override
-   public Object readResponse( Response response, Class<?> resultType ) throws ResourceException
-   {
-      if (response.getEntity().getMediaType().equals( MediaType.APPLICATION_JSON) && Table.class.isAssignableFrom( resultType ))
-      {
-         String jsonValue = response.getEntityAsText();
-         try
-         {
-            JSONObject jsonObject = new JSONObject(jsonValue);
+    public Object readResponse( Response response, Class<?> resultType )
+        throws ResourceException
+    {
+        if( response.getEntity()
+                .getMediaType()
+                .equals( MediaType.APPLICATION_JSON ) && Table.class.isAssignableFrom( resultType ) )
+        {
+            String jsonValue = response.getEntityAsText();
+            try
+            {
+                JSONObject jsonObject = new JSONObject( jsonValue );
 
-            JSONObject table = jsonObject.getJSONObject( "table" );
-            TableBuilder builder = new TableBuilder(module);
+                JSONObject table = jsonObject.getJSONObject( "table" );
+                TableBuilder builder = new TableBuilder( module );
 
-            JSONArray cols = table.getJSONArray( "cols" );
-            for (int i = 0; i < cols.length(); i++)
-            {
-               JSONObject col = cols.getJSONObject( i );
-               builder.column( col.optString( "id" ),  col.getString( "label" ), col.getString( "type" ));
-            }
+                JSONArray cols = table.getJSONArray( "cols" );
+                for( int i = 0; i < cols.length(); i++ )
+                {
+                    JSONObject col = cols.getJSONObject( i );
+                    builder.column( col.optString( "id" ), col.getString( "label" ), col.getString( "type" ) );
+                }
 
-            JSONArray rows = table.getJSONArray( "rows" );
-            for (int i = 0; i < rows.length(); i++)
-            {
-               builder.row();
-               JSONObject row = rows.getJSONObject( i );
-               JSONArray cells = row.getJSONArray( "c" );
-               for (int j = 0; j < cells.length(); j++)
-               {
-                  JSONObject cell = cells.getJSONObject( j );
-                  Object value = cell.opt( "v" );
-                  String formatted = cell.optString("f");
+                JSONArray rows = table.getJSONArray( "rows" );
+                for( int i = 0; i < rows.length(); i++ )
+                {
+                    builder.row();
+                    JSONObject row = rows.getJSONObject( i );
+                    JSONArray cells = row.getJSONArray( "c" );
+                    for( int j = 0; j < cells.length(); j++ )
+                    {
+                        JSONObject cell = cells.getJSONObject( j );
+                        Object value = cell.opt( "v" );
+                        String formatted = cell.optString( "f" );
 
-                  if (cols.getJSONObject( j ).getString( "type" ).equals("datetime") && value != null)
-                     value = Dates.fromString( value.toString() );
-                  else if (cols.getJSONObject( j ).getString( "type" ).equals("date") && value != null)
-                     try
-                     {
-                        value = new SimpleDateFormat( "yyyy-MM-dd").parse( value.toString() );
-                     } catch (ParseException e)
-                     {
-                        throw new ResourceException(e);
-                     }
-                  else if (cols.getJSONObject( j ).getString( "type" ).equals("timeofday") && value != null)
-                     try
-                     {
-                        value = new SimpleDateFormat( "HH:mm:ss").parse( value.toString() );
-                     } catch (ParseException e)
-                     {
-                        throw new ResourceException(e);
-                     }
+                        if( cols.getJSONObject( j ).getString( "type" ).equals( "datetime" ) && value != null )
+                        {
+                            value = ZonedDateTime.parse( value.toString() );
+                        }
+                        else if( cols.getJSONObject( j ).getString( "type" ).equals( "date" ) && value != null )
+                        {
+                            try
+                            {
+                                value = LocalDate.parse( value.toString() );
+                            }
+                            catch( RuntimeException e )
+                            {
+                                throw new ResourceException( e );
+                            }
+                        }
+                        else if( cols.getJSONObject( j ).getString( "type" ).equals( "timeofday" ) && value != null )
+                        {
+                            try
+                            {
+                                value = LocalTime.parse( value.toString() );
+                            }
+                            catch( RuntimeException e )
+                            {
+                                throw new ResourceException( e );
+                            }
+                        }
 
-                  builder.cell( value, formatted );
-               }
-               builder.endRow();
-            }
+                        builder.cell( value, formatted );
+                    }
+                    builder.endRow();
+                }
 
-            return builder.newTable();
-         } catch (JSONException e)
-         {
-            throw new ResourceException( Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY, e);
-         }
-      }
+                return builder.newTable();
+            }
+            catch( JSONException e )
+            {
+                throw new ResourceException( Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY, e );
+            }
+        }
 
-      return null;
-   }
+        return null;
+    }
 }