JBOSS REFLECTION MODULE (JRM)
SVN Location
http://anonsvn.jboss.org/repos/jbossas/projects/jboss-reflect/trunk
+-------------------+
| |
| Class Loading SPI |
| |
+-------------------+
+----------------+
| | uses
+-------| Beans Info SPI |<---------------------+
| | | |
| +----------------+ |
| | |
| | uses |
| V |
| +------------------+ +-------------------+
| | | uses | |
+-----| Classadapter SPI |<---------->| Configuration SPI |
| | | | |
u | +------------------+ +-------------------+
s | | |
e | | uses |
s | V |
| +----------------+ |
| | | |
+------| Joinpoint SPI |<----------------------+ u
| | | | s
| +----------------+ | e
| | | s
| | uses |
| V |
| +----------------+ |
| | | |
+----->| Reflection SPI |<----------------------+
| |
+----------------+
|
| delegates
|
+---------+----------+
| |
V V
+-------------+ +-----------------+
| Javassist | | Java Reflection |
| API wrapper | | API wrapper |
+-------------+ +-----------------+
| |
| uses | uses
| |
V V
+-------------+ +------------+
| Javassist | | Reflection |
| API | | API |
+-------------+ +------------+
Reflection SPI
- package org.jboss.reflect.spi
- good starting points are e.g. ClassInfo, Value, TypeInfo ...
- this package represents the most important abstraction provided by JRM and is heavily reused by other JRM subcomponents (see picture above)
- the key goal of this package is to abstract Reflection in general
- provides reflection objects abstraction such as:
- MethodInfo, FieldInfo, ModifierInfo, ConstructorInfo ...
Javassist API wrapper
- package org.jboss.reflect.plugins.javassist
- good starting point is JavassistTypeInfoFactory(Impl)
- implements Javassist based JRM Reflection SPI
Reflection API wrapper
- package org.jboss.reflect.plugins.introspection
- good starting point is IntrospectionTypeInfoFactory(Impl)
- implements Java Reflection based JRM Reflection SPI
Joinpoint SPI
- package org.jboss.joinpoint.spi
- good starting point is JoinpointFactory, Joinpoint ...
- the main abstraction provided by this package is method Joinpoint.dispatch() which represents execution join point in general
- provides invocation abstraction on different JRM Reflection SPI objects, e.g.:
- MethodInfo call, ConstructorInfo call, FieldInfo set/get calls ...
Joinpoint default implementation
- package org.jboss.joinpoint.plugins
- good starting points are Config and BasicJoinpointFactory
- provides basic JRM Joinpoint SPI implementation that is completely based on JRM Reflection SPI abstraction
Configuration SPI
- package org.jboss.config.spi
- good starting point is Configuration
- Configuration represents main entry point to whole JRM API
- provides factory methods such as:
- getBeanInfo()
- getTypeInfo()
- getClassInfo()
- etc
- provides extensibility mechanism to register custom JRM factories, see methods:
- Configuration.setBeanInfoFactory()
- Configuration.setClassAdapterFactory()
- Configuration.setJoinpointFactory()
- Configuration.setTypeInfoFactory()
Configuration default implementation
- package org.jboss.config.plugins
- good starting point is BasicConfiguration
- there're implemented Java security checks for JRM factories (see AbstractConfiguration):
- setBeanInfoFactory()
- setClassAdapterFactory()
- setTypeInfoFactory()
- setJoinpointFactory()
- if no custom JRM factories are provided, it defaults to the following factories (see BasicConfiguration):
- org.jboss.beans.info.plugins.AbstractBeanInfoFactory
- org.jboss.classadapter.plugins.BasicClassAdapterFactory
- org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory
- org.jboss.joinpoint.plugins.BasicJoinpointFactoryBuilder
Classadapter SPI
- package org.jboss.classadapter.spi
- good starting point is ClassAdapter
- represents integration point for manipulating class information at runtime
Classadapter default implementation
- package org.jboss.classadapter.plugins
- good starting point is BasicClassAdapter
- heavily uses Configuration provided JRM factories
Beans Info SPI
- package org.jboss.beans.info.spi
- good starting points are BeanInfo, BeanAccessMode ...
- the main abstraction in this package is BeanInfo which allows users to:
- get/set MethodInfo, ConstructorInfo, PropertyInfo
- create new BeanInfo using newInstance() method
- invoke methods on the BeanInfo instance using invoke() and invokeStatic() methods
Beans Info default implementation
- package org.jboss.beans.info.plugins
- good starting point is AbstractBeanInfo
- implements Beans Info SPI
- the most intresting of this implementation is caching ability intended to minimize e.g. Java reflection heavy cloning
- see weak cache implementation in AbstractBeanInfoFactory.getBeanInfo() for more details
- the cache hierarchy is (all references are weak):
Classloaders -----+-----> Classloader1 -----+-----> ClassInfo1 -----+-----> BeanAccessMode1 -----+-----> BeanInfo1
| | | |
+-----> Classloader2 +-----> ClassInfo2 +-----> BeanAccessMode2 +-----> BeanInfo2
| | | |
etc etc etc etc
ClassLoading SPI
- package org.jboss.classloading.spi
- provides abstractions such as ClassLoadingDomain, DomainClassLoader
- TODO: Where is this SPI implemented in the JBoss AS? Or is it in the JRM API for API backward compatibility only?
Comments