[jboss-cvs] JBossAS SVN: r76467 - in trunk/tomcat/src/main/org/jboss/web/tomcat/service: injection and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 30 08:10:40 EDT 2008
Author: emuckenhuber
Date: 2008-07-30 08:10:40 -0400 (Wed, 30 Jul 2008)
New Revision: 76467
Added:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/injection/WebEJBInjectionHandler.java
Modified:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
Log:
[JBAS-5673] web ejb injection
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java 2008-07-30 12:09:27 UTC (rev 76466)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java 2008-07-30 12:10:40 UTC (rev 76467)
@@ -56,7 +56,6 @@
import org.jboss.ejb3.javaee.AbstractJavaEEComponent;
import org.jboss.ejb3.javaee.SimpleJavaEEModule;
import org.jboss.injection.DependsHandler;
-import org.jboss.injection.EJBHandler;
import org.jboss.injection.EncInjector;
import org.jboss.injection.ExtendedInjectionContainer;
import org.jboss.injection.InjectionHandler;
@@ -77,6 +76,7 @@
import org.jboss.metadata.web.spec.ServletMetaData;
import org.jboss.virtual.VirtualFile;
import org.jboss.web.WebApplication;
+import org.jboss.web.tomcat.service.injection.WebEJBInjectionHandler;
import org.jboss.web.tomcat.service.injection.WebResourceHandler;
/**
@@ -474,7 +474,7 @@
// todo injection handlers should be pluggable from XML
handlers = new ArrayList<InjectionHandler<Environment>>();
- handlers.add(new EJBHandler<Environment>());
+ handlers.add(new WebEJBInjectionHandler<Environment>());
handlers.add(new DependsHandler<Environment>());
// FIXME: is this allowed in servlets?
//handlers.add(new JndiInjectHandler<Environment>());
Added: trunk/tomcat/src/main/org/jboss/web/tomcat/service/injection/WebEJBInjectionHandler.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/injection/WebEJBInjectionHandler.java (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/injection/WebEJBInjectionHandler.java 2008-07-30 12:10:40 UTC (rev 76467)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.web.tomcat.service.injection;
+
+import org.jboss.injection.EJBHandler;
+import org.jboss.injection.InjectionContainer;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.javaee.spec.AnnotatedEJBReferenceMetaData;
+import org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData;
+import org.jboss.metadata.javaee.spec.Environment;
+
+/**
+ * A web injection handler, which also processes the AnnotatedEjbReferences.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class WebEJBInjectionHandler<X extends Environment> extends EJBHandler<X>
+{
+
+ /** The logger. */
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(WebEJBInjectionHandler.class);
+
+
+ /**
+ * Process the RemoteEnvironmentMetaData
+ *
+ * @param xml the meta data
+ * @param container the InjectionContainer
+ */
+ public void loadXml(X xml, InjectionContainer container)
+ {
+ super.loadXml(xml, container);
+ if (xml != null)
+ {
+ if (xml.getAnnotatedEjbReferences() != null)
+ loadAnnotatedEjbXml(xml.getAnnotatedEjbReferences(), container);
+ }
+ }
+
+ /**
+ * Process the AnnoatedEJBReferencesMetaData
+ *
+ * @param refs the AnnotatedEJBReferences
+ * @param container the InjectionContainer
+ */
+ protected void loadAnnotatedEjbXml(AnnotatedEJBReferencesMetaData refs, InjectionContainer container)
+ {
+ for (AnnotatedEJBReferenceMetaData ref : refs)
+ {
+ String interfaceName = ref.getBeanInterface().getName();
+ String errorType = "@EJB";
+
+ ejbRefXml(ref, interfaceName, container, errorType);
+ }
+ }
+
+}
More information about the jboss-cvs-commits
mailing list