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 2006/04/25 18:00:23 UTC

svn commit: r396906 - in /beehive/trunk/controls: src/api/org/apache/beehive/controls/api/properties/ src/runtime/org/apache/beehive/controls/runtime/bean/ src/runtime/org/apache/beehive/controls/runtime/packaging/ src/runtime/org/apache/beehive/contro...

Author: ekoneil
Date: Tue Apr 25 09:00:21 2006
New Revision: 396906

URL: http://svn.apache.org/viewcvs?rev=396906&view=rev
Log:
Controls Javadoc cleanup and todos.

BB: self
Test: Controls pass


Modified:
    beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySetProxy.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/packaging/ControlEventSetDescriptor.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpRequestService.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpResponseService.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletServiceProvider.java
    beehive/trunk/controls/test/build.xml

Modified: beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySetProxy.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySetProxy.java?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySetProxy.java (original)
+++ beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySetProxy.java Tue Apr 25 09:00:21 2006
@@ -27,7 +27,7 @@
  * values held within a PropertyMap as an Object implementing an annotation type interface.
  * <p>
  * This enables properties resolved using the {@link PropertyMap}'s hiearchical resolution mechanism to
- * be exposed to the client of the proxy in the same way that JSR-175 annotations are 
+ * be exposed to the client of the proxy in the same way that Java 5 annotations are 
  * exposed using raw Java reflection APIs.   A proxy of this type should behave identically
  * to the one returned from a call to <code>AnnotatedElement.getAnnotation()</code>, but backed
  * by a richer, more dynamic resolution mechanism.

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java Tue Apr 25 09:00:21 2006
@@ -25,7 +25,6 @@
 import java.beans.PropertyVetoException;
 import java.beans.beancontext.BeanContext;
 import java.beans.beancontext.BeanContextServiceRevokedEvent;
-import java.beans.beancontext.BeanContextServiceRevokedListener;
 import java.beans.beancontext.BeanContextServiceProvider;
 import java.beans.beancontext.BeanContextServices;
 import java.beans.beancontext.BeanContextServicesSupport;
@@ -113,7 +112,8 @@
      * method.  This hook is used to perform additional processing that needs to occur when the control is associated
      * with a new nesting context.
      */
-    public synchronized void setBeanContext(BeanContext beanContext) throws PropertyVetoException
+    public synchronized void setBeanContext(BeanContext beanContext)
+        throws PropertyVetoException
     {
         ControlBeanContext cbcs = null;
 
@@ -181,7 +181,7 @@
             if (_nameGenerators == null)
                 _nameGenerators = new HashMap<String,NameGenerator>();
 
-            NameGenerator nameGenerator = (NameGenerator)_nameGenerators.get(namePrefix);
+            NameGenerator nameGenerator = _nameGenerators.get(namePrefix);
             if (nameGenerator == null)
             {
                 nameGenerator = new NameGenerator(namePrefix);
@@ -217,9 +217,6 @@
         String beanID = null;
         if (targetChild instanceof ControlBean)
         {
-            //
-            //
-            //
             ControlBean bean = (ControlBean)targetChild;
             beanID = bean.getLocalID();
 
@@ -239,6 +236,7 @@
                                                    beanID);
             }
         }
+
         boolean added = super.add(targetChild);
         if (added && beanID != null)
             _childMap.put(beanID, targetChild);
@@ -254,6 +252,7 @@
     {
         assert targetChild instanceof ControlBean;  // should be guaranteed above
         boolean removed = super.remove(targetChild);
+
         if (removed)
         {   
             //
@@ -285,7 +284,7 @@
 
         // Get the BeanContext associated with the found child, and then ask it
         // to resolve the rest of the path
-        return ((ControlBeanContext)bean.getBeanContextProxy()).getBean(id.substring(delim+1));
+        return bean.getBeanContextProxy().getBean(id.substring(delim+1));
     }
 
     /**
@@ -335,7 +334,7 @@
     /**
      * Returns the PropertyMap containing default properties for an AnnotatedElement
      * in the current context.  The initialization of PropertyMap binding is always
-     * done by delegating to a ControlContainerContext, enabling containers to implement
+     * done by delegating to a {@link ControlContainerContext}, enabling containers to implement
      * property binding mechanisms (such as external config) that may override the values
      * contained within the element annotations.
      */
@@ -385,6 +384,7 @@
         {
            annotClass = bean.getControlInterface();
         }
+
         if (annotClass != null)
         {
             PropertyMap delegateMap = bean.getAnnotationMap(annotClass);
@@ -395,7 +395,7 @@
     /**
      * Returns the default binding based entirely upon annotations or naming conventions.
      */
-    static public String getDefaultControlBinding(Class controlIntf)
+    public static String getDefaultControlBinding(Class controlIntf)
     {
         controlIntf = ControlBean.getMostDerivedInterface(controlIntf);
 
@@ -493,18 +493,16 @@
     // ControlBeanContext.getParameterPropertySet
     //
     public <T extends Annotation> T getParameterPropertySet(Method m, int i, Class<T> propertySet)
-                                    throws IllegalArgumentException, IndexOutOfBoundsException
+        throws IllegalArgumentException, IndexOutOfBoundsException
     {
         if (i >= m.getParameterTypes().length)
             throw new IndexOutOfBoundsException("Invalid parameter index for method:" + m);
 
-        //
-        // BUGBUG: Currently, there is no external override mechanism for method parameters
-        //
+        // todo: Currently, there is no external override mechanism for method parameters
         Annotation [] paramAnnots = m.getParameterAnnotations()[i];
-        for (int j = 0; j < paramAnnots.length; j++)
-            if (propertySet.isAssignableFrom(paramAnnots[j].getClass()))
-                return (T)paramAnnots[j];
+        for (Annotation paramAnnot : paramAnnots)
+            if (propertySet.isAssignableFrom(paramAnnot.getClass()))
+                return (T) paramAnnot;
 
         return null;
     }
@@ -512,7 +510,8 @@
     //
     // ControlBeanContext.getParameterNames
     //
-    public String [] getParameterNames(Method m) throws IllegalArgumentException
+    public String [] getParameterNames(Method m)
+        throws IllegalArgumentException
     {
         return _bean.getParameterNames(m);
     }
@@ -521,7 +520,7 @@
     // ControlBeanContext.getNamedParameterValue
     //
     public Object getParameterValue(Method m, String parameterName, Object [] parameters)
-                  throws IllegalArgumentException
+        throws IllegalArgumentException
     {
         String [] names = getParameterNames(m);    
 
@@ -583,8 +582,7 @@
         //
         try
         {
-            return  (T)((BeanContextServices)bc).getService(this, _bean, serviceClass, selector, 
-                                                            this);
+            return  (T)((BeanContextServices)bc).getService(this, _bean, serviceClass, selector, this);
         }
         catch (TooManyListenersException tmle)
         {
@@ -626,7 +624,7 @@
 
     /**
      * Filename that contains ordering priority for controls interceptor services.
-     * Each line in the file is a fully qualified interface name.  1st line in the file
+     * Each line in the file is a fully qualified interface name.  The first line in the file
      * is highest priority.
      */
     public static final String INTERCEPTOR_CONFIG_FILE = "controls-interceptors.config";
@@ -646,7 +644,8 @@
         // Read external configuration to obtain desired prioritization.
         if ( _interceptorPriorities == null )
         {
-            // Only ever attempt to read the external configuration once; bounce the VM if you want to try again.
+            // Only ever attempt to read the external configuration once; bounce the VM if you
+            // want to try again.
             _interceptorPriorities = new ArrayList<String>();
             BufferedReader in = null;
             try
@@ -736,11 +735,8 @@
     {
         if (_lifeCycleListeners != null)
         {
-            Iterator iter = _lifeCycleListeners.iterator();      
-            while (iter.hasNext())
-            {
-                LifeCycle listener = (LifeCycle)iter.next();
-                listener.onPropertyChange(pce);
+            for (LifeCycle lifeCycleListener : _lifeCycleListeners) {
+                lifeCycleListener.onPropertyChange(pce);
             }
         }
     }
@@ -801,7 +797,7 @@
 
     //
     // BeanContextServices.getCurrentServiceClasses
-    // Override the default implementatino of getCurrentServiceClasses inherited from
+    // Override the default implementation of getCurrentServiceClasses inherited from
     // java.beans.beancontext.BeanContextServicesSuppport.  The reason for this is a bug/
     // flaw in its underlying implementation.  It does not include any services exposed
     // by any nesting contexts.  This is contradictory to the implementation of hasService()
@@ -816,7 +812,7 @@
 
         while (bcs != null)
         {
-            // Optimize the case where we can do a direct copy based upon impl knowledge.
+            // Optimize the case where we can do a direct copy based upon superclass impl knowledge.
             if (bcs instanceof ControlBeanContext)
             {
                 classSet.addAll(((ControlBeanContext)bcs).services.keySet());

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java Tue Apr 25 09:00:21 2006
@@ -91,8 +91,7 @@
      * @param bean the acquiring ControlBean.  Unused by the base implementation, but
      *             available so subclassed containers can have access to the bean.
      */
-    protected synchronized void addResourceContext(ResourceContext resourceContext,
-                                                   ControlBean bean)
+    protected synchronized void addResourceContext(ResourceContext resourceContext, ControlBean bean)
     {
         if (!resourceContext.hasResources())
             _resourceContexts.push(resourceContext); 
@@ -105,8 +104,7 @@
      * @param bean the acquiring ControlBean.  Unused by the base implementation, but
      *             available so subclassed containers can have access to the bean.
      */
-    protected synchronized void removeResourceContext(ResourceContext resourceContext,
-                                                      ControlBean bean)
+    protected synchronized void removeResourceContext(ResourceContext resourceContext, ControlBean bean)
     {
         //
         // Ignore removal requests received within the context of global cleanup.  The

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/packaging/ControlEventSetDescriptor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/packaging/ControlEventSetDescriptor.java?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/packaging/ControlEventSetDescriptor.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/packaging/ControlEventSetDescriptor.java Tue Apr 25 09:00:21 2006
@@ -37,14 +37,15 @@
     /**
      * This constructor adds the getListenerMethod argument that is missing from the JDK!
      */
-    public ControlEventSetDescriptor(String eventSetName, Class<?> listenerType,
+    public ControlEventSetDescriptor(String eventSetName,
+                                     Class<?> listenerType,
                                      MethodDescriptor[] listenerMethodDescriptors,
-                                     Method addListenerMethod, Method removeListenerMethod,
+                                     Method addListenerMethod,
+                                     Method removeListenerMethod,
                                      Method getListenerMethod)
            throws IntrospectionException
     {
-        super(eventSetName, listenerType, listenerMethodDescriptors, 
-              addListenerMethod, removeListenerMethod);
+        super(eventSetName, listenerType, listenerMethodDescriptors, addListenerMethod, removeListenerMethod);
 
         // Follow the same pattern as the JDK and store the method as a soft reference, so
         // the introspector (alone) won't prevent Class garbage collection.

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpRequestService.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpRequestService.java?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpRequestService.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpRequestService.java Tue Apr 25 09:00:21 2006
@@ -32,6 +32,9 @@
     extends ServletRequestService
     implements HttpServletRequest
 {
+
+    // todo: how will this class version with subsequent Servlet specification versions?
+
     /**
      * This static helper class derives from javax.servlet.HttpServletRequestWrapper and can
      * be used to wrap a HttpServletRequestService instance in cases where the client expects

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpResponseService.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpResponseService.java?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpResponseService.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/HttpResponseService.java Tue Apr 25 09:00:21 2006
@@ -32,6 +32,9 @@
     extends ServletResponseService 
     implements HttpServletResponse
 {
+
+    // todo: how will this class version with subsequent Servlet specification versions?
+    
     /**
      * This static helper class derives from javax.servlet.HttpServletResponseWrapper and can
      * be used to wrap a HttpServletResponseService instance in cases where the client expects

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java Tue Apr 25 09:00:21 2006
@@ -22,7 +22,6 @@
 import java.beans.beancontext.BeanContextChild;
 import java.net.URL;
 import java.net.MalformedURLException;
-
 import javax.servlet.ServletContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
@@ -105,7 +104,8 @@
     /**
      * Pushes the current request context onto the stack
      */
-    private synchronized void pushRequestContext(ServletContext context, ServletRequest req, 
+    private synchronized void pushRequestContext(ServletContext context,
+                                                 ServletRequest req,
                                                  ServletResponse resp)
     {
         getRequestStack().push(new RequestContext(context, req, resp));
@@ -184,13 +184,12 @@
      *
      * @param name the resource name
      * @param bcc the specified child
-     * @return an <code>InputStream</code> for reading the resource,
-     * or <code>null</code> if the resource could not
-     * be found.
-     * @throws <code>IllegalArgumentException</code> if
-     * the resource is not valid
+     * @return an <code>InputStream</code> for reading the resource, or
+     *         <code>null</code> if the resource could not be found.
+     * @throws IllegalArgumentException <code>IllegalArgumentException</code> if the resource is not valid
      */
-    public InputStream getResourceAsStream(String name, BeanContextChild bcc) throws IllegalArgumentException
+    public InputStream getResourceAsStream(String name, BeanContextChild bcc)
+        throws IllegalArgumentException
     {
         ServletContext sc = getServletContext();
         if ( sc != null )
@@ -206,10 +205,10 @@
      * @param bcc the specified child
      * @return a <code>URL</code> for the named
      * resource for the specified child
-     * @throws <code>IllegalArgumentException</code>
-     * if the resource is not valid
+     * @throws IllegalArgumentException <code>IllegalArgumentException</code> if the resource is not valid
      */
-    public URL getResource(String name, BeanContextChild bcc) throws IllegalArgumentException
+    public URL getResource(String name, BeanContextChild bcc)
+        throws IllegalArgumentException
     {
         ServletContext sc = getServletContext();
         if ( sc != null )
@@ -233,4 +232,4 @@
 
     private boolean _useWrappers = true;
     private transient Stack<RequestContext> _reqStack;
-}
+}
\ No newline at end of file

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletServiceProvider.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletServiceProvider.java?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletServiceProvider.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ServletServiceProvider.java Tue Apr 25 09:00:21 2006
@@ -41,8 +41,7 @@
 
     /* package */ ServletServiceProvider() {}
 
-    public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass,
-                             Object serviceSelector)
+    public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector)
     {
         //
         // These services are only available to controls running within the scope of a

Modified: beehive/trunk/controls/test/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/build.xml?rev=396906&r1=396905&r2=396906&view=diff
==============================================================================
--- beehive/trunk/controls/test/build.xml (original)
+++ beehive/trunk/controls/test/build.xml Tue Apr 25 09:00:21 2006
@@ -404,13 +404,13 @@
              failonerror="${tch.fail-build}"
              dir="${controls.test.root}/build"
              inheritall="true">
-             <arg value="-emacs"/>
-             <property name="tch.replication.entry-point" value="ant -f ${controls.test.root}/build.xml run"/>
-             <sysproperty key="TEST_HOSTNAME" value="${test.hostname}"/>
-             <sysproperty key="TEST_HOSTNAME_PORT" value="${test.hostname.port}"/>
-             <sysproperty key="gtlf.dtd.use.remote" value="${gtlf.dtd.use.remote}"/>
-             <sysproperty key="gtlf.dtd.remote" value="${gtlf.dtd.remote}"/>
-             <sysproperty key="gtlf.dtd.local" value="${gtlf.dtd.local}"/>
+            <arg value="-emacs"/>
+            <property name="tch.replication.entry-point" value="ant -f ${controls.test.root}/build.xml run"/>
+            <sysproperty key="TEST_HOSTNAME" value="${test.hostname}"/>
+            <sysproperty key="TEST_HOSTNAME_PORT" value="${test.hostname.port}"/>
+            <sysproperty key="gtlf.dtd.use.remote" value="${gtlf.dtd.use.remote}"/>
+            <sysproperty key="gtlf.dtd.remote" value="${gtlf.dtd.remote}"/>
+            <sysproperty key="gtlf.dtd.local" value="${gtlf.dtd.local}"/>
         </tch>
 
         <ant antfile="${controls.test.infra.dir}/tch/runtime/build.xml" target="generate-html-log" dir="${controls.test.root}" inheritAll="false">