[jboss-cvs] JBossAS SVN: r106121 - in projects/demos/microcontainer/trunk: opojo and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 17 11:37:36 EDT 2010


Author: alesj
Date: 2010-06-17 11:37:35 -0400 (Thu, 17 Jun 2010)
New Revision: 106121

Added:
   projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/AbstractTeam.java
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/deployers/
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/deployers/VFDeployer.java
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockEjbServices.java
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockJpaServices.java
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockResourceServices.java
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockSecurityServices.java
   projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockTransactionServices.java
Modified:
   projects/demos/microcontainer/trunk/opojo/jboss-demos-opojo.iml
   projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/Team.java
   projects/demos/microcontainer/trunk/opojo/src/main/resources/META-INF/service-mix-beans.xml
   projects/demos/microcontainer/trunk/pom.xml
   projects/demos/microcontainer/trunk/weld/pom.xml
   projects/demos/microcontainer/trunk/weld/src/main/resources/META-INF/weld-beans.xml
Log:
Add Weld support #2.


Modified: projects/demos/microcontainer/trunk/opojo/jboss-demos-opojo.iml
===================================================================
--- projects/demos/microcontainer/trunk/opojo/jboss-demos-opojo.iml	2010-06-17 15:17:16 UTC (rev 106120)
+++ projects/demos/microcontainer/trunk/opojo/jboss-demos-opojo.iml	2010-06-17 15:37:35 UTC (rev 106121)
@@ -1,27 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module relativePaths="false" type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" inherit-compiler-output="false">
-    <output url="file://$MODULE_DIR$/target/classes" />
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
-      <excludeFolder url="file://$MODULE_DIR$/target" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
+
+<module relativePaths="false" type="JAVA_MODULE" version="4"> 
+  <component name="NewModuleRootManager" inherit-compiler-output="false"> 
+    <output url="file://$MODULE_DIR$/target/classes"/>  
+    <output-test url="file://$MODULE_DIR$/target/test-classes"/>  
+    <exclude-output/>  
+    <content url="file://$MODULE_DIR$"> 
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false"/>
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false"/>
+      <excludeFolder url="file://$MODULE_DIR$/target"/>
+    </content>  
+    <orderEntry type="inheritedJdk"/>  
+    <orderEntry type="sourceFolder" forTests="false"/>  
     <orderEntry type="module-library">
       <library>
         <CLASSES>
-          <root url="jar://$MAVEN_REPOSITORY$/org/osgi/org.osgi.core/4.2.0/org.osgi.core-4.2.0.jar!/" />
+          <root url="jar:///Users/alesj/.m2/repository/org/osgi/org.osgi.core/4.2.0/org.osgi.core-4.2.0.jar!/"/>
         </CLASSES>
-        <JAVADOC />
         <SOURCES>
-          <root url="jar://$MAVEN_REPOSITORY$/org/osgi/org.osgi.core/4.2.0/org.osgi.core-4.2.0-sources.jar!/" />
+          <root url="jar:///Users/alesj/.m2/repository/org/osgi/org.osgi.core/4.2.0/org.osgi.core-4.2.0-sources.jar!/"/>
         </SOURCES>
       </library>
     </orderEntry>
-  </component>
+  </component> 
 </module>
-

Copied: projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/AbstractTeam.java (from rev 106088, projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/Team.java)
===================================================================
--- projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/AbstractTeam.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/AbstractTeam.java	2010-06-17 15:37:35 UTC (rev 106121)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.demos.opojo.api;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractTeam implements Team
+{
+   @Override
+   public String toString()
+   {
+      return name();
+   }
+}
\ No newline at end of file

Modified: projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/Team.java
===================================================================
--- projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/Team.java	2010-06-17 15:17:16 UTC (rev 106120)
+++ projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/Team.java	2010-06-17 15:37:35 UTC (rev 106121)
@@ -27,5 +27,8 @@
  */
 public interface Team
 {
-
+   String name();
+   String captain();
+   String bestPlayer();
+   String coach();
 }
\ No newline at end of file

Modified: projects/demos/microcontainer/trunk/opojo/src/main/resources/META-INF/service-mix-beans.xml
===================================================================
--- projects/demos/microcontainer/trunk/opojo/src/main/resources/META-INF/service-mix-beans.xml	2010-06-17 15:17:16 UTC (rev 106120)
+++ projects/demos/microcontainer/trunk/opojo/src/main/resources/META-INF/service-mix-beans.xml	2010-06-17 15:37:35 UTC (rev 106121)
@@ -1,10 +1,16 @@
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
-    <osgi xmlns="urn:jboss:pojo2osgi:1.0" name="WorldCup" class="org.jboss.demos.opojo.impl.WorldCupImpl">
+    <!-- osgi xmlns="urn:jboss:pojo2osgi:1.0" name="WorldCup" class="org.jboss.demos.opojo.impl.WorldCupImpl">
         <constructor>
             <parameter><null/></parameter>
         </constructor>
         <exposed-type>org.jboss.demos.opojo.api.WorldCup</exposed-type>
-    </osgi>
+    </osgi -->
 
+    <bean name="WorldCup" class="org.jboss.demos.opojo.impl.WorldCupImpl">
+        <constructor>
+            <parameter><inject bean="Lottery" property="winner"/></parameter>
+        </constructor>
+    </bean>
+
 </deployment>

Modified: projects/demos/microcontainer/trunk/pom.xml
===================================================================
--- projects/demos/microcontainer/trunk/pom.xml	2010-06-17 15:17:16 UTC (rev 106120)
+++ projects/demos/microcontainer/trunk/pom.xml	2010-06-17 15:37:35 UTC (rev 106121)
@@ -38,6 +38,7 @@
     <module>gfs</module>
     <module>opojo</module>
     <module>weld</module>
+    <module>wpojo</module>
     <!-- <module>osgi</module> -->
     <module>build</module>
   </modules>
@@ -59,6 +60,7 @@
     <version.org.jboss.aop>2.0.1.GA</version.org.jboss.aop>
     <version.org.jboss.test>1.0.5.GA</version.org.jboss.test>
     <version.org.infinispan>4.1.0-SNAPSHOT</version.org.infinispan>
+    <version.org.slf4j>1.5.6</version.org.slf4j>
     <version.junit>4.4</version.junit>
     <version.javassist>3.12.1.GA</version.javassist>
     <version.xerces>2.9.1</version.xerces>
@@ -507,6 +509,18 @@
       </dependency>
 
       <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>${version.org.slf4j}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-simple</artifactId>
+        <version>${version.org.slf4j}</version>
+      </dependency>
+
+      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-core</artifactId>
         <version>${version.org.infinispan}</version>
@@ -589,6 +603,11 @@
          <version>${version.cdi}</version>
       </dependency>
       <dependency>
+         <groupId>org.jboss.weld</groupId>
+         <artifactId>weld-core</artifactId>
+         <version>${version.weld}</version>
+      </dependency>
+      <dependency>
          <groupId>org.jboss.jbossas</groupId>
          <artifactId>weld-int-ejb</artifactId>
          <version>${version.org.jboss.as}</version>

Modified: projects/demos/microcontainer/trunk/weld/pom.xml
===================================================================
--- projects/demos/microcontainer/trunk/weld/pom.xml	2010-06-17 15:17:16 UTC (rev 106120)
+++ projects/demos/microcontainer/trunk/weld/pom.xml	2010-06-17 15:37:35 UTC (rev 106121)
@@ -19,6 +19,14 @@
      </dependency>
      <!-- Compile (global dependencies) -->
      <dependency>
+       <groupId>org.slf4j</groupId>
+       <artifactId>slf4j-api</artifactId>
+     </dependency>
+     <dependency>
+       <groupId>org.slf4j</groupId>
+       <artifactId>slf4j-simple</artifactId>
+     </dependency>
+     <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
      </dependency>
@@ -27,6 +35,10 @@
         <artifactId>weld-spi</artifactId>
      </dependency>
      <dependency>
+        <groupId>org.jboss.weld</groupId>
+        <artifactId>weld-core</artifactId>
+     </dependency>
+     <dependency>
         <groupId>org.jboss.jbossas</groupId>
         <artifactId>weld-int-ejb</artifactId>
      </dependency>

Added: projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/deployers/VFDeployer.java
===================================================================
--- projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/deployers/VFDeployer.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/deployers/VFDeployer.java	2010-06-17 15:37:35 UTC (rev 106121)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.demos.weld.deployers;
+
+import javax.validation.*;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class VFDeployer extends AbstractDeployer
+{
+   private final ValidatorFactory INSTANCE = new DummyValidatorFactory();
+
+   public VFDeployer()
+   {
+      setStage(DeploymentStages.DESCRIBE);
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      unit.addAttachment(DeployersUtils.JAVAX_VALIDATION_VALIDATOR_FACTORY, INSTANCE);
+   }
+
+   private static class DummyValidatorFactory implements ValidatorFactory
+   {
+      public Validator getValidator()
+      {
+         return null;
+      }
+
+      public ValidatorContext usingContext()
+      {
+         return null;
+      }
+
+      public MessageInterpolator getMessageInterpolator()
+      {
+         return null;
+      }
+
+      public TraversableResolver getTraversableResolver()
+      {
+         return null;
+      }
+
+      public ConstraintValidatorFactory getConstraintValidatorFactory()
+      {
+         return null;
+      }
+
+      public <T> T unwrap(Class<T> type)
+      {
+         return null;
+      }
+   }
+}

Added: projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockEjbServices.java
===================================================================
--- projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockEjbServices.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockEjbServices.java	2010-06-17 15:37:35 UTC (rev 106121)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.demos.weld.mock;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.naming.NamingException;
+
+import java.util.Collections;
+
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.integration.util.AbstractJBossServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockEjbServices extends AbstractJBossServices implements EjbInjectionServices, EjbServices
+{
+   public MockEjbServices() throws NamingException
+   {
+   }
+
+   public Object resolveEjb(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+
+   public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor)
+   {
+      return null;
+   }
+
+   public void registerInterceptors(EjbDescriptor<?> ejbDescriptor, InterceptorBindings interceptorBindings)
+   {
+   }
+
+   public Iterable<EjbDescriptor<?>> getEjbs()
+   {
+      return Collections.emptySet();
+   }
+
+   public Iterable<String> getEjbContainerNames()
+   {
+	   return Collections.emptySet();
+   }
+}

Added: projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockJpaServices.java
===================================================================
--- projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockJpaServices.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockJpaServices.java	2010-06-17 15:37:35 UTC (rev 106121)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.demos.weld.mock;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.naming.NamingException;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
+import org.jboss.weld.integration.util.AbstractJBossServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockJpaServices extends AbstractJBossServices implements JpaInjectionServices
+{
+   public MockJpaServices() throws NamingException
+   {
+   }
+
+   public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+
+   public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+}
\ No newline at end of file

Added: projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockResourceServices.java
===================================================================
--- projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockResourceServices.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockResourceServices.java	2010-06-17 15:37:35 UTC (rev 106121)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.demos.weld.mock;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.naming.NamingException;
+
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.integration.util.AbstractJBossServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockResourceServices extends AbstractJBossServices implements ResourceInjectionServices
+{
+   public MockResourceServices() throws NamingException
+   {
+   }
+
+   public Object resolveResource(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+
+   public Object resolveResource(String jndiName, String mappedName)
+   {
+      return null;
+   }
+}
\ No newline at end of file

Added: projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockSecurityServices.java
===================================================================
--- projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockSecurityServices.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockSecurityServices.java	2010-06-17 15:37:35 UTC (rev 106121)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.demos.weld.mock;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.naming.NamingException;
+
+import java.security.Principal;
+
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.integration.util.AbstractJBossServices;
+import org.jboss.weld.security.spi.SecurityServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockSecurityServices extends AbstractJBossServices implements SecurityServices
+{
+   public MockSecurityServices() throws NamingException
+   {
+   }
+
+   public Principal getPrincipal()
+   {
+      return null;
+   }
+}
\ No newline at end of file

Added: projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockTransactionServices.java
===================================================================
--- projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockTransactionServices.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/weld/src/main/java/org/jboss/demos/weld/mock/MockTransactionServices.java	2010-06-17 15:37:35 UTC (rev 106121)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.demos.weld.mock;
+
+import javax.naming.NamingException;
+import javax.transaction.Synchronization;
+import javax.transaction.UserTransaction;
+
+import org.jboss.weld.integration.util.AbstractJBossServices;
+import org.jboss.weld.transaction.spi.TransactionServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockTransactionServices extends AbstractJBossServices implements TransactionServices
+{
+   public MockTransactionServices() throws NamingException
+   {
+   }
+
+   public void registerSynchronization(Synchronization synchronizedObserver)
+   {
+   }
+
+   public boolean isTransactionActive()
+   {
+      return false;
+   }
+
+   public UserTransaction getUserTransaction()
+   {
+      return null;
+   }
+}
\ No newline at end of file

Modified: projects/demos/microcontainer/trunk/weld/src/main/resources/META-INF/weld-beans.xml
===================================================================
--- projects/demos/microcontainer/trunk/weld/src/main/resources/META-INF/weld-beans.xml	2010-06-17 15:17:16 UTC (rev 106120)
+++ projects/demos/microcontainer/trunk/weld/src/main/resources/META-INF/weld-beans.xml	2010-06-17 15:37:35 UTC (rev 106121)
@@ -14,7 +14,9 @@
   <bean name="WeldDiscoveryDeployer" class="org.jboss.weld.integration.deployer.env.WeldDiscoveryDeployer"/>
 
   <!-- Responsible for discovering Weld classes -->
-  <bean name="EjbServicesDeployer" class="org.jboss.weld.integration.deployer.env.EjbServicesDeployer"/>
+  <bean name="EjbServicesDeployer" class="org.jboss.weld.integration.deployer.env.EjbServicesDeployer">
+     <property name="ejbServicesClassName">org.jboss.demos.weld.mock.MockEjbServices</property>
+  </bean>
 
   <!-- Responsible for discovering Weld classes -->
   <bean name="FlatDeploymentDeployer" class="org.jboss.weld.integration.deployer.env.FlatDeploymentDeployer"/>
@@ -26,14 +28,32 @@
     </constructor>
   </bean>
 
+  <!-- ValidatorFactory deployer -->
+  <bean name="VFDeployer" class="org.jboss.demos.weld.deployers.VFDeployer"/>
+
   <!-- Responsible for booting Weld -->
   <bean name="WeldBootstrapDeployer" class="org.jboss.weld.integration.deployer.env.WeldBootstrapDeployer"/>
 
-  <!-- Responsible for making sure that the CDI container is started before the web application(s)-->
-  <bean name="WebContainerDependencyDeployer" class="org.jboss.weld.integration.deployer.env.WebContainerDependencyDeployer"/>
-
   <!--  UNCOMMENT THIS TO ENABLE WELD/MC INJECTION - This feature is currently very experimental and so not enabled by default  -->
   <!-- Adds plugin to BeanMetaDataDeployer that installs WeldKernelControllerContexts -->
   <bean name="WeldBeanMetaDataDeployerPlugin" class="org.jboss.weld.integration.deployer.mc.WeldBeanMetaDataDeployerPlugin"/>
 
+  <!-- Services / mocks -->
+
+   <!-- EJB Services: @EJB-style injection lookup -->
+   <beanfactory name="JBossEjbServices" class="org.jboss.demos.weld.mock.MockEjbServices"/>
+
+   <!-- JPA Services: @PersistenceContext-style and @PersistenceUnit-style lookup -->
+   <beanfactory name="JBossJpaServices" class="org.jboss.demos.weld.mock.MockJpaServices"/>
+
+   <!-- @Resource-style lookup -->
+   <bean name="JBossResourceServices" class="org.jboss.demos.weld.mock.MockResourceServices" />
+
+   <!-- Access to the JTA UserTransaction, and synchronization registration -->
+   <bean name="JBossTransactionServices" class="org.jboss.demos.weld.mock.MockTransactionServices"/>
+   <bean name="RealTransactionManager" class="java.lang.Object" /> <!-- Marker TM -->
+
+   <!-- Access to the caller context Principal -->
+   <bean name="JBossSecurityServices" class="org.jboss.demos.weld.mock.MockSecurityServices" />
+
 </deployment>



More information about the jboss-cvs-commits mailing list