[jboss-cvs] JBossAS SVN: r102511 - in trunk/server/src: main/java/org/jboss/as/javaee and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 17 08:25:36 EDT 2010
Author: wolfc
Date: 2010-03-17 08:25:34 -0400 (Wed, 17 Mar 2010)
New Revision: 102511
Modified:
trunk/server/src/etc/deployers/core-naming-jboss-beans.xml
trunk/server/src/main/java/org/jboss/as/javaee/SimpleJavaEEModuleIdentifier.java
trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEComponentInformer.java
trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEModuleInformer.java
Log:
JBAS-7556: implemented JavaEEComponentInformer
Modified: trunk/server/src/etc/deployers/core-naming-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/core-naming-jboss-beans.xml 2010-03-17 12:05:14 UTC (rev 102510)
+++ trunk/server/src/etc/deployers/core-naming-jboss-beans.xml 2010-03-17 12:25:34 UTC (rev 102511)
@@ -20,7 +20,9 @@
<bean name="NamingJavaEEModuleInformer" class="org.jboss.as.naming.javaee.NamingJavaEEModuleInformer">
<property name="javaEEModuleIdentifier"><inject bean="JavaEEModuleIdentifier"/></property>
</bean>
- <bean name="NamingJavaEEComponentInformer" class="org.jboss.as.naming.javaee.NamingJavaEEComponentInformer"/>
+ <bean name="NamingJavaEEComponentInformer" class="org.jboss.as.naming.javaee.NamingJavaEEComponentInformer">
+ <property name="javaEEModuleIdentifier"><inject bean="JavaEEModuleIdentifier"/></property>
+ </bean>
<bean name="AppNamingDeployer" class="org.jboss.reloaded.naming.deployers.AppNamingDeployer">
<constructor><parameter><inject bean="NamingJavaEEApplicationInformer"/></parameter></constructor>
Modified: trunk/server/src/main/java/org/jboss/as/javaee/SimpleJavaEEModuleIdentifier.java
===================================================================
--- trunk/server/src/main/java/org/jboss/as/javaee/SimpleJavaEEModuleIdentifier.java 2010-03-17 12:05:14 UTC (rev 102510)
+++ trunk/server/src/main/java/org/jboss/as/javaee/SimpleJavaEEModuleIdentifier.java 2010-03-17 12:25:34 UTC (rev 102511)
@@ -38,7 +38,7 @@
{
// TODO: this should really be hooked via an incallback visitor which dynamically identifies the deployment unit. So that this class has no tech dependencies.
- private static final String[] REQUIRED_ATTACHMENTS = { JBossClientMetaData.class.getName(), JBossMetaData.class.getName(), JBossWebMetaData.class.getName() };
+ private static final String[] REQUIRED_ATTACHMENTS = { JBossClientMetaData.class.getName(), JBossMetaData.class.getName(), JBossWebMetaData.class.getName(), NamedModule.class.getName() };
public JavaEEModuleInformer.ModuleType getModuleType(DeploymentUnit unit)
{
Modified: trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEComponentInformer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEComponentInformer.java 2010-03-17 12:05:14 UTC (rev 102510)
+++ trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEComponentInformer.java 2010-03-17 12:25:34 UTC (rev 102511)
@@ -1,6 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.as.naming.javaee;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
import org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer;
/**
@@ -8,14 +31,29 @@
*/
public class NamingJavaEEComponentInformer extends NamingJavaEEModuleInformer implements JavaEEComponentInformer
{
+ private static final String[] REQUIRED_ATTACHMENTS = { JBossEnterpriseBeanMetaData.class.getName(), JBossServletMetaData.class.getName() };
+
public String getComponentName(DeploymentUnit unit)
{
// FIXME: it's real ugly to analyze the deployment unit at this stage. Better to let the ComponentNamingDeployer be explicitly driven by meta data.
- return null;
+ JBossEnterpriseBeanMetaData ejb = unit.getAttachment(JBossEnterpriseBeanMetaData.class);
+ JBossServletMetaData servlet = unit.getAttachment(JBossServletMetaData.class);
+ assert ejb != null || servlet != null : "borked deployment unit " + unit;
+ if(ejb != null)
+ return ejb.getEjbName();
+ if(servlet != null)
+ return servlet.getServletName();
+ throw new IllegalStateException("Deployment unit " + unit + " has no known component meta data");
}
+ @Override
+ public String[] getRequiredAttachments()
+ {
+ return concat(super.getRequiredAttachments(), REQUIRED_ATTACHMENTS);
+ }
+
public boolean isJavaEEComponent(DeploymentUnit unit)
{
- return false;
+ return unit.isAttachmentPresent(JBossEnterpriseBeanMetaData.class) || unit.isAttachmentPresent(JBossServletMetaData.class);
}
}
Modified: trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEModuleInformer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEModuleInformer.java 2010-03-17 12:05:14 UTC (rev 102510)
+++ trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEModuleInformer.java 2010-03-17 12:25:34 UTC (rev 102511)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.as.naming.javaee;
import org.jboss.as.javaee.SimpleJavaEEModuleIdentifier;
@@ -4,6 +25,8 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.reloaded.naming.deployers.javaee.JavaEEModuleInformer;
+import java.lang.reflect.Array;
+
/**
* @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
*/
@@ -12,6 +35,16 @@
// TODO: for now we delegate to the former JPA SPI informer. This informer should be merged with that one into one integration component
private SimpleJavaEEModuleIdentifier identifier;
+ private String[] requiredAttachments;
+
+ protected static <T> T[] concat(T[] array1, T[] array2)
+ {
+ T[] result = (T[]) Array.newInstance(array1.getClass().getComponentType(), array1.length + array2.length);
+ System.arraycopy(array1, 0, result, 0, array1.length);
+ System.arraycopy(array2, 0, result, array1.length, array2.length);
+ return result;
+ }
+
public String getApplicationName(DeploymentUnit deploymentUnit)
{
return super.getApplicationName(deploymentUnit.getTopLevel());
@@ -46,8 +79,15 @@
return identifier.getModuleType(deploymentUnit);
}
+ @Override
+ public String[] getRequiredAttachments()
+ {
+ return requiredAttachments;
+ }
+
public void setJavaEEModuleIdentifier(SimpleJavaEEModuleIdentifier identifier)
{
this.identifier = identifier;
+ this.requiredAttachments = concat(super.getRequiredAttachments(), identifier.getRequiredAttachments());
}
}
More information about the jboss-cvs-commits
mailing list