ucot.input
Class SimpleInputAdapter

java.lang.Object
  extended by ucot.input.SimpleInputAdapter
All Implemented Interfaces:
InputInterface

public class SimpleInputAdapter
extends java.lang.Object
implements InputInterface

Reads usecases that are stored in this format: [name] Name of the usecase is here [id] Id of the usecase (must be unique within file, it is discarded after loading) [steps] Steps separated with linebreak. Step can have a sub-usecase, it is marked with (usecaseid) after the steps description and "."-character. [end] Use case ends with [end] tag, another usecase can begin with [name] element now

Author:
pajumasu & vevijopi

Field Summary
private  java.util.Properties options
           
 
Constructor Summary
SimpleInputAdapter()
           
 
Method Summary
 boolean canRead(java.net.URL url)
          Tests if this adapter can read the file.
 java.util.Properties getOptions()
          Returns adapter's options
private  UseCaseStep parseStep(java.lang.String line)
          Parses usecase step from given line.
 UseCaseCollection read(java.net.URL url)
          Parses given usecase.
 UseCase readUseCase(java.io.BufferedReader reader, java.net.URL url)
          Reads a single usecase from given reader, sets it's url to given on
 void readUseCases(java.io.BufferedReader reader, UseCaseCollection collection, java.net.URL url)
          Reads usecases from given reader, stores them to given collection and sets their url to given one.
 void setOptions(java.util.Properties options)
          Sets options for the adapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

options

private java.util.Properties options
Constructor Detail

SimpleInputAdapter

public SimpleInputAdapter()
Method Detail

read

public UseCaseCollection read(java.net.URL url)
                       throws java.io.IOException
Description copied from interface: InputInterface
Parses given usecase. Stores Parsed data to given ParsedData object.

Specified by:
read in interface InputInterface
Parameters:
url - Url where input is loaded from
Returns:
Steps read from the input
Throws:
java.io.IOException

readUseCases

public void readUseCases(java.io.BufferedReader reader,
                         UseCaseCollection collection,
                         java.net.URL url)
                  throws java.io.IOException
Reads usecases from given reader, stores them to given collection and sets their url to given one.

Parameters:
reader - reader for the inputstream
collection - where all found usecases are stored
url - url for the usecase
Throws:
java.io.IOException

readUseCase

public UseCase readUseCase(java.io.BufferedReader reader,
                           java.net.URL url)
                    throws java.io.IOException
Reads a single usecase from given reader, sets it's url to given on

Parameters:
reader - reader to read usecases with
url - url for the usecases
Returns:
read new usecase or null if error encountered
Throws:
java.io.IOException

parseStep

private UseCaseStep parseStep(java.lang.String line)
Parses usecase step from given line. Also stores relation id

Parameters:
line -
Returns:

canRead

public boolean canRead(java.net.URL url)
Tests if this adapter can read the file. For now, only test is that the file ends with ".txt"

Specified by:
canRead in interface InputInterface
Parameters:
url - url of the file to test
Returns:
true if this adapter can read the file

setOptions

public void setOptions(java.util.Properties options)
Description copied from interface: InputInterface
Sets options for the adapter

Specified by:
setOptions in interface InputInterface
Parameters:
options - options for the adapter

getOptions

public java.util.Properties getOptions()
Description copied from interface: InputInterface
Returns adapter's options

Specified by:
getOptions in interface InputInterface
Returns:
adapter's options