Adapt to change in Argeo Commons
[gpl/argeo-slc.git] / swt / rcp / org.argeo.cms.e4.rcp / src / org / argeo / cms / e4 / rcp / CmsE4Application.java
index 3861597aad00baa1b232366cc923d22e9fb45a60..d148b66c63d422a2551ac56a6040a2d78364bdaa 100644 (file)
@@ -1,6 +1,9 @@
 package org.argeo.cms.e4.rcp;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.security.PrivilegedExceptionAction;
+import java.util.TimerTask;
 import java.util.UUID;
 import java.util.concurrent.Callable;
 
@@ -29,6 +32,8 @@ public class CmsE4Application implements IApplication, CmsView {
        private UxContext uxContext;
        private String uid;
 
+       private String httpServerBase;
+
        @Override
        public Object start(IApplicationContext context) throws Exception {
                // TODO wait for CMS to be ready
@@ -209,4 +214,32 @@ public class CmsE4Application implements IApplication, CmsView {
                throw new UnsupportedOperationException();
        }
 
+       @Override
+       public TimerTask schedule(Runnable task, long delay) {
+               throw new UnsupportedOperationException();
+       }
+
+       @Override
+       public TimerTask schedule(Runnable task, long delay, long period) {
+               throw new UnsupportedOperationException();
+       }
+
+       @Override
+       public URI toBackendUri(String url) {
+               try {
+                       URI u = new URI(url);
+                       if (u.getHost() == null) {
+                               // TODO make it more robust
+                               u = new URI(httpServerBase + url);
+                       }
+                       return u;
+               } catch (URISyntaxException e) {
+                       throw new IllegalArgumentException("Cannot convert " + url, e);
+               }
+       }
+
+       public void setHttpServerBase(String httpServerBase) {
+               this.httpServerBase = httpServerBase;
+       }
+
 }