Author: rich
Date: Fri Apr 22 00:41:54 2005
New Revision: 164185
URL: http://svn.apache.org/viewcvs?rev=164185&view=rev
Log:
This change allows the Page Flow compiler to work against various project
models. It adds/modifies the following attributes to the <build-pageflows>
macro in beehive-tools.xml:
- (*) srcdir: the root directory which will be scanned for source files.
- (*) classpathref: the classpath reference for building page flows.
- sourcepathref: a reference to a path that contains all the source roots.
Defaults to a path that contains @{srcdir} and @{srcdir}/WEB-INF/src.
- webcontentdir: the root location for web content (e.g., JSPs, web.xml,
etc.). Defaults to @{srcdir}.
- weboutputdir: the root of the webapp build output directory, for
generated webapp files (e.g., generated Struts config files in
WEB-INF/.pageflow-struts-generated). Defaults to @{srcdir}.
- classoutputdir: the directory for compiled classes. Defaults to
@{weboutputdir}/WEB-INF/classes.
- tempdir: the directory for temporary .java files, copied from page flows
(etc.) with non-.java extensions. Defaults to @{srcdir}/WEB-INF/.tmpbeansrc.
I've also renamed "sourceDir" to "srcdir", "tmpdir" to "tempdir",
"classpathRef" to "classpathRef", "destDir" to "destdir" in <build-schemas> and
<build-controls>, as mentioned in the thread on beehive-dev.
Also (unrelatedly), fixed the tomcatWeb drt to run again.
tests: drt in trunk, bvt in netui, drt.jsf-ri/drt.myfaces in
netui/test/webapps/jsf, drt in netui/test/webapps/tomcat, drt in
netui/test/webapps/projectModel (WinXP)
BB: self (linux)
Added:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FatalCompileTimeException.java
(with props)
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/MissingOptionException.java
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/
incubator/beehive/trunk/netui/test/webapps/projectModel/build.xml (with
props)
incubator/beehive/trunk/netui/test/webapps/projectModel/schemas/
incubator/beehive/trunk/netui/test/webapps/projectModel/src/
incubator/beehive/trunk/netui/test/webapps/projectModel/src/common/
incubator/beehive/trunk/netui/test/webapps/projectModel/src/common/Messages.properties
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/src/common/MyForm.java
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/src/common/strutsMerge.xml
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/testRecorder/
incubator/beehive/trunk/netui/test/webapps/projectModel/testRecorder/config/
incubator/beehive/trunk/netui/test/webapps/projectModel/testRecorder/config/testRecorder-config.xml
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/testRecorder/config/testRecorder-tests.xml
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/testRecorder/config/testRecorder-webapp.xml
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/testRecorder/tests/
incubator/beehive/trunk/netui/test/webapps/projectModel/testRecorder/tests/SmokeTest.xml
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/WEB-INF/
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/WEB-INF/web.xml
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/index/
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/index.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/index/Beehive.gif
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/index/index.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/index/linkDown.gif
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/index/linkOver.gif
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/index/style.css
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/smokeTest/
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/smokeTest/index.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webContent/smokeTest/success.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webSource/
incubator/beehive/trunk/netui/test/webapps/projectModel/webSource/index/
incubator/beehive/trunk/netui/test/webapps/projectModel/webSource/index/Controller.java
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webSource/log4j.xml
(with props)
incubator/beehive/trunk/netui/test/webapps/projectModel/webSource/smokeTest/
incubator/beehive/trunk/netui/test/webapps/projectModel/webSource/smokeTest/Controller.java
(with props)
Removed:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/NoWebInfDirectoryException.java
Modified:
incubator/beehive/trunk/ant/beehive-tools.xml
incubator/beehive/trunk/ant/buildWebapp.xml
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationMemberType.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseChecker.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseGenerator.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/Diagnostics.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingChecker.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerInfo.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FormBeanChecker.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/BaseValidationRuleGrammar.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/DelegatingType.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/EnumType.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ExternalPathOrActionType.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ForwardToExternalPathType.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/SharedFlowRefGrammar.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/TilesDefinitionsConfigsType.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ValidateRequiredGrammar.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/WebappPathOrActionType.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/StrutsApp.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/ValidationModel.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/BaseAnnotationProcessor.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseAnnotationProcessor.java
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/env/AnnotationProcessorEnvironment.java
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/NetuiSubTask.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java
incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
incubator/beehive/trunk/netui/test/conf/testRecorder-server.xml
incubator/beehive/trunk/netui/test/webapps/tomcat/testRecorder/tests/Login.xml
incubator/beehive/trunk/netui/test/webapps/tomcat/testRecorder/tests/SecureLinks.xml
incubator/beehive/trunk/netui/test/webapps/tomcat/testRecorder/tests/Security.xml
incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/build-dist.xml
incubator/beehive/trunk/test/dist-test/ant/testdist-buildWebapp.xml
incubator/beehive/trunk/user/netui-blank/build.xml
Modified: incubator/beehive/trunk/ant/beehive-tools.xml
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/ant/beehive-tools.xml?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
--- incubator/beehive/trunk/ant/beehive-tools.xml (original)
+++ incubator/beehive/trunk/ant/beehive-tools.xml Fri Apr 22 00:41:54 2005
@@ -29,25 +29,25 @@
</path>
<macrodef name="build-schemas">
- <attribute name="sourceDir" description="The direcotry containing XML
Schemas or XMLBeans xsdconfig files to build"/>
- <attribute name="destDir" description="The directory to use for files
generated during an XSD build"/>
+ <attribute name="srcdir" description="The directory containing XML
Schemas or XMLBeans xsdconfig files to build"/>
+ <attribute name="destdir" description="The directory to use for files
generated during an XSD build"/>
<sequential>
<taskdef name="xmlbeanbuild"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpathref="xbean.dependency.path"/>
<xmlbeanbuild classpathref="xbean.dependency.path"
- schema="@{sourceDir}"
- classgendir="@{destDir}"
+ schema="@{srcdir}"
+ classgendir="@{destdir}"
failonerror="true"/>
</sequential>
</macrodef>
<macrodef name="build-controls">
- <attribute name="sourceDir" description="The directory containing
controls to build"/>
- <attribute name="destDir" description="The directory to use for
generated class files"/>
- <attribute name="tmpDir" description="The temporary directory used
when building controls"/>
- <attribute name="classpathRef" description="The classpath to use when
compiling controls. This should be the id of an Ant <path>"/>
+ <attribute name="srcdir" description="The directory containing
controls to build. Required."/>
+ <attribute name="destdir" description="The destination directory for
compiled class files. Required."/>
+ <attribute name="tempdir" description="The temporary directory for
generated files. Required."/>
+ <attribute name="classpathref" description="The classpath reference
for building the controls. Required."/>
<sequential>
<taskdef name="apt"
classname="org.apache.beehive.controls.runtime.generator.AptTask"
@@ -59,13 +59,13 @@
explicitly added here via the velocity.dependency.path
-->
<path id="_controls.build.classpath">
- <path refid="@{classpathRef}"/>
+ <path refid="@{classpathref}"/>
<path refid="velocity.dependency.path"/>
</path>
- <apt srcdir="@{sourceDir}"
- destdir="@{destDir}"
- gendir="@{tmpDir}"
+ <apt srcdir="@{srcdir}"
+ destdir="@{destdir}"
+ gendir="@{tempdir}"
classpathref="_controls.build.classpath"
compileByExtension="true"
srcExtensions="*.java,*.jcx,*.jcs,*.jws"
@@ -79,10 +79,14 @@
once the compilation of the controls is complete, the page flows
within the web app can be compiled
using the macrodef below. -->
<macrodef name="build-pageflows">
- <attribute name="sourceDir" description="The directory contining Page
Flows to build"/>
- <attribute name="destDir" description="The directory to use for
generated class files"/>
- <attribute name="tmpDir" description="The temporary directory used
when building Page Flows"/>
- <attribute name="classpathRef" description="The classpath to use when
compiling Page Flows. This should be the id of an Ant <path>"/>
+ <attribute name="srcdir" description="The root directory which will be
scanned for source files. Required."/>
+ <attribute name="classpathref" description="The classpath reference
for building page flows. Required."/>
+ <attribute name="sourcepathref" default="_pageflow.default.sourcepath"
description="A reference to a path that contains all the source roots.
Defaults to a path that contains @{srcdir} and @{srcdir}/WEB-INF/src."/>
+ <attribute name="webcontentdir" default="@{srcdir}" description="The
root location for web content (e.g., JSPs, web.xml, etc.). Defaults to
@{srcdir}."/>
+ <attribute name="weboutputdir" default="@{srcdir}" description="The
root of the webapp build output directory, for generated webapp files (e.g.,
generated Struts config files in WEB-INF/.pageflow-struts-generated). Defaults
to @{srcdir}."/>
+ <attribute name="classoutputdir"
default="@{weboutputdir}/WEB-INF/classes" description="The directory for
compiled classes. Defaults to @{weboutputdir}/WEB-INF/classes."/>
+ <attribute name="tempdir" default="@{srcdir}/WEB-INF/.tmpbeansrc"
description="The directory for temporary .java files, copied from page flows
(etc.) with non-.java extensions. Defaults to @{srcdir}/WEB-INF/.tmpbeansrc."/>
+
<sequential>
<taskdef name="apt"
classname="org.apache.beehive.controls.runtime.generator.AptTask"
@@ -94,16 +98,36 @@
JAR, it needs to be explicitly added here via the
netui-compiler.dependency.path
-->
<path id="_pageflow.build.classpath">
- <path refid="@{classpathRef}"/>
+ <path refid="@{classpathref}"/>
<path refid="netui-compiler.dependency.path"/>
<path refid="velocity.dependency.path"/>
</path>
- <apt srcdir="@{sourceDir}"
- destdir="@{destDir}"
- gendir="@{tmpDir}"
+ <path id="_pageflow.default.sourcepath">
+ <pathelement path="@{srcdir}"/>
+ <pathelement path="@{srcdir}/WEB-INF/src"/>
+ </path>
+
+ <property name="_pageflow.build.classpath"
refid="_pageflow.build.classpath"/>
+ <property name="_pageflow.build.sourcepath"
refid="@{sourcepathref}"/>
+
+ <echo> srcdir: @{srcdir}</echo>
+ <echo> classpath: ${_pageflow.build.classpath}</echo>
+ <echo> sourcepath: ${_pageflow.build.sourcepath}</echo>
+ <echo> webcontentdir: @{webcontentdir}</echo>
+ <echo> weboutputdir: @{weboutputdir}</echo>
+ <echo> classoutputdir: @{classoutputdir}</echo>
+ <echo> tempdir: @{tempdir}</echo>
+
+ <mkdir dir="@{classoutputdir}"/>
+
+ <apt srcdir="@{srcdir}"
+ destdir="@{classoutputdir}"
+ gendir="@{tempdir}"
classpathref="_pageflow.build.classpath"
+ sourcepathref="@{sourcepathref}"
srcExtensions="*.jpf,*.jpfs,*.app,*.jsfb,*.java"
+ processorOptions="[EMAIL
PROTECTED],web.source.roots=${_pageflow.build.sourcepath},[EMAIL PROTECTED]"
debug="true"/>
</sequential>
</macrodef>
Modified: incubator/beehive/trunk/ant/buildWebapp.xml
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/ant/buildWebapp.xml?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
--- incubator/beehive/trunk/ant/buildWebapp.xml (original)
+++ incubator/beehive/trunk/ant/buildWebapp.xml Fri Apr 22 00:41:54 2005
@@ -38,25 +38,24 @@
<!-- compile XSDs -->
<echo>Building XML Schemas</echo>
- <build-schemas sourceDir="${webapp.dir}/WEB-INF/schemas"
- destDir="${webapp.dir}/WEB-INF/classes"/>
+ <build-schemas srcdir="${webapp.dir}/WEB-INF/schemas"
+ destdir="${webapp.dir}/WEB-INF/classes"/>
<!-- compile controls -->
<echo>Building Controls</echo>
- <build-controls sourceDir="${webapp.dir}/WEB-INF/src"
+ <build-controls srcdir="${webapp.dir}/WEB-INF/src"
destdir="${webapp.dir}/WEB-INF/classes"
- tmpdir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
- classpathRef="webapp.classpath"/>
+ tempdir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
+ classpathref="webapp.classpath"/>
<!-- compile JPFs -->
<echo>Building Page Flows</echo>
- <build-pageflows sourceDir="${webapp.dir}"
- destdir="${webapp.dir}/WEB-INF/classes"
- tmpdir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
- classpathRef="webapp.classpath"/>
+ <build-pageflows srcdir="${webapp.dir}"
+ tempdir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
+ classpathref="webapp.classpath"/>
<!-- copy resources -->
- <echo>Copying all .properties and .xml files to
${webapp.dir}/WEB-INF/classes</echo>
+ <echo>Copying all .properties and .xml files to
${webapp.dir}/WEB-INF/classes</echo>
<copy todir="${webapp.dir}/WEB-INF/classes">
<fileset dir="${webapp.dir}/WEB-INF/src"
includes="**/*.properties"/>
<fileset dir="${webapp.dir}/WEB-INF/src" includes="**/*.xml"/>
@@ -72,4 +71,4 @@
<delete dir="${webapp.dir}/WEB-INF/${tmp.jpfgen.dir}"
includeEmptyDirs="true" failOnError="false"/>
</target>
-</project>
\ No newline at end of file
+</project>
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java
Fri Apr 22 00:41:54 2005
@@ -77,12 +77,14 @@
public final Object check( AnnotationInstance annotation,
AnnotationInstance[] parentAnnotations,
MemberDeclaration classMember )
+ throws FatalCompileTimeException
{
return check( annotation, parentAnnotations, classMember, -1 );
}
public final Object check( AnnotationInstance annotation,
AnnotationInstance[] parentAnnotations,
MemberDeclaration classMember, int
annotationArrayIndex )
+ throws FatalCompileTimeException
{
if ( ! beginCheck( annotation, parentAnnotations, classMember ) )
return null;
@@ -155,6 +157,7 @@
public final boolean beginCheck( AnnotationInstance annotation,
AnnotationInstance[] parentAnnotations,
MemberDeclaration classMember )
+ throws FatalCompileTimeException
{
//
// First check to see if there's a required runtime version.
@@ -412,6 +415,7 @@
protected boolean onBeginCheck( AnnotationInstance annotation,
AnnotationInstance[] parentAnnotations,
MemberDeclaration classMember )
+ throws FatalCompileTimeException
{
return true;
}
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationMemberType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationMemberType.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationMemberType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationMemberType.java
Fri Apr 22 00:41:54 2005
@@ -53,6 +53,7 @@
public final Object check( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
AnnotationInstance[] parentAnnotations,
MemberDeclaration classMember,
int annotationArrayIndex )
+ throws FatalCompileTimeException
{
//
// First check to see if this attribute requires a particular runtime
version.
@@ -78,6 +79,7 @@
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
AnnotationInstance[] parentAnnotations,
MemberDeclaration classMember,
int annotationArrayIndex )
+ throws FatalCompileTimeException
{
return null;
}
@@ -240,5 +242,10 @@
protected final AnnotationProcessorEnvironment getEnv()
{
return _parentGrammar.getEnv();
+ }
+
+ protected final Diagnostics getDiagnostics()
+ {
+ return _parentGrammar.getDiagnostics();
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java
Fri Apr 22 00:41:54 2005
@@ -101,10 +101,10 @@
}
}
- public void writeXml( File webappRoot, Diagnostics diagnostics )
+ public void writeXml( String webappBuildRoot, Diagnostics diagnostics )
{
String typeName = _typeDecl.getQualifiedName();
- String outputFilePath = webappRoot + StrutsApp.getOutputFileURI(
ANNOTATIONS_FILE_PREFIX, typeName, false );
+ String outputFilePath = webappBuildRoot + StrutsApp.getOutputFileURI(
ANNOTATIONS_FILE_PREFIX, typeName, false );
try
{
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseChecker.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseChecker.java
Fri Apr 22 00:41:54 2005
@@ -17,8 +17,6 @@
*/
package org.apache.beehive.netui.compiler;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
-import org.apache.beehive.netui.compiler.model.StrutsApp;
import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
@@ -30,7 +28,6 @@
private AnnotationProcessorEnvironment _env;
private Diagnostics _diagnostics;
private RuntimeVersionChecker _runtimeVersionChecker;
- private File _webappRoot = null;
private SourceFileInfo _sourceFileInfo;
protected BaseChecker( AnnotationProcessorEnvironment env, SourceFileInfo
sourceFileInfo, Diagnostics diagnostics )
@@ -40,35 +37,15 @@
_sourceFileInfo = sourceFileInfo;
}
- Map check( ClassDeclaration jclass, File webappRoot )
+ public Map check( ClassDeclaration jclass )
+ throws FatalCompileTimeException
{
- _webappRoot = webappRoot;
- setRuntimeVersionChecker( new RuntimeVersionChecker( _webappRoot ) );
+ setRuntimeVersionChecker( new RuntimeVersionChecker() );
return onCheck( jclass );
}
- public final Map check( ClassDeclaration jclass )
- {
- //
- // Get a RuntimeVersionChecker (which looks at the manifest of
beehive-netui-pageflow.jar).
- //
- File webappRoot;
- File sourceFile = CompilerUtils.getSourceFile( jclass, true );
-
- try
- {
- webappRoot = StrutsApp.getWebappRootFromSourceFile( sourceFile );
- }
- catch ( NoWebInfDirectoryException e )
- {
- getDiagnostics().addError( jclass, "error.web-inf-not-found",
sourceFile );
- return null;
- }
-
- return check( jclass, webappRoot );
- }
-
- public abstract Map onCheck( ClassDeclaration jclass );
+ public abstract Map onCheck( ClassDeclaration jclass )
+ throws FatalCompileTimeException;
protected AnnotationProcessorEnvironment getEnv()
{
@@ -88,11 +65,6 @@
protected void setRuntimeVersionChecker( RuntimeVersionChecker
runtimeVersionChecker )
{
_runtimeVersionChecker = runtimeVersionChecker;
- }
-
- protected File getWebappRoot()
- {
- return _webappRoot;
}
protected SourceFileInfo getSourceFileInfo()
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseGenerator.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseGenerator.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseGenerator.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/BaseGenerator.java
Fri Apr 22 00:41:54 2005
@@ -34,7 +34,8 @@
_sourceFileInfo = sourceFileInfo;
}
- public abstract void generate( ClassDeclaration publicClass );
+ public abstract void generate( ClassDeclaration publicClass )
+ throws FatalCompileTimeException;
protected AnnotationProcessorEnvironment getEnv()
{
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
Fri Apr 22 00:41:54 2005
@@ -17,8 +17,6 @@
*/
package org.apache.beehive.netui.compiler;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
-import org.apache.beehive.netui.compiler.model.StrutsApp;
import org.apache.beehive.netui.compiler.typesystem.declaration.*;
import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
import org.apache.beehive.netui.compiler.typesystem.env.Filer;
@@ -1007,10 +1005,10 @@
return uri.substring( 0, lastDot );
}
- public static TypeDeclaration inferTypeFromPath( String
pathFromWebappRoot, AnnotationProcessorEnvironment env )
+ public static TypeDeclaration inferTypeFromPath( String
webappRelativePath, AnnotationProcessorEnvironment env )
{
- assert pathFromWebappRoot.startsWith( "/" ) : pathFromWebappRoot;
- String className = removeFileExtension( pathFromWebappRoot.substring(
1 ) );
+ assert webappRelativePath.startsWith( "/" ) : webappRelativePath;
+ String className = removeFileExtension( webappRelativePath.substring(
1 ) );
return env.getTypeDeclaration( className.replace( '/', '.' ) );
}
@@ -1191,78 +1189,123 @@
public static File getFileRelativeToSourceFile( TypeDeclaration
outerClass, String relativePath,
AnnotationProcessorEnvironment env )
+ throws FatalCompileTimeException
{
+ assert relativePath.length() > 0;
+
+ //
+ // If it starts with '/', just find the webapp-relative file.
+ //
+ if ( relativePath.charAt( 0 ) == '/' ) return getWebappRelativeFile(
relativePath, true, env );
+
+ //
+ // Look for the file relative to the source directory of the given
class.
+ //
File sourceFile = getSourceFile( outerClass, false );
File desiredParentDir = sourceFile.getAbsoluteFile().getParentFile();
File retVal = new File( desiredParentDir, relativePath );
+ //
+ // If we still haven't found it, construct a webapp-relative path and
look for the file relative to the webapp.
+ //
if ( ! retVal.exists() )
{
String jpfParentRelativePath = "";
PackageDeclaration jpfPackage = outerClass.getPackage();
if ( jpfPackage != null ) jpfParentRelativePath =
jpfPackage.getQualifiedName().replace( '.', '/' );
+ return getWebappRelativeFile( '/' + jpfParentRelativePath + '/' +
relativePath, true, env );
+ }
- //
- // Look for the file out in the web-addressable portion of the
webapp.
- //
- File webFilesRoot = getWebFilesRoot( sourceFile, true, env );
- retVal = new File( webFilesRoot + File.separator +
jpfParentRelativePath, relativePath );
+ return retVal;
+ }
+
+ public static File getWebappRelativeFile( String webappRelativePath,
boolean lookInSourceRoots,
+ AnnotationProcessorEnvironment
env )
+ throws FatalCompileTimeException
+ {
+ //
+ // Look for the file out in the web-addressable portion of the webapp.
+ //
+ assert webappRelativePath.startsWith( "/" ) : webappRelativePath;
+ String webContentRoot = getWebContentRoot( env );
+ File retVal = new File( webContentRoot + webappRelativePath );
+
+ //
+ // If appropriate, look for the file under all the source roots.
+ //
+ if ( ! retVal.exists() && lookInSourceRoots )
+ {
+ String[] webSourceRoots = getWebSourceRoots( env );
- //
- // We make special accommodation for source files in WEB-INF/src,
when the actual files being
- // compiled have been copied to a temporary location.
- //
- if ( ! retVal.exists() )
+ for ( int i = 0; i < webSourceRoots.length; i++ )
{
- try
- {
- retVal = new File( StrutsApp.getWebappRootFromSourceFile(
sourceFile ) + File.separator
- + WEBINF_SRC_DIR + File.separator
+ jpfParentRelativePath
- + File.separator + relativePath );
- }
- catch ( NoWebInfDirectoryException e )
- {
- // ignore and fall through
- }
- }
+ String webSourceRoot = webSourceRoots[i];
+ File webSourceRelativeFile = new File( webSourceRoot +
webappRelativePath );
+ if ( webSourceRelativeFile.exists() ) return
webSourceRelativeFile;
+ }
}
-
+
return retVal;
}
- public static File getWebFilesRoot( File jpfSourceFile, boolean
useAlternateLocation,
- AnnotationProcessorEnvironment env )
+ public static String[] getWebSourceRoots( AnnotationProcessorEnvironment
env )
+ throws FatalCompileTimeException
{
- try
+ return ( String[] ) getOption( "web.source.roots", true, env );
+ }
+
+ public static String getWebContentRoot( AnnotationProcessorEnvironment env
)
+ throws FatalCompileTimeException
+ {
+ return ( String ) getOption( "web.content.root", false, env );
+ }
+
+ public static String getWebBuildRoot( AnnotationProcessorEnvironment env )
+ throws FatalCompileTimeException
+ {
+ return ( String ) getOption( "web.output.root", false, env );
+ }
+
+ private static Object getOption( String optionName, boolean isList,
AnnotationProcessorEnvironment env )
+ throws MissingOptionException
+ {
+ Object cached = env.getAttribute( optionName );
+ if ( cached != null ) return cached;
+
+ Map options = env.getOptions();
+ String value = ( String ) options.get( optionName );
+
+ if ( value == null )
{
- String alternateRoot = null;
- if ( useAlternateLocation )
+ // TODO: there appears to be a bug in APT where both the key/value
are contained in the key
+ String aptOption = "-A" + optionName + '=';
+ for ( Iterator i = options.keySet().iterator(); i.hasNext(); )
{
- alternateRoot = ( String ) env.getOptions().get(
ALTERNATE_WEB_ROOT_DIR_OPTION );
+ String key = ( String ) i.next();
- // TODO: there appears to be a bug in APT where both the
key/value are contained in the key
- if ( alternateRoot == null )
+ if ( key.startsWith( aptOption ) )
{
- for ( Iterator ii = env.getOptions().keySet().iterator();
ii.hasNext(); )
- {
- Object i = ii.next();
- String key = ( String ) i;
-
- if ( key.startsWith( ALTERNATE_WEB_ROOT_DIR_OPTION +
'=' ) )
- {
- alternateRoot = key.substring(
ALTERNATE_WEB_ROOT_DIR_OPTION.length() + 1 );
- break;
- }
- }
+ value = key.substring( aptOption.length() );
+ break;
}
}
-
- return alternateRoot != null ? new File( alternateRoot ) :
StrutsApp.getWebappRootFromSourceFile( jpfSourceFile );
}
- catch ( NoWebInfDirectoryException e )
+
+ if ( value == null ) throw new MissingOptionException( optionName );
+
+ Object retVal = value;
+
+ if ( isList )
{
- assert false : e; // must be caught earlier, before
FlowControllerChecker is invoked
- return null;
+ String[] values = ( ( String ) retVal ).trim().split(
File.pathSeparator );
+ for ( int i = 0; i < values.length; i++ )
+ {
+ values[i] = values[i].trim();
+ }
+ retVal = values;
}
+
+ env.setAttribute( optionName, retVal );
+ return retVal;
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/Diagnostics.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/Diagnostics.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/Diagnostics.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/Diagnostics.java
Fri Apr 22 00:41:54 2005
@@ -57,6 +57,11 @@
_env.getMessager().printError( decl.getPosition(), getResourceString(
messageKey, args ) );
_hasErrors = true;
}
+
+ public void addErrorNoPosition( String messageKey, Object[] args )
+ {
+ _env.getMessager().printError( getResourceString( messageKey, args ) );
+ }
public void addError( AnnotationInstance ann, String messageKey )
{
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingChecker.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingChecker.java
Fri Apr 22 00:41:54 2005
@@ -36,6 +36,7 @@
}
public Map onCheck( ClassDeclaration jclass )
+ throws FatalCompileTimeException
{
if ( ! CompilerUtils.isAssignableFrom( FACES_BACKING_BEAN_CLASS,
jclass, getEnv() ))
{
@@ -52,7 +53,7 @@
if ( CompilerUtils.isPageFlowClass( classDecl, getEnv() ) )
jpfClass = classDecl;
}
- FlowControllerInfo fcInfo = new FlowControllerInfo( jpfClass,
getWebappRoot() );
+ FlowControllerInfo fcInfo = new FlowControllerInfo( jpfClass );
fcInfo.startBuild( getEnv(), jpfClass );
CommandHandlerGrammar chg =
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
Fri Apr 22 00:41:54 2005
@@ -21,13 +21,8 @@
import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
import
org.apache.beehive.netui.compiler.typesystem.declaration.MethodDeclaration;
import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
-import org.apache.beehive.netui.compiler.model.StrutsApp;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
-import org.apache.xmlbeans.XmlException;
import java.io.File;
-import java.io.IOException;
-import java.io.FileNotFoundException;
public class FacesBackingGenerator
extends BaseGenerator
@@ -39,38 +34,29 @@
}
public void generate( ClassDeclaration publicClass )
+ throws FatalCompileTimeException
{
- try
- {
- File sourceFile = CompilerUtils.getSourceFile( publicClass, true );
- File webappRoot = StrutsApp.getWebappRootFromSourceFile(
sourceFile );
- AnnotationInstance facesBackingAnnotation =
CompilerUtils.getAnnotation( publicClass, FACES_BACKING_TAG_NAME );
- assert facesBackingAnnotation != null; // checker should enforce
this
- AnnotationToXML atx = new AnnotationToXML( publicClass );
-
- // Add the class-level @Jpf.FacesBacking annotation.
- atx.include( publicClass, facesBackingAnnotation );
-
- // For each method, add the @Jpf.CommandHandler annotation.
- MethodDeclaration[] methods = CompilerUtils.getClassMethods(
publicClass, COMMAND_HANDLER_TAG_NAME );
- for ( int i = 0; i < methods.length; i++ )
- {
- MethodDeclaration method = methods[i];
- AnnotationInstance commandHandlerAnn =
CompilerUtils.getAnnotation( method, COMMAND_HANDLER_TAG_NAME );
- atx.include( method, commandHandlerAnn );
- }
-
- // Add @Jpf.SharedFlowField, @Jpf.PageFlowField, @Control.
- FlowControllerGenerator.includeFieldAnnotations( atx, publicClass,
PAGE_FLOW_FIELD_TAG_NAME );
-
- // Write the file.
- atx.writeXml( webappRoot, getDiagnostics() );
- }
- catch ( NoWebInfDirectoryException e )
+ File sourceFile = CompilerUtils.getSourceFile( publicClass, true );
+ AnnotationInstance facesBackingAnnotation =
CompilerUtils.getAnnotation( publicClass, FACES_BACKING_TAG_NAME );
+ assert facesBackingAnnotation != null; // checker should enforce this
+ AnnotationToXML atx = new AnnotationToXML( publicClass );
+
+ // Add the class-level @Jpf.FacesBacking annotation.
+ atx.include( publicClass, facesBackingAnnotation );
+
+ // For each method, add the @Jpf.CommandHandler annotation.
+ MethodDeclaration[] methods = CompilerUtils.getClassMethods(
publicClass, COMMAND_HANDLER_TAG_NAME );
+ for ( int i = 0; i < methods.length; i++ )
{
- e.printStackTrace(); // TODO: log
- getDiagnostics().addError( publicClass,
"error.could-not-generate", null, e.getMessage() );
+ MethodDeclaration method = methods[i];
+ AnnotationInstance commandHandlerAnn =
CompilerUtils.getAnnotation( method, COMMAND_HANDLER_TAG_NAME );
+ atx.include( method, commandHandlerAnn );
}
+ // Add @Jpf.SharedFlowField, @Jpf.PageFlowField, @Control.
+ FlowControllerGenerator.includeFieldAnnotations( atx, publicClass,
PAGE_FLOW_FIELD_TAG_NAME );
+
+ // Write the file.
+ atx.writeXml( CompilerUtils.getWebBuildRoot( getEnv() ),
getDiagnostics() );
}
}
Added:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FatalCompileTimeException.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FatalCompileTimeException.java?rev=164185&view=auto
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FatalCompileTimeException.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FatalCompileTimeException.java
Fri Apr 22 00:41:54 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004 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.compiler;
+
+public abstract class FatalCompileTimeException
+ extends Exception
+{
+ protected FatalCompileTimeException( String message )
+ {
+ super( message );
+ }
+
+ public abstract void printDiagnostic( Diagnostics diagnostics );
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FatalCompileTimeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
Fri Apr 22 00:41:54 2005
@@ -21,7 +21,6 @@
import org.apache.beehive.netui.compiler.grammar.ActionGrammar;
import org.apache.beehive.netui.compiler.grammar.ExceptionHandlerGrammar;
import org.apache.beehive.netui.compiler.grammar.WebappPathType;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
@@ -64,7 +63,7 @@
super( env, fcInfo, diags );
}
- protected void doAdditionalClassChecks( ClassDeclaration jpfClass, File
webappRoot )
+ protected void doAdditionalClassChecks( ClassDeclaration jpfClass )
{
}
@@ -78,6 +77,7 @@
protected abstract AnnotationGrammar getControllerGrammar();
public Map onCheck( ClassDeclaration jclass )
+ throws FatalCompileTimeException
{
FlowControllerInfo fcInfo = getFCSourceFileInfo();
@@ -88,7 +88,6 @@
new ExceptionHandlerGrammar( getEnv(), getDiagnostics(),
getRuntimeVersionChecker(), fcInfo );
_formBeanChecker = new FormBeanChecker( getEnv(), getDiagnostics() );
- fcInfo.setWebappRoot( getWebappRoot() );
fcInfo.startBuild( getEnv(), jclass );
try
@@ -102,6 +101,7 @@
}
private Map onCheckInternal( ClassDeclaration jclass )
+ throws FatalCompileTimeException
{
FlowControllerInfo fcInfo = getFCSourceFileInfo();
@@ -155,7 +155,7 @@
//
// Run additional .jpf- or .app-specific checks.
//
- doAdditionalClassChecks( jclass, getWebappRoot() );
+ doAdditionalClassChecks( jclass );
//
// Runtime performance enhancement: enable saving of previous-page and
previous-action information based on
@@ -247,67 +247,61 @@
}
protected abstract GenStrutsApp createStrutsApp( ClassDeclaration jclass )
- throws XmlException, IOException, NoWebInfDirectoryException;
+ throws XmlException, IOException, FatalCompileTimeException;
protected void startCheckClass( ClassDeclaration jclass )
+ throws FatalCompileTimeException
{
//
// Check for basic things like writability of the struts-config file.
//
+ GenStrutsApp strutsApp = null;
+ File strutsConfigFile = null;
+
+ //
+ // Make sure we can write to the struts-config XML file.
+ //
try
{
- GenStrutsApp strutsApp = null;
- File strutsConfigFile = null;
-
- //
- // Make sure we can write to the struts-config XML file.
- //
- try
- {
- strutsApp = createStrutsApp( jclass );
- strutsConfigFile = strutsApp.getStrutsConfigFile();
- }
- catch ( XmlException e )
- {
- // will be reported at generate time
- }
- catch ( IOException e )
- {
- // will be reported at generate time
- }
+ strutsApp = createStrutsApp( jclass );
+ strutsConfigFile = strutsApp.getStrutsConfigFile();
+ }
+ catch ( XmlException e )
+ {
+ // will be reported at generate time
+ }
+ catch ( IOException e )
+ {
+ // will be reported at generate time
+ }
+
+ if ( strutsConfigFile != null )
+ {
+ File parentDir = strutsConfigFile.getParentFile();
+
+ getFCSourceFileInfo().addReferencedFile( strutsConfigFile );
- if ( strutsConfigFile != null )
+ if ( ! parentDir.isDirectory() )
{
- File parentDir = strutsConfigFile.getParentFile();
-
- getFCSourceFileInfo().addReferencedFile( strutsConfigFile );
-
- if ( ! parentDir.isDirectory() )
- {
- //
- // The second call to isDirectory below accounts for the
possibility that another thread has created
- // the directory. Filesystem-based
double-checked-locking... works. We don't need to have
- // compiler-wide contention around this check.
- //
- if ( ! parentDir.mkdirs() && ! parentDir.isDirectory() )
- {
- getDiagnostics().addError( jclass,
"error.invalid-parent-directory", parentDir );
- }
- }
-
- if ( strutsConfigFile.exists() && strutsApp != null && !
strutsApp.canWrite() )
+ //
+ // The second call to isDirectory below accounts for the
possibility that another thread has created
+ // the directory. Filesystem-based double-checked-locking...
works. We don't need to have
+ // compiler-wide contention around this check.
+ //
+ if ( ! parentDir.mkdirs() && ! parentDir.isDirectory() )
{
- getDiagnostics().addError( jclass,
"error.struts-config-not-writable", strutsConfigFile );
+ getDiagnostics().addError( jclass,
"error.invalid-parent-directory", parentDir );
}
}
-
- getRuntimeVersionChecker().checkRuntimeVersion(
VERSION_8_SP2_STRING, jclass, getDiagnostics(),
-
"warning.runtime-version", new Object[]{ PAGEFLOW_RUNTIME_JAR } );
- }
- catch ( NoWebInfDirectoryException e )
- {
- getDiagnostics().addError( jclass, "error.web-inf-not-found",
CompilerUtils.getSourceFile( jclass, true ) );
+
+ if ( strutsConfigFile.exists() && strutsApp != null && !
strutsApp.canWrite() )
+ {
+ getDiagnostics().addError( jclass,
"error.struts-config-not-writable", strutsConfigFile );
+ }
}
+
+ getRuntimeVersionChecker().checkRuntimeVersion( VERSION_8_SP2_STRING,
jclass, getDiagnostics(),
+
"warning.runtime-version", new Object[]{ PAGEFLOW_RUNTIME_JAR } );
//
// Check the Jpf.Controller annotation on this class.
@@ -325,6 +319,7 @@
* Check relative paths in annotations inherited from a base class.
*/
private void checkInheritedRelativePaths( ClassDeclaration jclass )
+ throws FatalCompileTimeException
{
for ( ClassType type = jclass.getSuperclass();
type != null && CompilerUtils.isAssignableFrom(
FLOWCONTROLLER_BASE_CLASS, type, getEnv() );
@@ -437,6 +432,7 @@
private void checkRelativePath( AnnotationInstance ann, String memberName,
TypeDeclaration jclass,
TypeDeclaration baseType, boolean isError )
+ throws FatalCompileTimeException
{
if ( ann != null )
{
@@ -469,6 +465,7 @@
private void checkRelativePath( String methodName, AnnotationInstance ann,
String memberName,
TypeDeclaration jclass, TypeDeclaration
baseType, boolean isError )
+ throws FatalCompileTimeException
{
if ( ann != null )
{
@@ -478,7 +475,8 @@
{
String path = ( String ) pathVal.getValue();
- if ( path.charAt( 0 ) != '/' && !
WebappPathType.relativePathExists( path, jclass, getEnv() ) )
+ if ( path.charAt( 0 ) != '/' &&
+ ! WebappPathType.relativePathExists( path, jclass,
getEnv() ) )
{
String[] args = {
path,
@@ -521,6 +519,7 @@
}
protected void checkMethod( MethodDeclaration method, ClassDeclaration
jclass )
+ throws FatalCompileTimeException
{
AnnotationInstance[] annotations = method.getAnnotationInstances();
@@ -547,8 +546,9 @@
}
protected void checkInnerClass( ClassDeclaration innerClass )
+ throws FatalCompileTimeException
{
- _formBeanChecker.check( innerClass, getWebappRoot() );
+ _formBeanChecker.check( innerClass );
}
private void checkExceptionHandlerMethod( MethodDeclaration method )
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
Fri Apr 22 00:41:54 2005
@@ -19,7 +19,6 @@
import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
import org.apache.beehive.netui.compiler.genmodel.GenValidationModel;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
import
org.apache.beehive.netui.compiler.typesystem.declaration.FieldDeclaration;
@@ -48,7 +47,7 @@
}
protected abstract GenStrutsApp createStrutsApp( ClassDeclaration cl )
- throws XmlException, IOException, NoWebInfDirectoryException;
+ throws XmlException, IOException, FatalCompileTimeException;
public void generate( ClassDeclaration publicClass )
{
@@ -59,7 +58,7 @@
{
// Write the Struts config XML, and the Validator config XML if
appropriate.
app = createStrutsApp( publicClass );
- GenValidationModel validationModel = new GenValidationModel(
publicClass, app );
+ GenValidationModel validationModel = new GenValidationModel(
publicClass, app, getEnv() );
if ( ! validationModel.isEmpty() )
{
@@ -72,11 +71,15 @@
// First, write out XML for any fields annotated with
@Jpf.SharedFlowField or @Control.
writeFieldAnnotations( publicClass, app );
}
+ catch ( FatalCompileTimeException e )
+ {
+ e.printDiagnostic( getDiagnostics() );
+ }
catch ( Exception e )
{
e.printStackTrace(); // @TODO log
- assert e instanceof NoWebInfDirectoryException || e instanceof
XmlException || e instanceof IOException
- || e instanceof FileNotFoundException :
e.getClass().getName();
+ assert e instanceof XmlException || e instanceof IOException || e
instanceof FileNotFoundException
+ : e.getClass().getName();
getDiagnostics().addError( publicClass, "error.could-not-generate",
app != null ? app.getStrutsConfigFile()
: null, e.getMessage() );
}
@@ -87,12 +90,13 @@
}
private void writeFieldAnnotations( ClassDeclaration classDecl,
GenStrutsApp app )
+ throws FatalCompileTimeException
{
AnnotationToXML atx = new AnnotationToXML( classDecl );
if ( includeFieldAnnotations( atx, classDecl, null ) )
{
- atx.writeXml( app.getWebappRoot(), getDiagnostics() );
+ atx.writeXml( CompilerUtils.getWebBuildRoot( getEnv() ),
getDiagnostics() );
}
}
@@ -154,11 +158,14 @@
// @TODO logger.info( "Struts module " +
_strutsConfig.getStrutsConfigFile() + " is up-to-date." );
}
}
+ catch ( FatalCompileTimeException e )
+ {
+ e.printDiagnostic( getDiagnostics() );
+ }
catch ( Exception e )
{
e.printStackTrace(); // @TODO get rid of this
- assert e instanceof NoWebInfDirectoryException
- || e instanceof FileNotFoundException
+ assert e instanceof FileNotFoundException
|| e instanceof IOException
|| e instanceof XmlException
: e.getClass().getName();
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerInfo.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerInfo.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerInfo.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerInfo.java
Fri Apr 22 00:41:54 2005
@@ -37,7 +37,6 @@
private Set _actions = new HashSet();
private Set _returnActions = null;
- private File _webappRoot = null;
private Map _sharedFlowTypes = Collections.EMPTY_MAP;
private Map _sharedFlowTypeNames = Collections.EMPTY_MAP;
private Map _sharedFlowFiles = Collections.EMPTY_MAP;
@@ -109,12 +108,6 @@
super( CompilerUtils.getSourceFile( jclass, true ),
jclass.getQualifiedName() );
}
- public FlowControllerInfo( ClassDeclaration jclass, File webappRoot )
- {
- this( jclass );
- _webappRoot = webappRoot;
- }
-
void startBuild( AnnotationProcessorEnvironment env, ClassDeclaration
jclass )
{
_isBuilding = true;
@@ -217,9 +210,9 @@
if ( sharedFlowRefs != null )
{
- for ( java.util.Iterator ii = sharedFlowRefs.iterator();
ii.hasNext(); )
+ for ( Iterator i = sharedFlowRefs.iterator(); i.hasNext(); )
{
- AnnotationInstance sharedFlowRef = ( AnnotationInstance )
ii.next();
+ AnnotationInstance sharedFlowRef = ( AnnotationInstance )
i.next();
String name = CompilerUtils.getString( sharedFlowRef,
NAME_ATTR, true );
TypeInstance type = CompilerUtils.getTypeInstance(
sharedFlowRef, TYPE_ATTR, true );
@@ -240,25 +233,16 @@
//
if ( _sharedFlowTypes.isEmpty() )
{
- File globalAppFile = new File( getWebappRoot().getPath() +
GLOBALAPP_URI );
-
- if ( globalAppFile.exists() )
- {
- TypeDeclaration type = env.getTypeDeclaration(
GLOBALAPP_FULL_CLASSNAME );
-
- if ( type != null )
- {
- _sharedFlowTypes.put( GLOBALAPP_SHARED_FLOW_NAME, type );
- }
- }
+ TypeDeclaration type = env.getTypeDeclaration(
GLOBALAPP_FULL_CLASSNAME );
+ if ( type != null ) _sharedFlowTypes.put(
GLOBALAPP_SHARED_FLOW_NAME, type );
}
_sharedFlowTypeNames = new LinkedHashMap();
_sharedFlowFiles = new LinkedHashMap();
- for ( java.util.Iterator ii = _sharedFlowTypes.entrySet().iterator();
ii.hasNext(); )
+ for ( Iterator i = _sharedFlowTypes.entrySet().iterator();
i.hasNext(); )
{
- Map.Entry entry = ( Map.Entry ) ii.next();
+ Map.Entry entry = ( Map.Entry ) i.next();
TypeDeclaration type = ( TypeDeclaration ) entry.getValue();
_sharedFlowTypeNames.put( entry.getKey(), type.getQualifiedName()
);
File file = CompilerUtils.getSourceFile( type, false );
@@ -286,16 +270,6 @@
{
assert _isBuilding : "only valid during the check or generate phases";
return _mergedControllerAnnotation;
- }
-
- public File getWebappRoot()
- {
- return _webappRoot;
- }
-
- void setWebappRoot( File webappRoot )
- {
- _webappRoot = webappRoot;
}
public Map getMessageBundlesByName()
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FormBeanChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FormBeanChecker.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FormBeanChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FormBeanChecker.java
Fri Apr 22 00:41:54 2005
@@ -40,6 +40,7 @@
}
public Map onCheck( ClassDeclaration jclass )
+ throws FatalCompileTimeException
{
GetterValidatablePropertyGrammar validatablePropertyGrammar = new
GetterValidatablePropertyGrammar();
boolean isFormBeanClass = CompilerUtils.getAnnotation( jclass,
FORM_BEAN_TAG_NAME ) != null;
@@ -97,6 +98,7 @@
private boolean checkValidationAnnotation( MethodDeclaration method,
String annotationTagName,
AnnotationGrammar grammar )
+ throws FatalCompileTimeException
{
AnnotationInstance annotation = CompilerUtils.getAnnotation( method,
annotationTagName );
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
Fri Apr 22 00:41:54 2005
@@ -84,7 +84,6 @@
public static final String SHARED_FLOW_BASE_CLASS = PAGEFLOW_PACKAGE +
".SharedFlowController";
public static final String FACES_BACKING_BEAN_CLASS = PAGEFLOW_PACKAGE +
".FacesBackingBean";
public static final String FLOW_CONTROLLER_ACTION_CLASS =
PAGEFLOW_INTERNAL_PACKAGE + ".FlowControllerAction";
- public static final String WEBAPP_ROOT_PACKAGE = "webappRoot";
public static final String GLOBALAPP_BASE_CLASS = PAGEFLOW_PACKAGE +
".GlobalApp";
public static final String GLOBALAPP_PACKAGE = "global";
public static final String GLOBALAPP_CLASSNAME = "Global";
Added:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/MissingOptionException.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/MissingOptionException.java?rev=164185&view=auto
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/MissingOptionException.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/MissingOptionException.java
Fri Apr 22 00:41:54 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004 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.compiler;
+
+public class MissingOptionException
+ extends FatalCompileTimeException
+{
+ private String _optionName;
+
+ public MissingOptionException( String optionName )
+ {
+ super( "missing option: " + optionName );
+ _optionName = optionName;
+ }
+
+ public void printDiagnostic( Diagnostics diagnostics )
+ {
+ diagnostics.addErrorNoPosition( "error.missing-option", new Object[]{
_optionName } );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/MissingOptionException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java
Fri Apr 22 00:41:54 2005
@@ -20,7 +20,6 @@
import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
import org.apache.beehive.netui.compiler.grammar.ControllerGrammar;
import org.apache.beehive.netui.compiler.grammar.WebappPathOrActionType;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
import
org.apache.beehive.netui.compiler.typesystem.declaration.FieldDeclaration;
@@ -107,7 +106,7 @@
super.checkField( field, jclass );
}
- protected void doAdditionalClassChecks( ClassDeclaration jpfClass, File
webappRoot )
+ protected void doAdditionalClassChecks( ClassDeclaration jpfClass )
{
// Make sure there are no other page flows in this package/directory.
checkForOverlappingClasses( jpfClass, JPF_BASE_CLASS,
JPF_FILE_EXTENSION_DOT, "error.overlapping-pageflows" );
@@ -120,20 +119,12 @@
// Check the package name.
//
String jpfPackageName = pkg.getQualifiedName();
- if ( parentDir.equals( webappRoot ) )
- {
- if ( jpfPackageName != null && jpfPackageName.length() > 0 )
- {
- getDiagnostics().addError( jpfClass,
"error.root-level-package" );
- }
- }
- else
+
+ if ( jpfPackageName != null && jpfPackageName.length() > 0 )
{
- String expectedPackage = parentDir.getAbsolutePath().substring(
webappRoot.getPath().length() );
- expectedPackage = expectedPackage.replace( '\\', '/' );
- assert expectedPackage.length() != 1 : expectedPackage;
- if ( expectedPackage.length() > 1 ) expectedPackage =
expectedPackage.substring( 1 ).replace( '/', '.' );
- if ( jpfPackageName != null && ! expectedPackage.endsWith(
jpfPackageName ) )
+ String expectedPackage = parentDir.getAbsolutePath().replace(
'\\', '/' ).replace( '/', '.' );
+
+ if ( ! expectedPackage.endsWith( jpfPackageName ) )
{
getDiagnostics().addError( jpfClass,
"error.wrong-package-for-directory", parentDir.getPath() );
}
@@ -202,10 +193,10 @@
}
protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
- throws XmlException, IOException, NoWebInfDirectoryException
+ throws XmlException, IOException, FatalCompileTimeException
{
File sourceFile = CompilerUtils.getSourceFile( jclass, true );
- return new GenStrutsApp( sourceFile, jclass, getEnv(),
getFCSourceFileInfo(), true );
+ return new GenStrutsApp( sourceFile, jclass, getEnv(),
getFCSourceFileInfo(), true, getDiagnostics() );
}
protected AnnotationGrammar getControllerGrammar()
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java
Fri Apr 22 00:41:54 2005
@@ -18,7 +18,6 @@
package org.apache.beehive.netui.compiler;
import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
import org.apache.xmlbeans.XmlException;
@@ -36,10 +35,9 @@
}
protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
-
- throws XmlException, IOException, NoWebInfDirectoryException
+ throws XmlException, IOException, FatalCompileTimeException
{
File sourceFile = CompilerUtils.getSourceFile( jclass, true );
- return new GenStrutsApp( sourceFile, jclass, getEnv(),
getFCSourceFileInfo(), false );
+ return new GenStrutsApp( sourceFile, jclass, getEnv(),
getFCSourceFileInfo(), false, getDiagnostics() );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java
Fri Apr 22 00:41:54 2005
@@ -21,11 +21,6 @@
import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
import org.apache.beehive.netui.compiler.typesystem.declaration.Declaration;
-import java.io.File;
-import java.io.IOException;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
public class RuntimeVersionChecker
implements JpfLanguageConstants
@@ -42,7 +37,11 @@
_runtimeVersion = getHighVersion();
}
- public RuntimeVersionChecker( File webappRoot )
+ /*
+ * TODO: in the future, we should have a way to (optionally) find the
runtime jar(s) to check the versions.
+ * For now (1.0), this is unnecessary.
+ *
+ public RuntimeVersionChecker()
{
File pageflowJar = new File( webappRoot.getPath() +
PAGEFLOW_RUNTIME_JAR );
@@ -79,6 +78,7 @@
_runtimeVersion = getHighVersion();
}
}
+ */
private static String getHighVersion()
{
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java
Fri Apr 22 00:41:54 2005
@@ -20,7 +20,6 @@
import org.apache.beehive.netui.compiler.genmodel.GenSharedFlowStrutsApp;
import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
import org.apache.beehive.netui.compiler.grammar.ControllerGrammar;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
import org.apache.xmlbeans.XmlException;
@@ -37,7 +36,7 @@
super( env, fcInfo, diagnostics );
}
- protected void doAdditionalClassChecks( ClassDeclaration jclass, File
webappRoot )
+ protected void doAdditionalClassChecks( ClassDeclaration jclass )
{
// Make sure there are no other shared flows in this package/directory.
checkForOverlappingClasses( jclass, SHARED_FLOW_BASE_CLASS,
SHARED_FLOW_FILE_EXTENSION_DOT,
@@ -72,10 +71,10 @@
}
protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
- throws XmlException, IOException, NoWebInfDirectoryException
+ throws XmlException, IOException, FatalCompileTimeException
{
File sourceFile = CompilerUtils.getSourceFile( jclass, true );
- return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(),
getFCSourceFileInfo(), true );
+ return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(),
getFCSourceFileInfo(), true, getDiagnostics() );
}
protected AnnotationGrammar getControllerGrammar()
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
Fri Apr 22 00:41:54 2005
@@ -19,7 +19,6 @@
import org.apache.beehive.netui.compiler.genmodel.GenSharedFlowStrutsApp;
import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
import org.apache.xmlbeans.XmlException;
@@ -37,9 +36,9 @@
}
protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
- throws XmlException, IOException, NoWebInfDirectoryException
+ throws XmlException, IOException, FatalCompileTimeException
{
File sourceFile = CompilerUtils.getSourceFile( jclass, true );
- return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(),
getFCSourceFileInfo(), false );
+ return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(),
getFCSourceFileInfo(), false, getDiagnostics() );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties
Fri Apr 22 00:41:54 2005
@@ -213,3 +213,5 @@
warning.shared-flow-field-no-annotation = \
Field {0} is of a type that extends {1}, but it has no @{2} annotation. It
will not be initialized automatically.
+
+error.missing-option = The "{0}" option is required. It is specified by
passing "-A{0}=<value>" as an option to apt.
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java?rev=164185&r1=164184&r2=164185&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java
Fri Apr 22 00:41:54 2005
@@ -19,9 +19,10 @@
import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import org.apache.beehive.netui.compiler.FlowControllerInfo;
import org.apache.beehive.netui.compiler.JpfLanguageConstants;
+import org.apache.beehive.netui.compiler.Diagnostics;
+import org.apache.beehive.netui.compiler.FatalCompileTimeException;
import org.apache.xmlbeans.XmlException;
import java.io.File;
@@ -36,10 +37,10 @@
public GenSharedFlowStrutsApp( File sourceFile, ClassDeclaration jclass,
AnnotationProcessorEnvironment env,
- FlowControllerInfo fcInfo, boolean
checkOnly )
- throws NoWebInfDirectoryException, XmlException, IOException
+ FlowControllerInfo fcInfo, boolean
checkOnly, Diagnostics diagnostics )
+ throws XmlException, IOException, FatalCompileTimeException
{
- super( sourceFile, jclass, env, fcInfo, checkOnly );
+ super( sourceFile, jclass, env, fcInfo, checkOnly, diagnostics );
_isGlobalApp = GLOBALAPP_PACKAGE.equals(
jclass.getPackage().getQualifiedName() )
&& sourceFile.getName().startsWith( GLOBALAPP_CLASSNAME
);
recalculateStrutsConfigFile(); // it changes based on _isGlobalApp