Coinjema
1.7

org.coinjema.context.source
Class FileContextSource

java.lang.Object
  extended by org.coinjema.context.source.FileContextSource
All Implemented Interfaces:
ContextSource

public class FileContextSource
extends Object
implements ContextSource

An implementation of ContextSource based on a simple file structure.

Author:
mstover

Constructor Summary
FileContextSource(File file)
           
FileContextSource(String filename)
           
 
Method Summary
 InputStream getInputStream(String resource, String type)
          Returns null if no such file found.
 String getName()
          The relative name of this context.
 Reader getReader(String resource, String type)
          Returns null if no such file found.
 Resource getResource(String resourceName)
           
 Resource getResource(String resourceName, String ext)
          A more optimized way to find a specific resource if the caller knows the extension (resource type).
 File getRootDirectory()
           
 Collection<ContextSource> getSubContexts()
          Retrieve a collection of direct subcontexts of this context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileContextSource

public FileContextSource(File file)

FileContextSource

public FileContextSource(String filename)
Method Detail

getSubContexts

public Collection<ContextSource> getSubContexts()
Description copied from interface: ContextSource
Retrieve a collection of direct subcontexts of this context.

Specified by:
getSubContexts in interface ContextSource
Returns:

getName

public String getName()
Description copied from interface: ContextSource
The relative name of this context. The name of this context without the parent context names attached. If the context is file based, this would be the name of the last directory in the path.

Specified by:
getName in interface ContextSource
Returns:

getRootDirectory

public File getRootDirectory()

getReader

public Reader getReader(String resource,
                        String type)
Returns null if no such file found.


getInputStream

public InputStream getInputStream(String resource,
                                  String type)
Returns null if no such file found.


getResource

public Resource getResource(String resourceName,
                            String ext)
Description copied from interface: ContextSource
A more optimized way to find a specific resource if the caller knows the extension (resource type).

Specified by:
getResource in interface ContextSource
Returns:

getResource

public Resource getResource(String resourceName)
Specified by:
getResource in interface ContextSource

Coinjema
1.7

Public Domain Software.