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/22 01:12:16 UTC

svn commit: r1051706 - in /myfaces/extensions/cdi/trunk: core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/ core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/logging/ core/impl/src/main/java/org/apache/myfaces/extensions...

Author: gpetracek
Date: Wed Dec 22 00:12:15 2010
New Revision: 1051706

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

Added:
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/Name.java
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/logging/
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/logging/Logger.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/DefaultLogger.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/InstanceProducer.java
    myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/
    myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/ManualLoggingClient.java
    myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleLoggingTest.java
    myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleTestLogger.java
Modified:
    myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/conversation/grouped/ConversationDemoBean1.java

Added: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/Name.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/Name.java?rev=1051706&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/Name.java (added)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/Name.java Wed Dec 22 00:12:15 2010
@@ -0,0 +1,42 @@
+/*
+ * 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.api;
+
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Target({PARAMETER, FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+
+@Qualifier
+public @interface Name
+{
+    @Nonbinding
+    String value();
+}

Added: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/logging/Logger.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/logging/Logger.java?rev=1051706&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/logging/Logger.java (added)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/logging/Logger.java Wed Dec 22 00:12:15 2010
@@ -0,0 +1,122 @@
+/*
+ * 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.api.logging;
+
+import java.io.Serializable;
+import java.util.ResourceBundle;
+import java.util.logging.Filter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+/**
+ * @author Gerhard Petracek
+ */
+public interface Logger extends Serializable
+{
+    ResourceBundle getResourceBundle();
+
+    String getResourceBundleName();
+
+    void setFilter(Filter filter) throws SecurityException;
+
+    Filter getFilter();
+
+    void log(LogRecord logRecord);
+
+    void log(Level level, String s);
+
+    void log(Level level, String s, Object o);
+
+    void log(Level level, String s, Object[] objects);
+
+    void log(Level level, String s, Throwable throwable);
+
+    void logp(Level level, String s, String s1, String s2);
+
+    void logp(Level level, String s, String s1, String s2, Object o);
+
+    void logp(Level level, String s, String s1, String s2, Object[] objects);
+
+    void logp(Level level, String s, String s1, String s2, Throwable throwable);
+
+    void logrb(Level level, String s, String s1, String s2, String s3);
+
+    void logrb(Level level, String s, String s1, String s2, String s3, Object o);
+
+    void logrb(Level level, String s, String s1, String s2, String s3, Object[] objects);
+
+    void logrb(Level level, String s, String s1, String s2, String s3, Throwable throwable);
+
+    void entering(String s, String s1);
+
+    void entering(String s, String s1, Object o);
+
+    void entering(String s, String s1, Object[] objects);
+
+    void exiting(String s, String s1);
+
+    void exiting(String s, String s1, Object o);
+
+    void throwing(String s, String s1, Throwable throwable);
+
+    void severe(String s);
+
+    void warning(String s);
+
+    void info(String s);
+
+    void config(String s);
+
+    void fine(String s);
+
+    void finer(String s);
+
+    void finest(String s);
+
+    void setLevel(Level level) throws SecurityException;
+
+    Level getLevel();
+
+    boolean isLoggable(Level level);
+
+    String getName();
+
+    void addHandler(Handler handler) throws SecurityException;
+
+    void removeHandler(Handler handler) throws SecurityException;
+
+    Handler[] getHandlers();
+
+    void setUseParentHandlers(boolean b);
+
+    boolean getUseParentHandlers();
+
+    java.util.logging.Logger getParent();
+
+    void setParent(java.util.logging.Logger logger);
+
+    /**
+     * Just use this method if the original logger is really needed.
+     * It's used by CODI internally to get a better performance.
+     *
+     * @return the wrapped logger
+     */
+    java.util.logging.Logger getWrapped();
+}

Added: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/DefaultLogger.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/DefaultLogger.java?rev=1051706&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/DefaultLogger.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/DefaultLogger.java Wed Dec 22 00:12:15 2010
@@ -0,0 +1,287 @@
+/*
+ * 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.logging;
+
+import org.apache.myfaces.extensions.cdi.core.api.logging.Logger;
+
+import javax.enterprise.inject.Typed;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.ResourceBundle;
+import java.util.logging.Filter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+/**
+ * @author Gerhard Petracek
+ * @author Werner Punz
+ */
+@Typed
+public class DefaultLogger implements Logger
+{
+    private static final long serialVersionUID = 6112073723716267680L;
+
+    private transient java.util.logging.Logger wrapped;
+
+    private String loggerName = null;
+
+    protected DefaultLogger()
+    {
+    }
+
+    protected DefaultLogger(String loggerName)
+    {
+        this.loggerName = loggerName;
+        this.wrapped = java.util.logging.Logger.getLogger(this.loggerName);
+    }
+
+    public java.util.logging.Logger getWrapped()
+    {
+        return this.wrapped;
+    }
+
+    public ResourceBundle getResourceBundle()
+    {
+        return this.wrapped.getResourceBundle();
+    }
+
+    public String getResourceBundleName()
+    {
+        return this.wrapped.getResourceBundleName();
+    }
+
+    public void setFilter(Filter filter) throws SecurityException
+    {
+        this.wrapped.setFilter(filter);
+    }
+
+    public Filter getFilter()
+    {
+        return this.wrapped.getFilter();
+    }
+
+    public void log(LogRecord logRecord)
+    {
+        this.wrapped.log(logRecord);
+    }
+
+    public void log(Level level, String s)
+    {
+        this.wrapped.logp(level, this.loggerName, getMethodName(), s);
+    }
+
+    public void log(Level level, String s, Object o)
+    {
+        this.wrapped.logp(level, loggerName, getMethodName(), s, o);
+    }
+
+    public void log(Level level, String s, Object[] objects)
+    {
+        this.wrapped.logp(level, this.loggerName, getMethodName(), s, objects);
+    }
+
+    public void log(Level level, String s, Throwable throwable)
+    {
+        this.wrapped.logp(level, this.loggerName, getMethodName(), s, throwable);
+    }
+
+    public void logp(Level level, String s, String s1, String s2)
+    {
+        this.wrapped.logp(level, s, s1, s2);
+    }
+
+    public void logp(Level level, String s, String s1, String s2, Object o)
+    {
+        this.wrapped.logp(level, s, s1, s2, o);
+    }
+
+    public void logp(Level level, String s, String s1, String s2, Object[] objects)
+    {
+        this.wrapped.logp(level, s, s1, s2, objects);
+    }
+
+    public void logp(Level level, String s, String s1, String s2, Throwable throwable)
+    {
+        this.wrapped.logp(level, s, s1, s2, throwable);
+    }
+
+    public void logrb(Level level, String s, String s1, String s2, String s3)
+    {
+        this.wrapped.logrb(level, s, s1, s2, s3);
+    }
+
+    public void logrb(Level level, String s, String s1, String s2, String s3, Object o)
+    {
+        this.wrapped.logrb(level, s, s1, s2, s3, o);
+    }
+
+    public void logrb(Level level, String s, String s1, String s2, String s3, Object[] objects)
+    {
+        this.wrapped.logrb(level, s, s1, s2, s3, objects);
+    }
+
+    public void logrb(Level level, String s, String s1, String s2, String s3, Throwable throwable)
+    {
+        this.wrapped.logrb(level, s, s1, s2, s3, throwable);
+    }
+
+    public void entering(String s, String s1)
+    {
+        this.wrapped.entering(s, s1);
+    }
+
+    public void entering(String s, String s1, Object o)
+    {
+        this.wrapped.entering(s, s1, o);
+    }
+
+    public void entering(String s, String s1, Object[] objects)
+    {
+        this.wrapped.entering(s, s1, objects);
+    }
+
+    public void exiting(String s, String s1)
+    {
+        this.wrapped.exiting(s, s1);
+    }
+
+    public void exiting(String s, String s1, Object o)
+    {
+        this.wrapped.exiting(s, s1, o);
+    }
+
+    public void throwing(String s, String s1, Throwable throwable)
+    {
+        this.wrapped.throwing(s, s1, throwable);
+    }
+
+    public void severe(String s)
+    {
+        this.wrapped.logp(Level.SEVERE, loggerName, getMethodName(), s);
+    }
+
+    public void warning(String s)
+    {
+        this.wrapped.logp(Level.WARNING, loggerName, getMethodName(), s);
+    }
+
+    public void info(String s)
+    {
+        this.wrapped.logp(Level.INFO, loggerName, getMethodName(), s);
+    }
+
+    public void config(String s)
+    {
+        this.wrapped.config(s);
+    }
+
+    public void fine(String s)
+    {
+        this.wrapped.logp(Level.FINE, loggerName, getMethodName(), s);
+    }
+
+    public void finer(String s)
+    {
+        this.wrapped.logp(Level.FINER, loggerName, getMethodName(), s);
+    }
+
+    public void finest(String s)
+    {
+        this.wrapped.logp(Level.FINEST, loggerName, getMethodName(), s);
+    }
+
+    public void setLevel(Level level) throws SecurityException
+    {
+        this.wrapped.setLevel(level);
+    }
+
+    public Level getLevel()
+    {
+        return this.wrapped.getLevel();
+    }
+
+    public boolean isLoggable(Level level)
+    {
+        return this.wrapped.isLoggable(level);
+    }
+
+    public String getName()
+    {
+        return this.wrapped.getName();
+    }
+
+    public void addHandler(Handler handler) throws SecurityException
+    {
+        this.wrapped.addHandler(handler);
+    }
+
+    public void removeHandler(Handler handler) throws SecurityException
+    {
+        this.wrapped.removeHandler(handler);
+    }
+
+    public Handler[] getHandlers()
+    {
+        return this.wrapped.getHandlers();
+    }
+
+    public void setUseParentHandlers(boolean b)
+    {
+        this.wrapped.setUseParentHandlers(b);
+    }
+
+    public boolean getUseParentHandlers()
+    {
+        return this.wrapped.getUseParentHandlers();
+    }
+
+    public java.util.logging.Logger getParent()
+    {
+        return this.wrapped.getParent();
+    }
+
+    public void setParent(java.util.logging.Logger logger)
+    {
+        this.wrapped.setParent(logger);
+    }
+
+    @SuppressWarnings({"UnusedDeclaration"})
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+    {
+        in.defaultReadObject();
+        this.wrapped = java.util.logging.Logger.getLogger(this.loggerName);
+    }
+
+    private String getMethodName()
+    {
+        @SuppressWarnings({"ThrowableInstanceNeverThrown"})
+        RuntimeException runtimeException = new RuntimeException();
+
+        for(StackTraceElement element : runtimeException.getStackTrace())
+        {
+            if(!element.toString().contains(getClass().getName()))
+            {
+                return element.getMethodName();
+            }
+        }
+
+        return "";
+    }
+}

Added: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/InstanceProducer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/InstanceProducer.java?rev=1051706&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/InstanceProducer.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/logging/InstanceProducer.java Wed Dec 22 00:12:15 2010
@@ -0,0 +1,47 @@
+/*
+ * 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.logging;
+
+import org.apache.myfaces.extensions.cdi.core.api.Name;
+import org.apache.myfaces.extensions.cdi.core.api.logging.Logger;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+/**
+ * @author Gerhard Petracek
+ * @author Werner Punz
+ */
+final class InstanceProducer
+{
+    @Produces
+    public Logger getLogger(InjectionPoint injectionPoint)
+    {
+        return new DefaultLogger(injectionPoint.getBean().getBeanClass().getName());
+    }
+
+    @Produces
+    @Name("")
+    public Logger getLoggerWithName(InjectionPoint injectionPoint)
+    {
+        Name nameQualifier = injectionPoint.getAnnotated().getAnnotation(Name.class);
+
+        return new DefaultLogger(nameQualifier.value());
+    }
+}

Added: myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/ManualLoggingClient.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/ManualLoggingClient.java?rev=1051706&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/ManualLoggingClient.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/ManualLoggingClient.java Wed Dec 22 00:12:15 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.test.impl.logging;
+
+import org.apache.myfaces.extensions.cdi.core.api.logging.Logger;
+
+import java.io.Serializable;
+
+class ManualLoggingClient implements Serializable
+{
+    private static final long serialVersionUID = 8160911141345635806L;
+
+    private Logger logger = new SimpleTestLogger(ManualLoggingClient.class.getName());
+
+    void logMessage()
+    {
+        this.logger.info("log msg");
+    }
+
+    Logger getLogger()
+    {
+        return logger;
+    }
+}

Added: myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleLoggingTest.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/SimpleLoggingTest.java?rev=1051706&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleLoggingTest.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleLoggingTest.java Wed Dec 22 00:12:15 2010
@@ -0,0 +1,88 @@
+/*
+ * 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.test.impl.logging;
+
+import org.apache.myfaces.extensions.cdi.core.api.logging.Logger;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+import java.io.*;
+
+public class SimpleLoggingTest
+{
+    @Test
+    public void testSerialization()
+    {
+        ManualLoggingClient loggingClient = new ManualLoggingClient();
+
+        loggingClient.logMessage();
+
+        byte[] serialized = new byte[0];
+        try
+        {
+            serialized = serializeObject(loggingClient);
+        }
+        catch (IOException e)
+        {
+            fail("failed to serialize instance of " + Logger.class.getName(), e);
+        }
+
+        loggingClient = null;
+        assertEquals(loggingClient, null);
+        assertTrue(serialized.length > 0);
+
+        try
+        {
+            loggingClient = deserializeData(serialized);
+        }
+        catch (Throwable e)
+        {
+            fail("failed to deserialize instance of " + Logger.class.getName(), e);
+        }
+
+        loggingClient.logMessage();
+
+        assertTrue(loggingClient.getLogger().getWrapped() instanceof java.util.logging.Logger);
+    }
+
+    private byte[] serializeObject(Object object) throws IOException
+    {
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
+        objectOutputStream.writeObject(object);
+        objectOutputStream.close();
+        return byteArrayOutputStream.toByteArray();
+    }
+
+    private ManualLoggingClient deserializeData(byte[] serialized)
+            throws IOException, ClassNotFoundException
+    {
+        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(serialized);
+        ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
+
+        try
+        {
+            return (ManualLoggingClient)objectInputStream.readObject();
+        }
+        finally
+        {
+            byteArrayInputStream.close();
+        }
+    }
+}

Added: 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=1051706&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleTestLogger.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/logging/SimpleTestLogger.java Wed Dec 22 00:12:15 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.test.impl.logging;
+
+import org.apache.myfaces.extensions.cdi.core.impl.logging.DefaultLogger;
+
+class SimpleTestLogger extends DefaultLogger
+{
+    private static final long serialVersionUID = -4516457276481051077L;
+
+    protected SimpleTestLogger()
+    {
+        super();
+    }
+
+    SimpleTestLogger(String loggerName)
+    {
+        super(loggerName);
+    }
+}

Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/conversation/grouped/ConversationDemoBean1.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/conversation/grouped/ConversationDemoBean1.java?rev=1051706&r1=1051705&r2=1051706&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/conversation/grouped/ConversationDemoBean1.java (original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/examples/codi/jsf12/conversation/grouped/ConversationDemoBean1.java Wed Dec 22 00:12:15 2010
@@ -18,6 +18,8 @@
  */
 package org.apache.myfaces.examples.codi.jsf12.conversation.grouped;
 
+import org.apache.myfaces.extensions.cdi.core.api.Name;
+import org.apache.myfaces.extensions.cdi.core.api.logging.Logger;
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationGroup;
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
@@ -49,10 +51,19 @@ public class ConversationDemoBean1 imple
     @Inject
     private Conversation conversation;
 
+    @Inject
+    private Logger logger;
+
+    @Inject
+    @Name("l1")
+    private Logger l1;
+
     @PostConstruct
     public void init()
     {
         this.createdAt = new Date();
+        this.logger.info(getClass().getName() + " created at " + this.createdAt);
+        this.l1.info(getClass().getName() + " created at " + this.createdAt);
     }
 
     public String next()