[weld-commits] Weld SVN: r6752 - in extensions/trunk: docs and 8 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Thu Jul 22 06:21:26 EDT 2010


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 at 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>



More information about the weld-commits mailing list