CVS: plexus-components/summit/src/java/org/apache/plexus/summit/resolver AbstractResolver.java,1.3,1.4 ClassicResolver.java,1.2,1.3 Resolver.java,1.2,1.3 SimpleResolver.java,1.2,1.3
[email protected] Sat, 3 May 2003 14:14:36 -0500
| Newsgroups | gmane.comp.java.plexus.devel |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/plexus/plexus-components/summit/src/java/org/apache/plexus/summit/resolver
In directory eng.werken.com:/tmp/cvs-serv9002/org/apache/plexus/summit/resolver
Modified Files:
AbstractResolver.java ClassicResolver.java Resolver.java
SimpleResolver.java
Log Message:
o Fixed the behaviour that was inadvertently whacked some time back.
There was some confusion between what the first view to be shown is,
for example Index.vm, and the default base name to be used looking
for sibling views.
So first, the notion of the initial view to be shown was removed
which is wrong. It was being calculated from the default base
name with no extension. So it was completely wrong, I don't
know what happened here.
Second, because the notion of the default base name was
wrong it was being set to what the initial view should have
been set to.
So previously the default base name was set to Index so the
system correctly found Index.vm for the initial view but this
messed up the searching for sibling templates because a layout
of Index.vm was expected.
So now the initial view is configurable again so it is set
to Index.vm while the default base name is 'Default' so this
allows the Index.vm screen to use the Default.vm layout (along
with any other screen template that doesn't have a specific
layout template).
So this is the sequence of events now:
[DEBUG] Target is now: Index.vm
[INFO] Resolving target: Index.vm
[INFO] Looking for view: layouts/Index.vm
[INFO] Looking for view: layouts/Default.vm
[INFO] Found view: layouts/Default.vm
[INFO] Looking for view: screens/Index.vm
[INFO] Found view: screens/Index.vm
[INFO] Screen View: org.apache.plexus.summit.view.DefaultView@6c585a
[INFO] Rendering template: /Index.vm
[INFO] Rendering template: screens/Index.vm
Index: AbstractResolver.java
===================================================================
RCS file: /cvsroot/plexus/plexus-components/summit/src/java/org/apache/plexus/summit/resolver/AbstractResolver.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- AbstractResolver.java 3 May 2003 14:31:43 -0000 1.3
+++ AbstractResolver.java 3 May 2003 19:14:34 -0000 1.4
@@ -92,11 +92,12 @@
*/
private StringBuffer modulePackagesNames;
- /**
- * The view that will be used when there is an error.
- */
+ /** The view that will be used when there is an error. */
private String errorView;
+ /** The default view i.e. index.vm */
+ private String defaultView;
+
/**
* The name that will be searched for when a match cannot be made using the
* target's name within a <i>package</i> . This default base name is used
@@ -123,8 +124,10 @@
/**
* @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
*/
- public void configure( Configuration config ) throws ConfigurationException
+ public void configure( Configuration config )
+ throws ConfigurationException
{
+ setDefaultView( config.getChild( "defaultView" ).getValue() );
setErrorView( config.getChild( "errorView" ).getValue() );
setDefaultBaseName( config.getChild( "defaultBaseName" ).getValue() );
setDefaultViewExtension( config.getChild( "defaultViewExtension" ).getValue() );
@@ -132,7 +135,9 @@
Configuration[] packages = config.getChild( "modulePackages" ).getChildren();
// If the user does not define any modules, use the default package.
- if ( packages == null || packages.length == 0 )
+ if ( packages == null
+ ||
+ packages.length == 0 )
{
addModulePackage( "" );
}
@@ -150,7 +155,17 @@
// Accessors
// ----------------------------------------------------------------------
- protected void setErrorView( String errorView )
+ void setDefaultView( String defaultView )
+ {
+ this.defaultView = defaultView;
+ }
+
+ public String getDefaultView()
+ {
+ return defaultView;
+ }
+
+ void setErrorView( String errorView )
{
this.errorView = errorView;
}
@@ -170,7 +185,7 @@
*
* @param defaultBaseName
*/
- protected void setDefaultBaseName( String defaultBaseName )
+ void setDefaultBaseName( String defaultBaseName )
{
this.defaultBaseName = defaultBaseName;
}
@@ -189,7 +204,7 @@
/**
* Set the default view extension used in part to resolve <b>Views</b> .
*/
- protected void setDefaultViewExtension( String defaultViewExtension )
+ void setDefaultViewExtension( String defaultViewExtension )
{
this.defaultViewExtension = defaultViewExtension;
}
@@ -209,7 +224,7 @@
*
* @param modulePackages
*/
- protected void setModulePackages( List modulePackages )
+ void setModulePackages( List modulePackages )
{
this.modulePackages = modulePackages;
}
@@ -229,7 +244,7 @@
*
* @param modulePackage module package to add to search list
*/
- protected void addModulePackage( String modulePackage )
+ void addModulePackage( String modulePackage )
{
modulePackages.add( modulePackage );
modulePackagesNames.append( modulePackage ).append( "\n" );
@@ -242,7 +257,7 @@
/**
* Gets the view attribute of the AbstractResolver object
*/
- protected View getView( String target )
+ View getView( String target )
throws Exception
{
return getView( target, null, null );
@@ -251,7 +266,7 @@
/**
* Gets the view attribute of the AbstractResolver object
*/
- protected View getView( String target, String targetPrefix )
+ View getView( String target, String targetPrefix )
throws Exception
{
return getView( target, targetPrefix, null );
@@ -260,14 +275,16 @@
/**
* Gets the view attribute of the AbstractResolver object
*/
- protected View getView( String target, String targetPrefix, String defaultView )
+ View getView( String target, String targetPrefix, String defaultView )
throws Exception
{
List possibleViews = getPossibleViews( target, targetPrefix );
Renderer renderer = (Renderer) getServiceManager().lookup( Renderer.ROLE );
- if ( defaultView != null && defaultView.length() > 0 )
+ if ( defaultView != null
+ &&
+ defaultView.length() > 0 )
{
possibleViews.add( defaultView );
}
@@ -278,7 +295,9 @@
getLogger().info( "Looking for view: " + view );
- if ( getServiceManager() != null && renderer.viewExists( view ) )
+ if ( getServiceManager() != null
+ &&
+ renderer.viewExists( view ) )
{
getLogger().info( "Found view: " + view );
// We should use a view factory.
@@ -291,7 +310,7 @@
/**
*/
- protected List getPossibleViews( String target, String targetPrefix )
+ List getPossibleViews( String target, String targetPrefix )
throws Exception
{
ArrayList views = new ArrayList();
@@ -346,7 +365,7 @@
* @return The desired <code>Module</code>, or <code>null</code> if not
* found..
*/
- protected Module getModule( String target )
+ Module getModule( String target )
throws Exception
{
return getModule( target, null, null );
@@ -361,7 +380,7 @@
* @return The desired <code>Module</code>, or <code>null</code> if not
* found..
*/
- protected Module getModule( String target, String targetPrefix )
+ Module getModule( String target, String targetPrefix )
throws Exception
{
return getModule( target, targetPrefix, null );
@@ -378,7 +397,7 @@
* @return The desired <code>Module</code>, or <code>null</code> if not
* found..
*/
- protected Module getModule( String target, String targetPrefix, String defaultModule )
+ Module getModule( String target, String targetPrefix, String defaultModule )
throws Exception
{
Module module = null;
@@ -425,7 +444,7 @@
/**
*/
- protected List getPossibleModules( String target, String targetPrefix )
+ List getPossibleModules( String target, String targetPrefix )
throws Exception
{
ArrayList modules = new ArrayList();
@@ -456,13 +475,4 @@
return modules;
}
-
- /**
- * @see org.apache.plexus.summit.resolver.Resolver#getDefaultView()
- */
- public String getDefaultView()
- {
- return getDefaultBaseName() + getDefaultViewExtension();
- }
-
}
Index: ClassicResolver.java
===================================================================
RCS file: /cvsroot/plexus/plexus-components/summit/src/java/org/apache/plexus/summit/resolver/ClassicResolver.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ClassicResolver.java 1 May 2003 19:28:40 -0000 1.2
+++ ClassicResolver.java 3 May 2003 19:14:34 -0000 1.3
@@ -306,18 +306,14 @@
/**
* @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
*/
- public void configure( Configuration config ) throws ConfigurationException
+ public void configure( Configuration config )
+ throws ConfigurationException
{
super.configure( config );
- setDefaultLayoutModule(
- config.getChild( DEFAULT_LAYOUT_MODULE_KEY )
- .getValue( DEFAULT_LAYOUT_MODULE_KEY ) );
- setDefaultNavigationModule(
- config.getChild( DEFAULT_NAV_MODULE_KEY )
- .getValue( DEFAULT_NAV_MODULE_KEY ) );
- setDefaultScreenModule(
- config.getChild( DEFAULT_SCREEN_MODULE_KEY )
- .getValue( DEFAULT_SCREEN_MODULE_KEY ) );
+ // Set the default modules.
+ setDefaultLayoutModule( config.getChild( DEFAULT_LAYOUT_MODULE_KEY ).getValue( DEFAULT_LAYOUT_MODULE_KEY ) );
+ setDefaultNavigationModule( config.getChild( DEFAULT_NAV_MODULE_KEY ).getValue( DEFAULT_NAV_MODULE_KEY ) );
+ setDefaultScreenModule( config.getChild( DEFAULT_SCREEN_MODULE_KEY ).getValue( DEFAULT_SCREEN_MODULE_KEY ) );
}
}
Index: Resolver.java
===================================================================
RCS file: /cvsroot/plexus/plexus-components/summit/src/java/org/apache/plexus/summit/resolver/Resolver.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Resolver.java 1 May 2003 19:28:40 -0000 1.2
+++ Resolver.java 3 May 2003 19:14:34 -0000 1.3
@@ -91,4 +91,7 @@
* @return String the view
*/
String getErrorView();
+
+ String getDefaultBaseName();
+ String getDefaultViewExtension();
}
Index: SimpleResolver.java
===================================================================
RCS file: /cvsroot/plexus/plexus-components/summit/src/java/org/apache/plexus/summit/resolver/SimpleResolver.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SimpleResolver.java 1 May 2003 19:28:40 -0000 1.2
+++ SimpleResolver.java 3 May 2003 19:14:34 -0000 1.3
@@ -162,8 +162,6 @@
{
super.configure( config );
- setDefaultScreenModule(
- config.getChild( DEFAULT_SCREEN_MODULE_KEY )
- .getValue( DEFAULT_SCREEN_MODULE ) );
+ setDefaultScreenModule( config.getChild( DEFAULT_SCREEN_MODULE_KEY ).getValue( DEFAULT_SCREEN_MODULE ) );
}
}