Show
Ignore:
Timestamp:
08/30/10 00:30:11 (21 months ago)
Author:
mtld
Message:

added config-include support for modules

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-0.15.x/pustefix-core/src/main/java/de/schlund/pfixxml/config/includes/IncludesResolver.java

    r5108 r5326  
    3838import com.marsching.flexiparse.util.DOMBasedNamespaceContext; 
    3939 
    40 import de.schlund.pfixxml.resources.FileResource; 
     40import de.schlund.pfixxml.resources.Resource; 
    4141import de.schlund.pfixxml.resources.ResourceUtil; 
    4242import de.schlund.pfixxml.util.Generics; 
     
    117117            } 
    118118 
     119            String module = elem.getAttribute("module"); 
     120            if(module.equals("")) module = null; 
     121             
    119122            String filepath = elem.getAttribute("file"); 
    120123            if (filepath == null) { 
    121124                throw new SAXException("The attribute \"file\" must be set for the include tag!"); 
    122125            } 
     126            if(module != null) { 
     127                if(filepath.startsWith("/")) filepath = filepath.substring(1); 
     128                filepath = "module://" + module + "/" + filepath; 
     129            } 
     130             
    123131 
    124132            // Look if the same include has been performed ealier in the recursion 
     
    133141            } 
    134142             
    135             FileResource includeFile = ResourceUtil.getFileResourceFromDocroot(filepath); 
     143            Resource includeFile = ResourceUtil.getResource(filepath); 
    136144            Document includeDocument; 
    137145            try { 
     146                System.out.println(">>>>>>>>>>>> PARSE: "+includeFile.toString()); 
    138147                includeDocument = Xml.parseMutable(includeFile); 
    139148            } catch (IOException e) { 
     
    164173                Node node = includeNodes.item(i); 
    165174                Node newNode = doc.importNode(node, true); 
     175                if(module != null) { 
     176                        newNode.setUserData("module", module, null); 
     177                } 
    166178                elem.getParentNode().insertBefore(newNode, elem); 
    167179            }