protoj.core
Class ResourceFeature

java.lang.Object
  extended by protoj.core.ResourceFeature

public final class ResourceFeature
extends java.lang.Object

This feature can extract resources on the classpath and place them in the destination directory with the same relative path. En route variable replacements can be applied to ${var} variables inside the resources where a Configuration instance has been supplied with a call to initReplacements(Configuration).

Useful when a third-party component can only work with a filing system resource whereas the resource logically belongs in the jar or in the classes directory. The RetrieveFeature that delegates to ivy is a good example of this since ivy can only work with files on the filing system and not input streams obtained from system resources.

Author:
Ashley Williams

Constructor Summary
ResourceFeature(CoreProject parent)
          Creates an instance with the owning parent.
 
Method Summary
 java.io.File extractToDir(java.lang.String resourceName, java.io.File destDir)
          Extracts the resource on the classpath with the specified name to the specified directory.
 void initReplacements(org.apache.commons.configuration.Configuration replacements)
          If variable replacement is required then this method should be called to specify the set of properties to be used during creation of the extracted resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceFeature

public ResourceFeature(CoreProject parent)
Creates an instance with the owning parent.

Parameters:
parent -
Method Detail

initReplacements

public void initReplacements(org.apache.commons.configuration.Configuration replacements)
If variable replacement is required then this method should be called to specify the set of properties to be used during creation of the extracted resource.

Parameters:
replacements -

extractToDir

public java.io.File extractToDir(java.lang.String resourceName,
                                 java.io.File destDir)
Extracts the resource on the classpath with the specified name to the specified directory. If a replacements has been specified then it is used to replace any ${var} variables in the resource.

Parameters:
resourceName -
Returns: