[jboss-cvs] JBossAS SVN: r98527 - projects/javaee/tags/jboss-javaee-parent-6.0.0-alpha-1/jboss-jacc-api/src/main/javax/security/jacc.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 22 12:27:12 EST 2009
Author: jaikiran
Date: 2009-12-22 12:27:11 -0500 (Tue, 22 Dec 2009)
New Revision: 98527
Removed:
projects/javaee/tags/jboss-javaee-parent-6.0.0-alpha-1/jboss-jacc-api/src/main/javax/security/jacc/URLPattern.java
Log:
Autoversioning commit: a non-deltaV client made a change to
/projects/javaee/tags/jboss-javaee-parent-6.0.0-alpha-1/jboss-jacc-api/src/main/javax/security/jacc/URLPattern.java
Deleted: projects/javaee/tags/jboss-javaee-parent-6.0.0-alpha-1/jboss-jacc-api/src/main/javax/security/jacc/URLPattern.java
===================================================================
--- projects/javaee/tags/jboss-javaee-parent-6.0.0-alpha-1/jboss-jacc-api/src/main/javax/security/jacc/URLPattern.java 2009-12-22 17:27:04 UTC (rev 98526)
+++ projects/javaee/tags/jboss-javaee-parent-6.0.0-alpha-1/jboss-jacc-api/src/main/javax/security/jacc/URLPattern.java 2009-12-22 17:27:11 UTC (rev 98527)
@@ -1,151 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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 javax.security.jacc;
-
-/** The representation of a URLPattern in the WebResourcePermission and
- * WebUserDataPermission URLPatternSpecs.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revison:$
- */
-class URLPattern
-{
- /** the '/' pattern */
- static final int DEFAULT = 0;
- /** the '/*' pattern */
- static final int THE_PATH_PREFIX = 1;
- /** a '/.../*' pattern */
- static final int PATH_PREFIX = 2;
- /** a '*.xxx' pattern */
- static final int EXTENSION = 3;
- /** an exact pattern */
- static final int EXACT = 4;
-
- private String pattern;
- private String ext;
- private int length;
- private int type = -1;
-
- URLPattern(String pattern)
- {
- this.pattern = pattern;
- length = pattern.length();
- if( pattern.equals("/") )
- type = DEFAULT;
- else if( pattern.startsWith("/*") )
- type = THE_PATH_PREFIX;
- else if( length > 0 && pattern.charAt(0) == '/' && pattern.endsWith("/*") )
- type = PATH_PREFIX;
- else if( pattern.startsWith("*.") )
- {
- type = EXTENSION;
- ext = pattern.substring(1);
- }
- else
- type = EXACT;
- }
-
- /** The matching rules from the WebResourcePermission implies:
-
- 1. their pattern values are String equivalent, or
- 2. this pattern is the path-prefix pattern "/*", or
- 3. this pattern is a path-prefix pattern (that is, it starts with "/" and ends
- with "/*") and the argument pattern starts with the substring of this
- pattern, minus its last 2 characters, and the next character of the
- argument pattern, if there is one, is "/", or
- 4. this pattern is an extension pattern (that is, it starts with "*.") and the
- argument pattern ends with this pattern, or
- 5. the reference pattern is the special default pattern, "/", which matches all
- argument patterns.
- */
- boolean matches(URLPattern url)
- {
- return matches(url.pattern);
- }
-
- boolean matches(String urlPattern)
- {
- // 2 or 5
- if( type == DEFAULT || type == THE_PATH_PREFIX )
- return true;
-
- // 4, extension pattern
- if( type == EXTENSION && urlPattern.endsWith(ext) )
- return true;
-
- // 3. a path-prefix pattern
- if( type == PATH_PREFIX )
- {
- if( urlPattern.regionMatches(0,pattern, 0, length-2) )
- {
- int last = length - 2;
- if( urlPattern.length() > last && urlPattern.charAt(last) != '/' )
- return false;
- return true;
- }
- return false;
- }
-
- // 1. pattern values are String equivalent for exact pattern
- if( pattern.equals(urlPattern) )
- return true;
-
- return false;
- }
-
- String getPattern()
- {
- return pattern;
- }
- boolean isDefault()
- {
- return type == DEFAULT;
- }
- boolean isExact()
- {
- return type == EXACT;
- }
- boolean isExtension()
- {
- return type == EXTENSION;
- }
- boolean isPrefix()
- {
- return type == THE_PATH_PREFIX || type == PATH_PREFIX;
- }
-
- public int hashCode()
- {
- return pattern.hashCode();
- }
-
- boolean equals(URLPattern p)
- {
- boolean equals = type == p.type;
- if( equals )
- {
- equals = pattern.equals(p.pattern);
- }
- return equals;
- }
-
-}
More information about the jboss-cvs-commits
mailing list