[jboss-cvs] JBossAS SVN: r108921 - in projects/mc-int/trunk: common and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 26 11:32:07 EDT 2010
Author: alesj
Date: 2010-10-26 11:32:05 -0400 (Tue, 26 Oct 2010)
New Revision: 108921
Added:
projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerInject.java
projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerServlet.java
projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerServletInject.java
Removed:
projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/plugins/FederatedAnnotationEnvironmentVDFConnector.java
Modified:
projects/mc-int/trunk/common/pom.xml
projects/mc-int/trunk/pom.xml
projects/mc-int/trunk/servlet/pom.xml
projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/plugins/AnnotationEnvironmentVDFConnector.java
Log:
Update to MC 2.2, add MC+Servlet int.
Modified: projects/mc-int/trunk/common/pom.xml
===================================================================
--- projects/mc-int/trunk/common/pom.xml 2010-10-26 15:25:13 UTC (rev 108920)
+++ projects/mc-int/trunk/common/pom.xml 2010-10-26 15:32:05 UTC (rev 108921)
@@ -37,7 +37,7 @@
<artifactId>jboss-logging-spi</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-dependency</artifactId>
</dependency>
<dependency>
@@ -57,7 +57,7 @@
<artifactId>jboss-deployers-core-spi</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-kernel</artifactId>
</dependency>
<!-- test dependencies -->
Modified: projects/mc-int/trunk/pom.xml
===================================================================
--- projects/mc-int/trunk/pom.xml 2010-10-26 15:25:13 UTC (rev 108920)
+++ projects/mc-int/trunk/pom.xml 2010-10-26 15:32:05 UTC (rev 108921)
@@ -25,20 +25,21 @@
</modules>
<properties>
- <version.jboss.vfs>2.1.3.SP1</version.jboss.vfs>
- <version.jboss.man>2.1.1.GA</version.jboss.man>
- <version.jboss.mdr>2.0.2.GA</version.jboss.mdr>
- <version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
- <version.jboss.classloader>2.0.8.GA</version.jboss.classloader>
- <version.jboss.deployers>2.0.9.GA</version.jboss.deployers>
- <version.jboss.common.core>2.2.16.GA</version.jboss.common.core>
- <version.jboss.common.logging.spi>2.0.5.GA</version.jboss.common.logging.spi>
- <version.jboss.common.logging.log4j>2.0.5.GA</version.jboss.common.logging.log4j>
- <version.jbossxb>2.0.2.Beta2</version.jbossxb>
+ <version.jboss.vfs>3.0.0.CR5</version.jboss.vfs>
+ <version.jboss.man>2.1.1.SP2</version.jboss.man>
+ <version.jboss.mdr>2.2.0.Alpha3</version.jboss.mdr>
+ <version.jboss.microcontainer>2.2.0.Alpha10</version.jboss.microcontainer>
+ <version.jboss.classloader>2.2.0.Alpha8</version.jboss.classloader>
+ <version.jboss.deployers>2.2.0.Alpha7</version.jboss.deployers>
+ <version.jboss.scanning>1.0.0.Alpha6</version.jboss.scanning>
+ <version.jboss.common.core>2.2.17.GA</version.jboss.common.core>
+ <version.jboss.common.logging.spi>2.2.0.CR1</version.jboss.common.logging.spi>
+ <version.jboss.common.logging.log4j>2.2.0.CR1</version.jboss.common.logging.log4j>
+ <version.jbossxb>2.0.2.Beta9</version.jbossxb>
<version.jboss.aop>2.0.1.GA</version.jboss.aop>
<version.org.jboss.test>1.0.5.GA</version.org.jboss.test>
<version.junit>4.4</version.junit>
- <version.javassist>3.11.0.GA</version.javassist>
+ <version.javassist>3.12.1.GA</version.javassist>
<version.xerces>2.9.1</version.xerces>
<version.servlet.api>2.5</version.servlet.api>
</properties>
@@ -153,88 +154,343 @@
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-dependency</artifactId>
<version>${version.jboss.microcontainer}</version>
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-kernel</artifactId>
<version>${version.jboss.microcontainer}</version>
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-aop-mc-int</artifactId>
<version>${version.jboss.microcontainer}</version>
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-spring-int</artifactId>
<version>${version.jboss.microcontainer}</version>
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-guice-int</artifactId>
<version>${version.jboss.microcontainer}</version>
</dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-client</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-client-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-impl</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-plugins</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-plugins</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <type>test-jar</type>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-plugins</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-jmx</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-plugins</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-spi</artifactId>
+ <version>${version.jboss.scanning}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-impl</artifactId>
+ <version>${version.jboss.scanning}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading-vfs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-plugins</artifactId>
+ <version>${version.jboss.scanning}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.vfs</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading-vfs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.weld.integration</groupId>
+ <artifactId>weld-jboss-int-deployer</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.mc-int</groupId>
+ <artifactId>jboss-mc-int-servlet</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
<dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-core-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-impl</artifactId>
- <version>${version.jboss.deployers}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-structure-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
<groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloader</artifactId>
- <version>${version.jboss.classloader}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading</artifactId>
- <version>${version.jboss.classloader}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloading-vfs</artifactId>
<version>${version.jboss.classloader}</version>
</dependency>
@@ -284,7 +540,7 @@
<version>${version.jboss.aop}</version>
</dependency>
<dependency>
- <groupId>org.jboss</groupId>
+ <groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>${version.javassist}</version>
</dependency>
Modified: projects/mc-int/trunk/servlet/pom.xml
===================================================================
--- projects/mc-int/trunk/servlet/pom.xml 2010-10-26 15:25:13 UTC (rev 108920)
+++ projects/mc-int/trunk/servlet/pom.xml 2010-10-26 15:32:05 UTC (rev 108921)
@@ -45,7 +45,7 @@
<artifactId>jboss-logging-spi</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-dependency</artifactId>
</dependency>
<dependency>
@@ -64,8 +64,12 @@
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-core-spi</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jboss.scanning</groupId>
+ <artifactId>scanning-plugins</artifactId>
+ </dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-kernel</artifactId>
</dependency>
<dependency>
Added: projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerInject.java
===================================================================
--- projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerInject.java (rev 0)
+++ projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerInject.java 2010-10-26 15:32:05 UTC (rev 108921)
@@ -0,0 +1,86 @@
+/*
+ * 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.mc.servlet.vdf.api;
+
+import java.util.UUID;
+
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.plugins.dependency.StatelessKernelController;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+
+/**
+ * MC based inject.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MicrocontainerInject
+{
+ private KernelController controller;
+
+ public MicrocontainerInject(KernelController controller)
+ {
+ if (controller == null)
+ throw new IllegalArgumentException("Null controller");
+ this.controller = controller;
+ }
+
+ /**
+ * Do MC inject.
+ *
+ * @param instance the instance to inspewct for MC injections
+ */
+ public void inject(Object instance)
+ {
+ if (instance == null)
+ return;
+
+ String name = UUID.randomUUID().toString();
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, instance.getClass().getName());
+ builder.ignoreCreate();
+ builder.ignoreStart();
+ StatelessKernelController wrapper = new StatelessKernelController(controller);
+ try
+ {
+ KernelControllerContext context = wrapper.install(builder.getBeanMetaData(), instance);
+ if (ControllerState.INSTALLED.equals(context.getState()) == false)
+ {
+ //noinspection ThrowableResultOfMethodCallIgnored
+ throw new IllegalArgumentException(
+ "Instance [" + instance + "] not fully installed, missing dependency? - " +
+ context.getDependencyInfo().getUnresolvedDependencies(null),
+ context.getError()
+ );
+ }
+ }
+ catch (IllegalArgumentException t)
+ {
+ throw t;
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+}
Added: projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerServlet.java
===================================================================
--- projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerServlet.java (rev 0)
+++ projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerServlet.java 2010-10-26 15:32:05 UTC (rev 108921)
@@ -0,0 +1,130 @@
+/*
+ * 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.mc.servlet.vdf.api;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import java.io.IOException;
+import java.util.UUID;
+
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.mc.servlet.vdf.spi.VDFConnector;
+
+/**
+ * MC based servlet.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MicrocontainerServlet implements Servlet
+{
+ private Servlet delegate;
+ private KernelController controller;
+ private String name;
+ private ServletConfig config;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ VDFConnector<KernelController> connector = new KernelControllerVDFConnector(config.getServletContext());
+ if (connector.isValid() == false)
+ throw new ServletException("Invalid VDF connector: " + connector);
+
+ String className = config.getInitParameter("servlet-class");
+ if (className == null)
+ throw new ServletException("Missing 'servlet-class' init parameter.");
+
+ controller = connector.getUtility();
+ name = UUID.randomUUID().toString();
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, className);
+ builder.ignoreDestroy(); // leave it to servlet lifecycle
+ try
+ {
+ KernelControllerContext context = controller.install(builder.getBeanMetaData());
+ if (ControllerState.INSTALLED.equals(context.getState()) == false)
+ {
+ //noinspection ThrowableResultOfMethodCallIgnored
+ throw new IllegalArgumentException(
+ "Servlet [" + className + "] not fully installed, missing dependency? - " +
+ context.getDependencyInfo().getUnresolvedDependencies(null),
+ context.getError()
+ );
+ }
+ Object result = context.getTarget();
+ if (Servlet.class.isInstance(result) == false)
+ throw new ServletException("Classname [" + className + "] doesn't map Servlet instance: " + result);
+
+ delegate = (Servlet) result;
+ }
+ catch (ServletException t)
+ {
+ throw t;
+ }
+ catch (Throwable t)
+ {
+ throw new ServletException(t);
+ }
+
+ this.config = config;
+ }
+
+ public ServletConfig getServletConfig()
+ {
+ return config;
+ }
+
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
+ {
+ delegate.service(req, res);
+ }
+
+ public String getServletInfo()
+ {
+ return delegate.getServletInfo();
+ }
+
+ public void destroy()
+ {
+ try
+ {
+ if (delegate != null)
+ {
+ delegate.destroy();
+ delegate = null;
+ }
+ }
+ finally
+ {
+ if (controller != null)
+ {
+ controller.uninstall(name);
+ controller = null;
+ }
+ }
+ }
+}
Added: projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerServletInject.java
===================================================================
--- projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerServletInject.java (rev 0)
+++ projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/api/MicrocontainerServletInject.java 2010-10-26 15:32:05 UTC (rev 108921)
@@ -0,0 +1,49 @@
+/*
+ * 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.mc.servlet.vdf.api;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.mc.servlet.vdf.spi.VDFConnector;
+
+/**
+ * MC servlet context based inject.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MicrocontainerServletInject extends MicrocontainerInject
+{
+ public MicrocontainerServletInject(ServletContext context)
+ {
+ super(getKernelController(context));
+ }
+
+ private static KernelController getKernelController(ServletContext context)
+ {
+ VDFConnector<KernelController> connector = new KernelControllerVDFConnector(context);
+ if (connector.isValid() == false)
+ throw new IllegalArgumentException("Invalid VDF connector: " + connector);
+ return connector.getUtility();
+ }
+}
Modified: projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/plugins/AnnotationEnvironmentVDFConnector.java
===================================================================
--- projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/plugins/AnnotationEnvironmentVDFConnector.java 2010-10-26 15:25:13 UTC (rev 108920)
+++ projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/plugins/AnnotationEnvironmentVDFConnector.java 2010-10-26 15:32:05 UTC (rev 108921)
@@ -23,23 +23,23 @@
import javax.servlet.ServletContext;
-import org.jboss.deployers.spi.annotations.AnnotationEnvironment;
import org.jboss.mc.servlet.vdf.api.BaseAttachmentVDFConnector;
+import org.jboss.scanning.annotations.spi.AnnotationRepository;
/**
- * AnnotationEnvironment VDF connector.
+ * AnnotationRepository VDF connector.
*
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class AnnotationEnvironmentVDFConnector extends BaseAttachmentVDFConnector<AnnotationEnvironment>
+public class AnnotationEnvironmentVDFConnector extends BaseAttachmentVDFConnector<AnnotationRepository>
{
protected AnnotationEnvironmentVDFConnector(ServletContext servletContext)
{
super(servletContext);
}
- protected Class<AnnotationEnvironment> getAttachmentType()
+ protected Class<AnnotationRepository> getAttachmentType()
{
- return AnnotationEnvironment.class;
+ return AnnotationRepository.class;
}
}
\ No newline at end of file
Deleted: projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/plugins/FederatedAnnotationEnvironmentVDFConnector.java
===================================================================
--- projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/plugins/FederatedAnnotationEnvironmentVDFConnector.java 2010-10-26 15:25:13 UTC (rev 108920)
+++ projects/mc-int/trunk/servlet/src/main/java/org/jboss/mc/servlet/vdf/plugins/FederatedAnnotationEnvironmentVDFConnector.java 2010-10-26 15:32:05 UTC (rev 108921)
@@ -1,84 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.mc.servlet.vdf.plugins;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-
-import org.jboss.deployers.spi.annotations.AnnotationEnvironment;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.mc.servlet.vdf.api.AttachmentVDFConnector;
-
-/**
- * AnnotationEnvironment VDF connector.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class FederatedAnnotationEnvironmentVDFConnector extends AttachmentVDFConnector<List<AnnotationEnvironment>>
-{
- protected FederatedAnnotationEnvironmentVDFConnector(ServletContext servletContext)
- {
- super(servletContext);
- }
-
- protected List<AnnotationEnvironment> getUtilityFromAttribute(DeploymentUnit unit)
- {
- List<AnnotationEnvironment> list = new ArrayList<AnnotationEnvironment>();
- DeploymentUnit top = unit.getTopLevel();
- findAllAnnotationEnvironments(top, list);
- return list;
- }
-
- /**
- * Find all anotation environments recursively.
- *
- * @param unit the current deployment unit
- * @param list the holder list
- */
- protected void findAllAnnotationEnvironments(DeploymentUnit unit, List<AnnotationEnvironment> list)
- {
- applyAnnotationEnvironment(unit, list);
- List<DeploymentUnit> children = unit.getChildren();
- if (children != null && children.isEmpty() == false)
- {
- for (DeploymentUnit child : children)
- {
- findAllAnnotationEnvironments(child, list);
- }
- }
- }
-
- /**
- * Get annotation environment.
- *
- * @param unit the deployment unit
- * @param list the list
- */
- protected void applyAnnotationEnvironment(DeploymentUnit unit, List<AnnotationEnvironment> list)
- {
- AnnotationEnvironment ae = unit.getAttachment(AnnotationEnvironment.class);
- if (ae != null)
- list.add(ae);
- }
-}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list