You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shale.apache.org by cr...@apache.org on 2006/09/04 01:37:17 UTC
svn commit: r439874 - in /shale/sandbox:
shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogManager.java
shale-test-dialog2-legacy/src/main/webapp/WEB-INF/web.xml
Author: craigmcc
Date: Sun Sep 3 16:37:16 2006
New Revision: 439874
URL: http://svn.apache.org/viewvc?view=rev&rev=439874
Log:
Update legacy configuration resource parsing to automatically parse the
default resource (/WEB-INF/dialog-config.xml), if it exists, even if it
was not explicitly called out in a context init parameter.
SHALE-271
Modified:
shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogManager.java
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/web.xml
Modified: shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogManager.java
URL: http://svn.apache.org/viewvc/shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogManager.java?view=diff&rev=439874&r1=439873&r2=439874
==============================================================================
--- shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogManager.java (original)
+++ shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogManager.java Sun Sep 3 16:37:16 2006
@@ -17,6 +17,7 @@
package org.apache.shale.dialog2.legacy;
import java.io.Serializable;
+import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.faces.FacesException;
@@ -41,6 +42,14 @@
/**
+ * <p>The default configuration resource we will process (if present),
+ * even if it is not explicitly configured.</p>
+ */
+ private static final String DEFAULT_CONFIGURATION_RESOURCE =
+ "/WEB-INF/dialog-config.xml";
+
+
+ /**
* <p><code>Map</code> of {@link Dialog} configurations, keyed
* by dialog name. This value is lazily instantiated, and is also
* transient and may need to be regenerated.</p>
@@ -123,7 +132,8 @@
return this.dialogs;
}
- // Parse our configuration resources and cache the results
+ // Parse our specified configuration resources and cache the results
+ boolean didDefault = false;
ConfigurationParser parser = new ConfigurationParser();
parser.setDialogs(new HashMap());
String resources =
@@ -148,11 +158,31 @@
}
parser.setResource(context.getExternalContext().getResource(path));
parser.parse();
+ if (DEFAULT_CONFIGURATION_RESOURCE.equals(path)) {
+ didDefault = true;
+ }
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new FacesException(e);
+ }
+
+ // Parse the default configuration resource if it exists and has not
+ // already been parsed
+ if (!didDefault) {
+ try {
+ URL resource =
+ context.getExternalContext().getResource(DEFAULT_CONFIGURATION_RESOURCE);
+ if (resource != null) {
+ parser.setResource(resource);
+ parser.parse();
+ }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new FacesException(e);
+ }
}
// Cache the results both locally and in application scope
Modified: shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/web.xml?view=diff&rev=439874&r1=439873&r2=439874
==============================================================================
--- shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/web.xml (original)
+++ shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/web.xml Sun Sep 3 16:37:16 2006
@@ -40,10 +40,12 @@
</context-param>
<!-- Dialog2 Legacy Configuration Resources (comma separated list) -->
+<!-- Not explicitly required, because this is the default resource name
<context-param>
<param-name>org.apache.shale.dialog2.legacy.CONFIGURATION</param-name>
<param-value>/WEB-INF/dialog-config.xml</param-value>
</context-param>
+-->
<!-- JavaServer Faces Servlet Configuration -->
<servlet>