pt.digitalis.dif.codegen.util
Class DEMLoaderEntityRegistry

java.lang.Object
  extended by pt.digitalis.dif.codegen.util.DEMLoaderEntityRegistry

public final class DEMLoaderEntityRegistry
extends Object

A temporary registry of DEM entities that helps the codegen utility to track down all entities on a first pass

Author:
Pedro Viegas pviegas@digitalis.pt, Rodrigo Gonçalves rgoncalves@digitalis.pt
Created on:
Jul 23, 2007

Constructor Summary
DEMLoaderEntityRegistry()
           
 
Method Summary
static void addApplication(String id, pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
          Adds a application class to the temp DEM registry
static void addProvider(String id, pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
          Adds a provider class to the temp DEM registry
static void addService(String id, pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
          Adds a service class to the temp DEM registry
static void addStage(String id, pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
          Adds a stage class to the temp DEM registry
static void addValidator(String id, pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
          Adds a validator class to the temp DEM registry
static void cleanUp()
          Performs memory clean up by releasing the internal Maps of entities when they are no longer needed.
static pt.digitalis.utils.bytecode.holders.ClassHolder getApplication(String id)
          Searches the applications for the entry with the given ID
static int getApplicationCount()
          Returns the registered applications count
static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getApplications()
          Returns the Map of registered applications with the ID and their class objects
static int getEntityCount()
          Returns the total number of entities registered
static pt.digitalis.utils.bytecode.holders.ClassHolder getProvider(String id)
          Searches the providers for the entry with the given ID
static int getProviderCount()
          Returns the registered providers count
static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getProviders()
          Returns the Map of registered providers with the ID and their class objects
static pt.digitalis.utils.bytecode.holders.ClassHolder getService(String id)
          Searches the services for the entry with the given ID
static int getServiceCount()
          Returns the registered services count
static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getServices()
          Returns the Map of registered services with the ID and their class objects
static pt.digitalis.utils.bytecode.holders.ClassHolder getStage(String id)
          Searches the stages for the entry with the given ID
static int getStageCount()
          Returns the registered stages count
static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getStages()
          Returns the Map of registered stages with the ID and their class objects
static pt.digitalis.utils.bytecode.holders.ClassHolder getValidator(String id)
          Searches the validators for the entry with the given ID
static int getValidatorCount()
          Returns the registered validators count
static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getValidators()
          Returns the Map of registered validators with the ID and their class objects
static void loadEntityClasses(List<pt.digitalis.utils.bytecode.holders.ClassHolder> classes, IDEMRegistrator demRegistrator)
          Analyzes the given classes to determine witch of them are DEM Entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DEMLoaderEntityRegistry

public DEMLoaderEntityRegistry()
Method Detail

addApplication

public static void addApplication(String id,
                                  pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
Adds a application class to the temp DEM registry

Parameters:
id - the ID of the DEM Entity
clazz - the class object that represents the Entity

addProvider

public static void addProvider(String id,
                               pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
Adds a provider class to the temp DEM registry

Parameters:
id - the ID of the DEM Entity
clazz - the class object that represents the Entity

addService

public static void addService(String id,
                              pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
Adds a service class to the temp DEM registry

Parameters:
id - the ID of the DEM Entity
clazz - the class object that represents the Entity

addStage

public static void addStage(String id,
                            pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
Adds a stage class to the temp DEM registry

Parameters:
id - the ID of the DEM Entity
clazz - the class object that represents the Entity

addValidator

public static void addValidator(String id,
                                pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
Adds a validator class to the temp DEM registry

Parameters:
id - the ID of the DEM Entity
clazz - the class object that represents the Entity

cleanUp

public static void cleanUp()
Performs memory clean up by releasing the internal Maps of entities when they are no longer needed. Must be called since this is a static class with static attributes for temporary data.


getApplication

public static pt.digitalis.utils.bytecode.holders.ClassHolder getApplication(String id)
Searches the applications for the entry with the given ID

Parameters:
id - the ID of the Entity to search
Returns:
the class object of the Entity

getApplicationCount

public static int getApplicationCount()
Returns the registered applications count

Returns:
the number of Applications

getApplications

public static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getApplications()
Returns the Map of registered applications with the ID and their class objects

Returns:
the Applications Map

getEntityCount

public static int getEntityCount()
Returns the total number of entities registered

Returns:
the entity count

getProvider

public static pt.digitalis.utils.bytecode.holders.ClassHolder getProvider(String id)
Searches the providers for the entry with the given ID

Parameters:
id - the ID of the Entity to search
Returns:
the class object of the Entity

getProviderCount

public static int getProviderCount()
Returns the registered providers count

Returns:
the number of Providers

getProviders

public static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getProviders()
Returns the Map of registered providers with the ID and their class objects

Returns:
the Providers Map

getService

public static pt.digitalis.utils.bytecode.holders.ClassHolder getService(String id)
Searches the services for the entry with the given ID

Parameters:
id - the ID of the Entity to search
Returns:
the class object of the Entity

getServiceCount

public static int getServiceCount()
Returns the registered services count

Returns:
the number of Services

getServices

public static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getServices()
Returns the Map of registered services with the ID and their class objects

Returns:
the Services Map

getStage

public static pt.digitalis.utils.bytecode.holders.ClassHolder getStage(String id)
Searches the stages for the entry with the given ID

Parameters:
id - the ID of the Entity to search
Returns:
the class object of the Entity

getStageCount

public static int getStageCount()
Returns the registered stages count

Returns:
the number of Stages

getStages

public static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getStages()
Returns the Map of registered stages with the ID and their class objects

Returns:
the Stages Map

getValidator

public static pt.digitalis.utils.bytecode.holders.ClassHolder getValidator(String id)
Searches the validators for the entry with the given ID

Parameters:
id - the ID of the Entity to search
Returns:
the class object of the Entity

getValidatorCount

public static int getValidatorCount()
Returns the registered validators count

Returns:
the number if Validators

getValidators

public static Map<String,pt.digitalis.utils.bytecode.holders.ClassHolder> getValidators()
Returns the Map of registered validators with the ID and their class objects

Returns:
the Validators Map

loadEntityClasses

public static void loadEntityClasses(List<pt.digitalis.utils.bytecode.holders.ClassHolder> classes,
                                     IDEMRegistrator demRegistrator)
                              throws pt.digitalis.utils.inspection.exception.ResourceNotFoundException,
                                     ClassNotFoundException,
                                     InstantiationException,
                                     IllegalAccessException
Analyzes the given classes to determine witch of them are DEM Entity. It adds them to the corresponding DEM list. All read operations are executed by Javassist so classes are not loaded by the JVM.

Parameters:
classes - the classes to analyze
demRegistrator - the DEM registrator
Throws:
pt.digitalis.utils.inspection.exception.ResourceNotFoundException - if any class could not be found or an annotation can't be read
IllegalAccessException
InstantiationException
ClassNotFoundException


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.