Author: kentam
Date: Thu Apr 21 16:43:56 2005
New Revision: 164149
URL: http://svn.apache.org/viewcvs?rev=164149&view=rev
Log:
BEEHIVE-387: Enforce @VersionRequired on control fields at runtime
BEEHIVE-403: ant build.dist.archives does not work from DOS window
BEEHIVE-29: Apache infrastructure for regular builds, serving distributions
(gump/maven integration)
We're back to using the ant <tar>/<untar> tasks to build/test archives. This
means Beehive .tar.gz archives
require GNU tar to be processed under Windows -- any MKS tar users need to
switch to GNU tar.
Confirmed that the verify.dist.archives target works.
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ClientInitializer.java
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
incubator/beehive/trunk/distribution.xml
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ClientInitializer.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ClientInitializer.java?rev=164149&r1=164148&r2=164149&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ClientInitializer.java
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ClientInitializer.java
Thu Apr 21 16:43:56 2005
@@ -20,6 +20,8 @@
import java.lang.reflect.AnnotatedElement;
import org.apache.beehive.controls.api.context.ControlBeanContext;
import org.apache.beehive.controls.api.properties.PropertyMap;
+import org.apache.beehive.controls.api.versioning.VersionRequired;
+import org.apache.beehive.controls.api.versioning.Version;
/**
* The ClientInitializer class is an abstract base class that all generated
Control
@@ -29,6 +31,23 @@
*/
abstract public class ClientInitializer
{
+ /**
+ * Enforces the VersionRequired annotation at runtime (called when an
instance of a control is annotated
+ * with VersionRequired). Throws a ControlException if enforcement fails.
+ *
+ * @param versionRequired the value of the VersionRequired annotation on a
control field
+ */
+ protected static void enforceVersionRequired( ControlBean control,
VersionRequired versionRequired )
+ {
+ Class controlIntf = control.getMostDerivedInterface(
control.getControlInterface() );
+
+ Version versionPresent = (Version) controlIntf.getAnnotation(
Version.class );
+ if ( versionPresent != null )
+ {
+ ControlBean.enforceVersionRequired(
controlIntf.getCanonicalName(), versionPresent, versionRequired );
+ }
+ }
+
/**
* Returns the annotation map for the specified bean/element combination.
*/
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?rev=164149&r1=164148&r2=164149&view=diff
==============================================================================
---
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
Thu Apr 21 16:43:56 2005
@@ -55,6 +55,9 @@
* are generally marked as protected and have names that start with an
underscore. This avoids the
* possibility that the name might conflict with a user-defined method on a
control's public or
* extended (JCX) interface.
+ *
+ * NOTE: Adding public methods should be done with great care; any such method
becomes part of the
+ * public API, and occupies namespace for all controls.
*/
abstract public class ControlBean
implements
org.apache.beehive.controls.api.bean.ControlBean
@@ -65,7 +68,7 @@
* associate with an active context at runtime (via
thread-locals).
* @param id
* @param initProperties
- * @param controlIntf
+ * @param controlIntf the control interface or extension directly
implemented by the control bean
*/
protected
ControlBean(org.apache.beehive.controls.api.context.ControlBeanContext context,
String id, PropertyMap initProperties, Class
controlIntf)
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java?rev=164149&r1=164148&r2=164149&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java
Thu Apr 21 16:43:56 2005
@@ -17,7 +17,6 @@
* $Header:$
*/
-import java.util.ArrayList;
import java.util.Collection;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
@@ -31,6 +30,7 @@
import org.apache.beehive.controls.api.bean.ControlExtension;
import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.versioning.VersionRequired;
/**
* The AptControlField class contains information about a field that refers to
a nested control.
@@ -49,6 +49,15 @@
_env = env;
_controlBean = new ControlBean(getControlInterface());
};
+
+ /**
+ * Does this control field have a VersionRequired annotation?
+ * @return
+ */
+ public boolean hasVersionRequired()
+ {
+ return ( _fieldDecl.getAnnotation( VersionRequired.class ) != null );
+ }
/**
* Initializes the ControlInterface associated with this ControlField
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm?rev=164149&r1=164148&r2=164149&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
Thu Apr 21 16:43:56 2005
@@ -110,14 +110,19 @@
if ($control.localName == null)
$control.localName = (${control.controlBean.className})
Controls.instantiate(${control.controlBean.className}.class,
getAnnotationMap(cbc, ${control.reflectField}), cbc, "$control.name" );
#initEventAdaptors($control)
+
+ #if ($control.hasVersionRequired())
+ enforceVersionRequired( $control.localName,
${control.reflectField}.getAnnotation(VersionRequired.class) );
+ #end
+
#if ($init.needsReflection($control))
${control.reflectField}.set(client, $control.localName);
#else
client.${control.name} = $control.localName;
#end
-
#end
##
+##
## This macro defines the initialization method for all declared control
instances.
##
#macro (declareFieldInit)
@@ -153,8 +158,8 @@
import java.lang.reflect.Field;
import org.apache.beehive.controls.api.ControlException;
import org.apache.beehive.controls.api.bean.Controls;
+import org.apache.beehive.controls.api.versioning.VersionRequired;
import org.apache.beehive.controls.api.context.ControlBeanContext;
-import org.apache.beehive.controls.runtime.bean.ControlBean;
import org.apache.beehive.controls.runtime.bean.EventAdaptor;
import org.apache.beehive.controls.runtime.bean.AdaptorPersistenceDelegate;
Modified: incubator/beehive/trunk/distribution.xml
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/distribution.xml?rev=164149&r1=164148&r2=164149&view=diff
==============================================================================
--- incubator/beehive/trunk/distribution.xml (original)
+++ incubator/beehive/trunk/distribution.xml Thu Apr 21 16:43:56 2005
@@ -696,21 +696,6 @@
<fail unless="beehive.version" message="Could not build distribution
archive; beehive.version was not specified"/>
<mkdir dir="${dist.archives.dir}"/>
- <!-- the <tar> task has a bug under Windows, so we special-case it to
call out to an external tar program -->
- <antcall target="build.dist.tgz.windows"/>
- <antcall target="build.dist.tgz.non_windows"/>
- </target>
-
- <target name="build.dist.tgz.windows" if="isWindows">
- <exec executable="tar" dir="${dist.base.dir}" failonerror="true">
- <!-- <arg value="-force-local"/> add this (with extra "-" before
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
- <arg value="-czf"/>
- <arg value="${dist.archives.dir}/${dist.name}.tar.gz"/>
- <arg value="${dist.name}"/>
- </exec>
- </target>
-
- <target name="build.dist.tgz.non_windows" unless="isWindows">
<!-- exclude the docs/*txt files to eliminate redundant readmes,
notices, licenses, etc. -->
<tar destfile="${dist.archives.dir}/${dist.name}.tar.gz"
basedir="${dist.base.dir}" includes="${dist.name}/**"
excludes="${dist.name}/docs/*.txt,${dist.name}/docs/*.TXT"
compression="gzip"/>
@@ -720,21 +705,6 @@
<fail unless="beehive.version" message="Could not build distribution
archive; beehive.version was not specified"/>
<mkdir dir="${dist.archives.dir}"/>
- <!-- the <tar> task has a bug under Windows, so we special-case it to
call out to an external tar program -->
- <antcall target="build.dist.lib.tgz.windows"/>
- <antcall target="build.dist.lib.tgz.non_windows"/>
- </target>
-
- <target name="build.dist.lib.tgz.windows" if="isWindows">
- <exec executable="tar" dir="${dist.base.dir}" failonerror="true">
- <!-- <arg value="-force-local"/> add this (with extra "-" before
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
- <arg value="-czf"/>
- <arg value="${dist.archives.dir}/${dist.lib.name}.tar.gz"/>
- <arg value="${dist.lib.name}"/>
- </exec>
- </target>
-
- <target name="build.dist.lib.tgz.non_windows" unless="isWindows">
<tar destfile="${dist.archives.dir}/${dist.lib.name}.tar.gz"
basedir="${dist.base.dir}" includes="${dist.lib.name}/**" compression="gzip"/>
</target>
@@ -776,45 +746,15 @@
<mkdir dir="${dist.archives.dir}"/>
- <!-- the <tar> task has a bug under Windows, so we special-case it to
call out to an external tar program -->
- <antcall target="build.dist.docs.tgz.windows"/>
- <antcall target="build.dist.docs.tgz.non_windows"/>
+ <tar destfile="${dist.archives.dir}/${dist.docs.name}.tar.gz"
basedir="${dist.tmp.dir}" includes="${dist.docs.name}/**" compression="gzip"/>
<delete dir="${tmpdocsdir}" />
</target>
- <target name="build.dist.docs.tgz.windows" if="isWindows">
- <exec executable="tar" dir="${dist.tmp.dir}" failonerror="true">
- <!-- <arg value="-force-local"/> add this (with extra "-" before
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
- <arg value="-czf"/>
- <arg value="${dist.archives.dir}/${dist.docs.name}.tar.gz"/>
- <arg value="${dist.docs.name}"/>
- </exec>
- </target>
-
- <target name="build.dist.docs.tgz.non_windows" unless="isWindows">
- <tar destfile="${dist.archives.dir}/${dist.docs.name}.tar.gz"
basedir="${dist.tmp.dir}" includes="${dist.docs.name}/**" compression="gzip"/>
- </target>
-
<target name="build.dist.src.tgz" description="Builds a Beehive source
distribution tarball (.tar.gz)">
<fail unless="beehive.version" message="Could not build distribution
archive; beehive.version was not specified"/>
<mkdir dir="${dist.archives.dir}"/>
- <!-- the <tar> task has a bug under Windows, so we special-case it to
call out to an external tar program -->
- <antcall target="build.dist.src.tgz.windows"/>
- <antcall target="build.dist.src.tgz.non_windows"/>
- </target>
-
- <target name="build.dist.src.tgz.windows" if="isWindows">
- <exec executable="tar" dir="${dist.base.dir}" failonerror="true">
- <!-- <arg value="-force-local"/> add this (with extra "-" before
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
- <arg value="-czf"/>
- <arg value="${dist.archives.dir}/${dist.src.name}.tar.gz"/>
- <arg value="${dist.src.name}"/>
- </exec>
- </target>
-
- <target name="build.dist.src.tgz.non_windows" unless="isWindows">
<tar destfile="${dist.archives.dir}/${dist.src.name}.tar.gz"
basedir="${dist.base.dir}" includes="${dist.src.name}/**" compression="gzip"/>
</target>
@@ -852,11 +792,7 @@
<echo message="${line.separator}Verifying archive
@{filebase}.tar.gz"/>
<mkdir dir="${dist.tmp.dir}/@{filebase}"/>
- <antcall target="build.dist.untgz.windows">
- <param name="tgz.file"
value="${dist.archives.dir}/@{filebase}.tar.gz"/>
- <param name="tgz.dest.dir" value="${dist.tmp.dir}"/>
- </antcall>
- <antcall target="build.dist.untgz.non_windows">
+ <antcall target="build.dist.untgz">
<param name="tgz.file"
value="${dist.archives.dir}/@{filebase}.tar.gz"/>
<param name="tgz.dest.dir" value="${dist.tmp.dir}"/>
</antcall>
@@ -889,15 +825,7 @@
</sequential>
</macrodef>
- <target name="build.dist.untgz.windows" if="isWindows">
- <exec executable="tar" dir="${tgz.dest.dir}" failonerror="true">
- <!-- <arg value="-force-local"/> add this (with extra "-" before
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
- <arg value="-xzf"/>
- <arg value="${tgz.file}"/>
- </exec>
- </target>
-
- <target name="build.dist.untgz.non_windows" unless="isWindows">
+ <target name="build.dist.untgz">
<untar src="${tgz.file}" dest="${tgz.dest.dir}" compression="gzip"/>
</target>