org.kaariboga.core
Class ClassManager

java.lang.Object
  |
  +--org.kaariboga.core.ClassManager

public class ClassManager
extends java.lang.Object

Stores the classes and the bytecodes of the loaded classes. It is responsible to remove the classes if there is no longer any kaariboga of that kind active.


Inner Class Summary
(package private)  class ClassManager.ClassBox
          Helper class for the ClassManager to wrap class and bytecodes of the loaded classes.
(package private)  class ClassManager.Remover
          Helper class for the ClassManager that removes a class after a given delay time.
 
Field Summary
 java.io.File[] agentsPath
          The path where the agents class files are.
(package private)  java.util.Hashtable cache
          Stores class data in ClassBoxes.
(package private)  long delay
           
 
Constructor Summary
ClassManager(long delay, java.lang.String[] path)
          Create a new ClassManager.
 
Method Summary
 void addClass(java.lang.String name, java.lang.Class cl, byte[] byteCode)
          Adds a new class to the class manager.
 void dec(java.lang.String name)
          Decreases the count of class name
 byte[] getByteCode(java.lang.String name)
          Returns the byte code of a class
 java.lang.Class getClass(java.lang.String name)
          Returns the class of a given name
 void inc(java.lang.String name)
          Increases the count of class name
 void removeClass(java.lang.String name)
          Removes a class and it's bytecode from the class manager
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

agentsPath

public java.io.File[] agentsPath
The path where the agents class files are.

cache

java.util.Hashtable cache
Stores class data in ClassBoxes.

delay

long delay
Constructor Detail

ClassManager

public ClassManager(long delay,
                    java.lang.String[] path)
Create a new ClassManager.
Parameters:
delay - Time in milliseconds the ClassManager waits before a class is removed after it's count = 0.
path - The classpath from which classes are sent to other bases.
Method Detail

addClass

public void addClass(java.lang.String name,
                     java.lang.Class cl,
                     byte[] byteCode)
Adds a new class to the class manager.
Parameters:
name - Name of the class.
cl - The class istself.
byteCode - Byte code of the class.

removeClass

public void removeClass(java.lang.String name)
Removes a class and it's bytecode from the class manager
Parameters:
name - Name of the class to be removed

getClass

public java.lang.Class getClass(java.lang.String name)
Returns the class of a given name

getByteCode

public byte[] getByteCode(java.lang.String name)
Returns the byte code of a class

inc

public void inc(java.lang.String name)
Increases the count of class name

dec

public void dec(java.lang.String name)
Decreases the count of class name