Weld SVN: r5099 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-18 10:56:48 -0500 (Wed, 18 Nov 2009)
New Revision: 5099
Modified:
doc/trunk/reference/en-US/environments.xml
doc/trunk/reference/en-US/extend.xml
Log:
minor fixes
Modified: doc/trunk/reference/en-US/environments.xml
===================================================================
--- doc/trunk/reference/en-US/environments.xml 2009-11-18 15:49:28 UTC (rev 5098)
+++ doc/trunk/reference/en-US/environments.xml 2009-11-18 15:56:48 UTC (rev 5099)
@@ -256,7 +256,7 @@
</listitem>
<listitem>
<para>
- Decorators
+ Interceptors and decorators
</para>
</listitem>
<listitem>
Modified: doc/trunk/reference/en-US/extend.xml
===================================================================
--- doc/trunk/reference/en-US/extend.xml 2009-11-18 15:49:28 UTC (rev 5098)
+++ doc/trunk/reference/en-US/extend.xml 2009-11-18 15:56:48 UTC (rev 5099)
@@ -620,6 +620,9 @@
catch (NoSuchFieldException nsfe) {
pit.addDefinitionError(nsfe);
}
+ finally {
+ stream.close();
+ }
}
}
catch (IOException ioe) {
14 years, 7 months
Weld SVN: r5098 - in core/trunk/tests/src/test: java/org/jboss/weld/tests/decorators/stackoverflow and 3 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-18 10:49:28 -0500 (Wed, 18 Nov 2009)
New Revision: 5098
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/stackoverflow/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/stackoverflow/beans.xml
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java
Log:
add tests
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java 2009-11-18 15:49:28 UTC (rev 5098)
@@ -0,0 +1,23 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.weld.tests.decorators.stackoverflow;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Factory class that produces Logger for a given be to injected class
+ *
+ * @author wayne
+ */
+public class LogFacatory {
+ @Produces
+ public Logger getLogger(InjectionPoint ip){
+ return LoggerFactory.getLogger(ip.getMember().getDeclaringClass());
+ }
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java 2009-11-18 15:49:28 UTC (rev 5098)
@@ -0,0 +1,16 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.weld.tests.decorators.stackoverflow;
+
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author wayne
+ */
+public interface PaymentService {
+ boolean pay(String account, BigDecimal amount);
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java 2009-11-18 15:49:28 UTC (rev 5098)
@@ -0,0 +1,39 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.weld.tests.decorators.stackoverflow;
+
+import java.math.BigDecimal;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+import org.slf4j.Logger;
+
+/**
+ * Secure PaymentService implemented by decator
+ *
+ * @author wayne
+ */
+@Decorator
+class SecurePaymentService implements PaymentService
+{
+ @Inject
+ private Logger logger;
+
+ @Inject
+ @Delegate
+ @SimpleService
+ private PaymentService paymentService;
+
+ public boolean pay(String account, BigDecimal amount)
+ {
+ logger.info("I'm a secure payment service");
+
+ return paymentService.pay(account, amount);
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java 2009-11-18 15:49:28 UTC (rev 5098)
@@ -0,0 +1,32 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.weld.tests.decorators.stackoverflow;
+
+import java.math.BigDecimal;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.slf4j.Logger;
+
+/**
+ *
+ * @author wayne
+ */
+@SimpleService
+@ApplicationScoped
+public class SimplePaymentService implements PaymentService
+{
+ @Inject
+ Logger logger;
+
+ public boolean pay(String account, BigDecimal amount)
+ {
+ logger.info("Pay ${} for {}.", amount, account);
+
+ return true;
+ }
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java 2009-11-18 15:49:28 UTC (rev 5098)
@@ -0,0 +1,23 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.weld.tests.decorators.stackoverflow;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author wayne
+ */
+@Qualifier
+(a)Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface SimpleService {
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java 2009-11-18 15:49:28 UTC (rev 5098)
@@ -0,0 +1,23 @@
+package org.jboss.weld.tests.decorators.stackoverflow;
+
+import java.math.BigDecimal;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.Test;
+
+@Artifact
+@BeansXml("beans.xml")
+public class StackOverFlowTest extends AbstractWeldTest
+{
+
+ @Test(description="WELD-296", groups="broken")
+ public void test()
+ {
+ getCurrentManager().getInstanceByType(PaymentService.class, new AnnotationLiteral<SimpleService>() {}).pay("Pete", new BigDecimal(100));
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java 2009-11-18 12:44:14 UTC (rev 5097)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java 2009-11-18 15:49:28 UTC (rev 5098)
@@ -28,7 +28,6 @@
assert Container.instance().getStatus().equals(Status.VALIDATED);
container.stopContainer();
assert !Container.available();
- assert Container.instance().getStatus().equals(Status.SHUTDOWN);
}
}
Added: core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/stackoverflow/beans.xml
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/stackoverflow/beans.xml (rev 0)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/stackoverflow/beans.xml 2009-11-18 15:49:28 UTC (rev 5098)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans>
+ <decorators>
+ <class>org.jboss.weld.tests.decorators.stackoverflow.SecurePaymentService</class>
+ </decorators>
+</beans>
\ No newline at end of file
Property changes on: core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/stackoverflow/beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 7 months
Weld SVN: r5097 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-18 07:44:14 -0500 (Wed, 18 Nov 2009)
New Revision: 5097
Modified:
doc/trunk/reference/en-US/extensions.xml
Log:
import
Modified: doc/trunk/reference/en-US/extensions.xml
===================================================================
--- doc/trunk/reference/en-US/extensions.xml 2009-11-18 07:36:16 UTC (rev 5096)
+++ doc/trunk/reference/en-US/extensions.xml 2009-11-18 12:44:14 UTC (rev 5097)
@@ -23,6 +23,7 @@
</para>
<programlisting role="JAVA"><![CDATA[import org.slf4j.Logger;
+import javax.inject.Inject;
public class Checkout {
private @Inject Logger log;
14 years, 7 months
Weld SVN: r5096 - in core/tags/glassfish-integration/1.0.0-SP1: bom and 8 other directories.
by weld-commits@lists.jboss.org
Author: rogerk
Date: 2009-11-18 02:36:16 -0500 (Wed, 18 Nov 2009)
New Revision: 5096
Modified:
core/tags/glassfish-integration/1.0.0-SP1/bom/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/embedded-tck-runner/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/impl/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/inject-tck-runner/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/jboss-tck-runner/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/osgi-bundle/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/parent/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/porting-package/pom.xml
core/tags/glassfish-integration/1.0.0-SP1/tests/pom.xml
Log:
1.0.0 SP1 Tag
Modified: core/tags/glassfish-integration/1.0.0-SP1/bom/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/bom/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/bom/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -3,7 +3,7 @@
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-bom</artifactId>
<packaging>pom</packaging>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<parent>
<groupId>org.jboss.weld</groupId>
@@ -175,9 +175,9 @@
<!-- SCM and distribution management -->
<scm>
- <connection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/1.0.0/bom</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/branches/1.0.0/bom</developerConnection>
- <url>https://svn.jboss.org/repos/weld/core/tags/1.0.0/core/bom</url>
+ <connection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</developerConnection>
+ <url>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</url>
</scm>
</project>
Modified: core/tags/glassfish-integration/1.0.0-SP1/embedded-tck-runner/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/embedded-tck-runner/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/embedded-tck-runner/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.weld</groupId>
Modified: core/tags/glassfish-integration/1.0.0-SP1/impl/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/impl/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/impl/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP1/inject-tck-runner/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/inject-tck-runner/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/inject-tck-runner/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP1/jboss-tck-runner/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/jboss-tck-runner/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/jboss-tck-runner/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP1/osgi-bundle/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/osgi-bundle/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/osgi-bundle/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -16,7 +16,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP1/parent/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/parent/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/parent/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-bom</artifactId>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<relativePath>../bom</relativePath>
</parent>
Modified: core/tags/glassfish-integration/1.0.0-SP1/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -3,7 +3,7 @@
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-build-aggregator</artifactId>
<packaging>pom</packaging>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<parent>
<groupId>org.jboss.weld</groupId>
@@ -18,9 +18,9 @@
<!-- SCM and distribution management -->
<scm>
- <connection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/1.0.0</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/branches/1.0.0</developerConnection>
- <url>https://svn.jboss.org/repos/weld/core/tags/1.0.0</url>
+ <connection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</developerConnection>
+ <url>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</url>
</scm>
<profiles>
Modified: core/tags/glassfish-integration/1.0.0-SP1/porting-package/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/porting-package/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/porting-package/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP1/tests/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP1/tests/pom.xml 2009-11-18 07:00:02 UTC (rev 5095)
+++ core/tags/glassfish-integration/1.0.0-SP1/tests/pom.xml 2009-11-18 07:36:16 UTC (rev 5096)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
14 years, 7 months
Weld SVN: r5095 - core/tags/glassfish-integration.
by weld-commits@lists.jboss.org
Author: rogerk
Date: 2009-11-18 02:00:02 -0500 (Wed, 18 Nov 2009)
New Revision: 5095
Added:
core/tags/glassfish-integration/1.0.0-SP1/
Log:
1.0.0-SP1 tag
Copied: core/tags/glassfish-integration/1.0.0-SP1 (from rev 5094, core/branches/1.0.0)
14 years, 7 months
Weld SVN: r5094 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-17 22:55:42 -0500 (Tue, 17 Nov 2009)
New Revision: 5094
Modified:
doc/trunk/reference/en-US/extensions.xml
Log:
fix
Modified: doc/trunk/reference/en-US/extensions.xml
===================================================================
--- doc/trunk/reference/en-US/extensions.xml 2009-11-18 03:47:29 UTC (rev 5093)
+++ doc/trunk/reference/en-US/extensions.xml 2009-11-18 03:55:42 UTC (rev 5094)
@@ -35,8 +35,8 @@
}]]></programlisting>
<para>
- The example shows how objects can be interpolated into a message. If you use this approach, you do not need to
- surround a call to the logger with a condition like <emphasis>if ( log.isDebugEnabled() )</emphasis> to
+ The example shows how objects can be interpolated into a message. If you use this approach, you do not need
+ to surround a call to the logger with a condition like <literal>if ( log.isDebugEnabled() )</literal> to
avoid string concatenation.
</para>
14 years, 7 months
Weld SVN: r5093 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-17 22:47:29 -0500 (Tue, 17 Nov 2009)
New Revision: 5093
Modified:
doc/trunk/reference/en-US/extensions.xml
Log:
waffle
Modified: doc/trunk/reference/en-US/extensions.xml
===================================================================
--- doc/trunk/reference/en-US/extensions.xml 2009-11-18 03:37:04 UTC (rev 5092)
+++ doc/trunk/reference/en-US/extensions.xml 2009-11-18 03:47:29 UTC (rev 5093)
@@ -35,15 +35,9 @@
}]]></programlisting>
<para>
- The example shows how objects can be interpolated into a message. This interpolation is done using
- <emphasis>java.text.MessageFormat</emphasis>, so see the JavaDoc for that class for more details. In this case,
- the <literal>ShoppingCart</literal> should have implemented the <emphasis>toString()</emphasis> method to
- produce a human readable value that is meaningful in messages. Normally, this call would have involved
- evaluating cart.toString() with String concatenation to produce a single String argument. Thus it was necessary
- to surround the call with an if-statement using the condition <emphasis>log.isDebugEnabled()</emphasis> to
- avoid the expensive String concatenation if the message was not actually going to be used. However, when using
- <literal>@Logger</literal>-injected logging, the conditional test can be left out since the object arguments
- are not evaluated unless the message is going to be logged.
+ The example shows how objects can be interpolated into a message. If you use this approach, you do not need to
+ surround a call to the logger with a condition like <emphasis>if ( log.isDebugEnabled() )</emphasis> to
+ avoid string concatenation.
</para>
<note>
14 years, 7 months
Weld SVN: r5092 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-17 22:37:04 -0500 (Tue, 17 Nov 2009)
New Revision: 5092
Modified:
doc/trunk/reference/en-US/extensions.xml
Log:
fix docs for logger
Modified: doc/trunk/reference/en-US/extensions.xml
===================================================================
--- doc/trunk/reference/en-US/extensions.xml 2009-11-18 03:10:00 UTC (rev 5091)
+++ doc/trunk/reference/en-US/extensions.xml 2009-11-18 03:37:04 UTC (rev 5092)
@@ -18,21 +18,19 @@
<para>
Adding logging to your application is now even easier with simple injection of a logger object into any CDI
- bean. Simply annotate a <literal>org.jboss.weld.log.Log</literal> type member with the
- <emphasis>@Logger</emphasis> qualifier annotation and an appropriate logger object will be injected into any
- instance of the bean.
+ bean. Simply create an injection point of type <literal>org.slf4j.Logger</literal> and an appropriate logger
+ object will be injected into any instance of the bean.
</para>
- <programlisting role="JAVA"><![CDATA[import org.jboss.weld.annotation.Logger;
-import org.jboss.weld.log.Log;
+ <programlisting role="JAVA"><![CDATA[import org.slf4j.Logger;
public class Checkout {
- private @Inject @Logger Log log;
+ private @Inject Logger log;
public void invoiceItems() {
ShoppingCart cart;
...
- log.debug("Items invoiced for {0}", cart);
+ log.debug("Items invoiced for {}", cart);
}
}]]></programlisting>
@@ -50,9 +48,9 @@
<note>
<para>
- You can add the Weld Logger to your project by including weld-logger.jar, sl4j-api.jar and sl4j-jdk14.jar to
- your project. Alternatively, express a dependency on the <literal>org.jboss.weld:weld-logger</literal> Maven
- artifact.
+ You can add Weld logging to your project by including weld-logger.jar, sl4j-api.jar and sl4j-jdk14.jar to
+ your project. Alternatively, express a dependency on the <literal>org.jboss.weld:weld-logger</literal>
+ Maven artifact.
</para>
<para>
If you are using Weld as your JSR-299 implementation, there's no need to include sl4j as it's already
14 years, 7 months
Weld SVN: r5091 - in api/trunk/cdi/src/main/java/javax/enterprise: inject and 1 other directory.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-17 22:10:00 -0500 (Tue, 17 Nov 2009)
New Revision: 5091
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/event/Observes.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/Disposes.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/Produces.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/package-info.java
Log:
javadoc injection points
Modified: api/trunk/cdi/src/main/java/javax/enterprise/event/Observes.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/event/Observes.java 2009-11-17 17:14:26 UTC (rev 5090)
+++ api/trunk/cdi/src/main/java/javax/enterprise/event/Observes.java 2009-11-18 03:10:00 UTC (rev 5091)
@@ -50,6 +50,14 @@
*
* <p>The event parameter type may contain a type variable or wildcard.</p>
*
+ * <p>In addition to the event parameter, observer methods may declare
+ * additional parameters, which may declare qualifiers. These additional
+ * parameters are injection points.</p>
+ *
+ * <pre>
+ * public void afterLogin(@Observes LoggedInEvent event, @Manager User user, Logger log) { ... }
+ * </pre>
+ *
* <p>A bean (or extension) may declare multiple observer methods.</p>
*
* <p>Observer methods are inherited by bean subclasses.</p>
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Disposes.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Disposes.java 2009-11-17 17:14:26 UTC (rev 5090)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Disposes.java 2009-11-18 03:10:00 UTC (rev 5091)
@@ -64,6 +64,14 @@
* same bean class, the container must call this method when
* destroying any instance returned by that producer method.</p>
*
+ * <p>In addition to the disposed parameter, a disposer method
+ * may declare additional parameters, which may also specify
+ * qualifiers. These additional parameters are injection points.</p>
+ *
+ * <pre>
+ * public void close(@Disposes @UserDatabase EntityManager em, Logger log) { ... }
+ * </pre>
+ *
* <p>A disposer method may resolve to multiple producer
* methods declared by the bean class, in which case the
* container must call it when destroying any instance
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Produces.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Produces.java 2009-11-17 17:14:26 UTC (rev 5090)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Produces.java 2009-11-18 03:10:00 UTC (rev 5091)
@@ -74,7 +74,20 @@
* <p>If the producer method return type or producer field type is
* a parameterized type with a type variable, it must have scope
* {@link javax.enterprise.context.Dependent @Dependent}.</p>
+ *
+ * <p>A producer method may have any number of parameters. All
+ * producer method parameters are injection points.</p>
*
+ * <pre>public class OrderFactory {
+ *
+ * @Produces @ConversationScoped
+ * public Order createCurrentOrder(@New(Order.class) Order order, @Selected Product product) {
+ * order.setProduct(product);
+ * return order;
+ * }
+ *
+ * }</pre>
+
* <p>A bean may declare multiple producer methods or fields.</p>
*
* <p>Producer methods and fields are not inherited by bean subclasses.</p>
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/package-info.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/package-info.java 2009-11-17 17:14:26 UTC (rev 5090)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/package-info.java 2009-11-18 03:10:00 UTC (rev 5091)
@@ -360,6 +360,33 @@
* according to the class accessibility requirements of the module architecture.</li>
* </ul>
*
+ * <h3>Injection points</h3>
+ *
+ * <p>The following kinds of injection point exist:<p>
+ *
+ * <ul>
+ * <li>When the container instantiates a bean class, it calls the bean constructor.
+ * The bean constructor is a constructor of the bean class. The bean constructor may
+ * be identified by annotating the constructor
+ * {@link javax.inject.Inject @javax.inject.Inject}. If a bean class does not
+ * explicitly declare a constructor using <tt>@Inject</tt>, the constructor that
+ * accepts no parameters is the bean constructor. A bean constructor may have any number
+ * of parameters. All parameters of a bean constructor are injection points.</li>
+ * <li>An injected field is a non-static, non-final field of a bean class, or of any
+ * Java EE component class supporting injection. An injected field may be declared by
+ * annotating the field {@link javax.inject.Inject @javax.inject.Inject}.</li>
+ * <li>An initializer method is a non-abstract, non-static, non-generic method of a
+ * bean class, or of any Java EE component class supporting injection. If the bean is
+ * a session bean, the initializer method is not required to be a business method of
+ * the session bean. An initializer method may be declared by annotating the method
+ * {@link javax.inject.Inject @javax.inject.Inject}. An initializer method may
+ * have any number of parameters. All initializer method parameters are injection
+ * points.</li>
+ * <li>Finally, parameters of {@linkplain javax.enterprise.inject.Produces producer methods},
+ * {@linkplain javax.enterprise.inject.Disposes diposer methods} and
+ * {@linkplain javax.enterprise.event.Observes observer methods} are injection points.</li>
+ * </ul>
+ *
* <h3>Dependency injection</h3>
*
* <p>A bean is assignable to a given injection point if:</p>
14 years, 7 months
Weld SVN: r5090 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-17 12:14:26 -0500 (Tue, 17 Nov 2009)
New Revision: 5090
Modified:
doc/trunk/reference/en-US/extend.xml
Log:
example
Modified: doc/trunk/reference/en-US/extend.xml
===================================================================
--- doc/trunk/reference/en-US/extend.xml 2009-11-17 09:40:06 UTC (rev 5089)
+++ doc/trunk/reference/en-US/extend.xml 2009-11-17 17:14:26 UTC (rev 5090)
@@ -568,34 +568,113 @@
to intercept any of these operations when they are invoked by the container.
</para>
- <programlisting role="JAVA"><![CDATA[class LogServletCreationExtension implements Extension {
+ <para>
+ Here's a CDI portable extension that reads values from properties files and configures fields of Java EE components,
+ including servlets, EJBs, managed beans, interceptors and more. In this example, properties for a class such as
+ <literal>org.mydomain.blog.Blogger</literal> go in a resource named <literal>org/mydomain/blog/Blogger.properties</literal>,
+ and the name of a property must match the name of the field to be configured. So <literal>Blogger.properties</literal>
+ could contain:
+ </para>
+
+ <programlisting>firstName=Gavin
+lastName=King</programlisting>
+
+ <para>The portable extension works by wrapping the containers <literal>InjectionTarget</literal> and setting field
+ values from the <literal>inject()</literal> method.</para>
- <T extends Servlet> void processServlet(ProcessInjectionTarget<T> pit) {
-
- //wrap this to intercept the component lifecycle
- final InjectionTarget<T> it = pit.getInjectionTarget();
-
- InjectionTarget<T> wrapped = new InjectionTarget<T>() {
-
- @Override
- public T produce(CreationalContext<T> ctx) {
- Logger.global.debug("instantiating a servlet");
- return it.produce(ctx);
- }
-
- @Override
- public void inject(T instance, CreationalContext<T> ctx) {
- Logger.global.debug("injecting servlet dependencies");
- it.inject(instance, ctx);
- }
-
- //remaining methods of InjectionTarget
- ...
- }
-
- pit.setInjectionTarget(wrapped);
- }
-
+ <programlisting role="JAVA"><![CDATA[public class ConfigExtension implements Extension {
+
+ <X> void processInjectionTarget(ProcessInjectionTarget<X> pit) {
+
+ //wrap this to intercept the component lifecycle
+ final InjectionTarget<X> it = pit.getInjectionTarget();
+
+ final Map<Field, Object> configuredValues = new HashMap<Field, Object>();
+
+ //use this to read annotations of the class and its members
+ AnnotatedType<X> at = pit.getAnnotatedType();
+
+ //read the properties file
+ String propsFileName = at.getClass().getSimpleName() + ".properties";
+ InputStream stream = at.getJavaClass().getResourceAsStream(propsFileName);
+ if (stream!=null) {
+
+ try {
+ Properties props = new Properties();
+ props.load(stream);
+ for (Map.Entry<Object, Object> property : props.entrySet()) {
+ String fieldName = property.getKey().toString();
+ Object value = property.getValue();
+ try {
+ Field field = at.getJavaClass().getField(fieldName);
+ field.setAccessible(true);
+ if ( field.getType().isAssignableFrom( value.getClass() ) ) {
+ configuredValues.put(field, value);
+ }
+ else {
+ //TODO: do type conversion automatically
+ pit.addDefinitionError( new InjectionException(
+ "field is not of type String: " + field ) );
+ }
+ }
+ catch (NoSuchFieldException nsfe) {
+ pit.addDefinitionError(nsfe);
+ }
+ }
+ }
+ catch (IOException ioe) {
+ pit.addDefinitionError(ioe);
+ }
+ }
+
+ InjectionTarget<X> wrapped = new InjectionTarget<X>() {
+
+ @Override
+ public void inject(X instance, CreationalContext<X> ctx) {
+ it.inject(instance, ctx);
+
+ //set the values onto the new instance of the component
+ for (Map.Entry<Field, Object> configuredValue: configuredValues.entrySet()) {
+ try {
+ configuredValue.getKey().set(instance, configuredValue.getValue());
+ }
+ catch (Exception e) {
+ throw new InjectionException(e);
+ }
+ }
+ }
+
+ @Override
+ public void postConstruct(X instance) {
+ it.postConstruct(instance);
+ }
+
+ @Override
+ public void preDestroy(X instance) {
+ it.dispose(instance);
+ }
+
+ @Override
+ public void dispose(X instance) {
+ it.dispose(instance);
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints() {
+ return it.getInjectionPoints();
+ }
+
+ @Override
+ public X produce(CreationalContext<X> ctx) {
+ return it.produce(ctx);
+ }
+
+ };
+
+ pit.setInjectionTarget(wrapped);
+
+ }
+
}]]></programlisting>
<para>
14 years, 7 months