cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r149055 - in cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools: . acting copletManagement copletManagement/generation generation helper model service transformation userManagement
Date Sat, 29 Jan 2005 18:21:35 GMT
Author: cziegeler
Date: Sat Jan 29 10:21:34 2005
New Revision: 149055

URL: http://svn.apache.org/viewcvs?view=rev&rev=149055
Log:
Code formatting and optimizations
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalTool.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolBuilder.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/acting/CheckAccessAction.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/LayoutActions.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/generation/I18nCatalogueGenerator.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/MultipleRoleMatcher.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/PortalObjects.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/RoleMatcher.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/SingleRoleMatcher.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/model/User.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/service/UserrightsService.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/CheckAccessTransformer.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsI18nTransformer.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsLayoutTransformer.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextGrabber.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextItem.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/UserBean.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalTool.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalTool.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalTool.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalTool.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalTool.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalTool.java
Sat Jan 29 10:21:34 2005
@@ -28,11 +28,11 @@
  */
 public class PortalTool {
 	
-	HashMap functions = new HashMap();
+    protected final HashMap functions;
 	
-	String toolName = "";
-	String toolId = "";
-	ArrayList i18n = new ArrayList();
+	protected final String toolName;
+	protected final String toolId;
+	protected final ArrayList i18n;
 	
 	/**
 	 * Creates a new Portal Tool
@@ -74,7 +74,7 @@
 	    Collection funs = functions.values();
 	    for(Iterator it = funs.iterator(); it.hasNext(); ) {
 	        PortalToolFunction ptf = (PortalToolFunction) it.next();
-	        if(ptf.isInternal()) {
+	        if (ptf.isInternal()) {
 	            internal.add(ptf);
 	        }
 	    }
@@ -89,7 +89,7 @@
 	    Collection funs = functions.values();
 	    for(Iterator it = funs.iterator(); it.hasNext(); ) {
 	        PortalToolFunction ptf = (PortalToolFunction) it.next();
-	        if(!ptf.isInternal()) {
+	        if (!ptf.isInternal()) {
 	            publik.add(ptf);
 	        }
 	    }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolBuilder.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolBuilder.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolBuilder.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolBuilder.java
Sat Jan 29 10:21:34 2005
@@ -31,7 +31,6 @@
  */
 public class PortalToolBuilder {
     
-    
     public PortalTool buildTool(File confFile, String rootDir, String pluginDir, String i18nDir)
{
         PortalTool pTool = null;
         try {
@@ -61,8 +60,12 @@
 			}
 			pTool = new PortalTool(toolName, toolId, functions, i18n);
         } catch (ConfigurationException ece) {
+            // TODO
         } catch (SAXException esax) {
-		} catch (IOException eio) {}
+            // TODO
+		} catch (IOException eio) {
+            // TODO
+        }
 		return pTool;
     }
    

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolManager.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolManager.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolManager.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolManager.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolManager.java
Sat Jan 29 10:21:34 2005
@@ -64,9 +64,6 @@
 
 	private ServiceManager manager;
 	
-	// parameters from the component-configuration
-	private Parameters para;
-	
 	private List i18n = new ArrayList();
 	
 	
@@ -85,16 +82,10 @@
     /** The source resolver */
     protected SourceResolver resolver;
     
-    /**
-	 * Constructor
-	 */
-	public PortalToolManager() {}
-
 	/* (non-Javadoc)
 	 * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
 	 */
 	public void parameterize(Parameters para) throws ParameterException {
-		this.para = para;
 		this.rootDir = para.getParameter("root", "/");
 		this.confFile = para.getParameter("conf", "conf.xml");
 		this.authFile = para.getParameter("auth", "auth.xml");

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/acting/CheckAccessAction.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/acting/CheckAccessAction.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/acting/CheckAccessAction.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/acting/CheckAccessAction.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/acting/CheckAccessAction.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/acting/CheckAccessAction.java
Sat Jan 29 10:21:34 2005
@@ -36,37 +36,30 @@
 extends ServiceableAction
 implements ThreadSafe {
     
-    /**
-     * The userrights service.
-     */
-    private UserrightsService userrightsService;
-
-    /** 
-     * Overridden from superclass.
-     * 
+    /* (non-Javadoc)
      * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector,
org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
      */
-    public Map act(
-        Redirector redirector,
-        SourceResolver resolver,
-        Map objectModel,
-        String source,
-        Parameters parameters)
-    throws Exception
-    {
+    public Map act(Redirector redirector,
+                   SourceResolver resolver,
+                   Map objectModel,
+                   String source,
+                   Parameters parameters)
+    throws Exception {
     	String name = parameters.getParameter("name", "anonymous");
     	String role = parameters.getParameter("role", "guest");
         String url = parameters.getParameter("url");
         User user = new User(name, role);
         PortalToolManager ptm = (PortalToolManager) this.manager.lookup(PortalToolManager.ROLE);
-        userrightsService = ptm.getUserRightsService();
-        // FIXME: replace the throw with something else
-        if (!this.userrightsService.userIsAllowed(url, user)) {
+        try {
+            UserrightsService userrightsService = ptm.getUserRightsService();
+            // FIXME: replace the throw with something else
+            if (!userrightsService.userIsAllowed(url, user)) {
+                throw new ProcessingException(
+                    "You are not allowed to request this page.");
+            }
+        } finally {
             this.manager.release(ptm);
-            throw new ProcessingException(
-                "You are not allowed to request this page.");
         }
-        this.manager.release(ptm);
         return EMPTY_MAP;
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/LayoutActions.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/LayoutActions.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/LayoutActions.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/LayoutActions.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/LayoutActions.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/LayoutActions.java
Sat Jan 29 10:21:34 2005
@@ -42,10 +42,10 @@
  */
 public class LayoutActions {
     
-    private Layout layout = null;
-    private LayoutFactory lf = null;
-    private ProfileManager pm = null;
-    private CopletFactory cf = null;
+    private final Layout layout;
+    private final LayoutFactory lf;
+    private final ProfileManager pm;
+    private final CopletFactory cf;
     
     public LayoutActions(Layout layout, LayoutFactory lf, CopletFactory cf, ProfileManager
pm) {
         this.layout = layout;
@@ -54,6 +54,7 @@
         this.cf = cf;
     }
     
+    // FIXME - where is this used?
     public static int line = 1;
     
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
Sat Jan 29 10:21:34 2005
@@ -57,7 +57,7 @@
         final Request request = ObjectModelHelper.getRequest(this.objectModel);
         final Object context = FlowHelper.getContextObject(this.objectModel);
         Map myMap = new HashMap();
-        if(context instanceof Map) {
+        if (context instanceof Map) {
             myMap = (Map) context;
         } else {
             fillContext(context, myMap);

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/generation/I18nCatalogueGenerator.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/generation/I18nCatalogueGenerator.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/generation/I18nCatalogueGenerator.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/generation/I18nCatalogueGenerator.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/generation/I18nCatalogueGenerator.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/generation/I18nCatalogueGenerator.java
Sat Jan 29 10:21:34 2005
@@ -47,7 +47,6 @@
     private String catalogueStartTag = "<?xml version=\"1.0\"?><catalogue>";
     private String catalogueEndTag = "</catalogue>";
     private String lang = ".xml";
-    private PortalToolManager ptm = null;
     private StringBuffer i18n = new StringBuffer();
     
     /* (non-Javadoc)
@@ -76,6 +75,7 @@
             lang = src.substring(src.indexOf("_"), src.length());
             lang = lang.toLowerCase();
         }
+        PortalToolManager ptm = null;
         try {
             ptm = (PortalToolManager) this.manager.lookup(PortalToolManager.ROLE);
             List cats = ptm.getI18n();
@@ -103,7 +103,9 @@
             }
         } catch (ServiceException e) {
             e.printStackTrace();
-        } 
+        } finally {
+            this.manager.release(ptm);
+        }
         
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/MultipleRoleMatcher.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/MultipleRoleMatcher.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/MultipleRoleMatcher.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/MultipleRoleMatcher.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/MultipleRoleMatcher.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/MultipleRoleMatcher.java
Sat Jan 29 10:21:34 2005
@@ -25,9 +25,8 @@
  * @version CVS $Id$
  */
 public class MultipleRoleMatcher
-implements
-    RoleMatcher
-{
+implements RoleMatcher {
+    
     /**
      * The character used to seperate multiple roles.
      */
@@ -41,8 +40,7 @@
     /**
      * Creates a new MultipleRoleMatcher.
      */
-    public MultipleRoleMatcher(String roles)
-    {
+    public MultipleRoleMatcher(String roles) {
         StringTokenizer tokenizer = new StringTokenizer(
             roles,
             ROLE_SEPARATOR,
@@ -52,8 +50,7 @@
 
         String token;
         int i = 0;
-        while (tokenizer.hasMoreTokens())
-        {
+        while (tokenizer.hasMoreTokens()) {
             token = tokenizer.nextToken();
             this.roles[i] = token;
             i++;
@@ -65,13 +62,14 @@
      * 
      * @see com.vodafone.veap.util.RoleMatcher#matches(com.vodafone.veap.model.User)
      */
-    public boolean matches(User user)
-    {
+    public boolean matches(User user) {
         // The user must have all roles
         int length = this.roles.length;
-        for (int i = 0; i < length; i++)
-            if (!user.hasRole(this.roles[i]))
+        for (int i = 0; i < length; i++) {
+            if (!user.hasRole(this.roles[i])) {
                 return false;
+            }
+        }
         return true;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/PortalObjects.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/PortalObjects.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/PortalObjects.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/PortalObjects.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/PortalObjects.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/PortalObjects.java
Sat Jan 29 10:21:34 2005
@@ -44,12 +44,15 @@
 	public PortalComponentManager getComponentManager() {
 		return componentManager;
 	}
+    
 	public Layout getPortalLayout() {
 		return portalLayout;
 	}
+    
 	public PortalService getPortalService() {
 		return portalService;
 	}
+    
 	public ProfileManager getProfileManager() {
 		return profileManager;
 	}

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/RoleMatcher.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/RoleMatcher.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/RoleMatcher.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/RoleMatcher.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/RoleMatcher.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/RoleMatcher.java
Sat Jan 29 10:21:34 2005
@@ -22,8 +22,8 @@
  * 
  * @version CVS $Id$
  */
-public interface RoleMatcher
-{
+public interface RoleMatcher {
+    
     /**
      * @return Whether the user matches this role.
      */

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/SingleRoleMatcher.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/SingleRoleMatcher.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/SingleRoleMatcher.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/SingleRoleMatcher.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/SingleRoleMatcher.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/helper/SingleRoleMatcher.java
Sat Jan 29 10:21:34 2005
@@ -23,19 +23,17 @@
  * @version CVS $Id$
  */
 public class SingleRoleMatcher
-implements
-    RoleMatcher
-{
+implements RoleMatcher {
+    
     /**
      * The role.
      */
-    private String role;
+    private final String role;
 
     /**
      * Creates a new SingleRoleMatcher.
      */
-    public SingleRoleMatcher(String role)
-    {
+    public SingleRoleMatcher(String role) {
         this.role = role;
     }
 
@@ -44,8 +42,7 @@
      * 
      * @see com.vodafone.veap.util.RoleMatcher#matches(com.vodafone.veap.model.User)
      */
-    public boolean matches(User user)
-    {
+    public boolean matches(User user) {
         return user.hasRole(this.role);
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/model/User.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/model/User.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/model/User.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/model/User.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/model/User.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/model/User.java
Sat Jan 29 10:21:34 2005
@@ -59,8 +59,9 @@
 	
     public boolean hasRole(String role) {
         for(Iterator it = roles.iterator(); it.hasNext();) {
-            if(((String) it.next()).equals(role)) 
+            if(((String) it.next()).equals(role)) {
                 return true;
+            }
         }
 		return false;
 	}

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/service/UserrightsService.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/service/UserrightsService.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/service/UserrightsService.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/service/UserrightsService.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/service/UserrightsService.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/service/UserrightsService.java
Sat Jan 29 10:21:34 2005
@@ -34,8 +34,8 @@
  * 
  * @version CVS $Id$
  */
-public class UserrightsService
-{
+public class UserrightsService {
+    
     /** 
      * The properties' location.
      */
@@ -44,7 +44,7 @@
     /**
      * The properties.
      */
-    private Properties properties = null;
+    private Properties properties;
 
     /**
      * Signals when the properties have been loaded last.
@@ -65,8 +65,7 @@
      * @return The location
      */
     
-    public Source getLocation()
-    {
+    public Source getLocation() {
         return this.location;
     }
 
@@ -74,63 +73,54 @@
      * @param location The location to set
      */
 
-    public void setLocation(Source location)
-    {
+    public void setLocation(Source location) {
         this.location = location;
     }
 
     /**
      * @return The reload
      */
-    public boolean getReload()
-    {
+    public boolean getReload() {
         return this.reload;
     }
 
     /**
      * @param reload The reload to set
      */
-    public void setReload(boolean reload)
-    {
+    public void setReload(boolean reload) {
         this.reload = reload;
     }
 
     /**
      * Initialize the bean.
      */
-    public void initialize()
-    {
+    public void initialize() {
         boolean load;
 
         // Check if called for the first time
-        if (this.properties == null)
+        if (this.properties == null) {
             load = true;
-        else
-        {
+        } else {
             // Check if reload is required
             load = this.reload;
         }
 
-        try
-        {
-            if (load)
-            {
+        try {
+            if (load) {
                 // Check file timestamp
                 long lastModified = this.location.getLastModified();
-                if (this.lastModified >= lastModified)
+                if (this.lastModified >= lastModified) {
                     load = false;
+                }
 
-                if (load)
-                {
+                if (load) {
                     this.lastModified = lastModified;
                     this.properties = new Properties();
                     this.properties.load(this.location.getInputStream());
                     this.parseProperties();
                 }
             }
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             throw new RuntimeException(e);
         }
     }
@@ -138,8 +128,7 @@
     /**
      * @return Whether the current user is allowed to call the given url.
      */
-    public boolean userIsAllowed(String url, User user)
-    {
+    public boolean userIsAllowed(String url, User user) {
         this.initialize();
 
         boolean isAllowed = true;
@@ -149,23 +138,21 @@
         Map.Entry entry;
         int[] pattern;
         RoleMatcher[] matcher;
-        while (iterator.hasNext() && isAllowed)
-        {
+        while (iterator.hasNext() && isAllowed) {
             entry = (Map.Entry)iterator.next();
             pattern = (int[])entry.getKey();
 
             // If userright matches try to find a matching role
-            if (WildcardHelper.match(new HashMap(), url, pattern))
-            {
+            if (WildcardHelper.match(new HashMap(), url, pattern)) {
                 matcher = (RoleMatcher[])entry.getValue();
 
                 isAllowed = false;
 
                 int length = matcher.length;
-                for (int i = 0; i < length; i++)
-                {
-                    if (matcher[i].matches(user))
+                for (int i = 0; i < length; i++) {
+                    if (matcher[i].matches(user)) {
                         isAllowed = true;
+                    }
                 }
             }
         }
@@ -173,8 +160,7 @@
         return isAllowed;
     }
 
-    public boolean userFunctionIsAllowed(String id, User user)
-    {
+    public boolean userFunctionIsAllowed(String id, User user) {
         this.initialize();
 
         boolean isAllowed = true;
@@ -184,23 +170,21 @@
         Map.Entry entry;
         int[] pattern;
         RoleMatcher[] matcher;
-        while (iterator.hasNext() && isAllowed)
-        {
+        while (iterator.hasNext() && isAllowed) {
             entry = (Map.Entry)iterator.next();
             pattern = (int[])entry.getKey();
 
             // If userright matches try to find a matching role
-            if (WildcardHelper.match(new HashMap(), id, pattern))
-            {
+            if (WildcardHelper.match(new HashMap(), id, pattern)) {
                 matcher = (RoleMatcher[])entry.getValue();
 
                 isAllowed = false;
 
                 int length = matcher.length;
-                for (int i = 0; i < length; i++)
-                {
-                    if (matcher[i].matches(user))
+                for (int i = 0; i < length; i++) {
+                    if (matcher[i].matches(user)) {
                         isAllowed = true;
+                    }
                 }
             }
         }
@@ -211,14 +195,12 @@
     /**
      * Parse the properties.
      */
-    private void parseProperties()
-    {
+    private void parseProperties() {
         Map userrights = new HashMap();
 
         Iterator iterator = this.properties.entrySet().iterator();
         Map.Entry entry;
-        while (iterator.hasNext())
-        {
+        while (iterator.hasNext()) {
             entry = (Map.Entry)iterator.next();
             userrights.put(
                 WildcardHelper.compilePattern((String)entry.getKey()),
@@ -231,20 +213,20 @@
     /**
      * @return A list representing the given roles.
      */
-    private RoleMatcher[] buildRoles(String roles)
-    {
+    private RoleMatcher[] buildRoles(String roles) {
         StringTokenizer tokenizer = new StringTokenizer(roles, ",", false);
 
         RoleMatcher[] result = new RoleMatcher[tokenizer.countTokens()];
 
         String token;
         int i = 0;
-        while (tokenizer.hasMoreTokens())
-        {
+        while (tokenizer.hasMoreTokens()) {
             token = tokenizer.nextToken();
-            if (token.indexOf(MultipleRoleMatcher.ROLE_SEPARATOR) == -1)
+            if (token.indexOf(MultipleRoleMatcher.ROLE_SEPARATOR) == -1) {
                 result[i] = new SingleRoleMatcher(token);
-            else result[i] = new MultipleRoleMatcher(token);
+            } else {
+                result[i] = new MultipleRoleMatcher(token);
+            }
             i++;
         }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/CheckAccessTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/CheckAccessTransformer.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/CheckAccessTransformer.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/CheckAccessTransformer.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/CheckAccessTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/CheckAccessTransformer.java
Sat Jan 29 10:21:34 2005
@@ -96,7 +96,11 @@
      * @see org.apache.avalon.framework.activity.Disposable#dispose()
      */
     public void dispose() {
-        this.manager.release(ptm);
+        if ( this.manager != null ) {
+            this.manager.release(ptm);
+            ptm = null;
+            this.manager = null;
+        }
     }
 
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsI18nTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsI18nTransformer.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsI18nTransformer.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsI18nTransformer.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsI18nTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsI18nTransformer.java
Sat Jan 29 10:21:34 2005
@@ -21,12 +21,10 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationSerializer;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.portal.tools.PortalToolCatalogue;
 import org.apache.cocoon.portal.tools.PortalToolManager;
 import org.apache.cocoon.transformation.I18nTransformer;
-import org.xml.sax.SAXException;
 
 /**
  * 
@@ -36,49 +34,44 @@
     
     public static String ROLE = PortalToolsI18nTransformer.class.getName();
     
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+     */
     public void configure(Configuration conf) throws ConfigurationException {
-      /*
-      <catalogues default="portalTools">
-                <catalogue id="portalTools" name="portalTools" location="cocoon:/i18n"/>
-      </catalogues>
-      */
+        /*
+        <catalogues default="portalTools">
+          <catalogue id="portalTools" name="portalTools" location="cocoon:/i18n"/>
+        </catalogues>
+        */
         
-        if(conf.getChild("catalogues").getAttribute("new", "no").equals("no")) {
+        if (conf.getChild("catalogues").getAttribute("new", "no").equals("no")) {
             super.configure(conf);
             return;
         }
-      DefaultConfiguration root = new DefaultConfiguration("root");
-      DefaultConfiguration defconf = new DefaultConfiguration("catalogues");
-      defconf.setAttribute("default", "default");
-      root.addChild(defconf);
-      PortalToolManager ptm;
-      try {
-          System.out.println("getting toolmananger:");
-      ptm = (PortalToolManager) this.manager.lookup(PortalToolManager.ROLE);
-      System.out.println("getting catalog list");
-      List i18nc = ptm.getI18n();
-      for(Iterator it = i18nc.iterator(); it.hasNext();) {
-          PortalToolCatalogue ptc = (PortalToolCatalogue) it.next();
-	    System.out.println("ptc: " + ptc);
-	    DefaultConfiguration catConf = new DefaultConfiguration("catalogue");
-	    catConf.setAttribute("id", ptc.getId());
-	    catConf.setAttribute("name", ptc.getName());
-	    catConf.setAttribute("location", ptc.getLocation());
-	    defconf.addChild(catConf);
-      }
-      System.out.println("conf:");
-      System.out.println(new DefaultConfigurationSerializer().serialize(conf));
-      System.out.println("new Conf:");
-      System.out.println(new DefaultConfigurationSerializer().serialize(defconf));
-      super.configure(root);
-      this.manager.release(ptm);
-      } catch (ServiceException e) {
-         e.printStackTrace();
-      } catch (ConfigurationException e) {
-                e.printStackTrace();
-      } catch (SAXException e) {
-                e.printStackTrace();
-      }
+        DefaultConfiguration root = new DefaultConfiguration("root");
+        DefaultConfiguration defconf = new DefaultConfiguration("catalogues");
+        defconf.setAttribute("default", "default");
+        root.addChild(defconf);
+        PortalToolManager ptm = null;
+        try {
+            ptm = (PortalToolManager) this.manager.lookup(PortalToolManager.ROLE);
+            List i18nc = ptm.getI18n();
+            for(Iterator it = i18nc.iterator(); it.hasNext();) {
+                PortalToolCatalogue ptc = (PortalToolCatalogue) it.next();
+                DefaultConfiguration catConf = new DefaultConfiguration("catalogue");
+	            catConf.setAttribute("id", ptc.getId());
+	            catConf.setAttribute("name", ptc.getName());
+                catConf.setAttribute("location", ptc.getLocation());
+                defconf.addChild(catConf);
+            }
+            super.configure(root);
+        } catch (ServiceException e) {
+           e.printStackTrace();
+        } catch (ConfigurationException e) {
+           e.printStackTrace();
+        } finally {
+            this.manager.release(ptm);            
+        }
     }
 
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsLayoutTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsLayoutTransformer.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsLayoutTransformer.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsLayoutTransformer.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsLayoutTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/transformation/PortalToolsLayoutTransformer.java
Sat Jan 29 10:21:34 2005
@@ -44,9 +44,7 @@
 	public static final String ROLE = PortalToolsLayoutTransformer.class.getName();
 	
 	private PortalToolManager pm;
-	private String selected = null;
-	public PortalToolsLayoutTransformer() {
-	}
+	private String selected;
 
 	/* (non-Javadoc)
 	 * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
@@ -74,7 +72,11 @@
 	 * @see org.apache.avalon.framework.activity.Disposable#dispose()
 	 */
 	public void dispose() {
-		this.manager.release(pm);
+        if ( this.manager != null ) {
+		    this.manager.release(pm);
+            pm = null;
+            this.manager = null;
+        }
 	}
 	
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextGrabber.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextGrabber.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextGrabber.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextGrabber.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextGrabber.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextGrabber.java
Sat Jan 29 10:21:34 2005
@@ -27,16 +27,13 @@
  */
 public class ContextGrabber {
 	
-	public ContextGrabber () { /* NOP */ }
-	
 	/**
 	 * Grabbing the context of the current user
 	 * 
 	 * @param context the instantiated class AuthenticationContext
 	 * @return Object of context information
 	 */
-	public UserBean grab (AuthenticationContext context)
-	{
+	public UserBean grab (AuthenticationContext context) {
 		UserBean ub = new UserBean ();
 		DocumentFragment df = null;
 		try {
@@ -48,19 +45,17 @@
 		return ub;
 	}
 	
-	private void grabAuthContext (Node node, UserBean ub){
+	private void grabAuthContext (Node node, UserBean ub) {
 		
-		while (node != null){
+		while (node != null) {
 			
-			if (!node.getNodeName().equals("#text"))
-			{
-				if (node.getFirstChild() != null)
-				{
+			if (!node.getNodeName().equals("#text")) {
+				if (node.getFirstChild() != null) {
 					grabAuthContext  (node.getFirstChild () ,ub);
 					ub.addContext(node.getNodeName(),node.getFirstChild().getNodeValue());
-				}
-				else
+				} else {
 					ub.addContext(node.getNodeName(),"");
+                }
 			}
 			node = node.getNextSibling();
 		}

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextItem.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextItem.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextItem.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextItem.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextItem.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/ContextItem.java
Sat Jan 29 10:21:34 2005
@@ -22,8 +22,8 @@
  */
 public class ContextItem {
 	
-	private String key = "";
-	private String value = "";
+	private final String key;
+	private final String value;
 	
 	public ContextItem(String key, String value){
 		this.key = key;
@@ -34,13 +34,8 @@
 	public String getKey() {
 		return key;
 	}
+    
 	public String getValue() {
 		return value;
-	}
-	public void setKey(String string) {
-		key = string;
-	}
-	public void setValue(String string) {
-		value = string;
 	}
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/UserBean.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/UserBean.java?view=diff&rev=149055&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/UserBean.java&r1=149054&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/UserBean.java&r2=149055
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/UserBean.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/tools/userManagement/UserBean.java
Sat Jan 29 10:21:34 2005
@@ -29,7 +29,8 @@
 	private String picture = "";
 	
 	
-    public UserBean () {}
+    public UserBean () {
+    }
     
     /**
      * Add a single context information
@@ -57,10 +58,11 @@
 	 * @return
 	 */
 	public String getContextItem (String key) {
-		if (this.context.get(key) != null)
+		if (this.context.get(key) != null) {
 			return ((ContextItem) this.context.get(key)).getValue();
-		else
+        } else {
 			return "";
+        }
 	}
 	
 	/**

Mime
View raw message