You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2010/12/31 17:49:24 UTC

svn commit: r1054134 - in /myfaces/extensions/cdi/trunk: component-support-modules/trinidad-support/src/main/java/org/apache/myfaces/extensions/cdi/trinidad/impl/ core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/ core/api/src/ma...

Author: gpetracek
Date: Fri Dec 31 16:49:23 2010
New Revision: 1054134

URL: http://svn.apache.org/viewvc?rev=1054134&view=rev
Log:
EXTCDI-113 first draft

Added:
    myfaces/extensions/cdi/trunk/component-support-modules/trinidad-support/src/main/java/org/apache/myfaces/extensions/cdi/trinidad/impl/TrinidadSupportModuleStartupObserver.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/AbstractStartupObserver.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/CoreStartupObserver.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/util/ProxyUtils.java
    myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/BeanValidationModuleStartupObserver.java
    myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/JpaModuleStartupObserver.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/JsfModuleStartupObserver.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareLocaleResolver.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/Jsf2ModuleStartupObserver.java
    myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptingModuleStartupObserver.java
Removed:
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/CodiInformationExtension.java
Modified:
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/CodiCoreConfig.java
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/startup/event/StartupEvent.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
    myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleTestLogger.java
    myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/listener/startup/StartupObserver.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareMessageContextProducer.java
    myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageContextConfig.java

Added: myfaces/extensions/cdi/trunk/component-support-modules/trinidad-support/src/main/java/org/apache/myfaces/extensions/cdi/trinidad/impl/TrinidadSupportModuleStartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/component-support-modules/trinidad-support/src/main/java/org/apache/myfaces/extensions/cdi/trinidad/impl/TrinidadSupportModuleStartupObserver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/component-support-modules/trinidad-support/src/main/java/org/apache/myfaces/extensions/cdi/trinidad/impl/TrinidadSupportModuleStartupObserver.java (added)
+++ myfaces/extensions/cdi/trunk/component-support-modules/trinidad-support/src/main/java/org/apache/myfaces/extensions/cdi/trinidad/impl/TrinidadSupportModuleStartupObserver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.trinidad.impl;
+
+import org.apache.myfaces.extensions.cdi.core.api.startup.event.StartupEvent;
+import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+import org.apache.myfaces.extensions.cdi.core.impl.AbstractStartupObserver;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+/**
+ * @author Gerhard Petracek
+ */
+@ApplicationScoped
+public class TrinidadSupportModuleStartupObserver extends AbstractStartupObserver
+{
+    protected TrinidadSupportModuleStartupObserver()
+    {
+    }
+
+    protected void logTrinidadSupportModuleConfiguration(@Observes StartupEvent startupEvent)
+    {
+        if(!this.codiCoreConfig.isConfigurationLoggingEnabled())
+        {
+            return;
+        }
+        
+        try
+        {
+            String moduleVersion = detectModuleVersion();
+
+            //module info
+            StringBuilder info = new StringBuilder("[Started] MyFaces CODI Trinidad-Support-Module");
+            info.append(moduleVersion);
+            info.append(separator);
+
+            this.logger.info(info.toString());
+        }
+        //avoid that this log harms the startup
+        catch (Throwable t)
+        {
+            this.logger.warning("Trinidad-Support-Module couldn't log the current configuration." +
+                                "Startup will continue!");
+        }
+    }
+
+
+    protected String detectModuleVersion()
+    {
+        String version = ClassUtils.getJarVersion(TrinidadSupportModuleStartupObserver.class);
+
+        if(version != null && !version.startsWith("null"))
+        {
+            return " v" + version;
+        }
+        return "";
+    }
+}

Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/CodiCoreConfig.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/CodiCoreConfig.java?rev=1054134&r1=1054133&r2=1054134&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/CodiCoreConfig.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/CodiCoreConfig.java Fri Dec 31 16:49:23 2010
@@ -36,4 +36,9 @@ public class CodiCoreConfig extends Abst
     {
         return true;
     }
+
+    public boolean isConfigurationLoggingEnabled()
+    {
+        return true;
+    }
 }

Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/startup/event/StartupEvent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/startup/event/StartupEvent.java?rev=1054134&r1=1054133&r2=1054134&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/startup/event/StartupEvent.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/startup/event/StartupEvent.java Fri Dec 31 16:49:23 2010
@@ -26,5 +26,5 @@ import java.util.Map;
  */
 public interface StartupEvent
 {
-    Map<String, Serializable> getApplicationProperties();
+    Map<String, Serializable> getApplicationParameters();
 }

Added: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/AbstractStartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/AbstractStartupObserver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/AbstractStartupObserver.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/AbstractStartupObserver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.core.impl;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.AbstractAttributeAware;
+import org.apache.myfaces.extensions.cdi.core.api.config.CodiConfig;
+import org.apache.myfaces.extensions.cdi.core.api.config.CodiCoreConfig;
+import org.apache.myfaces.extensions.cdi.core.api.logging.Logger;
+import org.apache.myfaces.extensions.cdi.core.impl.util.ProxyUtils;
+
+import javax.inject.Inject;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractStartupObserver
+{
+    @Inject
+    protected Logger logger;
+
+    @Inject
+    protected CodiCoreConfig codiCoreConfig;
+
+    protected String separator = System.getProperty("line.separator");
+
+    //generic alternative to #toString to avoid an overriden #toString at custom implementations
+    protected String getConfigInfo(CodiConfig config)
+    {
+        StringBuilder info = new StringBuilder();
+
+        Set<String> processedMethod = new HashSet<String>();
+        createMethodFilter(processedMethod);
+
+        Class currentClass = ProxyUtils.getUnproxiedClass(config.getClass());
+        while (currentClass != null &&
+                !Object.class.getName().equals(currentClass.getName()) &&
+                !AbstractAttributeAware.class.getName().equals(currentClass.getName()))
+        {
+
+            info.append("config implementation: ");
+            info.append(currentClass.getName());
+            info.append(separator);
+
+            //inspect the other methods of the implementing class
+            for(Method currentMethod : currentClass.getDeclaredMethods())
+            {
+                if(processedMethod.contains(currentMethod.getName()))
+                {
+                    continue;
+                }
+
+                processedMethod.add(currentMethod.getName());
+
+                info.append("   method-name:\t\t").append(currentMethod.getName());
+                info.append(separator);
+                Object value;
+                try
+                {
+                    value = currentMethod.invoke(config);
+                    info.append("   method-value:\t").append(value.toString());
+                }
+                catch (IllegalAccessException e)
+                {
+                    info.append("   method-value:\t[unknown]");
+                }
+                catch (InvocationTargetException e)
+                {
+                    info.append("   method-value: [unknown]");
+                }
+                info.append(separator);
+                info.append(separator);
+            }
+
+            currentClass = currentClass.getSuperclass();
+        }
+
+        return info.toString();
+    }
+
+    protected void createMethodFilter(Set<String> processedMethod)
+    {
+        processedMethod.add("toString");
+        processedMethod.add("equals");
+        processedMethod.add("hashCode");
+        processedMethod.add("finalize");
+        processedMethod.add("clone");
+    }
+}

Added: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/CoreStartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/CoreStartupObserver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/CoreStartupObserver.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/CoreStartupObserver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.core.impl;
+
+import org.apache.myfaces.extensions.cdi.core.api.CodiInformation;
+import org.apache.myfaces.extensions.cdi.core.api.logging.Logger;
+import org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStage;
+import org.apache.myfaces.extensions.cdi.core.api.startup.event.StartupEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ */
+@ApplicationScoped
+public class CoreStartupObserver extends AbstractStartupObserver
+{
+    @Inject
+    protected Logger logger;
+
+    @Inject
+    protected ProjectStage projectStage;
+
+    protected CoreStartupObserver()
+    {
+    }
+
+    protected void logCoreConfiguration(@Observes StartupEvent startupEvent)
+    {
+        if(!this.codiCoreConfig.isConfigurationLoggingEnabled())
+        {
+            return;
+        }
+
+        try
+        {
+            //module info
+            StringBuilder info = new StringBuilder("[Started] MyFaces CODI (Extensions CDI) Core");
+            info.append(getCodiCoreInformation());
+            info.append(separator);
+            info.append("project-stage: ");
+            info.append(this.projectStage.toString());
+            info.append(separator);
+            info.append("project-stage class: ");
+            info.append(this.projectStage.getClass().getName());
+            info.append(separator);
+            info.append(separator);
+
+            //application info
+            for(Map.Entry property : System.getProperties().entrySet())
+            {
+                if(property.getKey() instanceof String &&
+                        ((String) property.getKey()).startsWith("org.apache.myfaces.extensions.cdi"))
+                {
+                    info.append("system-property-name:\t").append(property.getKey());
+                    info.append(separator);
+
+                    info.append("system-property-value:\t").append(property.getValue());
+                    info.append(separator);
+                    info.append(separator);
+                }
+            }
+
+            for(Map.Entry<String, Serializable> contextParam : startupEvent.getApplicationParameters().entrySet())
+            {
+                info.append("param-name:\t\t").append(contextParam.getKey());
+                info.append(separator);
+
+                info.append("param-value:\t").append(contextParam.getValue());
+                info.append(separator);
+                info.append(separator);
+            }
+
+            //module config
+            info.append(getConfigInfo(this.codiCoreConfig));
+
+            this.logger.info(info.toString());
+        }
+        //avoid that this log harms the startup
+        catch (Throwable t)
+        {
+            this.logger.warning("Core-Module couldn't log the current configuration." +
+                                "Startup will continue!");
+        }
+    }
+
+    public String getCodiCoreInformation()
+    {
+        if(CodiInformation.VERSION != null && !CodiInformation.VERSION.startsWith("null"))
+        {
+            return " v" + CodiInformation.VERSION;
+        }
+        return "";
+    }
+}

Added: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/util/ProxyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/util/ProxyUtils.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/util/ProxyUtils.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/util/ProxyUtils.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.core.impl.util;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Typed()
+public class ProxyUtils
+{
+    private ProxyUtils()
+    {
+    }
+
+    public static Class getUnproxiedClass(Class currentClass)
+    {
+        if(isProxiedClass(currentClass))
+        {
+            return currentClass.getSuperclass();
+        }
+        return currentClass;
+    }
+
+    public static boolean isProxiedClass(Class currentClass)
+    {
+        return currentClass.getName().contains("$$EnhancerByCGLIB$$") ||
+            currentClass.getName().contains("$$FastClassByCGLIB$$") ||
+            currentClass.getName().contains("_$$_javassist");
+    }
+}

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension?rev=1054134&r1=1054133&r2=1054134&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension (original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension Fri Dec 31 16:49:23 2010
@@ -23,6 +23,4 @@ org.apache.myfaces.extensions.cdi.core.i
 # myfaces-codi BeanManager provider
 org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider
 
-org.apache.myfaces.extensions.cdi.core.impl.CodiInformationExtension
-
 org.apache.myfaces.extensions.cdi.core.impl.CodiDeactivatorExtension
\ No newline at end of file

Modified: myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleTestLogger.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleTestLogger.java?rev=1054134&r1=1054133&r2=1054134&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleTestLogger.java (original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleTestLogger.java Fri Dec 31 16:49:23 2010
@@ -20,6 +20,9 @@ package org.apache.myfaces.extensions.cd
 
 import org.apache.myfaces.extensions.cdi.core.impl.logging.DefaultLogger;
 
+import javax.enterprise.inject.Typed;
+
+@Typed()
 class SimpleTestLogger extends DefaultLogger
 {
     private static final long serialVersionUID = -4516457276481051077L;

Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/listener/startup/StartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/listener/startup/StartupObserver.java?rev=1054134&r1=1054133&r2=1054134&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/listener/startup/StartupObserver.java (original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/listener/startup/StartupObserver.java Fri Dec 31 16:49:23 2010
@@ -38,7 +38,7 @@ public class StartupObserver
 
     protected void logApplicationProperties(@Observes StartupEvent startupEvent)
     {
-        for(Map.Entry<String, Serializable> property : startupEvent.getApplicationProperties().entrySet())
+        for(Map.Entry<String, Serializable> property : startupEvent.getApplicationParameters().entrySet())
         {
             this.logger.info("key: " + property.getKey() + " value: " + property.getValue());
         }

Added: myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/BeanValidationModuleStartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/BeanValidationModuleStartupObserver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/BeanValidationModuleStartupObserver.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/BeanValidationModuleStartupObserver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.bv.impl;
+
+import org.apache.myfaces.extensions.cdi.core.api.startup.event.StartupEvent;
+import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+import org.apache.myfaces.extensions.cdi.core.impl.AbstractStartupObserver;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+/**
+ * @author Gerhard Petracek
+ */
+@ApplicationScoped
+public class BeanValidationModuleStartupObserver extends AbstractStartupObserver
+{
+    protected BeanValidationModuleStartupObserver()
+    {
+    }
+
+    protected void logBeanValidationModuleConfiguration(@Observes StartupEvent startupEvent)
+    {
+        if(!this.codiCoreConfig.isConfigurationLoggingEnabled())
+        {
+            return;
+        }
+        
+        try
+        {
+            String moduleVersion = detectModuleVersion();
+
+            //module info
+            StringBuilder info = new StringBuilder("[Started] MyFaces CODI Bean-Validation-Module");
+            info.append(moduleVersion);
+
+            this.logger.info(info.toString());
+        }
+        //avoid that this log harms the startup
+        catch (Throwable t)
+        {
+            this.logger.warning("Bean-Validation-Module couldn't log the current configuration." +
+                                "Startup will continue!");
+        }
+    }
+
+
+    protected String detectModuleVersion()
+    {
+        String version = ClassUtils.getJarVersion(BeanValidationModuleStartupObserver.class);
+
+        if(version != null && !version.startsWith("null"))
+        {
+            return " v" + version;
+        }
+        return "";
+    }
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/JpaModuleStartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/JpaModuleStartupObserver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/JpaModuleStartupObserver.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/JpaModuleStartupObserver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.jpa.impl;
+
+import org.apache.myfaces.extensions.cdi.core.api.startup.event.StartupEvent;
+import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+import org.apache.myfaces.extensions.cdi.core.impl.AbstractStartupObserver;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+/**
+ * @author Gerhard Petracek
+ */
+@ApplicationScoped
+public class JpaModuleStartupObserver extends AbstractStartupObserver
+{
+    protected JpaModuleStartupObserver()
+    {
+    }
+
+    protected void logJpaModuleConfiguration(@Observes StartupEvent startupEvent)
+    {
+        if(!this.codiCoreConfig.isConfigurationLoggingEnabled())
+        {
+            return;
+        }
+
+        try
+        {
+            String moduleVersion = detectModuleVersion();
+
+            //module info
+            StringBuilder info = new StringBuilder("[Started] MyFaces CODI JPA-Module");
+            info.append(moduleVersion);
+            info.append(separator);
+
+            this.logger.info(info.toString());
+        }
+        //avoid that this log harms the startup
+        catch (Throwable t)
+        {
+            this.logger.warning("JPA-Module couldn't log the current configuration." +
+                                "Startup will continue!");
+        }
+    }
+
+
+    protected String detectModuleVersion()
+    {
+        String version = ClassUtils.getJarVersion(JpaModuleStartupObserver.class);
+
+        if(version != null && !version.startsWith("null"))
+        {
+            return " v" + version;
+        }
+        return "";
+    }
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/JsfModuleStartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/JsfModuleStartupObserver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/JsfModuleStartupObserver.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/JsfModuleStartupObserver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.jsf.impl;
+
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.ConversationConfig;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig;
+import org.apache.myfaces.extensions.cdi.core.api.startup.event.StartupEvent;
+import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+import org.apache.myfaces.extensions.cdi.core.impl.AbstractStartupObserver;
+import org.apache.myfaces.extensions.cdi.jsf.api.Jsf;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.JsfModuleConfig;
+import org.apache.myfaces.extensions.cdi.message.api.MessageContext;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.faces.context.FacesContext;
+import javax.faces.el.PropertyResolver;
+import javax.inject.Inject;
+
+/**
+ * @author Gerhard Petracek
+ */
+@ApplicationScoped
+public class JsfModuleStartupObserver extends AbstractStartupObserver
+{
+    @Inject
+    protected JsfModuleConfig jsfModuleConfig;
+
+    @Inject
+    protected WindowContextConfig windowContextConfig;
+
+    @Inject
+    protected ConversationConfig conversationConfig;
+
+    @Inject
+    @Jsf
+    protected MessageContext messageContext;
+
+    protected JsfModuleStartupObserver()
+    {
+    }
+
+    protected void logJsfModuleConfiguration(@Observes StartupEvent startupEvent)
+    {
+        if(!this.codiCoreConfig.isConfigurationLoggingEnabled())
+        {
+            return;
+        }
+        
+        try
+        {
+            String jsfModuleVersion = detectJsfModuleVersion();
+            String jsfVersion = detectActiveJsfVersion();
+
+            //module info
+            StringBuilder info = new StringBuilder("[Started] MyFaces CODI JSF-Module ");
+            info.append(jsfModuleVersion);
+            info.append(separator);
+
+            if(jsfVersion != null)
+            {
+                info.append(jsfVersion);
+            }
+            info.append(separator);
+
+            //module config
+            info.append(getConfigInfo(this.jsfModuleConfig));
+            info.append(getConfigInfo(this.windowContextConfig));
+            info.append(getConfigInfo(this.conversationConfig));
+
+            info.append(this.messageContext.config().toString()); //TODO
+
+            this.logger.info(info.toString());
+        }
+        //avoid that this log harms the startup
+        catch (Throwable t)
+        {
+            this.logger.warning("JSF-Module couldn't log the current configuration." +
+                                "Startup will continue!");
+        }
+    }
+
+    protected String detectActiveJsfVersion()
+    {
+        //In JSF 1.2+ this artifact isn't wrapped by custom implementations (because it's deprecated)
+        //-> usually it's the version of the implementation
+        
+        @SuppressWarnings({"deprecation"})
+        PropertyResolver anyJsfClass = FacesContext.getCurrentInstance().getApplication().getPropertyResolver();
+
+        if(anyJsfClass == null)
+        {
+            return null;
+        }
+
+        String version = ClassUtils.getJarVersion(anyJsfClass.getClass());
+
+        String description = "Used JSF implementation: ";
+
+        if(anyJsfClass.getClass().getName().startsWith("org.apache.myfaces"))
+        {
+            return description + "MyFaces Core v" + version;
+        }
+        else if(anyJsfClass.getClass().getName().startsWith("com.sun.faces"))
+        {
+            return description + "Mojarra v" + version;
+        }
+        return null;
+    }
+
+    protected String detectJsfModuleVersion()
+    {
+        String version = ClassUtils.getJarVersion(JsfModuleStartupObserver.class);
+
+        if(version != null && !version.startsWith("null"))
+        {
+            return "v" + version + " for JSF " + getTargetJsfVersion();
+        }
+        return " for JSF " + getTargetJsfVersion();
+    }
+
+    protected String getTargetJsfVersion()
+    {
+        return "1.2";
+    }
+}

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java?rev=1054134&r1=1054133&r2=1054134&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java Fri Dec 31 16:49:23 2010
@@ -20,6 +20,7 @@ package org.apache.myfaces.extensions.cd
 
 import org.apache.myfaces.extensions.cdi.core.api.startup.event.StartupEvent;
 
+import javax.enterprise.inject.Typed;
 import javax.faces.context.FacesContext;
 import java.io.Serializable;
 import java.util.Map;
@@ -27,6 +28,7 @@ import java.util.Map;
 /**
  * @author Gerhard Petracek
  */
+@Typed()
 class JsfStartupEvent implements StartupEvent
 {
     private FacesContext facesContext;
@@ -36,7 +38,7 @@ class JsfStartupEvent implements Startup
         this.facesContext = facesContext;
     }
 
-    public Map<String, Serializable> getApplicationProperties()
+    public Map<String, Serializable> getApplicationParameters()
     {
         return this.facesContext.getExternalContext().getInitParameterMap();
     }

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareLocaleResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareLocaleResolver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareLocaleResolver.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareLocaleResolver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.jsf.impl.message;
+
+import org.apache.myfaces.extensions.cdi.message.api.LocaleResolver;
+
+import javax.faces.context.FacesContext;
+import java.util.Locale;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class JsfAwareLocaleResolver implements LocaleResolver
+{
+    private static final long serialVersionUID = 5945811297524654438L;
+
+    public Locale getLocale()
+    {
+        Locale locale = null;
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        if (facesContext != null && facesContext.getViewRoot() != null)
+        {
+            locale = facesContext.getViewRoot().getLocale();
+        }
+        return locale != null ? locale : Locale.getDefault();
+    }
+}

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareMessageContextProducer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareMessageContextProducer.java?rev=1054134&r1=1054133&r2=1054134&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareMessageContextProducer.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/message/JsfAwareMessageContextProducer.java Fri Dec 31 16:49:23 2010
@@ -20,7 +20,6 @@ package org.apache.myfaces.extensions.cd
 
 import org.apache.myfaces.extensions.cdi.jsf.api.Jsf;
 import static org.apache.myfaces.extensions.cdi.jsf.api.JsfModuleBeanNames.MESSAGE_CONTEXT;
-import org.apache.myfaces.extensions.cdi.message.api.LocaleResolver;
 import org.apache.myfaces.extensions.cdi.message.api.MessageContext;
 import org.apache.myfaces.extensions.cdi.message.api.MessageFactory;
 import org.apache.myfaces.extensions.cdi.message.impl.DefaultMessageContext;
@@ -30,9 +29,7 @@ import org.apache.myfaces.extensions.cdi
 import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.Produces;
-import javax.faces.context.FacesContext;
 import javax.inject.Named;
-import java.util.Locale;
 
 /**
  * @author Gerhard Petracek
@@ -69,7 +66,7 @@ public class JsfAwareMessageContextProdu
 
         MessageContext result = defaultMessageContext.config()
                 .use()
-                    .localeResolver(createJsfAwareLocaleResolver())
+                    .localeResolver(new JsfAwareLocaleResolver())
                     .messageResolver(new JsfAwareApplicationMessagesMessageResolver())
                     .messageInterpolator(new FacesMessageInterpolator(elProvider, argumentFilter))
                     .addMessageHandler(new JsfAwareMessageHandler())
@@ -82,23 +79,4 @@ public class JsfAwareMessageContextProdu
 
         return result;
     }
-
-    private LocaleResolver createJsfAwareLocaleResolver()
-    {
-        return new LocaleResolver()
-        {
-            private static final long serialVersionUID = 5945811297524654438L;
-
-            public Locale getLocale()
-            {
-                Locale locale = null;
-                FacesContext facesContext = FacesContext.getCurrentInstance();
-                if (facesContext != null && facesContext.getViewRoot() != null)
-                {
-                    locale = facesContext.getViewRoot().getLocale();
-                }
-                return locale != null ? locale : Locale.getDefault();
-            }
-        };
-    }
 }

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/Jsf2ModuleStartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/Jsf2ModuleStartupObserver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/Jsf2ModuleStartupObserver.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/Jsf2ModuleStartupObserver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.jsf2.impl;
+
+import org.apache.myfaces.extensions.cdi.jsf.impl.JsfModuleStartupObserver;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Specializes;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Specializes
+@ApplicationScoped
+public class Jsf2ModuleStartupObserver extends JsfModuleStartupObserver
+{
+    @Override
+    protected String getTargetJsfVersion()
+    {
+        return "2.0";
+    }
+}

Modified: myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageContextConfig.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageContextConfig.java?rev=1054134&r1=1054133&r2=1054134&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageContextConfig.java (original)
+++ myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageContextConfig.java Fri Dec 31 16:49:23 2010
@@ -289,6 +289,73 @@ class DefaultMessageContextConfig implem
         this.formatterFactory = formatterFactory;
     }
 
+    @Override
+    public String toString()
+    {
+        String newLine = System.getProperty("line.separator");
+
+        StringBuilder configInfo = new StringBuilder("MessageContextConfig class: ");
+        configInfo.append(getClass().getName());
+        configInfo.append(newLine);
+
+        if(this.messageInterpolator != null)
+        {
+            configInfo.append("   MessageInterpolator class: ").append(this.messageInterpolator.getClass());
+        }
+        else
+        {
+            configInfo.append("   no MessageInterpolator");
+        }
+        configInfo.append(newLine);
+
+        if(this.messageResolver != null)
+        {
+            configInfo.append("   MessageResolver class: ").append(this.messageResolver.getClass());
+        }
+        else
+        {
+            configInfo.append("   no MessageResolver");
+        }
+        configInfo.append(newLine);
+
+        if(this.messageHandlers != null && !this.messageHandlers.isEmpty())
+        {
+            for(MessageHandler messageHandler : this.messageHandlers)
+            {
+                configInfo.append("   MessageHandler class: ").append(messageHandler.getClass());
+            }
+        }
+        else
+        {
+            configInfo.append("   no MessageHandlers");
+        }
+        configInfo.append(newLine);
+
+        if(this.localeResolver != null)
+        {
+            configInfo.append("   LocaleResolver class: ").append(this.localeResolver.getClass());
+        }
+        else
+        {
+            configInfo.append("   no LocaleResolver");
+        }
+        configInfo.append(newLine);
+
+        if(this.formatterFactory != null)
+        {
+            configInfo.append("   FormatterFactory class: ").append(this.formatterFactory.getClass());
+            configInfo.append(newLine);
+            //TODO
+            //configInfo.append("   FormatterFactory details: ").append(this.formatterFactory.toString());
+        }
+        else
+        {
+            configInfo.append("   no FormatterFactory");
+        }
+
+        return configInfo.toString();
+    }
+
     /*
      * generated
      */

Added: myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptingModuleStartupObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptingModuleStartupObserver.java?rev=1054134&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptingModuleStartupObserver.java (added)
+++ myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptingModuleStartupObserver.java Fri Dec 31 16:49:23 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.scripting.impl;
+
+import org.apache.myfaces.extensions.cdi.core.api.startup.event.StartupEvent;
+import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+import org.apache.myfaces.extensions.cdi.core.impl.AbstractStartupObserver;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+/**
+ * @author Gerhard Petracek
+ */
+@ApplicationScoped
+public class ScriptingModuleStartupObserver extends AbstractStartupObserver
+{
+    protected ScriptingModuleStartupObserver()
+    {
+    }
+
+    protected void logScriptingModuleConfiguration(@Observes StartupEvent startupEvent)
+    {
+        if(!this.codiCoreConfig.isConfigurationLoggingEnabled())
+        {
+            return;
+        }
+        
+        try
+        {
+            String moduleVersion = detectModuleVersion();
+
+            //module info
+            StringBuilder info = new StringBuilder("[Started] MyFaces CODI Scripting-Module");
+            info.append(moduleVersion);
+            info.append(separator);
+
+            this.logger.info(info.toString());
+        }
+        //avoid that this log harms the startup
+        catch (Throwable t)
+        {
+            this.logger.warning("Scripting-Module couldn't log the current configuration." +
+                                "Startup will continue!");
+        }
+    }
+
+
+    protected String detectModuleVersion()
+    {
+        String version = ClassUtils.getJarVersion(ScriptingModuleStartupObserver.class);
+
+        if(version != null && !version.startsWith("null"))
+        {
+            return " v" + version;
+        }
+        return "";
+    }
+}