You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ky...@apache.org on 2005/02/25 17:08:13 UTC
svn commit: r155338 -
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
Author: kylem
Date: Fri Feb 25 08:08:11 2005
New Revision: 155338
URL: http://svn.apache.org/viewcvs?view=rev&rev=155338
Log:
Added bean construction-time check to ensure that bound implementation class is marked with the @ControlImplementation annotation. Without this, there will be other (less overt) downstream initialization failures. Resolves BEEHIVE-84.
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java?view=diff&r1=155337&r2=155338
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java (original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java Fri Feb 25 08:08:11 2005
@@ -34,6 +34,7 @@
import org.apache.beehive.controls.api.versioning.Version;
import org.apache.beehive.controls.api.bean.Threading;
import org.apache.beehive.controls.api.bean.ThreadingPolicy;
+import org.apache.beehive.controls.api.bean.ControlImplementation;
import org.apache.beehive.controls.api.bean.ControlExtension;
import org.apache.beehive.controls.api.bean.ControlInterface;
import org.apache.beehive.controls.api.context.ControlThreadContext;
@@ -143,12 +144,22 @@
else
implBinding = ControlBeanContext.getDefaultControlBinding(_controlIntf);
- // REVIEW: consider surfacing ClassNotFoundException in the generated bean's ctors. Is that a violation
- // of JavaBean spec for the signature of bean ctors?
+ // REVIEW: consider surfacing ClassNotFoundException in the generated bean's ctors.
+ // Is that a violation of JavaBean spec for the signature of bean ctors?
try
{
_implClass = _controlIntf.getClassLoader().loadClass(implBinding);
+
+ //
+ // Validate that the specified implementation class has an @ControlImplementation
+ // annotation, else downstream requirements (such as having a valid control init
+ // class) will not be met.
+ //
+ if (_implClass.getAnnotation(ControlImplementation.class) == null)
+ {
+ throw new ControlException("@org.apache.beehive.controls.api.bean.ControlImplementation annotation is missing from control implementation class: " + _implClass.getName());
+ }
}
catch (ClassNotFoundException cnfe)
{