Apperently passing the environment isn't sufficient. This time i'm setting up base using getContext().
I'm only submitting patches for cocoon20 this time. The only file that is different from the last set is AbstractComplementaryConfigurableAction.java. I'll rework the head patches if anyone is interested. It's really quite trivial though. I wanted to provide this functionality deeper (in URLFactoryImpl or SourceHandlerImpl) but I don't want to break any functionality elsewhere in cocoon. It's funny: file is dealt with as an exception to trap unix/dos inconsistencies but it's done in the code rather than with a FileURLFactory. Tim On Thu, Nov 29, 2001 at 10:08:02PM -0500, Tim Myers wrote: > Here is a patchset for the acting directory of the cocoon_20_branch and HEAD. > These make the "file:" url behave as expected for bringing in configuration files >that live in a subsitemap. > > It makes the configuration files much more useful. > > Tim Content-Description: patches for HEAD > ? acting.diff > Index: AbstractComplementaryConfigurableAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/AbstractComplementaryConfigurableAction.java,v > retrieving revision 1.12 > diff -u -r1.12 AbstractComplementaryConfigurableAction.java > --- AbstractComplementaryConfigurableAction.java 2001/10/11 07:28:15 1.12 > +++ AbstractComplementaryConfigurableAction.java 2001/11/30 02:43:24 > @@ -14,6 +14,8 @@ > import org.apache.cocoon.Constants; > import org.apache.cocoon.components.source.SourceHandler; > import org.apache.cocoon.environment.Source; > +import org.apache.cocoon.environment.SourceResolver; > +import org.apache.cocoon.environment.Environment; > > import java.util.HashMap; > import java.util.Map; > @@ -43,7 +45,7 @@ > boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT; > if (this.settings.containsKey("reloadable")) > reloadable = Boolean.getBoolean((String) this.settings.get("reloadable")); > - return this.getConfiguration(descriptor, reloadable); > + return this.getConfiguration(descriptor, null, reloadable); > } > > /** > @@ -52,7 +54,7 @@ > * this approach, we can limit the number of config files. > * Also note that the configuration file does not have to be a file. > */ > - protected Configuration getConfiguration(String descriptor, boolean reloadable) >throws ConfigurationException { > + protected Configuration getConfiguration(String descriptor, SourceResolver >resolver, boolean reloadable) throws ConfigurationException { > ConfigurationHelper conf = null; > > if (descriptor == null) { > @@ -68,7 +70,7 @@ > > try { > sourceHandler = (SourceHandler) >this.manager.lookup(SourceHandler.ROLE); > - resource = sourceHandler.getSource(null, descriptor); > + resource = sourceHandler.getSource((Environment)resolver, >descriptor); > > if (conf == null || conf.lastModified < >resource.getLastModified()) { > getLogger().debug("(Re)Loading " + descriptor); > Index: DatabaseAddAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAddAction.java,v > retrieving revision 1.14 > diff -u -r1.14 DatabaseAddAction.java > --- DatabaseAddAction.java 2001/10/25 18:00:11 1.14 > +++ DatabaseAddAction.java 2001/11/30 02:43:24 > @@ -56,7 +56,7 @@ > // read local parameter settings > try { > Configuration conf = > - this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), > + this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), resolver, > >param.getParameterAsBoolean("reloadable",reloadable)); > > datasource = this.getDataSource(conf); > Index: DatabaseAuthenticatorAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAuthenticatorAction.java,v > retrieving revision 1.16 > diff -u -r1.16 DatabaseAuthenticatorAction.java > --- DatabaseAuthenticatorAction.java 2001/10/25 19:32:58 1.16 > +++ DatabaseAuthenticatorAction.java 2001/11/30 02:43:24 > @@ -79,6 +79,7 @@ > try { > Configuration conf = this.getConfiguration ( > parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), > + resolver, > parameters.getParameterAsBoolean("reloadable",reloadable)); > boolean cs = true; > String create_session = parameters.getParameter ("create-session", > Index: DatabaseDeleteAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseDeleteAction.java,v > retrieving revision 1.11 > diff -u -r1.11 DatabaseDeleteAction.java > --- DatabaseDeleteAction.java 2001/10/11 07:28:15 1.11 > +++ DatabaseDeleteAction.java 2001/11/30 02:43:24 > @@ -54,7 +54,7 @@ > // read local parameter settings > try { > Configuration conf = > - this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), > + this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), resolver, > >param.getParameterAsBoolean("reloadable",reloadable)); > > String query = this.getDeleteQuery(conf); > Index: DatabaseSelectAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseSelectAction.java,v > retrieving revision 1.5 > diff -u -r1.5 DatabaseSelectAction.java > --- DatabaseSelectAction.java 2001/10/11 07:28:15 1.5 > +++ DatabaseSelectAction.java 2001/11/30 02:43:24 > @@ -56,6 +56,7 @@ > try { > Configuration conf = > this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), > + resolver, > >param.getParameterAsBoolean("reloadable",reloadable)); > > Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT); > Index: DatabaseUpdateAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseUpdateAction.java,v > retrieving revision 1.12 > diff -u -r1.12 DatabaseUpdateAction.java > --- DatabaseUpdateAction.java 2001/10/11 07:28:15 1.12 > +++ DatabaseUpdateAction.java 2001/11/30 02:43:24 > @@ -51,7 +51,7 @@ > // read local parameter settings > try { > Configuration conf = > - this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), > + this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), resolver, > >param.getParameterAsBoolean("reloadable",reloadable)); > > String query = this.getUpdateQuery(conf); > Index: FormValidatorAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/FormValidatorAction.java,v > retrieving revision 1.12 > diff -u -r1.12 FormValidatorAction.java > --- FormValidatorAction.java 2001/10/11 07:28:15 1.12 > +++ FormValidatorAction.java 2001/11/30 02:43:24 > @@ -81,7 +81,7 @@ > // read local settings > try { > Configuration conf = this.getConfiguration ( > - parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), > + parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), resolver, > parameters.getParameterAsBoolean("reloadable", reloadable)); > String valstr = parameters.getParameter ("validate", (String) >settings.get("validate","")); > String valsetstr = parameters.getParameter ("validate-set", (String) >settings.get("validate-set","")); > Index: SessionValidatorAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/SessionValidatorAction.java,v > retrieving revision 1.12 > diff -u -r1.12 SessionValidatorAction.java > --- SessionValidatorAction.java 2001/10/11 07:28:16 1.12 > +++ SessionValidatorAction.java 2001/11/30 02:43:25 > @@ -83,7 +83,7 @@ > > try { > Configuration conf = this.getConfiguration ( > - parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), > + parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), resolver, > parameters.getParameterAsBoolean("reloadable",reloadable)); > > String valsetstr = parameters.getParameter ( "validate-set", (String) >settings.get("validate-set") ); Content-Description: for cocoon_20_branch > ? acting.diff > Index: AbstractComplementaryConfigurableAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/AbstractComplementaryConfigurableAction.java,v > retrieving revision 1.3.2.9 > diff -u -r1.3.2.9 AbstractComplementaryConfigurableAction.java > --- AbstractComplementaryConfigurableAction.java 2001/10/11 08:52:03 1.3.2.9 > +++ AbstractComplementaryConfigurableAction.java 2001/11/30 02:12:39 > @@ -14,6 +14,8 @@ > import org.apache.cocoon.Constants; > import org.apache.cocoon.components.source.SourceHandler; > import org.apache.cocoon.environment.Source; > +import org.apache.cocoon.environment.SourceResolver; > +import org.apache.cocoon.environment.Environment; > > import java.util.HashMap; > import java.util.Map; > @@ -43,7 +45,7 @@ > boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT; > if (this.settings.containsKey("reloadable")) > reloadable = Boolean.getBoolean((String) this.settings.get("reloadable")); > - return this.getConfiguration(descriptor, reloadable); > + return this.getConfiguration(descriptor, null, reloadable); > } > > /** > @@ -52,7 +54,7 @@ > * this approach, we can limit the number of config files. > * Also note that the configuration file does not have to be a file. > */ > - protected Configuration getConfiguration(String descriptor, boolean reloadable) >throws ConfigurationException { > + protected Configuration getConfiguration(String descriptor, SourceResolver >resolver, boolean reloadable) throws ConfigurationException { > ConfigurationHelper conf = null; > > if (descriptor == null) { > @@ -68,7 +70,7 @@ > > try { > sourceHandler = (SourceHandler) >this.manager.lookup(SourceHandler.ROLE); > - resource = sourceHandler.getSource(null, descriptor); > + resource = sourceHandler.getSource((Environment)resolver, >descriptor); > > if (conf == null || conf.lastModified < >resource.getLastModified()) { > getLogger().debug("(Re)Loading " + descriptor); > Index: DatabaseAddAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAddAction.java,v > retrieving revision 1.6.2.9 > diff -u -r1.6.2.9 DatabaseAddAction.java > --- DatabaseAddAction.java 2001/10/25 18:00:34 1.6.2.9 > +++ DatabaseAddAction.java 2001/11/30 02:12:39 > @@ -56,7 +56,7 @@ > // read local parameter settings > try { > Configuration conf = > - this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), > + this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), resolver, > >param.getParameterAsBoolean("reloadable",reloadable)); > > datasource = this.getDataSource(conf); > Index: DatabaseAuthenticatorAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAuthenticatorAction.java,v > retrieving revision 1.3.2.12 > diff -u -r1.3.2.12 DatabaseAuthenticatorAction.java > --- DatabaseAuthenticatorAction.java 2001/10/25 19:31:24 1.3.2.12 > +++ DatabaseAuthenticatorAction.java 2001/11/30 02:12:39 > @@ -78,7 +78,7 @@ > // read local settings > try { > Configuration conf = this.getConfiguration ( > - parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), > + parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), resolver, > parameters.getParameterAsBoolean("reloadable",reloadable)); > boolean cs = true; > String create_session = parameters.getParameter ("create-session", > Index: DatabaseDeleteAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseDeleteAction.java,v > retrieving revision 1.3.2.9 > diff -u -r1.3.2.9 DatabaseDeleteAction.java > --- DatabaseDeleteAction.java 2001/10/11 08:52:03 1.3.2.9 > +++ DatabaseDeleteAction.java 2001/11/30 02:12:39 > @@ -54,7 +54,7 @@ > // read local parameter settings > try { > Configuration conf = > - this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), > + this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), resolver, > >param.getParameterAsBoolean("reloadable",reloadable)); > > String query = this.getDeleteQuery(conf); > Index: DatabaseUpdateAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseUpdateAction.java,v > retrieving revision 1.3.2.10 > diff -u -r1.3.2.10 DatabaseUpdateAction.java > --- DatabaseUpdateAction.java 2001/10/11 08:52:03 1.3.2.10 > +++ DatabaseUpdateAction.java 2001/11/30 02:12:39 > @@ -51,7 +51,7 @@ > // read local parameter settings > try { > Configuration conf = > - this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), > + this.getConfiguration(param.getParameter("descriptor", (String) >this.settings.get("descriptor")), resolver, > >param.getParameterAsBoolean("reloadable",reloadable)); > > String query = this.getUpdateQuery(conf); > Index: FormValidatorAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/FormValidatorAction.java,v > retrieving revision 1.4.2.8 > diff -u -r1.4.2.8 FormValidatorAction.java > --- FormValidatorAction.java 2001/10/11 08:52:03 1.4.2.8 > +++ FormValidatorAction.java 2001/11/30 02:12:39 > @@ -81,7 +81,7 @@ > // read local settings > try { > Configuration conf = this.getConfiguration ( > - parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), > + parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), resolver, > parameters.getParameterAsBoolean("reloadable", reloadable)); > String valstr = parameters.getParameter ("validate", (String) >settings.get("validate","")); > String valsetstr = parameters.getParameter ("validate-set", (String) >settings.get("validate-set","")); > Index: SessionValidatorAction.java > =================================================================== > RCS file: >/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/SessionValidatorAction.java,v > retrieving revision 1.3.2.9 > diff -u -r1.3.2.9 SessionValidatorAction.java > --- SessionValidatorAction.java 2001/10/11 08:52:03 1.3.2.9 > +++ SessionValidatorAction.java 2001/11/30 02:12:39 > @@ -83,7 +83,7 @@ > > try { > Configuration conf = this.getConfiguration ( > - parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), > + parameters.getParameter ("descriptor", (String) >this.settings.get("descriptor")), resolver, > parameters.getParameterAsBoolean("reloadable",reloadable)); > > String valsetstr = parameters.getParameter ( "validate-set", (String) >settings.get("validate-set") ); > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED]
? acting.diff Index: AbstractComplementaryConfigurableAction.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/AbstractComplementaryConfigurableAction.java,v retrieving revision 1.3.2.9 diff -u -r1.3.2.9 AbstractComplementaryConfigurableAction.java --- AbstractComplementaryConfigurableAction.java 2001/10/11 08:52:03 1.3.2.9 +++ AbstractComplementaryConfigurableAction.java 2001/12/01 03:57:23 @@ -14,6 +14,8 @@ import org.apache.cocoon.Constants; import org.apache.cocoon.components.source.SourceHandler; import org.apache.cocoon.environment.Source; +import org.apache.cocoon.environment.SourceResolver; +import org.apache.cocoon.environment.Environment; import java.util.HashMap; import java.util.Map; @@ -43,7 +45,7 @@ boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT; if (this.settings.containsKey("reloadable")) reloadable = Boolean.getBoolean((String) this.settings.get("reloadable")); - return this.getConfiguration(descriptor, reloadable); + return this.getConfiguration(descriptor, null,reloadable); } /** @@ -52,7 +54,7 @@ * this approach, we can limit the number of config files. * Also note that the configuration file does not have to be a file. */ - protected Configuration getConfiguration(String descriptor, boolean reloadable) throws ConfigurationException { + protected Configuration getConfiguration(String descriptor, SourceResolver +resolver, boolean reloadable) throws ConfigurationException { ConfigurationHelper conf = null; if (descriptor == null) { @@ -68,7 +70,10 @@ try { sourceHandler = (SourceHandler) this.manager.lookup(SourceHandler.ROLE); - resource = sourceHandler.getSource(null, descriptor); + if (descriptor.startsWith("file:")) { + resource = +sourceHandler.getSource((Environment)resolver,((Environment)resolver).getContext(), +descriptor.substring(5)); + } else + resource = +sourceHandler.getSource((Environment)resolver, descriptor.substring(5)); if (conf == null || conf.lastModified < resource.getLastModified()) { getLogger().debug("(Re)Loading " + descriptor); Index: DatabaseAddAction.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAddAction.java,v retrieving revision 1.6.2.9 diff -u -r1.6.2.9 DatabaseAddAction.java --- DatabaseAddAction.java 2001/10/25 18:00:34 1.6.2.9 +++ DatabaseAddAction.java 2001/12/01 03:57:23 @@ -56,7 +56,7 @@ // read local parameter settings try { Configuration conf = - this.getConfiguration(param.getParameter("descriptor", (String) this.settings.get("descriptor")), + this.getConfiguration(param.getParameter("descriptor", (String) +this.settings.get("descriptor")), resolver, param.getParameterAsBoolean("reloadable",reloadable)); datasource = this.getDataSource(conf); Index: DatabaseAuthenticatorAction.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAuthenticatorAction.java,v retrieving revision 1.3.2.12 diff -u -r1.3.2.12 DatabaseAuthenticatorAction.java --- DatabaseAuthenticatorAction.java 2001/10/25 19:31:24 1.3.2.12 +++ DatabaseAuthenticatorAction.java 2001/12/01 03:57:23 @@ -78,7 +78,7 @@ // read local settings try { Configuration conf = this.getConfiguration ( - parameters.getParameter ("descriptor", (String) this.settings.get("descriptor")), + parameters.getParameter ("descriptor", (String) +this.settings.get("descriptor")), resolver, parameters.getParameterAsBoolean("reloadable",reloadable)); boolean cs = true; String create_session = parameters.getParameter ("create-session", Index: DatabaseDeleteAction.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseDeleteAction.java,v retrieving revision 1.3.2.9 diff -u -r1.3.2.9 DatabaseDeleteAction.java --- DatabaseDeleteAction.java 2001/10/11 08:52:03 1.3.2.9 +++ DatabaseDeleteAction.java 2001/12/01 03:57:23 @@ -54,7 +54,7 @@ // read local parameter settings try { Configuration conf = - this.getConfiguration(param.getParameter("descriptor", (String) this.settings.get("descriptor")), + this.getConfiguration(param.getParameter("descriptor", (String) +this.settings.get("descriptor")), resolver, param.getParameterAsBoolean("reloadable",reloadable)); String query = this.getDeleteQuery(conf); Index: DatabaseUpdateAction.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseUpdateAction.java,v retrieving revision 1.3.2.10 diff -u -r1.3.2.10 DatabaseUpdateAction.java --- DatabaseUpdateAction.java 2001/10/11 08:52:03 1.3.2.10 +++ DatabaseUpdateAction.java 2001/12/01 03:57:23 @@ -51,7 +51,7 @@ // read local parameter settings try { Configuration conf = - this.getConfiguration(param.getParameter("descriptor", (String) this.settings.get("descriptor")), + this.getConfiguration(param.getParameter("descriptor", (String) +this.settings.get("descriptor")), resolver, param.getParameterAsBoolean("reloadable",reloadable)); String query = this.getUpdateQuery(conf); Index: FormValidatorAction.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/FormValidatorAction.java,v retrieving revision 1.4.2.8 diff -u -r1.4.2.8 FormValidatorAction.java --- FormValidatorAction.java 2001/10/11 08:52:03 1.4.2.8 +++ FormValidatorAction.java 2001/12/01 03:57:23 @@ -81,7 +81,7 @@ // read local settings try { Configuration conf = this.getConfiguration ( - parameters.getParameter ("descriptor", (String) this.settings.get("descriptor")), + parameters.getParameter ("descriptor", (String) +this.settings.get("descriptor")), resolver, parameters.getParameterAsBoolean("reloadable", reloadable)); String valstr = parameters.getParameter ("validate", (String) settings.get("validate","")); String valsetstr = parameters.getParameter ("validate-set", (String) settings.get("validate-set","")); Index: SessionValidatorAction.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/acting/SessionValidatorAction.java,v retrieving revision 1.3.2.9 diff -u -r1.3.2.9 SessionValidatorAction.java --- SessionValidatorAction.java 2001/10/11 08:52:03 1.3.2.9 +++ SessionValidatorAction.java 2001/12/01 03:57:23 @@ -83,7 +83,7 @@ try { Configuration conf = this.getConfiguration ( - parameters.getParameter ("descriptor", (String) this.settings.get("descriptor")), + parameters.getParameter ("descriptor", (String) +this.settings.get("descriptor")), resolver, parameters.getParameterAsBoolean("reloadable",reloadable)); String valsetstr = parameters.getParameter ( "validate-set", (String) settings.get("validate-set") );
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]