Weld SVN: r6756 - extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util.
by weld-commits@lists.jboss.org
Author: swd847
Date: 2010-07-22 16:18:23 -0400 (Thu, 22 Jul 2010)
New Revision: 6756
Modified:
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java
Log:
change to Reflections.classForName
Modified: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java 2010-07-22 17:06:40 UTC (rev 6755)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java 2010-07-22 20:18:23 UTC (rev 6756)
@@ -217,11 +217,11 @@
public static Class classForName(String name) throws ClassNotFoundException
{
- try
+ if (Thread.currentThread().getContextClassLoader() != null)
{
return Thread.currentThread().getContextClassLoader().loadClass(name);
}
- catch (Exception e)
+ else
{
return Class.forName(name);
}
14 years, 3 months
Weld SVN: r6755 - core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2010-07-22 13:06:40 -0400 (Thu, 22 Jul 2010)
New Revision: 6755
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
Log:
Fix the TypeSafeResolver so that the equals implementation for Key works correctly. Any Resolvable implementation must now implement their own equals and hashCode.
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java 2010-07-22 16:40:17 UTC (rev 6754)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java 2010-07-22 17:06:40 UTC (rev 6755)
@@ -28,6 +28,10 @@
// do nothing
}
+ public void pass()
+ {
+
+ }
public Attacker cloneMe()
{
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java 2010-07-22 16:40:17 UTC (rev 6754)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java 2010-07-22 17:06:40 UTC (rev 6755)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.interceptors.hierarchical;
import org.jboss.testharness.impl.packaging.Artifact;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java 2010-07-22 16:40:17 UTC (rev 6754)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java 2010-07-22 17:06:40 UTC (rev 6755)
@@ -26,6 +26,11 @@
}
+ public void receiveInstructions()
+ {
+
+ }
+
public Player cloneMe()
{
return this;
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java 2010-07-22 17:06:40 UTC (rev 6755)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.interceptors.hierarchical;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.weld.util.Beans;
+import org.testng.annotations.Test;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Artifact
+public class SimpleWeldClassTest extends AbstractWeldTest
+{
+
+ @Test(groups = "broken")
+ public void testWeldClassForCovariantReturnType()
+ {
+ WeldClass<Attacker> weldClass = WeldClassImpl.of(Attacker.class, new ClassTransformer(new TypeStore()));
+ Collection methods = weldClass.getWeldMethods();
+ assert methods.size() == 4;
+ List<WeldMethod<?,?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
+ assert methods.size() == 4;
+ }
+
+}
14 years, 3 months
Weld SVN: r6754 - in core/trunk/tests/src/test: java/org/jboss/weld/tests/interceptors/hierarchical and 2 other directories.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2010-07-22 12:40:17 -0400 (Thu, 22 Jul 2010)
New Revision: 6754
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Defender.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/beans.xml
Log:
Tests for WELD-568
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java 2010-07-22 16:40:17 UTC (rev 6754)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.interceptors.hierarchical;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Play
+public class Attacker extends Player
+{
+
+ public void playBall()
+ {
+ // do nothing
+ }
+
+
+ public Attacker cloneMe()
+ {
+ return this;
+ }
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Defender.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Defender.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Defender.java 2010-07-22 16:40:17 UTC (rev 6754)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.interceptors.hierarchical;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Interceptor @Play
+public class Defender
+{
+ static int invocationsCount = 0;
+
+ @AroundInvoke
+ public Object tackle(InvocationContext invocationContext) throws Exception
+ {
+ invocationsCount ++;
+ return invocationContext.proceed();
+ }
+}
\ No newline at end of file
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java 2010-07-22 16:40:17 UTC (rev 6754)
@@ -0,0 +1,30 @@
+package org.jboss.weld.tests.interceptors.hierarchical;
+
+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.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Artifact
+@BeansXml("beans.xml")
+public class InterceptorsWithHierarchyTest extends AbstractWeldTest
+{
+ @BeforeClass
+ public static void initialize()
+ {
+ Defender.invocationsCount = 0;
+ }
+
+ @Test(groups = "broken")
+ public void testInterceptorsWithHierarchy()
+ {
+ Attacker player = this.getReference(Attacker.class);
+ player.cloneMe();
+ assert Defender.invocationsCount == 1;
+ }
+
+}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java (from rev 6741, core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/ejb/Pass.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java 2010-07-22 16:40:17 UTC (rev 6754)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.interceptors.hierarchical;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@InterceptorBinding
+@Retention(RUNTIME)
+(a)Target({ElementType.METHOD, ElementType.TYPE})
+@Documented
+public @interface Play
+{
+}
\ No newline at end of file
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java 2010-07-22 16:40:17 UTC (rev 6754)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.interceptors.hierarchical;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class Player
+{
+ public void playBall()
+ {
+
+ }
+
+ public Player cloneMe()
+ {
+ return this;
+ }
+}
Copied: core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/beans.xml (from rev 6741, core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/ejb/beans.xml)
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/beans.xml (rev 0)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/beans.xml 2010-07-22 16:40:17 UTC (rev 6754)
@@ -0,0 +1,5 @@
+<beans>
+ <interceptors>
+ <class>org.jboss.weld.tests.interceptors.hierarchical.Defender</class>
+ </interceptors>
+</beans>
14 years, 3 months
Weld SVN: r6753 - extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/defaultbean.
by weld-commits@lists.jboss.org
Author: swd847
Date: 2010-07-22 06:46:17 -0400 (Thu, 22 Jul 2010)
New Revision: 6753
Modified:
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/defaultbean/DefaultBeanExtension.java
Log:
fix logging bug
Modified: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/defaultbean/DefaultBeanExtension.java
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/defaultbean/DefaultBeanExtension.java 2010-07-22 10:21:24 UTC (rev 6752)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/defaultbean/DefaultBeanExtension.java 2010-07-22 10:46:17 UTC (rev 6753)
@@ -60,6 +60,8 @@
private static final Set<DefaultBeanDefinition> beans = new HashSet<DefaultBeanDefinition>();
+ private boolean beanDiscoveryOver = false;
+
/**
* Adds a default bean with the {@link Default} qualifier
*/
@@ -78,6 +80,10 @@
public void processBean(@Observes ProcessBean<?> event)
{
+ if (beanDiscoveryOver)
+ {
+ return;
+ }
Iterator<DefaultBeanDefinition> it = beans.iterator();
while (it.hasNext())
{
@@ -92,6 +98,7 @@
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event)
{
+ beanDiscoveryOver = true;
for (DefaultBeanDefinition d : beans)
{
log.info("Installing default bean " + d.getDefaultBean());
14 years, 3 months
Weld SVN: r6752 - in extensions/trunk: docs and 8 other directories.
by weld-commits@lists.jboss.org
Author: swd847
Date: 2010-07-22 06:21:24 -0400 (Thu, 22 Jul 2010)
New Revision: 6752
Added:
extensions/trunk/docs/
extensions/trunk/docs/README.TXT
extensions/trunk/docs/pom.xml
extensions/trunk/docs/src/
extensions/trunk/docs/src/main/
extensions/trunk/docs/src/main/assembly/
extensions/trunk/docs/src/main/assembly/assembly.xml
extensions/trunk/docs/src/main/docbook/
extensions/trunk/docs/src/main/docbook/en-US/
extensions/trunk/docs/src/main/docbook/en-US/master.xml
extensions/trunk/docs/src/main/docbook/en-US/weld-extensions.xml
extensions/trunk/impl/
extensions/trunk/impl/pom.xml
extensions/trunk/impl/src/
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/DummyInjectionTarget.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java
Removed:
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java
extensions/trunk/src/
Modified:
extensions/trunk/pom.xml
Log:
refactored weld-extensions structure
Property changes on: extensions/trunk/docs
___________________________________________________________________
Name: svn:ignore
+ .settings
.classpath
.project
target
Added: extensions/trunk/docs/README.TXT
===================================================================
--- extensions/trunk/docs/README.TXT (rev 0)
+++ extensions/trunk/docs/README.TXT 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,3 @@
+To build the Weld Extensions docs run the following command:
+
+mvn jdocbook:generate
Added: extensions/trunk/docs/pom.xml
===================================================================
--- extensions/trunk/docs/pom.xml (rev 0)
+++ extensions/trunk/docs/pom.xml 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,82 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.jboss.weld.extensions</groupId>
+ <artifactId>weld-extensions-reference-guide</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+ <name>Weld Extensions Reference Guide</name>
+
+ <properties>
+ <pdf.name>weld-extensions-reference.pdf</pdf.name>
+ <weld.docbook.version>1.1.1-Beta5</weld.docbook.version>
+ </properties>
+
+ <build>
+ <defaultGoal>process-classes</defaultGoal>
+ <plugins>
+
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ </plugin>
+
+ <!-- Attach docs as a war so dist can retrieve them -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-zip</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.outputDirectory}/${project.artifactId}-${project.version}.war</file>
+ <type>war</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>distribution</id>
+ <activation>
+ <property>
+ <name>release</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/weld/extensions/trunk/doc</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/extensions/trunk/docs</developerConnection>
+ <url>http://fisheye.jboss.org/browse/weld/extensions/trunk/docs</url>
+ </scm>
+</project>
Added: extensions/trunk/docs/src/main/assembly/assembly.xml
===================================================================
--- extensions/trunk/docs/src/main/assembly/assembly.xml (rev 0)
+++ extensions/trunk/docs/src/main/assembly/assembly.xml 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,17 @@
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>sources</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <baseDirectory>${project.artifactId}</baseDirectory>
+ <fileSets>
+ <fileSet>
+ <outputDirectory>.</outputDirectory>
+ <directory>${project.basedir}/src/main/docbook/en-US</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: extensions/trunk/docs/src/main/docbook/en-US/master.xml
===================================================================
--- extensions/trunk/docs/src/main/docbook/en-US/master.xml (rev 0)
+++ extensions/trunk/docs/src/main/docbook/en-US/master.xml 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding="utf-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.35//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
+<book lang="en">
+
+ <toc/>
+
+ <title>Weld Extensions</title>
+ <xi:include href="weld-extensions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+</book>
\ No newline at end of file
Added: extensions/trunk/docs/src/main/docbook/en-US/weld-extensions.xml
===================================================================
--- extensions/trunk/docs/src/main/docbook/en-US/weld-extensions.xml (rev 0)
+++ extensions/trunk/docs/src/main/docbook/en-US/weld-extensions.xml 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
+<chapter id="xml">
+ <title>Weld Extensions</title>
+
+
+</chapter>
Property changes on: extensions/trunk/docs/src/main/docbook/en-US/weld-extensions.xml
___________________________________________________________________
Name: svn:executable
+ *
Property changes on: extensions/trunk/impl
___________________________________________________________________
Name: svn:ignore
+ target
.settings
.classpath
.project
Copied: extensions/trunk/impl/pom.xml (from rev 6741, extensions/trunk/pom.xml)
===================================================================
--- extensions/trunk/impl/pom.xml (rev 0)
+++ extensions/trunk/impl/pom.xml 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,211 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <name>Weld Extensions</name>
+ <url>http://www.seamframework.org/Weld</url>
+
+ <description>Portable extensions for CDI</description>
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>https://jira.jboss.org/jira/browse/WELDX/component/12312756</url>
+ </issueManagement>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <distribution>repo</distribution>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
+ </license>
+ </licenses>
+
+
+ <developers>
+
+ <developer>
+ <name>Pete Muir</name>
+ <email>pete.muir(a)jboss.org</email>
+ <organization>Red Hat Inc.</organization>
+ <url>http://in.relation.to/Bloggers/Pete</url>
+ </developer>
+
+ <developer>
+ <name>Stuart Douglas</name>
+ </developer>
+
+ </developers>
+
+ <inceptionYear>2008</inceptionYear>
+
+ <organization>
+ <name>Seam Framework</name>
+ <url>http://seamframework.org</url>
+ </organization>
+
+ <ciManagement>
+ <system>Hudson</system>
+ <url />
+ </ciManagement>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-embedded</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>incontainer</id>
+ <activation>
+ <property>
+ <name>incontainer</name>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-60</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>6.0.0.20100429-M3</version>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+<!--
+ <profile>
+ <id>write-artifacts-to-disk</id>
+ <activation>
+ <property>
+ <name>dumpArtifacts</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-artifacts</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.jboss.testharness.api.TCK</mainClass>
+ <classpathScope>test</classpathScope>
+ <systemProperties>
+ <systemProperty>
+ <key>dumpArtifacts</key>
+ <value>true</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.outputDirectory</key>
+ <value>target/test-artifacts</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.libraryDirectory</key>
+ <value>target/dependency/lib</value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+-->
+ </profiles>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/weld/extensions/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/extensions/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/weld/extensions/trunk</url>
+ </scm>
+
+</project>
Copied: extensions/trunk/impl/src (from rev 6741, extensions/trunk/src)
Deleted: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java 2010-07-21 13:07:38 UTC (rev 6741)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -1,259 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.extensions.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.Default;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionTarget;
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Named;
-
-import org.jboss.weld.extensions.annotated.Annotateds;
-
-/**
- * class that can build a bean from an AnnotatedType.
- *
- * @author stuart
- *
- */
-public class BeanBuilder<T>
-{
-
- private final AnnotatedType<T> type;
- private final BeanManager beanManager;
- private InjectionTarget<T> injectionTarget;
- private String name;
- private Set<Annotation> qualifiers;
- private Class<? extends Annotation> scope;
- private Set<Class<? extends Annotation>> stereotypes;
- private Set<Type> types = new HashSet<Type>();
- private boolean alternative = false;
- private boolean nullable = false;
- private BeanLifecycle<T> beanLifecycle;
- boolean passivationCapable;
- private String id;
-
- public BeanBuilder(AnnotatedType<T> type, BeanManager beanManager)
- {
- this.type = type;
- this.beanManager = beanManager;
- }
-
- public BeanBuilder<T> defineBeanFromAnnotatedType()
- {
- if (!type.getJavaClass().isInterface())
- {
- this.injectionTarget = beanManager.createInjectionTarget(type);
- }
- this.qualifiers = new HashSet<Annotation>();
- this.stereotypes = new HashSet<Class<? extends Annotation>>();
- for (Annotation annotation : type.getAnnotations())
- {
- if (beanManager.isQualifier(annotation.annotationType()))
- {
- this.qualifiers.add(annotation);
- }
- else if (beanManager.isScope(annotation.annotationType()))
- {
- this.scope = annotation.annotationType();
- }
- else if (beanManager.isStereotype(annotation.annotationType()))
- {
- this.stereotypes.add(annotation.annotationType());
- }
- if (annotation instanceof Named)
- {
- this.name = ((Named) annotation).value();
- }
- if (annotation instanceof Alternative)
- {
- this.alternative = true;
- }
- }
- if (this.scope == null)
- {
- this.scope = Dependent.class;
- }
- for (Class<?> c = type.getJavaClass(); c != Object.class && c != null; c = c.getSuperclass())
- {
- this.types.add(c);
- }
- for (Class<?> i : type.getJavaClass().getInterfaces())
- {
- this.types.add(i);
- }
- if (qualifiers.isEmpty())
- {
- qualifiers.add(new AnnotationLiteral<Default>()
- {
- });
- }
- this.beanLifecycle = new BeanLifecycleImpl<T>();
- this.id = BeanImpl.class.getName() + ":" + Annotateds.createTypeId(type);
- return this;
- }
-
- public Bean<T> create()
- {
- if (!passivationCapable)
- {
- return new BeanImpl<T>(type.getJavaClass(), injectionTarget, name, qualifiers, scope, stereotypes, types, alternative, nullable, beanLifecycle);
- }
- return new PassivationCapableBeanImpl<T>(id, type.getJavaClass(), injectionTarget, name, qualifiers, scope, stereotypes, types, alternative, nullable, beanLifecycle);
-
- }
-
- public InjectionTarget<T> getInjectionTarget()
- {
- return injectionTarget;
- }
-
- public BeanBuilder<T> setInjectionTarget(InjectionTarget<T> injectionTarget)
- {
- this.injectionTarget = injectionTarget;
- return this;
- }
- public Set<Annotation> getQualifiers()
- {
- return qualifiers;
- }
-
- public BeanBuilder<T> setQualifiers(Set<Annotation> qualifiers)
- {
- this.qualifiers = qualifiers;
- return this;
- }
-
- public Class<? extends Annotation> getScope()
- {
- return scope;
- }
-
- public BeanBuilder<T> setScope(Class<? extends Annotation> scope)
- {
- this.scope = scope;
- return this;
- }
-
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return stereotypes;
- }
-
- public BeanBuilder<T> setStereotypes(Set<Class<? extends Annotation>> stereotypes)
- {
- this.stereotypes = stereotypes;
- return this;
- }
-
- public Set<Type> getTypes()
- {
- return types;
- }
-
- public BeanBuilder<T> setTypes(Set<Type> types)
- {
- this.types = types;
- return this;
- }
-
- public boolean isAlternative()
- {
- return alternative;
- }
-
- public BeanBuilder<T> setAlternative(boolean alternative)
- {
- this.alternative = alternative;
- return this;
- }
-
- public boolean isNullable()
- {
- return nullable;
- }
-
- public BeanBuilder<T> setNullable(boolean nullable)
- {
- this.nullable = nullable;
- return this;
- }
-
- public BeanLifecycle<T> getBeanLifecycle()
- {
- return beanLifecycle;
- }
-
- public BeanBuilder<T> setBeanLifecycle(BeanLifecycle<T> beanLifecycle)
- {
- this.beanLifecycle = beanLifecycle;
- return this;
- }
-
- public AnnotatedType<T> getType()
- {
- return type;
- }
-
- public BeanManager getBeanManager()
- {
- return beanManager;
- }
-
- public String getName()
- {
- return name;
- }
-
- public BeanBuilder<T> setName(String name)
- {
- this.name = name;
- return this;
- }
-
- public boolean isPassivationCapable()
- {
- return passivationCapable;
- }
-
- public BeanBuilder<T> setPassivationCapable(boolean passivationCapable)
- {
- this.passivationCapable = passivationCapable;
- return this;
- }
-
- public String getId()
- {
- return id;
- }
-
- public BeanBuilder<T> setId(String id)
- {
- this.id = id;
- return this;
- }
-
-}
Copied: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java (from rev 6743, extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java)
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java (rev 0)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,264 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.extensions.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Named;
+
+import org.jboss.weld.extensions.annotated.Annotateds;
+
+/**
+ * class that can build a bean from an AnnotatedType.
+ *
+ * @author stuart
+ *
+ */
+public class BeanBuilder<T>
+{
+
+ private final AnnotatedType<T> type;
+ private final BeanManager beanManager;
+ private InjectionTarget<T> injectionTarget;
+ private String name;
+ private Set<Annotation> qualifiers;
+ private Class<? extends Annotation> scope;
+ private Set<Class<? extends Annotation>> stereotypes;
+ private Set<Type> types = new HashSet<Type>();
+ private boolean alternative = false;
+ private boolean nullable = false;
+ private BeanLifecycle<T> beanLifecycle;
+ boolean passivationCapable;
+ private String id;
+
+ public BeanBuilder(AnnotatedType<T> type, BeanManager beanManager)
+ {
+ this.type = type;
+ this.beanManager = beanManager;
+ }
+
+ public BeanBuilder<T> defineBeanFromAnnotatedType()
+ {
+ if (!type.getJavaClass().isInterface())
+ {
+ this.injectionTarget = beanManager.createInjectionTarget(type);
+ }
+ else
+ {
+ this.injectionTarget = new DummyInjectionTarget<T>();
+ }
+ this.qualifiers = new HashSet<Annotation>();
+ this.stereotypes = new HashSet<Class<? extends Annotation>>();
+ for (Annotation annotation : type.getAnnotations())
+ {
+ if (beanManager.isQualifier(annotation.annotationType()))
+ {
+ this.qualifiers.add(annotation);
+ }
+ else if (beanManager.isScope(annotation.annotationType()))
+ {
+ this.scope = annotation.annotationType();
+ }
+ else if (beanManager.isStereotype(annotation.annotationType()))
+ {
+ this.stereotypes.add(annotation.annotationType());
+ }
+ if (annotation instanceof Named)
+ {
+ this.name = ((Named) annotation).value();
+ }
+ if (annotation instanceof Alternative)
+ {
+ this.alternative = true;
+ }
+ }
+ if (this.scope == null)
+ {
+ this.scope = Dependent.class;
+ }
+ for (Class<?> c = type.getJavaClass(); c != Object.class && c != null; c = c.getSuperclass())
+ {
+ this.types.add(c);
+ }
+ for (Class<?> i : type.getJavaClass().getInterfaces())
+ {
+ this.types.add(i);
+ }
+ if (qualifiers.isEmpty())
+ {
+ qualifiers.add(new AnnotationLiteral<Default>()
+ {
+ });
+ }
+ this.beanLifecycle = new BeanLifecycleImpl<T>();
+ this.id = BeanImpl.class.getName() + ":" + Annotateds.createTypeId(type);
+ return this;
+ }
+
+ public Bean<T> create()
+ {
+ if (!passivationCapable)
+ {
+ return new BeanImpl<T>(type.getJavaClass(), injectionTarget, name, qualifiers, scope, stereotypes, types, alternative, nullable, beanLifecycle);
+ }
+ return new PassivationCapableBeanImpl<T>(id, type.getJavaClass(), injectionTarget, name, qualifiers, scope, stereotypes, types, alternative, nullable, beanLifecycle);
+
+ }
+
+ public InjectionTarget<T> getInjectionTarget()
+ {
+ return injectionTarget;
+ }
+
+ public BeanBuilder<T> setInjectionTarget(InjectionTarget<T> injectionTarget)
+ {
+ this.injectionTarget = injectionTarget;
+ return this;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ public BeanBuilder<T> setQualifiers(Set<Annotation> qualifiers)
+ {
+ this.qualifiers = qualifiers;
+ return this;
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ return scope;
+ }
+
+ public BeanBuilder<T> setScope(Class<? extends Annotation> scope)
+ {
+ this.scope = scope;
+ return this;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return stereotypes;
+ }
+
+ public BeanBuilder<T> setStereotypes(Set<Class<? extends Annotation>> stereotypes)
+ {
+ this.stereotypes = stereotypes;
+ return this;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ public BeanBuilder<T> setTypes(Set<Type> types)
+ {
+ this.types = types;
+ return this;
+ }
+
+ public boolean isAlternative()
+ {
+ return alternative;
+ }
+
+ public BeanBuilder<T> setAlternative(boolean alternative)
+ {
+ this.alternative = alternative;
+ return this;
+ }
+
+ public boolean isNullable()
+ {
+ return nullable;
+ }
+
+ public BeanBuilder<T> setNullable(boolean nullable)
+ {
+ this.nullable = nullable;
+ return this;
+ }
+
+ public BeanLifecycle<T> getBeanLifecycle()
+ {
+ return beanLifecycle;
+ }
+
+ public BeanBuilder<T> setBeanLifecycle(BeanLifecycle<T> beanLifecycle)
+ {
+ this.beanLifecycle = beanLifecycle;
+ return this;
+ }
+
+ public AnnotatedType<T> getType()
+ {
+ return type;
+ }
+
+ public BeanManager getBeanManager()
+ {
+ return beanManager;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public BeanBuilder<T> setName(String name)
+ {
+ this.name = name;
+ return this;
+ }
+
+ public boolean isPassivationCapable()
+ {
+ return passivationCapable;
+ }
+
+ public BeanBuilder<T> setPassivationCapable(boolean passivationCapable)
+ {
+ this.passivationCapable = passivationCapable;
+ return this;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public BeanBuilder<T> setId(String id)
+ {
+ this.id = id;
+ return this;
+ }
+
+}
Copied: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/DummyInjectionTarget.java (from rev 6742, extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/DummyInjectionTarget.java)
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/DummyInjectionTarget.java (rev 0)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/DummyInjectionTarget.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.extensions.bean;
+
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+/**
+ * Injection target implementation that does nothing
+ *
+ * @author Stuart Douglas
+ *
+ */
+public class DummyInjectionTarget<T> implements InjectionTarget<T>
+{
+
+ public void inject(T instance, CreationalContext<T> ctx)
+ {
+ }
+
+ public void postConstruct(T instance)
+ {
+ }
+
+ public void preDestroy(T instance)
+ {
+ }
+
+ public void dispose(T instance)
+ {
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ return null;
+ }
+
+}
Copied: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java (from rev 6745, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java)
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java (rev 0)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.extensions.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+
+/**
+ * Exception thrown when more than 1 beans with the given type and qualifiers
+ * could be found
+ *
+ * @author Stuart Douglas
+ *
+ */
+public class AmbiguousBeanException extends BeanResolutionException
+{
+
+ private static final long serialVersionUID = -6513493477765900752L;
+
+ public AmbiguousBeanException(Type type, Annotation[] qualifiers, Set<Bean<?>> beans)
+ {
+ super(type, qualifiers, "More than one bean found with type " + type + "and qualifiers. Bean found: " + beans);
+ }
+
+}
Copied: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java (from rev 6745, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java)
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java (rev 0)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.extensions.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+/**
+ * Exception thrown when no beans with the given type and qualifiers could be
+ * found
+ *
+ * @author Stuart Douglas
+ *
+ */
+public class BeanNotFoundException extends BeanResolutionException
+{
+
+ private static final long serialVersionUID = -6513493477765900752L;
+
+ public BeanNotFoundException(Type type, Annotation[] qualifiers)
+ {
+ super(type, qualifiers, "No bean found with type " + type + "and qualifiers " + qualifiers);
+
+ }
+
+}
Copied: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java (from rev 6745, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java)
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java (rev 0)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.extensions.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+/**
+ * Superclass for exceptions that result from bean lookup
+ *
+ * @author Stuart Douglas
+ *
+ */
+public class BeanResolutionException extends Exception
+{
+ private static final long serialVersionUID = -4376259139316630962L;
+ private final Type type;
+ private final Annotation[] qualifiers;
+
+ public BeanResolutionException(Type type, Annotation[] qualifiers, String message)
+ {
+ this.type = type;
+ this.qualifiers = qualifiers;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public Annotation[] getQualifiers()
+ {
+ return qualifiers;
+ }
+
+}
Copied: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java (from rev 6748, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java)
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java (rev 0)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.extensions.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.extensions.literal.DefaultLiteral;
+
+/**
+ * Utility class to resolve and acquire references to Beans
+ *
+ * @author Stuart Douglas
+ *
+ */
+public class BeanResolver
+{
+ private BeanResolver()
+ {
+ }
+
+ /**
+ * Resolves a bean
+ *
+ */
+ public static Bean<?> resolveBean(Type beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
+ {
+ Set<Bean<?>> beans = manager.getBeans(beanType, qualifiers);
+ if (beans.size() == 0)
+ {
+ throw new BeanNotFoundException(beanType, qualifiers);
+ }
+ if (beans.size() != 1)
+ {
+ throw new AmbiguousBeanException(beanType, qualifiers, beans);
+ }
+ return beans.iterator().next();
+ }
+
+ /**
+ * Resolves a bean with the qualifier @Default
+ *
+ */
+ public static Bean<?> resolveDefaultBean(Type beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
+ {
+ Annotation[] qualifiers = new Annotation[1];
+ qualifiers[0] = DefaultLiteral.INSTANCE;
+ Set<Bean<?>> beans = manager.getBeans(beanType, qualifiers);
+ if (beans.size() == 0)
+ {
+ throw new BeanNotFoundException(beanType, qualifiers);
+ }
+ if (beans.size() != 1)
+ {
+ throw new AmbiguousBeanException(beanType, qualifiers, beans);
+ }
+ return beans.iterator().next();
+ }
+
+ /**
+ * gets a reference to a bean with the given type and qualifiers
+ */
+ public static Object getReference(Type beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
+ {
+ Bean<?> bean = resolveBean(beanType, manager, qualifiers);
+ CreationalContext<?> context = manager.createCreationalContext(bean);
+ return manager.getReference(bean, beanType, context);
+ }
+
+ /**
+ * gets a reference to a bean with the given type and qualifiers
+ */
+ public static <T> T getReference(Class<T> beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
+ {
+ return (T) getReference((Type) beanType, manager, qualifiers);
+ }
+
+ /**
+ * gets a reference to a bean with the given type and qualifier @Default
+ */
+ public static Object getDefaultReference(Type beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
+ {
+ Bean<?> bean = resolveDefaultBean(beanType, manager);
+ CreationalContext<?> context = manager.createCreationalContext(bean);
+ return manager.getReference(bean, beanType, context);
+ }
+
+ /**
+ * gets a reference to a bean with the given type and qualifier @Default
+ */
+ public static <T> T getDefaultReference(Class<T> beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
+ {
+ return (T) getDefaultReference((Type) beanType, manager);
+ }
+
+}
Deleted: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/Reflections.java 2010-07-21 13:07:38 UTC (rev 6741)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -1,217 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.extensions.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.BeanManager;
-
-/**
- * class that provides a way of retrieving all methods and fields from a class
- *
- * @author stuart
- *
- */
-public class Reflections
-{
-
- private Reflections() {}
-
- public static Set<Field> getFields(Class<?> clazz)
- {
- HashSet<Field> ret = new HashSet<Field>();
- Class<?> p = clazz;
- while (p != null && p != Object.class)
- {
- for (Field a : p.getDeclaredFields())
- {
- ret.add(a);
- }
- p = p.getSuperclass();
- }
- return ret;
- }
-
- public static Field getField(Class<?> parent, String name)
- {
- Class<?> p = parent;
- while (p != null && p != Object.class)
- {
- try
- {
- return p.getDeclaredField(name);
- }
- catch (Exception e1)
- {
-
- }
- p = p.getSuperclass();
- }
- return null;
- }
-
- public static <X> AnnotatedField<? super X> getField(AnnotatedType<X> annotatedType, Field field)
- {
- for (AnnotatedField<? super X> annotatedField : annotatedType.getFields())
- {
- if (annotatedField.getDeclaringType().getJavaClass().equals(field.getDeclaringClass()) && annotatedField.getJavaMember().getName().equals(field.getName()))
- {
- return annotatedField;
- }
- }
- return null;
- }
-
- public static Set<Annotation> getAnnotationsWithMetatype(Set<Annotation> annotations, Class<? extends Annotation> metaAnnotationType)
- {
- Set<Annotation> set = new HashSet<Annotation>();
- for (Annotation annotation : annotations)
- {
- if (annotation.annotationType().isAnnotationPresent(metaAnnotationType))
- {
- set.add(annotation);
- }
- }
- return set;
- }
-
- public static Set<Annotation> getQualifiers(Set<Annotation> annotations, BeanManager beanManager)
- {
- Set<Annotation> set = new HashSet<Annotation>();
- for (Annotation annotation : annotations)
- {
- if (beanManager.isQualifier(annotation.annotationType()))
- {
- set.add(annotation);
- }
- }
- return set;
- }
-
-
- public static boolean methodExists(Class<?> parent, String name)
- {
- Class<?> p = parent;
- while (p != null && p != Object.class)
- {
- for (Method m : p.getDeclaredMethods())
- {
- if (m.getName().equals(name))
- {
- return true;
- }
- }
- p = p.getSuperclass();
- }
- return false;
- }
-
- public static Set<Method> getMethods(Class<?> clazz)
- {
- HashSet<Method> ret = new HashSet<Method>();
- Class<?> p = clazz;
- while (p != null && p != Object.class)
- {
- for (Method a : p.getDeclaredMethods())
- {
- ret.add(a);
- }
- p = p.getSuperclass();
- }
- return ret;
- }
-
- public static Method getMethod(Class<?> parent, String name, Class<?>... args)
- {
- Class<?> p = parent;
- while (p != null && p != Object.class)
- {
- try
- {
- return p.getDeclaredMethod(name, args);
- }
- catch (Exception e1)
- {
-
- }
- p = p.getSuperclass();
- }
- return null;
- }
-
- public static Constructor<?> getConstructor(Class<?> parent, Class<?>... args)
- {
- Class<?> p = parent;
- while (p != null && p != Object.class)
- {
- try
- {
- return p.getDeclaredConstructor(args);
- }
- catch (Exception e1)
- {
-
- }
- p = p.getSuperclass();
- }
- return null;
- }
-
- public static Set<Constructor<?>> getConstructors(Class<?> clazz)
- {
- HashSet<Constructor<?>> ret = new HashSet<Constructor<?>>();
- Class<?> p = clazz;
- while (p != null && p != Object.class)
- {
- for (Constructor<?> c : p.getDeclaredConstructors())
- {
- ret.add(c);
- }
- p = p.getSuperclass();
- }
- return ret;
- }
-
- public static Class<?> getMemberType(Member member)
- {
- if (member instanceof Field)
- {
- return ((Field) member).getType();
- }
- else if (member instanceof Method)
- {
- return ((Method) member).getReturnType();
- }
- else if (member instanceof Constructor<?>)
- {
- return ((Constructor<?>) member).getDeclaringClass();
- }
- else
- {
- throw new UnsupportedOperationException("Cannot operate on a member of type " + member.getClass());
- }
- }
-
-}
Copied: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java (from rev 6745, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/Reflections.java)
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java (rev 0)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java 2010-07-22 10:21:24 UTC (rev 6752)
@@ -0,0 +1,249 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.extensions.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+
+/**
+ * class that provides a way of retrieving all methods and fields from a class
+ *
+ * @author stuart
+ *
+ */
+public class Reflections
+{
+
+ private Reflections()
+ {
+ }
+
+ public static Set<Field> getFields(Class<?> clazz)
+ {
+ HashSet<Field> ret = new HashSet<Field>();
+ Class<?> p = clazz;
+ while (p != null && p != Object.class)
+ {
+ for (Field a : p.getDeclaredFields())
+ {
+ ret.add(a);
+ }
+ p = p.getSuperclass();
+ }
+ return ret;
+ }
+
+ public static Field getField(Class<?> parent, String name)
+ {
+ Class<?> p = parent;
+ while (p != null && p != Object.class)
+ {
+ try
+ {
+ return p.getDeclaredField(name);
+ }
+ catch (Exception e1)
+ {
+
+ }
+ p = p.getSuperclass();
+ }
+ return null;
+ }
+
+ public static <X> AnnotatedField<? super X> getField(AnnotatedType<X> annotatedType, Field field)
+ {
+ for (AnnotatedField<? super X> annotatedField : annotatedType.getFields())
+ {
+ if (annotatedField.getDeclaringType().getJavaClass().equals(field.getDeclaringClass()) && annotatedField.getJavaMember().getName().equals(field.getName()))
+ {
+ return annotatedField;
+ }
+ }
+ return null;
+ }
+
+ public static Set<Annotation> getAnnotationsWithMetatype(Set<Annotation> annotations, Class<? extends Annotation> metaAnnotationType)
+ {
+ Set<Annotation> set = new HashSet<Annotation>();
+ for (Annotation annotation : annotations)
+ {
+ if (annotation.annotationType().isAnnotationPresent(metaAnnotationType))
+ {
+ set.add(annotation);
+ }
+ }
+ return set;
+ }
+
+ public static Set<Annotation> getQualifiers(Set<Annotation> annotations, BeanManager beanManager)
+ {
+ Set<Annotation> set = new HashSet<Annotation>();
+ for (Annotation annotation : annotations)
+ {
+ if (beanManager.isQualifier(annotation.annotationType()))
+ {
+ set.add(annotation);
+ }
+ }
+ return set;
+ }
+
+ public static boolean methodExists(Class<?> parent, String name)
+ {
+ Class<?> p = parent;
+ while (p != null && p != Object.class)
+ {
+ for (Method m : p.getDeclaredMethods())
+ {
+ if (m.getName().equals(name))
+ {
+ return true;
+ }
+ }
+ p = p.getSuperclass();
+ }
+ return false;
+ }
+
+ public static Set<Method> getMethods(Class<?> clazz)
+ {
+ HashSet<Method> ret = new HashSet<Method>();
+ Class<?> p = clazz;
+ while (p != null && p != Object.class)
+ {
+ for (Method a : p.getDeclaredMethods())
+ {
+ ret.add(a);
+ }
+ p = p.getSuperclass();
+ }
+ return ret;
+ }
+
+ public static Method getMethod(Class<?> parent, String name, Class<?>... args)
+ {
+ Class<?> p = parent;
+ while (p != null && p != Object.class)
+ {
+ try
+ {
+ return p.getDeclaredMethod(name, args);
+ }
+ catch (Exception e1)
+ {
+
+ }
+ p = p.getSuperclass();
+ }
+ return null;
+ }
+
+ public static Constructor<?> getConstructor(Class<?> parent, Class<?>... args)
+ {
+ Class<?> p = parent;
+ while (p != null && p != Object.class)
+ {
+ try
+ {
+ return p.getDeclaredConstructor(args);
+ }
+ catch (Exception e1)
+ {
+
+ }
+ p = p.getSuperclass();
+ }
+ return null;
+ }
+
+ public static Set<Constructor<?>> getConstructors(Class<?> clazz)
+ {
+ HashSet<Constructor<?>> ret = new HashSet<Constructor<?>>();
+ Class<?> p = clazz;
+ while (p != null && p != Object.class)
+ {
+ for (Constructor<?> c : p.getDeclaredConstructors())
+ {
+ ret.add(c);
+ }
+ p = p.getSuperclass();
+ }
+ return ret;
+ }
+
+ public static Class<?> getMemberType(Member member)
+ {
+ if (member instanceof Field)
+ {
+ return ((Field) member).getType();
+ }
+ else if (member instanceof Method)
+ {
+ return ((Method) member).getReturnType();
+ }
+ else if (member instanceof Constructor<?>)
+ {
+ return ((Constructor<?>) member).getDeclaringClass();
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Cannot operate on a member of type " + member.getClass());
+ }
+ }
+
+ public static Class classForName(String name) throws ClassNotFoundException
+ {
+ try
+ {
+ return Thread.currentThread().getContextClassLoader().loadClass(name);
+ }
+ catch (Exception e)
+ {
+ return Class.forName(name);
+ }
+ }
+
+ public static Object invokeAndWrap(Method method, Object target, Object... args)
+ {
+ try
+ {
+ return method.invoke(target, args);
+ }
+ catch (Exception e)
+ {
+ if (e instanceof RuntimeException)
+ {
+ throw (RuntimeException) e;
+ }
+ else
+ {
+ throw new RuntimeException("exception invoking: " + method.getName(), e);
+ }
+ }
+ }
+
+}
Modified: extensions/trunk/pom.xml
===================================================================
--- extensions/trunk/pom.xml 2010-07-22 10:10:43 UTC (rev 6751)
+++ extensions/trunk/pom.xml 2010-07-22 10:21:24 UTC (rev 6752)
@@ -1,8 +1,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.weld</groupId>
- <artifactId>weld-extensions</artifactId>
- <packaging>jar</packaging>
+ <artifactId>weld-extensions-parent</artifactId>
+ <packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<parent>
@@ -11,8 +11,12 @@
<version>12</version>
</parent>
- <name>Weld Extensions</name>
+ <name>Weld Extensions Parent</name>
<url>http://www.seamframework.org/Weld</url>
+
+ <modules>
+ <module>impl</module>
+ </modules>
<description>Portable extensions for CDI</description>
@@ -137,147 +141,14 @@
</dependencies>
</dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-core</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-api</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <optional>true</optional>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <optional>true</optional>
- </dependency>
-
- </dependencies>
-
+
<profiles>
<profile>
- <id>defualt</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-weld-embedded</artifactId>
- <version>${arquillian.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <id>dist</id>
+ <modules>
+ <module>docs</module>
+ </modules>
</profile>
- <profile>
- <id>incontainer</id>
- <activation>
- <property>
- <name>incontainer</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-jbossas-remote-60</artifactId>
- <version>${arquillian.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-client</artifactId>
- <version>6.0.0.20100429-M3</version>
- <type>pom</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
-<!--
- <profile>
- <id>write-artifacts-to-disk</id>
- <activation>
- <property>
- <name>dumpArtifacts</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-test-artifacts</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>java</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <mainClass>org.jboss.testharness.api.TCK</mainClass>
- <classpathScope>test</classpathScope>
- <systemProperties>
- <systemProperty>
- <key>dumpArtifacts</key>
- <value>true</value>
- </systemProperty>
- <systemProperty>
- <key>org.jboss.testharness.outputDirectory</key>
- <value>target/test-artifacts</value>
- </systemProperty>
- <systemProperty>
- <key>org.jboss.testharness.libraryDirectory</key>
- <value>target/dependency/lib</value>
- </systemProperty>
- </systemProperties>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
--->
</profiles>
<scm>
14 years, 3 months
Weld SVN: r6751 - core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/util.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-07-22 06:10:43 -0400 (Thu, 22 Jul 2010)
New Revision: 6751
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/util/SimpleProxyServices.java
Log:
WELD-566 Changed SPI for ProxyServices to remove the wrap method
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/util/SimpleProxyServices.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/util/SimpleProxyServices.java 2010-07-22 09:50:21 UTC (rev 6750)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/util/SimpleProxyServices.java 2010-07-22 10:10:43 UTC (rev 6751)
@@ -87,12 +87,6 @@
}
- public Object wrapForSerialization(Object proxyObject)
- {
- // Simply use our own replacement object for proxies
- return new SerializableProxy(proxyObject);
- }
-
public Class<?> loadBeanClass(final String className)
{
try
14 years, 3 months
Weld SVN: r6750 - core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-07-22 05:50:21 -0400 (Thu, 22 Jul 2010)
New Revision: 6750
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
Log:
WELD-566 Changed SPI for ProxyServices to remove the wrap method
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java 2010-07-22 09:50:04 UTC (rev 6749)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java 2010-07-22 09:50:21 UTC (rev 6750)
@@ -386,7 +386,7 @@
// replacement object and the subsequent call get the proxy object.
CtClass exception = classPool.get(ObjectStreamException.class.getName());
CtClass objectClass = classPool.get(Object.class.getName());
- String writeReplaceBody = "{ " + " if (firstSerializationPhaseComplete) {" + " firstSerializationPhaseComplete = false; " + " return $0; " + " } else {" + " firstSerializationPhaseComplete = true; " + " return ((org.jboss.weld.serialization.spi.ProxyServices)org.jboss.weld.Container.instance().services().get(org.jboss.weld.serialization.spi.ProxyServices.class)).wrapForSerialization($0);" + " } }";
+ String writeReplaceBody = "{ " + " if (firstSerializationPhaseComplete) {" + " firstSerializationPhaseComplete = false; " + " return $0; " + " } else {" + " firstSerializationPhaseComplete = true; " + " return new org.jboss.weld.bean.proxy.util.SerializableProxy($0);" + " } }";
proxyClassType.addMethod(CtNewMethod.make(objectClass, "writeReplace", null, new CtClass[] { exception }, writeReplaceBody, proxyClassType));
// Also add a static method that can be used to deserialize a proxy
14 years, 3 months
Weld SVN: r6749 - api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-07-22 05:50:04 -0400 (Thu, 22 Jul 2010)
New Revision: 6749
Modified:
api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi/ProxyServices.java
Log:
WELD-566 Changed SPI for ProxyServices to remove the wrap method
Modified: api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi/ProxyServices.java
===================================================================
--- api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi/ProxyServices.java 2010-07-22 09:47:30 UTC (rev 6748)
+++ api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi/ProxyServices.java 2010-07-22 09:50:04 UTC (rev 6749)
@@ -68,19 +68,6 @@
public ProtectionDomain getProtectionDomain(Class<?> proxiedBeanType);
/**
- * Allows a proxy object to be intercepted before it is serialized to an
- * object stream. The object may be wrapped or otherwise handled in such a
- * way to allow it to be serialized and then later deserialized in another
- * VM. The default Weld implementation uses a wrapper class which contains
- * enough information to recreate the proxy class and then to deserialize the
- * proxy object itself.
- *
- * @param proxyObject the proxy object from Weld being serialized
- * @return a replacement object or the proxy
- */
- public Object wrapForSerialization(Object proxyObject);
-
- /**
* <p>
* Loads classes or interfaces extended/implemented by a bean or in
* particular a proxy class for a bean. This includes application types of
14 years, 3 months
Weld SVN: r6748 - extensions/trunk/src/main/java/org/jboss/weld/extensions/util.
by weld-commits@lists.jboss.org
Author: swd847
Date: 2010-07-22 05:47:30 -0400 (Thu, 22 Jul 2010)
New Revision: 6748
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java
Log:
minor
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java 2010-07-22 09:29:23 UTC (rev 6747)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java 2010-07-22 09:47:30 UTC (rev 6748)
@@ -42,7 +42,7 @@
* Resolves a bean
*
*/
- public static Bean<?> resolveBean(Type beanType, Annotation[] qualifiers, BeanManager manager) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
+ public static Bean<?> resolveBean(Type beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
{
Set<Bean<?>> beans = manager.getBeans(beanType, qualifiers);
if (beans.size() == 0)
@@ -60,7 +60,7 @@
* Resolves a bean with the qualifier @Default
*
*/
- public static Bean<?> resolveDefaultBean(Type beanType, BeanManager manager) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
+ public static Bean<?> resolveDefaultBean(Type beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
{
Annotation[] qualifiers = new Annotation[1];
qualifiers[0] = DefaultLiteral.INSTANCE;
@@ -79,9 +79,9 @@
/**
* gets a reference to a bean with the given type and qualifiers
*/
- public static Object getReference(Type beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
+ public static Object getReference(Type beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
{
- Bean<?> bean = resolveBean(beanType, qualifiers, manager);
+ Bean<?> bean = resolveBean(beanType, manager, qualifiers);
CreationalContext<?> context = manager.createCreationalContext(bean);
return manager.getReference(bean, beanType, context);
}
@@ -89,7 +89,7 @@
/**
* gets a reference to a bean with the given type and qualifiers
*/
- public static <T> T getReference(Class<T> beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
+ public static <T> T getReference(Class<T> beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
{
return (T) getReference((Type) beanType, manager, qualifiers);
}
@@ -97,7 +97,7 @@
/**
* gets a reference to a bean with the given type and qualifier @Default
*/
- public static Object getDefaultReference(Type beanType, BeanManager manager) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
+ public static Object getDefaultReference(Type beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
{
Bean<?> bean = resolveDefaultBean(beanType, manager);
CreationalContext<?> context = manager.createCreationalContext(bean);
@@ -107,7 +107,7 @@
/**
* gets a reference to a bean with the given type and qualifier @Default
*/
- public static <T> T getDefaultReference(Class<T> beanType, BeanManager manager) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
+ public static <T> T getDefaultReference(Class<T> beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
{
return (T) getDefaultReference((Type) beanType, manager);
}
14 years, 3 months
Weld SVN: r6747 - extensions/trunk/src/main/java/org/jboss/weld/extensions/util.
by weld-commits@lists.jboss.org
Author: swd847
Date: 2010-07-22 05:29:23 -0400 (Thu, 22 Jul 2010)
New Revision: 6747
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java
Log:
api change
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java 2010-07-22 09:10:14 UTC (rev 6746)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java 2010-07-22 09:29:23 UTC (rev 6747)
@@ -79,7 +79,7 @@
/**
* gets a reference to a bean with the given type and qualifiers
*/
- public static Object getReference(Type beanType, Annotation[] qualifiers, BeanManager manager) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
+ public static Object getReference(Type beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
{
Bean<?> bean = resolveBean(beanType, qualifiers, manager);
CreationalContext<?> context = manager.createCreationalContext(bean);
@@ -89,9 +89,9 @@
/**
* gets a reference to a bean with the given type and qualifiers
*/
- public static <T> T getReference(Class<T> beanType, Annotation[] qualifiers, BeanManager manager) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
+ public static <T> T getReference(Class<T> beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanResolutionException, BeanNotFoundException
{
- return (T) getReference((Type) beanType, qualifiers, manager);
+ return (T) getReference((Type) beanType, manager, qualifiers);
}
/**
14 years, 3 months