au.gov.tas.dpiwe.mr.tool
Class HomeSourceFileScanner

java.lang.Object
  extended by java.io.Reader
      extended by java.io.BufferedReader
          extended by au.gov.tas.dpiwe.mr.tool.HomeSourceFileScanner
All Implemented Interfaces:
Closeable, Readable

public class HomeSourceFileScanner
extends BufferedReader

HomeSourceFileScanner is currently a very primitive Java source file reader needed by the DeploymentContainer to extract formal parameter lists from home interface source files.

Since:
Mr Architecture 1.0
Version:
1.0.0.9
Author:
Kade Hansson

Field Summary
protected  List importTargets
          The targets of the import clauses in the file.
protected  Messenger messenger
          If we are logging, the messenger to log to.
protected  Map methods
          A mapping from finder method signatures to methods.
protected  int parameterCountOnLongest
          The length of the longest finder method signature found so far.
protected  List parameterTypesOnLongest
          The signature of the finder method with the most parameters so far.
protected  HomeSourceFileScanner superclassReader
          A reference to a scanner for the superinterface.
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
HomeSourceFileScanner(Reader reader, HomeSourceFileScanner superclassReader)
          Creates a new home source file scanner.
HomeSourceFileScanner(Reader reader, HomeSourceFileScanner superclassReader, Messenger messenger)
          Creates a new home source file scanner with logging enabled.
 
Method Summary
 void close()
          Closes both this reader and any superinterface readers.
 List getImportTargets()
          Get the targets referenced in the import clauses.
 List getNames()
          Get the formal parameter names of the longest findWhereFieldsEqual() method.
 List getNames(Class[] parameterTypes)
          Get the formal parameter names of the specified findWhereFieldsEqual() method.
 List getNamesOrEmptyListIfNone()
          Get the formal parameter names of the longest findWhereFieldsEqual() method.
 List getTypes()
          Get the parameter types of the longest findWhereFieldsEqual() method.
 List getTypes(Class[] parameterTypes)
          Get the parameter types of the specified findWhereFieldsEqual() method.
 List getTypesOrEmptyListIfNone()
          Get the parameter types of the longest findWhereFieldsEqual() method.
 void scanHomeSourceFile()
          Scans the source file and populates the scanner's internal data structures.
 
Methods inherited from class java.io.BufferedReader
mark, markSupported, read, read, readLine, ready, reset, skip
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methods

protected Map methods
A mapping from finder method signatures to methods.


parameterCountOnLongest

protected int parameterCountOnLongest
The length of the longest finder method signature found so far.


parameterTypesOnLongest

protected List parameterTypesOnLongest
The signature of the finder method with the most parameters so far.


superclassReader

protected HomeSourceFileScanner superclassReader
A reference to a scanner for the superinterface.


importTargets

protected List importTargets
The targets of the import clauses in the file.


messenger

protected Messenger messenger
If we are logging, the messenger to log to.

Constructor Detail

HomeSourceFileScanner

public HomeSourceFileScanner(Reader reader,
                             HomeSourceFileScanner superclassReader)
                      throws IOException
Creates a new home source file scanner.

Parameters:
reader - the reader from which the source file is waiting to be read.
superclassReader - another constructed home source file scanner for reading the source file of the superinterface.
Throws:
IOException - if the reader cannot be suitably buffered.

HomeSourceFileScanner

public HomeSourceFileScanner(Reader reader,
                             HomeSourceFileScanner superclassReader,
                             Messenger messenger)
                      throws IOException
Creates a new home source file scanner with logging enabled.

Parameters:
reader - the reader from which the source file is waiting to be read.
superclassReader - another constructed home source file scanner for reading the source file of the superinterface.
messenger - the messenger to log to.
Throws:
IOException - if the reader cannot be suitably buffered.
Method Detail

scanHomeSourceFile

public void scanHomeSourceFile()
                        throws IOException
Scans the source file and populates the scanner's internal data structures.

Throws:
IOException - if the input file could not be read.

getTypes

public List getTypes()
Get the parameter types of the longest findWhereFieldsEqual() method.

Returns:
list of parameter type names in the signature of the longest findWhereFieldsEqual() method.
Throws:
EJBException - if there is no findWhereFieldsEqual() method.

getNames

public List getNames()
Get the formal parameter names of the longest findWhereFieldsEqual() method.

Returns:
list of formal parameter names in the signature of the longest findWhereFieldsEqual() method.
Throws:
EJBException - if there is no findWhereFieldsEqual() method.

getTypesOrEmptyListIfNone

public List getTypesOrEmptyListIfNone()
Get the parameter types of the longest findWhereFieldsEqual() method.

Returns:
list of parameter type names in the signature of the longest findWhereFieldsEqual() method, or an empty list if there is no findWhereFieldsEqual() method.

getNamesOrEmptyListIfNone

public List getNamesOrEmptyListIfNone()
Get the formal parameter names of the longest findWhereFieldsEqual() method.

Returns:
list of formal parameter names in the signature of the longest findWhereFieldsEqual() method, or an empty list if there is no findWhereFieldsEqual() method.

getTypes

public List getTypes(Class[] parameterTypes)
Get the parameter types of the specified findWhereFieldsEqual() method.

Parameters:
parameterTypes - specifying signature of findWhereFieldsEqual() method.
Returns:
list of parameter type names in the signature of the specified findWhereFieldsEqual() method.
Throws:
EJBException - if there is no findWhereFieldsEqual() method matching that specified.

getNames

public List getNames(Class[] parameterTypes)
Get the formal parameter names of the specified findWhereFieldsEqual() method.

Parameters:
parameterTypes - specifying signature of findWhereFieldsEqual() method.
Returns:
list of formal parameter names in the signature of the specified findWhereFieldsEqual() method.
Throws:
EJBException - if there is no findWhereFieldsEqual() method matching that specified.

getImportTargets

public List getImportTargets()
Get the targets referenced in the import clauses.

Returns:
list of import targets.

close

public void close()
           throws IOException
Closes both this reader and any superinterface readers.

Specified by:
close in interface Closeable
Overrides:
close in class BufferedReader
Throws:
IOException - if closing fails.