ooc
Class SourceContextDirectory

java.lang.Object
  extended byooc.SourceContextAbstract
      extended byooc.SourceContextDirectory
All Implemented Interfaces:
SourceContext

public class SourceContextDirectory
extends SourceContextAbstract

Given an absolute path to a file, it can always be divided up into two parts. For following example where the absolute path '/home/my_home/dev/def.xml' can be divided up into following pairs

the first part is what is called directory in this class and the second part is the source name.


Field Summary
static java.lang.String NAME
          Contains the default name of this context which is 'current_directory'.
 
Constructor Summary
SourceContextDirectory()
          Constructs a context with current directory as the directory and the name as 'current_directory'.
SourceContextDirectory(java.io.File directory, java.lang.String name)
          Constructs a context with given directory and name.
 
Method Summary
 Source createSource(java.lang.String sourceName)
          Returns a newly created source from which tags can be parsed.
 boolean isSourceInContext(java.lang.String sourceName)
          Returns true if the given source exists in this contexts.
 
Methods inherited from class ooc.SourceContextAbstract
getName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
Contains the default name of this context which is 'current_directory'.

See Also:
Constant Field Values
Constructor Detail

SourceContextDirectory

public SourceContextDirectory()
Constructs a context with current directory as the directory and the name as 'current_directory'.


SourceContextDirectory

public SourceContextDirectory(java.io.File directory,
                              java.lang.String name)
Constructs a context with given directory and name.

Parameters:
directory - is the directory for this context.
name - is the name of this context.
Method Detail

isSourceInContext

public boolean isSourceInContext(java.lang.String sourceName)
Description copied from interface: SourceContext
Returns true if the given source exists in this contexts.


createSource

public Source createSource(java.lang.String sourceName)
Description copied from interface: SourceContext
Returns a newly created source from which tags can be parsed.

Parameters:
sourceName - is the name of the source created.
Returns:
a new created source from which tags can be parsed. If no source is found in this context, null is returned.