Author: pete.muir(a)jboss.org
Date: 2009-04-06 08:20:13 -0400 (Mon, 06 Apr 2009)
New Revision: 2312
Added:
extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/
extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/LoggerProducer.java
Removed:
extensions/trunk/logger/src/main/java/org/jboss/webbeans/producer/
extensions/trunk/logger/src/test/java/org/jboss/webbeans/annotation/
Modified:
extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/Logger.java
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Finch.java
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java
Log:
Fix up bad commit and fix packages
Copied: extensions/trunk/logger/src/main/java/org/jboss/webbeans/log (from rev 2288,
extensions/trunk/logger/src/test/java/org/jboss/webbeans/annotation)
Modified: extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/Logger.java
===================================================================
---
extensions/trunk/logger/src/test/java/org/jboss/webbeans/annotation/Logger.java 2009-03-31
23:28:02 UTC (rev 2288)
+++ extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/Logger.java 2009-04-06
12:20:13 UTC (rev 2312)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.annotation;
+package org.jboss.webbeans.log;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Copied: extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/LoggerProducer.java
(from rev 2287,
extensions/trunk/logger/src/main/java/org/jboss/webbeans/producer/LoggerProducer.java)
===================================================================
--- extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/LoggerProducer.java
(rev 0)
+++
extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/LoggerProducer.java 2009-04-06
12:20:13 UTC (rev 2312)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.log;
+
+import javax.inject.Current;
+import javax.inject.Produces;
+import javax.inject.manager.InjectionPoint;
+
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * The <code>LoggerProducer</code> provides a producer method for all
+ * @Logger annotated log objects. Each logger is application scoped
+ * since the logger applies to the class, not each instance of the
+ * class.
+ *
+ * @author David Allen
+ *
+ */
+public class LoggerProducer
+{
+ @Produces @Logger
+ public Log produceLog(@Current InjectionPoint injectionPoint)
+ {
+ Log log = null;
+ String category = null;
+ category = injectionPoint.getAnnotation(Logger.class).value();
+ if (category.isEmpty())
+ {
+ log = Logging.getLog((Class<?>)
injectionPoint.getMember().getDeclaringClass());
+ }
+ else
+ {
+ log = Logging.getLog(category);
+ }
+ return log;
+ }
+}
Property changes on:
extensions/trunk/logger/src/main/java/org/jboss/webbeans/log/LoggerProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Finch.java
===================================================================
---
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Finch.java 2009-04-06
08:54:23 UTC (rev 2311)
+++
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Finch.java 2009-04-06
12:20:13 UTC (rev 2312)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test.log;
-import org.jboss.webbeans.annotation.Logger;
import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
public class Finch
{
Modified:
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java
===================================================================
---
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java 2009-04-06
08:54:23 UTC (rev 2311)
+++
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java 2009-04-06
12:20:13 UTC (rev 2312)
@@ -17,8 +17,6 @@
package org.jboss.webbeans.test.log;
-import javax.inject.ExecutionException;
-
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.webbeans.test.AbstractLogTest;
@@ -30,7 +28,7 @@
* @author David Allen
*/
@Artifact
-@Classes(packages = { "org.jboss.webbeans.producer",
"org.jboss.webbeans.test.log" })
+@Classes(packages = { "org.jboss.webbeans.log",
"org.jboss.webbeans.test.log" })
public class LoggerInjectionTest extends AbstractLogTest
{
@Test
Modified: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java
===================================================================
---
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java 2009-04-06
08:54:23 UTC (rev 2311)
+++
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java 2009-04-06
12:20:13 UTC (rev 2312)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test.log;
-import org.jboss.webbeans.annotation.Logger;
import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
class Sparrow
{