net.fckeditor.handlers
Class ResourceType

java.lang.Object
  extended by net.fckeditor.handlers.ResourceType

public class ResourceType
extends Object

File Browser resource types. The File Browser provides a specific resource type for each and every request. This class is intended to reflect these in an Enum-like manner.

The resource types are:

Version:
$Id: ResourceType.java 4785 2009-12-21 20:10:28Z mosipov $

Field Summary
static ResourceType FILE
          Resource type File
static ResourceType FLASH
          Resource type Flash
static ResourceType IMAGE
          Resource type Image
static ResourceType MEDIA
          Resource type Media
 
Method Summary
 boolean equals(Object obj)
          Compares the specified object with this resource type for equality.
 Set<String> getAllowedEextensions()
          Returns a read-only reference to the allowed extensions set.
static ResourceType getDefaultResourceType(String name)
          Returns the resource type constant with the specified name.
 Set<String> getDeniedExtensions()
          Returns a read-only reference to the denied extensions set.
 String getName()
          Returns the name of this resource type.
 String getPath()
          Returns the absolute path of this resource type.
static ResourceType getResourceType(String name)
          Returns the resource type constant with the specified name.
 int hashCode()
          Returns the hash code value for this resource type.
 boolean isAllowedExtension(String extension)
          Returns true if extension is allowed.
 boolean isDeniedExtension(String extension)
          Returns true if extension is denied.
static boolean isValidType(String name)
          Returns true if name represents a valid resource type constant.
static ResourceType valueOf(String name)
          Returns the resource type constant with the specified name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE

public static final ResourceType FILE
Resource type File


FLASH

public static final ResourceType FLASH
Resource type Flash


IMAGE

public static final ResourceType IMAGE
Resource type Image


MEDIA

public static final ResourceType MEDIA
Resource type Media

Method Detail

getName

public String getName()
Returns the name of this resource type.

Returns:
the name of this resource type

getPath

public String getPath()
Returns the absolute path of this resource type. This path is absolute to the userfiles path. To set this path, see the configuration.

Returns:
the absolute path of this resource type

getAllowedEextensions

public Set<String> getAllowedEextensions()
Returns a read-only reference to the allowed extensions set.

Returns:
the read-only allowed extensions set of this resource type

getDeniedExtensions

public Set<String> getDeniedExtensions()
Returns a read-only reference to the denied extensions set.

Returns:
the read-only denied extensions set of this resource type

valueOf

public static ResourceType valueOf(String name)
Returns the resource type constant with the specified name.

Parameters:
name - the name of the constant to return
Returns:
the resource type constant with the specified name
Throws:
IllegalArgumentException - if this class has no constant with the specified name
NullPointerException - if name is null or empty

isValidType

public static boolean isValidType(String name)
Returns true if name represents a valid resource type constant.

Parameters:
name - the resource type to check
Returns:
true if name represents a valid resource type, else false

getResourceType

public static ResourceType getResourceType(String name)
Returns the resource type constant with the specified name. In contrast to valueOf(String) it returns a null instead of throwing an exception if a resource type constant was not found.

Parameters:
name - the name of the constant to return
Returns:
the resource type constant with the specified name, else null

getDefaultResourceType

public static ResourceType getDefaultResourceType(String name)
Returns the resource type constant with the specified name. In contrast to getResourceType(String) it returns FILE instead of returning null.

Parameters:
name - the name of the constant to return
Returns:
the resource type constant with the specified name, else FILE

isAllowedExtension

public boolean isAllowedExtension(String extension)
Returns true if extension is allowed. Denied extensions set takes precedence over allowed extensions set, in other words a negative check is made against denied set and if this fails, allowed set is checked.

Parameters:
extension - the extension to check, empty will fail
Returns:
true if extension is allowed, else false

isDeniedExtension

public boolean isDeniedExtension(String extension)
Returns true if extension is denied. This method simply negates isAllowedExtension(String).

Parameters:
extension - the extension to check, empty will fail
Returns:
true if extension is denied, else false

equals

public boolean equals(Object obj)
Compares the specified object with this resource type for equality. The comparison is based on class and name only.

Overrides:
equals in class Object
Parameters:
obj - Object to be compared with this resource type.
Returns:
true if the specified object is equal to this resource type

hashCode

public int hashCode()
Returns the hash code value for this resource type. The hash code equals the hash code of the name field.

Overrides:
hashCode in class Object
Returns:
the hash code value for this resource type


Copyright © 2004-2010 Frederico Caldeira Knabben. All Rights Reserved.