lacam.management
Class LibraryManager

java.lang.Object
  extended byjava.lang.ClassLoader
      extended bylacam.management.LibraryManager

public class LibraryManager
extends java.lang.ClassLoader

Manages the class library of the whole system.

All the described plugin classes are cached here in their ClassDescriptor which also contains all other needfull data as the default parameter list of the class, the description, author etc. Is is also used by the ProcessDescriptor to find the classes linked for the step the ProcessDescriptor is representing.

Author:
Dimitrij Zub

Method Summary
static void clearCache()
          Deprecated.  
static java.lang.Class createInstance(ClassDescriptor descriptor)
          Creates an instance of the class described by the ClassDescriptor
 java.lang.Class findClass(java.lang.String name)
           
static ClassDescriptor findDescriptor(java.lang.String name, java.lang.String version)
          Tries to find the matching class descriptor
static ClassDescriptor[] getClassesByPurpose(java.lang.String purpose)
          Searches the ClassDescriptor database of the LibraryManager for alle classes matching the purpose defined by purpose
static javax.swing.tree.TreeModel getTreeModelInstance()
           
static java.lang.Class loadByName(java.lang.String name, boolean type_ignorable)
          Tries to load a class identified only by its name
static java.lang.Class loadByVersion(java.lang.String version)
          Tries to load a class by its version (id)
 java.lang.Class loadClass(java.lang.String name)
           
static boolean matchesPurpose(java.lang.String purpose, java.lang.String name, java.lang.String version)
           
 java.lang.String toString()
           
static void updateClassesSet()
          Updates the classes set containing the class descriptors of any class in the plugin directory so those can be loaded without accessing the harddisk
static void updateClassesSetVerbose()
          Updates the classes set containing the class descriptors of any class in the plugin directory so those can be loaded without accessing the harddisk, while showing the progress to the user.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

loadByName

public static java.lang.Class loadByName(java.lang.String name,
                                         boolean type_ignorable)
Tries to load a class identified only by its name

Parameters:
name - The full qualified name of the class
type_ignorable - True if the type of the class is ignorable
Returns:
Class if found, null if not found

loadByVersion

public static java.lang.Class loadByVersion(java.lang.String version)
Tries to load a class by its version (id)

Parameters:
version - The version (id) of the class
Returns:
Class if found, null if not found

createInstance

public static java.lang.Class createInstance(ClassDescriptor descriptor)
Creates an instance of the class described by the ClassDescriptor

Parameters:
descriptor - The descriptor containing the class to create an instance of
Returns:
The classes instance

clearCache

public static void clearCache()
Deprecated.  

Cleares the classes cache of the ClassLoader. This should force the LibraryManager to reload all classes on demand. Deprecated because it has never been really tested


updateClassesSet

public static void updateClassesSet()
Updates the classes set containing the class descriptors of any class in the plugin directory so those can be loaded without accessing the harddisk


updateClassesSetVerbose

public static void updateClassesSetVerbose()
Updates the classes set containing the class descriptors of any class in the plugin directory so those can be loaded without accessing the harddisk, while showing the progress to the user.


getClassesByPurpose

public static ClassDescriptor[] getClassesByPurpose(java.lang.String purpose)
Searches the ClassDescriptor database of the LibraryManager for alle classes matching the purpose defined by purpose

Parameters:
purpose - The purpose to search for
Returns:
ClassDescriptor[] containing all classes found
See Also:
ClassLibraryContainer.getClassesForPurpose(String)

findDescriptor

public static ClassDescriptor findDescriptor(java.lang.String name,
                                             java.lang.String version)
Tries to find the matching class descriptor

Returns:
The found ClassDescriptor or null if none was found

matchesPurpose

public static boolean matchesPurpose(java.lang.String purpose,
                                     java.lang.String name,
                                     java.lang.String version)
Returns:
True if the class identified by name and version can do the job (purpose)

getTreeModelInstance

public static javax.swing.tree.TreeModel getTreeModelInstance()
Returns:
The TreeModel of the classes library

loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException
See Also:
ClassLoader.loadClass(String)

findClass

public java.lang.Class findClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

toString

public java.lang.String toString()