1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
package org.pentaho.reporting.libraries.resourceloader.cache;
import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
import org.pentaho.reporting.libraries.resourceloader.Resource;
import org.pentaho.reporting.libraries.resourceloader.ResourceException;
import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
/**
* Todo: Document me!
* <p/>
* Date: 07.10.2009
* Time: 18:31:11
*
* @author Thomas Morgner.
*/
public class BundleCacheResourceWrapper implements Resource
{
private Resource parent;
private ResourceKey outsideKey;
public BundleCacheResourceWrapper(final Resource parent,
final ResourceKey outsideKey)
{
this.parent = parent;
this.outsideKey = outsideKey;
}
public Object getResource()
throws ResourceException
{
return parent.getResource();
}
public Class getTargetType()
{
return parent.getTargetType();
}
public long getVersion(final ResourceKey key)
{
if (ObjectUtilities.equal(key, outsideKey))
{
return parent.getVersion(parent.getSource());
}
return parent.getVersion(key);
}
public ResourceKey[] getDependencies()
{
final ResourceKey[] resourceKeys = parent.getDependencies();
final ResourceKey[] target = new ResourceKey[resourceKeys.length + 1];
target[0] = parent.getSource();
System.arraycopy(resourceKeys, 0, target, 1, resourceKeys.length);
return target;
}
public ResourceKey getSource()
{
return outsideKey;
}
public boolean isTemporaryResult()
{
return parent.isTemporaryResult();
}
}
|