org.ow2.jonas.generators.genbase.utils
Class TempRepository

java.lang.Object
  extended by org.ow2.jonas.generators.genbase.utils.TempRepository

public class TempRepository
extends Object

A TempRepository object is tye main container for temporary directories. When an object of WsGen or ClientStubGen wants to use a temporary directory, it ask TempRepository instance to create a new one. It is usefull when multiples tempo directories are created. Deletion is much more simpler. The TempRepository is a Singleton.

Author:
Guillaume Sauthier

Method Summary
 void addDir(File file)
          Add a temporary File in the repository (file or directory).
 File createDir()
          Return an empty temporary directory and automatically add it into the repository.
 File createDir(String extension)
          Return an empty temporary directory and automatically add it into the repository.
 boolean deleteAll()
          Delete all the files contained in the repository.
static TempRepository getInstance()
          Return the only instance of TempRepository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TempRepository getInstance()
Return the only instance of TempRepository.

Returns:
the only instance of TempRepository.

addDir

public void addDir(File file)
Add a temporary File in the repository (file or directory).

Parameters:
file - the temporary file or directory to add.

deleteAll

public boolean deleteAll()
Delete all the files contained in the repository. Returns true when deletion is successfull, false otherwise.

Returns:
true when deletion is successfull, false otherwise.

createDir

public File createDir()
               throws IOException
Return an empty temporary directory and automatically add it into the repository.

Returns:
an empty temporary directory.
Throws:
IOException - when creation fails.

createDir

public File createDir(String extension)
               throws IOException
Return an empty temporary directory and automatically add it into the repository.

Returns:
an empty temporary directory.
Throws:
IOException - when creation fails.


Copyright © 2010 OW2 Consortium. All Rights Reserved.