← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 332: Changed some interceptors from extending AroundInterceptor to implement Interceptor

 

------------------------------------------------------------
revno: 332
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-05-26 13:17:27 +0200
message:
  Changed some interceptors from extending AroundInterceptor to implement Interceptor
modified:
  dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkDataDictionaryModeInterceptor.java
  dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkI18nInterceptor.java
  dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkStyleInterceptor.java
  dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkSystemSettingInterceptor.java

=== modified file 'dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkDataDictionaryModeInterceptor.java'
--- dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkDataDictionaryModeInterceptor.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkDataDictionaryModeInterceptor.java	2009-05-26 11:17:27 +0000
@@ -1,5 +1,32 @@
 package org.hisp.dhis.webwork.interceptor;
 
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -10,10 +37,14 @@
 
 import com.opensymphony.xwork.Action;
 import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.interceptor.AroundInterceptor;
+import com.opensymphony.xwork.interceptor.Interceptor;
 
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
 public class WebWorkDataDictionaryModeInterceptor
-    extends AroundInterceptor
+    implements Interceptor
 {
     private static final String KEY_DATA_DICTIONARY_MODE = "dataDictionaryMode";
     
@@ -32,7 +63,19 @@
     // AroundInterceptor implementation
     // -------------------------------------------------------------------------
 
-    protected void before( ActionInvocation invocation )
+    public void destroy()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void init()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String intercept( ActionInvocation invocation )
         throws Exception
     {
         Action action = (Action) invocation.getAction();
@@ -62,11 +105,7 @@
         catch ( NoSuchPropertyException e )
         {
         }
-    }
-    
-    protected void after( ActionInvocation invocation, String result )
-        throws Exception
-    {
-        // Not in use
+        
+        return invocation.invoke();
     }   
 }

=== modified file 'dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkI18nInterceptor.java'
--- dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkI18nInterceptor.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkI18nInterceptor.java	2009-05-26 11:17:27 +0000
@@ -39,14 +39,14 @@
 
 import com.opensymphony.xwork.Action;
 import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.interceptor.AroundInterceptor;
+import com.opensymphony.xwork.interceptor.Interceptor;
 
 /**
  * @author Nguyen Dang Quang
  * @version $Id: WebWorkI18nInterceptor.java 6335 2008-11-20 11:11:26Z larshelg $
  */
 public class WebWorkI18nInterceptor
-    extends AroundInterceptor
+    implements Interceptor
 {
     private static final String KEY_I18N = "i18n";
 
@@ -67,12 +67,19 @@
     // AroundInterceptor implementation
     // -------------------------------------------------------------------------
 
-    protected void after( ActionInvocation invocation, String result )
-        throws Exception
-    {
-    }
-
-    protected void before( ActionInvocation invocation )
+    public void destroy()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void init()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String intercept( ActionInvocation invocation )
         throws Exception
     {
         Action action = (Action) invocation.getAction();
@@ -111,5 +118,7 @@
         catch ( NoSuchPropertyException e )
         {
         }
+        
+        return invocation.invoke();
     }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkStyleInterceptor.java'
--- dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkStyleInterceptor.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkStyleInterceptor.java	2009-05-26 11:17:27 +0000
@@ -33,14 +33,14 @@
 import org.hisp.dhis.options.style.StyleManager;
 
 import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.interceptor.AroundInterceptor;
+import com.opensymphony.xwork.interceptor.Interceptor;
 
 /**
  * @author Lars Helge Overland
  * @version $Id$
  */
 public class WebWorkStyleInterceptor
-    extends AroundInterceptor
+    implements Interceptor
 {
     private static final String KEY_STYLE = "stylesheet";
     private static final String KEY_STYLE_DIRECTORY = "stylesheetDirectory";
@@ -61,7 +61,19 @@
     // AroundInterceptor implementation
     // -------------------------------------------------------------------------
 
-    protected void before( ActionInvocation invocation )
+    public void destroy()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void init()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String intercept( ActionInvocation invocation )
         throws Exception
     {
         Map<String, Object> map = new HashMap<String, Object>( 2 );
@@ -73,11 +85,7 @@
         map.put( KEY_STYLE_DIRECTORY, styleDirectory );
         
         invocation.getStack().push( map );
-    }
-    
-    protected void after( ActionInvocation invocation, String result )
-        throws Exception
-    {
-
+        
+        return invocation.invoke();        
     }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkSystemSettingInterceptor.java'
--- dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkSystemSettingInterceptor.java	2009-03-14 07:19:36 +0000
+++ dhis-2/dhis-support/dhis-support-webwork/src/main/java/org/hisp/dhis/webwork/interceptor/WebWorkSystemSettingInterceptor.java	2009-05-26 11:17:27 +0000
@@ -27,25 +27,25 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.options.SystemSettingManager.KEY_APPLICATION_TITLE;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_FLAG;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_FORUM_INTEGRATION;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_START_MODULE;
+
 import java.util.HashMap;
 import java.util.Map;
 
 import org.hisp.dhis.options.SystemSettingManager;
 
 import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.interceptor.AroundInterceptor;
-
-import static org.hisp.dhis.options.SystemSettingManager.KEY_APPLICATION_TITLE;
-import static org.hisp.dhis.options.SystemSettingManager.KEY_FLAG;
-import static org.hisp.dhis.options.SystemSettingManager.KEY_FORUM_INTEGRATION;
-import static org.hisp.dhis.options.SystemSettingManager.KEY_START_MODULE;
+import com.opensymphony.xwork.interceptor.Interceptor;
 
 /**
  * @author Lars Helge Overland
  * @version $Id$
  */
 public class WebWorkSystemSettingInterceptor
-    extends AroundInterceptor
+    implements Interceptor
 {
     // -------------------------------------------------------------------------
     // Dependencies
@@ -62,7 +62,19 @@
     // AroundInterceptor implementation
     // -------------------------------------------------------------------------
 
-    protected void before( ActionInvocation invocation )
+    public void destroy()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void init()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String intercept( ActionInvocation invocation )
         throws Exception
     {
         Map<String, Object> map = new HashMap<String, Object>( 2 );
@@ -78,10 +90,7 @@
         map.put( KEY_START_MODULE, startModule );
         
         invocation.getStack().push( map );
-    }
-    
-    protected void after( ActionInvocation invocation, String result )
-        throws Exception
-    {
+        
+        return invocation.invoke();
     }
 }



--
Trunk
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.