org.apache.naming.resources

## Class ResourceAttributes

- java.lang.Object
- - org.apache.naming.resources.ResourceAttributes

All Implemented Interfaces:
  Serializable, Cloneable, Attributes

Direct Known Subclasses:
  FileDirContext.FileResourceAttributes

    public class ResourceAttributes
    extends Object
    implements Attributes

Attributes implementation.

Author:
  Remy Maucherat
See Also:
  Serialized Form

### Field Summary

Fields
`static String` `ALTERNATE_CONTENT_LENGTH` Content length.
`static String` `ALTERNATE_CREATION_DATE` Creation date.
`static String` `ALTERNATE_ETAG` ETag.
`static String` `ALTERNATE_LAST_MODIFIED` Last modification date.
`static String` `ALTERNATE_TYPE` Type.
`protected Attributes` `attributes` External attributes.
`protected boolean` `collection` Collection flag.
`static String` `COLLECTION_TYPE` Collection type.
`static String` `CONTENT_LENGTH` Content length.
`static String` `CONTENT_TYPE` MIME type of the content.
`protected long` `contentLength` Content length.
`protected long` `creation` Creation time.
`static String` `CREATION_DATE` Creation date.
`protected Date` `creationDate` Creation date.
`static String` `ETAG` ETag.
`protected static SimpleDateFormat` `format` HTTP date format.
`protected static SimpleDateFormat[]` `formats` Date formats using for Date parsing.
`protected static TimeZone` `gmtZone`
`static String` `LAST_MODIFIED` Last modification date.
`protected long` `lastModified` Last modified time.
`protected Date` `lastModifiedDate` Last modified date.
`protected String` `lastModifiedHttp` Last modified date in HTTP format.
`protected String` `mimeType` MIME type.
`protected String` `name` Name.
`static String` `NAME` Name.
`protected String` `strongETag` Strong ETag.
`static String` `TYPE` Type.
`protected String` `weakETag` Weak ETag.

### Constructor Summary

Constructors
Constructor and Description
`ResourceAttributes()` Default constructor.
`ResourceAttributes(Attributes attributes)` Merges with another attribute set.

### Method Summary

Methods
`Object` `clone()` Clone the attributes object (WARNING: fake cloning).
`Attribute` `get(String attrID)` Get attribute.
`NamingEnumeration<? extends Attribute>` `getAll()` Get all attributes.
`String` `getCanonicalPath()` Return the canonical path of the resource, to possibly be used for direct file serving.
`long` `getContentLength()` Get content length.
`long` `getCreation()` Get creation time.
`Date` `getCreationDate()` Get creation date.
`String` `getETag()` Get ETag.
`NamingEnumeration<String>` `getIDs()` Get all attribute IDs.
`long` `getLastModified()` Get last modified time.
`Date` `getLastModifiedDate()` Get lastModified date.
`String` `getLastModifiedHttp()`
`String` `getMimeType()`
`String` `getName()` Get name.
`String` `getResourceType()` Get resource type.
`boolean` `isCaseIgnored()` Case sensitivity.
`boolean` `isCollection()` Is collection.
`Attribute` `put(Attribute attribute)` Put attribute.
`Attribute` `put(String attrID, Object val)` Put attribute.
`Attribute` `remove(String attrID)` Remove attribute.
`void` `setCollection(boolean collection)` Set collection flag.
`void` `setContentLength(long contentLength)` Set content length.
`void` `setCreation(long creation)` Deprecated. - unused
`void` `setCreationDate(Date creationDate)` Creation date mutator.
`void` `setETag(String eTag)` Set strong ETag.
`void` `setLastModified(long lastModified)` Set last modified.
`void` `setLastModifiedDate(Date lastModifiedDate)` Deprecated. - unused
`void` `setLastModifiedHttp(String lastModifiedHttp)` Deprecated. - unused
`void` `setMimeType(String mimeType)`
`void` `setName(String name)` Set name.
`void` `setResourceType(String resourceType)` Type mutator.
`int` `size()` Retrieves the number of attributes in the attribute set.

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### CREATION_DATE

    public static final String CREATION_DATE

Creation date.

See Also:
  Constant Field Values

#### ALTERNATE_CREATION_DATE

    public static final String ALTERNATE_CREATION_DATE

Creation date.

See Also:
  Constant Field Values

#### LAST_MODIFIED

    public static final String LAST_MODIFIED

Last modification date.

See Also:
  Constant Field Values

#### ALTERNATE_LAST_MODIFIED

    public static final String ALTERNATE_LAST_MODIFIED

Last modification date.

See Also:
  Constant Field Values

#### NAME

    public static final String NAME

Name.

See Also:
  Constant Field Values

#### TYPE

    public static final String TYPE

Type.

See Also:
  Constant Field Values

#### ALTERNATE_TYPE

    public static final String ALTERNATE_TYPE

Type.

See Also:
  Constant Field Values

#### CONTENT_TYPE

    public static final String CONTENT_TYPE

MIME type of the content.

See Also:
  Constant Field Values

#### CONTENT_LENGTH

    public static final String CONTENT_LENGTH

Content length.

See Also:
  Constant Field Values

#### ALTERNATE_CONTENT_LENGTH

    public static final String ALTERNATE_CONTENT_LENGTH

Content length.

See Also:
  Constant Field Values

#### ETAG

    public static final String ETAG

ETag.

See Also:
  Constant Field Values

#### ALTERNATE_ETAG

    public static final String ALTERNATE_ETAG

ETag.

See Also:
  Constant Field Values

#### COLLECTION_TYPE

    public static final String COLLECTION_TYPE

Collection type.

See Also:
  Constant Field Values

#### format

    protected static final SimpleDateFormat format

HTTP date format.

#### formats

    protected static final SimpleDateFormat[] formats

Date formats using for Date parsing.

#### gmtZone

    protected static final TimeZone gmtZone

#### collection

    protected boolean collection

Collection flag.

#### contentLength

    protected long contentLength

Content length.

#### creation

    protected long creation

Creation time.

#### creationDate

    protected Date creationDate

Creation date.

#### lastModified

    protected long lastModified

Last modified time.

#### lastModifiedDate

    protected Date lastModifiedDate

Last modified date.

#### lastModifiedHttp

    protected String lastModifiedHttp

Last modified date in HTTP format.

#### mimeType

    protected String mimeType

MIME type.

#### name

    protected String name

Name.

#### weakETag

    protected String weakETag

Weak ETag.

#### strongETag

    protected String strongETag

Strong ETag.

#### attributes

    protected Attributes attributes

External attributes.

### Constructor Detail

#### ResourceAttributes

    public ResourceAttributes()

Default constructor.

#### ResourceAttributes

    public ResourceAttributes(Attributes attributes)

Merges with another attribute set.

### Method Detail

#### isCollection

    public boolean isCollection()

Is collection.

#### setCollection

    public void setCollection(boolean collection)

Set collection flag.

Parameters:
  `collection` - New flag value

#### getContentLength

    public long getContentLength()

Get content length.

Returns:
  content length value

#### setContentLength

    public void setContentLength(long contentLength)

Set content length.

Parameters:
  `contentLength` - New content length value

#### getCreation

    public long getCreation()

Get creation time.

Returns:
  creation time value

#### setCreation

    @Deprecated
    public void setCreation(long creation)

Deprecated. - unused
Set creation.

Parameters:
  `creation` - New creation value

#### getCreationDate

    public Date getCreationDate()

Get creation date.

Returns:
  Creation date value

#### setCreationDate

    public void setCreationDate(Date creationDate)

Creation date mutator.

Parameters:
  `creationDate` - New creation date

#### getLastModified

    public long getLastModified()

Get last modified time.

Returns:
  lastModified time value

#### setLastModified

    public void setLastModified(long lastModified)

Set last modified.

Parameters:
  `lastModified` - New last modified value

#### getLastModifiedDate

    public Date getLastModifiedDate()

Get lastModified date.

Returns:
  LastModified date value

#### setLastModifiedDate

    @Deprecated
    public void setLastModifiedDate(Date lastModifiedDate)

Deprecated. - unused
Last modified date mutator.

Parameters:
  `lastModifiedDate` - New last modified date

#### getLastModifiedHttp

    public String getLastModifiedHttp()

Returns:
  Returns the lastModifiedHttp.

#### setLastModifiedHttp

    @Deprecated
    public void setLastModifiedHttp(String lastModifiedHttp)

Deprecated. - unused

Parameters:
  `lastModifiedHttp` - The lastModifiedHttp to set.

#### getMimeType

    public String getMimeType()

Returns:
  Returns the mimeType.

#### setMimeType

    public void setMimeType(String mimeType)

Parameters:
  `mimeType` - The mimeType to set.

#### getName

    public String getName()

Get name.

Returns:
  Name value

#### setName

    public void setName(String name)

Set name.

Parameters:
  `name` - New name value

#### getResourceType

    public String getResourceType()

Get resource type.

Returns:
  String resource type

#### setResourceType

    public void setResourceType(String resourceType)

Type mutator.

Parameters:
  `resourceType` - New resource type

#### getETag

    public String getETag()

Get ETag.

Returns:
  strong ETag if available, else weak ETag.

#### setETag

    public void setETag(String eTag)

Set strong ETag.

#### getCanonicalPath

    public String getCanonicalPath()

Return the canonical path of the resource, to possibly be used for direct file serving. Implementations which support this should override it to return the file path.

Returns:
  The canonical path of the resource

#### get

    public Attribute get(String attrID)

Get attribute.

Specified by:
  `get` in interface `Attributes`

#### put

    public Attribute put(Attribute attribute)

Put attribute.

Specified by:
  `put` in interface `Attributes`

#### put

    public Attribute put(String attrID,
                Object val)

Put attribute.

Specified by:
  `put` in interface `Attributes`

#### remove

    public Attribute remove(String attrID)

Remove attribute.

Specified by:
  `remove` in interface `Attributes`

#### getAll

    public NamingEnumeration<? extends Attribute> getAll()

Get all attributes.

Specified by:
  `getAll` in interface `Attributes`

#### getIDs

    public NamingEnumeration<String> getIDs()

Get all attribute IDs.

Specified by:
  `getIDs` in interface `Attributes`

#### size

    public int size()

Retrieves the number of attributes in the attribute set.

Specified by:
  `size` in interface `Attributes`

#### clone

    public Object clone()

Clone the attributes object (WARNING: fake cloning).

Specified by:
  `clone` in interface `Attributes`
Overrides:
  `clone` in class `Object`

#### isCaseIgnored

    public boolean isCaseIgnored()

Case sensitivity.

Specified by:
  `isCaseIgnored` in interface `Attributes`