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 2013/05/17 15:01:39 UTC

git commit: ISIS-406: getting ready for release...

Updated Branches:
  refs/heads/master 1e7d09194 -> 175cd5cbc


ISIS-406: getting ready for release...

.. some tiny fixes to be able to support GAE (the DHTMLX viewer)


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

Branch: refs/heads/master
Commit: 175cd5cbc38887ebb44a40d4be110759a9573e47
Parents: 1e7d091
Author: Dan Haywood <da...@apache.org>
Authored: Fri May 17 14:01:23 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Fri May 17 14:01:23 2013 +0100

----------------------------------------------------------------------
 .../runtime/installers/InstallerLookupDefault.java |   24 +++++++++-----
 .../isis/core/runtime/system/SystemConstants.java  |    5 ++-
 .../core/runtime/installer-registry.properties     |    1 +
 3 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/175cd5cb/core/runtime/src/main/java/org/apache/isis/core/runtime/installers/InstallerLookupDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installers/InstallerLookupDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installers/InstallerLookupDefault.java
index 7591670..ca35c3a 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installers/InstallerLookupDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/installers/InstallerLookupDefault.java
@@ -23,6 +23,7 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.nullValue;
 
+import java.awt.Canvas;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -200,19 +201,24 @@ public class InstallerLookupDefault implements InstallerLookup {
 
     @Override
     public TemplateImageLoaderInstaller templateImageLoaderInstaller(final String requested) {
-        final boolean onGae = onGae(); 
-        return getInstaller(TemplateImageLoaderInstaller.class, requested, SystemConstants.IMAGE_LOADER_KEY, !onGae?SystemConstants.IMAGE_LOADER_DEFAULT:SystemConstants.IMAGE_LOADER_GAE);
-    }
-
-    private static boolean onGae() {
         try {
-            final Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass("com.google.appengine.api.utils.SystemProperty");
-            return cls != null;
-        } catch(Exception ex) {
-            return false;
+            if(requested == null) {
+                // fail early if the default (which uses AWT) cannot be used.
+                // this is a workaround to force the fallback of Noop; ie for Google App Engine.
+                @SuppressWarnings("unused")
+                Canvas canvas = new java.awt.Canvas();
+            }
+            return templateImageLoaderInstaller(requested, SystemConstants.IMAGE_LOADER_DEFAULT);
+        } catch (NoClassDefFoundError e) {
+            // to support running on Google App Engine
+            return templateImageLoaderInstaller(requested, SystemConstants.IMAGE_LOADER_NOOP);
         }
     }
 
+    private TemplateImageLoaderInstaller templateImageLoaderInstaller(final String requested, final String fallback) {
+        return getInstaller(TemplateImageLoaderInstaller.class, requested, SystemConstants.IMAGE_LOADER_KEY, fallback);
+    }
+
     @Override
     public PersistenceMechanismInstaller persistenceMechanismInstaller(final String requested, final DeploymentType deploymentType) {
         final String persistorDefault = deploymentType.isExploring() || deploymentType.isPrototyping() ? SystemConstants.OBJECT_PERSISTOR_NON_PRODUCTION_DEFAULT : SystemConstants.OBJECT_PERSISTOR_PRODUCTION_DEFAULT;

http://git-wip-us.apache.org/repos/asf/isis/blob/175cd5cb/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java
index 792aa2c..c42de2c 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java
@@ -32,6 +32,7 @@ import org.apache.isis.core.runtime.imageloader.TemplateImageLoaderInstaller;
 import org.apache.isis.core.runtime.installerregistry.installerapi.EmbeddedWebServerInstaller;
 import org.apache.isis.core.runtime.installerregistry.installerapi.IsisViewerInstaller;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.core.runtime.installers.InstallerLookupDefault;
 import org.apache.isis.core.runtime.services.ServicesInstaller;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.userprofile.UserProfileStore;
@@ -169,9 +170,9 @@ public final class SystemConstants {
      */
     public static final String IMAGE_LOADER_DEFAULT = "awt";
     /**
-     * Default if running on Google App Engine.
+     * Default if running on Google App Engine, see {@link InstallerLookupDefault#templateImageLoaderInstaller(String)}
      */
-    public static final String IMAGE_LOADER_GAE = "gae";
+    public static final String IMAGE_LOADER_NOOP = "noop";
 
 
     /**

http://git-wip-us.apache.org/repos/asf/isis/blob/175cd5cb/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties b/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
index 44491fe..ce260c7 100644
--- a/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
+++ b/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
@@ -66,6 +66,7 @@ org.apache.isis.core.runtime.progmodels.JavaReflectorInstaller   # "java"
 
 # image loader
 org.apache.isis.core.runtime.imageloader.awt.TemplateImageLoaderAwtInstaller # "awt"
+org.apache.isis.core.runtime.imageloader.noop.TemplateImageLoaderNoopInstaller # "noop"
 
 # fixture loaders
 org.apache.isis.core.runtime.fixtures.FixturesInstallerFromConfiguration  "configuration"