You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/09/16 19:06:47 UTC

svn commit: r289611 - in /beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow: ./ faces/internal/ internal/ internal/annotationreader/

Author: ekoneil
Date: Fri Sep 16 10:06:40 2005
New Revision: 289611

URL: http://svn.apache.org/viewcvs?rev=289611&view=rev
Log:
Remove the XMLBean dependence that the JPF AnnotationReader class had; this switches onto DOM from the JDK for parsing.

Contribution from Carlin Rogers.

BB: self
Test: NetUI BVT pass


Added:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/AnnotationAttribute.java   (with props)
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotation.java   (with props)
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotationParser.java   (with props)
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotations.java   (with props)
Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java?rev=289611&r1=289610&r2=289611&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java Fri Sep 16 10:06:40 2005
@@ -20,7 +20,6 @@
 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
 import org.apache.beehive.netui.pageflow.internal.CachedFacesBackingInfo;
-import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.internal.CachedSharedFlowRefInfo;
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
 import org.apache.beehive.netui.pageflow.handler.Handlers;
@@ -31,8 +30,6 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
 import java.util.Map;
 import java.util.Collections;
 import java.lang.reflect.Field;

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java?rev=289611&r1=289610&r2=289611&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java Fri Sep 16 10:06:40 2005
@@ -19,7 +19,7 @@
 
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
 import org.apache.beehive.netui.pageflow.internal.AnnotationReader;
-import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotation;
+import org.apache.beehive.netui.pageflow.internal.annotationreader.ProcessedAnnotation;
 import org.apache.beehive.netui.util.logging.Logger;
 import org.apache.beehive.netui.util.internal.cache.FieldCache;
 import org.apache.beehive.netui.util.internal.cache.MethodCache;

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java?rev=289611&r1=289610&r2=289611&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java Fri Sep 16 10:06:40 2005
@@ -18,55 +18,56 @@
 package org.apache.beehive.netui.pageflow.internal;
 
 import org.apache.beehive.netui.pageflow.PageFlowConstants;
-import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotationsDocument;
-import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotation;
-import org.apache.beehive.netui.compiler.schema.annotations.AnnotatedElement;
-import org.apache.beehive.netui.compiler.schema.annotations.AnnotationAttribute;
-import org.apache.beehive.netui.util.logging.Logger;
+import org.apache.beehive.netui.pageflow.internal.annotationreader.AnnotationAttribute;
+import org.apache.beehive.netui.pageflow.internal.annotationreader.ProcessedAnnotation;
+import org.apache.beehive.netui.pageflow.internal.annotationreader.ProcessedAnnotations;
+import org.apache.beehive.netui.pageflow.internal.annotationreader.ProcessedAnnotationParser;
 import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
-import org.apache.xmlbeans.XmlException;
+import org.apache.beehive.netui.util.logging.Logger;
 
 import javax.servlet.ServletContext;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.Serializable;
 import java.lang.reflect.Member;
+import java.util.Iterator;
+import java.util.Map;
 
 /**
  * Utility for reading XML files that describe annotations in classes.  These files are generated during Page Flow build.
- */ 
+ */
 public class AnnotationReader
         implements Serializable
 {
     private static final Logger _log = Logger.getInstance( AnnotationReader.class );
     private static final String CACHE_ATTR = InternalConstants.ATTR_PREFIX + "annCache";
-    
-    private ProcessedAnnotationsDocument.ProcessedAnnotations _annotations;
-    
+
+    private ProcessedAnnotations _annotations;
+
     public static AnnotationReader getAnnotationReader( Class type, ServletContext servletContext )
     {
         InternalConcurrentHashMap cache = ( InternalConcurrentHashMap ) servletContext.getAttribute( CACHE_ATTR );
-        
+
         if ( cache == null )
         {
             cache = new InternalConcurrentHashMap();
             servletContext.setAttribute( CACHE_ATTR, cache );
         }
-        
+
         AnnotationReader reader = ( AnnotationReader ) cache.get( type );
-        
+
         if ( reader == null )
         {
             reader = new AnnotationReader( type, servletContext );
             cache.put( type, reader );
         }
-        
+
         return reader;
     }
-    
+
     private AnnotationReader( Class type, ServletContext servletContext )
     {
-        String annotationsXml = 
+        String annotationsXml =
                 PageFlowConstants.PAGEFLOW_MODULE_CONFIG_GEN_DIR + "/jpf-annotations-"
                 + type.getName().replace( '.', '-' ) + ".xml";
         InputStream in = servletContext.getResourceAsStream( annotationsXml );
@@ -76,103 +77,89 @@
             annotationsXml = annotationsXml.substring( 1 );
             in = Thread.currentThread().getContextClassLoader().getResourceAsStream( annotationsXml );
         }
-        
-        
+
+
         if ( in != null )
         {
+            _annotations = ProcessedAnnotationParser.parse( annotationsXml, in );
             try
             {
-                ProcessedAnnotationsDocument doc = ProcessedAnnotationsDocument.Factory.parse( in );
-                _annotations = doc.getProcessedAnnotations();
-            }
-            catch ( XmlException e )
-            {
-                _log.error( "Error while parsing annotations XML file " + annotationsXml, e );
+                in.close();
             }
             catch ( IOException e )
             {
-                _log.error( "Error while reading annotations XML file " + annotationsXml, e );
-            }
-            finally
-            {
-                try
-                {
-                    in.close();
-                }
-                catch ( IOException e )
-                {
-                    _log.error( "Could not close input stream for " + annotationsXml, e );
-                }
+                _log.error( "Could not close input stream for " + annotationsXml, e );
             }
         }
     }
-    
+
     public ProcessedAnnotation getAnnotation( String declarationName, String annotationTypeName )
     {
         if ( _annotations == null ) return null;
-        
-        AnnotatedElement[] elements = _annotations.getAnnotatedElementArray();
-        
-        for ( int i = 0; i < elements.length; i++ )
+
+        Map elements = _annotations.getAnnotatedElements();
+
+        for ( Iterator i = elements.keySet().iterator(); i.hasNext(); )
         {
-            AnnotatedElement element = elements[i];
-            if ( element.getElementName().equals( declarationName ) )
+            String name = ( String ) i.next();
+            if ( name.equals( declarationName ) )
             {
                 // For now, we can be sure that there's only one element in this array.
-                assert element.getAnnotationArray().length == 1 : element.getAnnotationArray().length;
-                ProcessedAnnotation pa = element.getAnnotationArray( 0 );
+                ProcessedAnnotation[] annotations = ( ProcessedAnnotation[] ) elements.get( name );
+                assert annotations.length == 1 : annotations.length;
+                ProcessedAnnotation pa = annotations[ 0 ];
                 return pa.getAnnotationName().equals( annotationTypeName ) ? pa : null;
             }
         }
-        
+
         return null;
     }
-    
+
     public ProcessedAnnotation getJpfAnnotation( Member member, String annotationTypeName )
     {
         return getAnnotation( member.getName(), InternalConstants.ANNOTATION_QUALIFIER + annotationTypeName );
     }
-    
+
     public ProcessedAnnotation getJpfAnnotation( Class type, String annotationTypeName )
     {
         return getAnnotation( type.getName(), InternalConstants.ANNOTATION_QUALIFIER + annotationTypeName );
     }
-    
+
     public static String getStringAttribute( ProcessedAnnotation ann, String attrName )
     {
-        AnnotationAttribute[] attrs = ann.getAnnotationAttributeArray();
-        
+        AnnotationAttribute[] attrs = ann.getAnnotationAttributes();
+
         for ( int i = 0; i < attrs.length; i++ )
         {
             AnnotationAttribute attr = attrs[i];
-            
+
             if ( attr.getAttributeName().equals( attrName ) )
             {
-                String value = attr.getStringValue1();
+                String value = attr.getStringValue();
                 assert value != null : "attribute " + attrName + " did not have a String value";
                 return value;
             }
         }
-        
+
         return null;
     }
-    
+
     public static ProcessedAnnotation[] getAnnotationArrayAttribute( ProcessedAnnotation ann, String attrName )
     {
-        AnnotationAttribute[] attrs = ann.getAnnotationAttributeArray();
-        
+        AnnotationAttribute[] attrs = ann.getAnnotationAttributes();
+
         for ( int i = 0; i < attrs.length; i++ )
         {
             AnnotationAttribute attr = attrs[i];
-            
+
             if ( attr.getAttributeName().equals( attrName ) )
             {
-                ProcessedAnnotation[] array = attr.getAnnotationValueArray();
+                ProcessedAnnotation[] array = attr.getAnnotationValues();
                 assert array != null : "attribute " + attrName + " did not have an array of annotations.";
                 return array;
             }
         }
-        
+
         return null;
     }
 }

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java?rev=289611&r1=289610&r2=289611&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java Fri Sep 16 10:06:40 2005
@@ -17,13 +17,12 @@
  */
 package org.apache.beehive.netui.pageflow.internal;
 
-import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotation;
+import org.apache.beehive.netui.pageflow.internal.annotationreader.ProcessedAnnotation;
 
-import javax.servlet.ServletContext;
-import java.util.List;
-import java.util.ArrayList;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
 
 public class CachedSharedFlowRefInfo
 {

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java?rev=289611&r1=289610&r2=289611&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java Fri Sep 16 10:06:40 2005
@@ -17,15 +17,12 @@
  */
 package org.apache.beehive.netui.pageflow.internal;
 
-import org.apache.beehive.netui.util.internal.InternalStringBuilder;
-
 import org.apache.beehive.controls.runtime.servlet.ServletBeanContext;
 import org.apache.beehive.controls.api.bean.Controls;
 import org.apache.beehive.controls.api.bean.ControlBean;
 import org.apache.beehive.controls.api.bean.Control;
 import org.apache.beehive.controls.api.context.ControlBeanContext;
 import org.apache.beehive.controls.api.properties.AnnotatedElementMap;
-import org.apache.beehive.controls.api.properties.PropertyMap;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;

Added: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/AnnotationAttribute.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/AnnotationAttribute.java?rev=289611&view=auto
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/AnnotationAttribute.java (added)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/AnnotationAttribute.java Fri Sep 16 10:06:40 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.pageflow.internal.annotationreader;
+
+/**
+ *
+ */
+public class AnnotationAttribute
+{
+    private String _attributeName;
+    private String _stringValue;
+    private ProcessedAnnotation[] _annotationValues;
+
+    public AnnotationAttribute()
+    {
+    }
+
+    public AnnotationAttribute( String attributeName, String value )
+    {
+        _attributeName = attributeName;
+        _stringValue = value;
+    }
+
+    public AnnotationAttribute( String attributeName, ProcessedAnnotation[] annotationValues )
+    {
+        _attributeName = attributeName;
+        _annotationValues = annotationValues;
+    }
+
+    public String getAttributeName()
+    {
+        return _attributeName;
+    }
+
+    public void setAttributeName( String attributeName )
+    {
+        _attributeName = attributeName;
+    }
+
+    public String getStringValue()
+    {
+        return _stringValue;
+    }
+
+    public void setStringValue( String value )
+    {
+        _stringValue = value;
+    }
+
+    public ProcessedAnnotation[] getAnnotationValues()
+    {
+        return _annotationValues;
+    }
+
+    public void setAnnotationValues( ProcessedAnnotation[] annotationValues )
+    {
+        _annotationValues = annotationValues;
+    }
+}

Propchange: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/AnnotationAttribute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotation.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotation.java?rev=289611&view=auto
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotation.java (added)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotation.java Fri Sep 16 10:06:40 2005
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.pageflow.internal.annotationreader;
+
+/**
+ *
+ */
+public class ProcessedAnnotation
+{
+
+    private String _annotationName;
+    private AnnotationAttribute[] _annotationAttributes;
+
+    public ProcessedAnnotation()
+    {
+    }
+
+    public ProcessedAnnotation( String annotationName, AnnotationAttribute[] annotationAttributes )
+    {
+        _annotationName = annotationName;
+        _annotationAttributes = annotationAttributes;
+    }
+
+    public String getAnnotationName()
+    {
+        return _annotationName;
+    }
+
+    public void setAnnotationName( String annotationName )
+    {
+        _annotationName = annotationName;
+    }
+
+    public AnnotationAttribute[] getAnnotationAttributes()
+    {
+        return _annotationAttributes;
+    }
+
+    public void setAnnotationAttributes( AnnotationAttribute[] annotationAttributes )
+    {
+        _annotationAttributes = annotationAttributes;
+    }
+}

Propchange: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotationParser.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotationParser.java?rev=289611&view=auto
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotationParser.java (added)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotationParser.java Fri Sep 16 10:06:40 2005
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.pageflow.internal.annotationreader;
+
+import org.apache.beehive.netui.util.xml.DomUtils;
+import org.apache.beehive.netui.util.logging.Logger;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+public final class ProcessedAnnotationParser
+{
+    private static final Logger _log = Logger.getInstance( ProcessedAnnotationParser.class );
+
+    private static final String ANNOTATED_ELEMENT = "annotated-element";
+    private static final String ANNOTATION = "annotation";
+    private static final String ANNOTATION_ATTRIBUTE = "annotation-attribute";
+    private static final String ANNOTATION_NAME = "annotation-name";
+    private static final String ATTRIBUTE_NAME = "attribute-name";
+    private static final String ATTRIBUTE_STRING_VALUE = "string-value";
+    private static final String ATTRIBUTE_VALUE = "annotation-value";
+    private static final String ELEMENT_NAME = "element-name";
+    private static final String TYPE_NAME = "type-name";
+
+    /* do not construct */
+    private ProcessedAnnotationParser() {}
+
+    public static ProcessedAnnotations parse( final String annotationsXml, final InputStream is )
+    {
+        assert is != null;
+
+        ProcessedAnnotations processedAnnotations = null;
+        try
+        {
+            /* parse the config document */
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse( is );
+            Element root = document.getDocumentElement();
+            String typeName = getElementText( root, TYPE_NAME );
+            assert typeName != null : "Missing the following element: " + TYPE_NAME;
+            Map annotatedElements = parseAnnotatedElements( root );
+            processedAnnotations = new ProcessedAnnotations( typeName, annotatedElements );
+        }
+        catch ( ParserConfigurationException pce )
+        {
+            _log.error( "Error occurred while parsing annotations XML file " + annotationsXml, pce );
+        }
+        catch ( SAXException saxe )
+        {
+            _log.error( "Error occurred while parsing annotations XML file " + annotationsXml, saxe );
+        }
+        catch ( IOException ioe )
+        {
+            _log.error( "Error occurred while parsing annotations XML file " + annotationsXml, ioe );
+        }
+        return processedAnnotations;
+    }
+
+    private static final Map parseAnnotatedElements( Element parent )
+    {
+        if ( parent == null )
+        {
+            return null;
+        }
+
+        List list = DomUtils.getChildElementsByName( parent, ANNOTATED_ELEMENT );
+        if ( list == null || list.size() == 0 )
+        {
+            return null;
+        }
+
+        HashMap annotatedElements = new HashMap();
+        for ( int i = 0; i < list.size(); i++ )
+        {
+            Element elem = ( Element ) list.get( i );
+            String name = getElementText( elem, ELEMENT_NAME );
+            assert name != null : "Missing the following element: " + ELEMENT_NAME;
+
+            ProcessedAnnotation[] annotations = parseProcessedAnnotations( elem, ANNOTATION );
+            assert annotations != null : "Missing the following element: " + ANNOTATION;
+
+            annotatedElements.put( name, annotations );
+        }
+        return annotatedElements;
+    }
+
+    private static final ProcessedAnnotation[] parseProcessedAnnotations( Element parent, String nodeName )
+    {
+        if ( parent == null )
+        {
+            return null;
+        }
+
+        List list = DomUtils.getChildElementsByName( parent, nodeName );
+        if ( list == null || list.size() == 0 )
+        {
+            return null;
+        }
+
+        ProcessedAnnotation[] annotations = new ProcessedAnnotation[list.size()];
+        for ( int i = 0; i < list.size(); i++ )
+        {
+            Element elem = ( Element ) list.get( i );
+            String name = getElementText( elem, ANNOTATION_NAME );
+            assert name != null : "Missing the following element: " + ANNOTATION_NAME;
+
+            AnnotationAttribute[] attributes = parseAnnotationAttribute( elem );
+            annotations[i] =  new ProcessedAnnotation( name, attributes );
+        }
+        return annotations;
+    }
+
+    private static final AnnotationAttribute[] parseAnnotationAttribute( Element parent )
+    {
+        if ( parent == null )
+        {
+            return null;
+        }
+
+        List list = DomUtils.getChildElementsByName( parent, ANNOTATION_ATTRIBUTE );
+        if ( list == null || list.size() == 0 )
+        {
+            return null;
+        }
+
+        AnnotationAttribute[] attributes = new AnnotationAttribute[list.size()];
+        for ( int i = 0; i < list.size(); i++ )
+        {
+            Element elem = ( Element ) list.get( i );
+            String name = getElementText( elem, ATTRIBUTE_NAME );
+            assert name != null : "Missing the following element: " + ATTRIBUTE_NAME;
+
+            String value = getElementText( elem, ATTRIBUTE_STRING_VALUE );
+            if ( value != null )
+            {
+                attributes[i] =  new AnnotationAttribute( name, value );
+            }
+            else
+            {
+                ProcessedAnnotation[] annotations = parseProcessedAnnotations( elem, ATTRIBUTE_VALUE );
+                attributes[i] =  new AnnotationAttribute( name, annotations );
+            }
+        }
+        return attributes;
+    }
+
+    private static String getElementText( Element parent, String elementName )
+    {
+        Element child = DomUtils.getChildElementByName( parent, elementName );
+        if ( child != null )
+        {
+            String text = DomUtils.getElementText( child );
+            if ( text != null )
+            {
+                return text.length() == 0 ? null : text;
+            }
+        }
+
+        return null;
+    }
+}

Propchange: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotationParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotations.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotations.java?rev=289611&view=auto
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotations.java (added)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotations.java Fri Sep 16 10:06:40 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.pageflow.internal.annotationreader;
+
+import java.util.Map;
+
+/**
+ *
+ */
+public class ProcessedAnnotations
+{
+
+    private String _typeName;
+    private Map _annotatedElements;
+
+    public ProcessedAnnotations()
+    {
+    }
+
+    public ProcessedAnnotations( String typeName, Map annotatedElements )
+    {
+        _typeName = typeName;
+        _annotatedElements = annotatedElements;
+    }
+
+    public String getTypeName()
+    {
+        return _typeName;
+    }
+
+    public void setTypeName( String typeName )
+    {
+        _typeName = typeName;
+    }
+
+    public Map getAnnotatedElements()
+    {
+        return _annotatedElements;
+    }
+
+    public void setAnnotatedElements( Map annotatedElements )
+    {
+        _annotatedElements = annotatedElements;
+    }
+}

Propchange: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/annotationreader/ProcessedAnnotations.java
------------------------------------------------------------------------------
    svn:eol-style = native