|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfnug.resource.AbstractResource
fnug.resource.AbstractAggregatedResource
fnug.resource.DefaultResourceCollection
public class DefaultResourceCollection
Default implementation of ResourceCollection
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class fnug.resource.AbstractResource |
---|
AbstractResource.Entry |
Field Summary |
---|
Fields inherited from class fnug.resource.AbstractResource |
---|
CONTENT_TYPE_TEXT_CSS, CONTENT_TYPE_TEXT_JAVASCRIPT |
Constructor Summary | |
---|---|
DefaultResourceCollection(Bundle owner,
Bundle bundle,
Resource[] aggregates,
Resource[] dependencies)
Constructs setting all necessary bits. |
Method Summary | |
---|---|
protected byte[] |
buildAggregate()
Builds two sets of aggregated bytes. |
boolean |
checkModified()
Calls Resource.checkModified() on all the underlying resources in AggregatedResource.getAggregates() and
AggregatedResource.getDependencies() . |
Resource[] |
getAggregates()
Aggregates are the resources that actually make up the aggregated resource - that are used to produce the Resource.getBytes() . |
Bundle |
getBundle()
Returns the associated bundle. |
Resource |
getCompressedCss()
Returns a resource that is the compressed version of the ResourceCollection.getCss() . |
Resource |
getCompressedJs()
Returns a resource that is the compressed version of the ResourceCollection.getJs() . |
byte[] |
getCss()
Returns the dependent css files, concatenated in dependency order. |
Resource[] |
getDependencies()
Dependencies are resources that are just dependent on for Resource.getLastModified() (along with
AggregatedResource.getAggregates() ) but are not part of making the bytes of the aggregate. |
List<Resource> |
getExistingCssAggregates()
Returns the discovered dependent css files that actually exists (doesn't return -1 for Resource.getLastModified() ). |
List<Resource> |
getExistingJsAggregates()
Returns the discovered dependent javascript files that actually exists (doesn't return -1 for Resource.getLastModified() ). |
byte[] |
getJs()
Returns the dependent javascript files, concatenated in dependency order. |
String |
getPath()
The path of a resource collection is an md5 hash sum as hexadecimal of all the aggregates file names and last modified dates prepended with the bundle name. |
Methods inherited from class fnug.resource.AbstractAggregatedResource |
---|
findRequiresTags, readEntry, readLastModified |
Methods inherited from class fnug.resource.AbstractResource |
---|
contentTypeForPath, ensureReadEntry, getBasePath, getBytes, getContentType, getFullPath, getLastModified, isCss, isJs, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface fnug.resource.AggregatedResource |
---|
getBasePath |
Methods inherited from interface fnug.resource.Resource |
---|
findRequiresTags, getBytes, getContentType, getFullPath, getLastModified, isCss, isJs |
Constructor Detail |
---|
public DefaultResourceCollection(Bundle owner, Bundle bundle, Resource[] aggregates, Resource[] dependencies)
owner
- The bundle that generated this collection.bundle
- The bundle to which the resources in this collection belongs.aggregates
- Resources that comprises the aggregates. This is a mix of javascript, css and other dependent
resources.dependencies
- Resources that are just dependencies, not used for building aggregated bytes, but for
AbstractResource.getLastModified()
.Method Detail |
---|
public String getPath()
getPath
in interface Resource
getPath
in class AbstractResource
public Resource[] getAggregates()
Resource.getBytes()
.
getAggregates
in interface AggregatedResource
public Resource[] getDependencies()
Resource.getLastModified()
(along with
AggregatedResource.getAggregates()
) but are not part of making the bytes of the aggregate.
getDependencies
in interface AggregatedResource
public Bundle getBundle()
getBundle
in interface HasBundle
protected byte[] buildAggregate()
getJs()
and the other getCss()
. Loops over
all getAggregates()
and picks out Resource.isJs()
and Resource.isCss()
.
buildAggregate
in class AbstractAggregatedResource
AggregatedResource.getAggregates()
.public byte[] getJs()
Resource.getBytes()
on the resource.
getJs
in interface ResourceCollection
public byte[] getCss()
getCss
in interface ResourceCollection
public Resource getCompressedJs()
ResourceCollection.getJs()
.
getCompressedJs
in interface ResourceCollection
public Resource getCompressedCss()
ResourceCollection.getCss()
.
getCompressedCss
in interface ResourceCollection
public boolean checkModified()
Resource.checkModified()
on all the underlying resources in AggregatedResource.getAggregates()
and
AggregatedResource.getDependencies()
. After that calls super class checkModified() which may trigger a rebuild of the
aggregate (via AbstractAggregatedResource.readEntry()
, AbstractAggregatedResource.buildAggregate()
) If any resource is changed, will dropped the compressed javascript and css.
checkModified
in interface Resource
checkModified
in class AbstractAggregatedResource
public List<Resource> getExistingJsAggregates()
Resource.getLastModified()
).
getExistingJsAggregates
in interface ResourceCollection
public List<Resource> getExistingCssAggregates()
Resource.getLastModified()
).
getExistingCssAggregates
in interface ResourceCollection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |