Author: rich
Date: Sun Feb 6 19:16:15 2005
New Revision: 151671
URL: http://svn.apache.org/viewcvs?view=rev&rev=151671
Log:
- Reworked the Page Flow compiler so that it does not care whether
referenced/extended classes are on sourcepath (i.e., their source files may be
unavailable, as when they are on classpath but not sourcepath).
- Removed knowledge of the temporary source directory (WEB-INF/.tmpbeansrc)
from the Page Flow compiler. This directory is used to process renamed
(.jpf->.java) page flow classes with apt. But knowledge of this in the Page
Flow (and Shared Flow, and JSF Backing Bean) annotation processors is bad.
DRT/BVT: netui (WinXP)
BB: self (linux)
Added:
incubator/beehive/trunk/netui/test/webapps/tomcat/tomcatWeb/WEB-INF/src/log4j.xml
(with props)
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java
Sun Feb 6 19:16:15 2005
@@ -52,8 +52,7 @@
// Get a RuntimeVersionChecker (which looks at the manifest of
beehive-netui-pageflow.jar).
//
File webappRoot;
- File sourceFile = CompilerUtils.getOriginalFile( jclass );
- assert sourceFile != null : "could not get source file for " +
jclass.getQualifiedName();
+ File sourceFile = CompilerUtils.getSourceFile( jclass, true );
try
{
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
Sun Feb 6 19:16:15 2005
@@ -45,6 +45,9 @@
import java.io.File;
import java.lang.annotation.Annotation;
+import org.apache.beehive.netui.compiler.model.StrutsApp;
+import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
+
public class CompilerUtils
implements JpfLanguageConstants
@@ -649,100 +652,19 @@
return getLoadableName( getDeclaration( jclass ) );
}
- /**
- * Get the original filename, inferred from the current temporary file
being compiled.
- */
+ /** @deprecated */
+ // TODO: remove this method once we're sure it's not being used.
public static File getOriginalFile( TypeDeclaration decl )
{
- decl = CompilerUtils.getOutermostClass( decl );
- SourcePosition position = decl.getPosition();
- File retVal = null;
-
- if ( position != null )
- {
- File file = position.file();
- String path = file.getAbsoluteFile().getPath();
- int pos = path.indexOf( TMP_SRC_DIR );
-
- if ( pos != -1 )
- {
- String webappRootPath = path.substring( 0, pos - 1 );
-
- //
- // Global.app (deprecated) can only be
/WEB-INF/src/global/Global.{app,java}
- //
- if ( decl.getQualifiedName().equals( GLOBALAPP_FULL_CLASSNAME
) )
- {
- StringBuilder sb = new StringBuilder( webappRootPath );
- sb.append( WEBINF_SRC_PATH ).append( '/' );
- sb.append( GLOBALAPP_PACKAGE ).append( '/' );
- sb.append( GLOBALAPP_CLASSNAME );
- String basePath = sb.toString();
- retVal = new File( basePath + GLOBALAPP_FILE_EXTENSION_DOT
);
- if ( ! retVal.exists() ) retVal = new File( basePath +
JAVA_FILE_EXTENSION_DOT );
- }
- else
- {
- String fileRelativePath = path.substring( pos +
TMP_SRC_DIR.length() );
- retVal = findSourceFileInWebapp( webappRootPath,
fileRelativePath );
- }
- }
- else
- {
- retVal = new File( path );
- }
-
- }
-
- return retVal;
- }
-
- public static File findSourceFileInWebapp( String webappRootPath, String
fileRelativePath )
- {
- int extensionPos = fileRelativePath.lastIndexOf(
JAVA_FILE_EXTENSION_DOT );
- assert extensionPos != -1 : "expected a .java file: " +
fileRelativePath;
- webappRootPath += File.separatorChar;
-
- // See if we can find the file by chopping out the temp-dir.
- File retVal = new File( webappRootPath + fileRelativePath );
-
- if ( ! retVal.exists() )
- {
- // See if we need to replace ".java" with ".jpf" or ".jpfs".
- fileRelativePath = fileRelativePath.substring( 0, extensionPos );
- retVal = getSourceFile( webappRootPath + fileRelativePath );
-
- //
- // See if the file lives in WEB-INF/src.
- //
- if ( retVal == null )
- {
- StringBuilder retValPath = new StringBuilder( webappRootPath );
- retValPath.append( WEBINF_DIR_NAME ).append(
File.separatorChar );
- retValPath.append( "src" ).append( File.separatorChar );
- retValPath.append( fileRelativePath );
- retVal = getSourceFile( retValPath.toString() );
- }
- }
-
- assert retVal != null : "could not find original file for " +
fileRelativePath;
- return retVal.exists() ? retVal.getAbsoluteFile() : null;
+ return getSourceFile( decl, true );
}
- /**
- * Tries to find the file with '.jpf', '.jpfs', '.jsfb', '.java'
extensions.
- */
- private static File getSourceFile( String base )
+ public static File getSourceFile( TypeDeclaration decl, boolean
mustBeNonNull )
{
- File file = new File( base + JAVA_FILE_EXTENSION_DOT );
- if ( file.exists() ) return file;
- file = new File( base + JPF_FILE_EXTENSION_DOT );
- if ( file.exists() ) return file;
- file = new File( base + SHARED_FLOW_FILE_EXTENSION_DOT );
- if ( file.exists() ) return file;
- file = new File( base + FACES_BACKING_FILE_EXTENSION_DOT );
- if ( file.exists() ) return file;
- return null;
+ decl = getOutermostClass( decl );
+ SourcePosition position = decl.getPosition();
+ if ( mustBeNonNull ) assert position != null : "no source file for " +
decl.toString();
+ return position != null ? position.file() : null;
}
public static class ExtendedAnnotationProcessorEnvironment
@@ -1013,12 +935,6 @@
return uri.substring( 0, lastDot );
}
- public static TypeDeclaration inferTypeFromFile( File file, String
webappRoot, AnnotationProcessorEnvironment env )
- {
- assert file.getPath().startsWith( webappRoot ) : file + ", " +
webappRoot;
- return inferTypeFromPath( file.getPath().substring(
webappRoot.length() ).replace( File.separatorChar, '/'), env );
- }
-
public static TypeDeclaration inferTypeFromPath( String
pathFromWebappRoot, AnnotationProcessorEnvironment env )
{
assert pathFromWebappRoot.startsWith( "/" ) : pathFromWebappRoot;
@@ -1183,5 +1099,81 @@
}
return type;
+ }
+
+ public static File getFileRelativeToSourceFile( TypeDeclaration
outerClass, String relativePath,
+
AnnotationProcessorEnvironment env )
+ {
+ File sourceFile = getSourceFile( outerClass, false );
+ File desiredParentDir = sourceFile.getAbsoluteFile().getParentFile();
+ File retVal = new File( desiredParentDir, relativePath );
+
+ if ( ! retVal.exists() )
+ {
+ String jpfParentRelativePath = "";
+ PackageDeclaration jpfPackage = outerClass.getPackage();
+ if ( jpfPackage != null ) jpfParentRelativePath =
jpfPackage.getQualifiedName().replace( '.', '/' );
+
+ //
+ // 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 );
+
+ //
+ // 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() )
+ {
+ try
+ {
+ retVal = new File( StrutsApp.getWebappRootFromJpf(
sourceFile ) + File.separator
+ + WEBINF_SRC_DIR + File.separator
+ jpfParentRelativePath
+ + File.separator + relativePath );
+ }
+ catch ( NoWebInfDirectoryException e )
+ {
+ // ignore and fall through
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ public static File getWebFilesRoot( File jpfSourceFile, boolean
useAlternateLocation,
+ AnnotationProcessorEnvironment env )
+ {
+ try
+ {
+ String alternateRoot = null;
+ if ( useAlternateLocation )
+ {
+ alternateRoot = env.getOptions().get(
ALTERNATE_WEB_ROOT_DIR_OPTION );
+
+ // TODO: there appears to be a bug in APT where both the
key/value are contained in the key
+ if ( alternateRoot == null )
+ {
+ for ( Object i : env.getOptions().keySet() )
+ {
+ String key = ( String ) i;
+
+ if ( key.startsWith( ALTERNATE_WEB_ROOT_DIR_OPTION +
'=' ) )
+ {
+ alternateRoot = key.substring(
ALTERNATE_WEB_ROOT_DIR_OPTION.length() + 1 );
+ break;
+ }
+ }
+ }
+ }
+
+ return alternateRoot != null ? new File( alternateRoot ) :
StrutsApp.getWebappRootFromJpf( jpfSourceFile );
+ }
+ catch ( NoWebInfDirectoryException e )
+ {
+ assert false : e; // must be caught earlier, before
FlowControllerChecker is invoked
+ return null;
+ }
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
Sun Feb 6 19:16:15 2005
@@ -28,8 +28,6 @@
import com.sun.mirror.type.TypeMirror;
import com.sun.mirror.type.DeclaredType;
import com.sun.mirror.type.ClassType;
-import com.sun.mirror.type.TypeVariable;
-import com.sun.mirror.type.ReferenceType;
import java.io.File;
import java.io.IOException;
@@ -229,13 +227,11 @@
{
}
- protected abstract GenStrutsApp createStrutsApp( File sourceFile,
ClassDeclaration jclass )
+ protected abstract GenStrutsApp createStrutsApp( ClassDeclaration jclass )
throws XmlException, IOException, NoWebInfDirectoryException;
protected void startCheckClass( ClassDeclaration jclass )
{
- File sourceFile = CompilerUtils.getOriginalFile( jclass );
-
//
// Check for basic things like writability of the struts-config file.
//
@@ -249,7 +245,7 @@
//
try
{
- strutsApp = createStrutsApp( sourceFile, jclass );
+ strutsApp = createStrutsApp( jclass );
strutsConfigFile = strutsApp.getStrutsConfigFile();
}
catch ( XmlException e )
@@ -291,7 +287,7 @@
}
catch ( NoWebInfDirectoryException e )
{
- getDiagnostics().addError( jclass, "error.web-inf-not-found",
sourceFile );
+ getDiagnostics().addError( jclass, "error.web-inf-not-found",
CompilerUtils.getSourceFile( jclass, true ) );
}
//
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
Sun Feb 6 19:16:15 2005
@@ -46,7 +46,7 @@
_fcInfo = fcInfo;
}
- protected abstract GenStrutsApp createStrutsApp( File sourceFile,
ClassDeclaration cl )
+ protected abstract GenStrutsApp createStrutsApp( ClassDeclaration cl )
throws XmlException, IOException, NoWebInfDirectoryException;
public void generate( ClassDeclaration publicClass )
@@ -56,7 +56,7 @@
try
{
- app = createStrutsApp( CompilerUtils.getOriginalFile( publicClass
), publicClass );
+ app = createStrutsApp( publicClass );
GenValidationModel validationModel = new GenValidationModel(
publicClass, app );
if ( ! validationModel.isEmpty() )
@@ -115,7 +115,7 @@
getEnv().getMessager().printError( publicClass.getPosition(), "" );
getDiagnostics().addError( publicClass,
"error.could-not-generate-struts-config",
- strutsConfigFile != null ? new
Object[]{ strutsConfigFile.getPath() } : null,
+ strutsConfigFile != null ?
strutsConfigFile.getPath() : null,
null );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java
Sun Feb 6 19:16:15 2005
@@ -114,7 +114,7 @@
public FlowControllerInfo( ClassDeclaration jclass )
{
- super( CompilerUtils.getOriginalFile( jclass ),
jclass.getQualifiedName() );
+ super( CompilerUtils.getSourceFile( jclass, true ),
jclass.getQualifiedName() );
}
public FlowControllerInfo( ClassDeclaration jclass, File webappRoot )
@@ -270,9 +270,13 @@
{
TypeDeclaration type = entry.getValue();
_sharedFlowTypeNames.put( entry.getKey(), type.getQualifiedName()
);
- File file = CompilerUtils.getOriginalFile( type );
- _sharedFlowFiles.put( entry.getKey(), file );
- _referencedFiles.add( file );
+ File file = CompilerUtils.getSourceFile( type, false );
+
+ if ( file != null )
+ {
+ _sharedFlowFiles.put( entry.getKey(), file );
+ _referencedFiles.add( file );
+ }
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
Sun Feb 6 19:16:15 2005
@@ -89,7 +89,6 @@
public static final String GLOBALAPP_PARENT_PATH = WEBINF_SRC_PATH + '/' +
GLOBALAPP_PACKAGE;
public static final String GLOBALAPP_SOURCE_NAME = GLOBALAPP_CLASSNAME +
GLOBALAPP_FILE_EXTENSION_DOT;
public static final String GLOBALAPP_URI = GLOBALAPP_PARENT_PATH + '/' +
GLOBALAPP_SOURCE_NAME;
- public static final String TMP_SRC_DIR = "WEB-INF" + File.separatorChar +
".tmpbeansrc" + File.separatorChar;
public static final String ANNOTATION_QUALIFIER = PAGEFLOW_PACKAGE +
".annotations.Jpf.";
public static final String ANNOTATION_INTERFACE_PREFIX = "Jpf.";
public static final String NAVIGATE_TO_ENUM = "NavigateTo";
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
Sun Feb 6 19:16:15 2005
@@ -123,7 +123,7 @@
protected void doAdditionalClassChecks( ClassDeclaration jpfClass, File
webappRoot )
{
- File jpfFile = CompilerUtils.getOriginalFile( jpfClass );
+ File jpfFile = CompilerUtils.getSourceFile( jpfClass, true );
PackageDeclaration pkg = jpfClass.getPackage();
Collection< ClassDeclaration > packageClasses = pkg.getClasses();
Set< String > overlapping = new HashSet< String >();
@@ -136,13 +136,13 @@
{
if ( CompilerUtils.isPageFlowClass( classDecl, getEnv() ) )
{
- File file = CompilerUtils.getOriginalFile( classDecl );
+ File file = CompilerUtils.getSourceFile( classDecl, false );
//
// Add the dependency if it's a different file and if the file
exists (it may have been deleted
// sometime after the list of classes in this package got
built.
//
- if ( jpfFile != null && ! jpfFile.equals( file ) && file !=
null && file.exists() )
+ if ( ! jpfFile.equals( file ) && file != null && file.exists()
)
{
overlapping.add( file.getName() );
overlappingFiles.add( file );
@@ -154,7 +154,7 @@
// Additionally, we'll go through the parent directory to make sure
there are no other .jpf files. This is
// a double-check for the case where duplicate files have the same
class names inside them, which means that
// iterating through the list of package classes is hit or miss (only
one of them will show up, and it may be
- // this class or the duplicate class.
+ // this class or the duplicate class).
//
File parentDir = jpfFile.getParentFile();
File[] peers = parentDir.listFiles( JPF_FILE_FILTER );
@@ -205,22 +205,13 @@
}
else
{
- String expectedPackage = parentDir.getPath().substring(
webappRoot.getPath().length() );
+ String expectedPackage = parentDir.getAbsolutePath().substring(
webappRoot.getPath().length() );
expectedPackage = expectedPackage.replace( '\\', '/' );
-
- //
- // We support .jpf in WEB-INF/src.
- //
- if ( expectedPackage.startsWith( WEBINF_SRC_PATH ) )
- {
- expectedPackage = expectedPackage.substring(
WEBINF_SRC_PATH.length() );
- }
-
assert expectedPackage.length() != 1 : expectedPackage;
if ( expectedPackage.length() > 1 ) expectedPackage =
expectedPackage.substring( 1 ).replace( '/', '.' );
- if ( jpfPackageName != null && ! jpfPackageName.equals(
expectedPackage ) )
+ if ( jpfPackageName != null && ! expectedPackage.endsWith(
jpfPackageName ) )
{
- getDiagnostics().addError( jpfClass, "error.wrong-package",
expectedPackage );
+ getDiagnostics().addError( jpfClass,
"error.wrong-package-for-directory", parentDir.getPath() );
}
}
@@ -263,9 +254,10 @@
return JPF_BASE_CLASS;
}
- protected GenStrutsApp createStrutsApp( File sourceFile, ClassDeclaration
jclass )
+ protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
throws XmlException, IOException, NoWebInfDirectoryException
{
+ File sourceFile = CompilerUtils.getSourceFile( jclass, true );
return new GenStrutsApp( sourceFile, jclass, getEnv(),
getFlowControllerInfo(), true );
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java
Sun Feb 6 19:16:15 2005
@@ -36,10 +36,11 @@
super( env, fcInfo );
}
- protected GenStrutsApp createStrutsApp( File sourceFile, ClassDeclaration
jclass )
+ protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
throws XmlException, IOException, NoWebInfDirectoryException
{
+ File sourceFile = CompilerUtils.getSourceFile( jclass, true );
return new GenStrutsApp( sourceFile, jclass, getEnv(),
getFlowControllerInfo(), false );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
Sun Feb 6 19:16:15 2005
@@ -47,11 +47,6 @@
{
String pkg = jclass.getPackage().getQualifiedName();
- if ( pkg.length() == 0 )
- {
- getDiagnostics().addError( jclass, "error.wrong-package",
WEBAPP_ROOT_PACKAGE );
- }
-
//
// If it's Global.app, make sure the package is "global".
//
@@ -72,15 +67,16 @@
protected String getDesiredBaseClass( ClassDeclaration jclass )
{
- File sourceFile = CompilerUtils.getOriginalFile( jclass );
+ File sourceFile = CompilerUtils.getSourceFile( jclass, true );
if ( sourceFile.getName().endsWith( GLOBALAPP_FILE_EXTENSION_DOT ) )
return GLOBALAPP_BASE_CLASS;
if ( sourceFile.getName().endsWith( SHARED_FLOW_FILE_EXTENSION_DOT ) )
return SHARED_FLOW_BASE_CLASS;
return null;
}
- protected GenStrutsApp createStrutsApp( File sourceFile, ClassDeclaration
jclass )
+ protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
throws XmlException, IOException, NoWebInfDirectoryException
{
+ File sourceFile = CompilerUtils.getSourceFile( jclass, true );
return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(),
getFlowControllerInfo(), true );
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
Sun Feb 6 19:16:15 2005
@@ -37,9 +37,10 @@
super( env, fcInfo );
}
- protected GenStrutsApp createStrutsApp( File sourceFile, ClassDeclaration
jclass )
+ protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
throws XmlException, IOException, NoWebInfDirectoryException
{
+ File sourceFile = CompilerUtils.getSourceFile( jclass, true );
return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(),
getFlowControllerInfo(), false );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java
Sun Feb 6 19:16:15 2005
@@ -21,10 +21,14 @@
import com.sun.mirror.apt.AnnotationProcessor;
import com.sun.mirror.declaration.TypeDeclaration;
import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
import com.sun.mirror.util.SimpleDeclarationVisitor;
+import com.sun.mirror.type.ClassType;
import org.apache.beehive.netui.compiler.Diagnostics;
import org.apache.beehive.netui.compiler.BaseChecker;
import org.apache.beehive.netui.compiler.BaseGenerator;
+
+import java.util.Collection;
public abstract class BaseAnnotationProcessor
implements AnnotationProcessor
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java
Sun Feb 6 19:16:15 2005
@@ -56,7 +56,7 @@
if ( CompilerUtils.getAnnotation( classDecl, FACES_BACKING_TAG_NAME )
!= null )
{
- File originalFile = CompilerUtils.getOriginalFile( classDecl );
+ File originalFile = CompilerUtils.getSourceFile( classDecl, true );
FacesBackingInfo fbInfo = new FacesBackingInfo( originalFile,
className );
return new FacesBackingChecker( getEnv(), diagnostics, fbInfo );
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
Sun Feb 6 19:16:15 2005
@@ -7,10 +7,12 @@
error.atleast-one-must-exist-3 = At least one of attributes "{0}", "{1}", or
"{2}" must be present.
error.atleast-one-must-exist-4 = At least one of attributes "{0}", "{1}",
"{2}", or "{3}" must be present.
error.atleast-one-must-exist-5 = At least one of attributes "{0}", "{1}",
"{2}", "{3}", or "{4}" must be present.
+error.atleast-one-must-exist-6 = At least one of attributes "{0}", "{1}",
"{2}", "{3}", "{4}", or "{5}" must be present.
error.atmost-one-may-exist-2 = Only one of attributes "{0}" or "{1}" may be
present.
error.atmost-one-may-exist-3 = Only one of attributes "{0}", "{1}", or "{2}"
may be present.
error.atmost-one-may-exist-4 = Only one of attributes "{0}", "{1}", "{2}", or
"{3}" may be present.
error.atmost-one-may-exist-5 = Only one of attributes "{0}", "{1}", "{2}",
"{3}", or "{4}" may be present.
+error.atmost-one-may-exist-6 = Only one of attributes "{0}", "{1}", "{2}",
"{3}", "{4}", or "{5}" may be present.
error.attr-dependency-not-found-1 = Attribute "{0}" may only be present when
attribute "{1}" is present.
error.attr-dependency-not-found-2 = Attribute "{0}" may only be present when
attribute "{1}" or "{2}" is present.
error.unresolved-exception-handler = No exception handler method named "{0}"
could be found.
@@ -37,6 +39,7 @@
error.exception-method-wrong-arg-type2 = Argument {0} must be of type {1} or
{2}.
error.exception-method-wrong-arg-count = Expected {0} arguments on this method.
error.wrong-package = The package must be "{0}".
+error.wrong-package-for-directory = The package does not match the directory
{0}.
error.wrong-classname = The class name must be "{0}".
warning.classname-same-as-package = \
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
Sun Feb 6 19:16:15 2005
@@ -46,6 +46,7 @@
import com.sun.mirror.declaration.Modifier;
import com.sun.mirror.declaration.MethodDeclaration;
import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.declaration.PackageDeclaration;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.type.TypeMirror;
import com.sun.mirror.type.DeclaredType;
@@ -242,20 +243,27 @@
for ( String definitionsConfig : tilesDefinitionsConfigs )
{
- if ( definitionsConfig != null && definitionsConfig.startsWith(
"/" ) )
+ if ( definitionsConfig != null && definitionsConfig.length() > 0
&& definitionsConfig.charAt( 0 ) == '/' )
{
paths.add( definitionsConfig );
}
else
{
- String prefix =
_sourceFile.getParentFile().toString().substring(
_webappRoot.toString().length() );
- paths.add( prefix + '/' + definitionsConfig );
+ paths.add( getStrutsModulePath() + '/' + definitionsConfig );
}
}
setTilesDefinitionsConfigs( paths );
}
+ private String getStrutsModulePath()
+ {
+ StringBuilder modulePath = new StringBuilder( '/' );
+ if ( isSharedFlow() ) modulePath.append( STRUTS_CONFIG_SEPARATOR );
+ if ( _containingPackage != null ) modulePath.append(
_containingPackage.replace( '.', '/' ) );
+ return modulePath.toString();
+ }
+
private void addActionMethods()
{
Collection< MethodDeclaration > actionMethods =
CompilerUtils.getClassMethods( _jclass, ACTION_TAG_NAME );
@@ -324,8 +332,9 @@
protected boolean isModuleDeclaredInWebXml()
{
- String webappRelativeSourceFile = getWebappRelativeSourceFile();
- return webappRelativeSourceFile.lastIndexOf( '/' ) == 0;
+ // Only the root page flow (which generates a module for path "/") is
declared in web.xml
+ PackageDeclaration pkg = _jclass.getPackage();
+ return ! isSharedFlow() && pkg == null ||
pkg.getQualifiedName().length() == 0;
}
String getOutputFileURI( String filePrefix )
@@ -592,27 +601,17 @@
}
else
{
- return new File( _sourceFile.getParentFile() + File.separator
+ mergeFileName );
+ return CompilerUtils.getFileRelativeToSourceFile( _jclass,
mergeFileName, getEnv() );
}
}
return null;
}
- public String getWebappRelativeSourceFile()
- {
- return getWebappRelativePath( _sourceFile );
- }
-
- public File getSourceFile()
- {
- return _sourceFile;
- }
-
protected String getHeaderComment( File mergeFile )
{
StringBuffer comment = new StringBuffer( " Generated from " );
- comment.append( getWebappRelativeSourceFile() );
+ comment.append( getWebappRelativePath( _sourceFile ) );
if ( mergeFile != null )
{
comment.append( " and " ).append( getWebappRelativePath( mergeFile
) );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java
Sun Feb 6 19:16:15 2005
@@ -66,7 +66,7 @@
&& ! WebappPathOrActionType.actionExists( action, _jpfClass,
null, getEnv(), getFlowControllerInfo(), true ) )
{
getDiagnostics().addWarning( member, "warning.no-such-action",
action,
- CompilerUtils.getOriginalFile(
_jpfClass ) );
+ CompilerUtils.getSourceFile(
_jpfClass, true ) );
}
return null;
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java
Sun Feb 6 19:16:15 2005
@@ -47,22 +47,26 @@
_schema = schema;
}
+ @Override
protected boolean checkAnyExtension()
{
return true;
}
+ @Override
protected boolean doFatalError()
{
return true;
}
+ @Override
protected boolean ignoreDirectories()
{
return false;
}
- protected boolean mustBeInPageFlowDir()
+ @Override
+ protected boolean allowFileInPageFlowSourceDir()
{
return true;
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
Sun Feb 6 19:16:15 2005
@@ -21,14 +21,13 @@
import org.apache.beehive.netui.compiler.AnnotationGrammar;
import org.apache.beehive.netui.compiler.CompilerUtils;
import org.apache.beehive.netui.compiler.FlowControllerInfo;
-import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
-import org.apache.beehive.netui.compiler.model.StrutsApp;
import com.sun.mirror.declaration.AnnotationValue;
import com.sun.mirror.declaration.AnnotationMirror;
import com.sun.mirror.declaration.MemberDeclaration;
import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
import com.sun.mirror.declaration.TypeDeclaration;
import com.sun.mirror.declaration.Modifier;
+import com.sun.mirror.declaration.PackageDeclaration;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import java.net.URISyntaxException;
@@ -108,7 +107,6 @@
}
boolean fileExists = true;
- File jpfFile = CompilerUtils.getOriginalFile(
CompilerUtils.getOuterClass( classMember ) );
TypeDeclaration outerClass = CompilerUtils.getOutermostClass(
classMember );
File fileToCheck = null;
@@ -122,7 +120,7 @@
if ( filePath.endsWith( JPF_FILE_EXTENSION_DOT ) )
{
TypeDeclaration type = CompilerUtils.inferTypeFromPath(
filePath, getEnv() );
- fileToCheck = type != null ? CompilerUtils.getOriginalFile(
type ) : null;
+ fileToCheck = type != null ? CompilerUtils.getSourceFile(
type, false ) : null;
// Note that if we can't infer the file from the type, we'll
fall through to the next case, where
// we actually look for the file in the webapp.
@@ -130,27 +128,34 @@
if ( fileToCheck == null )
{
- File webappRoot = getWebFilesRoot( jpfFile, true, getEnv() );
- fileToCheck = new File( webappRoot + filePath );
+ File jpfSourceFile = CompilerUtils.getSourceFile(
CompilerUtils.getOuterClass( classMember ), false );
- if ( ! fileToCheck.exists() && ! ( ignoreDirectories() &&
fileToCheck.isDirectory() ) )
+ //
+ // We don't always have the source file for the classMember's
containing class (e.g., when this class
+ // extends a class that's on classpath but not sourcepath).
If we don't have the source, just ignore.
+ //
+ if ( jpfSourceFile != null )
{
- fileExists = false;
+ File webappRoot = CompilerUtils.getWebFilesRoot(
jpfSourceFile, true, getEnv() );
+ fileToCheck = new File( webappRoot + filePath );
+
+ if ( ! fileToCheck.exists() && ! ( ignoreDirectories() &&
fileToCheck.isDirectory() ) )
+ {
+ fileExists = false;
+ }
}
}
}
//
- // In certain error conditions (jpfFile == null), we can't determine
the file. In this case, just ignore.
- // Also, if the class being compiled is abstract, don't print warnings
for relative-path files that aren't
+ // If the class being compiled is abstract, don't print warnings for
relative-path files that aren't
// found. The derived class might have them.
//
- else if ( jpfFile != null && filePath.indexOf( '/' ) != 0
- && ! CompilerUtils.hasModifier( outerClass,
Modifier.ABSTRACT ) )
+ else if ( filePath.indexOf( '/' ) != 0 && ! CompilerUtils.hasModifier(
outerClass, Modifier.ABSTRACT ) )
{
CompilerUtils.Mutable< File > retFileToCheck = new
CompilerUtils.Mutable< File >();
- fileExists = checkRelativePath( filePath, outerClass, jpfFile,
retFileToCheck, ignoreDirectories(),
- mustBeInPageFlowDir(), getEnv() );
+ fileExists = checkRelativePath( filePath, outerClass,
retFileToCheck, ignoreDirectories(),
+ allowFileInPageFlowSourceDir(),
getEnv() );
fileToCheck = retFileToCheck.get();
}
@@ -178,17 +183,17 @@
public static boolean relativePathExists( String filePath, TypeDeclaration
outerClass,
AnnotationProcessorEnvironment
env )
{
- File jpfFile = CompilerUtils.getOriginalFile(
CompilerUtils.getOuterClass( outerClass ) );
- return checkRelativePath( filePath, outerClass, jpfFile, null, true,
false, env );
+ return checkRelativePath( filePath, outerClass, null, true, false, env
);
}
private static boolean checkRelativePath( String filePath, TypeDeclaration
outerClass,
- File jpfFile,
CompilerUtils.Mutable< File > retFileToCheck,
- boolean ignoreDirectories,
boolean mustBeInPageFlowDir,
+ CompilerUtils.Mutable< File >
retFileToCheck,
+ boolean ignoreDirectories,
boolean allowFileInPageFlowSourceDir,
AnnotationProcessorEnvironment
env )
{
- File fileToCheck;
+ File fileToCheck = null;
boolean fileExists = true;
+ File jpfSourceFile;
if ( filePath.endsWith( JPF_FILE_EXTENSION_DOT ) )
{
@@ -202,35 +207,27 @@
}
className = ( pkg.length() > 0 ? pkg + '.' : "" ) +
className.replace( '/', '.' );
TypeDeclaration type = env.getTypeDeclaration( className );
- fileToCheck = type != null ? CompilerUtils.getOriginalFile( type )
: null;
+ fileToCheck = type != null ? CompilerUtils.getSourceFile( type,
false ) : null;
if ( fileToCheck == null ) fileExists = false;
}
- else
+ // In certain error conditions (jpfFile == null), we can't determine
the file. In this case, just ignore.
+ else if ( ( jpfSourceFile = CompilerUtils.getSourceFile( outerClass,
false ) ) != null )
{
- File webappRoot = getWebFilesRoot( jpfFile, false, env );
- File webFilesRoot = getWebFilesRoot( jpfFile, true, env );
- File jpfParent = jpfFile.getAbsoluteFile().getParentFile();
- assert jpfParent.getPath().startsWith( webappRoot.getPath() ) :
jpfParent.getPath();
- String jpfParentRelativePath = jpfParent.getPath().substring(
webappRoot.getPath().length() );
-
- //
- // Check if this page flow is in WEB-INF/src. If so, the "local"
dir is actually out
- // in the web-addressable part of the webapp, unless we're looking
for a .jpf (in the
- // case that there's a forward to the current page flow from
within the page flow).
- //
- if ( ! mustBeInPageFlowDir )
+ if ( allowFileInPageFlowSourceDir )
{
- jpfParentRelativePath = jpfParentRelativePath.replace( '\\',
'/' );
-
- if ( jpfParentRelativePath.startsWith( WEBINF_SRC_PATH ) )
- {
- jpfParentRelativePath = jpfParentRelativePath.substring(
WEBINF_SRC_PATH.length() );
- }
+ fileToCheck = CompilerUtils.getFileRelativeToSourceFile(
outerClass, filePath, env );
}
-
- File desiredParentDir = new File( webFilesRoot +
jpfParentRelativePath );
- fileToCheck = new File( desiredParentDir, filePath );
-
+ else
+ {
+ // Use the package name to infer the relative path (from web
files root) to the page flow directory.
+ File webFilesRoot = CompilerUtils.getWebFilesRoot(
jpfSourceFile, true, env );
+ String jpfParentRelativePath = "";
+ PackageDeclaration jpfPackage = outerClass.getPackage();
+ if ( jpfPackage != null ) jpfParentRelativePath =
jpfPackage.getQualifiedName().replace( '.', '/' );
+ File desiredParentDir = new File( webFilesRoot.getPath(),
jpfParentRelativePath );
+ fileToCheck = new File( desiredParentDir, filePath );
+ }
+
if ( ! fileToCheck.exists() && ! ( ignoreDirectories &&
fileToCheck.isDirectory() ) )
{
fileExists = false;
@@ -241,41 +238,6 @@
return fileExists;
}
- protected static File getWebFilesRoot( File jpfFile, boolean
useAlternateLocation,
- AnnotationProcessorEnvironment env )
- {
- try
- {
- String alternateRoot = null;
- if ( useAlternateLocation )
- {
- alternateRoot = env.getOptions().get(
ALTERNATE_WEB_ROOT_DIR_OPTION );
-
- // TODO: there appears to be a bug in APT where both the
key/value are contained in the key
- if ( alternateRoot == null )
- {
- for ( Object i : env.getOptions().keySet() )
- {
- String key = ( String ) i;
-
- if ( key.startsWith( ALTERNATE_WEB_ROOT_DIR_OPTION +
'=' ) )
- {
- alternateRoot = key.substring(
ALTERNATE_WEB_ROOT_DIR_OPTION.length() + 1 );
- break;
- }
- }
- }
- }
-
- return alternateRoot != null ? new File( alternateRoot ) :
StrutsApp.getWebappRootFromJpf( jpfFile );
- }
- catch ( NoWebInfDirectoryException e )
- {
- assert false : e; // must be caught earlier, before
FlowControllerChecker is invoked
- return null;
- }
- }
-
protected boolean checkAnyExtension()
{
return false;
@@ -299,7 +261,7 @@
* Tell whether the file must be in the page flow directory. If not, it
is assumed to live in a webapp-addressable
* directory whose path corresponds to the page flow's package. This is
here to support page flows in WEB-INF.
*/
- protected boolean mustBeInPageFlowDir()
+ protected boolean allowFileInPageFlowSourceDir()
{
return false;
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
Sun Feb 6 19:16:15 2005
@@ -262,10 +262,14 @@
// TODO: cache the stringValue of getWebappRootFromJpf. It's
expensive to calculate.
for ( File dir = jpf.getAbsoluteFile().getParentFile(); dir != null;
dir = dir.getParentFile() )
{
- if ( new File( dir, WEBINF_DIR_NAME ).isDirectory() )
+ File webinfDir = new File( dir, WEBINF_DIR_NAME );
+
+ if ( webinfDir.isDirectory() )
{
webappRoot = dir;
- break;
+
+ // If the directory contains a web.xml file, then it is our
best match.
+ if ( new File( webinfDir, "web.xml" ).isFile() ) break;
}
}
@@ -906,10 +910,7 @@
{
StringBuilder fileName = new StringBuilder( STRUTSCONFIG_OUTPUT_DIR );
fileName.append( '/' ).append( filePrefix );
- if ( containingPackage != null && containingPackage.length() > 0 )
- {
- fileName.append( STRUTS_CONFIG_SEPARATOR );
- }
+ if ( containingPackage != null && containingPackage.length() > 0 )
fileName.append( STRUTS_CONFIG_SEPARATOR );
if ( isSharedFlow ) fileName.append( STRUTS_CONFIG_SEPARATOR );
if ( containingPackage != null ) fileName.append(
containingPackage.replace( '.', STRUTS_CONFIG_SEPARATOR ) );
fileName.append( STRUTS_CONFIG_EXTENSION );
@@ -936,8 +937,13 @@
_multipartHandlerClassName = multipartHandlerClassName;
}
- public void setTilesDefinitionsConfigs( List<String>
tilesDefinitionsConfigs )
+ public void setTilesDefinitionsConfigs( List< String >
tilesDefinitionsConfigs )
{
_tilesDefinitionsConfigs = tilesDefinitionsConfigs;
+ }
+
+ protected boolean isSharedFlow()
+ {
+ return _isSharedFlow;
}
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java?view=diff&r1=151670&r2=151671
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
Sun Feb 6 19:16:15 2005
@@ -207,7 +207,7 @@
{
PageflowConfig options =
ConfigUtil.getConfig().getPageflowConfig();
- if ( options == null || ! options.getEnableRenesting() )
+ if ( options == null || ! options.getEnableSelfNesting() )
{
int lastIndexOfJpfClass = pfStack.lastIndexOf( request,
pageFlowClass );
Modified:
incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd?view=diff&r1=151670&r2=151671
==============================================================================
--- incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd
(original)
+++ incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd
Sun Feb 6 19:16:15 2005
@@ -106,7 +106,7 @@
<xsd:complexType name="pageflow-config">
<xsd:sequence>
- <xsd:element name="enable-renesting" type="xsd:boolean"
minOccurs="0" maxOccurs="1" default="false"/>
+ <xsd:element name="enable-self-nesting" type="xsd:boolean"
minOccurs="0" maxOccurs="1" default="false"/>
<xsd:element name="max-forwards-per-request" type="xsd:int"
minOccurs="0" maxOccurs="1" default="25"/>
<xsd:element name="max-nesting-stack-depth" type="xsd:int"
minOccurs="0" maxOccurs="1" default="10"/>
<xsd:element name="ensure-secure-forwards" type="xsd:boolean"
minOccurs="0" maxOccurs="1" default="false"/>
Added:
incubator/beehive/trunk/netui/test/webapps/tomcat/tomcatWeb/WEB-INF/src/log4j.xml
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/tomcat/tomcatWeb/WEB-INF/src/log4j.xml?view=auto&rev=151671
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/tomcat/tomcatWeb/WEB-INF/src/log4j.xml
(added)
+++
incubator/beehive/trunk/netui/test/webapps/tomcat/tomcatWeb/WEB-INF/src/log4j.xml
Sun Feb 6 19:16:15 2005
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+<!--
+ <appender name="NETUISYSLOGFILE"
class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="c:/tmp/netui.log"/>
+-->
+ <appender name="NETUISYSLOGFILE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Append" value="true"/>
+ <param name="MaxFileSize" value="500000KB"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%x]:
%m%n"/>
+ </layout>
+ </appender>
+
+ <!-- base for all netui server components -->
+ <category name="org.apache.beehive.netui">
+ <priority value="error"/>
+ <appender-ref ref="NETUISYSLOGFILE"/>
+ </category>
+
+ <!-- base for all netui server components -->
+ <category name="org.apache.struts">
+ <priority value="error"/>
+ <appender-ref ref="NETUISYSLOGFILE"/>
+ </category>
+
+ <category name="org.apache.beehive.netui.script">
+ <priority value="error"/>
+ <appender-ref ref="NETUISYSLOGFILE"/>
+ </category>
+
+</log4j:configuration>
Propchange:
incubator/beehive/trunk/netui/test/webapps/tomcat/tomcatWeb/WEB-INF/src/log4j.xml
------------------------------------------------------------------------------
svn:eol-style = native