You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2007/10/19 15:34:09 UTC
svn commit: r586442 - in
/myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation:
AnnotationInfoManager.java spring/AnnotationsInfoInitializer.java
Author: skitching
Date: Fri Oct 19 06:34:08 2007
New Revision: 586442
URL: http://svn.apache.org/viewvc?rev=586442&view=rev
Log:
Add comments only
Modified:
myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/AnnotationInfoManager.java
myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/spring/AnnotationsInfoInitializer.java
Modified: myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/AnnotationInfoManager.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/AnnotationInfoManager.java?rev=586442&r1=586441&r2=586442&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/AnnotationInfoManager.java (original)
+++ myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/AnnotationInfoManager.java Fri Oct 19 06:34:08 2007
@@ -31,7 +31,10 @@
import java.util.Map;
/**
- * This manager provides access to the parsed annotations.
+ * Inspects a class for Orchestra annotations, and if found then caches this information
+ * for later access.
+ * <p>
+ * The processing of Class objects is expected to happen only at application startup.
*/
public class AnnotationInfoManager
{
@@ -77,6 +80,16 @@
return annotationsInfoByViewId.get(viewId);
}
+ /**
+ * Inspect the provided class for annotations, and if found then cache the info
+ * keyed by the specified beanName.
+ * <p>
+ * Currently the annotations looked for are:
+ * <ul>
+ * <li>ViewController
+ * <li>ConversationRequire
+ * </ul>
+ */
public void processBeanAnnotations(String beanName, Class clazz)
{
ViewController viewController = (ViewController) clazz.getAnnotation(ViewController.class);
Modified: myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/spring/AnnotationsInfoInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/spring/AnnotationsInfoInitializer.java?rev=586442&r1=586441&r2=586442&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/spring/AnnotationsInfoInitializer.java (original)
+++ myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/annotation/spring/AnnotationsInfoInitializer.java Fri Oct 19 06:34:08 2007
@@ -31,6 +31,14 @@
/**
* Parse all configured spring beans and extract Orchestra annotations out of them.
+ * <p>
+ * Just declaring an instance of this type as a Spring Singleton will cause the
+ * postProcessBeanFactory to be called passing in info about all the bean declarations
+ * in the spring context, allowing Orchestra annotations on any directly declared class
+ * to be discovered and processed.
+ * <p>
+ * Every class referenced from a bean declaration is then passed to the
+ * AnnotationInfoManager instance that has been injected into this object.
*/
public class AnnotationsInfoInitializer implements BeanFactoryPostProcessor, Ordered
{
@@ -40,6 +48,9 @@
private AnnotationInfoManager annotationInfoManager;
+ /**
+ * Implement the Spring Ordered interface.
+ */
public int getOrder()
{
return order;
@@ -50,11 +61,18 @@
this.order = order;
}
+ /**
+ * Inject the object that actually inspects each Class for Orchestra annotations.
+ */
public void setAnnotationInfoManager(AnnotationInfoManager annotationInfoManager)
{
this.annotationInfoManager = annotationInfoManager;
}
+ /**
+ * For each bean in the beanFactory, load the appropriate Class object and pass it to the
+ * annotationInfoManager object for inspection.
+ */
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
{
String[] beanNames = beanFactory.getBeanDefinitionNames();