fnug.resource
Class DefaultBundleResource

java.lang.Object
  extended by fnug.resource.AbstractResource
      extended by fnug.resource.DefaultResource
          extended by fnug.resource.DefaultBundleResource
All Implemented Interfaces:
HasBundle, HasJSLintResult, HasLastModifiedBytes, Resource

public class DefaultBundleResource
extends DefaultResource
implements HasBundle, HasJSLintResult

Extension of DefaultResource that implements HasBundle.

Author:
Martin Algesten

Nested Class Summary
 
Nested classes/interfaces inherited from class fnug.resource.AbstractResource
AbstractResource.Entry
 
Field Summary
 
Fields inherited from class fnug.resource.DefaultResource
DEFAULT_CHECK_MODIFIED_INTERVAL
 
Fields inherited from class fnug.resource.AbstractResource
CONTENT_TYPE_TEXT_CSS, CONTENT_TYPE_TEXT_JAVASCRIPT
 
Constructor Summary
DefaultBundleResource(Bundle bundle, String path)
          Constructs setting the necessary bundle and path.
 
Method Summary
 boolean checkModified()
          Compares this resource in memory held last modified date with the one on disk (or for aggregated resource, all the aggregates are checked).
 Bundle getBundle()
          Returns the associated bundle.
 String getJSLintResult()
          Returns the jslint result.
 
Methods inherited from class fnug.resource.DefaultResource
decode, doGetResourceURL, extractJarFile, findRequiresTags, getBytesForFindRequires, getResourceURL, readEntry, readLastModified, readLastModifiedAllowed
 
Methods inherited from class fnug.resource.AbstractResource
contentTypeForPath, ensureReadEntry, getBasePath, getBytes, getContentType, getFullPath, getLastModified, getPath, isCss, isJs, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultBundleResource

public DefaultBundleResource(Bundle bundle,
                             String path)
Constructs setting the necessary bundle and path. The BundleConfig.basePath() will be used as AbstractResource.getBasePath(). The BundleConfig.checkModifiedInterval() will be used for check intervals of the resource.

Parameters:
bundle - the bundle to construct from and which base path to use.
path - the local path. See AbstractResource.getPath().
Method Detail

getBundle

public Bundle getBundle()
Returns the associated bundle.

Specified by:
getBundle in interface HasBundle
Returns:
the associated bundle.

getJSLintResult

public String getJSLintResult()
Returns the jslint result. If the entity does not have a lint result, null is returned.

Specified by:
getJSLintResult in interface HasJSLintResult

checkModified

public boolean checkModified()
Compares this resource in memory held last modified date with the one on disk (or for aggregated resource, all the aggregates are checked). If the last modified on disk is found to be newer than the one in memory, the in memory data is dropped and reread on next Resource.getBytes() or Resource.getLastModified().

Specified by:
checkModified in interface Resource
Overrides:
checkModified in class AbstractResource
Returns:
true if the file system resource (or aggregates in case of aggregated resources) has a newer last modified date which caused the in memory held data to be dropped.


Copyright © 2012. All Rights Reserved.