Package jadex.bdiv3
Class BDIClassReader
- java.lang.Object
-
- jadex.micro.MicroClassReader
-
- jadex.bdiv3.BDIClassReader
-
public class BDIClassReader extends MicroClassReader
Reads micro agent classes and generates a model from metainfo and annotations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jadex.micro.MicroClassReader
MicroClassReader.DummyClassLoader
-
-
Field Summary
Fields Modifier and Type Field Description protected IBDIClassGenerator
gen
The class generator.protected BDIModelLoader
loader
The model loader for subcapabilities.
-
Constructor Summary
Constructors Constructor Description BDIClassReader(BDIModelLoader loader)
Create a new bdi class reader.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MTrigger
buildPlanTrigger(BDIModel bdimodel, java.lang.String name, Trigger trigger, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
protected java.util.List<MConfigBeliefElement>
createConfigBeliefsList(NameValue[] values)
Create config beliefs.protected java.util.List<MConfigParameterElement>
createConfigParamElementsList(NameValue[] values)
Create config parameter elements.protected MicroClassReader.DummyClassLoader
createDummyClassLoader(java.lang.ClassLoader original, java.lang.ClassLoader parent, java.util.List<java.net.URL> urls)
Create a throw away class loader.protected MCondition
createMethodCondition(MParameterElement mpelem, java.lang.String condtype, java.lang.String[] evs, RawEvent[] rawevs, java.lang.String[] paramevs, BDIModel model, java.lang.reflect.Method m, java.lang.ClassLoader cl)
protected MGoal
createMGoal(BDIModel model, Goal goal, java.lang.Class<?> gcl, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
protected MPlan
createMPlan(BDIModel bdimodel, Plan p, MethodInfo mi, java.lang.String name, ClassInfo ci, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
protected void
fillBDIModelFromAnnotations(BDIModel bdimodel, java.lang.String model, java.lang.Class<?> cma, java.lang.ClassLoader cl, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)
Fill the model details using annotation.protected MGoal
getMGoal(BDIModel model, Goal goal, java.lang.Class<?> gcl, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
protected java.lang.Class
getMicroAgentClass(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)
Get the mirco agent class.protected MPlan
getMPlan(BDIModel bdimodel, Plan p, MethodInfo mi, ClassInfo ci, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
protected MServiceCall
getServiceCall(BDIModel bdimodel, ServiceTrigger st)
protected void
initBDIModelAfterClassLoading(BDIModel model, java.lang.ClassLoader cl)
Do model initialization that can only be done after class reading.protected BDIModel
read(java.lang.String model, java.lang.Class<?> cma, java.lang.ClassLoader cl, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)
Load the model.MicroModel
read(java.lang.String model, java.lang.Object pojo, java.lang.String[] imports, java.lang.ClassLoader classloader, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)
Load a model.static java.util.List<jadex.rules.eca.EventType>
readAnnotationEvents(MCapability capa, java.lang.annotation.Annotation[][] annos, java.lang.ClassLoader cl)
Read the annotation events from method annotations.void
setGenerator(IBDIClassGenerator gen)
Set the generator.-
Methods inherited from class jadex.micro.MicroClassReader
checkAndAddRequiredServiceInfo, checkMethodReturnType, createBinding, createComponentInstanceInfo, createComponentInstanceInfo, createImplementation, createNFRProperties, createProvidedServiceInfo, createRequiredServiceInfo, createUnparsedExpressions, evaluateExpression, fillMicroModelFromAnnotations, findInjections, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getClass, getClassArray, getOrCreateList, getOrCreateMap, getOrCreateSet, getParameterAnnotations, getParameterAnnotations, getProxyAnnotation, guessName, guessParameterType, isAnnotationPresent, isAnnotationPresent, isAnnotationPresent, isAnnotationPresent, isClassLoaderCompatible
-
-
-
-
Field Detail
-
gen
protected IBDIClassGenerator gen
The class generator.
-
loader
protected BDIModelLoader loader
The model loader for subcapabilities.
-
-
Constructor Detail
-
BDIClassReader
public BDIClassReader(BDIModelLoader loader)
Create a new bdi class reader.
-
-
Method Detail
-
setGenerator
public void setGenerator(IBDIClassGenerator gen)
Set the generator.- Parameters:
gen
- the gen to set
-
read
public MicroModel read(java.lang.String model, java.lang.Object pojo, java.lang.String[] imports, java.lang.ClassLoader classloader, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)
Load a model.- Overrides:
read
in classMicroClassReader
- Parameters:
model
- The model (e.g. file name).imports
- (if any).- Returns:
- The loaded model.
-
createDummyClassLoader
protected MicroClassReader.DummyClassLoader createDummyClassLoader(java.lang.ClassLoader original, java.lang.ClassLoader parent, java.util.List<java.net.URL> urls)
Create a throw away class loader.
-
read
protected BDIModel read(java.lang.String model, java.lang.Class<?> cma, java.lang.ClassLoader cl, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)
Load the model.- Overrides:
read
in classMicroClassReader
-
fillBDIModelFromAnnotations
protected void fillBDIModelFromAnnotations(BDIModel bdimodel, java.lang.String model, java.lang.Class<?> cma, java.lang.ClassLoader cl, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)
Fill the model details using annotation. // called with dummy classloader (that was used to load cma first time)
-
buildPlanTrigger
protected MTrigger buildPlanTrigger(BDIModel bdimodel, java.lang.String name, Trigger trigger, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
-
getServiceCall
protected MServiceCall getServiceCall(BDIModel bdimodel, ServiceTrigger st)
-
getMPlan
protected MPlan getMPlan(BDIModel bdimodel, Plan p, MethodInfo mi, ClassInfo ci, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
-
createMPlan
protected MPlan createMPlan(BDIModel bdimodel, Plan p, MethodInfo mi, java.lang.String name, ClassInfo ci, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
-
getMGoal
protected MGoal getMGoal(BDIModel model, Goal goal, java.lang.Class<?> gcl, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
-
createMGoal
protected MGoal createMGoal(BDIModel model, Goal goal, java.lang.Class<?> gcl, java.lang.ClassLoader cl, java.util.Map<ClassInfo,java.util.List<Tuple2<MGoal,java.lang.String>>> pubs)
-
createMethodCondition
protected MCondition createMethodCondition(MParameterElement mpelem, java.lang.String condtype, java.lang.String[] evs, RawEvent[] rawevs, java.lang.String[] paramevs, BDIModel model, java.lang.reflect.Method m, java.lang.ClassLoader cl)
-
readAnnotationEvents
public static java.util.List<jadex.rules.eca.EventType> readAnnotationEvents(MCapability capa, java.lang.annotation.Annotation[][] annos, java.lang.ClassLoader cl)
Read the annotation events from method annotations.
-
getMicroAgentClass
protected java.lang.Class getMicroAgentClass(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)
Get the mirco agent class.- Overrides:
getMicroAgentClass
in classMicroClassReader
-
createConfigBeliefsList
protected java.util.List<MConfigBeliefElement> createConfigBeliefsList(NameValue[] values)
Create config beliefs.
-
createConfigParamElementsList
protected java.util.List<MConfigParameterElement> createConfigParamElementsList(NameValue[] values)
Create config parameter elements.
-
initBDIModelAfterClassLoading
protected void initBDIModelAfterClassLoading(BDIModel model, java.lang.ClassLoader cl)
Do model initialization that can only be done after class reading.
-
-