You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by dr...@apache.org on 2011/08/18 21:20:18 UTC

svn commit: r1159364 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java

Author: drobiazko
Date: Thu Aug 18 19:20:18 2011
New Revision: 1159364

URL: http://svn.apache.org/viewvc?rev=1159364&view=rev
Log:
Printing Tapestry 5 in ascii code when the registry startup is announced.

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java?rev=1159364&r1=1159363&r2=1159364&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java Thu Aug 18 19:20:18 2011
@@ -21,7 +21,11 @@ import org.apache.tapestry5.ioc.Registry
 import org.apache.tapestry5.ioc.def.ContributionDef;
 import org.apache.tapestry5.ioc.def.ModuleDef;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
-import org.apache.tapestry5.ioc.services.*;
+import org.apache.tapestry5.ioc.services.ServiceActivity;
+import org.apache.tapestry5.ioc.services.ServiceActivityScoreboard;
+import org.apache.tapestry5.ioc.services.Status;
+import org.apache.tapestry5.ioc.services.SymbolProvider;
+import org.apache.tapestry5.ioc.services.SymbolSource;
 import org.apache.tapestry5.services.TapestryModule;
 import org.slf4j.Logger;
 
@@ -57,14 +61,14 @@ public class TapestryAppInitializer
 
     /**
      * @param logger
-     *            logger for output confirmation
+     *         logger for output confirmation
      * @param appPackage
-     *            root package name to search for pages and components
+     *         root package name to search for pages and components
      * @param appName
-     *            the name of the application (i.e., the name of the application servlet)
+     *         the name of the application (i.e., the name of the application servlet)
      * @param aliasMode
-     *            ignored (was used in 5.2)
-     * @deprecated Use {@link #TapestryAppInitializer(Logger,String,String)} instead. To be removed
+     *         ignored (was used in 5.2)
+     * @deprecated Use {@link #TapestryAppInitializer(Logger, String, String)} instead. To be removed
      *             in 5.4.
      */
     public TapestryAppInitializer(Logger logger, String appPackage, String appName, String aliasMode)
@@ -74,11 +78,11 @@ public class TapestryAppInitializer
 
     /**
      * @param logger
-     *            logger for output confirmation
+     *         logger for output confirmation
      * @param appPackage
-     *            root package name to search for pages and components
+     *         root package name to search for pages and components
      * @param appName
-     *            the name of the application (i.e., the name of the application servlet)
+     *         the name of the application (i.e., the name of the application servlet)
      */
     public TapestryAppInitializer(Logger logger, String appPackage, String appName)
     {
@@ -88,41 +92,41 @@ public class TapestryAppInitializer
 
     /**
      * @param logger
-     *            logger for output confirmation
+     *         logger for output confirmation
      * @param appProvider
-     *            provides symbols for the application (normally, from the ServletContext init
-     *            parameters)
+     *         provides symbols for the application (normally, from the ServletContext init
+     *         parameters)
      * @param appName
-     *            the name of the application (i.e., the name of the application servlet)
+     *         the name of the application (i.e., the name of the application servlet)
      * @param aliasMode
-     *            ignored (was used in 5.2 and earlier)
+     *         ignored (was used in 5.2 and earlier)
      * @param executionModes
-     *            an optional, comma-separated list of execution modes, each of which is used
-     *            to find a list of additional module classes to load (key
-     *            <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
-     *            context)
-     * @deprecated Use {@link #TapestryAppInitializer(Logger,SymbolProvider,String,String)} instead.
+     *         an optional, comma-separated list of execution modes, each of which is used
+     *         to find a list of additional module classes to load (key
+     *         <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
+     *         context)
+     * @deprecated Use {@link #TapestryAppInitializer(Logger, SymbolProvider, String, String)} instead.
      *             To be removed in 5.4.
      */
     public TapestryAppInitializer(Logger logger, SymbolProvider appProvider, String appName, String aliasMode,
-            String executionModes)
+                                  String executionModes)
     {
         this(logger, appProvider, appName, executionModes);
     }
 
     /**
      * @param logger
-     *            logger for output confirmation
+     *         logger for output confirmation
      * @param appProvider
-     *            provides symbols for the application (normally, from the ServletContext init
-     *            parameters)
+     *         provides symbols for the application (normally, from the ServletContext init
+     *         parameters)
      * @param appName
-     *            the name of the application (i.e., the name of the application servlet)
+     *         the name of the application (i.e., the name of the application servlet)
      * @param executionModes
-     *            an optional, comma-separated list of execution modes, each of which is used
-     *            to find a list of additional module classes to load (key
-     *            <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
-     *            context)
+     *         an optional, comma-separated list of execution modes, each of which is used
+     *         to find a list of additional module classes to load (key
+     *         <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
+     *         context)
      */
     public TapestryAppInitializer(Logger logger, SymbolProvider appProvider, String appName, String executionModes)
     {
@@ -156,8 +160,7 @@ public class TapestryAppInitializer
             Class moduleClass = Thread.currentThread().getContextClassLoader().loadClass(className);
 
             builder.add(moduleClass);
-        }
-        catch (ClassNotFoundException ex)
+        } catch (ClassNotFoundException ex)
         {
             // That's OK, not all applications will have a module class, even though any
             // non-trivial application will.
@@ -181,7 +184,7 @@ public class TapestryAppInitializer
 
     /**
      * Adds additional modules.
-     * 
+     *
      * @param moduleDefs
      */
     public void addModules(ModuleDef... moduleDefs)
@@ -264,6 +267,13 @@ public class TapestryAppInitializer
         f.format("\n%4.2f%% unrealized services (%d/%d)\n", 100. * unrealized / serviceActivity.size(), unrealized,
                 serviceActivity.size());
 
+        buffer.append("\n\n");
+        buffer.append(" ______                  __             ____\n");
+        buffer.append("/_  __/__ ____  ___ ___ / /_______ __  / __/\n");
+        buffer.append(" / / / _ `/ _ \\/ -_|_-</ __/ __/ // / /__ \\ \n");
+        buffer.append("/_/  \\_,_/ .__/\\__/___/\\__/_/  \\_, / /____/\n");
+        buffer.append("        /_/                   /___/       \n\n");
+
         logger.info(buffer.toString());
     }
 }



Re: svn commit: r1159364 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java

Posted by Josh Canfield <jo...@gmail.com>.
I know this is a ridiculous optimization, but if instead of
StringBuffer you just use the + operator the compiler can put the
whole tag into one memory location instead of storing it in chunks.

final String tag = "\n\n" +
    " ______                  __             ____\n" +
    "/_  __/__ ____  ___ ___ / /_______ __  / __/\n" +
    " / / / _ `/ _ \\/ -_|_-</ __/ __/ // / /__ \\ \n" +
    "/_/  \\_,_/ .__/\\__/___/\\__/_/  \\_, / /____/\n" +
    "        /_/                   /___/       \n\n";

StringBuilder/StringBuffer are more appropriate for when you have
non-constant content.

Josh

On Thu, Aug 18, 2011 at 12:20 PM,  <dr...@apache.org> wrote:
> Author: drobiazko
> Date: Thu Aug 18 19:20:18 2011
> New Revision: 1159364
>
> URL: http://svn.apache.org/viewvc?rev=1159364&view=rev
> Log:
> Printing Tapestry 5 in ascii code when the registry startup is announced.
>
> Modified:
>    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
>
> Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
> URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java?rev=1159364&r1=1159363&r2=1159364&view=diff
> ==============================================================================
> --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java (original)
> +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java Thu Aug 18 19:20:18 2011
> @@ -21,7 +21,11 @@ import org.apache.tapestry5.ioc.Registry
>  import org.apache.tapestry5.ioc.def.ContributionDef;
>  import org.apache.tapestry5.ioc.def.ModuleDef;
>  import org.apache.tapestry5.ioc.internal.util.InternalUtils;
> -import org.apache.tapestry5.ioc.services.*;
> +import org.apache.tapestry5.ioc.services.ServiceActivity;
> +import org.apache.tapestry5.ioc.services.ServiceActivityScoreboard;
> +import org.apache.tapestry5.ioc.services.Status;
> +import org.apache.tapestry5.ioc.services.SymbolProvider;
> +import org.apache.tapestry5.ioc.services.SymbolSource;
>  import org.apache.tapestry5.services.TapestryModule;
>  import org.slf4j.Logger;
>
> @@ -57,14 +61,14 @@ public class TapestryAppInitializer
>
>     /**
>      * @param logger
> -     *            logger for output confirmation
> +     *         logger for output confirmation
>      * @param appPackage
> -     *            root package name to search for pages and components
> +     *         root package name to search for pages and components
>      * @param appName
> -     *            the name of the application (i.e., the name of the application servlet)
> +     *         the name of the application (i.e., the name of the application servlet)
>      * @param aliasMode
> -     *            ignored (was used in 5.2)
> -     * @deprecated Use {@link #TapestryAppInitializer(Logger,String,String)} instead. To be removed
> +     *         ignored (was used in 5.2)
> +     * @deprecated Use {@link #TapestryAppInitializer(Logger, String, String)} instead. To be removed
>      *             in 5.4.
>      */
>     public TapestryAppInitializer(Logger logger, String appPackage, String appName, String aliasMode)
> @@ -74,11 +78,11 @@ public class TapestryAppInitializer
>
>     /**
>      * @param logger
> -     *            logger for output confirmation
> +     *         logger for output confirmation
>      * @param appPackage
> -     *            root package name to search for pages and components
> +     *         root package name to search for pages and components
>      * @param appName
> -     *            the name of the application (i.e., the name of the application servlet)
> +     *         the name of the application (i.e., the name of the application servlet)
>      */
>     public TapestryAppInitializer(Logger logger, String appPackage, String appName)
>     {
> @@ -88,41 +92,41 @@ public class TapestryAppInitializer
>
>     /**
>      * @param logger
> -     *            logger for output confirmation
> +     *         logger for output confirmation
>      * @param appProvider
> -     *            provides symbols for the application (normally, from the ServletContext init
> -     *            parameters)
> +     *         provides symbols for the application (normally, from the ServletContext init
> +     *         parameters)
>      * @param appName
> -     *            the name of the application (i.e., the name of the application servlet)
> +     *         the name of the application (i.e., the name of the application servlet)
>      * @param aliasMode
> -     *            ignored (was used in 5.2 and earlier)
> +     *         ignored (was used in 5.2 and earlier)
>      * @param executionModes
> -     *            an optional, comma-separated list of execution modes, each of which is used
> -     *            to find a list of additional module classes to load (key
> -     *            <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
> -     *            context)
> -     * @deprecated Use {@link #TapestryAppInitializer(Logger,SymbolProvider,String,String)} instead.
> +     *         an optional, comma-separated list of execution modes, each of which is used
> +     *         to find a list of additional module classes to load (key
> +     *         <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
> +     *         context)
> +     * @deprecated Use {@link #TapestryAppInitializer(Logger, SymbolProvider, String, String)} instead.
>      *             To be removed in 5.4.
>      */
>     public TapestryAppInitializer(Logger logger, SymbolProvider appProvider, String appName, String aliasMode,
> -            String executionModes)
> +                                  String executionModes)
>     {
>         this(logger, appProvider, appName, executionModes);
>     }
>
>     /**
>      * @param logger
> -     *            logger for output confirmation
> +     *         logger for output confirmation
>      * @param appProvider
> -     *            provides symbols for the application (normally, from the ServletContext init
> -     *            parameters)
> +     *         provides symbols for the application (normally, from the ServletContext init
> +     *         parameters)
>      * @param appName
> -     *            the name of the application (i.e., the name of the application servlet)
> +     *         the name of the application (i.e., the name of the application servlet)
>      * @param executionModes
> -     *            an optional, comma-separated list of execution modes, each of which is used
> -     *            to find a list of additional module classes to load (key
> -     *            <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
> -     *            context)
> +     *         an optional, comma-separated list of execution modes, each of which is used
> +     *         to find a list of additional module classes to load (key
> +     *         <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
> +     *         context)
>      */
>     public TapestryAppInitializer(Logger logger, SymbolProvider appProvider, String appName, String executionModes)
>     {
> @@ -156,8 +160,7 @@ public class TapestryAppInitializer
>             Class moduleClass = Thread.currentThread().getContextClassLoader().loadClass(className);
>
>             builder.add(moduleClass);
> -        }
> -        catch (ClassNotFoundException ex)
> +        } catch (ClassNotFoundException ex)
>         {
>             // That's OK, not all applications will have a module class, even though any
>             // non-trivial application will.
> @@ -181,7 +184,7 @@ public class TapestryAppInitializer
>
>     /**
>      * Adds additional modules.
> -     *
> +     *
>      * @param moduleDefs
>      */
>     public void addModules(ModuleDef... moduleDefs)
> @@ -264,6 +267,13 @@ public class TapestryAppInitializer
>         f.format("\n%4.2f%% unrealized services (%d/%d)\n", 100. * unrealized / serviceActivity.size(), unrealized,
>                 serviceActivity.size());
>
> +        buffer.append("\n\n");
> +        buffer.append(" ______                  __             ____\n");
> +        buffer.append("/_  __/__ ____  ___ ___ / /_______ __  / __/\n");
> +        buffer.append(" / / / _ `/ _ \\/ -_|_-</ __/ __/ // / /__ \\ \n");
> +        buffer.append("/_/  \\_,_/ .__/\\__/___/\\__/_/  \\_, / /____/\n");
> +        buffer.append("        /_/                   /___/       \n\n");
> +
>         logger.info(buffer.toString());
>     }
>  }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org