jefft       2003/05/11 04:09:46

  Modified:    src/java/org/apache/cocoon/components/modules/input
                        XMLFileModule.java
  Log:
  Allow for the possibility of totally dynamic configuration. Previously, a @src
  had to be specified for the static configuration.
  
  Revision  Changes    Path
  1.6       +11 -4     
cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java
  
  Index: XMLFileModule.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XMLFileModule.java        3 May 2003 11:17:44 -0000       1.5
  +++ XMLFileModule.java        11 May 2003 11:09:46 -0000      1.6
  @@ -91,6 +91,8 @@
   public class XMLFileModule extends AbstractJXPathModule
       implements Composable, ThreadSafe {
   
  +    /** Static (cocoon.xconf) configuration location, for error reporting */
  +    String staticConfLocation;
       /** Cached documents */
       Map documents = null;
       /** Default value for reloadability of sources */
  @@ -217,6 +219,7 @@
        */
       public void configure(Configuration config) throws 
ConfigurationException {
   
  +        this.staticConfLocation = config.getLocation();
           super.configure(config);
           this.reloadAll = 
config.getChild("reloadable").getValueAsBoolean(this.reloadAll);
           if (config.getChild("cachable", false) != null) {
  @@ -238,9 +241,6 @@
               // if multiple file tags are used.
               this.documents.put(files[i], new DocumentHelper(reload, cache, 
this.src));
           }
  -
  -        if (this.src == null)
  -            throw new ConfigurationException("No source given!");
       }
   
   
  @@ -284,6 +284,13 @@
   
           if (this.documents == null) 
               this.documents = Collections.synchronizedMap(new HashMap());
  +
  +        if (src==null) {
  +            throw new ConfigurationException("No source specified"+
  +                    (modeConf!=null?", either dynamically in 
"+modeConf.getLocation()+", or ":"")+
  +                    " statically in "+staticConfLocation
  +                    );
  +        }
   
           if (!this.documents.containsKey(src)) {
               if (hasDynamicConf) {
  
  
  

Reply via email to