myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckor...@apache.org
Subject svn commit: r906243 - in /myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo: ./ support/ support/impl/ support/util/
Date Wed, 03 Feb 2010 21:07:20 GMT
Author: ckormos
Date: Wed Feb  3 21:07:19 2010
New Revision: 906243

URL: http://svn.apache.org/viewvc?rev=906243&view=rev
Log:
[trinidad components showcase] :
     -  removed usage of commons logging, replaced with logging with java.util.
     - added arg to sitemap generator to be able to specify base URL on execution.

Modified:
    myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/ComponentDemoRegistry.java
    myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/NavigationHandlerPhaseListener.java
    myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/PrettyUrlFilter.java
    myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/impl/ComponentVariantDemoDescriptionProvider.java
    myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/util/SitemapGenerator.java

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/ComponentDemoRegistry.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/ComponentDemoRegistry.java?rev=906243&r1=906242&r2=906243&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/ComponentDemoRegistry.java
(original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/ComponentDemoRegistry.java
Wed Feb  3 21:07:19 2010
@@ -18,8 +18,6 @@
  */
 package org.apache.myfaces.trinidaddemo;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.trinidaddemo.support.ComponentDemoCategoryId;
 import org.apache.myfaces.trinidaddemo.support.ComponentDemoId;
 import org.apache.myfaces.trinidaddemo.support.IComponentDemo;
@@ -31,13 +29,15 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Collection;
+import java.util.logging.Logger;
+import java.util.logging.Level;
 
 /**
  * This class represents the central point where component demos can be registered and obtained
from.
  */
 public class ComponentDemoRegistry {
 
-    private static final Log log = LogFactory.getLog(ComponentDemoRegistry.class);
+    private static final Logger _LOG = Logger.getLogger(ComponentDemoRegistry.class.getName());
 
     private static ComponentDemoRegistry instance = new ComponentDemoRegistry();
 
@@ -77,7 +77,7 @@
             throw new IllegalArgumentException("Trying to register a null component demo!");
         }
 
-        log.info("Register component demo '" + componentDemo.getDisplayName() + "' in category
'" + categoryName + "'");
+        _LOG.log(Level.INFO, "Register component demo '" + componentDemo.getDisplayName()
+ "' in category '" + categoryName + "'");
 
         IComponentDemoCategory category = categoriesRegistry.get(categoryId);
         if (category == null) {

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/NavigationHandlerPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/NavigationHandlerPhaseListener.java?rev=906243&r1=906242&r2=906243&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/NavigationHandlerPhaseListener.java
(original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/NavigationHandlerPhaseListener.java
Wed Feb  3 21:07:19 2010
@@ -24,21 +24,22 @@
 import javax.faces.event.PhaseId;
 import javax.faces.event.PhaseListener;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.trinidaddemo.support.ComponentDemoId;
 import org.apache.myfaces.trinidaddemo.support.IComponentDemo;
 import org.apache.myfaces.trinidaddemo.support.IComponentVariantDemo;
 import org.apache.myfaces.trinidaddemo.support.jsf.JsfHelper;
 
-/**
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+ /**
  * Phase listener that handles navigation based on URL parameters that identify a certain
component demo and its variant.
  */
 public class NavigationHandlerPhaseListener implements PhaseListener {
 
 	private static final long serialVersionUID = -6002602992566868748L;
 
-	private static final Log log = LogFactory.getLog(NavigationHandlerPhaseListener.class);
+	private static final Logger _LOG = Logger.getLogger(NavigationHandlerPhaseListener.class.getName());
 
     public static final String COMPONENT_DEMO_ID_PARAM_NAME = "id";
     public static final String COMPONENT_DEMO_VARIANT_ID_PARAM_NAME = "variantId";
@@ -50,7 +51,7 @@
         if (fc.getViewRoot().getViewId().startsWith("/feature") ||
             fc.getViewRoot().getViewId().equals("/pages/demoStart.xhtml") ||
             fc.getViewRoot().getViewId().equals("/pages/demoSearch.xhtml")) {
-                log.info("Ignore request to demoStart or demoSearch pages.");
+                _LOG.log(Level.INFO, "Ignore request to demoStart or demoSearch pages.");
                 return;
         }
 
@@ -68,7 +69,7 @@
             fc.addMessage(null, msg);
             fc.getViewRoot().setViewId("/pages/demoStart.xhtml");
 
-            log.error("Either component demo id or variant name is missing.");
+            _LOG.log(Level.SEVERE, "Either component demo id or variant name is missing.");
             return;
         }
 
@@ -88,11 +89,11 @@
                 fc.addMessage(null, msg);
                 fc.getViewRoot().setViewId("/pages/demoStart.xhtml");
 
-                log.error("Component with id: '" + componentDemoId + "' doesn't have a variant
with name: '"+variantId+"'!");
+                _LOG.log(Level.SEVERE, "Component with id: '" + componentDemoId + "' doesn't
have a variant with name: '"+variantId+"'!");
                 return;
             }
 
-            log.info("Navigation successfull to component demo id: '"+componentDemoId+"',
variant name: '"+variantId+"'");
+            _LOG.log(Level.INFO, "Navigation successfull to component demo id: '"+componentDemoId+"',
variant name: '"+variantId+"'");
             navigationHandler.setCurrentComponentVariantDemo(resultingDemo);
         }
         catch (IllegalArgumentException e) {
@@ -102,7 +103,7 @@
             fc.addMessage(null, msg);
             fc.getViewRoot().setViewId("/pages/demoStart.xhtml");
 
-            log.error("Component id: '" + componentDemoId + "' not found!");
+            _LOG.log(Level.SEVERE, "Component id: '" + componentDemoId + "' not found!");
         }             
     }
 

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/PrettyUrlFilter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/PrettyUrlFilter.java?rev=906243&r1=906242&r2=906243&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/PrettyUrlFilter.java
(original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/PrettyUrlFilter.java
Wed Feb  3 21:07:19 2010
@@ -20,8 +20,6 @@
 
 import org.apache.myfaces.trinidaddemo.NavigationHandlerBean;
 import org.apache.myfaces.trinidaddemo.ComponentDemoRegistry;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.Filter;
@@ -37,13 +35,15 @@
 import javax.faces.context.FacesContextFactory;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
+import java.util.logging.Logger;
+import java.util.logging.Level;
 
 /**
  *
  */
 public class PrettyUrlFilter implements Filter {
 
-    private static final Log log = LogFactory.getLog(PrettyUrlFilter.class);
+    private static final Logger _LOG = Logger.getLogger(PrettyUrlFilter.class.getName());
 
     public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
         String requestURI = getRequestURI(request);
@@ -54,7 +54,7 @@
 
         navigationHandler.setCurrentComponentVariantDemo(resultingDemo);
 
-        log.info("Forwarding request [" + requestURI + "] to view [" + "/pages/componentDemo.xhtml?id="+resultingDemo.getId()+"&variantId="+resultingDemo.getVariantId()+"]");
+        _LOG.log(Level.INFO, "Forwarding request [" + requestURI + "] to view [" + "/pages/componentDemo.xhtml?id="+resultingDemo.getId()+"&variantId="+resultingDemo.getVariantId()+"]");
         if (!response.isCommitted()) {
             request.getRequestDispatcher("/faces/pages/componentDemo.xhtml").forward(request,
response);
         }       

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/impl/ComponentVariantDemoDescriptionProvider.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/impl/ComponentVariantDemoDescriptionProvider.java?rev=906243&r1=906242&r2=906243&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/impl/ComponentVariantDemoDescriptionProvider.java
(original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/impl/ComponentVariantDemoDescriptionProvider.java
Wed Feb  3 21:07:19 2010
@@ -19,8 +19,6 @@
 package org.apache.myfaces.trinidaddemo.support.impl;
 
 import org.apache.myfaces.trinidaddemo.support.IComponentVariantDemo;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 import javax.faces.context.FacesContext;
 import java.io.InputStream;
@@ -29,13 +27,15 @@
 import java.io.IOException;
 import java.net.URL;
 import java.net.MalformedURLException;
+import java.util.logging.Logger;
+import java.util.logging.Level;
 
 /**
  *
  */
 public class ComponentVariantDemoDescriptionProvider {
 
-    private static final Log log = LogFactory.getLog(ComponentVariantDemoDescriptionProvider.class);
+    private static final Logger _LOG = Logger.getLogger(ComponentVariantDemoDescriptionProvider.class.getName());
 
     /**
      * @param facesContext
@@ -79,12 +79,12 @@
                     }
                 }
                 catch (IOException exc) {
-                    log.error(exc);
+                    _LOG.log(Level.SEVERE, "Error while closing file reader", exc);
                 }
             }
         }
         catch (Exception exc) {
-            log.error(exc);
+            _LOG.log(Level.INFO, "Error while reading file", exc);
         }
 
         return description.toString();

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/util/SitemapGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/util/SitemapGenerator.java?rev=906243&r1=906242&r2=906243&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/util/SitemapGenerator.java
(original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/src/main/java/org/apache/myfaces/trinidaddemo/support/util/SitemapGenerator.java
Wed Feb  3 21:07:19 2010
@@ -39,7 +39,12 @@
 import java.util.HashSet;
 
 /**
+ * Utility class for generating the corresponding sitemap.xml for this demo app.
  *
+ * Example mvn command:
+ *  mvn exec:java
+ *      -Dexec.args="http://example.irian.at/trinidad-components-showcase"
+ *      -Dexec.mainClass="org.apache.myfaces.trinidaddemo.support.util.SitemapGenerator"
  */
 public class SitemapGenerator {
 
@@ -216,7 +221,14 @@
     }
 
     public static void main(String[] args) {
-        SitemapGenerator generator = new SitemapGenerator("http://test.codebeat.ro/trinidad-components-demo");
-        generator.generateSitemap();
+        //expected arg example : ""http://test.codebeat.ro/trinidad-components-demo"
+        //to specify baseURL for the links in the generated sitemap
+        String loc = "http://test.codebeat.ro/trinidad-components-demo"; //default value
+        if (args != null && args.length > 0) {
+            loc = args[0];
+        }
+
+        SitemapGenerator generator = new SitemapGenerator(loc);
+        generator.generateSitemap();        
     }
 }



Mime
View raw message