cuba.util
Class GeneratedFile

java.lang.Object
  extended by cuba.util.GeneratedFile

public class GeneratedFile
extends java.lang.Object

Represents a file output of a generator. There are two different types of outputs. A content-typed output contains the content of a file and the proposed file name. A filename-typed output containes only the name of a file which is already there. CUBA's code and descriptor generators usually produce content-typed results, letting the caller to deside how to dump them to actual files (which may be a different procedure in command line tools and IDE integrations). However, when generating descriptors for AXIS, CUBA executes AXIS' generator tools which already write files. In these cases, the results are filename-typed.
Content-typed results can be dumped to a file by method dump(). Filename-typed results can be turned to content-typed once by method undump().

Author:
dbt

Nested Class Summary
static interface GeneratedFile.Type
          The different Type of Files: Adaptor or Descriptor.
 
Constructor Summary
GeneratedFile(java.lang.String location)
           
GeneratedFile(java.lang.String location, byte[] content)
           
GeneratedFile(java.lang.String location, int type)
           
 
Method Summary
 void close()
           
 void dump()
          Dumps the content of a content-typed generator result to a file of the proposed name.
 byte[] getContent()
           
 java.lang.String getLocation()
           
 int getType()
           
 void print(java.lang.String text)
           
 void println()
           
 void println(java.lang.String text)
           
 void undump()
          Reads a filename-typed generator result into memory and removes the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratedFile

public GeneratedFile(java.lang.String location,
                     byte[] content)

GeneratedFile

public GeneratedFile(java.lang.String location)

GeneratedFile

public GeneratedFile(java.lang.String location,
                     int type)
Method Detail

getLocation

public java.lang.String getLocation()

getType

public int getType()

println

public void println(java.lang.String text)

println

public void println()

print

public void print(java.lang.String text)

close

public void close()

getContent

public byte[] getContent()

dump

public void dump()
          throws GeneratorException
Dumps the content of a content-typed generator result to a file of the proposed name. For filename-typed results, the function does nothing. This function is used by command line variants of the generators to create the output files.

Throws:
GeneratorException - If the file can not be created or written

undump

public void undump()
            throws GeneratorException
Reads a filename-typed generator result into memory and removes the file. For content-typed results, the function does nothing. This function is of interest for IDE integration variants of the generators which require files to be registered in the IDE first before actually creating them.

Throws:
GeneratorException - If the file can not be created or written