MUM.repositoryService
Class ComponentDescriptorRepositoryFile

java.lang.Object
  extended byMUM.repositoryService.ComponentDescriptorRepositoryFile
All Implemented Interfaces:
IComponentDescriptorRepository

public class ComponentDescriptorRepositoryFile
extends java.lang.Object
implements IComponentDescriptorRepository

This class is a Component Repository. It implements the interface IComponentRepository. Pay attention!!!! All works properly if and only if the files and directories used as component repository are not utilized by others applications, even a file explorer.

See Also:
IComponentRepository

Constructor Summary
ComponentDescriptorRepositoryFile(java.lang.String absoluteFileName, java.io.PrintStream out)
          This is the constructor.
 
Method Summary
 boolean eliminateComponentDescriptor(java.lang.String packageName, java.lang.String interfaceName)
          This method eliminate an entry in the DB
 java.lang.Object getClassInstance(java.lang.String packageName, java.lang.String interfaceName, java.lang.Object[] arguments)
          This method returns a factory for the desired interface
 ComponentDescriptor getComponentDescriptor(java.lang.String packageName, java.lang.String interfaceName)
          This method given a package name and an interface name returns the hashSet which contains all the classes needed by that component.
 boolean insertComponentDescriptor(ComponentDescriptor componentDescriptor)
          This method introduce a new entry in the DB
 boolean insertComponentDescriptor(java.lang.String packageName, java.lang.String interfaceName, java.lang.String className, java.util.HashSet classList)
          This method introduce a new entry in the DB.
 boolean isPresentComponentDescriptor(java.lang.String packageName, java.lang.String interfaceName)
          This method query the DB if the required component is present
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentDescriptorRepositoryFile

public ComponentDescriptorRepositoryFile(java.lang.String absoluteFileName,
                                         java.io.PrintStream out)
                                  throws java.io.FileNotFoundException,
                                         java.io.IOException,
                                         java.lang.ClassNotFoundException
This is the constructor. It accept the absolute name of a file used as DB

Method Detail

insertComponentDescriptor

public boolean insertComponentDescriptor(java.lang.String packageName,
                                         java.lang.String interfaceName,
                                         java.lang.String className,
                                         java.util.HashSet classList)
                                  throws java.io.IOException
This method introduce a new entry in the DB. Important!! In this DB we keep only information to give an istance of the required interface when requested. This operation return false if another entry with the same packageName+interfaceName is already present. In this case you should use the modifyComponentDescriptor method.

Specified by:
insertComponentDescriptor in interface IComponentDescriptorRepository
Parameters:
packageName - the name of the class's package
interfaceName - the name of the class's interface
classList - the list of the classes componing this component
className - the name of the class
Returns:
false if the table already contains the componentDescriptor
Throws:
java.io.IOException

insertComponentDescriptor

public boolean insertComponentDescriptor(ComponentDescriptor componentDescriptor)
                                  throws java.io.IOException
This method introduce a new entry in the DB

Specified by:
insertComponentDescriptor in interface IComponentDescriptorRepository
Returns:
false if the table already contains the componentDescriptor
Throws:
java.io.IOException

getComponentDescriptor

public ComponentDescriptor getComponentDescriptor(java.lang.String packageName,
                                                  java.lang.String interfaceName)
This method given a package name and an interface name returns the hashSet which contains all the classes needed by that component. The package name joined with the class name is the i-element of the hashset

Specified by:
getComponentDescriptor in interface IComponentDescriptorRepository
Parameters:
packageName - the name of the class's package
interfaceName - the name of the class's interface
Returns:
null there isn't this component descriptor, otherwise an hash table with all the required interfaces and classes

eliminateComponentDescriptor

public boolean eliminateComponentDescriptor(java.lang.String packageName,
                                            java.lang.String interfaceName)
                                     throws java.io.IOException
This method eliminate an entry in the DB

Specified by:
eliminateComponentDescriptor in interface IComponentDescriptorRepository
Parameters:
packageName - the name of the class's package
interfaceName - the name of the class's interface
Returns:
false if the entry determined by packageName+interfaceName is not present
Throws:
java.io.IOException

isPresentComponentDescriptor

public boolean isPresentComponentDescriptor(java.lang.String packageName,
                                            java.lang.String interfaceName)
This method query the DB if the required component is present

Specified by:
isPresentComponentDescriptor in interface IComponentDescriptorRepository
Parameters:
packageName - the name of the class's package
interfaceName - the name of the class's interface
Returns:
true if the considered component descriptor is present

getClassInstance

public java.lang.Object getClassInstance(java.lang.String packageName,
                                         java.lang.String interfaceName,
                                         java.lang.Object[] arguments)
                                  throws ComponentDescriptorRepositoryException,
                                         java.lang.IllegalAccessException,
                                         java.lang.NoSuchMethodException,
                                         java.lang.ClassNotFoundException,
                                         java.lang.InstantiationException,
                                         java.lang.reflect.InvocationTargetException
This method returns a factory for the desired interface

Specified by:
getClassInstance in interface IComponentDescriptorRepository
Parameters:
packageName - the name of the class's package
interfaceName - the name of the class's interface
Throws:
ComponentDescriptorRepositoryException
java.lang.IllegalAccessException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException


Copyright © 2004 Luca Foschini