public static LeafResource create ( Resource resource ) { try { // if we can access the file then there is no reason to decorate it... resource . getFile ( ) ; return new LeafResourceImpl ( resource ) ; } catch ( IOException e ) { return new LocalCacheLeafResource ( resource ) ; } }
Decorates the resource to implement a caching strategy .