You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/03/06 11:30:12 UTC

[4/4] git commit: ISIS-730: make ClockService concrete.

ISIS-730: make ClockService concrete.

and extend in line with underlying Clock singleton.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d97d9c2d
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d97d9c2d
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d97d9c2d

Branch: refs/heads/master
Commit: d97d9c2d560ff1ed57f07fc7ae74ac2d1a3ec77f
Parents: fe7aa5b
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Mar 6 10:29:51 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Mar 6 10:29:51 2014 +0000

----------------------------------------------------------------------
 .../applib/services/clock/ClockService.java     | 31 ++++++++++++++++--
 .../services/clock/ClockServiceDefault.java     | 33 --------------------
 .../src/main/webapp/WEB-INF/isis.properties     |  3 +-
 .../src/main/webapp/WEB-INF/isis.properties     |  2 +-
 4 files changed, 31 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/d97d9c2d/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockService.java b/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockService.java
index 6284f70..b2c8621 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockService.java
@@ -16,15 +16,42 @@
  */
 package org.apache.isis.applib.services.clock;
 
+import java.sql.Timestamp;
+
+import org.joda.time.DateTime;
 import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
 
 import org.apache.isis.applib.annotation.Hidden;
 import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.clock.Clock;
 
 @Hidden
-public interface ClockService {
+public class ClockService {
     
     @Programmatic
-    public LocalDate now();
+    public LocalDate now() {
+        return Clock.getTimeAsLocalDate();
+    }
+
+    @Programmatic
+    public LocalDateTime nowAsLocalDateTime() {
+        return Clock.getTimeAsLocalDateTime();
+    }
+
+    @Programmatic
+    public DateTime nowAsDateTime() {
+        return Clock.getTimeAsDateTime();
+    }
+
+    @Programmatic
+    public Timestamp nowAsJavaSqlTimestamp() {
+        return Clock.getTimeAsJavaSqlTimestamp();
+    }
+
+    @Programmatic
+    public long nowAsMillis() {
+        return Clock.getTime();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/d97d9c2d/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockServiceDefault.java b/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockServiceDefault.java
deleted file mode 100644
index 291cb34..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/services/clock/ClockServiceDefault.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.isis.applib.services.clock;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.clock.Clock;
-
-@Hidden
-public class ClockServiceDefault implements ClockService {
-    
-    @Programmatic
-    public LocalDate now() {
-        return Clock.getTimeAsLocalDate();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/d97d9c2d/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
index 55f64c8..835a459 100644
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
+++ b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
@@ -171,7 +171,6 @@ isis.services = \
                 app.ToDoItemAnalysisContributions,\
                 dom.todo.ToDoItemContributions,\
                 \
-                \
                 # supporting services if using JDO objectstore, \
                 org.apache.isis.objectstore.jdo.applib.service.exceprecog.ExceptionRecognizerCompositeForJdoObjectStore,\
                 org.apache.isis.objectstore.jdo.datanucleus.service.support.IsisJdoSupportImpl,\
@@ -182,7 +181,7 @@ isis.services = \
                 org.apache.isis.core.runtime.services.xmlsnapshot.XmlSnapshotServiceDefault,\
                 \
                 # Core implementation of a clock service, \
-                org.apache.isis.applib.services.clock.ClockServiceDefault,\
+                org.apache.isis.applib.services.clock.ClockService,\
                 \
                 # Core implementation of the various (inter)action services, \
                 org.apache.isis.applib.services.command.CommandContext,\

http://git-wip-us.apache.org/repos/asf/isis/blob/d97d9c2d/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
index 0b1c849..fe7e8e6 100644
--- a/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
+++ b/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
@@ -173,7 +173,7 @@ isis.services = \
                 org.apache.isis.core.runtime.services.xmlsnapshot.XmlSnapshotServiceDefault,\
                 \
                 # Core implementation of a clock service, \
-                org.apache.isis.applib.services.clock.ClockServiceDefault,\
+                org.apache.isis.applib.services.clock.ClockService,\
                 \
                 # Core implementation of the various (inter)action services, \
                 org.apache.isis.applib.services.command.CommandContext,\