Author: julien(a)jboss.com
Date: 2006-11-22 10:02:09 -0500 (Wed, 22 Nov 2006)
New Revision: 5711
Removed:
trunk/core/src/main/org/jboss/portal/core/util/RewriteHelper.java
Log:
removed unused code
Deleted: trunk/core/src/main/org/jboss/portal/core/util/RewriteHelper.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/util/RewriteHelper.java 2006-11-22 15:01:12
UTC (rev 5710)
+++ trunk/core/src/main/org/jboss/portal/core/util/RewriteHelper.java 2006-11-22 15:02:09
UTC (rev 5711)
@@ -1,103 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This 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 software 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 software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.util;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Rewrite helper class. <p>This class features a set of methods to rewrite markup
content with unique identifiers. It
- * can be used for WSRP consumer rewrite. The default implementation of all methods
replaces the 'wsrp_rewrite_' token
- * with the provided prefix token.</p>
- *
- * @author <a href="mailto:mholzner@novell.com>Martin Holzner</a>
- * @version $LastChangedRevision$, $LastChangedDate$
- */
-public final class RewriteHelper
-{
-
- private static Pattern WSRP_REWRITE_TOKEN =
Pattern.compile("wsrp_rewrite_");
-
- /**
- * Constant to signal in a portlet that rewrite is requested. <p>A portlet can
set this flag as a response property
- * (set to "true") to signal to the theme layer that the content needs to be
rewritten. If the flag is set the theme
- * layer will detect it and replace all 'wsrp_rewite_' tokens with the
provided prefix</p>
- */
- public static final String REWRITE_FLAG = "WSRP_REWRITE";
-
- /**
- * Constant to set a prefix value to use during the rewrite. <p>This prefix is
equivalent to the producer write
- * paradigm defined in WSRP. The portlet can set any arbitrary value to use for the
rewrite, by providing this token
- * as a response property. It is up to the portlet to decide where to get the value
from.</p>
- */
- public static final String NAMESPACE_PREFIX = "WSRP_NAMESPACE_PREFIX";
-
- /**
- * Constant to set the content that should be injected into the HEAD tag of the pages
markup. <p>The content set in a
- * portlet response property with this flag will be injected into the HEAD tag, if the
portal layout features the
- * headercontent tag.</p>
- */
- public static final String HEADER_CONTENT = "HEADER_CONTENT";
-
- /**
- * Rewrite the content. <p>Rewrite the provided content by parsing for the
'wsrp_rewrite_' token and replacing it
- * with the provided <code>prefix</code>.</p>
- *
- * @param content the content to parse and potentially rewrite
- * @param prefix the replacement string for the 'wsrp_rewrite_' token(s)
- * @return the rewritten content
- */
- public static String wsrpRewriteContent(String content, String prefix)
- {
- return rewriteContent(WSRP_REWRITE_TOKEN, content, prefix);
- }
-
- /**
- * Rewrite the content. <p>Rewrite the provided content by parsing for the
provided pattern, and replacing each
- * occurence with the provided prefix.</p>
- *
- * @param pattern the compiled regular expression to parse the content for
- * @param content the content to parse and potentially rewrite
- * @param prefix the replacement string for the 'wsrp_rewrite_' token(s)
- * @return the rewritten content
- * @see java.util.regex.Pattern#compile()
- */
- public static String rewriteContent(Pattern pattern, String content, String prefix)
- {
- if (pattern == null)
- {
- throw new IllegalArgumentException("pattern cannot be null");
- }
- if (content == null)
- {
- throw new IllegalArgumentException("content cannot be null");
- }
- // We allow an empty token to rewrite , or do we ?
- if (prefix == null)
- {
- throw new IllegalArgumentException("prefix cannot be null");
- }
- Matcher match = pattern.matcher(content);
- return match.replaceAll(prefix);
- }
-}