com.atlassian.modzdetector
Interface StreamMapper

All Known Implementing Classes:
FilesystemStreamMapper

public interface StreamMapper

An abstraction of the logic that chooses how to acquire a resource's InputStream by name and resource type prefix. This only needs to be implemented by a user of this library if reading a registry in a different way than was expected when it was written. For example, loading a registry via a product's installer to check if there are any modifications to files would need to load all resources off the filesystem as opposed to what a running web application would do, i.e. load some things off the classpath.


Method Summary
 java.lang.String getResourceKey(java.io.File file)
          Given a file creates a resource key that would correspond to this file
 java.lang.String getResourcePath(java.lang.String resourceKey)
          Given a resource name returns a file path to this resource.
 java.io.InputStream mapStream(java.lang.String prefix, java.lang.String resourceName)
          Gets the input stream for the resource registered with the given name and prefix.
 

Method Detail

mapStream

java.io.InputStream mapStream(java.lang.String prefix,
                              java.lang.String resourceName)
Gets the input stream for the resource registered with the given name and prefix. Caller should close the stream when finished.

Parameters:
prefix -
resourceName -
Returns:
null on failure to map.

getResourcePath

java.lang.String getResourcePath(java.lang.String resourceKey)
Given a resource name returns a file path to this resource. The root of the path is defined by the implementation.

Parameters:
resourceKey -
Returns:

getResourceKey

java.lang.String getResourceKey(java.io.File file)
Given a file creates a resource key that would correspond to this file

Parameters:
file -
Returns:


Copyright © 2011 Atlassian. All Rights Reserved.