jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaqu...@apache.org
Subject svn commit: r682148 [8/8] - in /incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki: parser/ plugin/ preferences/ providers/ render/ rpc/ rpc/atom/ rpc/json/ rss/ search/ tags/ ui/ ui/admin/ ui/admin/beans/ ui/progress/
Date Sun, 03 Aug 2008 12:22:18 GMT
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiServletFilter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiServletFilter.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiServletFilter.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiServletFilter.java
Sun Aug  3 05:22:13 2008
@@ -1,21 +1,22 @@
-/* 
+/*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2006 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui;
 
@@ -24,25 +25,34 @@
 
 import javax.servlet.*;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
 
 import org.apache.log4j.Logger;
 import org.apache.log4j.NDC;
 
+import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
-
-
+import com.ecyrd.jspwiki.WikiSession;
+import com.ecyrd.jspwiki.auth.AuthenticationManager;
+import com.ecyrd.jspwiki.auth.SessionMonitor;
+import com.ecyrd.jspwiki.auth.WikiSecurityException;
+import com.ecyrd.jspwiki.tags.WikiTagBase;
 
 /**
- *  <p>Initial filter for JSPWiki that ensures that the WikiEngine is running, and
- *  injects a reference to it into the request scope. The WikiEngine is subsequently
- *  available, for example, as a JSP 2.0 Expression Language variable
- *  <code>${wikiEngine}</code>. A reference to the WikiSession is also stashed
- *  and is available as (logically enough) <code>${wikiSession}</code>.</p>
- *  <p>This filter also does a bunch of sanity-checks. Note that this filter should
- *  run before any other Filter, including
- *  {@link net.sourceforge.stripes.controller.StripesFilter}.</p>
+ * Filter that verifies that the {@link com.ecyrd.jspwiki.WikiEngine} is running, and
+ * sets the authentication status for the user's WikiSession. Each HTTP request
+ * processed by this filter is wrapped by a {@link WikiRequestWrapper}. The wrapper's
+ * primary responsibility is to return the correct <code>userPrincipal</code>
and
+ * <code>remoteUser</code> for authenticated JSPWiki users (whether 
+ * authenticated by container or by JSPWiki's custom system).
+ * The wrapper's other responsibility is to incorporate JSPWiki built-in roles
+ * into the role-checking algorithm for {@link  HttpServletRequest#isUserInRole(String)}.
+ * Just before the request is wrapped, the method {@link AuthenticationManager#login(HttpServletRequest)}
executes;
+ * this method contains all of the logic needed to grab any user login credentials set 
+ * by the container or by cookies.
  *  
  *  @author Janne Jalkanen
+ *  @author Andrew Jaquith
  *
  */
 public class WikiServletFilter implements Filter
@@ -55,18 +65,33 @@
         super();
     }
 
-    public void init(FilterConfig config) throws ServletException
+    /**
+     * Initializes the WikiServletFilter.
+     */
+    public void init( FilterConfig config ) throws ServletException
     {
         ServletContext context = config.getServletContext();
         m_engine = WikiEngine.getInstance( context, null );
     }
 
+    /**
+     * Destroys the WikiServletFilter.
+     */
     public void destroy()
     {
     }
 
-
-    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
+    /**
+    * Checks that the WikiEngine is running ok, wraps the current
+    * HTTP request, and sets the correct authentication state for the users's
+    * WikiSession. First, the method {@link AuthenticationManager#login(HttpServletRequest)}
+    * executes, which sets the authentication state. Then, the request is wrapped with a
+    * {@link WikiRequestWrapper}.
+    * @param request the current HTTP request object
+    * @param response the current HTTP response object
+    * @throws ServletException if {@link AuthenticationManager#login(HttpServletRequest)}
fails for any reason
+     */
+    public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain
) throws IOException, ServletException
     {
         //
         //  Sanity check; it might be true in some conditions, but we need to know where.
@@ -88,17 +113,57 @@
             out.print("<p>We apologize for the inconvenience.  No, really, we do. 
We're trying to ");
             out.print("JSPWiki as easy as we can, but there is only so much we have time
to test ");
             out.print("platforms.</p>");
-            out.print("</body>");
+            out.print( "<p>Please go to the <a href='Install.jsp'>installer</a>
to continue.</p>" );
+            out.print("</body></html>");
             return;
         }   
         
+        if( m_engine.getBaseURL().length() == 0 && !((HttpServletRequest)request).getRequestURI().endsWith("Install.jsp")
)
+        {
+            PrintWriter out = response.getWriter();
+            
+            out.print( "<html><head><title>JSPWiki installation start</title></head>"
);
+            out.print( "<body>" );
+            out.print( "<h1>JSPWiki installation</h1>" );
+            out.print( "<p>Hello!  It appears that this is your first jspwiki installation."
);
+            out.print( "(Or, you have removed jspwiki.baseURL from your property file.) "
);
+            out.print( "Therefore, you will need to start the installation process. " );
+            out.print( "Please <a href='Install.jsp'>continue to the installer</a>."
);
+            out.print( "</p>");
+            out.print( "<p>If you just used the installer, then please restart your
servlet container to get rid of this message.</p>" );
+            out.print("</body></html>");            
+            return;
+        }
+        
+        // If we haven't done so, wrap the request and run the security filter
         HttpServletRequest httpRequest = (HttpServletRequest) request;
+        if ( !isWrapped( request ) )
+        {
+            // Prepare the WikiSession
+            try
+            {
+                m_engine.getAuthenticationManager().login( httpRequest );
+                WikiSession wikiSession = SessionMonitor.getInstance( m_engine ).find( httpRequest.getSession()
);
+                httpRequest = new WikiRequestWrapper( m_engine, httpRequest );
+                if ( log.isDebugEnabled() )
+                {
+                    log.debug( "Executed security filters for user=" + wikiSession.getLoginPrincipal().getName()
+ ", path=" + httpRequest.getRequestURI() );
+                }
+            }
+            catch ( WikiSecurityException e )
+            {
+                throw new ServletException( e );
+            }
+        }
         
+        // Set the character encoding
+        httpRequest.setCharacterEncoding( m_engine.getContentEncoding() );
+
         try
         {
             NDC.push( m_engine.getApplicationName()+":"+httpRequest.getRequestURL() );
             
-            chain.doFilter( request, response );
+            chain.doFilter( httpRequest, response );
         }
         finally
         {
@@ -108,4 +173,38 @@
 
     }
 
+    /**
+     *  Figures out the wiki context from the request.  This method does not create the
+     *  context if it does not exist.
+     *  
+     *  @param request The request to examine
+     *  @return A valid WikiContext value (or null, if the context could not be located).
+     */
+    protected WikiContext getWikiContext( ServletRequest  request )
+    {
+        HttpServletRequest httpRequest = (HttpServletRequest) request;
+    
+        WikiContext ctx = (WikiContext) httpRequest.getAttribute( WikiTagBase.ATTR_CONTEXT
);
+        
+        return ctx;
+    }
+
+    /** 
+     * Determines whether the request has been previously wrapped with a WikiRequestWrapper.

+     * We find the wrapper by recursively unwrapping successive request wrappers, if they
have been supplied.
+     * @param request the current HTTP request
+     * @return <code>true</code> if the request has previously been wrapped;
+     * <code>false</code> otherwise
+     */
+    private boolean isWrapped( ServletRequest request )
+    {
+        while ( !(request instanceof WikiRequestWrapper )
+            && request != null
+            && request instanceof HttpServletRequestWrapper )
+        {
+            request = ((HttpServletRequestWrapper) request).getRequest();
+        }
+        return request instanceof WikiRequestWrapper ? true : false;
+    }
+
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBean.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBean.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBean.java
Sun Aug  3 05:22:13 2008
@@ -1,21 +1,22 @@
 /* 
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2007 JSPWiki development group
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui.admin;
 
@@ -25,7 +26,6 @@
 /**
  *  Describes an administrative bean.
  *  
- *  @author Janne Jalkanen
  *  @since  2.5.52
  */
 public interface AdminBean

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java
Sun Aug  3 05:22:13 2008
@@ -1,21 +1,22 @@
-/*
+/* 
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2007 JSPWiki development group
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui.admin;
 
@@ -27,7 +28,6 @@
 
 import javax.management.*;
 
-import org.apache.commons.lang.SystemUtils;
 import org.apache.log4j.Logger;
 
 import com.ecyrd.jspwiki.Release;
@@ -45,7 +45,6 @@
  *  Provides a manager class for all AdminBeans within JSPWiki.  This class
  *  also manages registration for any AdminBean which is also a JMX bean.
  *
- *  @author Janne Jalkanen
  *  @since  2.5.52
  */
 public class AdminBeanManager implements WikiEventListener
@@ -59,24 +58,9 @@
 
     public AdminBeanManager( WikiEngine engine )
     {
-        if( SystemUtils.isJavaVersionAtLeast(1.5f) )
-        {
-            log.info("Using JDK 1.5 Platform MBeanServer");
-            m_mbeanServer = MBeanServerFactory15.getServer();
-        }
-        else
-        {
-            log.info("Finding a JDK 1.4 -compatible MBeanServer.");
-            try
-            {
-                m_mbeanServer = MBeanServerFactory14.getServer();
-            }
-            catch( Exception e )
-            {
-                log.error("Unable to locate the JMX libraries from your classpath. "+
-                          "Please make sure that \"jmxri.jar\" can be found in your WEB-INF/lib
directory.");
-            }
-        }
+        log.info("Using JDK 1.5 Platform MBeanServer");
+        m_mbeanServer = MBeanServerFactory15.getServer();
+
         m_engine = engine;
 
         if( m_mbeanServer != null )
@@ -263,42 +247,8 @@
     }
 
     /**
-     *  A JDK 1.4 version of something which gets us the MBeanServer.  It
-     *  binds to the first server it can find.
-     *
-     *  @author Janne Jalkanen
-     *
-     */
-    private static final class MBeanServerFactory14
-    {
-        private MBeanServerFactory14()
-        {}
-
-        public static MBeanServer getServer()
-        {
-            MBeanServer server;
-            ArrayList servers = MBeanServerFactory.findMBeanServer(null);
-
-            if( servers == null || servers.size() == 0 )
-            {
-                log.info("Creating a new MBeanServer...");
-                server = MBeanServerFactory.createMBeanServer(Release.APPNAME);
-            }
-            else
-            {
-                server = (MBeanServer)servers.get(0);
-            }
-
-            return server;
-        }
-    }
-
-    /**
      *  Provides a JDK 1.5-compliant version of the MBeanServerFactory. This
      *  will simply bind to the platform MBeanServer.
-     *
-     *  @author Janne Jalkanen
-     *
      */
     private static final class MBeanServerFactory15
     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/SimpleAdminBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/SimpleAdminBean.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/SimpleAdminBean.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/SimpleAdminBean.java
Sun Aug  3 05:22:13 2008
@@ -1,21 +1,22 @@
 /* 
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2007 JSPWiki development group
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui.admin;
 
@@ -33,7 +34,6 @@
  *  and doPost() interfaces by using the introspection capabilities of the
  *  SimpleMBean.
  *  
- *  @author Janne Jalkanen
  *  @since 2.5.52
  */
 public abstract class SimpleAdminBean extends SimpleMBean implements AdminBean

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/WikiFormAdminBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/WikiFormAdminBean.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/WikiFormAdminBean.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/WikiFormAdminBean.java
Sun Aug  3 05:22:13 2008
@@ -1,21 +1,22 @@
 /* 
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2007 JSPWiki development group
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui.admin;
 
@@ -31,7 +32,6 @@
 
 /**
  *  This class is still experimental.
- * @author jalkanen
  *
  */
 public abstract class WikiFormAdminBean

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/CoreBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/CoreBean.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/CoreBean.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/CoreBean.java
Sun Aug  3 05:22:13 2008
@@ -1,21 +1,22 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2007 JSPWiki development group
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui.admin.beans;
 
@@ -28,7 +29,6 @@
 /**
  *  An AdminBean which manages the JSPWiki core operations.
  *
- *  @author jalkanen
  */
 public class CoreBean
     extends SimpleAdminBean
@@ -45,7 +45,7 @@
     /**
      *  Return the page count in the Wiki.
      *
-     *  @return
+     *  @return the page content
      */
     public int getPages()
     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/PlainEditorAdminBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/PlainEditorAdminBean.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/PlainEditorAdminBean.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/PlainEditorAdminBean.java
Sun Aug  3 05:22:13 2008
@@ -1,21 +1,22 @@
 /* 
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2007 JSPWiki development group
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui.admin.beans;
 
@@ -31,7 +32,6 @@
 /**
  *  This class is still experimental.
  *  
- * @author jalkanen
  *
  */
 public class PlainEditorAdminBean

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/PluginBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/PluginBean.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/PluginBean.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/PluginBean.java
Sun Aug  3 05:22:13 2008
@@ -1,3 +1,23 @@
+/*
+    JSPWiki - a JSP-based WikiWiki clone.
+
+    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 com.ecyrd.jspwiki.ui.admin.beans;
 
 import java.util.Collection;
@@ -42,9 +62,10 @@
         return CORE;
     }
 
+    @SuppressWarnings("unchecked")
     public String doGet(WikiContext context)
     {
-        Collection plugins = m_engine.getPluginManager().modules();
+        Collection<WikiPluginInfo> plugins = m_engine.getPluginManager().modules();
 
         div root = new div();
 
@@ -61,12 +82,12 @@
 
         tb.addElement(head);
 
-        for( Iterator i = plugins.iterator(); i.hasNext(); )
+        for( Iterator<WikiPluginInfo> i = plugins.iterator(); i.hasNext(); )
         {
             tr  row = new tr();
             tb.addElement( row );
 
-            WikiPluginInfo info = (WikiPluginInfo)i.next();
+            WikiPluginInfo info = i.next();
 
             row.addElement( new td(info.getName()) );
             row.addElement( new td(info.getAlias()) );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/SearchManagerBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/SearchManagerBean.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/SearchManagerBean.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/SearchManagerBean.java
Sun Aug  3 05:22:13 2008
@@ -1,12 +1,29 @@
+/* 
+    JSPWiki - a JSP-based WikiWiki clone.
+
+    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 com.ecyrd.jspwiki.ui.admin.beans;
 
 import java.util.Collection;
-import java.util.Iterator;
 
 import javax.management.NotCompliantMBeanException;
 
-import org.apache.log4j.Logger;
-
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
 import com.ecyrd.jspwiki.WikiPage;
@@ -26,9 +43,9 @@
 {
     private static final String PROGRESS_ID = "searchmanagerbean.reindexer";
 
-    public static final String[] METHODS = { "reload" };
+    private static final String[] METHODS = { "reload" };
 
-    private static Logger log = Logger.getLogger( SearchManagerBean.class );
+    // private static Logger log = Logger.getLogger( SearchManagerBean.class );
 
     private WikiBackgroundThread m_updater;
 
@@ -74,9 +91,10 @@
                     setName("Reindexer started");
                 }
 
+                @SuppressWarnings("unchecked")
                 public void backgroundTask() throws Exception
                 {
-                    Collection allPages = m_engine.getPageManager().getAllPages();
+                    Collection<WikiPage> allPages = m_engine.getPageManager().getAllPages();
 
                     SearchManager mgr = m_engine.getSearchManager();
                     m_max = allPages.size();
@@ -90,10 +108,8 @@
 
                     m_engine.getProgressManager().startProgress( pi, PROGRESS_ID );
 
-                    for( Iterator i = allPages.iterator(); i.hasNext(); )
+                    for( WikiPage page : allPages )
                     {
-                        WikiPage page = (WikiPage) i.next();
-
                         mgr.reindexPage(page);
                         m_count++;
                     }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/UserBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/UserBean.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/UserBean.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/beans/UserBean.java
Sun Aug  3 05:22:13 2008
@@ -1,3 +1,23 @@
+/* 
+    JSPWiki - a JSP-based WikiWiki clone.
+
+    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 com.ecyrd.jspwiki.ui.admin.beans;
 
 import java.util.Date;

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/progress/ProgressItem.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/progress/ProgressItem.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/progress/ProgressItem.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/progress/ProgressItem.java
Sun Aug  3 05:22:13 2008
@@ -1,44 +1,62 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui.progress;
 
 /**
  *  Provides access to an progress item.
  *
- *  @author Janne Jalkanen
  *  @since  2.6
  */
 public abstract class ProgressItem
 {
+    /**
+     *  Status: The PI is created.
+     */
     public static final int CREATED  = 0;
+    
+    /** Status: The PI is started. */
     public static final int STARTED  = 1;
+    
+    /** Status: The PI is stopped. */
     public static final int STOPPED  = 2;
+    
+    /** Status: The PI is finished. */
     public static final int FINISHED = 3;
 
     protected int m_state = CREATED;
 
+    /**
+     *  Get the state of the ProgressItem.
+     *  @return CREATED, STARTED, STOPPED or FINISHED.
+     */
     public int getState()
     {
         return m_state;
     }
 
+    /**
+     *  Sets the state of the ProgressItem.
+     *  
+     *  @param state One of the CREATED, STARTED, STOPPED or FINISHED.
+     */
     public void setState( int state )
     {
         m_state = state;

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/progress/ProgressManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/progress/ProgressManager.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/progress/ProgressManager.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/progress/ProgressManager.java
Sun Aug  3 05:22:13 2008
@@ -1,29 +1,30 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    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 com.ecyrd.jspwiki.ui.progress;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.UUID;
 
 import org.apache.log4j.Logger;
-import org.safehaus.uuid.UUIDGenerator;
 
 import com.ecyrd.jspwiki.rpc.RPCCallable;
 import com.ecyrd.jspwiki.rpc.json.JSONRPCManager;
@@ -32,15 +33,14 @@
  *  Manages progressing items.  In general this class is used whenever JSPWiki
  *  is doing something which may require a long time.  In addition, this manager
  *  provides a JSON interface for finding remotely what the progress is.  The
- *  JSON object name is JSON_PROGRESSTRACKER = "{@value JSON_PROGRESSTRACKER}".
+ *  JSON object name is JSON_PROGRESSTRACKER = "{@value #JSON_PROGRESSTRACKER}".
  *
- *  @author Janne Jalkanen
  *  @since  2.6
  */
-// FIXME: Gotta synchronize
+// FIXME: Needs synchronization, I think
 public class ProgressManager
 {
-    private Map m_progressingTasks = new HashMap();
+    private Map<String,ProgressItem> m_progressingTasks = new HashMap<String,ProgressItem>();
 
     /**
      *  The name of the progress tracker JSON object.  The current value is "{@value}",
@@ -63,7 +63,7 @@
      */
     public String getNewProgressIdentifier()
     {
-        return UUIDGenerator.getInstance().generateRandomBasedUUID().toString();
+        return UUID.randomUUID().toString();
     }
 
     /**
@@ -90,7 +90,7 @@
     public void stopProgress( String id )
     {
         log.debug("Removed "+id+" from progress queue");
-        ProgressItem pi = (ProgressItem) m_progressingTasks.remove( id );
+        ProgressItem pi = m_progressingTasks.remove( id );
         if( pi != null ) pi.setState( ProgressItem.STOPPED );
     }
 
@@ -98,13 +98,13 @@
      *  Get the progress in percents.
      *
      *  @param id The progress identifier.
-     *  @return A value between 0 to 100 indicating the progress.
+     *  @return a value between 0 to 100 indicating the progress
      *  @throws IllegalArgumentException If no such progress item exists.
      */
     public int getProgress( String id )
         throws IllegalArgumentException
     {
-        ProgressItem pi = (ProgressItem)m_progressingTasks.get( id );
+        ProgressItem pi = m_progressingTasks.get( id );
 
         if( pi != null )
         {
@@ -116,19 +116,20 @@
 
     /**
      *  Provides access to a progress indicator, assuming you know the ID.
-     *
-     *  @author Janne Jalkanen
+     *  Progress of zero (0) means that the progress has just started, and a progress of
+     *  100 means that it is complete.
      */
     public class JSONTracker implements RPCCallable
     {
         /**
          *  Returns upload progress in percents so far.
-         *  @param uploadId
-         *  @return
+         *  @param progressId The string representation of the progress ID that you want
to know the
+         *                    progress of.
+         *  @return a value between 0 to 100 indicating the progress
          */
         public int getProgress( String progressId )
         {
             return ProgressManager.this.getProgress( progressId );
         }
     }
-}
\ No newline at end of file
+}



Mime
View raw message