things.thinger.kernel.basic.tools
Class UniverseFileManager

java.lang.Object
  extended by javax.tools.ForwardingJavaFileManager<javax.tools.StandardJavaFileManager>
      extended by things.thinger.kernel.basic.tools.UniverseFileManager
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, javax.tools.JavaFileManager, javax.tools.OptionChecker

public class UniverseFileManager
extends javax.tools.ForwardingJavaFileManager<javax.tools.StandardJavaFileManager>

A java file manager for handling universe objects.

NOTE: This is a big problem with the captured files. I don't make sure they are actually closed from whatever operation when they are all released. This is something to handle later.

Version:
1.0

Version History

EPG - Initial - 18 NOV 02
 
Author:
Erich P. Gatejen

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.tools.JavaFileManager
javax.tools.JavaFileManager.Location
 
Field Summary
 
Fields inherited from class javax.tools.ForwardingJavaFileManager
fileManager
 
Constructor Summary
UniverseFileManager(javax.tools.StandardJavaFileManager rootManager, UniverseAnchor ua, java.lang.ClassLoader aClassLoader)
          Construct
 
Method Summary
protected  void finalize()
          Finalize.
 java.lang.ClassLoader getClassLoader(javax.tools.JavaFileManager.Location location)
          Always return it.
 javax.tools.JavaFileObject getJavaFileForOutput(javax.tools.JavaFileManager.Location location, java.lang.String name, javax.tools.JavaFileObject.Kind kind, javax.tools.FileObject sibling)
          Get a JavaFileObject for output.
 UniverseAnchor getUniverse()
          Get the registered universe.
 void releaseAllCaptured()
          Release all captured files.
 
Methods inherited from class javax.tools.ForwardingJavaFileManager
close, flush, getFileForInput, getFileForOutput, getJavaFileForInput, handleOption, hasLocation, inferBinaryName, isSameFile, isSupportedOption, list
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniverseFileManager

public UniverseFileManager(javax.tools.StandardJavaFileManager rootManager,
                           UniverseAnchor ua,
                           java.lang.ClassLoader aClassLoader)
Construct

Parameters:
rootManager - The root manager from which we will take forwards.
aClassLoader - The class loader for this manager
ua - The UniverseAnchor for this manager. All objects will be relative to this anchor.
See Also:
UniverseAnchor
Method Detail

getUniverse

public UniverseAnchor getUniverse()
Get the registered universe.

Returns:
the universe anchor.

getJavaFileForOutput

public javax.tools.JavaFileObject getJavaFileForOutput(javax.tools.JavaFileManager.Location location,
                                                       java.lang.String name,
                                                       javax.tools.JavaFileObject.Kind kind,
                                                       javax.tools.FileObject sibling)
                                                throws java.io.IOException
Get a JavaFileObject for output. It isn't much different than the output method--for now. If it is writing a class, it'll always make sure there is a .class at the end.

Specified by:
getJavaFileForOutput in interface javax.tools.JavaFileManager
Overrides:
getJavaFileForOutput in class javax.tools.ForwardingJavaFileManager<javax.tools.StandardJavaFileManager>
Parameters:
location - the location type
name - the class name
kind - the kind
sibling - the sibling
Throws:
java.io.IOException

getClassLoader

public java.lang.ClassLoader getClassLoader(javax.tools.JavaFileManager.Location location)
Always return it.

Specified by:
getClassLoader in interface javax.tools.JavaFileManager
Overrides:
getClassLoader in class javax.tools.ForwardingJavaFileManager<javax.tools.StandardJavaFileManager>

releaseAllCaptured

public void releaseAllCaptured()
Release all captured files. It is important to do this when you are done. It'll happen with finalization, but that might be a bit late in the game.


finalize

protected void finalize()
                 throws java.lang.Throwable
Finalize. Make sure we released the captured.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Things.