forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nicola...@apache.org
Subject svn commit: rev 10150 - in xml/forrest/branches/copyless/src: core/context/WEB-INF java/org/apache/forrest/conf
Date Wed, 21 Apr 2004 06:58:13 GMT
Author: nicolaken
Date: Tue Apr 20 23:58:12 2004
New Revision: 10150

Modified:
   xml/forrest/branches/copyless/src/core/context/WEB-INF/cocoon.xconf
   xml/forrest/branches/copyless/src/java/org/apache/forrest/conf/AntProperties.java
   xml/forrest/branches/copyless/src/java/org/apache/forrest/conf/ForrestConfModule.java
Log:
ForrestConfModule now works correctly.
Make cocoon.xconf use it for the default: and project: modules.
Temporarily fix the resolver catalog file a swe don't filter anymore with Ant.
Use the sitemap to get skinconf.xml

Modified: xml/forrest/branches/copyless/src/core/context/WEB-INF/cocoon.xconf
==============================================================================
--- xml/forrest/branches/copyless/src/core/context/WEB-INF/cocoon.xconf	(original)
+++ xml/forrest/branches/copyless/src/core/context/WEB-INF/cocoon.xconf	Tue Apr 20 23:58:12
2004
@@ -167,27 +167,29 @@
     <component-instance class="org.apache.cocoon.components.modules.input.DateMetaInputModule"
logger="core.modules.input" name="datemeta"/>
     <component-instance class="org.apache.cocoon.components.modules.input.JXPathMetaModule"
logger="core.modules.input" name="jxpath"/>
     <component-instance class="org.apache.cocoon.components.modules.input.SimpleMappingMetaModule"
logger="core.modules.input" name="simplemap"/>
+    
     <component-instance logger="core.modules.input" name="forrest"    class="org.apache.cocoon.components.modules.input.ChainMetaModule">
       <input-module name="request-param"/>
       <input-module name="request-attr"/>
       <input-module name="session-attr"/>
       <input-module name="defaults"/>
     </component-instance>
-    <component-instance name="defaults"       class="org.apache.cocoon.components.modules.input.DefaultsMetaModule">
+    
+    <component-instance name="defaults" class="org.apache.forrest.conf.ForrestConfModule">
       <values>
-        <skin>@skin@</skin>
-        <menu-scheme>@menu-scheme@</menu-scheme>
-        <bugtracking-url>@bugtracking-url@</bugtracking-url>
-        <i18n>@i18n@</i18n>
+        <skin>@project.skin@</skin>
+        <menu-scheme>@project.menu-scheme@</menu-scheme>
+        <bugtracking-url>@project.bugtracking-url@</bugtracking-url>
+        <i18n>@project.i18n@</i18n>
         <home>@forrest.home@/</home>
         <skins-dir>@forrest.home@/context/skins/</skins-dir>
         <stylesheets>@forrest.home@/context/resources/stylesheets</stylesheets>
       </values>
     </component-instance>
 
-    <component-instance name="project"       class="org.apache.cocoon.components.modules.input.DefaultsMetaModule">
+    <component-instance name="project" class="org.apache.forrest.conf.ForrestConfModule">
       <values>
-        <skin>@skin@</skin>
+        <skin>@project.skin@</skin>
         <skinconf>@project.home@/@project.skinconf@</skinconf>        
         <doc>@project.home@/@project.content-dir@/</doc>
         <content>@project.home@/@project.raw-content-dir@/</content>
@@ -207,7 +209,7 @@
       class="org.apache.cocoon.components.modules.input.SimpleMappingMetaModule"
       logger="core.modules.mapper" name="conf">
       <input-module name="skinconf">
-        <file src="skinconf.xml" reloadable="true" />
+        <file src="cocoon://skinconf.xml" reloadable="true" />
       </input-module>
       <prefix>/skinconfig/</prefix>
     </component-instance>
@@ -283,9 +285,11 @@
       |     <parameter name="verbosity" value="2"/>
       +-->
   <entity-resolver logger="core.resolver">
-    <parameter name="catalog" value="@forrest.home@/context/resources/schema/catalog.xcat"/>
-    <parameter name="local-catalog" value="@local-catalog@"/>
-    <parameter name="verbosity" value="@catalog-verbosity@"/>
+    <parameter name="catalog" value="resources/schema/catalog.xcat"/>
+    <!-- TODO disabled for now, as filtering no longer works -->
+    <!--<parameter name="local-catalog" value="@local-catalog@"/>-->
+    <!-- TODO fixed to 1 for now, as filtering no longer works -->
+    <parameter name="verbosity" value="1"/>
   </entity-resolver>
 
   <!--+

Modified: xml/forrest/branches/copyless/src/java/org/apache/forrest/conf/AntProperties.java
==============================================================================
--- xml/forrest/branches/copyless/src/java/org/apache/forrest/conf/AntProperties.java	(original)
+++ xml/forrest/branches/copyless/src/java/org/apache/forrest/conf/AntProperties.java	Tue
Apr 20 23:58:12 2004
@@ -113,29 +113,23 @@
 
         StringTokenizer st = new StringTokenizer(stringToFilter, "@", true);
 
-        String currentToken = st.nextToken();
         STATE state;
 
-        if (currentToken.equals("@")) {
+        if (stringToFilter.startsWith("@")) {
             state = new STATE(STATE.START_TOKEN);
         } else {
             state = new STATE(STATE.STRING_NOT_TO_FILTER);
         }
 
-        while (st.hasMoreTokens()) {
+        for (String currentToken; st.hasMoreTokens(); state.increment()) {
+
+            currentToken = st.nextToken();
 
             if (state.isStringToFilter()) {
-                resultStringBuffer.append(getProperty(currentToken,"@"+currentToken+"@"));
-                System.out.println("currentToken to Filter:" + currentToken);
+                resultStringBuffer.append(getProperty(currentToken, "@"
+                                + currentToken + "@"));
             } else if (state.isStringNOTToFilter()) {
                 resultStringBuffer.append(currentToken);
-            }
-
-            System.out.println("resultStringBuffer;" + resultStringBuffer);
-
-            {
-                currentToken = st.nextToken();
-                state.increment();
             }
         }
 

Modified: xml/forrest/branches/copyless/src/java/org/apache/forrest/conf/ForrestConfModule.java
==============================================================================
--- xml/forrest/branches/copyless/src/java/org/apache/forrest/conf/ForrestConfModule.java
(original)
+++ xml/forrest/branches/copyless/src/java/org/apache/forrest/conf/ForrestConfModule.java
Tue Apr 20 23:58:12 2004
@@ -70,9 +70,7 @@
     private AntProperties  filteringProperties;
 
     public void service(ServiceManager manager) throws ServiceException {
-        System.out.println("getting resolver...");
         m_resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
-        System.out.println("gotten resolver:" + m_resolver);
     }
 
     public void initialize() throws Exception {
@@ -84,31 +82,42 @@
         //
         //      as it will get FORREST_HOME even when the app
         //      is run as a .war
-        forrestHome = getAndResolveSystemProperty("forrest.home");
+        forrestHome = getSystemProperty("forrest.home");
 
         // get location of project.home
-        projectHome = getAndResolveSystemProperty("project.home");
+        projectHome = getSystemProperty("project.home");
+        
 
         // get default-forrest.properties and load the values
         String defaultRorrestPropertiesStringURI = forrestHome
                         + SystemUtils.FILE_SEPARATOR
                         + "default-forrest.properties";
-        System.out.println("defaultRorrestPropertiesStringURI:"
+
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Searching for default forrest.properties in:"
                         + defaultRorrestPropertiesStringURI);
+        }
 
         Source source = null;
         InputStream in = null;
         try {
-            System.out.println("using resolver:" + m_resolver);
             source = m_resolver.resolveURI(defaultRorrestPropertiesStringURI);
 
-            System.out.println("Resolved URI:" + source);
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug(
+                                "Searching for default forrest.properties in [RESOLVED]:"
+                                                + source.getURI());
+            }
 
             in = source.getInputStream();
             filteringProperties = new AntProperties();
             filteringProperties.load(in);
 
-            System.out.println("Loaded defaults:" + filteringProperties);
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug(
+                                "Loaded default forrest.properties:"
+                                                + filteringProperties);
+            }
 
         } finally {
             if (source != null) {
@@ -124,14 +133,22 @@
         // get forrest.properties and load the values
         String forrestPropertiesStringURI = projectHome
                         + SystemUtils.FILE_SEPARATOR + "forrest.properties";
-        System.out.println("forrestPropertiesStringURI:"
-                        + forrestPropertiesStringURI);
+
+        if (getLogger().isDebugEnabled()) {
+            getLogger()
+                            .debug(
+                                            "Searching for project forrest.properties in:"
+                                                            + defaultRorrestPropertiesStringURI);
+        }
 
         try {
-            System.out.println("using resolver:" + m_resolver);
             source = m_resolver.resolveURI(forrestPropertiesStringURI);
 
-            System.out.println("Resolved URI:" + source);
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug(
+                                "Searching for project forrest.properties in [RESOLVED]:"
+                                                + source.getURI());
+            }
 
             in = source.getInputStream();
             filteringProperties = new AntProperties(filteringProperties);
@@ -147,13 +164,20 @@
             }
         }
 
-        System.out.println("Loaded project stuff:" + filteringProperties);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug(
+                            "Loaded project forrest.properties:"
+                                            + filteringProperties);
+        }
 
         //add forrest.home and project.home to properties
         filteringProperties.setProperty("forrest.home", forrestHome);
         filteringProperties.setProperty("project.home", projectHome);
 
-        System.out.println("Loaded all:" + filteringProperties);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug(
+                            "Global forrest.properties:" + filteringProperties);
+        }
 
     }
 
@@ -176,32 +200,26 @@
         String attributeValue = this.getAttributeValues(name, modeConf,
                         objectModel)[0].toString();
 
-        System.out.println(" - Requested:" + name);
-        System.out.println(" - Original:" + original);
-        System.out.println(" - Given:" + attributeValue);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug(" - Requested:" + name);
+            getLogger().debug(" - Unfiltered:" + original);
+            getLogger().debug(" - Given:" + attributeValue);
+        }
         return attributeValue;
     }
 
-    private final String getAndResolveSystemProperty(String propertyName)
+    private final String getSystemProperty(String propertyName)
                     throws MalformedURLException, IOException {
-        String raw = System.getProperty(propertyName, ".");
-
-        if (getLogger().isDebugEnabled()) {
-            getLogger().debug("raw " + propertyName + "=" + raw);
-
-        }
 
-        System.out.println("raw " + propertyName + "=" + raw);
-        System.out.println("resolver: " + m_resolver);
-
-        String value = m_resolver.resolveURI(raw).getURI();
+        String propertyValue = System.getProperty(propertyName, ".");
 
         if (getLogger().isDebugEnabled()) {
-            getLogger().debug("resolved " + propertyName + "=" + value);
-
+            getLogger().debug(
+                            "system property " + propertyName + "="
+                                            + propertyValue);
         }
 
-        return raw;
+        return propertyValue;
     }
 
 }

Mime
View raw message