You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by aj...@apache.org on 2008/08/03 14:12:49 UTC

svn commit: r682139 [1/6] - in /incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki: ./ action/

Author: ajaquith
Date: Sun Aug  3 05:12:47 2008
New Revision: 682139

URL: http://svn.apache.org/viewvc?rev=682139&view=rev
Log:
Massive re-factoring to make Stripes less invasive.

Added:
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiServlet.java   (with props)
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/GroupTypeConverter.java
      - copied, changed from r643690, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/GroupTypeConverter.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/HandlerInfo.java   (with props)
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/HandlerPermission.java
      - copied, changed from r643690, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/EventPermission.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/PrincipalTypeConverter.java
      - copied, changed from r643690, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/PrincipalTypeConverter.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiExceptionHandler.java
      - copied, changed from r643690, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiExceptionHandler.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiInterceptor.java
      - copied, changed from r643690, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiInterceptor.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiPageTypeConverter.java
      - copied, changed from r643690, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiPageTypeConverter.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiRuntimeConfiguration.java
      - copied, changed from r643690, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiRuntimeConfiguration.java
Removed:
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageRenamer.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/AdminActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/DiffActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/EventPermission.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/EventPermissionInfo.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/GroupContext.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/PreviewActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiUrlPattern.java
Modified:
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/FileUtil.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/InternalWikiException.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/LinkCollector.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoRequiredPropertyException.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoSuchVariableException.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageLock.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageManager.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageTimeComparator.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PropertyReader.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/QueryItem.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ReferenceManager.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchMatcher.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchResultComparator.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/StringTransmutator.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/TextUtil.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/TranslatorReader.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/VariableManager.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiException.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiPage.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiProvider.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiSession.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/AbstractActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/AdministerProfilesActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/AttachActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/CommentActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/DeleteActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/EditActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/ErrorActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/GroupActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/InstallActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/LoginActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/MessageActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/NewBlogEntryActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/NewPageActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/PageInfoActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/PageModifiedActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RSSActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RenameActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/SearchActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UploadActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/ViewActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBean.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanContext.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanFactory.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiRequestContext.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WorkflowActionBean.java

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/FileUtil.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/FileUtil.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/FileUtil.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/FileUtil.java Sun Aug  3 05:12:47 2008
@@ -1,23 +1,23 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001 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;
 
 import java.io.*;

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/InternalWikiException.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/InternalWikiException.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/InternalWikiException.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/InternalWikiException.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2002 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;
 
@@ -24,7 +25,6 @@
  *  It is a runtime exception so that the API does not need
  *  to be changed, but it's helluva lot better than NullPointerException =).
  *
- *  @author Janne Jalkanen
  *  @since 1.6.9
  */
 public class InternalWikiException extends RuntimeException

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/LinkCollector.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/LinkCollector.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/LinkCollector.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/LinkCollector.java Sun Aug  3 05:12:47 2008
@@ -36,7 +36,7 @@
      * Returns a List of Strings representing links.
      * @return the link collection
      */
-    public Collection<String> getLinks()
+    public Collection getLinks()
     {
         return m_items;
     }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoRequiredPropertyException.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoRequiredPropertyException.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoRequiredPropertyException.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoRequiredPropertyException.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
-/* 
+/*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2002 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;
 
@@ -25,8 +26,6 @@
  *  a good value for a property, you'll see this exception.
  *  <P>
  *  Check <TT>jspwiki.properties</TT> for the required properties.
- *
- *  @author Janne Jalkanen
  */
 public class NoRequiredPropertyException
     extends WikiException

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoSuchVariableException.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoSuchVariableException.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoSuchVariableException.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/NoSuchVariableException.java Sun Aug  3 05:12:47 2008
@@ -1,28 +1,27 @@
-/* 
+/*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2002 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;
 
 /**
  *  Marks that no such variable was located.
- *
- *  @author Janne Jalkanen
  */
 public class NoSuchVariableException
     extends WikiException

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageLock.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageLock.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageLock.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageLock.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
-/* 
+/*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2002 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;
 
@@ -28,8 +29,6 @@
  *  <p>
  *  The PageLock keeps no reference to a WikiPage because otherwise it could
  *  keep a reference to a page for a long time.
- *  
- *  @author Janne Jalkanen
  *
  */
 public class PageLock

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageManager.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageManager.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2002 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;
 
@@ -50,8 +51,10 @@
  *  Manages the WikiPages.  This class functions as an unified interface towards
  *  the page providers.  It handles initialization and management of the providers,
  *  and provides utility methods for accessing the contents.
+ *  <p>
+ *  Saving a page is a two-stage Task; first the pre-save operations and then the
+ *  actual save.  See the descriptions of the tasks for further information.
  *
- *  @author Janne Jalkanen
  *  @since 2.0
  */
 // FIXME: This class currently only functions just as an extra layer over providers,
@@ -72,12 +75,24 @@
      */
     public static final String PROP_LOCKEXPIRY   = "jspwiki.lockExpiryTime";
     
+    /** The message key for storing the text for the presave task.  Value is <tt>{@value}</tt>*/
     public static final String PRESAVE_TASK_MESSAGE_KEY = "task.preSaveWikiPage";
+    
+    /** The workflow attribute which stores the wikiContext. */
     public static final String PRESAVE_WIKI_CONTEXT = "wikiContext";
-    public static final String SAVE_APPROVER = "workflow.saveWikiPage";
+    
+    /** The name of the key from jspwiki.properties which defines who shall approve
+     *  the workflow of storing a wikipage.  Value is <tt>{@value}</tt>*/
+    public static final String SAVE_APPROVER             = "workflow.saveWikiPage";
+    
+    /** The message key for storing the Decision text for saving a page.  Value is {@value}. */
     public static final String SAVE_DECISION_MESSAGE_KEY = "decision.saveWikiPage";
-    public static final String SAVE_REJECT_MESSAGE_KEY = "notification.saveWikiPage.reject";
-    public static final String SAVE_TASK_MESSAGE_KEY = "task.saveWikiPage";
+    
+    /** The message key for rejecting the decision to save the page.  Value is {@value}. */
+    public static final String SAVE_REJECT_MESSAGE_KEY   = "notification.saveWikiPage.reject";
+    
+    /** The message key of the text to finally approve a page save.  Value is {@value}. */
+    public static final String SAVE_TASK_MESSAGE_KEY     = "task.saveWikiPage";
     
     /** Fact name for storing the page name.  Value is {@value}. */
     public static final String FACT_PAGE_NAME = "fact.pageName";
@@ -91,13 +106,14 @@
     /** Fact name for storing the proposed (edited) text.  Value is {@value}. */
     public static final String FACT_PROPOSED_TEXT = "fact.proposedText";
     
+    /** Fact name for storing whether the user is authenticated or not.  Value is {@value}. */
     public static final String FACT_IS_AUTHENTICATED = "fact.isAuthenticated";
 
     static Logger log = Logger.getLogger( PageManager.class );
 
     private WikiPageProvider m_provider;
 
-    protected HashMap m_pageLocks = new HashMap();
+    protected HashMap<String,PageLock> m_pageLocks = new HashMap<String,PageLock>();
 
     private WikiEngine m_engine;
 
@@ -197,7 +213,7 @@
      *  @return A Collection of WikiPage objects.
      *  @throws ProviderException If the backend has problems.
      */
-    public Collection<WikiPage> getAllPages()
+    public Collection getAllPages()
         throws ProviderException
     {
         return m_provider.getAllPages();
@@ -319,7 +335,7 @@
         {
             fireEvent( WikiPageEvent.PAGE_LOCK, page.getName() ); // prior to or after actual lock?
 
-            lock = (PageLock) m_pageLocks.get( page.getName() );
+            lock = m_pageLocks.get( page.getName() );
 
             if( lock == null )
             {
@@ -377,7 +393,7 @@
 
         synchronized( m_pageLocks )
         {
-            lock = (PageLock)m_pageLocks.get( page.getName() );
+            lock = m_pageLocks.get( page.getName() );
         }
 
         return lock;
@@ -393,13 +409,13 @@
      */
     public List getActiveLocks()
     {
-        ArrayList result = new ArrayList();
+        ArrayList<PageLock> result = new ArrayList<PageLock>();
 
         synchronized( m_pageLocks )
         {
-            for( Iterator i = m_pageLocks.values().iterator(); i.hasNext(); )
+            for( PageLock lock : m_pageLocks.values() )
             {
-                result.add( i.next() );
+                result.add( lock );
             }
         }
 
@@ -436,11 +452,16 @@
             //
             log.info("Repository has been modified externally while fetching info for "+pageName );
 
-            WikiPage p = new WikiPage( m_engine, pageName );
-
-            m_engine.updateReferences( p );
-
             page = m_provider.getPageInfo( pageName, version );
+
+            if( page != null )
+            {
+                m_engine.updateReferences( page );
+            }
+            else
+            {
+                m_engine.getReferenceManager().pageRemoved( new WikiPage(m_engine,pageName) );
+            }
         }
 
         //
@@ -591,6 +612,11 @@
      */
     private class LockReaper extends WikiBackgroundThread
     {
+        /**
+         *  Create a LockReaper for a given engine.
+         *  
+         *  @param engine WikiEngine to own this thread.
+         */
         public LockReaper( WikiEngine engine )
         {
             super( engine, 60 );
@@ -636,9 +662,16 @@
      */
     public static class PreSaveWikiPageTask extends Task
     {
+        private static final long serialVersionUID = 6304715570092804615L;
         private final WikiContext m_context;
         private final String m_proposedText;
 
+        /**
+         *  Creates the task.
+         *  
+         *  @param context The WikiContext
+         *  @param proposedText The text that was just saved.
+         */
         public PreSaveWikiPageTask( WikiContext context, String proposedText )
         {
             super( PRESAVE_TASK_MESSAGE_KEY );
@@ -646,6 +679,10 @@
             m_proposedText = proposedText;
         }
 
+        /**
+         *  {@inheritDoc}
+         */
+        @Override
         public Outcome execute() throws WikiException
         {
             // Retrieve attributes
@@ -694,11 +731,18 @@
      */
     public static class SaveWikiPageTask extends Task
     {
+        private static final long serialVersionUID = 3190559953484411420L;
+
+        /**
+         *  Creates the Task.
+         */
         public SaveWikiPageTask()
         {
             super( SAVE_TASK_MESSAGE_KEY );
         }
 
+        /** {@inheritDoc} */
+        @Override
         public Outcome execute() throws WikiException
         {
             // Retrieve attributes
@@ -741,6 +785,7 @@
     /**
      *  {@inheritDoc}
      */
+    @Override
     public Collection modules()
     {
         // TODO Auto-generated method stub
@@ -825,8 +870,8 @@
         if ( acl != null )
         {
             Enumeration entries = acl.entries();
-            Collection entriesToAdd = new ArrayList();
-            Collection entriesToRemove = new ArrayList();
+            Collection<AclEntry> entriesToAdd    = new ArrayList<AclEntry>();
+            Collection<AclEntry> entriesToRemove = new ArrayList<AclEntry>();
             while ( entries.hasMoreElements() )
             {
                 AclEntry entry = (AclEntry)entries.nextElement();

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageTimeComparator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageTimeComparator.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageTimeComparator.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PageTimeComparator.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
-/* 
+/*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001 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;
 
@@ -29,8 +30,6 @@
  *  <p>
  *  If the lastModified date is the same, then the next key is the page name.
  *  If the page name is also equal, then returns 0 for equality.
- *  
- *  @author jalkanen
  */
 // FIXME: Does not implement equals().
 // FIXME3.0: move to util package
@@ -45,30 +44,30 @@
     /**
      *  {@inheritDoc}
      */
-    public int compare( WikiPage o1, WikiPage o2 )
+    public int compare( WikiPage w1, WikiPage w2 )
     {
-        WikiPage w1 = (WikiPage)o1;
-        WikiPage w2 = (WikiPage)o2;
-        
         if( w1 == null || w2 == null ) 
         {
             log.error( "W1 or W2 is NULL in PageTimeComparator!");
             return 0; // FIXME: Is this correct?
         }
 
-        if( w1.getLastModified() == null )
+        Date w1LastMod = w1.getLastModified();
+        Date w2LastMod = w2.getLastModified();
+
+        if( w1LastMod == null )
         {
             log.error( "NULL MODIFY DATE WITH "+w1.getName() );
             return 0;
         }
-        else if( w2.getLastModified() == null )
+        else if( w2LastMod == null )
         {
             log.error( "NULL MODIFY DATE WITH "+w2.getName() );
             return 0;
         }
 
         // This gets most recent on top
-        int timecomparison = w2.getLastModified().compareTo( w1.getLastModified() );
+        int timecomparison = w2LastMod.compareTo( w1LastMod );
 
         if( timecomparison == 0 )
         {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PropertyReader.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PropertyReader.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PropertyReader.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/PropertyReader.java Sun Aug  3 05:12:47 2008
@@ -41,12 +41,19 @@
 public final class PropertyReader
 {
 
+    private static final String DEFAULT_JSPWIKI_PROPERTIES = "/ini/default_jspwiki.properties";
+
     /** The web.xml parameter that defines where the config file is to be found.
      *  If it is not defined, uses the default as defined by DEFAULT_PROPERTYFILE.
      *  {@value #DEFAULT_PROPERTYFILE}
      */
     public static final String PARAM_PROPERTYFILE = "jspwiki.propertyfile";
 
+    /**
+     *  The prefix when you are cascading properties.  
+     *  
+     *  @see #loadWebAppProps(ServletContext)
+     */
     public static final String PARAM_PROPERTYFILE_CASCADEPREFIX = "jspwiki.propertyfile.cascade.";
 
     /** Path to the default property file.
@@ -54,8 +61,8 @@
      */
     public static final String  DEFAULT_PROPERTYFILE = "/WEB-INF/jspwiki.properties";
 
-    public static final String PARAM_VAR_DECLARATION = "var.";
-    public static final String PARAM_VAR_IDENTIFIER = "$";
+    private static final String PARAM_VAR_DECLARATION = "var.";
+    private static final String PARAM_VAR_IDENTIFIER  = "$";
 
 
     /**
@@ -102,6 +109,9 @@
      *  and so on. You have to number your cascade in a descending way starting
      *  with "1". This means you cannot leave out numbers in your cascade. This
      *  method is based on an idea by Olaf Kaus, see [JSPWiki:MultipleWikis].
+     *  
+     *  @param context A Servlet Context which is used to find the properties
+     *  @return A filled Properties object with all the cascaded properties in place
      */
     public static Properties loadWebAppProps( ServletContext context )
     {
@@ -168,10 +178,28 @@
 
     /**
      *  Returns the default property set as a Properties object.
+     *  
+     *  @return The default property set.
      */
     public static final Properties getDefaultProperties()
     {
-        return new Properties( TextUtil.createProperties( DEFAULT_PROPERTIES ) );
+        Properties props = new Properties( TextUtil.createProperties( DEFAULT_PROPERTIES ) );
+        
+        InputStream in = PropertyReader.class.getResourceAsStream( DEFAULT_JSPWIKI_PROPERTIES );
+        
+        if( in != null )
+        {
+            try
+            {
+                props.load( in );
+            }
+            catch( IOException e )
+            {
+                System.err.println("Unable to load default propertyfile '"+DEFAULT_JSPWIKI_PROPERTIES+"'"+e.getMessage());
+            }
+        }
+        
+        return props;
     }
 
 
@@ -275,7 +303,7 @@
     public static void expandVars(Properties properties)
     {
         //get variable name/values from properties...
-        Map vars = new HashMap();
+        Map<String,String> vars = new HashMap<String,String>();
         Enumeration propertyList = properties.propertyNames();
         while( propertyList.hasMoreElements() )
         {
@@ -323,4 +351,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/QueryItem.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/QueryItem.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/QueryItem.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/QueryItem.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
-/* 
+/*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2002 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;
 
@@ -23,8 +24,8 @@
  *  This simple class just fulfils the role of a container
  *  for searches.  It tells the word and whether it is requested or not.
  *
- *  @author Janne Jalkanen
  */
+// FIXME3.0: This should be moved to the search-package, as well as properly rewritten as a bean.
 public class QueryItem
 {
     /** The word is required to be in the pages */

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ReferenceManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ReferenceManager.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ReferenceManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ReferenceManager.java Sun Aug  3 05:12:47 2008
@@ -1,22 +1,22 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2004 Janne Jalkanen (Janne.Jalkanen@iki.fi),
-                            Erik Bunn (ebu@memecry.net)
-
-    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;
 
@@ -121,8 +121,8 @@
      *  must contain Strings. The Collection may contain names of non-existing
      *  pages.
      */
-    private Map<String,Set<String>> m_refersTo;
-    private Map<String,Set<String>> m_unmutableRefersTo;
+    private Map<String,Collection<String>> m_refersTo;
+    private Map<String,Collection<String>> m_unmutableRefersTo;
 
     /** Maps page wikiname to a Set of referring pages. The Set must
      *  contain Strings. Non-existing pages (a reference exists, but not a file
@@ -142,7 +142,7 @@
     private static final String SERIALIZATION_DIR  = "refmgr-attr";
 
     /** We use this also a generic serialization id */
-    private static final long serialVersionUID = 2L;
+    private static final long serialVersionUID = 4L;
 
     /**
      *  Builds a new ReferenceManager.
@@ -151,7 +151,7 @@
      */
     public ReferenceManager( WikiEngine engine )
     {
-        m_refersTo   = new HashMap<String,Set<String>>();
+        m_refersTo   = new HashMap<String,Collection<String>>();
         m_referredBy = new HashMap<String,Set<String>>();
         m_engine = engine;
 
@@ -169,6 +169,7 @@
     /**
      *  Does a full reference update.  Does not sync; assumes that you do it afterwards.
      */
+    @SuppressWarnings("unchecked")
     private void updatePageReferences( WikiPage page )
         throws ProviderException
     {
@@ -179,11 +180,11 @@
         Collection<String> links = m_engine.scanWikiLinks( page, content );
 
         res.addAll( links );
-        Collection<Attachment> attachments = m_engine.getAttachmentManager().listAttachments( page );
+        Collection attachments = m_engine.getAttachmentManager().listAttachments( page );
 
-        for( Attachment atti : attachments )
+        for( Iterator atti = attachments.iterator(); atti.hasNext(); )
         {
-            res.add( atti.getName() );
+            res.add( ((Attachment)(atti.next())).getName() );
         }
 
         internalUpdateReferences( page.getName(), res );
@@ -196,8 +197,9 @@
      *  @param pages A collection of all pages you want to be included in the reference
      *               count.
      *  @since 2.2
+     *  @throws ProviderException If reading of pages fail.
      */
-    public void initialize( Collection<WikiPage> pages )
+    public void initialize( Collection pages )
         throws ProviderException
     {
         log.debug( "Initializing new ReferenceManager with "+pages.size()+" initial pages." );
@@ -222,8 +224,10 @@
             //
             long saved = unserializeFromDisk();
 
-            for( WikiPage page : pages )
+            for( Iterator it = pages.iterator(); it.hasNext(); )
             {
+                WikiPage page = (WikiPage) it.next();
+
                 unserializeAttrsFromDisk( page );
             }
 
@@ -233,11 +237,11 @@
             //  the references for them.
             //
 
-            Iterator<WikiPage> it = pages.iterator();
+            Iterator it = pages.iterator();
 
             while( it.hasNext() )
             {
-                WikiPage page = it.next();
+                WikiPage page = (WikiPage) it.next();
 
                 if( page instanceof Attachment )
                 {
@@ -267,10 +271,10 @@
             buildKeyLists( pages );
 
             // Scan the existing pages from disk and update references in the manager.
-            Iterator<WikiPage> it = pages.iterator();
+            Iterator it = pages.iterator();
             while( it.hasNext() )
             {
-                WikiPage page  = it.next();
+                WikiPage page  = (WikiPage)it.next();
 
                 if( page instanceof Attachment )
                 {
@@ -300,6 +304,7 @@
      *  Reads the serialized data from the disk back to memory.
      *  Returns the date when the data was last written on disk
      */
+    @SuppressWarnings("unchecked")
     private synchronized long unserializeFromDisk()
         throws IOException,
                ClassNotFoundException
@@ -324,8 +329,8 @@
             }
 
             saved        = in.readLong();
-            m_refersTo   = (Map<String,Set<String>>) in.readObject();
-            m_referredBy = (Map<String,Set<String>>) in.readObject();
+            m_refersTo   = (Map) in.readObject();
+            m_referredBy = (Map) in.readObject();
 
             in.close();
 
@@ -337,11 +342,7 @@
         }
         finally
         {
-            try
-            {
-                if( in != null ) in.close();
-            }
-            catch( IOException ex ) {}
+            if( in != null ) in.close();
         }
 
         return saved;
@@ -470,6 +471,7 @@
 
             sw.stop();
             log.debug("Read serialized data for "+name+" successfully in "+sw);
+            p.setHasMetadata();
         }
         catch( NoSuchAlgorithmException e )
         {
@@ -477,11 +479,7 @@
         }
         finally
         {
-            try
-            {
-                if( in != null ) in.close();
-            }
-            catch( IOException ex ) {}
+            if( in != null ) in.close();
         }
 
         return saved;
@@ -499,7 +497,7 @@
             // FIXME: There is a concurrency issue here...
             Set entries = p.getAttributes().entrySet();
 
-            if( entries.size() == 0 ) return;
+            // if( entries.size() == 0 ) return;
 
             StopWatch sw = new StopWatch();
             sw.start();
@@ -556,6 +554,9 @@
 
     /**
      *  After the page has been saved, updates the reference lists.
+     *  
+     *  @param context {@inheritDoc}
+     *  @param content {@inheritDoc}
      */
     public void postSave( WikiContext context, String content )
     {
@@ -592,10 +593,10 @@
 
         if( refTo != null )
         {
-            Iterator it_refTo = refTo.iterator();
-            while( it_refTo.hasNext() )
+            Iterator itRefTo = refTo.iterator();
+            while( itRefTo.hasNext() )
             {
-                String referredPageName = (String)it_refTo.next();
+                String referredPageName = (String)itRefTo.next();
                 Set<String> refBy = m_referredBy.get( referredPageName );
 
                 if( refBy == null )
@@ -654,7 +655,7 @@
      *  @param page Name of the page to update.
      *  @param references A Collection of Strings, each one pointing to a page this page references.
      */
-    public synchronized void updateReferences( String page, Collection<String> references )
+    public synchronized void updateReferences( String page, Collection references )
     {
         internalUpdateReferences(page, references);
 
@@ -672,19 +673,21 @@
      *  @param references A Collection of Strings, each one pointing to a page this page references.
      */
 
-    private void internalUpdateReferences(String page, Collection<String> references)
+    private void internalUpdateReferences(String page, Collection references)
     {
         page = getFinalPageName( page );
 
         //
         // Create a new entry in m_refersTo.
         //
-        Collection<String> oldRefTo = m_refersTo.get( page );
+        Collection oldRefTo = m_refersTo.get( page );
         m_refersTo.remove( page );
 
         TreeSet<String> cleanedRefs = new TreeSet<String>();
-        for( String ref : references )
+        for( Iterator i = references.iterator(); i.hasNext(); )
         {
+            String ref = (String)i.next();
+
             ref = getFinalPageName( ref );
 
             cleanedRefs.add( ref );
@@ -712,14 +715,18 @@
         //
         //  Notify all referred pages of their referinesshoodicity.
         //
-        for( String referredPageName : cleanedRefs )
+        Iterator<String> it = cleanedRefs.iterator();
+        while( it.hasNext() )
         {
+            String referredPageName = it.next();
             updateReferredBy( getFinalPageName(referredPageName), page );
         }
     }
 
     /**
      * Returns the refers-to list. For debugging.
+     * 
+     * @return The refers-to list.
      */
     protected Map getRefersTo()
     {
@@ -728,6 +735,8 @@
 
     /**
      * Returns the referred-by list. For debugging.
+     * 
+     * @return Referred-by lists.
      */
     protected Map getReferredBy()
     {
@@ -738,8 +747,8 @@
      * Cleans the 'referred by' list, removing references by 'referrer' to
      * any other page. Called after 'referrer' is removed.
      */
-    private void cleanReferredBy( String referrer, 
-                                  Collection<String> oldReferred,
+    private void cleanReferredBy( String referrer,
+                                  Collection oldReferred,
                                   Collection<String> newReferred )
     {
         // Two ways to go about this. One is to look up all pages previously
@@ -753,9 +762,11 @@
         if( oldReferred == null )
             return;
 
-        for( String referredPage : oldReferred )
+        Iterator it = oldReferred.iterator();
+        while( it.hasNext() )
         {
-            Set<String> oldRefBy = m_referredBy.get( referredPage );
+            String referredPage = (String)it.next();
+            Set oldRefBy = m_referredBy.get( referredPage );
             if( oldRefBy != null )
             {
                 oldRefBy.remove( referrer );
@@ -785,7 +796,7 @@
      *
      * @param pages   a Collection containing WikiPage objects.
      */
-    private synchronized void buildKeyLists( Collection<WikiPage> pages )
+    private synchronized void buildKeyLists( Collection pages )
     {
         m_refersTo.clear();
         m_referredBy.clear();
@@ -793,14 +804,16 @@
         if( pages == null )
             return;
 
+        Iterator it = pages.iterator();
         try
         {
-            for( WikiPage page : pages )
+            while( it.hasNext() )
             {
+                WikiPage page = (WikiPage)it.next();
                 // We add a non-null entry to referredBy to indicate the referred page exists
                 m_referredBy.put( page.getName(), new TreeSet<String>() );
                 // Just add a key to refersTo; the keys need to be in sync with referredBy.
-                m_refersTo.put( page.getName(), (TreeSet<String>)null );
+                m_refersTo.put( page.getName(), null );
             }
         }
         catch( ClassCastException e )
@@ -868,9 +881,9 @@
 
         if( c != null )
         {
-            for( Iterator<String> i = c.iterator(); i.hasNext(); )
+            for( String key : c )
             {
-                Collection<String> dref = m_referredBy.get( i.next() );
+                Collection<?> dref = m_referredBy.get( key );
 
                 dref.remove( pagename );
             }
@@ -887,18 +900,17 @@
     /**
      *  Finds all unreferenced pages. This requires a linear scan through
      *  m_referredBy to locate keys with null or empty values.
+     *  
+     *  @return The Collection of Strings
      */
-    public synchronized Collection<String> findUnreferenced()
+    public synchronized Collection findUnreferenced()
     {
-        List<String> unref = new ArrayList<String>();
-
-        Iterator<String> it = m_referredBy.keySet().iterator();
+        ArrayList<String> unref = new ArrayList<String>();
 
-        while( it.hasNext() )
+        for( String key : m_referredBy.keySet() )
         {
-            String key = it.next();
-            //Set refs = (Set) m_referredBy.get( key );
-            Set refs = getReferenceList( m_referredBy, key );
+            Set<?> refs = getReferenceList( m_referredBy, key );
+            
             if( refs == null || refs.isEmpty() )
             {
                 unref.add( key );
@@ -918,19 +930,23 @@
      * Returns a Collection containing Strings of unreferenced page names.
      * Each non-existant page name is shown only once - we don't return information
      * on who referred to it.
+     * 
+     * @return A Collection of Strings
      */
-    public synchronized Collection<String> findUncreated()
+    public synchronized Collection findUncreated()
     {
-        Set<String> uncreated = new TreeSet<String>();
+        TreeSet<String> uncreated = new TreeSet<String>();
 
         // Go through m_refersTo values and check that m_refersTo has the corresponding keys.
         // We want to reread the code to make sure our HashMaps are in sync...
 
-        for( Collection<String> refs : m_refersTo.values())
+        Collection<Collection<String>> allReferences = m_refersTo.values();
+
+        for( Collection<String> refs : allReferences )
         {
             if( refs != null )
             {
-                for ( String aReference : refs )
+                for( String aReference : refs )
                 {
                     if( m_engine.pageExists( aReference ) == false )
                     {
@@ -944,18 +960,24 @@
     }
 
     /**
-     *  Searches for the given page in the given Map.
+     *  Searches for the given page in the given Map, and returns
+     *  the set of references.  This method also takes care of English plural
+     *  matching.
+     *  
+     *  @param coll The Map to search in
+     *  @param pagename The name to find.
+     *  @return The references list.
      */
-    private Set<String> getReferenceList( Map<String,Set<String>> coll, String pagename )
+    private <T> Set<T> getReferenceList( Map<String,Set<T>> coll, String pagename )
     {
-        Set<String> refs = coll.get( pagename );
+        Set<T> refs = coll.get( pagename );
 
         if( m_matchEnglishPlurals )
         {
             //
             //  We'll add also matches from the "other" page.
             //
-            Set<String> refs2;
+            Set<T> refs2;
 
             if( pagename.endsWith("s") )
             {
@@ -988,7 +1010,7 @@
      *         does not exist, or if it has no references.
      */
     // FIXME: Return a Set instead of a Collection.
-    public synchronized Collection<String> findReferrers( String pagename )
+    public synchronized Collection findReferrers( String pagename )
     {
         Set<String> refs = getReferenceList( m_referredBy, pagename );
 
@@ -1040,7 +1062,7 @@
      *         been indexed yet.
      * @since 2.2.33
      */
-    public Collection<String> findRefersTo( String pageName )
+    public Collection findRefersTo( String pageName )
     {
         return m_unmutableRefersTo.get( getFinalPageName(pageName) );
     }
@@ -1056,12 +1078,12 @@
      *         ReferenceManager
      * @since 2.3.24
      */
-    /*
-       This method traps and retries if a concurrent
-       modifcaition occurs.
-       TODO: It is unnecessary to calculate the hashcode; it should be calculated only
-             when the hashmaps are changed.  This is slow.
-    */
+    //
+    //   This method traps and retries if a concurrent
+    //   modifcaition occurs.
+    //   TODO: It is unnecessary to calculate the hashcode; it should be calculated only
+    //         when the hashmaps are changed.  This is slow.
+    //
     public int deepHashCode()
     {
         boolean failed = true;
@@ -1095,7 +1117,7 @@
      *  @return A Set of all defined page names that ReferenceManager knows about.
      *  @since 2.3.24
      */
-    public Set<String> findCreated()
+    public Set findCreated()
     {
         return new HashSet<String>( m_refersTo.keySet() );
     }
@@ -1118,6 +1140,9 @@
         }
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public void actionPerformed(WikiEvent event)
     {
         if( (event instanceof WikiPageEvent) && (event.getType() == WikiPageEvent.PAGE_DELETED) )

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/Release.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/Release.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
 /*
     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;
@@ -36,7 +37,6 @@
  *  to the CVS history, it dates from 6.7.2001, and it really hasn't changed
  *  much since.
  *  </p>
- *  @author Janne Jalkanen
  *  @since  1.0
  */
 public final class Release
@@ -57,16 +57,16 @@
      *  <p>
      *  If the POSTFIX is empty, it is not added to the version string.
      */
-    private static final String    POSTFIX       = "svn";
+    private static final String    POSTFIX       = "alpha";
 
     /** The JSPWiki major version. */
     public static final int        VERSION       = 2;
 
     /** The JSPWiki revision. */
-    public static final int        REVISION      = 6;
+    public static final int        REVISION      = 7;
 
     /** The minor revision.  */
-    public static final int        MINORREVISION = 2;
+    public static final int        MINORREVISION = 0;
 
     /** The build number/identifier.  This is a String as opposed to an integer, just
      *  so that people can add other identifiers to it.  The build number is incremented
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "2";
+    public static final String     BUILD         = "5";
     
     /**
      *  This is the generic version string you should use
@@ -190,4 +190,4 @@
     {
         System.out.println(VERSTR);
     }
-}
\ No newline at end of file
+}

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchMatcher.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchMatcher.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchMatcher.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchMatcher.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001 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;
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchResultComparator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchResultComparator.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchResultComparator.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/SearchResultComparator.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
-/* 
+/*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001 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;
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/StringTransmutator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/StringTransmutator.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/StringTransmutator.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/StringTransmutator.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
-/* 
+/*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
+    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
 
-    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.
+       http://www.apache.org/licenses/LICENSE-2.0
 
-    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
+    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;
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/TextUtil.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/TextUtil.java?rev=682139&r1=682138&r2=682139&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/TextUtil.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/TextUtil.java Sun Aug  3 05:12:47 2008
@@ -1,21 +1,22 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001-2002 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;
 
@@ -345,6 +346,39 @@
 
         return buf.toString();
     }
+    
+    /**
+     *  Replaces a string with an other string. Case insensitive matching is used
+     *
+     *  @param orig Original string.  Null is safe.
+     *  @param src  The string to find.
+     *  @param dest The string to replace <I>src</I> with.
+     *  @return A string with all instances of src replaced with dest.
+     */
+    public static String replaceStringCaseUnsensitive( String orig, String src, String dest )
+    {
+        if( orig == null ) return null;
+
+        StringBuffer res = new StringBuffer();
+        int start        = 0;
+        int end          = 0;
+        int last         = 0;
+        
+        String origCaseUnsn = orig.toLowerCase();
+        String srcCaseUnsn = src.toLowerCase();
+
+        while( (start = origCaseUnsn.indexOf(srcCaseUnsn, end)) != -1 )
+        {
+            res.append( orig.substring( last, start ) );
+            res.append( dest );
+            end  = start+src.length();
+            last = start+src.length();
+        }
+
+        res.append( orig.substring( end ) );
+
+        return res.toString();
+    }
 
     /**
      *  Parses an integer parameter, returning a default value