[jboss-cvs] JBossAS SVN: r73243 - in projects/metadata/tags: 1.0.0.Beta15 and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 9 17:58:18 EDT 2008
Author: scott.stark at jboss.org
Date: 2008-05-09 17:58:18 -0400 (Fri, 09 May 2008)
New Revision: 73243
Added:
projects/metadata/tags/1.0.0.Beta15/
projects/metadata/tags/1.0.0.Beta15/pom.xml
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java
projects/metadata/tags/1.0.0.Beta15/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java
Removed:
projects/metadata/tags/1.0.0.Beta15/pom.xml
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java
projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java
projects/metadata/tags/1.0.0.Beta15/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java
Log:
[maven-release-plugin] copy for tag 1.0.0.Beta15
Copied: projects/metadata/tags/1.0.0.Beta15 (from rev 73237, projects/metadata/trunk)
Deleted: projects/metadata/tags/1.0.0.Beta15/pom.xml
===================================================================
--- projects/metadata/trunk/pom.xml 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/pom.xml 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,212 +0,0 @@
-<!--
- vi:ts=2:sw=2:expandtab
--->
-<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>
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>3</version>
- </parent>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata</artifactId>
- <packaging>jar</packaging>
- <version>1.0.0-SNAPSHOT</version>
- <name>JBoss Metadata</name>
- <url>http://www.jboss.org</url>
- <description>The common JavaEE metadata classes</description>
- <scm>
- <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/metadata/trunk/</connection>
- </scm>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss, A division of Red Hat</name>
- <url>http://www.jboss.org</url>
- </organization>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <printSummary>true</printSummary>
- <disableXmlReport>false</disableXmlReport>
- <testFailureIgnore>true</testFailureIgnore>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <includes>
- <include>**/*TestCase.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <!--
- Eclipse settings have been removed from parent. This needs to be
- done via an eclipse profile.
- http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085896#4085896
- -->
- <profiles>
- <profile>
- <id>eclipse</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- <buildOutputDirectory>target/eclipse-classes</buildOutputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <!-- This profile allows hudson to skip the jboss-deploy step -->
- <id>jboss-deploy</id>
- <activation>
- <property>
- <name>!skip.jboss-deploy</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jboss-deploy-plugin</artifactId>
- <version>1.5</version>
- <executions>
- <execution>
- <id>jboss-deploy</id>
- <goals>
- <goal>jboss-deploy</goal>
- </goals>
- <phase>deploy</phase>
- </execution>
- </executions>
- <configuration>
- <groupId>jboss</groupId>
- <imports>
- <jboss.common-core>2.2.1.GA,2.2.2.GA</jboss.common-core>
- </imports>
- <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
- <removeArtifactVersion>true</removeArtifactVersion>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <!-- Compile Dependencies -->
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>2.0.5.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <version>2.2.5.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-ext-api</artifactId>
- <version>0.3</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-ejb-api</artifactId>
- <version>3.0.0.CR1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-jms-api</artifactId>
- <version>1.1.0.CR1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-persistence-api</artifactId>
- <version>3.0.0.CR1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-transaction-api</artifactId>
- <version>1.0.1.CR1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-spi</artifactId>
- <version>1.0.2.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-jaxws</artifactId>
- <version>2.0.1.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <version>2.0.0.CR9</version>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <version>2.0.0.Beta11</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- <version>2.0.0.Beta15</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>1.1.0.GA</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
Copied: projects/metadata/tags/1.0.0.Beta15/pom.xml (from rev 73242, projects/metadata/trunk/pom.xml)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/pom.xml (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/pom.xml 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,212 @@
+<!--
+ vi:ts=2:sw=2:expandtab
+-->
+<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>
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>3</version>
+ </parent>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0.Beta15</version>
+ <name>JBoss Metadata</name>
+ <url>http://www.jboss.org</url>
+ <description>The common JavaEE metadata classes</description>
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/metadata/tags/1.0.0.Beta15</connection>
+ </scm>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss, A division of Red Hat</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <printSummary>true</printSummary>
+ <disableXmlReport>false</disableXmlReport>
+ <testFailureIgnore>true</testFailureIgnore>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!--
+ Eclipse settings have been removed from parent. This needs to be
+ done via an eclipse profile.
+ http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085896#4085896
+ -->
+ <profiles>
+ <profile>
+ <id>eclipse</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <buildOutputDirectory>target/eclipse-classes</buildOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <!-- This profile allows hudson to skip the jboss-deploy step -->
+ <id>jboss-deploy</id>
+ <activation>
+ <property>
+ <name>!skip.jboss-deploy</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jboss-deploy-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>jboss-deploy</id>
+ <goals>
+ <goal>jboss-deploy</goal>
+ </goals>
+ <phase>deploy</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <groupId>jboss</groupId>
+ <imports>
+ <jboss.common-core>2.2.1.GA,2.2.2.GA</jboss.common-core>
+ </imports>
+ <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
+ <removeArtifactVersion>true</removeArtifactVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <!-- Compile Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>2.0.5.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>2.2.5.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-ext-api</artifactId>
+ <version>0.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api</artifactId>
+ <version>3.0.0.CR1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jms-api</artifactId>
+ <version>1.1.0.CR1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-persistence-api</artifactId>
+ <version>3.0.0.CR1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-transaction-api</artifactId>
+ <version>1.0.1.CR1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-spi</artifactId>
+ <version>1.0.2.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-jaxws</artifactId>
+ <version>2.0.1.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <version>2.0.0.CR9</version>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>2.0.0.Beta11</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ <version>2.0.0.Beta15</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>1.1.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Deleted: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,1773 +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.metadata.ejb.jboss;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.ejb.TransactionAttributeType;
-import javax.ejb.TransactionManagementType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.jboss.metadata.common.ejb.IEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
-import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
-import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
-import org.jboss.metadata.ejb.spec.ContainerTransactionMetaData;
-import org.jboss.metadata.ejb.spec.ContainerTransactionsMetaData;
-import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.spec.EntityBeanMetaData;
-import org.jboss.metadata.ejb.spec.ExcludeListMetaData;
-import org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData;
-import org.jboss.metadata.ejb.spec.MethodInterfaceType;
-import org.jboss.metadata.ejb.spec.MethodMetaData;
-import org.jboss.metadata.ejb.spec.MethodPermissionMetaData;
-import org.jboss.metadata.ejb.spec.MethodPermissionsMetaData;
-import org.jboss.metadata.ejb.spec.SecurityIdentityMetaData;
-import org.jboss.metadata.ejb.spec.SessionBeanMetaData;
-import org.jboss.metadata.javaee.jboss.AnnotationsMetaData;
-import org.jboss.metadata.javaee.jboss.IgnoreDependencyMetaData;
-import org.jboss.metadata.javaee.jboss.JndiRefsMetaData;
-import org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData;
-import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
-import org.jboss.metadata.javaee.spec.EJBLocalReferencesMetaData;
-import org.jboss.metadata.javaee.spec.EJBReferenceMetaData;
-import org.jboss.metadata.javaee.spec.EJBReferencesMetaData;
-import org.jboss.metadata.javaee.spec.Environment;
-import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
-import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
-import org.jboss.metadata.javaee.spec.LifecycleCallbacksMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationReferencesMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceContextReferenceMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceContextReferencesMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceUnitReferenceMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceUnitReferencesMetaData;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
-import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleRefsMetaData;
-import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
-import org.jboss.metadata.javaee.spec.TransactionManagementTypeAdapter;
-import org.jboss.metadata.javaee.support.AbstractMappedMetaData;
-import org.jboss.metadata.javaee.support.NamedMetaData;
-import org.jboss.metadata.javaee.support.NamedMetaDataWithDescriptionGroup;
-import org.jboss.metadata.javaee.support.NonNullLinkedHashSet;
-import org.jboss.xb.annotations.JBossXmlConstants;
-import org.jboss.xb.annotations.JBossXmlModelGroup;
-
-/**
- * enterprise-bean/{session,entity,message-driven} metadata
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
- at JBossXmlModelGroup(
- kind=JBossXmlConstants.MODEL_GROUP_CHOICE,
- particles={
- @JBossXmlModelGroup.Particle(element=@XmlElement(name="session"), type=JBossSessionBeanMetaData.class),
- @JBossXmlModelGroup.Particle(element=@XmlElement(name="entity"), type=JBossEntityBeanMetaData.class),
- @JBossXmlModelGroup.Particle(element=@XmlElement(name="message-driven"), type=JBossMessageDrivenBeanMetaData.class),
- @JBossXmlModelGroup.Particle(element=@XmlElement(name="consumer"), type=JBossConsumerBeanMetaData.class),
- @JBossXmlModelGroup.Particle(element=@XmlElement(name="ejb"), type=JBossGenericBeanMetaData.class),
- @JBossXmlModelGroup.Particle(element=@XmlElement(name="service"), type=JBossServiceBeanMetaData.class)})
-public abstract class JBossEnterpriseBeanMetaData extends NamedMetaDataWithDescriptionGroup
- implements Environment,
- IEnterpriseBeanMetaData<JBossAssemblyDescriptorMetaData, JBossEnterpriseBeansMetaData, JBossEnterpriseBeanMetaData, JBossMetaData>
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 6909774842926430193L;
-
- /** The enterprise bean container */
- private JBossEnterpriseBeansMetaData enterpriseBeansMetaData;
-
- /** The mapped name */
- private String mappedName;
-
- /** The ejb class */
- private String ejbClass;
-
- /** The local jndi name */
- private String localJndiName;
-
- /** Whether to throw an exception if the transaction is marked for rollback */
- private boolean exceptionOnRollback;
-
- /** Whether to persist timers */
- private boolean timerPersistence = true;
-
- /** The configuration name */
- private String configurationName;
-
- /** The invokers */
- private InvokerBindingsMetaData invokers;
-
- /** The determined invokers */
- private transient InvokerBindingsMetaData determinedInvokers;
-
- /** The ior security config */
- private IORSecurityConfigMetaData iorSecurityConfig;
-
- /** The security proxy */
- private String securityProxy;
-
- /** The environment */
- private JBossEnvironmentRefsGroupMetaData jndiEnvironmentRefsGroup;
-
- /** The method attributes */
- private MethodAttributesMetaData methodAttributes;
-
- /** The security domain */
- private String securityDomain;
-
- /** The dependencies */
- private Set<String> depends;
-
- /** The annotations */
- private AnnotationsMetaData annotations;
-
- /** Ignore dependency */
- private IgnoreDependencyMetaData ignoreDependency;
-
- /** The aop domain name */
- private String aopDomainName;
-
- /** The pool configuration */
- private PoolConfigMetaData poolConfig;
-
- /** The jndi refs */
- private JndiRefsMetaData jndiRefs;
-
- /** The security identity */
- private SecurityIdentityMetaData securityIdentity;
-
- /** The cached container transactions */
- private transient ContainerTransactionsMetaData cachedContainerTransactions;
-
- /** The transaction type cache */
- private transient ConcurrentHashMap<Method, TransactionAttributeType> methodTx;
- /** The transaction type */
- private TransactionManagementType transactionType;
-
- /** the class name that implements the JNDI binding policy for this ejb */
- private String jndiBindingPolicy;
- /** The runtime name of the ejb container as known to the 'kernel', what ever it is */
- private String containerName;
- /** A non-managed generated container name as known to the 'kernel', what ever it is */
- private String generatedContainerName;
-
- /**
- * Create the correct JBossEnterpriseBeanMetaData for the input
- * standard bean metadata.
- *
- * @param bean the standard bean metadata
- * @return the corresponding jboss extenstion metadata
- */
- public static JBossEnterpriseBeanMetaData newBean(EnterpriseBeanMetaData bean)
- {
- JBossEnterpriseBeanMetaData jbean = null;
- if(bean instanceof EntityBeanMetaData)
- jbean = new JBossEntityBeanMetaData();
- if(bean instanceof MessageDrivenBeanMetaData)
- jbean = new JBossMessageDrivenBeanMetaData();
- if(bean instanceof SessionBeanMetaData)
- jbean = new JBossSessionBeanMetaData();
- return jbean;
- }
-
- /**
- * Create a new EnterpriseBeanMetaData.
- */
- public JBossEnterpriseBeanMetaData()
- {
- // For serialization
- }
-
- /**
- * Get the enterpriseBeansMetaData.
- *
- * @return the enterpriseBeansMetaData.
- */
- public JBossEnterpriseBeansMetaData getEnterpriseBeansMetaData()
- {
- return enterpriseBeansMetaData;
- }
-
- /**
- * Set the enterpriseBeansMetaData.
- *
- * @param enterpriseBeansMetaData the enterpriseBeansMetaData.
- */
- @XmlTransient
- public void setEnterpriseBeansMetaData(JBossEnterpriseBeansMetaData enterpriseBeansMetaData)
- {
- assert enterpriseBeansMetaData != null : "enterpriseBeansMetaData is null";
-
- this.enterpriseBeansMetaData = enterpriseBeansMetaData;
- }
-
- /**
- * Get the jbossMetaData.
- *
- * @return the jbossMetaData.
- */
- @XmlTransient
- public JBossMetaData getJBossMetaData()
- {
- if (enterpriseBeansMetaData == null)
- return null;
- return enterpriseBeansMetaData.getEjbJarMetaData();
- }
-
- /**
- * Get the jbossMetaData.
- *
- * @return the jbossMetaData with check
- */
- @XmlTransient
- public JBossMetaData getJBossMetaDataWithCheck()
- {
- JBossMetaData jbossMetaData = getJBossMetaData();
- if (jbossMetaData == null)
- throw new IllegalStateException("This bean is not a part of a deployment " + this);
- return jbossMetaData;
- }
-
- /**
- * Get the jndiEnvironmentRefsGroup.
- *
- * @return the jndiEnvironmentRefsGroup.
- */
- public Environment getJndiEnvironmentRefsGroup()
- {
- return jndiEnvironmentRefsGroup;
- }
-
- @XmlElement(type=JBossEnvironmentRefsGroupMetaData.class)
- public void setJndiEnvironmentRefsGroup(Environment env)
- {
- if (env == null)
- throw new IllegalArgumentException("Null jndiEnvironmentRefsGroup");
- JBossEnvironmentRefsGroupMetaData jenv = (JBossEnvironmentRefsGroupMetaData) env;
- if(jndiEnvironmentRefsGroup != null)
- jndiEnvironmentRefsGroup.merge(jenv, null, null, "jboss.xml", "ejb-jar.xml", false);
- else
- jndiEnvironmentRefsGroup = jenv;
- }
-
- /**
- * Get the ejbName.
- *
- * @return the ejbName.
- */
- public String getEjbName()
- {
- return getName();
- }
-
- /**
- * Set the ejbName.
- *
- * @param ejbName the ejbName.
- * @throws IllegalArgumentException for a null ejbName
- */
- public void setEjbName(String ejbName)
- {
- setName(ejbName);
- }
-
- public String getEjbClass()
- {
- return ejbClass;
- }
-
- @XmlTransient
- public JBossMetaData getEjbJarMetaData()
- {
- return enterpriseBeansMetaData.getEjbJarMetaData();
- }
-
- /**
- * Get the container transactions
- *
- * @return the container transactions or null for no result
- */
- @XmlTransient
- public ContainerTransactionsMetaData getContainerTransactions()
- {
- if (cachedContainerTransactions != null)
- return cachedContainerTransactions;
- JBossAssemblyDescriptorMetaData assemblyDescriptor = getAssemblyDescriptor();
- if (assemblyDescriptor == null)
- return null;
- return assemblyDescriptor.getContainerTransactionsByEjbName(getEjbName());
- }
-
- /**
- * Get the method transaction type
- *
- * @param methodName the method name
- * @param params the parameters
- * @param iface the interface type
- * @return the method transaction type
- */
- public TransactionAttributeType getMethodTransactionType(String methodName, Class<?>[] params, MethodInterfaceType iface)
- {
- // default value
- TransactionAttributeType result = null;
-
- ContainerTransactionsMetaData containerTransactions = getContainerTransactions();
- if (containerTransactions == null || containerTransactions.isEmpty())
- return result;
-
- ContainerTransactionMetaData bestMatchTransaction = null;
- MethodMetaData bestMatch = null;
- for (ContainerTransactionMetaData transaction : containerTransactions)
- {
- MethodMetaData match = transaction.bestMatch(methodName, params, iface, bestMatch);
- if (match != bestMatch)
- {
- bestMatchTransaction = transaction;
- bestMatch = match;
- }
- }
-
- if (bestMatchTransaction != null)
- result = bestMatchTransaction.getTransAttribute();
-
- return result;
- }
-
- /**
- * Get the transaction type
- *
- * @param m the method
- * @param iface the interface type
- * @return the transaction type
- */
- public TransactionAttributeType getMethodTransactionType(Method m, MethodInterfaceType iface)
- {
- if (m == null)
- return TransactionAttributeType.SUPPORTS;
-
- TransactionAttributeType result = null;
- if (methodTx != null)
- {
- result = methodTx.get(m);
- if (result != null)
- return result;
- }
-
- result = getMethodTransactionType(m.getName(), m.getParameterTypes(), iface);
-
- // provide default if method is not found in descriptor
- if (result == null)
- result = TransactionAttributeType.REQUIRED;
-
- if (methodTx == null)
- methodTx = new ConcurrentHashMap<Method, TransactionAttributeType>();
- methodTx.put(m, result);
- return result;
- }
-
- /**
- * Get the exclude list
- *
- * @return the exclude list or null for no result
- */
- @XmlTransient
- public ExcludeListMetaData getExcludeList()
- {
- JBossAssemblyDescriptorMetaData assemblyDescriptor = getAssemblyDescriptor();
- if (assemblyDescriptor == null)
- return null;
- return assemblyDescriptor.getExcludeListByEjbName(getEjbName());
- }
-
- public String getMappedName()
- {
- return mappedName;
- }
-
- public void setEjbClass(String ejbClass)
- {
- this.ejbClass = ejbClass;
- }
-
- public void setMappedName(String mappedName)
- {
- this.mappedName = mappedName;
- }
-
- /**
- * Whether this is a consumer bean
- *
- * @return true when a consumer bean
- */
- @XmlTransient
- public boolean isConsumer()
- {
- return false;
- }
-
- /**
- * Whether this is a service bean
- *
- * @return true when a service bean
- */
- @XmlTransient
- public boolean isService()
- {
- return false;
- }
-
- /**
- * Whether this is a session bean
- *
- * @return true when a session bean
- */
- @XmlTransient
- public boolean isSession()
- {
- return false;
- }
-
- /**
- * Whether this is a message driven bean
- *
- * @return true when a message driven bean
- */
- @XmlTransient
- public boolean isMessageDriven()
- {
- return false;
- }
-
- /**
- * Whether this is an entity bean
- *
- * @return true when an entity bean
- */
- @XmlTransient
- public boolean isEntity()
- {
- return false;
- }
-
- /**
- * Is this container managed transactions
- *
- * @return true when CMT
- */
- @XmlTransient
- public boolean isCMT()
- {
- TransactionManagementType type = getTransactionType();
- if (type == null)
- return true;
- else
- return type == TransactionManagementType.CONTAINER;
- }
-
- /**
- * Is this bean managed transactions
- *
- * @return true when BMT
- */
- @XmlTransient
- public boolean isBMT()
- {
- return isCMT() == false;
- }
-
- public TransactionManagementType getTransactionType()
- {
- return transactionType;
- }
-
- @XmlJavaTypeAdapter(TransactionManagementTypeAdapter.class)
- public void setTransactionType(TransactionManagementType transactionType)
- {
- this.transactionType = transactionType;
- }
-
- /**
- * Get the localJndiName.
- *
- * @return the localJndiName.
- */
- public String getLocalJndiName()
- {
- return localJndiName;
- }
-
- /**
- * Set the localJndiName.
- *
- * @param localJndiName the localJndiName.
- * @throws IllegalArgumentException for a null localJndiName
- */
- public void setLocalJndiName(String localJndiName)
- {
- if (localJndiName == null)
- throw new IllegalArgumentException("Null localJndiName");
- this.localJndiName = localJndiName;
- }
-
- /**
- * Determine the localJndiName.
- *
- * @return the localJndiName.
- */
- @XmlTransient
- public String determineLocalJndiName()
- {
- if (localJndiName != null)
- return localJndiName;
-
- String ejbName = getEjbName();
- // Generate a unique name based on ejbName + identityHashCode
- return "local/" + ejbName + '@' + System.identityHashCode(ejbName);
- }
-
- /**
- * Get the base jndi name for the bean if one exists. Not all ejbs have
- * a jndi name notion.
- *
- * @return the base jndi name for the ejb it one exists, null otherwise.
- */
- @XmlTransient
- abstract public String determineJndiName();
-
- /**
- * Determine the jndi name for the proxy associated with iface. This calls
- * {@link #determineResolvedJndiName(String, null)}
- *
- * @param iface - the fully qualified class name of the interface, or one
- * of the {@linkplain KnownInterfaces}. May be null in which case the base
- * name as determined by {@link #getMappedName()} or
- * {@link #determineJndiName()} is used.
- * @return the resolved jndi name
- */
- @XmlTransient
- public String determineResolvedJndiName(String iface)
- {
- return determineResolvedJndiName(iface, null);
- }
- /**
- * Determine the jndi name for the proxy associated with iface. This uses
- * the bean DefaultJndiBindingPolicy. This will be one of in the following
- * order:
- * - {@link #getJndiBindingPolicy()} the metadata policy
- * - the argument defaultPolicy
- * - BasicJndiBindingPolicy(base-jndi-name)
- *
- * @param iface - the fully qualified class name of the interface, or one
- * of the {@linkplain KnownInterfaces}. May be null in which case the base
- * name as determined by {@link #getMappedName()} or
- * {@link #determineJndiName()} is used.
- * @param defaultPolicy - an optional DefaultJndiBindingPolicy to use if
- * {@link #getJndiBindingPolicy()} is null.
- * @return the resolved jndi name
- */
- public String determineResolvedJndiName(String iface,
- DefaultJndiBindingPolicy defaultPolicy)
- {
- String baseJndiName = getMappedName();
- if(baseJndiName == null)
- baseJndiName = determineJndiName();
- String resolvedJndiName = baseJndiName;
- if(getJBossMetaData().getDeploymentSummary() != null)
- {
- // Use summary info to create the metadata policy if it exists
- DeploymentSummary dsummary = getJBossMetaData().getDeploymentSummary();
- DefaultJndiBindingPolicy policy = null;
- try
- {
- policy = createPolicy(dsummary.getLoader(), null);
- }
- catch(Exception e)
- {
- }
- if(policy == null)
- policy = defaultPolicy;
- if(policy == null)
- {
- // Use the metadata default binding policy
- policy = new BasicJndiBindingPolicy(baseJndiName);
- }
-
- // Derive the summary info from this metadata and deployment summary
- EjbDeploymentSummary ejbSummary = new EjbDeploymentSummary(this, dsummary);
- // The targeted business interface to append to the jndi name
- String ifaceToAppend = null;
- // Need to compare iface against the metadata local-home/home & business locals/remotes
- if(this.isSession())
- {
- JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) this;
- // Map local/remote home
- if(sbeanMD.getLocalHome() != null && sbeanMD.getLocalHome().equals(iface))
- iface = KnownInterfaces.LOCAL_HOME;
- else if(sbeanMD.getHome() != null && sbeanMD.getHome().equals(iface))
- iface = KnownInterfaces.HOME;
- else
- {
- // Check business locals
- BusinessLocalsMetaData locals = sbeanMD.getBusinessLocals();
- if(locals != null)
- {
- for(String local : locals)
- {
- if(local.equals(iface))
- {
- ifaceToAppend = iface;
- iface = KnownInterfaces.LOCAL;
- break;
- }
- }
- }
- if(ifaceToAppend == null)
- {
- // Check business remotes
- BusinessRemotesMetaData remotes = sbeanMD.getBusinessRemotes();
- if(remotes != null)
- {
- for(String remote : remotes)
- {
- if(remote.equals(iface))
- {
- ifaceToAppend = iface;
- iface = KnownInterfaces.REMOTE;
- break;
- }
- }
- }
- }
- }
- }
- else if(this.isEntity())
- {
- JBossEntityBeanMetaData ebeanMD = (JBossEntityBeanMetaData) this;
- if(ebeanMD.getLocalHome() != null && ebeanMD.getLocalHome().equals(iface))
- iface = KnownInterfaces.LOCAL_HOME;
- else if(ebeanMD.getHome() != null && ebeanMD.getHome().equals(iface))
- iface = KnownInterfaces.HOME;
- }
-
- // Have the policy
- resolvedJndiName = policy.getJndiName(ejbSummary, iface);
- if(ifaceToAppend != null)
- {
- resolvedJndiName += "-" + ifaceToAppend;
- }
- }
- return resolvedJndiName;
- }
-
- /**
- * Create the DefaultJndiBindingPolicy from the bean metadata.
- *
- * @param loader - the class loader used to load the policy class
- * @param defaultPolicyClass - a fallback implementation to use if the
- * bean has no policy set.
- * @return the DefaultJndiBindingPolicy implementation
- * @throws Exception on failure to load the policy class or instantiate it
- */
- @XmlTransient
- public DefaultJndiBindingPolicy createPolicy(ClassLoader loader,
- Class<? extends DefaultJndiBindingPolicy> defaultPolicyClass)
- throws Exception
- {
- Class<? extends DefaultJndiBindingPolicy> policyClass = defaultPolicyClass;
- String policyClassName = getJndiBindingPolicy();
- if(policyClassName != null && loader != null)
- {
- policyClass = (Class<? extends DefaultJndiBindingPolicy>)
- loader.loadClass(policyClassName);
- }
- DefaultJndiBindingPolicy policy = null;
- if(policyClass != null)
- policy = policyClass.newInstance();
- return policy;
- }
-
- /**
- * Determine the container jndi name used in the object name. This is
- * really obsolete as there is no need for jmx names.
- *
- * @return the jndi name suitable for use in the object name
- */
- @XmlTransient
- public String getContainerObjectNameJndiName()
- {
- return getLocalJndiName();
- }
-
- /**
- * Get the kernel name for the ejb container. This is the managed property
- * version admin tools may use to control the name. Generally its not set
- * and the server will set the name via the generatedContainerName
- * non-managed property.
- *
- * @see #setGeneratedContainerName(String)
- * @return containerName property value.
- */
- public String getContainerName()
- {
- return containerName;
- }
- public void setContainerName(String containerName)
- {
- this.containerName = containerName;
- }
-
- /**
- * Get the generated kernel name for the ejb container. This is the
- * non-managed property version that the server would use to set the name
- * it generated when no containerName property existed.
- *
- * @see #getContainerName()
- * @return generatedContainerName property value.
- */
- @XmlTransient
- public String getGeneratedContainerName()
- {
- return generatedContainerName;
- }
- public void setGeneratedContainerName(String containerName)
- {
- this.generatedContainerName = containerName;
- }
- /**
- * Get the kernel name for the ejb container. This is either the
- * containerName managed property, or a runtime generated name set via
- * the non-managed generatedContainerName property.
- * @return the kernel name for the ejb container
- */
- public String determineContainerName()
- {
- String name = containerName;
- if(name == null)
- name = generatedContainerName;
- return name;
- }
-
- /**
- * Get the exceptionOnRollback.
- *
- * @return the exceptionOnRollback.
- */
- public boolean isExceptionOnRollback()
- {
- return exceptionOnRollback;
- }
-
- /**
- * Set the exceptionOnRollback.
- *
- * @param exceptionOnRollback the exceptionOnRollback.
- */
- public void setExceptionOnRollback(boolean exceptionOnRollback)
- {
- this.exceptionOnRollback = exceptionOnRollback;
- }
-
- /**
- * Get the timerPersistence.
- *
- * @return the timerPersistence.
- */
- public boolean isTimerPersistence()
- {
- return timerPersistence;
- }
-
- /**
- * Set the timerPersistence.
- *
- * @param timerPersistence the timerPersistence.
- */
- public void setTimerPersistence(boolean timerPersistence)
- {
- this.timerPersistence = timerPersistence;
- }
-
- /**
- * Get the configurationName.
- *
- * @return the configurationName.
- */
- public String getConfigurationName()
- {
- return configurationName;
- }
-
- /**
- * Set the configurationName.
- *
- * @param configurationName the configurationName.
- * @throws IllegalArgumentException for a null configurationName
- */
- public void setConfigurationName(String configurationName)
- {
- if (configurationName == null)
- throw new IllegalArgumentException("Null configurationName");
- this.configurationName = configurationName;
- }
-
- /**
- * Determine the configuration name
- *
- * @return the configuration name
- */
- public String determineConfigurationName()
- {
- if (configurationName != null)
- return configurationName;
-
- return getDefaultConfigurationName();
- }
-
- /**
- * Get the container configuration
- *
- * @return the container configuration
- */
- public ContainerConfigurationMetaData determineContainerConfiguration()
- {
- String name = determineConfigurationName();
- ContainerConfigurationMetaData result = getJBossMetaDataWithCheck().getContainerConfiguration(name);
- if (result == null)
- throw new IllegalStateException("Container configuration not found: " + name + " available: " + getJBossMetaDataWithCheck().getContainerConfigurations());
- return result;
- }
-
- public void setPoolConfig(PoolConfigMetaData poolConfig)
- {
- this.poolConfig = poolConfig;
- }
-
- /**
- * Get the default configuration name
- *
- * @return the default name
- */
- public abstract String getDefaultConfigurationName();
-
- /**
- * Get the securityProxy.
- *
- * @return the securityProxy.
- */
- public String getSecurityProxy()
- {
- return securityProxy;
- }
-
- /**
- * Set the securityProxy.
- *
- * @param securityProxy the securityProxy.
- * @throws IllegalArgumentException for a null securityProxy
- */
- public void setSecurityProxy(String securityProxy)
- {
- if (securityProxy == null)
- throw new IllegalArgumentException("Null securityProxy");
- this.securityProxy = securityProxy;
- }
-
- /**
- * Get the securityDomain.
- *
- * @return the securityDomain.
- */
- public String getSecurityDomain()
- {
- return securityDomain;
- }
-
- /**
- * Set the securityDomain.
- *
- * @param securityDomain the securityDomain.
- * @throws IllegalArgumentException for a null securityDomain
- */
- @XmlElement(required=false)
- public void setSecurityDomain(String securityDomain)
- {
- if (securityDomain == null)
- throw new IllegalArgumentException("Null securityDomain");
- this.securityDomain = securityDomain;
- }
-
- /**
- * Get the depends.
- *
- * @return the depends.
- */
- public Set<String> getDepends()
- {
- return depends;
- }
-
- /**
- * Set the depends.
- *
- * @param depends the depends.
- * @throws IllegalArgumentException for a null depends
- */
- @XmlElement(/*type=NonNullLinkedHashSet.class*/)
- public void setDepends(Set<String> depends)
- {
- if (depends == null)
- throw new IllegalArgumentException("Null depends");
- this.depends = depends;
- }
-
- /**
- * Get the depends.
- *
- * @return the depends.
- */
- public Set<String> determineAllDepends()
- {
- NonNullLinkedHashSet<String> result = new NonNullLinkedHashSet<String>();
-
- Set<String> depends = getDepends();
- if (depends != null)
- result.addAll(depends);
-
- ContainerConfigurationMetaData containerConfigurationMetaData = determineContainerConfiguration();
- if (containerConfigurationMetaData != null)
- {
- depends = containerConfigurationMetaData.getDepends();
- if (depends != null)
- result.addAll(depends);
- }
-
- return result;
- }
-
- /**
- * Get the invokers.
- *
- * @return the invokers.
- */
- public InvokerBindingsMetaData getInvokerBindings()
- {
- return invokers;
- }
-
- /**
- * Set the invokers.
- *
- * @param invokers the invokers.
- * @throws IllegalArgumentException for a null invokers
- */
- public void setInvokerBindings(InvokerBindingsMetaData invokers)
- {
- if (invokers == null)
- throw new IllegalArgumentException("Null invokers");
- this.invokers = invokers;
- }
-
- /**
- * Determine the invokers
- *
- * @return the invokers.
- */
- public InvokerBindingsMetaData determineInvokerBindings()
- {
- // We already worked it out
- if (determinedInvokers != null)
- return determinedInvokers;
-
- // Use anything configured
- if (invokers != null)
- {
- determinedInvokers = invokers;
- return determinedInvokers;
- }
-
- // Look at the container configuration
- ContainerConfigurationMetaData containerConfiguration = determineContainerConfiguration();
- Set<String> invokerProxyBindingNames = containerConfiguration.getInvokerProxyBindingNames();
- if (invokerProxyBindingNames != null && invokerProxyBindingNames.isEmpty() == false)
- {
- determinedInvokers = new InvokerBindingsMetaData();
-
- // Like the original code, they all get bound with the same name?
- String jndiName = getDefaultInvokerJndiName();
- for (String name : invokerProxyBindingNames)
- {
- InvokerBindingMetaData invoker = new InvokerBindingMetaData();
- invoker.setInvokerProxyBindingName(name);
- if (jndiName != null)
- invoker.setJndiName(jndiName);
- determinedInvokers.add(invoker);
- }
- }
- else
- {
- determinedInvokers = getDefaultInvokers();
- }
- return determinedInvokers;
- }
-
- /**
- * Determine an invoker binding
- *
- * @param invokerName the invoker proxy binding name
- * @return the invoke binding
- * @throws IllegalStateException if there is no such binding
- */
- public InvokerBindingMetaData determineInvokerBinding(String invokerName)
- {
- InvokerBindingMetaData binding = determineInvokerBindings().get(invokerName);
- if (binding == null)
- throw new IllegalStateException("No such binding: " + invokerName + " available: " + determinedInvokers);
- return binding;
- }
-
- /**
- * Determine the jndi name for invoker bindings that come from the container configuration
- *
- * @return the jndi name suitable for use on the default invoker
- */
- protected String getDefaultInvokerJndiName()
- {
- return null;
- }
-
- /**
- * Get the default invokers
- *
- * @return the default invokers
- */
- protected InvokerBindingsMetaData getDefaultInvokers()
- {
- InvokerBindingsMetaData bindings = new InvokerBindingsMetaData();
- InvokerBindingMetaData binding = new InvokerBindingMetaData();
- binding.setInvokerProxyBindingName(getDefaultInvokerName());
- String jndiName = getDefaultInvokerJndiName();
- if (jndiName != null)
- binding.setJndiName(getDefaultInvokerJndiName());
- bindings.add(binding);
- return bindings;
- }
-
- /**
- * Get the default invokers
- *
- * @return the default invokers
- */
- protected abstract String getDefaultInvokerName();
-
- public EJBLocalReferenceMetaData getEjbLocalReferenceByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getEjbLocalReferences());
- }
-
- @XmlTransient
- public EJBLocalReferencesMetaData getEjbLocalReferences()
- {
- EJBLocalReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getEjbLocalReferences();
- return refs;
- }
-
- public EJBReferenceMetaData getEjbReferenceByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getEjbReferences());
- }
-
- @XmlTransient
- public EJBReferencesMetaData getEjbReferences()
- {
- EJBReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getEjbReferences();
- return refs;
- }
- // TODO?
- @XmlTransient
- public AnnotatedEJBReferencesMetaData getAnnotatedEjbReferences()
- {
- AnnotatedEJBReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getAnnotatedEjbReferences();
- return refs;
- }
-
- @XmlTransient
- public EnvironmentEntriesMetaData getEnvironmentEntries()
- {
- EnvironmentEntriesMetaData env = null;
- if(jndiEnvironmentRefsGroup != null)
- env = jndiEnvironmentRefsGroup.getEnvironmentEntries();
- return env;
- }
-
- public EnvironmentEntryMetaData getEnvironmentEntryByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getEnvironmentEntries());
- }
-
- public MessageDestinationReferenceMetaData getMessageDestinationReferenceByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getMessageDestinationReferences());
- }
-
- @XmlTransient
- public MessageDestinationReferencesMetaData getMessageDestinationReferences()
- {
- MessageDestinationReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getMessageDestinationReferences();
- return refs;
- }
-
- public PersistenceContextReferenceMetaData getPersistenceContextReferenceByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getPersistenceContextRefs());
- }
-
- @XmlTransient
- public PersistenceContextReferencesMetaData getPersistenceContextRefs()
- {
- PersistenceContextReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getPersistenceContextRefs();
- return refs;
- }
-
- public PersistenceUnitReferenceMetaData getPersistenceUnitReferenceByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getPersistenceUnitRefs());
- }
-
- @XmlTransient
- public PersistenceUnitReferencesMetaData getPersistenceUnitRefs()
- {
- PersistenceUnitReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getPersistenceUnitRefs();
- return refs;
- }
-
- public PoolConfigMetaData getPoolConfig()
- {
- return poolConfig;
- }
-
- @XmlTransient
- public LifecycleCallbacksMetaData getPostConstructs()
- {
- LifecycleCallbacksMetaData lcs = null;
- if(jndiEnvironmentRefsGroup != null)
- lcs = jndiEnvironmentRefsGroup.getPostConstructs();
- return lcs;
- }
-
- @XmlTransient
- public LifecycleCallbacksMetaData getPreDestroys()
- {
- LifecycleCallbacksMetaData lcs = null;
- if(jndiEnvironmentRefsGroup != null)
- lcs = jndiEnvironmentRefsGroup.getPreDestroys();
- return lcs;
- }
-
- public ResourceEnvironmentReferenceMetaData getResourceEnvironmentReferenceByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getResourceEnvironmentReferences());
- }
-
- @XmlTransient
- public ResourceEnvironmentReferencesMetaData getResourceEnvironmentReferences()
- {
- ResourceEnvironmentReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getResourceEnvironmentReferences();
- return refs;
- }
-
- public ResourceReferenceMetaData getResourceReferenceByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getResourceReferences());
- }
-
- @XmlTransient
- public ResourceReferencesMetaData getResourceReferences()
- {
- ResourceReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getResourceReferences();
- return refs;
- }
-
- public ServiceReferenceMetaData getServiceReferenceByName(String name)
- {
- return AbstractMappedMetaData.getByName(name, getServiceReferences());
- }
-
- @XmlTransient
- public ServiceReferencesMetaData getServiceReferences()
- {
- ServiceReferencesMetaData refs = null;
- if(jndiEnvironmentRefsGroup != null)
- refs = jndiEnvironmentRefsGroup.getServiceReferences();
- return refs;
- }
-
- /**
- * Provies a common accessor that returns an empty security role refs.
- * Subclasses that support security-role-refs must override.
- * @return An empty security role refs.
- */
- @XmlTransient
- public SecurityRoleRefsMetaData getSecurityRoleRefs()
- {
- return new SecurityRoleRefsMetaData();
- }
-
- /**
- * Get the annotations.
- *
- * @return the annotations.
- */
- public AnnotationsMetaData getAnnotations()
- {
- return annotations;
- }
-
- /**
- * Set the annotations.
- *
- * @param annotations the annotations.
- * @throws IllegalArgumentException for a null annotations
- */
- @XmlElement(name="annotation")
- public void setAnnotations(AnnotationsMetaData annotations)
- {
- if (annotations == null)
- throw new IllegalArgumentException("Null annotations");
- this.annotations = annotations;
- }
-
- /**
- * Get the aopDomainName.
- *
- * @return the aopDomainName.
- */
- public String getAopDomainName()
- {
- return aopDomainName;
- }
-
- /**
- * Set the aopDomainName.
- *
- * @param aopDomainName the aopDomainName.
- * @throws IllegalArgumentException for a null aopDomainName
- */
- public void setAopDomainName(String aopDomainName)
- {
- if (aopDomainName == null)
- throw new IllegalArgumentException("Null aopDomainName");
- this.aopDomainName = aopDomainName;
- }
-
- /**
- * Get the jndiRefs.
- *
- * @return the jndiRefs.
- */
- public JndiRefsMetaData getJndiRefs()
- {
- return jndiRefs;
- }
-
- /**
- * Set the jndiRefs.
- *
- * @param jndiRefs the jndiRefs.
- * @throws IllegalArgumentException for a null jndiRefs
- */
- @XmlElement(name="jndi-ref")
- public void setJndiRefs(JndiRefsMetaData jndiRefs)
- {
- if (jndiRefs == null)
- throw new IllegalArgumentException("Null jndiRefs");
- this.jndiRefs = jndiRefs;
- }
-
- /**
- * Get a security role
- *
- * @param roleName the role name
- * @return the security role or null if not found
- */
- @XmlTransient
- public SecurityRoleMetaData getSecurityRole(String roleName)
- {
- JBossAssemblyDescriptorMetaData assemblyDescriptor = getJBossMetaDataWithCheck().getAssemblyDescriptor();
- if (assemblyDescriptor == null)
- return null;
- else
- return assemblyDescriptor.getSecurityRole(roleName);
- }
-
- /**
- * Get a security role's principals
- *
- * @param roleName the role name
- * @return the principals or null if not found
- */
- public Set<String> getSecurityRolePrincipals(String roleName)
- {
- JBossAssemblyDescriptorMetaData assemblyDescriptor = getJBossMetaDataWithCheck().getAssemblyDescriptor();
- if (assemblyDescriptor == null)
- return null;
- else
- return assemblyDescriptor.getSecurityRolePrincipals(roleName);
- }
-
- /**
- * Get the methods permissions
- *
- * @return the method permissions or null for no result
- */
- @XmlTransient
- public MethodPermissionsMetaData getMethodPermissions()
- {
- JBossAssemblyDescriptorMetaData assemblyDescriptor = getAssemblyDescriptor();
- if (assemblyDescriptor == null)
- return null;
- return assemblyDescriptor.getMethodPermissionsByEjbName(getEjbName());
- }
-
- /**
- * A somewhat tedious method that builds a Set<Principal> of the roles
- * that have been assigned permission to execute the indicated method. The
- * work performed is tedious because of the wildcard style of declaring
- * method permission allowed in the ejb-jar.xml descriptor. This method is
- * called by the Container.getMethodPermissions() when it fails to find the
- * prebuilt set of method roles in its cache.
- *
- * @param methodName the method name
- * @param params the parameters
- * @param interfaceType the interface type
- * @return The Set<String> for the application domain roles that caller principal's are to be validated against.
- */
- public Set<String> getMethodPermissions(String methodName, Class<?>[] params, MethodInterfaceType interfaceType)
- {
- Set<String> result = null;
-
- JBossMetaData jbossMetaData = getJBossMetaDataWithCheck();
-
- // First check the excluded method list as this takes priority over
- // all other assignments
- ExcludeListMetaData excluded = getExcludeList();
- if (excluded != null && excluded.matches(methodName, params, interfaceType))
- {
- // No one is allowed to execute this method so add a role that
- // fails to equate to any Principal or Principal name and return.
- // We don't return null to differentiate between an explicit
- // assignment of no access and no assignment information.
- if (result == null)
- result = new HashSet<String>();
- result.add(SecurityRoleNames.NOBODY_PRINCIPAL);
- return result;
- }
-
- // Check the permissioned methods list
- MethodPermissionsMetaData permissions = getMethodPermissions();
- if (permissions != null)
- {
- for (MethodPermissionMetaData permission : permissions)
- {
- if (permission.isNotChecked(methodName, params, interfaceType))
- {
- if (result == null)
- result = new HashSet<String>();
- result.clear();
- result.add(SecurityRoleNames.ANYBODY_PRINCIPAL);
- break;
- }
- else if (permission.matches(methodName, params, interfaceType))
- {
- Set<String> roles = permission.getRoles();
- if (roles != null)
- {
- if (result == null)
- result = new HashSet<String>();
- for (String roleName : roles)
- {
- // Get any extra principal names assigned to the role
- Set<String> principals = getSecurityRolePrincipals(roleName);
- if (principals != null)
- {
- for (String principal : principals)
- {
- result.add(principal);
- }
- }
- // Also add the role name itself
- result.add(roleName);
- }
- }
- }
- }
- }
-
- if (jbossMetaData.isExcludeMissingMethods() == false && result == null)
- {
- result = new HashSet<String>();
- result.add(SecurityRoleNames.ANYBODY_PRINCIPAL);
- }
-
- if (result == null)
- result = Collections.emptySet();
- return result;
- }
-
- /**
- * Check to see if there was a method-permission or exclude-list statement
- * for the given method.
- *
- * @param methodName - the method name
- * @param params - the method parameter signature
- * @param interfaceType - the method interface type
- * @return true if a matching method permission exists, false if no match
- */
- public boolean hasMethodPermissions(String methodName, Class<?>[] params, MethodInterfaceType interfaceType)
- {
- // First check the excluded method list as this takes priority over
- // all other assignments
- ExcludeListMetaData excluded = getExcludeList();
- if (excluded != null && excluded.matches(methodName, params, interfaceType))
- return true;
-
- // Check the permissioned methods list
- MethodPermissionsMetaData permissions = getMethodPermissions();
- if (permissions != null)
- {
- for (MethodPermissionMetaData permission : permissions)
- {
- if (permission.matches(methodName, params, interfaceType))
- return true;
- }
- }
-
- // No match
- return false;
- }
-
- /**
- * Get the iorSecurityConfig.
- *
- * @return the iorSecurityConfig.
- */
- public IORSecurityConfigMetaData getIorSecurityConfig()
- {
- return iorSecurityConfig;
- }
-
- /**
- * Set the iorSecurityConfig.
- *
- * @param iorSecurityConfig the iorSecurityConfig.
- * @throws IllegalArgumentException for a null iorSecurityConfig
- */
- public void setIorSecurityConfig(IORSecurityConfigMetaData iorSecurityConfig)
- {
- if (iorSecurityConfig == null)
- throw new IllegalArgumentException("Null iorSecurityConfig");
- this.iorSecurityConfig = iorSecurityConfig;
- }
-
- /**
- * Get the ignoreDependency.
- *
- * @return the ignoreDependency.
- */
- public IgnoreDependencyMetaData getIgnoreDependency()
- {
- return ignoreDependency;
- }
-
- /**
- * Set the ignoreDependency.
- *
- * @param ignoreDependency the ignoreDependency.
- * @throws IllegalArgumentException for a null ignoreDependency
- */
- public void setIgnoreDependency(IgnoreDependencyMetaData ignoreDependency)
- {
- if (ignoreDependency == null)
- throw new IllegalArgumentException("Null ignoreDependency");
- this.ignoreDependency = ignoreDependency;
- }
-
- /**
- * Get the methodAttributes.
- *
- * @return the methodAttributes.
- */
- public MethodAttributesMetaData getMethodAttributes()
- {
- return methodAttributes;
- }
-
- /**
- * Set the methodAttributes.
- *
- * @param methodAttributes the methodAttributes.
- * @throws IllegalArgumentException for a null methodAttributes
- */
- public void setMethodAttributes(MethodAttributesMetaData methodAttributes)
- {
- if (methodAttributes == null)
- throw new IllegalArgumentException("Null methodAttributes");
- this.methodAttributes = methodAttributes;
- }
-
- /**
- * Is this method a read-only method
- *
- * @param methodName the method name
- * @return true for read only
- */
- public boolean isMethodReadOnly(String methodName)
- {
- if (methodAttributes == null)
- return false;
- return methodAttributes.isMethodReadOnly(methodName);
- }
-
- /**
- * Is this method a read-only method
- *
- * @param method the method
- * @return true for read only
- */
- public boolean isMethodReadOnly(Method method)
- {
- if (method == null)
- return false;
- return isMethodReadOnly(method.getName());
- }
-
- /**
- * Get the transaction timeout for the method
- *
- * @param methodName the method name
- * @return the transaction timeout
- */
- public int getMethodTransactionTimeout(String methodName)
- {
- if (methodAttributes == null)
- return 0;
- return methodAttributes.getMethodTransactionTimeout(methodName);
- }
-
- /**
- * Get the transaction timeout for the method
- *
- * @param method the method
- * @return the transaction timeout
- */
- public int getMethodTransactionTimeout(Method method)
- {
- if (method == null)
- return 0;
- return getMethodTransactionTimeout(method.getName());
- }
-
- /**
- * Get the securityIdentity.
- *
- * @return the securityIdentity.
- */
- public SecurityIdentityMetaData getSecurityIdentity()
- {
- return securityIdentity;
- }
-
- /**
- * Set the securityIdentity.
- *
- * @param securityIdentity the securityIdentity.
- * @throws IllegalArgumentException for a null securityIdentity
- */
- public void setSecurityIdentity(SecurityIdentityMetaData securityIdentity)
- {
- if (securityIdentity == null)
- throw new IllegalArgumentException("Null securityIdentity");
- this.securityIdentity = securityIdentity;
- }
-
- @Override
- public void merge(NamedMetaData override, NamedMetaData original)
- {
- throw new RuntimeException("wrong merge method called");
- }
-
- public void merge(JBossEnterpriseBeanMetaData override, EnterpriseBeanMetaData original)
- {
- this.merge(override, original, "jboss.xml", "ejb-jar.xml", true);
- }
- public void merge(JBossEnterpriseBeanMetaData override, EnterpriseBeanMetaData original,
- String overrideFile, String overridenFile, boolean mustOverride)
- {
- super.merge(override, original);
- if(override != null && override.getEjbClass() != null)
- setEjbClass(override.getEjbClass());
- else if(original != null && original.getEjbClass() != null)
- setEjbClass(original.getEjbClass());
- if(override != null && override.getName() != null)
- setName(override.getName());
- else if(original != null && original.getName() != null)
- setName(original.getName());
- if(override != null && override.getMappedName() != null)
- setMappedName(override.getMappedName());
- else if(original != null && original.getMappedName() != null)
- setMappedName(original.getMappedName());
-
- // transactionType
- if(override != null && override.getTransactionType() != null)
- transactionType = override.getTransactionType();
- else if(original != null && original.getTransactionType() != null)
- transactionType = original.getTransactionType();
-
- if(override != null)
- {
- if(override.getAopDomainName() != null)
- setAopDomainName(override.getAopDomainName());
- if(override.getConfigurationName() != null)
- setConfigurationName(override.getConfigurationName());
- if(override.getAnnotations() != null)
- setAnnotations(override.getAnnotations());
- if(override.getDepends() != null)
- setDepends(override.getDepends());
- setExceptionOnRollback(override.isExceptionOnRollback());
- if(override.getIgnoreDependency() != null)
- setIgnoreDependency(override.getIgnoreDependency());
- if(override.getInvokerBindings() != null)
- setInvokerBindings(override.getInvokerBindings());
- if(override.getIorSecurityConfig() != null)
- setIorSecurityConfig(override.getIorSecurityConfig());
- if(override.getSecurityProxy() != null)
- setSecurityProxy(override.getSecurityProxy());
- }
-
- if(this.jndiEnvironmentRefsGroup == null)
- jndiEnvironmentRefsGroup = new JBossEnvironmentRefsGroupMetaData();
- Environment env = original != null ? original.getJndiEnvironmentRefsGroup() : null;
- JBossEnvironmentRefsGroupMetaData jenv = null;
- ResourceManagersMetaData resourceMgrs = this.getJBossMetaData().getResourceManagers();
- if( override != null )
- {
- ResourceManagersMetaData resourceMgrsOverride = override.getJBossMetaData().getResourceManagers();
- if(resourceMgrsOverride != null)
- resourceMgrs = resourceMgrsOverride;
- jenv = (JBossEnvironmentRefsGroupMetaData) override.getJndiEnvironmentRefsGroup();
- }
- jndiEnvironmentRefsGroup.merge(jenv, env, resourceMgrs, overridenFile, overrideFile, mustOverride);
-
- // Fixup the invoker binding references on ejb refs
- InvokerBindingsMetaData invokerBindings = getInvokerBindings();
- if (invokerBindings != null && invokerBindings.isEmpty() == false)
- {
- for (InvokerBindingMetaData invokerBinding : invokerBindings)
- {
- if(invokerBinding.getEjbRefs() != null)
- {
- for(InvokerBindingMetaData.EjbRef ejbRef : invokerBinding.getEjbRefs())
- {
- EJBReferenceMetaData targetEjbRef = jndiEnvironmentRefsGroup.getEjbReferenceByName(ejbRef.getEjbRefName());
- if (targetEjbRef == null)
- throw new IllegalStateException("ejb-ref " + ejbRef.getEjbRefName() + " found on invoker " + invokerBinding.getName() + " but it does not exist for ejb: " + getName());
- targetEjbRef.addInvokerBinding(invokerBinding.getName(), ejbRef.getJndiName());
- }
- }
- }
- }
-
- // Fixup the security identity
- SecurityIdentityMetaData jbossSecurityIdentity = null;
- if (override != null && override.getSecurityIdentity() != null)
- jbossSecurityIdentity = override.getSecurityIdentity();
- SecurityIdentityMetaData originalSecurityIdentity = null;
- if(original != null)
- originalSecurityIdentity = original.getSecurityIdentity();
- if(jbossSecurityIdentity != null || originalSecurityIdentity != null)
- {
- if(securityIdentity == null)
- securityIdentity = new SecurityIdentityMetaData();
- securityIdentity.merge(jbossSecurityIdentity, originalSecurityIdentity);
- }
- }
-
- public void checkValid()
- {
- }
-
- /**
- * Get the assembly descriptor
- *
- * @return the ejbJarMetaData.
- */
- protected JBossAssemblyDescriptorMetaData getAssemblyDescriptor()
- {
- JBossMetaData ejbJar = getEjbJarMetaData();
- if (ejbJar == null)
- return null;
- return ejbJar.getAssemblyDescriptor();
- }
-
- public String getJndiBindingPolicy()
- {
- return jndiBindingPolicy;
- }
-
- public void setJndiBindingPolicy(String jndiBindingPolicy)
- {
- this.jndiBindingPolicy = jndiBindingPolicy;
- }
-}
Copied: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java (from rev 73241, projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,1768 @@
+/*
+* 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.metadata.ejb.jboss;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagementType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.jboss.metadata.common.ejb.IEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces.KnownInterfaceType;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
+import org.jboss.metadata.ejb.spec.ContainerTransactionMetaData;
+import org.jboss.metadata.ejb.spec.ContainerTransactionsMetaData;
+import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.spec.EntityBeanMetaData;
+import org.jboss.metadata.ejb.spec.ExcludeListMetaData;
+import org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.spec.MethodInterfaceType;
+import org.jboss.metadata.ejb.spec.MethodMetaData;
+import org.jboss.metadata.ejb.spec.MethodPermissionMetaData;
+import org.jboss.metadata.ejb.spec.MethodPermissionsMetaData;
+import org.jboss.metadata.ejb.spec.SecurityIdentityMetaData;
+import org.jboss.metadata.ejb.spec.SessionBeanMetaData;
+import org.jboss.metadata.javaee.jboss.AnnotationsMetaData;
+import org.jboss.metadata.javaee.jboss.IgnoreDependencyMetaData;
+import org.jboss.metadata.javaee.jboss.JndiRefsMetaData;
+import org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData;
+import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
+import org.jboss.metadata.javaee.spec.EJBLocalReferencesMetaData;
+import org.jboss.metadata.javaee.spec.EJBReferenceMetaData;
+import org.jboss.metadata.javaee.spec.EJBReferencesMetaData;
+import org.jboss.metadata.javaee.spec.Environment;
+import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.LifecycleCallbacksMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferencesMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceContextReferenceMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceContextReferencesMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceUnitReferenceMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceUnitReferencesMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleRefsMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
+import org.jboss.metadata.javaee.spec.TransactionManagementTypeAdapter;
+import org.jboss.metadata.javaee.support.AbstractMappedMetaData;
+import org.jboss.metadata.javaee.support.NamedMetaData;
+import org.jboss.metadata.javaee.support.NamedMetaDataWithDescriptionGroup;
+import org.jboss.metadata.javaee.support.NonNullLinkedHashSet;
+import org.jboss.xb.annotations.JBossXmlConstants;
+import org.jboss.xb.annotations.JBossXmlModelGroup;
+
+/**
+ * enterprise-bean/{session,entity,message-driven} metadata
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at JBossXmlModelGroup(
+ kind=JBossXmlConstants.MODEL_GROUP_CHOICE,
+ particles={
+ @JBossXmlModelGroup.Particle(element=@XmlElement(name="session"), type=JBossSessionBeanMetaData.class),
+ @JBossXmlModelGroup.Particle(element=@XmlElement(name="entity"), type=JBossEntityBeanMetaData.class),
+ @JBossXmlModelGroup.Particle(element=@XmlElement(name="message-driven"), type=JBossMessageDrivenBeanMetaData.class),
+ @JBossXmlModelGroup.Particle(element=@XmlElement(name="consumer"), type=JBossConsumerBeanMetaData.class),
+ @JBossXmlModelGroup.Particle(element=@XmlElement(name="ejb"), type=JBossGenericBeanMetaData.class),
+ @JBossXmlModelGroup.Particle(element=@XmlElement(name="service"), type=JBossServiceBeanMetaData.class)})
+public abstract class JBossEnterpriseBeanMetaData extends NamedMetaDataWithDescriptionGroup
+ implements Environment,
+ IEnterpriseBeanMetaData<JBossAssemblyDescriptorMetaData, JBossEnterpriseBeansMetaData, JBossEnterpriseBeanMetaData, JBossMetaData>
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6909774842926430193L;
+
+ /** The enterprise bean container */
+ private JBossEnterpriseBeansMetaData enterpriseBeansMetaData;
+
+ /** The mapped name */
+ private String mappedName;
+
+ /** The ejb class */
+ private String ejbClass;
+
+ /** The local jndi name */
+ private String localJndiName;
+
+ /** Whether to throw an exception if the transaction is marked for rollback */
+ private boolean exceptionOnRollback;
+
+ /** Whether to persist timers */
+ private boolean timerPersistence = true;
+
+ /** The configuration name */
+ private String configurationName;
+
+ /** The invokers */
+ private InvokerBindingsMetaData invokers;
+
+ /** The determined invokers */
+ private transient InvokerBindingsMetaData determinedInvokers;
+
+ /** The ior security config */
+ private IORSecurityConfigMetaData iorSecurityConfig;
+
+ /** The security proxy */
+ private String securityProxy;
+
+ /** The environment */
+ private JBossEnvironmentRefsGroupMetaData jndiEnvironmentRefsGroup;
+
+ /** The method attributes */
+ private MethodAttributesMetaData methodAttributes;
+
+ /** The security domain */
+ private String securityDomain;
+
+ /** The dependencies */
+ private Set<String> depends;
+
+ /** The annotations */
+ private AnnotationsMetaData annotations;
+
+ /** Ignore dependency */
+ private IgnoreDependencyMetaData ignoreDependency;
+
+ /** The aop domain name */
+ private String aopDomainName;
+
+ /** The pool configuration */
+ private PoolConfigMetaData poolConfig;
+
+ /** The jndi refs */
+ private JndiRefsMetaData jndiRefs;
+
+ /** The security identity */
+ private SecurityIdentityMetaData securityIdentity;
+
+ /** The cached container transactions */
+ private transient ContainerTransactionsMetaData cachedContainerTransactions;
+
+ /** The transaction type cache */
+ private transient ConcurrentHashMap<Method, TransactionAttributeType> methodTx;
+ /** The transaction type */
+ private TransactionManagementType transactionType;
+
+ /** the class name that implements the JNDI binding policy for this ejb */
+ private String jndiBindingPolicy;
+ /** The runtime name of the ejb container as known to the 'kernel', what ever it is */
+ private String containerName;
+ /** A non-managed generated container name as known to the 'kernel', what ever it is */
+ private String generatedContainerName;
+
+ /**
+ * Create the correct JBossEnterpriseBeanMetaData for the input
+ * standard bean metadata.
+ *
+ * @param bean the standard bean metadata
+ * @return the corresponding jboss extenstion metadata
+ */
+ public static JBossEnterpriseBeanMetaData newBean(EnterpriseBeanMetaData bean)
+ {
+ JBossEnterpriseBeanMetaData jbean = null;
+ if(bean instanceof EntityBeanMetaData)
+ jbean = new JBossEntityBeanMetaData();
+ if(bean instanceof MessageDrivenBeanMetaData)
+ jbean = new JBossMessageDrivenBeanMetaData();
+ if(bean instanceof SessionBeanMetaData)
+ jbean = new JBossSessionBeanMetaData();
+ return jbean;
+ }
+
+ /**
+ * Create a new EnterpriseBeanMetaData.
+ */
+ public JBossEnterpriseBeanMetaData()
+ {
+ // For serialization
+ }
+
+ /**
+ * Get the enterpriseBeansMetaData.
+ *
+ * @return the enterpriseBeansMetaData.
+ */
+ public JBossEnterpriseBeansMetaData getEnterpriseBeansMetaData()
+ {
+ return enterpriseBeansMetaData;
+ }
+
+ /**
+ * Set the enterpriseBeansMetaData.
+ *
+ * @param enterpriseBeansMetaData the enterpriseBeansMetaData.
+ */
+ @XmlTransient
+ public void setEnterpriseBeansMetaData(JBossEnterpriseBeansMetaData enterpriseBeansMetaData)
+ {
+ assert enterpriseBeansMetaData != null : "enterpriseBeansMetaData is null";
+
+ this.enterpriseBeansMetaData = enterpriseBeansMetaData;
+ }
+
+ /**
+ * Get the jbossMetaData.
+ *
+ * @return the jbossMetaData.
+ */
+ @XmlTransient
+ public JBossMetaData getJBossMetaData()
+ {
+ if (enterpriseBeansMetaData == null)
+ return null;
+ return enterpriseBeansMetaData.getEjbJarMetaData();
+ }
+
+ /**
+ * Get the jbossMetaData.
+ *
+ * @return the jbossMetaData with check
+ */
+ @XmlTransient
+ public JBossMetaData getJBossMetaDataWithCheck()
+ {
+ JBossMetaData jbossMetaData = getJBossMetaData();
+ if (jbossMetaData == null)
+ throw new IllegalStateException("This bean is not a part of a deployment " + this);
+ return jbossMetaData;
+ }
+
+ /**
+ * Get the jndiEnvironmentRefsGroup.
+ *
+ * @return the jndiEnvironmentRefsGroup.
+ */
+ public Environment getJndiEnvironmentRefsGroup()
+ {
+ return jndiEnvironmentRefsGroup;
+ }
+
+ @XmlElement(type=JBossEnvironmentRefsGroupMetaData.class)
+ public void setJndiEnvironmentRefsGroup(Environment env)
+ {
+ if (env == null)
+ throw new IllegalArgumentException("Null jndiEnvironmentRefsGroup");
+ JBossEnvironmentRefsGroupMetaData jenv = (JBossEnvironmentRefsGroupMetaData) env;
+ if(jndiEnvironmentRefsGroup != null)
+ jndiEnvironmentRefsGroup.merge(jenv, null, null, "jboss.xml", "ejb-jar.xml", false);
+ else
+ jndiEnvironmentRefsGroup = jenv;
+ }
+
+ /**
+ * Get the ejbName.
+ *
+ * @return the ejbName.
+ */
+ public String getEjbName()
+ {
+ return getName();
+ }
+
+ /**
+ * Set the ejbName.
+ *
+ * @param ejbName the ejbName.
+ * @throws IllegalArgumentException for a null ejbName
+ */
+ public void setEjbName(String ejbName)
+ {
+ setName(ejbName);
+ }
+
+ public String getEjbClass()
+ {
+ return ejbClass;
+ }
+
+ @XmlTransient
+ public JBossMetaData getEjbJarMetaData()
+ {
+ return enterpriseBeansMetaData.getEjbJarMetaData();
+ }
+
+ /**
+ * Get the container transactions
+ *
+ * @return the container transactions or null for no result
+ */
+ @XmlTransient
+ public ContainerTransactionsMetaData getContainerTransactions()
+ {
+ if (cachedContainerTransactions != null)
+ return cachedContainerTransactions;
+ JBossAssemblyDescriptorMetaData assemblyDescriptor = getAssemblyDescriptor();
+ if (assemblyDescriptor == null)
+ return null;
+ return assemblyDescriptor.getContainerTransactionsByEjbName(getEjbName());
+ }
+
+ /**
+ * Get the method transaction type
+ *
+ * @param methodName the method name
+ * @param params the parameters
+ * @param iface the interface type
+ * @return the method transaction type
+ */
+ public TransactionAttributeType getMethodTransactionType(String methodName, Class<?>[] params, MethodInterfaceType iface)
+ {
+ // default value
+ TransactionAttributeType result = null;
+
+ ContainerTransactionsMetaData containerTransactions = getContainerTransactions();
+ if (containerTransactions == null || containerTransactions.isEmpty())
+ return result;
+
+ ContainerTransactionMetaData bestMatchTransaction = null;
+ MethodMetaData bestMatch = null;
+ for (ContainerTransactionMetaData transaction : containerTransactions)
+ {
+ MethodMetaData match = transaction.bestMatch(methodName, params, iface, bestMatch);
+ if (match != bestMatch)
+ {
+ bestMatchTransaction = transaction;
+ bestMatch = match;
+ }
+ }
+
+ if (bestMatchTransaction != null)
+ result = bestMatchTransaction.getTransAttribute();
+
+ return result;
+ }
+
+ /**
+ * Get the transaction type
+ *
+ * @param m the method
+ * @param iface the interface type
+ * @return the transaction type
+ */
+ public TransactionAttributeType getMethodTransactionType(Method m, MethodInterfaceType iface)
+ {
+ if (m == null)
+ return TransactionAttributeType.SUPPORTS;
+
+ TransactionAttributeType result = null;
+ if (methodTx != null)
+ {
+ result = methodTx.get(m);
+ if (result != null)
+ return result;
+ }
+
+ result = getMethodTransactionType(m.getName(), m.getParameterTypes(), iface);
+
+ // provide default if method is not found in descriptor
+ if (result == null)
+ result = TransactionAttributeType.REQUIRED;
+
+ if (methodTx == null)
+ methodTx = new ConcurrentHashMap<Method, TransactionAttributeType>();
+ methodTx.put(m, result);
+ return result;
+ }
+
+ /**
+ * Get the exclude list
+ *
+ * @return the exclude list or null for no result
+ */
+ @XmlTransient
+ public ExcludeListMetaData getExcludeList()
+ {
+ JBossAssemblyDescriptorMetaData assemblyDescriptor = getAssemblyDescriptor();
+ if (assemblyDescriptor == null)
+ return null;
+ return assemblyDescriptor.getExcludeListByEjbName(getEjbName());
+ }
+
+ public String getMappedName()
+ {
+ return mappedName;
+ }
+
+ public void setEjbClass(String ejbClass)
+ {
+ this.ejbClass = ejbClass;
+ }
+
+ public void setMappedName(String mappedName)
+ {
+ this.mappedName = mappedName;
+ }
+
+ /**
+ * Whether this is a consumer bean
+ *
+ * @return true when a consumer bean
+ */
+ @XmlTransient
+ public boolean isConsumer()
+ {
+ return false;
+ }
+
+ /**
+ * Whether this is a service bean
+ *
+ * @return true when a service bean
+ */
+ @XmlTransient
+ public boolean isService()
+ {
+ return false;
+ }
+
+ /**
+ * Whether this is a session bean
+ *
+ * @return true when a session bean
+ */
+ @XmlTransient
+ public boolean isSession()
+ {
+ return false;
+ }
+
+ /**
+ * Whether this is a message driven bean
+ *
+ * @return true when a message driven bean
+ */
+ @XmlTransient
+ public boolean isMessageDriven()
+ {
+ return false;
+ }
+
+ /**
+ * Whether this is an entity bean
+ *
+ * @return true when an entity bean
+ */
+ @XmlTransient
+ public boolean isEntity()
+ {
+ return false;
+ }
+
+ /**
+ * Is this container managed transactions
+ *
+ * @return true when CMT
+ */
+ @XmlTransient
+ public boolean isCMT()
+ {
+ TransactionManagementType type = getTransactionType();
+ if (type == null)
+ return true;
+ else
+ return type == TransactionManagementType.CONTAINER;
+ }
+
+ /**
+ * Is this bean managed transactions
+ *
+ * @return true when BMT
+ */
+ @XmlTransient
+ public boolean isBMT()
+ {
+ return isCMT() == false;
+ }
+
+ public TransactionManagementType getTransactionType()
+ {
+ return transactionType;
+ }
+
+ @XmlJavaTypeAdapter(TransactionManagementTypeAdapter.class)
+ public void setTransactionType(TransactionManagementType transactionType)
+ {
+ this.transactionType = transactionType;
+ }
+
+ /**
+ * Get the localJndiName.
+ *
+ * @return the localJndiName.
+ */
+ public String getLocalJndiName()
+ {
+ return localJndiName;
+ }
+
+ /**
+ * Set the localJndiName.
+ *
+ * @param localJndiName the localJndiName.
+ * @throws IllegalArgumentException for a null localJndiName
+ */
+ public void setLocalJndiName(String localJndiName)
+ {
+ if (localJndiName == null)
+ throw new IllegalArgumentException("Null localJndiName");
+ this.localJndiName = localJndiName;
+ }
+
+ /**
+ * Determine the localJndiName.
+ *
+ * @return the localJndiName.
+ */
+ @XmlTransient
+ public String determineLocalJndiName()
+ {
+ if (localJndiName != null)
+ return localJndiName;
+
+ String ejbName = getEjbName();
+ // Generate a unique name based on ejbName + identityHashCode
+ return "local/" + ejbName + '@' + System.identityHashCode(ejbName);
+ }
+
+ /**
+ * Get the base jndi name for the bean if one exists. Not all ejbs have
+ * a jndi name notion.
+ *
+ * @return the base jndi name for the ejb it one exists, null otherwise.
+ */
+ @XmlTransient
+ abstract public String determineJndiName();
+
+ /**
+ * Determine the jndi name for the proxy associated with iface. This calls
+ * {@link #determineResolvedJndiName(String, null)}
+ *
+ * @param iface - the fully qualified class name of the interface, or one
+ * of the {@linkplain KnownInterfaces}. May be null in which case the base
+ * name as determined by {@link #getMappedName()} or
+ * {@link #determineJndiName()} is used.
+ * @return the resolved jndi name
+ */
+ @XmlTransient
+ public String determineResolvedJndiName(String iface)
+ {
+ return determineResolvedJndiName(iface, null);
+ }
+ /**
+ * Determine the jndi name for the proxy associated with iface. This uses
+ * the bean DefaultJndiBindingPolicy. This will be one of in the following
+ * order:
+ * - {@link #getJndiBindingPolicy()} the metadata policy
+ * - the argument defaultPolicy
+ * - BasicJndiBindingPolicy(base-jndi-name)
+ *
+ * @param iface - the fully qualified class name of the interface, or one
+ * of the {@linkplain KnownInterfaces}. May be null in which case the base
+ * name as determined by {@link #getMappedName()} or
+ * {@link #determineJndiName()} is used.
+ * @param defaultPolicy - an optional DefaultJndiBindingPolicy to use if
+ * {@link #getJndiBindingPolicy()} is null.
+ * @return the resolved jndi name
+ */
+ public String determineResolvedJndiName(String iface,
+ DefaultJndiBindingPolicy defaultPolicy)
+ {
+ String baseJndiName = getMappedName();
+ if(baseJndiName == null)
+ baseJndiName = determineJndiName();
+ String resolvedJndiName = baseJndiName;
+ if(getJBossMetaData().getDeploymentSummary() != null)
+ {
+ // Use summary info to create the metadata policy if it exists
+ DeploymentSummary dsummary = getJBossMetaData().getDeploymentSummary();
+ DefaultJndiBindingPolicy policy = null;
+ try
+ {
+ policy = createPolicy(dsummary.getLoader(), null);
+ }
+ catch(Exception e)
+ {
+ }
+ if(policy == null)
+ policy = defaultPolicy;
+ if(policy == null)
+ {
+ // Use the metadata default binding policy
+ policy = new BasicJndiBindingPolicy(baseJndiName);
+ }
+
+ // Derive the summary info from this metadata and deployment summary
+ EjbDeploymentSummary ejbSummary = new EjbDeploymentSummary(this, dsummary);
+ KnownInterfaceType ifaceType = KnownInterfaces.classifyInterface(iface);
+ // Need to compare iface against the metadata local-home/home & business locals/remotes
+ if(this.isSession() && ifaceType == KnownInterfaceType.UNKNOWN)
+ {
+ JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) this;
+ // Figure out the interface type from the metadata
+ if(sbeanMD.getLocalHome() != null && sbeanMD.getLocalHome().equals(iface))
+ ifaceType = KnownInterfaceType.LOCAL_HOME;
+ else if(sbeanMD.getHome() != null && sbeanMD.getHome().equals(iface))
+ ifaceType = KnownInterfaceType.REMOTE_HOME;
+ else
+ {
+ // Check business locals
+ BusinessLocalsMetaData locals = sbeanMD.getBusinessLocals();
+ if(locals != null)
+ {
+ for(String local : locals)
+ {
+ if(local.equals(iface))
+ {
+ ifaceType = KnownInterfaceType.BUSINESS_LOCAL;
+ break;
+ }
+ }
+ }
+ if(ifaceType == KnownInterfaceType.UNKNOWN)
+ {
+ // Check business remotes
+ BusinessRemotesMetaData remotes = sbeanMD.getBusinessRemotes();
+ if(remotes != null)
+ {
+ for(String remote : remotes)
+ {
+ if(remote.equals(iface))
+ {
+ ifaceType = KnownInterfaceType.BUSINESS_REMOTE;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ else if(this.isEntity() && ifaceType == KnownInterfaceType.UNKNOWN)
+ {
+ JBossEntityBeanMetaData ebeanMD = (JBossEntityBeanMetaData) this;
+ // Figure out the interface type from the metadata
+ if(ebeanMD.getLocalHome() != null && ebeanMD.getLocalHome().equals(iface))
+ ifaceType = KnownInterfaceType.LOCAL_HOME;
+ else if(ebeanMD.getHome() != null && ebeanMD.getHome().equals(iface))
+ ifaceType = KnownInterfaceType.REMOTE_HOME;
+ }
+
+ // Have the policy generate the actual name
+ resolvedJndiName = policy.getJndiName(ejbSummary, iface, ifaceType);
+ }
+ return resolvedJndiName;
+ }
+
+ /**
+ * Create the DefaultJndiBindingPolicy from the bean metadata.
+ *
+ * @param loader - the class loader used to load the policy class
+ * @param defaultPolicyClass - a fallback implementation to use if the
+ * bean has no policy set.
+ * @return the DefaultJndiBindingPolicy implementation
+ * @throws Exception on failure to load the policy class or instantiate it
+ */
+ @XmlTransient
+ public DefaultJndiBindingPolicy createPolicy(ClassLoader loader,
+ Class<? extends DefaultJndiBindingPolicy> defaultPolicyClass)
+ throws Exception
+ {
+ Class<? extends DefaultJndiBindingPolicy> policyClass = defaultPolicyClass;
+ String policyClassName = getJndiBindingPolicy();
+ if(policyClassName != null && loader != null)
+ {
+ policyClass = (Class<? extends DefaultJndiBindingPolicy>)
+ loader.loadClass(policyClassName);
+ }
+ DefaultJndiBindingPolicy policy = null;
+ if(policyClass != null)
+ policy = policyClass.newInstance();
+ return policy;
+ }
+
+ /**
+ * Determine the container jndi name used in the object name. This is
+ * really obsolete as there is no need for jmx names.
+ *
+ * @return the jndi name suitable for use in the object name
+ */
+ @XmlTransient
+ public String getContainerObjectNameJndiName()
+ {
+ return getLocalJndiName();
+ }
+
+ /**
+ * Get the kernel name for the ejb container. This is the managed property
+ * version admin tools may use to control the name. Generally its not set
+ * and the server will set the name via the generatedContainerName
+ * non-managed property.
+ *
+ * @see #setGeneratedContainerName(String)
+ * @return containerName property value.
+ */
+ public String getContainerName()
+ {
+ return containerName;
+ }
+ public void setContainerName(String containerName)
+ {
+ this.containerName = containerName;
+ }
+
+ /**
+ * Get the generated kernel name for the ejb container. This is the
+ * non-managed property version that the server would use to set the name
+ * it generated when no containerName property existed.
+ *
+ * @see #getContainerName()
+ * @return generatedContainerName property value.
+ */
+ @XmlTransient
+ public String getGeneratedContainerName()
+ {
+ return generatedContainerName;
+ }
+ public void setGeneratedContainerName(String containerName)
+ {
+ this.generatedContainerName = containerName;
+ }
+ /**
+ * Get the kernel name for the ejb container. This is either the
+ * containerName managed property, or a runtime generated name set via
+ * the non-managed generatedContainerName property.
+ * @return the kernel name for the ejb container
+ */
+ public String determineContainerName()
+ {
+ String name = containerName;
+ if(name == null)
+ name = generatedContainerName;
+ return name;
+ }
+
+ /**
+ * Get the exceptionOnRollback.
+ *
+ * @return the exceptionOnRollback.
+ */
+ public boolean isExceptionOnRollback()
+ {
+ return exceptionOnRollback;
+ }
+
+ /**
+ * Set the exceptionOnRollback.
+ *
+ * @param exceptionOnRollback the exceptionOnRollback.
+ */
+ public void setExceptionOnRollback(boolean exceptionOnRollback)
+ {
+ this.exceptionOnRollback = exceptionOnRollback;
+ }
+
+ /**
+ * Get the timerPersistence.
+ *
+ * @return the timerPersistence.
+ */
+ public boolean isTimerPersistence()
+ {
+ return timerPersistence;
+ }
+
+ /**
+ * Set the timerPersistence.
+ *
+ * @param timerPersistence the timerPersistence.
+ */
+ public void setTimerPersistence(boolean timerPersistence)
+ {
+ this.timerPersistence = timerPersistence;
+ }
+
+ /**
+ * Get the configurationName.
+ *
+ * @return the configurationName.
+ */
+ public String getConfigurationName()
+ {
+ return configurationName;
+ }
+
+ /**
+ * Set the configurationName.
+ *
+ * @param configurationName the configurationName.
+ * @throws IllegalArgumentException for a null configurationName
+ */
+ public void setConfigurationName(String configurationName)
+ {
+ if (configurationName == null)
+ throw new IllegalArgumentException("Null configurationName");
+ this.configurationName = configurationName;
+ }
+
+ /**
+ * Determine the configuration name
+ *
+ * @return the configuration name
+ */
+ public String determineConfigurationName()
+ {
+ if (configurationName != null)
+ return configurationName;
+
+ return getDefaultConfigurationName();
+ }
+
+ /**
+ * Get the container configuration
+ *
+ * @return the container configuration
+ */
+ public ContainerConfigurationMetaData determineContainerConfiguration()
+ {
+ String name = determineConfigurationName();
+ ContainerConfigurationMetaData result = getJBossMetaDataWithCheck().getContainerConfiguration(name);
+ if (result == null)
+ throw new IllegalStateException("Container configuration not found: " + name + " available: " + getJBossMetaDataWithCheck().getContainerConfigurations());
+ return result;
+ }
+
+ public void setPoolConfig(PoolConfigMetaData poolConfig)
+ {
+ this.poolConfig = poolConfig;
+ }
+
+ /**
+ * Get the default configuration name
+ *
+ * @return the default name
+ */
+ public abstract String getDefaultConfigurationName();
+
+ /**
+ * Get the securityProxy.
+ *
+ * @return the securityProxy.
+ */
+ public String getSecurityProxy()
+ {
+ return securityProxy;
+ }
+
+ /**
+ * Set the securityProxy.
+ *
+ * @param securityProxy the securityProxy.
+ * @throws IllegalArgumentException for a null securityProxy
+ */
+ public void setSecurityProxy(String securityProxy)
+ {
+ if (securityProxy == null)
+ throw new IllegalArgumentException("Null securityProxy");
+ this.securityProxy = securityProxy;
+ }
+
+ /**
+ * Get the securityDomain.
+ *
+ * @return the securityDomain.
+ */
+ public String getSecurityDomain()
+ {
+ return securityDomain;
+ }
+
+ /**
+ * Set the securityDomain.
+ *
+ * @param securityDomain the securityDomain.
+ * @throws IllegalArgumentException for a null securityDomain
+ */
+ @XmlElement(required=false)
+ public void setSecurityDomain(String securityDomain)
+ {
+ if (securityDomain == null)
+ throw new IllegalArgumentException("Null securityDomain");
+ this.securityDomain = securityDomain;
+ }
+
+ /**
+ * Get the depends.
+ *
+ * @return the depends.
+ */
+ public Set<String> getDepends()
+ {
+ return depends;
+ }
+
+ /**
+ * Set the depends.
+ *
+ * @param depends the depends.
+ * @throws IllegalArgumentException for a null depends
+ */
+ @XmlElement(/*type=NonNullLinkedHashSet.class*/)
+ public void setDepends(Set<String> depends)
+ {
+ if (depends == null)
+ throw new IllegalArgumentException("Null depends");
+ this.depends = depends;
+ }
+
+ /**
+ * Get the depends.
+ *
+ * @return the depends.
+ */
+ public Set<String> determineAllDepends()
+ {
+ NonNullLinkedHashSet<String> result = new NonNullLinkedHashSet<String>();
+
+ Set<String> depends = getDepends();
+ if (depends != null)
+ result.addAll(depends);
+
+ ContainerConfigurationMetaData containerConfigurationMetaData = determineContainerConfiguration();
+ if (containerConfigurationMetaData != null)
+ {
+ depends = containerConfigurationMetaData.getDepends();
+ if (depends != null)
+ result.addAll(depends);
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the invokers.
+ *
+ * @return the invokers.
+ */
+ public InvokerBindingsMetaData getInvokerBindings()
+ {
+ return invokers;
+ }
+
+ /**
+ * Set the invokers.
+ *
+ * @param invokers the invokers.
+ * @throws IllegalArgumentException for a null invokers
+ */
+ public void setInvokerBindings(InvokerBindingsMetaData invokers)
+ {
+ if (invokers == null)
+ throw new IllegalArgumentException("Null invokers");
+ this.invokers = invokers;
+ }
+
+ /**
+ * Determine the invokers
+ *
+ * @return the invokers.
+ */
+ public InvokerBindingsMetaData determineInvokerBindings()
+ {
+ // We already worked it out
+ if (determinedInvokers != null)
+ return determinedInvokers;
+
+ // Use anything configured
+ if (invokers != null)
+ {
+ determinedInvokers = invokers;
+ return determinedInvokers;
+ }
+
+ // Look at the container configuration
+ ContainerConfigurationMetaData containerConfiguration = determineContainerConfiguration();
+ Set<String> invokerProxyBindingNames = containerConfiguration.getInvokerProxyBindingNames();
+ if (invokerProxyBindingNames != null && invokerProxyBindingNames.isEmpty() == false)
+ {
+ determinedInvokers = new InvokerBindingsMetaData();
+
+ // Like the original code, they all get bound with the same name?
+ String jndiName = getDefaultInvokerJndiName();
+ for (String name : invokerProxyBindingNames)
+ {
+ InvokerBindingMetaData invoker = new InvokerBindingMetaData();
+ invoker.setInvokerProxyBindingName(name);
+ if (jndiName != null)
+ invoker.setJndiName(jndiName);
+ determinedInvokers.add(invoker);
+ }
+ }
+ else
+ {
+ determinedInvokers = getDefaultInvokers();
+ }
+ return determinedInvokers;
+ }
+
+ /**
+ * Determine an invoker binding
+ *
+ * @param invokerName the invoker proxy binding name
+ * @return the invoke binding
+ * @throws IllegalStateException if there is no such binding
+ */
+ public InvokerBindingMetaData determineInvokerBinding(String invokerName)
+ {
+ InvokerBindingMetaData binding = determineInvokerBindings().get(invokerName);
+ if (binding == null)
+ throw new IllegalStateException("No such binding: " + invokerName + " available: " + determinedInvokers);
+ return binding;
+ }
+
+ /**
+ * Determine the jndi name for invoker bindings that come from the container configuration
+ *
+ * @return the jndi name suitable for use on the default invoker
+ */
+ protected String getDefaultInvokerJndiName()
+ {
+ return null;
+ }
+
+ /**
+ * Get the default invokers
+ *
+ * @return the default invokers
+ */
+ protected InvokerBindingsMetaData getDefaultInvokers()
+ {
+ InvokerBindingsMetaData bindings = new InvokerBindingsMetaData();
+ InvokerBindingMetaData binding = new InvokerBindingMetaData();
+ binding.setInvokerProxyBindingName(getDefaultInvokerName());
+ String jndiName = getDefaultInvokerJndiName();
+ if (jndiName != null)
+ binding.setJndiName(getDefaultInvokerJndiName());
+ bindings.add(binding);
+ return bindings;
+ }
+
+ /**
+ * Get the default invokers
+ *
+ * @return the default invokers
+ */
+ protected abstract String getDefaultInvokerName();
+
+ public EJBLocalReferenceMetaData getEjbLocalReferenceByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getEjbLocalReferences());
+ }
+
+ @XmlTransient
+ public EJBLocalReferencesMetaData getEjbLocalReferences()
+ {
+ EJBLocalReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getEjbLocalReferences();
+ return refs;
+ }
+
+ public EJBReferenceMetaData getEjbReferenceByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getEjbReferences());
+ }
+
+ @XmlTransient
+ public EJBReferencesMetaData getEjbReferences()
+ {
+ EJBReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getEjbReferences();
+ return refs;
+ }
+ // TODO?
+ @XmlTransient
+ public AnnotatedEJBReferencesMetaData getAnnotatedEjbReferences()
+ {
+ AnnotatedEJBReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getAnnotatedEjbReferences();
+ return refs;
+ }
+
+ @XmlTransient
+ public EnvironmentEntriesMetaData getEnvironmentEntries()
+ {
+ EnvironmentEntriesMetaData env = null;
+ if(jndiEnvironmentRefsGroup != null)
+ env = jndiEnvironmentRefsGroup.getEnvironmentEntries();
+ return env;
+ }
+
+ public EnvironmentEntryMetaData getEnvironmentEntryByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getEnvironmentEntries());
+ }
+
+ public MessageDestinationReferenceMetaData getMessageDestinationReferenceByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getMessageDestinationReferences());
+ }
+
+ @XmlTransient
+ public MessageDestinationReferencesMetaData getMessageDestinationReferences()
+ {
+ MessageDestinationReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getMessageDestinationReferences();
+ return refs;
+ }
+
+ public PersistenceContextReferenceMetaData getPersistenceContextReferenceByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getPersistenceContextRefs());
+ }
+
+ @XmlTransient
+ public PersistenceContextReferencesMetaData getPersistenceContextRefs()
+ {
+ PersistenceContextReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getPersistenceContextRefs();
+ return refs;
+ }
+
+ public PersistenceUnitReferenceMetaData getPersistenceUnitReferenceByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getPersistenceUnitRefs());
+ }
+
+ @XmlTransient
+ public PersistenceUnitReferencesMetaData getPersistenceUnitRefs()
+ {
+ PersistenceUnitReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getPersistenceUnitRefs();
+ return refs;
+ }
+
+ public PoolConfigMetaData getPoolConfig()
+ {
+ return poolConfig;
+ }
+
+ @XmlTransient
+ public LifecycleCallbacksMetaData getPostConstructs()
+ {
+ LifecycleCallbacksMetaData lcs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ lcs = jndiEnvironmentRefsGroup.getPostConstructs();
+ return lcs;
+ }
+
+ @XmlTransient
+ public LifecycleCallbacksMetaData getPreDestroys()
+ {
+ LifecycleCallbacksMetaData lcs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ lcs = jndiEnvironmentRefsGroup.getPreDestroys();
+ return lcs;
+ }
+
+ public ResourceEnvironmentReferenceMetaData getResourceEnvironmentReferenceByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getResourceEnvironmentReferences());
+ }
+
+ @XmlTransient
+ public ResourceEnvironmentReferencesMetaData getResourceEnvironmentReferences()
+ {
+ ResourceEnvironmentReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getResourceEnvironmentReferences();
+ return refs;
+ }
+
+ public ResourceReferenceMetaData getResourceReferenceByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getResourceReferences());
+ }
+
+ @XmlTransient
+ public ResourceReferencesMetaData getResourceReferences()
+ {
+ ResourceReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getResourceReferences();
+ return refs;
+ }
+
+ public ServiceReferenceMetaData getServiceReferenceByName(String name)
+ {
+ return AbstractMappedMetaData.getByName(name, getServiceReferences());
+ }
+
+ @XmlTransient
+ public ServiceReferencesMetaData getServiceReferences()
+ {
+ ServiceReferencesMetaData refs = null;
+ if(jndiEnvironmentRefsGroup != null)
+ refs = jndiEnvironmentRefsGroup.getServiceReferences();
+ return refs;
+ }
+
+ /**
+ * Provies a common accessor that returns an empty security role refs.
+ * Subclasses that support security-role-refs must override.
+ * @return An empty security role refs.
+ */
+ @XmlTransient
+ public SecurityRoleRefsMetaData getSecurityRoleRefs()
+ {
+ return new SecurityRoleRefsMetaData();
+ }
+
+ /**
+ * Get the annotations.
+ *
+ * @return the annotations.
+ */
+ public AnnotationsMetaData getAnnotations()
+ {
+ return annotations;
+ }
+
+ /**
+ * Set the annotations.
+ *
+ * @param annotations the annotations.
+ * @throws IllegalArgumentException for a null annotations
+ */
+ @XmlElement(name="annotation")
+ public void setAnnotations(AnnotationsMetaData annotations)
+ {
+ if (annotations == null)
+ throw new IllegalArgumentException("Null annotations");
+ this.annotations = annotations;
+ }
+
+ /**
+ * Get the aopDomainName.
+ *
+ * @return the aopDomainName.
+ */
+ public String getAopDomainName()
+ {
+ return aopDomainName;
+ }
+
+ /**
+ * Set the aopDomainName.
+ *
+ * @param aopDomainName the aopDomainName.
+ * @throws IllegalArgumentException for a null aopDomainName
+ */
+ public void setAopDomainName(String aopDomainName)
+ {
+ if (aopDomainName == null)
+ throw new IllegalArgumentException("Null aopDomainName");
+ this.aopDomainName = aopDomainName;
+ }
+
+ /**
+ * Get the jndiRefs.
+ *
+ * @return the jndiRefs.
+ */
+ public JndiRefsMetaData getJndiRefs()
+ {
+ return jndiRefs;
+ }
+
+ /**
+ * Set the jndiRefs.
+ *
+ * @param jndiRefs the jndiRefs.
+ * @throws IllegalArgumentException for a null jndiRefs
+ */
+ @XmlElement(name="jndi-ref")
+ public void setJndiRefs(JndiRefsMetaData jndiRefs)
+ {
+ if (jndiRefs == null)
+ throw new IllegalArgumentException("Null jndiRefs");
+ this.jndiRefs = jndiRefs;
+ }
+
+ /**
+ * Get a security role
+ *
+ * @param roleName the role name
+ * @return the security role or null if not found
+ */
+ @XmlTransient
+ public SecurityRoleMetaData getSecurityRole(String roleName)
+ {
+ JBossAssemblyDescriptorMetaData assemblyDescriptor = getJBossMetaDataWithCheck().getAssemblyDescriptor();
+ if (assemblyDescriptor == null)
+ return null;
+ else
+ return assemblyDescriptor.getSecurityRole(roleName);
+ }
+
+ /**
+ * Get a security role's principals
+ *
+ * @param roleName the role name
+ * @return the principals or null if not found
+ */
+ public Set<String> getSecurityRolePrincipals(String roleName)
+ {
+ JBossAssemblyDescriptorMetaData assemblyDescriptor = getJBossMetaDataWithCheck().getAssemblyDescriptor();
+ if (assemblyDescriptor == null)
+ return null;
+ else
+ return assemblyDescriptor.getSecurityRolePrincipals(roleName);
+ }
+
+ /**
+ * Get the methods permissions
+ *
+ * @return the method permissions or null for no result
+ */
+ @XmlTransient
+ public MethodPermissionsMetaData getMethodPermissions()
+ {
+ JBossAssemblyDescriptorMetaData assemblyDescriptor = getAssemblyDescriptor();
+ if (assemblyDescriptor == null)
+ return null;
+ return assemblyDescriptor.getMethodPermissionsByEjbName(getEjbName());
+ }
+
+ /**
+ * A somewhat tedious method that builds a Set<Principal> of the roles
+ * that have been assigned permission to execute the indicated method. The
+ * work performed is tedious because of the wildcard style of declaring
+ * method permission allowed in the ejb-jar.xml descriptor. This method is
+ * called by the Container.getMethodPermissions() when it fails to find the
+ * prebuilt set of method roles in its cache.
+ *
+ * @param methodName the method name
+ * @param params the parameters
+ * @param interfaceType the interface type
+ * @return The Set<String> for the application domain roles that caller principal's are to be validated against.
+ */
+ public Set<String> getMethodPermissions(String methodName, Class<?>[] params, MethodInterfaceType interfaceType)
+ {
+ Set<String> result = null;
+
+ JBossMetaData jbossMetaData = getJBossMetaDataWithCheck();
+
+ // First check the excluded method list as this takes priority over
+ // all other assignments
+ ExcludeListMetaData excluded = getExcludeList();
+ if (excluded != null && excluded.matches(methodName, params, interfaceType))
+ {
+ // No one is allowed to execute this method so add a role that
+ // fails to equate to any Principal or Principal name and return.
+ // We don't return null to differentiate between an explicit
+ // assignment of no access and no assignment information.
+ if (result == null)
+ result = new HashSet<String>();
+ result.add(SecurityRoleNames.NOBODY_PRINCIPAL);
+ return result;
+ }
+
+ // Check the permissioned methods list
+ MethodPermissionsMetaData permissions = getMethodPermissions();
+ if (permissions != null)
+ {
+ for (MethodPermissionMetaData permission : permissions)
+ {
+ if (permission.isNotChecked(methodName, params, interfaceType))
+ {
+ if (result == null)
+ result = new HashSet<String>();
+ result.clear();
+ result.add(SecurityRoleNames.ANYBODY_PRINCIPAL);
+ break;
+ }
+ else if (permission.matches(methodName, params, interfaceType))
+ {
+ Set<String> roles = permission.getRoles();
+ if (roles != null)
+ {
+ if (result == null)
+ result = new HashSet<String>();
+ for (String roleName : roles)
+ {
+ // Get any extra principal names assigned to the role
+ Set<String> principals = getSecurityRolePrincipals(roleName);
+ if (principals != null)
+ {
+ for (String principal : principals)
+ {
+ result.add(principal);
+ }
+ }
+ // Also add the role name itself
+ result.add(roleName);
+ }
+ }
+ }
+ }
+ }
+
+ if (jbossMetaData.isExcludeMissingMethods() == false && result == null)
+ {
+ result = new HashSet<String>();
+ result.add(SecurityRoleNames.ANYBODY_PRINCIPAL);
+ }
+
+ if (result == null)
+ result = Collections.emptySet();
+ return result;
+ }
+
+ /**
+ * Check to see if there was a method-permission or exclude-list statement
+ * for the given method.
+ *
+ * @param methodName - the method name
+ * @param params - the method parameter signature
+ * @param interfaceType - the method interface type
+ * @return true if a matching method permission exists, false if no match
+ */
+ public boolean hasMethodPermissions(String methodName, Class<?>[] params, MethodInterfaceType interfaceType)
+ {
+ // First check the excluded method list as this takes priority over
+ // all other assignments
+ ExcludeListMetaData excluded = getExcludeList();
+ if (excluded != null && excluded.matches(methodName, params, interfaceType))
+ return true;
+
+ // Check the permissioned methods list
+ MethodPermissionsMetaData permissions = getMethodPermissions();
+ if (permissions != null)
+ {
+ for (MethodPermissionMetaData permission : permissions)
+ {
+ if (permission.matches(methodName, params, interfaceType))
+ return true;
+ }
+ }
+
+ // No match
+ return false;
+ }
+
+ /**
+ * Get the iorSecurityConfig.
+ *
+ * @return the iorSecurityConfig.
+ */
+ public IORSecurityConfigMetaData getIorSecurityConfig()
+ {
+ return iorSecurityConfig;
+ }
+
+ /**
+ * Set the iorSecurityConfig.
+ *
+ * @param iorSecurityConfig the iorSecurityConfig.
+ * @throws IllegalArgumentException for a null iorSecurityConfig
+ */
+ public void setIorSecurityConfig(IORSecurityConfigMetaData iorSecurityConfig)
+ {
+ if (iorSecurityConfig == null)
+ throw new IllegalArgumentException("Null iorSecurityConfig");
+ this.iorSecurityConfig = iorSecurityConfig;
+ }
+
+ /**
+ * Get the ignoreDependency.
+ *
+ * @return the ignoreDependency.
+ */
+ public IgnoreDependencyMetaData getIgnoreDependency()
+ {
+ return ignoreDependency;
+ }
+
+ /**
+ * Set the ignoreDependency.
+ *
+ * @param ignoreDependency the ignoreDependency.
+ * @throws IllegalArgumentException for a null ignoreDependency
+ */
+ public void setIgnoreDependency(IgnoreDependencyMetaData ignoreDependency)
+ {
+ if (ignoreDependency == null)
+ throw new IllegalArgumentException("Null ignoreDependency");
+ this.ignoreDependency = ignoreDependency;
+ }
+
+ /**
+ * Get the methodAttributes.
+ *
+ * @return the methodAttributes.
+ */
+ public MethodAttributesMetaData getMethodAttributes()
+ {
+ return methodAttributes;
+ }
+
+ /**
+ * Set the methodAttributes.
+ *
+ * @param methodAttributes the methodAttributes.
+ * @throws IllegalArgumentException for a null methodAttributes
+ */
+ public void setMethodAttributes(MethodAttributesMetaData methodAttributes)
+ {
+ if (methodAttributes == null)
+ throw new IllegalArgumentException("Null methodAttributes");
+ this.methodAttributes = methodAttributes;
+ }
+
+ /**
+ * Is this method a read-only method
+ *
+ * @param methodName the method name
+ * @return true for read only
+ */
+ public boolean isMethodReadOnly(String methodName)
+ {
+ if (methodAttributes == null)
+ return false;
+ return methodAttributes.isMethodReadOnly(methodName);
+ }
+
+ /**
+ * Is this method a read-only method
+ *
+ * @param method the method
+ * @return true for read only
+ */
+ public boolean isMethodReadOnly(Method method)
+ {
+ if (method == null)
+ return false;
+ return isMethodReadOnly(method.getName());
+ }
+
+ /**
+ * Get the transaction timeout for the method
+ *
+ * @param methodName the method name
+ * @return the transaction timeout
+ */
+ public int getMethodTransactionTimeout(String methodName)
+ {
+ if (methodAttributes == null)
+ return 0;
+ return methodAttributes.getMethodTransactionTimeout(methodName);
+ }
+
+ /**
+ * Get the transaction timeout for the method
+ *
+ * @param method the method
+ * @return the transaction timeout
+ */
+ public int getMethodTransactionTimeout(Method method)
+ {
+ if (method == null)
+ return 0;
+ return getMethodTransactionTimeout(method.getName());
+ }
+
+ /**
+ * Get the securityIdentity.
+ *
+ * @return the securityIdentity.
+ */
+ public SecurityIdentityMetaData getSecurityIdentity()
+ {
+ return securityIdentity;
+ }
+
+ /**
+ * Set the securityIdentity.
+ *
+ * @param securityIdentity the securityIdentity.
+ * @throws IllegalArgumentException for a null securityIdentity
+ */
+ public void setSecurityIdentity(SecurityIdentityMetaData securityIdentity)
+ {
+ if (securityIdentity == null)
+ throw new IllegalArgumentException("Null securityIdentity");
+ this.securityIdentity = securityIdentity;
+ }
+
+ @Override
+ public void merge(NamedMetaData override, NamedMetaData original)
+ {
+ throw new RuntimeException("wrong merge method called");
+ }
+
+ public void merge(JBossEnterpriseBeanMetaData override, EnterpriseBeanMetaData original)
+ {
+ this.merge(override, original, "jboss.xml", "ejb-jar.xml", true);
+ }
+ public void merge(JBossEnterpriseBeanMetaData override, EnterpriseBeanMetaData original,
+ String overrideFile, String overridenFile, boolean mustOverride)
+ {
+ super.merge(override, original);
+ if(override != null && override.getEjbClass() != null)
+ setEjbClass(override.getEjbClass());
+ else if(original != null && original.getEjbClass() != null)
+ setEjbClass(original.getEjbClass());
+ if(override != null && override.getName() != null)
+ setName(override.getName());
+ else if(original != null && original.getName() != null)
+ setName(original.getName());
+ if(override != null && override.getMappedName() != null)
+ setMappedName(override.getMappedName());
+ else if(original != null && original.getMappedName() != null)
+ setMappedName(original.getMappedName());
+
+ // transactionType
+ if(override != null && override.getTransactionType() != null)
+ transactionType = override.getTransactionType();
+ else if(original != null && original.getTransactionType() != null)
+ transactionType = original.getTransactionType();
+
+ if(override != null)
+ {
+ if(override.getAopDomainName() != null)
+ setAopDomainName(override.getAopDomainName());
+ if(override.getConfigurationName() != null)
+ setConfigurationName(override.getConfigurationName());
+ if(override.getAnnotations() != null)
+ setAnnotations(override.getAnnotations());
+ if(override.getDepends() != null)
+ setDepends(override.getDepends());
+ setExceptionOnRollback(override.isExceptionOnRollback());
+ if(override.getIgnoreDependency() != null)
+ setIgnoreDependency(override.getIgnoreDependency());
+ if(override.getInvokerBindings() != null)
+ setInvokerBindings(override.getInvokerBindings());
+ if(override.getIorSecurityConfig() != null)
+ setIorSecurityConfig(override.getIorSecurityConfig());
+ if(override.getSecurityProxy() != null)
+ setSecurityProxy(override.getSecurityProxy());
+ }
+
+ if(this.jndiEnvironmentRefsGroup == null)
+ jndiEnvironmentRefsGroup = new JBossEnvironmentRefsGroupMetaData();
+ Environment env = original != null ? original.getJndiEnvironmentRefsGroup() : null;
+ JBossEnvironmentRefsGroupMetaData jenv = null;
+ ResourceManagersMetaData resourceMgrs = this.getJBossMetaData().getResourceManagers();
+ if( override != null )
+ {
+ ResourceManagersMetaData resourceMgrsOverride = override.getJBossMetaData().getResourceManagers();
+ if(resourceMgrsOverride != null)
+ resourceMgrs = resourceMgrsOverride;
+ jenv = (JBossEnvironmentRefsGroupMetaData) override.getJndiEnvironmentRefsGroup();
+ }
+ jndiEnvironmentRefsGroup.merge(jenv, env, resourceMgrs, overridenFile, overrideFile, mustOverride);
+
+ // Fixup the invoker binding references on ejb refs
+ InvokerBindingsMetaData invokerBindings = getInvokerBindings();
+ if (invokerBindings != null && invokerBindings.isEmpty() == false)
+ {
+ for (InvokerBindingMetaData invokerBinding : invokerBindings)
+ {
+ if(invokerBinding.getEjbRefs() != null)
+ {
+ for(InvokerBindingMetaData.EjbRef ejbRef : invokerBinding.getEjbRefs())
+ {
+ EJBReferenceMetaData targetEjbRef = jndiEnvironmentRefsGroup.getEjbReferenceByName(ejbRef.getEjbRefName());
+ if (targetEjbRef == null)
+ throw new IllegalStateException("ejb-ref " + ejbRef.getEjbRefName() + " found on invoker " + invokerBinding.getName() + " but it does not exist for ejb: " + getName());
+ targetEjbRef.addInvokerBinding(invokerBinding.getName(), ejbRef.getJndiName());
+ }
+ }
+ }
+ }
+
+ // Fixup the security identity
+ SecurityIdentityMetaData jbossSecurityIdentity = null;
+ if (override != null && override.getSecurityIdentity() != null)
+ jbossSecurityIdentity = override.getSecurityIdentity();
+ SecurityIdentityMetaData originalSecurityIdentity = null;
+ if(original != null)
+ originalSecurityIdentity = original.getSecurityIdentity();
+ if(jbossSecurityIdentity != null || originalSecurityIdentity != null)
+ {
+ if(securityIdentity == null)
+ securityIdentity = new SecurityIdentityMetaData();
+ securityIdentity.merge(jbossSecurityIdentity, originalSecurityIdentity);
+ }
+ }
+
+ public void checkValid()
+ {
+ }
+
+ /**
+ * Get the assembly descriptor
+ *
+ * @return the ejbJarMetaData.
+ */
+ protected JBossAssemblyDescriptorMetaData getAssemblyDescriptor()
+ {
+ JBossMetaData ejbJar = getEjbJarMetaData();
+ if (ejbJar == null)
+ return null;
+ return ejbJar.getAssemblyDescriptor();
+ }
+
+ public String getJndiBindingPolicy()
+ {
+ return jndiBindingPolicy;
+ }
+
+ public void setJndiBindingPolicy(String jndiBindingPolicy)
+ {
+ this.jndiBindingPolicy = jndiBindingPolicy;
+ }
+}
Deleted: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,802 +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.metadata.ejb.jboss;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import org.jboss.logging.Logger;
-import org.jboss.metadata.common.ejb.IEjbJarMetaData;
-import org.jboss.metadata.common.jboss.LoaderRepositoryMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
-import org.jboss.metadata.ejb.spec.EjbJar3xMetaData;
-import org.jboss.metadata.ejb.spec.EjbJarMetaData;
-import org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
-import org.jboss.metadata.ejb.spec.RelationsMetaData;
-import org.jboss.metadata.ejb.spec.SecurityIdentityMetaData;
-import org.jboss.metadata.javaee.jboss.RunAsIdentityMetaData;
-import org.jboss.metadata.javaee.spec.RunAsMetaData;
-import org.jboss.metadata.javaee.support.IdMetaDataImplWithDescriptionGroup;
-
-/**
- * JBossMetaData.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class JBossMetaData extends IdMetaDataImplWithDescriptionGroup
- implements IEjbJarMetaData<JBossAssemblyDescriptorMetaData, JBossEnterpriseBeansMetaData, JBossEnterpriseBeanMetaData, JBossMetaData>
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 598759931857080298L;
-
- /** The log */
- private static final Logger log = Logger.getLogger(JBossMetaData.class);
-
- /** DTD information */
- private String dtdPublicId;
- private String dtdSystemId;
- /** The version */
- private String version;
- /** The ejb jar version */
- private String ejbVersion;
-
- /** The ejb client jar */
- private String ejbClientJar;
-
- /** The relations */
- private RelationsMetaData relationships;
-
- /** The loader repository */
- private LoaderRepositoryMetaData loaderRepository;
-
- /** The jmx name */
- private String jmxName;
-
- /** The security domain */
- private String securityDomain;
-
- /** The jacc context id */
- private String jaccContextID;
-
- /** Whether to exclude missing methods */
- private boolean excludeMissingMethods = true;
-
- /** The unauthenticated principal */
- private String unauthenticatedPrincipal;
-
- /** Whether to throw an exception when marked rollback */
- private boolean exceptionOnRollback;
-
- /** The webservices */
- private WebservicesMetaData webservices;
-
- /** The enterprise beans */
- private JBossEnterpriseBeansMetaData enterpriseBeans;
-
- /** The assembly descriptor */
- private JBossAssemblyDescriptorMetaData assemblyDescriptor;
-
- /** The resource manager */
- private ResourceManagersMetaData resourceManagers;
-
- /** The invoker-proxy-bindings */
- private InvokerProxyBindingsMetaData invokerProxyBindings;
-
- /** The container configurations */
- private ContainerConfigurationsMetaData containerConfigurations;
-
- /** The interceptors */
- private InterceptorsMetaData interceptors;
- /** */
- private Map<String, RunAsIdentityMetaData> runAsIdentity = new HashMap<String, RunAsIdentityMetaData>();
- /** Is this a complete metadata description */
- private boolean metadataComplete;
-
- /** the class name that implements the default JNDI binding policy for this ejb unit*/
- private String jndiBindingPolicy;
- /** The ejb jar deployment summary information */
- private DeploymentSummary deploymentSummary;
-
- /**
- * Create a new JBossMetaData.
- */
- public JBossMetaData()
- {
- // For serialization
- }
-
- /**
- * Callback for the DTD information
- * @param root
- * @param publicId
- * @param systemId
- */
- @XmlTransient
- public void setDTD(String root, String publicId, String systemId)
- {
- this.dtdPublicId = publicId;
- this.dtdSystemId = systemId;
- // Set the version based on the public id
- if (dtdPublicId != null && dtdPublicId.contains("3.0"))
- setVersion("3.0");
- if (dtdPublicId != null && dtdPublicId.contains("3.2"))
- setVersion("3.2");
- if (dtdPublicId != null && dtdPublicId.contains("4.0"))
- setVersion("4.0");
- if (dtdPublicId != null && dtdPublicId.contains("4.2"))
- setVersion("4.2");
- if (dtdPublicId != null && dtdPublicId.contains("5.0"))
- setVersion("5.0");
- }
- /**
- * Get the DTD public id if one was seen
- * @return the value of the web.xml dtd public id
- */
- @XmlTransient
- public String getDtdPublicId()
- {
- return dtdPublicId;
- }
- /**
- * Get the DTD system id if one was seen
- * @return the value of the web.xml dtd system id
- */
- @XmlTransient
- public String getDtdSystemId()
- {
- return dtdSystemId;
- }
-
- @XmlTransient
- public InterceptorsMetaData getInterceptors()
- {
- return interceptors;
- }
-
- /**
- * Get the jboss.xml version.
- *
- * @return the version.
- */
- public String getVersion()
- {
- return version;
- }
-
- /**
- * Set the version.
- *
- * @param version the version.
- * @throws IllegalArgumentException for a null version
- */
- @XmlAttribute
- public void setVersion(String version)
- {
- if (version == null)
- throw new IllegalArgumentException("Null version");
- this.version = version;
- }
-
- public JBossAssemblyDescriptorMetaData getAssemblyDescriptor()
- {
- return assemblyDescriptor;
- }
-
- public String getEjbClientJar()
- {
- return this.ejbClientJar;
- }
- public void setEjbClientJar(String ejbClientJar)
- {
- this.ejbClientJar = ejbClientJar;
- }
-
- public RelationsMetaData getRelationships()
- {
- return this.relationships;
- }
- public void setRelationships(RelationsMetaData relationships)
- {
- this.relationships = relationships;
- }
-
- public boolean isEJB1x()
- {
- return ejbVersion != null && ejbVersion.contains("1.");
- }
-
- public boolean isEJB21()
- {
- return ejbVersion != null && ejbVersion.contains("2.1");
- }
-
- public boolean isEJB2x()
- {
- return ejbVersion != null && ejbVersion.contains("2.");
- }
-
- public boolean isEJB3x()
- {
- return ejbVersion != null && ejbVersion.contains("3.");
- }
-
- /**
- * Get the loaderRepository.
- *
- * @return the loaderRepository.
- */
- public LoaderRepositoryMetaData getLoaderRepository()
- {
- return loaderRepository;
- }
-
- /**
- * Set the loaderRepository.
- *
- * @param loaderRepository the loaderRepository.
- * @throws IllegalArgumentException for a null loaderRepository
- */
- public void setLoaderRepository(LoaderRepositoryMetaData loaderRepository)
- {
- if (loaderRepository == null)
- throw new IllegalArgumentException("Null loaderRepository");
- this.loaderRepository = loaderRepository;
- }
-
- /**
- * Get the jmxName.
- *
- * @return the jmxName.
- */
- public String getJmxName()
- {
- return jmxName;
- }
-
- public String getJaccContextID()
- {
- return jaccContextID;
- }
-
- /**
- * Set the jmxName.
- *
- * @param jmxName the jmxName.
- * @throws IllegalArgumentException for a null jmxName
- */
- public void setJmxName(String jmxName)
- {
- if (jmxName == null)
- throw new IllegalArgumentException("Null jmxName");
- this.jmxName = jmxName;
- }
-
- /**
- * Set the JACC context id
- * @param jaccContextID the id to use for the bean JACC context
- */
- public void setJaccContextID(String jaccContextID)
- {
- this.jaccContextID = jaccContextID;
- }
-
- /**
- * Get the securityDomain.
- *
- * @return the securityDomain.
- */
- public String getSecurityDomain()
- {
- return securityDomain;
- }
-
- /**
- * Set the securityDomain.
- *
- * @param securityDomain the securityDomain.
- * @throws IllegalArgumentException for a null securityDomain
- */
- public void setSecurityDomain(String securityDomain)
- {
- if (securityDomain == null)
- throw new IllegalArgumentException("Null securityDomain");
- this.securityDomain = securityDomain.trim();
- }
-
- /**
- * Get the excludeMissingMethods.
- *
- * @return the excludeMissingMethods.
- */
- public boolean isExcludeMissingMethods()
- {
- return excludeMissingMethods;
- }
-
- /**
- * Set the excludeMissingMethods.
- *
- * @param excludeMissingMethods the excludeMissingMethods.
- */
- @XmlElement(name="missing-method-permissions-excluded-mode")
- public void setExcludeMissingMethods(boolean excludeMissingMethods)
- {
- this.excludeMissingMethods = excludeMissingMethods;
- }
-
- /**
- * Get the unauthenticatedPrincipal.
- *
- * @return the unauthenticatedPrincipal.
- */
- public String getUnauthenticatedPrincipal()
- {
- return unauthenticatedPrincipal;
- }
-
- /**
- * Set the unauthenticatedPrincipal.
- *
- * @param unauthenticatedPrincipal the unauthenticatedPrincipal.
- * @throws IllegalArgumentException for a null unauthenticatedPrincipal
- */
- public void setUnauthenticatedPrincipal(String unauthenticatedPrincipal)
- {
- if (unauthenticatedPrincipal == null)
- throw new IllegalArgumentException("Null unauthenticatedPrincipal");
- this.unauthenticatedPrincipal = unauthenticatedPrincipal;
- }
-
- /**
- * Get the exceptionOnRollback.
- *
- * @return the exceptionOnRollback.
- */
- public boolean isExceptionOnRollback()
- {
- return exceptionOnRollback;
- }
-
- /**
- * Set the exceptionOnRollback.
- *
- * @param exceptionOnRollback the exceptionOnRollback.
- */
- public void setExceptionOnRollback(boolean exceptionOnRollback)
- {
- this.exceptionOnRollback = exceptionOnRollback;
- }
-
- public boolean isMetadataComplete()
- {
- return metadataComplete;
- }
-
- public void setMetadataComplete(boolean metadataComplete)
- {
- this.metadataComplete = metadataComplete;
- }
-
- /**
- * Get the enterpriseBeans.
- *
- * @return the enterpriseBeans.
- */
- public JBossEnterpriseBeansMetaData getEnterpriseBeans()
- {
- return enterpriseBeans;
- }
-
- /**
- * Set the enterpriseBeans.
- *
- * @param enterpriseBeans the enterpriseBeans.
- * @throws IllegalArgumentException for a null enterpriseBeans
- */
- @XmlElement(name="enterprise-beans")
- public void setEnterpriseBeans(JBossEnterpriseBeansMetaData enterpriseBeans)
- {
- if (enterpriseBeans == null)
- throw new IllegalArgumentException("Null enterpriseBeans");
- this.enterpriseBeans = enterpriseBeans;
- this.enterpriseBeans.setJBossMetaData(this);
- }
-
- /**
- * Get an enterprise bean
- *
- * @param name the name
- * @return the container configuration
- */
- public JBossEnterpriseBeanMetaData getEnterpriseBean(String name)
- {
- if (enterpriseBeans == null)
- return null;
- return enterpriseBeans.get(name);
- }
-
- /**
- * Set the enforceEjbRestrictions.
- *
- * @param enforceEjbRestrictions the enforceEjbRestrictions.
- * @throws IllegalArgumentException for a null enforceEjbRestrictions
- */
- public void setEnforceEjbRestrictions(String enforceEjbRestrictions)
- {
- log.warn("<enforce-ejb-restrictions/> in jboss.xml is no longer used and will be removed in a future version.");
- }
-
- /**
- * Get the webservices.
- *
- * @return the webservices.
- */
- public WebservicesMetaData getWebservices()
- {
- return webservices;
- }
-
- /**
- * Set the webservices.
- *
- * @param webservices the webservices.
- * @throws IllegalArgumentException for a null webservices
- */
- public void setWebservices(WebservicesMetaData webservices)
- {
- if (webservices == null)
- throw new IllegalArgumentException("Null webservices");
- this.webservices = webservices;
- }
-
- /**
- * Get the containerConfigurations.
- *
- * @return the containerConfigurations.
- */
- public ContainerConfigurationsMetaData getContainerConfigurations()
- {
- return containerConfigurations;
- }
-
- /**
- * Set the containerConfigurations.
- *
- * @param containerConfigurations the containerConfigurations.
- * @throws IllegalArgumentException for a null containerConfigurations
- */
- public void setContainerConfigurations(ContainerConfigurationsMetaData containerConfigurations)
- {
- if (containerConfigurations == null)
- throw new IllegalArgumentException("Null containerConfigurations");
- this.containerConfigurations = containerConfigurations;
- }
-
- /**
- * Get a container configuration
- *
- * @param name the name
- * @return the container configuration
- */
- public ContainerConfigurationMetaData getContainerConfiguration(String name)
- {
- if (containerConfigurations == null)
- return null;
- return containerConfigurations.get(name);
- }
-
- /**
- * Get the invokerProxyBindings.
- *
- * @return the invokerProxyBindings.
- */
- public InvokerProxyBindingsMetaData getInvokerProxyBindings()
- {
- return invokerProxyBindings;
- }
-
- /**
- * Set the invokerProxyBindings.
- *
- * @param invokerProxyBindings the invokerProxyBindings.
- * @throws IllegalArgumentException for a null invokerProxyBindings
- */
- public void setInvokerProxyBindings(InvokerProxyBindingsMetaData invokerProxyBindings)
- {
- if (invokerProxyBindings == null)
- throw new IllegalArgumentException("Null invokerProxyBindings");
- this.invokerProxyBindings = invokerProxyBindings;
- }
-
- /**
- * Get an invoker proxy binding
- *
- * @param name the name
- * @return the invoker proxy binding
- */
- public InvokerProxyBindingMetaData getInvokerProxyBinding(String name)
- {
- if (invokerProxyBindings == null)
- return null;
- return invokerProxyBindings.get(name);
- }
-
- /**
- * Get the resourceManagers.
- *
- * @return the resourceManagers.
- */
- public ResourceManagersMetaData getResourceManagers()
- {
- return resourceManagers;
- }
-
- /**
- * Set the resourceManagers.
- *
- * @param resourceManagers the resourceManagers.
- * @throws IllegalArgumentException for a null resourceManagers
- */
- public void setResourceManagers(ResourceManagersMetaData resourceManagers)
- {
- if (resourceManagers == null)
- throw new IllegalArgumentException("Null resourceManagers");
- this.resourceManagers = resourceManagers;
- }
-
- /**
- * Get a resource manager
- *
- * @param name the name
- * @return the resource manager
- */
- public ResourceManagerMetaData getResourceManager(String name)
- {
- if (resourceManagers == null)
- return null;
- return resourceManagers.get(name);
- }
-
- /**
- * Set the assemblyDescriptor.
- *
- * @param assemblyDescriptor the assemblyDescriptor.
- * @throws IllegalArgumentException for a null assemblyDescriptor
- */
- public void setAssemblyDescriptor(JBossAssemblyDescriptorMetaData assemblyDescriptor)
- {
- if (assemblyDescriptor == null)
- throw new IllegalArgumentException("Null assemblyDescriptor");
- this.assemblyDescriptor = assemblyDescriptor;
- }
-
- public String getJndiBindingPolicy()
- {
- return jndiBindingPolicy;
- }
-
- public void setJndiBindingPolicy(String jndiBindingPolicy)
- {
- this.jndiBindingPolicy = jndiBindingPolicy;
- }
-
- /**
- * Access the RunAsIdentity associated with the given servlet
- * @param ejbName - the servlet-name from the web.xml
- * @return RunAsIdentity for the servet if one exists, null otherwise
- */
- @XmlTransient
- public RunAsIdentityMetaData getRunAsIdentity(String ejbName)
- {
- RunAsIdentityMetaData identity = runAsIdentity.get(ejbName);
- if (identity == null)
- {
- JBossEnterpriseBeanMetaData ejb = this.getEnterpriseBean(ejbName);
- if (ejb != null)
- {
- // Check for a ejb-jar.xml run-as only specification
- synchronized (runAsIdentity)
- {
- SecurityIdentityMetaData si = ejb.getSecurityIdentity();
- if(si != null)
- {
- RunAsMetaData runAs = si.getRunAs();
- if (runAs != null)
- {
- String roleName = runAs.getRoleName();
- identity = new RunAsIdentityMetaData(roleName, null);
- runAsIdentity.put(ejbName, identity);
- }
- }
- }
- }
- }
- return identity;
- }
-
- /**
- * Get the ejb deployment summary information.
- * @return the associated ejb deployment summary if a deployer has
- * set it. May be null.
- */
- @XmlTransient
- public DeploymentSummary getDeploymentSummary()
- {
- return deploymentSummary;
- }
- public void setDeploymentSummary(DeploymentSummary deploymentSummary)
- {
- this.deploymentSummary = deploymentSummary;
- }
-
- /**
- * Merge the contents of override with original into this.
- *
- * @param override data which overrides original
- * @param original the original data
- */
- public void merge(JBossMetaData override, EjbJarMetaData original)
- {
- super.merge(override, original);
- if(assemblyDescriptor == null)
- assemblyDescriptor = new JBossAssemblyDescriptorMetaData();
- if(resourceManagers == null)
- resourceManagers = new ResourceManagersMetaData();
- if(containerConfigurations == null)
- containerConfigurations = new ContainerConfigurationsMetaData();
- if(override != null && override.containerConfigurations != null)
- containerConfigurations.merge(override.containerConfigurations);
- if(invokerProxyBindings == null)
- invokerProxyBindings = new InvokerProxyBindingsMetaData();
- if(override != null && override.invokerProxyBindings != null)
- invokerProxyBindings.merge(override.invokerProxyBindings);
- if(interceptors == null)
- interceptors = new InterceptorsMetaData();
- if(override != null && override.webservices != null)
- webservices = new WebservicesMetaData();
-
- if(original != null)
- {
- ejbVersion = original.getVersion();
- relationships = original.getRelationships();
- if(original instanceof EjbJar3xMetaData)
- {
- EjbJar3xMetaData original3x = (EjbJar3xMetaData) original;
- metadataComplete = original3x.isMetadataComplete();
- }
- }
-
- if(override != null && override.assemblyDescriptor != null)
- {
- assemblyDescriptor.merge(override.assemblyDescriptor, original.getAssemblyDescriptor());
- }
- else if(original != null && original.getAssemblyDescriptor() != null)
- {
- assemblyDescriptor.merge(null, original.getAssemblyDescriptor());
- }
- //
- if(override != null && override.resourceManagers != null)
- resourceManagers.merge(override.resourceManagers);
-
- if(override != null && override.interceptors != null)
- interceptors.merge(override.interceptors);
- else if(original != null && original.getInterceptors() != null)
- interceptors.merge(original.getInterceptors());
-
- if(override != null)
- {
- if(override.jaccContextID != null)
- jaccContextID = override.jaccContextID;
- if(override.jmxName != null)
- jmxName = override.jmxName;
- if(override.loaderRepository != null)
- loaderRepository = override.loaderRepository;
- if(override.securityDomain != null)
- securityDomain = override.securityDomain;
- if(override.unauthenticatedPrincipal != null)
- unauthenticatedPrincipal = override.unauthenticatedPrincipal;
- if(override.metadataComplete)
- metadataComplete = true;
- }
-
- if (webservices != null && override != null)
- webservices.merge(override.webservices);
-
- if(enterpriseBeans == null)
- {
- enterpriseBeans = new JBossEnterpriseBeansMetaData();
- enterpriseBeans.setJBossMetaData(this);
- }
-
- JBossEnterpriseBeansMetaData jbeans = null;
- if(override != null)
- {
- jbeans = override.enterpriseBeans;
-
- //Ensure that there is no customization of the Unspecified method permissions
- if(override.excludeMissingMethods == false)
- this.excludeMissingMethods = false;
- }
-
- EnterpriseBeansMetaData beans = null;
- if(original != null)
- beans = original.getEnterpriseBeans();
-
- boolean isEJB3x = (original == null || original.isEJB3x());
- enterpriseBeans.merge(jbeans, beans, "ejb-jar.xml", "jboss.xml", !isEJB3x);
-
- // Update run-as indentity for a run-as-principal
- if(enterpriseBeans != null)
- {
- for(JBossEnterpriseBeanMetaData ejb : enterpriseBeans)
- {
- String ejbName = ejb.getEjbName();
- SecurityIdentityMetaData si = ejb.getSecurityIdentity();
- String principalName = si != null ? si.getRunAsPrincipal() : null;
- // Get the run-as primary role
- String ejbXmlRunAs = null;
- if(si != null && si.getRunAs() != null)
- ejbXmlRunAs = si.getRunAs().getRoleName();
- if (principalName != null)
- {
- // Update the run-as indentity to use the principal name
- if (ejbXmlRunAs == null)
- {
- // Can't make this check since the name may come from an annotation
- //throw new IllegalStateException("run-as-principal: " + principalName + " found in jboss.xml but there was no run-as in ejb-jar.xml");
- ejbXmlRunAs = "anonymous";
- }
- // See if there are any additional roles for this principal
- Set<String> extraRoles = null;
- if(getAssemblyDescriptor() != null)
- {
- extraRoles = getAssemblyDescriptor().getSecurityRoleNamesByPrincipal(principalName);
- }
- RunAsIdentityMetaData runAsId = new RunAsIdentityMetaData(ejbXmlRunAs, principalName, extraRoles);
- runAsIdentity.put(ejbName, runAsId);
- }
- else if (ejbXmlRunAs != null)
- {
- RunAsIdentityMetaData runAsId = new RunAsIdentityMetaData(ejbXmlRunAs, null);
- runAsIdentity.put(ejbName, runAsId);
- }
- }
- }
- }
-
- /**
- *
- * @return
- */
- protected JBossEnterpriseBeanMetaData newBean()
- {
- return null;
- }
-}
Copied: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java (from rev 73241, projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,816 @@
+/*
+* 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.metadata.ejb.jboss;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.ejb.IEjbJarMetaData;
+import org.jboss.metadata.common.jboss.LoaderRepositoryMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
+import org.jboss.metadata.ejb.spec.EjbJar3xMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
+import org.jboss.metadata.ejb.spec.RelationsMetaData;
+import org.jboss.metadata.ejb.spec.SecurityIdentityMetaData;
+import org.jboss.metadata.javaee.jboss.RunAsIdentityMetaData;
+import org.jboss.metadata.javaee.spec.RunAsMetaData;
+import org.jboss.metadata.javaee.support.IdMetaDataImplWithDescriptionGroup;
+
+/**
+ * JBossMetaData.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class JBossMetaData extends IdMetaDataImplWithDescriptionGroup
+ implements IEjbJarMetaData<JBossAssemblyDescriptorMetaData, JBossEnterpriseBeansMetaData, JBossEnterpriseBeanMetaData, JBossMetaData>
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 598759931857080298L;
+
+ /** The log */
+ private static final Logger log = Logger.getLogger(JBossMetaData.class);
+
+ /** DTD information */
+ private String dtdPublicId;
+ private String dtdSystemId;
+ /** The version */
+ private String version;
+ /** The ejb jar version */
+ private String ejbVersion;
+
+ /** The ejb client jar */
+ private String ejbClientJar;
+
+ /** The relations */
+ private RelationsMetaData relationships;
+
+ /** The loader repository */
+ private LoaderRepositoryMetaData loaderRepository;
+
+ /** The jmx name */
+ private String jmxName;
+
+ /** The security domain */
+ private String securityDomain;
+
+ /** The jacc context id */
+ private String jaccContextID;
+
+ /** Whether to exclude missing methods */
+ private boolean excludeMissingMethods = true;
+
+ /** The unauthenticated principal */
+ private String unauthenticatedPrincipal;
+
+ /** Whether to throw an exception when marked rollback */
+ private boolean exceptionOnRollback;
+
+ /** The webservices */
+ private WebservicesMetaData webservices;
+
+ /** The enterprise beans */
+ private JBossEnterpriseBeansMetaData enterpriseBeans;
+
+ /** The assembly descriptor */
+ private JBossAssemblyDescriptorMetaData assemblyDescriptor;
+
+ /** The resource manager */
+ private ResourceManagersMetaData resourceManagers;
+
+ /** The invoker-proxy-bindings */
+ private InvokerProxyBindingsMetaData invokerProxyBindings;
+
+ /** The container configurations */
+ private ContainerConfigurationsMetaData containerConfigurations;
+
+ /** The interceptors */
+ private InterceptorsMetaData interceptors;
+ /** */
+ private Map<String, RunAsIdentityMetaData> runAsIdentity = new HashMap<String, RunAsIdentityMetaData>();
+ /** Is this a complete metadata description */
+ private boolean metadataComplete;
+
+ /** the class name that implements the default JNDI binding policy for this ejb unit*/
+ private String jndiBindingPolicy;
+ /** The ejb jar deployment summary information */
+ private DeploymentSummary deploymentSummary;
+
+ /**
+ * Create a new JBossMetaData.
+ */
+ public JBossMetaData()
+ {
+ // For serialization
+ }
+
+ /**
+ * Callback for the DTD information
+ * @param root
+ * @param publicId
+ * @param systemId
+ */
+ @XmlTransient
+ public void setDTD(String root, String publicId, String systemId)
+ {
+ this.dtdPublicId = publicId;
+ this.dtdSystemId = systemId;
+ // Set the version based on the public id
+ if (dtdPublicId != null && dtdPublicId.contains("3.0"))
+ setVersion("3.0");
+ if (dtdPublicId != null && dtdPublicId.contains("3.2"))
+ setVersion("3.2");
+ if (dtdPublicId != null && dtdPublicId.contains("4.0"))
+ setVersion("4.0");
+ if (dtdPublicId != null && dtdPublicId.contains("4.2"))
+ setVersion("4.2");
+ if (dtdPublicId != null && dtdPublicId.contains("5.0"))
+ setVersion("5.0");
+ }
+ /**
+ * Get the DTD public id if one was seen
+ * @return the value of the web.xml dtd public id
+ */
+ @XmlTransient
+ public String getDtdPublicId()
+ {
+ return dtdPublicId;
+ }
+ /**
+ * Get the DTD system id if one was seen
+ * @return the value of the web.xml dtd system id
+ */
+ @XmlTransient
+ public String getDtdSystemId()
+ {
+ return dtdSystemId;
+ }
+
+ @XmlTransient
+ public InterceptorsMetaData getInterceptors()
+ {
+ return interceptors;
+ }
+
+ /**
+ * Get the jboss.xml version.
+ *
+ * @return the version.
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Set the version.
+ *
+ * @param version the version.
+ * @throws IllegalArgumentException for a null version
+ */
+ @XmlAttribute
+ public void setVersion(String version)
+ {
+ if (version == null)
+ throw new IllegalArgumentException("Null version");
+ this.version = version;
+ }
+
+ public JBossAssemblyDescriptorMetaData getAssemblyDescriptor()
+ {
+ return assemblyDescriptor;
+ }
+
+ public String getEjbClientJar()
+ {
+ return this.ejbClientJar;
+ }
+ public void setEjbClientJar(String ejbClientJar)
+ {
+ this.ejbClientJar = ejbClientJar;
+ }
+
+ /**
+ * The spec metadata version information
+ * @return
+ */
+ @XmlTransient
+ public String getEjbVersion()
+ {
+ return ejbVersion;
+ }
+ public void setEjbVersion(String ejbVersion)
+ {
+ this.ejbVersion = ejbVersion;
+ }
+
+ public RelationsMetaData getRelationships()
+ {
+ return this.relationships;
+ }
+ public void setRelationships(RelationsMetaData relationships)
+ {
+ this.relationships = relationships;
+ }
+
+ public boolean isEJB1x()
+ {
+ return ejbVersion != null && ejbVersion.contains("1.");
+ }
+
+ public boolean isEJB21()
+ {
+ return ejbVersion != null && ejbVersion.contains("2.1");
+ }
+
+ public boolean isEJB2x()
+ {
+ return ejbVersion != null && ejbVersion.contains("2.");
+ }
+
+ public boolean isEJB3x()
+ {
+ return ejbVersion != null && ejbVersion.contains("3.");
+ }
+
+ /**
+ * Get the loaderRepository.
+ *
+ * @return the loaderRepository.
+ */
+ public LoaderRepositoryMetaData getLoaderRepository()
+ {
+ return loaderRepository;
+ }
+
+ /**
+ * Set the loaderRepository.
+ *
+ * @param loaderRepository the loaderRepository.
+ * @throws IllegalArgumentException for a null loaderRepository
+ */
+ public void setLoaderRepository(LoaderRepositoryMetaData loaderRepository)
+ {
+ if (loaderRepository == null)
+ throw new IllegalArgumentException("Null loaderRepository");
+ this.loaderRepository = loaderRepository;
+ }
+
+ /**
+ * Get the jmxName.
+ *
+ * @return the jmxName.
+ */
+ public String getJmxName()
+ {
+ return jmxName;
+ }
+
+ public String getJaccContextID()
+ {
+ return jaccContextID;
+ }
+
+ /**
+ * Set the jmxName.
+ *
+ * @param jmxName the jmxName.
+ * @throws IllegalArgumentException for a null jmxName
+ */
+ public void setJmxName(String jmxName)
+ {
+ if (jmxName == null)
+ throw new IllegalArgumentException("Null jmxName");
+ this.jmxName = jmxName;
+ }
+
+ /**
+ * Set the JACC context id
+ * @param jaccContextID the id to use for the bean JACC context
+ */
+ public void setJaccContextID(String jaccContextID)
+ {
+ this.jaccContextID = jaccContextID;
+ }
+
+ /**
+ * Get the securityDomain.
+ *
+ * @return the securityDomain.
+ */
+ public String getSecurityDomain()
+ {
+ return securityDomain;
+ }
+
+ /**
+ * Set the securityDomain.
+ *
+ * @param securityDomain the securityDomain.
+ * @throws IllegalArgumentException for a null securityDomain
+ */
+ public void setSecurityDomain(String securityDomain)
+ {
+ if (securityDomain == null)
+ throw new IllegalArgumentException("Null securityDomain");
+ this.securityDomain = securityDomain.trim();
+ }
+
+ /**
+ * Get the excludeMissingMethods.
+ *
+ * @return the excludeMissingMethods.
+ */
+ public boolean isExcludeMissingMethods()
+ {
+ return excludeMissingMethods;
+ }
+
+ /**
+ * Set the excludeMissingMethods.
+ *
+ * @param excludeMissingMethods the excludeMissingMethods.
+ */
+ @XmlElement(name="missing-method-permissions-excluded-mode")
+ public void setExcludeMissingMethods(boolean excludeMissingMethods)
+ {
+ this.excludeMissingMethods = excludeMissingMethods;
+ }
+
+ /**
+ * Get the unauthenticatedPrincipal.
+ *
+ * @return the unauthenticatedPrincipal.
+ */
+ public String getUnauthenticatedPrincipal()
+ {
+ return unauthenticatedPrincipal;
+ }
+
+ /**
+ * Set the unauthenticatedPrincipal.
+ *
+ * @param unauthenticatedPrincipal the unauthenticatedPrincipal.
+ * @throws IllegalArgumentException for a null unauthenticatedPrincipal
+ */
+ public void setUnauthenticatedPrincipal(String unauthenticatedPrincipal)
+ {
+ if (unauthenticatedPrincipal == null)
+ throw new IllegalArgumentException("Null unauthenticatedPrincipal");
+ this.unauthenticatedPrincipal = unauthenticatedPrincipal;
+ }
+
+ /**
+ * Get the exceptionOnRollback.
+ *
+ * @return the exceptionOnRollback.
+ */
+ public boolean isExceptionOnRollback()
+ {
+ return exceptionOnRollback;
+ }
+
+ /**
+ * Set the exceptionOnRollback.
+ *
+ * @param exceptionOnRollback the exceptionOnRollback.
+ */
+ public void setExceptionOnRollback(boolean exceptionOnRollback)
+ {
+ this.exceptionOnRollback = exceptionOnRollback;
+ }
+
+ public boolean isMetadataComplete()
+ {
+ return metadataComplete;
+ }
+
+ public void setMetadataComplete(boolean metadataComplete)
+ {
+ this.metadataComplete = metadataComplete;
+ }
+
+ /**
+ * Get the enterpriseBeans.
+ *
+ * @return the enterpriseBeans.
+ */
+ public JBossEnterpriseBeansMetaData getEnterpriseBeans()
+ {
+ return enterpriseBeans;
+ }
+
+ /**
+ * Set the enterpriseBeans.
+ *
+ * @param enterpriseBeans the enterpriseBeans.
+ * @throws IllegalArgumentException for a null enterpriseBeans
+ */
+ @XmlElement(name="enterprise-beans")
+ public void setEnterpriseBeans(JBossEnterpriseBeansMetaData enterpriseBeans)
+ {
+ if (enterpriseBeans == null)
+ throw new IllegalArgumentException("Null enterpriseBeans");
+ this.enterpriseBeans = enterpriseBeans;
+ this.enterpriseBeans.setJBossMetaData(this);
+ }
+
+ /**
+ * Get an enterprise bean
+ *
+ * @param name the name
+ * @return the container configuration
+ */
+ public JBossEnterpriseBeanMetaData getEnterpriseBean(String name)
+ {
+ if (enterpriseBeans == null)
+ return null;
+ return enterpriseBeans.get(name);
+ }
+
+ /**
+ * Set the enforceEjbRestrictions.
+ *
+ * @param enforceEjbRestrictions the enforceEjbRestrictions.
+ * @throws IllegalArgumentException for a null enforceEjbRestrictions
+ */
+ public void setEnforceEjbRestrictions(String enforceEjbRestrictions)
+ {
+ log.warn("<enforce-ejb-restrictions/> in jboss.xml is no longer used and will be removed in a future version.");
+ }
+
+ /**
+ * Get the webservices.
+ *
+ * @return the webservices.
+ */
+ public WebservicesMetaData getWebservices()
+ {
+ return webservices;
+ }
+
+ /**
+ * Set the webservices.
+ *
+ * @param webservices the webservices.
+ * @throws IllegalArgumentException for a null webservices
+ */
+ public void setWebservices(WebservicesMetaData webservices)
+ {
+ if (webservices == null)
+ throw new IllegalArgumentException("Null webservices");
+ this.webservices = webservices;
+ }
+
+ /**
+ * Get the containerConfigurations.
+ *
+ * @return the containerConfigurations.
+ */
+ public ContainerConfigurationsMetaData getContainerConfigurations()
+ {
+ return containerConfigurations;
+ }
+
+ /**
+ * Set the containerConfigurations.
+ *
+ * @param containerConfigurations the containerConfigurations.
+ * @throws IllegalArgumentException for a null containerConfigurations
+ */
+ public void setContainerConfigurations(ContainerConfigurationsMetaData containerConfigurations)
+ {
+ if (containerConfigurations == null)
+ throw new IllegalArgumentException("Null containerConfigurations");
+ this.containerConfigurations = containerConfigurations;
+ }
+
+ /**
+ * Get a container configuration
+ *
+ * @param name the name
+ * @return the container configuration
+ */
+ public ContainerConfigurationMetaData getContainerConfiguration(String name)
+ {
+ if (containerConfigurations == null)
+ return null;
+ return containerConfigurations.get(name);
+ }
+
+ /**
+ * Get the invokerProxyBindings.
+ *
+ * @return the invokerProxyBindings.
+ */
+ public InvokerProxyBindingsMetaData getInvokerProxyBindings()
+ {
+ return invokerProxyBindings;
+ }
+
+ /**
+ * Set the invokerProxyBindings.
+ *
+ * @param invokerProxyBindings the invokerProxyBindings.
+ * @throws IllegalArgumentException for a null invokerProxyBindings
+ */
+ public void setInvokerProxyBindings(InvokerProxyBindingsMetaData invokerProxyBindings)
+ {
+ if (invokerProxyBindings == null)
+ throw new IllegalArgumentException("Null invokerProxyBindings");
+ this.invokerProxyBindings = invokerProxyBindings;
+ }
+
+ /**
+ * Get an invoker proxy binding
+ *
+ * @param name the name
+ * @return the invoker proxy binding
+ */
+ public InvokerProxyBindingMetaData getInvokerProxyBinding(String name)
+ {
+ if (invokerProxyBindings == null)
+ return null;
+ return invokerProxyBindings.get(name);
+ }
+
+ /**
+ * Get the resourceManagers.
+ *
+ * @return the resourceManagers.
+ */
+ public ResourceManagersMetaData getResourceManagers()
+ {
+ return resourceManagers;
+ }
+
+ /**
+ * Set the resourceManagers.
+ *
+ * @param resourceManagers the resourceManagers.
+ * @throws IllegalArgumentException for a null resourceManagers
+ */
+ public void setResourceManagers(ResourceManagersMetaData resourceManagers)
+ {
+ if (resourceManagers == null)
+ throw new IllegalArgumentException("Null resourceManagers");
+ this.resourceManagers = resourceManagers;
+ }
+
+ /**
+ * Get a resource manager
+ *
+ * @param name the name
+ * @return the resource manager
+ */
+ public ResourceManagerMetaData getResourceManager(String name)
+ {
+ if (resourceManagers == null)
+ return null;
+ return resourceManagers.get(name);
+ }
+
+ /**
+ * Set the assemblyDescriptor.
+ *
+ * @param assemblyDescriptor the assemblyDescriptor.
+ * @throws IllegalArgumentException for a null assemblyDescriptor
+ */
+ public void setAssemblyDescriptor(JBossAssemblyDescriptorMetaData assemblyDescriptor)
+ {
+ if (assemblyDescriptor == null)
+ throw new IllegalArgumentException("Null assemblyDescriptor");
+ this.assemblyDescriptor = assemblyDescriptor;
+ }
+
+ public String getJndiBindingPolicy()
+ {
+ return jndiBindingPolicy;
+ }
+
+ public void setJndiBindingPolicy(String jndiBindingPolicy)
+ {
+ this.jndiBindingPolicy = jndiBindingPolicy;
+ }
+
+ /**
+ * Access the RunAsIdentity associated with the given servlet
+ * @param ejbName - the servlet-name from the web.xml
+ * @return RunAsIdentity for the servet if one exists, null otherwise
+ */
+ @XmlTransient
+ public RunAsIdentityMetaData getRunAsIdentity(String ejbName)
+ {
+ RunAsIdentityMetaData identity = runAsIdentity.get(ejbName);
+ if (identity == null)
+ {
+ JBossEnterpriseBeanMetaData ejb = this.getEnterpriseBean(ejbName);
+ if (ejb != null)
+ {
+ // Check for a ejb-jar.xml run-as only specification
+ synchronized (runAsIdentity)
+ {
+ SecurityIdentityMetaData si = ejb.getSecurityIdentity();
+ if(si != null)
+ {
+ RunAsMetaData runAs = si.getRunAs();
+ if (runAs != null)
+ {
+ String roleName = runAs.getRoleName();
+ identity = new RunAsIdentityMetaData(roleName, null);
+ runAsIdentity.put(ejbName, identity);
+ }
+ }
+ }
+ }
+ }
+ return identity;
+ }
+
+ /**
+ * Get the ejb deployment summary information.
+ * @return the associated ejb deployment summary if a deployer has
+ * set it. May be null.
+ */
+ @XmlTransient
+ public DeploymentSummary getDeploymentSummary()
+ {
+ return deploymentSummary;
+ }
+ public void setDeploymentSummary(DeploymentSummary deploymentSummary)
+ {
+ this.deploymentSummary = deploymentSummary;
+ }
+
+ /**
+ * Merge the contents of override with original into this.
+ *
+ * @param override data which overrides original
+ * @param original the original data
+ */
+ public void merge(JBossMetaData override, EjbJarMetaData original)
+ {
+ super.merge(override, original);
+ if(assemblyDescriptor == null)
+ assemblyDescriptor = new JBossAssemblyDescriptorMetaData();
+ if(resourceManagers == null)
+ resourceManagers = new ResourceManagersMetaData();
+ if(containerConfigurations == null)
+ containerConfigurations = new ContainerConfigurationsMetaData();
+ if(override != null && override.containerConfigurations != null)
+ containerConfigurations.merge(override.containerConfigurations);
+ if(invokerProxyBindings == null)
+ invokerProxyBindings = new InvokerProxyBindingsMetaData();
+ if(override != null && override.invokerProxyBindings != null)
+ invokerProxyBindings.merge(override.invokerProxyBindings);
+ if(interceptors == null)
+ interceptors = new InterceptorsMetaData();
+ if(override != null && override.webservices != null)
+ webservices = new WebservicesMetaData();
+
+ if(original != null)
+ {
+ ejbVersion = original.getVersion();
+ relationships = original.getRelationships();
+ if(original instanceof EjbJar3xMetaData)
+ {
+ EjbJar3xMetaData original3x = (EjbJar3xMetaData) original;
+ metadataComplete = original3x.isMetadataComplete();
+ }
+ }
+
+ if(override != null && override.assemblyDescriptor != null)
+ {
+ assemblyDescriptor.merge(override.assemblyDescriptor, original.getAssemblyDescriptor());
+ }
+ else if(original != null && original.getAssemblyDescriptor() != null)
+ {
+ assemblyDescriptor.merge(null, original.getAssemblyDescriptor());
+ }
+ //
+ if(override != null && override.resourceManagers != null)
+ resourceManagers.merge(override.resourceManagers);
+
+ if(override != null && override.interceptors != null)
+ interceptors.merge(override.interceptors);
+ else if(original != null && original.getInterceptors() != null)
+ interceptors.merge(original.getInterceptors());
+
+ if(override != null)
+ {
+ if(override.jaccContextID != null)
+ jaccContextID = override.jaccContextID;
+ if(override.jmxName != null)
+ jmxName = override.jmxName;
+ if(override.loaderRepository != null)
+ loaderRepository = override.loaderRepository;
+ if(override.securityDomain != null)
+ securityDomain = override.securityDomain;
+ if(override.unauthenticatedPrincipal != null)
+ unauthenticatedPrincipal = override.unauthenticatedPrincipal;
+ if(override.metadataComplete)
+ metadataComplete = true;
+ }
+
+ if (webservices != null && override != null)
+ webservices.merge(override.webservices);
+
+ if(enterpriseBeans == null)
+ {
+ enterpriseBeans = new JBossEnterpriseBeansMetaData();
+ enterpriseBeans.setJBossMetaData(this);
+ }
+
+ JBossEnterpriseBeansMetaData jbeans = null;
+ if(override != null)
+ {
+ jbeans = override.enterpriseBeans;
+
+ //Ensure that there is no customization of the Unspecified method permissions
+ if(override.excludeMissingMethods == false)
+ this.excludeMissingMethods = false;
+ }
+
+ EnterpriseBeansMetaData beans = null;
+ if(original != null)
+ beans = original.getEnterpriseBeans();
+
+ boolean isEJB3x = (original == null || original.isEJB3x());
+ enterpriseBeans.merge(jbeans, beans, "ejb-jar.xml", "jboss.xml", !isEJB3x);
+
+ // Update run-as indentity for a run-as-principal
+ if(enterpriseBeans != null)
+ {
+ for(JBossEnterpriseBeanMetaData ejb : enterpriseBeans)
+ {
+ String ejbName = ejb.getEjbName();
+ SecurityIdentityMetaData si = ejb.getSecurityIdentity();
+ String principalName = si != null ? si.getRunAsPrincipal() : null;
+ // Get the run-as primary role
+ String ejbXmlRunAs = null;
+ if(si != null && si.getRunAs() != null)
+ ejbXmlRunAs = si.getRunAs().getRoleName();
+ if (principalName != null)
+ {
+ // Update the run-as indentity to use the principal name
+ if (ejbXmlRunAs == null)
+ {
+ // Can't make this check since the name may come from an annotation
+ //throw new IllegalStateException("run-as-principal: " + principalName + " found in jboss.xml but there was no run-as in ejb-jar.xml");
+ ejbXmlRunAs = "anonymous";
+ }
+ // See if there are any additional roles for this principal
+ Set<String> extraRoles = null;
+ if(getAssemblyDescriptor() != null)
+ {
+ extraRoles = getAssemblyDescriptor().getSecurityRoleNamesByPrincipal(principalName);
+ }
+ RunAsIdentityMetaData runAsId = new RunAsIdentityMetaData(ejbXmlRunAs, principalName, extraRoles);
+ runAsIdentity.put(ejbName, runAsId);
+ }
+ else if (ejbXmlRunAs != null)
+ {
+ RunAsIdentityMetaData runAsId = new RunAsIdentityMetaData(ejbXmlRunAs, null);
+ runAsIdentity.put(ejbName, runAsId);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ protected JBossEnterpriseBeanMetaData newBean()
+ {
+ return null;
+ }
+}
Deleted: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * 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.metadata.ejb.jboss.jndipolicy.plugins;
-
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
-
-/**
- * A basic implementation of DefaultJndiBindingPolicy that uses a base jndi
- * name and generates the following from that:
- * getDefaultLocalHomeJndiName : baseJndiName + "/" + KnownInterfaces.LOCAL_HOME
- * getDefaultLocalJndiName : baseJndiName + "/" + KnownInterfaces.LOCAL
- * getDefaultRemoteHomeJndiName : baseJndiName + "/" + KnownInterfaces.HOME
- * getDefaultRemoteJndiName : baseJndiName + "/" + KnownInterfaces.REMOTE
- * getJndiName : baseJndiName
- * getJndiName(String iface) : baseJndiName + "/" + iface (if iface is not in KnownInterfaces)
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class BasicJndiBindingPolicy implements DefaultJndiBindingPolicy
-{
- private String baseJndiName;
-
- public BasicJndiBindingPolicy()
- {
-
- }
- public BasicJndiBindingPolicy(String baseJndiName)
- {
- this.baseJndiName = baseJndiName;
- }
-
-
- public String getBaseJndiName()
- {
- return baseJndiName;
- }
- public void setBaseJndiName(String baseJndiName)
- {
- this.baseJndiName = baseJndiName;
- }
-
- public String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary)
- {
- return baseJndiName + "/" + KnownInterfaces.LOCAL_HOME;
- }
-
- public String getDefaultLocalJndiName(EjbDeploymentSummary summary)
- {
- return baseJndiName + "/" + KnownInterfaces.LOCAL;
- }
-
- public String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary)
- {
- return baseJndiName + "/" + KnownInterfaces.HOME;
- }
-
- public String getDefaultRemoteJndiName(EjbDeploymentSummary summary)
- {
- return baseJndiName + "/" + KnownInterfaces.REMOTE;
- }
-
- public String getJndiName(EjbDeploymentSummary summary)
- {
- return baseJndiName;
- }
-
- public String getJndiName(EjbDeploymentSummary summary, String iface)
- {
- String jndiName = null;
- if(iface == null)
- jndiName = getJndiName(summary);
- else if(KnownInterfaces.isKnownInterface(iface))
- {
- // Don't append the iface for ejb2.x homes
- boolean is3x = summary.getBeanMD().getJBossMetaData().isEJB3x();
- if(is3x)
- jndiName = baseJndiName + "/" + iface;
- else if(KnownInterfaces.LOCAL_HOME.equalsIgnoreCase(iface))
- jndiName = summary.getBeanMD().determineLocalJndiName();
- else
- jndiName = baseJndiName;
- }
- else
- {
- jndiName = baseJndiName + "/" + iface;
- }
- return jndiName;
- }
-
-}
Copied: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java (from rev 73241, projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/BasicJndiBindingPolicy.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.ejb.jboss.jndipolicy.plugins;
+
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces.KnownInterfaceType;
+
+/**
+ * A basic implementation of DefaultJndiBindingPolicy that uses a base jndi
+ * name and generates the following from that:
+ * getDefaultLocalHomeJndiName : baseJndiName + "/" + KnownInterfaces.LOCAL_HOME
+ * getDefaultLocalJndiName : baseJndiName + "/" + KnownInterfaces.LOCAL
+ * getDefaultRemoteHomeJndiName : baseJndiName + "/" + KnownInterfaces.HOME
+ * getDefaultRemoteJndiName : baseJndiName + "/" + KnownInterfaces.REMOTE
+ * getJndiName : baseJndiName
+ * getJndiName(String iface) : baseJndiName + "/" + iface (if iface is not in KnownInterfaces)
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class BasicJndiBindingPolicy implements DefaultJndiBindingPolicy
+{
+ private String baseJndiName;
+
+ public BasicJndiBindingPolicy()
+ {
+
+ }
+ public BasicJndiBindingPolicy(String baseJndiName)
+ {
+ this.baseJndiName = baseJndiName;
+ }
+
+
+ public String getBaseJndiName()
+ {
+ return baseJndiName;
+ }
+ public void setBaseJndiName(String baseJndiName)
+ {
+ this.baseJndiName = baseJndiName;
+ }
+
+ public String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary)
+ {
+ return baseJndiName + "/" + KnownInterfaces.LOCAL_HOME;
+ }
+
+ public String getDefaultLocalJndiName(EjbDeploymentSummary summary)
+ {
+ return baseJndiName + "/" + KnownInterfaces.LOCAL;
+ }
+
+ public String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary)
+ {
+ return baseJndiName + "/" + KnownInterfaces.HOME;
+ }
+
+ public String getDefaultRemoteJndiName(EjbDeploymentSummary summary)
+ {
+ return baseJndiName + "/" + KnownInterfaces.REMOTE;
+ }
+
+ public String getJndiName(EjbDeploymentSummary summary)
+ {
+ return baseJndiName;
+ }
+
+ public String getJndiName(EjbDeploymentSummary summary, String iface,
+ KnownInterfaceType ifaceType)
+ {
+ String jndiName = null;
+ if(KnownInterfaces.isKnownInterface(iface))
+ iface = null;
+
+ if(ifaceType == KnownInterfaceType.UNKNOWN)
+ {
+ if(iface == null)
+ jndiName = baseJndiName;
+ else
+ jndiName = baseJndiName + "/" + iface;
+ }
+ else
+ {
+ boolean is3x = summary.getBeanMD().getJBossMetaData().isEJB3x();
+ switch(ifaceType)
+ {
+ // base-name / (local|remote) - iface
+ case BUSINESS_LOCAL:
+ case BUSINESS_REMOTE:
+ case UNKNOWN:
+ if(iface == null)
+ jndiName = baseJndiName + "/" + ifaceType.toSuffix();
+ else
+ jndiName = baseJndiName + "/" + ifaceType.toSuffix() + "-" + iface;
+ break;
+ case LOCAL_HOME:
+ if(is3x)
+ {
+ // base-name / (local|remote)Home
+ jndiName = baseJndiName + "/" + ifaceType.toSuffix();
+ }
+ else
+ {
+ // Use the bean local jndi name or generated name for ejb2.x local homes
+ jndiName = summary.getBeanMD().determineLocalJndiName();
+ }
+ break;
+ case REMOTE_HOME:
+ if(is3x)
+ {
+ // base-name / (local|remote)Home
+ jndiName = baseJndiName + "/" + ifaceType.toSuffix();
+ }
+ else
+ {
+ // Don't append the iface suffix for ejb2.x homes
+ jndiName = baseJndiName;
+ }
+ break;
+ }
+ }
+ return jndiName;
+ }
+
+}
Deleted: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * 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.metadata.ejb.jboss.jndipolicy.plugins;
-
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
-
-/**
- * A default jndi policy based on the ejb name.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class EjbNameJndiBindingPolicy
- implements DefaultJndiBindingPolicy
-{
-
- /**
- * @return ejb-name + "LocalHome";
- */
- public String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary)
- {
- return summary.getEjbName() + "LocalHome";
- }
- /**
- * @return ejb-name + "Local"
- */
- public String getDefaultLocalJndiName(EjbDeploymentSummary summary)
- {
- return summary.getEjbName() + "Local";
- }
- /**
- * @return ejb-name + "Home"
- */
- public String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary)
- {
- return summary.getEjbName() + "Home";
- }
- /**
- * @return ejb-name + "Remote"
- */
- public String getDefaultRemoteJndiName(EjbDeploymentSummary summary)
- {
- return summary.getEjbName() + "Remote";
- }
- /**
- * @return ejb-name
- */
- public String getJndiName(EjbDeploymentSummary summary)
- {
- return summary.getEjbName();
- }
- /**
- * @return ejb-name + "/" + iface
- */
- public String getJndiName(EjbDeploymentSummary summary, String iface)
- {
- String jndiName = null;
- if(iface == null)
- jndiName = getJndiName(summary);
- else if(KnownInterfaces.isKnownInterface(iface))
- {
- if(KnownInterfaces.HOME.equalsIgnoreCase(iface))
- jndiName = getDefaultRemoteHomeJndiName(summary);
- else if(KnownInterfaces.LOCAL.equalsIgnoreCase(iface))
- jndiName = getDefaultLocalJndiName(summary);
- else if(KnownInterfaces.LOCAL_HOME.equalsIgnoreCase(iface))
- jndiName = getDefaultLocalHomeJndiName(summary);
- else if(KnownInterfaces.REMOTE.equalsIgnoreCase(iface))
- jndiName = getDefaultRemoteJndiName(summary);
- else
- throw new IllegalStateException("Unknown iterface type: "+iface);
- }
- else
- {
- jndiName = summary.getEjbName() + "/" + iface;
- }
- return jndiName;
- }
-
-}
Copied: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java (from rev 73241, projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/EjbNameJndiBindingPolicy.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.ejb.jboss.jndipolicy.plugins;
+
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces.KnownInterfaceType;
+
+/**
+ * A default jndi policy based on the ejb name.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class EjbNameJndiBindingPolicy
+ implements DefaultJndiBindingPolicy
+{
+
+ /**
+ * @return ejb-name + "LocalHome";
+ */
+ public String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary)
+ {
+ return summary.getEjbName() + "LocalHome";
+ }
+ /**
+ * @return ejb-name + "Local"
+ */
+ public String getDefaultLocalJndiName(EjbDeploymentSummary summary)
+ {
+ return summary.getEjbName() + "Local";
+ }
+ /**
+ * @return ejb-name + "Home"
+ */
+ public String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary)
+ {
+ return summary.getEjbName() + "Home";
+ }
+ /**
+ * @return ejb-name + "Remote"
+ */
+ public String getDefaultRemoteJndiName(EjbDeploymentSummary summary)
+ {
+ return summary.getEjbName() + "Remote";
+ }
+ /**
+ * @return ejb-name
+ */
+ public String getJndiName(EjbDeploymentSummary summary)
+ {
+ return summary.getEjbName();
+ }
+ /**
+ * @return ejb-name + "/" + iface
+ */
+ public String getJndiName(EjbDeploymentSummary summary, String iface,
+ KnownInterfaceType ifaceType)
+ {
+ String jndiName = null;
+ if(iface == null)
+ jndiName = getJndiName(summary);
+ else if(KnownInterfaces.isKnownInterface(iface))
+ {
+ if(KnownInterfaces.HOME.equalsIgnoreCase(iface))
+ jndiName = getDefaultRemoteHomeJndiName(summary);
+ else if(KnownInterfaces.LOCAL.equalsIgnoreCase(iface))
+ jndiName = getDefaultLocalJndiName(summary);
+ else if(KnownInterfaces.LOCAL_HOME.equalsIgnoreCase(iface))
+ jndiName = getDefaultLocalHomeJndiName(summary);
+ else if(KnownInterfaces.REMOTE.equalsIgnoreCase(iface))
+ jndiName = getDefaultRemoteJndiName(summary);
+ else
+ throw new IllegalStateException("Unknown iterface type: "+iface);
+ }
+ else
+ {
+ jndiName = summary.getEjbName() + "/" + iface;
+ }
+ return jndiName;
+ }
+
+}
Deleted: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,142 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * 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.metadata.ejb.jboss.jndipolicy.plugins;
-
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
-
-/**
- * Default session bean jndi naming policy
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class SessionJndiBindingPolicy
- implements DefaultJndiBindingPolicy
-{
-
- public String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary)
- {
- JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
- String name = null;
- if(beanMD instanceof JBossSessionBeanMetaData)
- {
- JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
- name = sbeanMD.getLocalHomeJndiName();
- }
- if(name == null)
- {
- name = beanMD.determineLocalJndiName();
- }
- return name;
- }
-
- public String getDefaultLocalJndiName(EjbDeploymentSummary summary)
- {
- JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
- String name = null;
- if(beanMD instanceof JBossSessionBeanMetaData)
- {
- JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
- name = sbeanMD.getLocalJndiName();
- }
- if(name == null)
- {
- name = beanMD.determineLocalJndiName();
- }
- return name;
- }
-
- public String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary)
- {
- JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
- String name = null;
- if(beanMD instanceof JBossSessionBeanMetaData)
- {
- JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
- name = sbeanMD.getHomeJndiName();
- if (name == null)
- name = sbeanMD.getJndiName();
- if(name == null)
- name = sbeanMD.getMappedName();
- if(name == null && sbeanMD.getRemoteBindings() != null && sbeanMD.getRemoteBindings().size() > 0)
- name = sbeanMD.getRemoteBindings().get(0).getJndiName();
- }
- if(name == null)
- {
- name = beanMD.getEjbName() + "Remote";
- }
- return name;
- }
-
- public String getDefaultRemoteJndiName(EjbDeploymentSummary summary)
- {
- JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
- String name = null;
- if(beanMD instanceof JBossSessionBeanMetaData)
- {
- JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
- name = sbeanMD.getJndiName();
- if(name == null)
- name = sbeanMD.getMappedName();
- if(name == null && sbeanMD.getRemoteBindings() != null && sbeanMD.getRemoteBindings().size() > 0)
- name = sbeanMD.getRemoteBindings().get(0).getJndiName();
- }
- if(name == null)
- {
- name = beanMD.getEjbName() + "Remote";
- }
- return name;
- }
-
- public String getJndiName(EjbDeploymentSummary summary)
- {
- JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
- String name = null;
- if(beanMD instanceof JBossSessionBeanMetaData)
- {
- JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
- name = sbeanMD.getHomeJndiName();
- if (name == null)
- name = sbeanMD.getJndiName();
- if(name == null)
- name = sbeanMD.getMappedName();
- if(name == null && sbeanMD.getRemoteBindings() != null && sbeanMD.getRemoteBindings().size() > 0)
- name = sbeanMD.getRemoteBindings().get(0).getJndiName();
- }
- if(name == null)
- {
- name = beanMD.getEjbName();
- }
- return name;
- }
- /**
- * @return ejb-name + "/" + iface
- */
- public String getJndiName(EjbDeploymentSummary summary, String iface)
- {
- return summary.getEjbName() + "/" + iface;
- }
-
-}
Copied: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java (from rev 73241, projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/SessionJndiBindingPolicy.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.ejb.jboss.jndipolicy.plugins;
+
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces.KnownInterfaceType;
+
+/**
+ * Default session bean jndi naming policy
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class SessionJndiBindingPolicy
+ implements DefaultJndiBindingPolicy
+{
+
+ public String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary)
+ {
+ JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
+ String name = null;
+ if(beanMD instanceof JBossSessionBeanMetaData)
+ {
+ JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
+ name = sbeanMD.getLocalHomeJndiName();
+ }
+ if(name == null)
+ {
+ name = beanMD.determineLocalJndiName();
+ }
+ return name;
+ }
+
+ public String getDefaultLocalJndiName(EjbDeploymentSummary summary)
+ {
+ JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
+ String name = null;
+ if(beanMD instanceof JBossSessionBeanMetaData)
+ {
+ JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
+ name = sbeanMD.getLocalJndiName();
+ }
+ if(name == null)
+ {
+ name = beanMD.determineLocalJndiName();
+ }
+ return name;
+ }
+
+ public String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary)
+ {
+ JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
+ String name = null;
+ if(beanMD instanceof JBossSessionBeanMetaData)
+ {
+ JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
+ name = sbeanMD.getHomeJndiName();
+ if (name == null)
+ name = sbeanMD.getJndiName();
+ if(name == null)
+ name = sbeanMD.getMappedName();
+ if(name == null && sbeanMD.getRemoteBindings() != null && sbeanMD.getRemoteBindings().size() > 0)
+ name = sbeanMD.getRemoteBindings().get(0).getJndiName();
+ }
+ if(name == null)
+ {
+ name = beanMD.getEjbName() + "Remote";
+ }
+ return name;
+ }
+
+ public String getDefaultRemoteJndiName(EjbDeploymentSummary summary)
+ {
+ JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
+ String name = null;
+ if(beanMD instanceof JBossSessionBeanMetaData)
+ {
+ JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
+ name = sbeanMD.getJndiName();
+ if(name == null)
+ name = sbeanMD.getMappedName();
+ if(name == null && sbeanMD.getRemoteBindings() != null && sbeanMD.getRemoteBindings().size() > 0)
+ name = sbeanMD.getRemoteBindings().get(0).getJndiName();
+ }
+ if(name == null)
+ {
+ name = beanMD.getEjbName() + "Remote";
+ }
+ return name;
+ }
+
+ public String getJndiName(EjbDeploymentSummary summary)
+ {
+ JBossEnterpriseBeanMetaData beanMD = summary.getBeanMD();
+ String name = null;
+ if(beanMD instanceof JBossSessionBeanMetaData)
+ {
+ JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
+ name = sbeanMD.getHomeJndiName();
+ if (name == null)
+ name = sbeanMD.getJndiName();
+ if(name == null)
+ name = sbeanMD.getMappedName();
+ if(name == null && sbeanMD.getRemoteBindings() != null && sbeanMD.getRemoteBindings().size() > 0)
+ name = sbeanMD.getRemoteBindings().get(0).getJndiName();
+ }
+ if(name == null)
+ {
+ name = beanMD.getEjbName();
+ }
+ return name;
+ }
+ /**
+ * @return ejb-name + "/" + iface
+ */
+ public String getJndiName(EjbDeploymentSummary summary, String iface,
+ KnownInterfaceType ifaceType)
+ {
+ return summary.getEjbName() + "/" + iface;
+ }
+
+}
Deleted: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * 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.metadata.ejb.jboss.jndipolicy.spi;
-
-/**
- * A jndi name policy spi for obtaining jndi names not specified in metadata.
- *
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public interface DefaultJndiBindingPolicy
-{
- /**
- * Returns the JNDI name that should be assigned to this deployment
- * based on the information contained in the specified summary
- *
- * @param summary
- * @return
- */
- String getJndiName(EjbDeploymentSummary summary);
- /**
- *
- * @param summary
- * @param iface
- * @return
- */
- String getJndiName(EjbDeploymentSummary summary, String iface);
-
- String getDefaultRemoteJndiName(EjbDeploymentSummary summary);
-
- String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary);
-
- String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary);
-
- String getDefaultLocalJndiName(EjbDeploymentSummary summary);
-
-}
Copied: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java (from rev 73241, projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DefaultJndiBindingPolicy.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.ejb.jboss.jndipolicy.spi;
+
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces.KnownInterfaceType;
+
+/**
+ * A jndi name policy spi for obtaining jndi names not specified in metadata.
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DefaultJndiBindingPolicy
+{
+ /**
+ * Returns the JNDI name that should be assigned to this deployment
+ * based on the information contained in the specified summary
+ *
+ * @param summary
+ * @return
+ */
+ String getJndiName(EjbDeploymentSummary summary);
+ /**
+ * Get the jndi name to use as the reference link target and proxy binding
+ * location for a given ejb interface.
+ *
+ * @param summary - the deployment summary information for the ejb in question.
+ * @param iface - the fully qualified name of the interface, may be null.
+ * @param ifaceType - the classification of iface to one of the known
+ * ejb interface types
+ * @return
+ */
+ String getJndiName(EjbDeploymentSummary summary, String iface, KnownInterfaceType ifaceType);
+
+ String getDefaultRemoteJndiName(EjbDeploymentSummary summary);
+
+ String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary);
+
+ String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary);
+
+ String getDefaultLocalJndiName(EjbDeploymentSummary summary);
+
+}
Deleted: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * 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.metadata.ejb.jboss.jndipolicy.spi;
-
-/**
- * Constants for known interfaces that may be passed to
- * {@link DefaultJndiBindingPolicy#getJndiName(EjbDeploymentSummary, String)}
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public final class KnownInterfaces
-{
- public static final String LOCAL = "local";
- public static final String LOCAL_HOME = "localHome";
- public static final String REMOTE = "remote";
- public static final String HOME = "remoteHome";
-
- /**
- * Is iface one of the KnownInterfaces
- * @param iface - the interface name to compare in a case insensitive manner.
- * @return true if iface is one of the KnownInterfaces constants, false otherwise.
- */
- public static boolean isKnownInterface(String iface)
- {
- boolean isKnownInterface = KnownInterfaces.HOME.equalsIgnoreCase(iface)
- || KnownInterfaces.LOCAL.equalsIgnoreCase(iface)
- || KnownInterfaces.LOCAL_HOME.equalsIgnoreCase(iface)
- || KnownInterfaces.REMOTE.equalsIgnoreCase(iface)
- ;
- return isKnownInterface;
- }
-}
Copied: projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java (from rev 73241, projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/KnownInterfaces.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.ejb.jboss.jndipolicy.spi;
+
+/**
+ * Constants for known interfaces that may be passed to
+ * {@link DefaultJndiBindingPolicy#getJndiName(EjbDeploymentSummary, String)}
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public final class KnownInterfaces
+{
+ /**
+ * Enums for the standard types of ejb interfaces
+ */
+ public enum KnownInterfaceType {
+ BUSINESS_LOCAL(KnownInterfaces.LOCAL),
+ BUSINESS_REMOTE(KnownInterfaces.REMOTE),
+ LOCAL_HOME(KnownInterfaces.LOCAL_HOME),
+ REMOTE_HOME(KnownInterfaces.HOME),
+ UNKNOWN(KnownInterfaces.UNKNOWN);
+
+ /**
+ * Get the preferred jndi binding suffix
+ * @return the preferred jndi binding suffix for the interface type
+ */
+ public String toSuffix()
+ {
+ return suffix;
+ }
+
+ private final String suffix;
+ KnownInterfaceType(String suffix)
+ {
+ this.suffix = suffix;
+ }
+ }
+ public static final String LOCAL = "local";
+ public static final String LOCAL_HOME = "localHome";
+ public static final String REMOTE = "remote";
+ public static final String HOME = "remoteHome";
+ public static final String UNKNOWN = "unknown";
+
+ /**
+ * Is iface one of the KnownInterfaces
+ * @param iface - the interface name to compare in a case insensitive manner.
+ * @return true if iface is one of the KnownInterfaces constants, false otherwise.
+ */
+ public static boolean isKnownInterface(String iface)
+ {
+ boolean isKnownInterface = KnownInterfaces.HOME.equalsIgnoreCase(iface)
+ || KnownInterfaces.LOCAL.equalsIgnoreCase(iface)
+ || KnownInterfaces.LOCAL_HOME.equalsIgnoreCase(iface)
+ || KnownInterfaces.REMOTE.equalsIgnoreCase(iface)
+ ;
+ return isKnownInterface;
+ }
+ /**
+ * Utility method that compares iface to one of the KnownInterfaces constants
+ * and returns the corresponding enum.
+ * @param iface - a
+ * @return a KnownInterfaceType
+ */
+ public static KnownInterfaceType classifyInterface(String iface)
+ {
+ KnownInterfaceType ifaceType = KnownInterfaceType.UNKNOWN;
+ if(KnownInterfaces.HOME.equalsIgnoreCase(iface))
+ ifaceType = KnownInterfaceType.REMOTE_HOME;
+ else if(KnownInterfaces.LOCAL.equalsIgnoreCase(iface))
+ ifaceType = KnownInterfaceType.BUSINESS_LOCAL;
+ else if(KnownInterfaces.LOCAL_HOME.equalsIgnoreCase(iface))
+ ifaceType = KnownInterfaceType.LOCAL_HOME;
+ else if(KnownInterfaces.REMOTE.equalsIgnoreCase(iface))
+ ifaceType = KnownInterfaceType.BUSINESS_REMOTE;
+ return ifaceType;
+ }
+}
Deleted: projects/metadata/tags/1.0.0.Beta15/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java 2008-05-09 20:39:55 UTC (rev 73237)
+++ projects/metadata/tags/1.0.0.Beta15/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -1,248 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * 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.test.metadata.ejb;
-
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.EjbNameJndiBindingPolicy;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
-import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
-import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
-
-import junit.framework.TestCase;
-
-/**
- * Tests of the JBossEnterpriseBeanMetaData.determineResolvedJndiName behavior
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class ResolvedJndiNameUnitTestCase
- extends TestCase
-{
-
- public void testResolvedJndiName()
- {
- JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
- String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
- assertEquals("testResolvedJndiName-jndi-name", resolvedJndiName);
- }
- public void testResolvedJndiNameWithMappedName()
- {
- JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
- beanMD.setMappedName("testResolvedJndiName-mapped-name");
- String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
- assertEquals("testResolvedJndiName-mapped-name", resolvedJndiName);
- }
- public void testResolvedJndiNames()
- {
- JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
- String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
- assertEquals("testResolvedJndiNames-jndi-name", resolvedJndiName);
- String resolvedJndiNameRemote = beanMD.determineResolvedJndiName(KnownInterfaces.REMOTE, null);
- assertEquals("testResolvedJndiNames-jndi-name/remote", resolvedJndiNameRemote);
- String resolvedJndiNameHome = beanMD.determineResolvedJndiName(KnownInterfaces.HOME, null);
- assertEquals("testResolvedJndiNames-jndi-name/remoteHome", resolvedJndiNameHome);
- String resolvedJndiNameLocal = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL, null);
- assertEquals("testResolvedJndiNames-jndi-name/local", resolvedJndiNameLocal);
- String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME, null);
- assertEquals("testResolvedJndiNames-jndi-name/localHome", resolvedJndiNameLocalHome);
- String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", null);
- assertEquals("testResolvedJndiNames-jndi-name/org.jboss.test.some.IFace", resolvedJndiNameIface);
- }
- /**
- * JBMETA-36, JBMETA-37
- */
- public void testResolvedJndiNamesWithKnownIfaces()
- {
- JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
- JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
- sbeanMD.setLocal("org.jboss.ifaces.LocalIF");
- sbeanMD.setLocalHome("org.jboss.ifaces.LocalHomeIF");
- sbeanMD.setHome("org.jboss.ifaces.HomeIF");
- sbeanMD.setRemote("org.jboss.ifaces.RemoteIF");
- BusinessLocalsMetaData locals = new BusinessLocalsMetaData();
- locals.add("org.jboss.ifaces.LocalIF");
- locals.add("org.jboss.ifaces.LocalIF2");
- sbeanMD.setBusinessLocals(locals);
- BusinessRemotesMetaData remotes = new BusinessRemotesMetaData();
- remotes.add("org.jboss.ifaces.RemoteIF");
- remotes.add("org.jboss.ifaces.RemoteIF2");
- sbeanMD.setBusinessRemotes(remotes);
-
- String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name", resolvedJndiName);
- String resolvedJndiNameRemote = beanMD.determineResolvedJndiName("org.jboss.ifaces.RemoteIF", null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/remote-org.jboss.ifaces.RemoteIF", resolvedJndiNameRemote);
- String resolvedJndiNameRemote2 = beanMD.determineResolvedJndiName("org.jboss.ifaces.RemoteIF2", null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/remote-org.jboss.ifaces.RemoteIF2", resolvedJndiNameRemote2);
- String resolvedJndiNameHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.HomeIF", null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/remoteHome", resolvedJndiNameHome);
- String resolvedJndiNameLocal = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalIF", null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/local-org.jboss.ifaces.LocalIF", resolvedJndiNameLocal);
- String resolvedJndiNameLocal2 = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalIF2", null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/local-org.jboss.ifaces.LocalIF2", resolvedJndiNameLocal2);
- String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalHomeIF", null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/localHome", resolvedJndiNameLocalHome);
- String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/org.jboss.test.some.IFace", resolvedJndiNameIface);
- }
- public void testResolvedJndiNamesWithKnownIfaces2x()
- {
- JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
- beanMD.getJBossMetaData().setVersion("2.1");
- JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
- sbeanMD.setLocal("org.jboss.ifaces.LocalIF");
- sbeanMD.setLocalHome("org.jboss.ifaces.LocalHomeIF");
- sbeanMD.setHome("org.jboss.ifaces.HomeIF");
- sbeanMD.setRemote("org.jboss.ifaces.RemoteIF");
-
-
- String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces2x-jndi-name", resolvedJndiName);
- String resolvedJndiNameHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.HomeIF", null);
- assertEquals("testResolvedJndiNamesWithKnownIfaces2x-jndi-name", resolvedJndiNameHome);
- String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalHomeIF", null);
- assertEquals(sbeanMD.determineLocalJndiName(), resolvedJndiNameLocalHome);
- }
-
- public void testResolvedJndiNamesWithKnownIfacesEntity()
- {
- JBossEnterpriseBeanMetaData beanMD = getEntityMetaData();
- JBossEntityBeanMetaData sbeanMD = (JBossEntityBeanMetaData) beanMD;
- sbeanMD.setLocal("org.jboss.ifaces.LocalIF");
- sbeanMD.setLocalHome("org.jboss.ifaces.LocalHomeIF");
- sbeanMD.setHome("org.jboss.ifaces.HomeIF");
- sbeanMD.setRemote("org.jboss.ifaces.RemoteIF");
-
- String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
- assertEquals("testResolvedJndiNamesWithKnownIfacesEntity-jndi-name", resolvedJndiName);
- String resolvedJndiNameHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.HomeIF", null);
- assertEquals("testResolvedJndiNamesWithKnownIfacesEntity-jndi-name/remoteHome", resolvedJndiNameHome);
- String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalHomeIF", null);
- assertEquals("testResolvedJndiNamesWithKnownIfacesEntity-jndi-name/localHome", resolvedJndiNameLocalHome);
- String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", null);
- assertEquals("testResolvedJndiNamesWithKnownIfacesEntity-jndi-name/org.jboss.test.some.IFace", resolvedJndiNameIface);
- }
-
- /**
- * Test the determineResolvedJndiName with a jndiBindingPolicy on the
- * JBossEnterpriseBeanMetaData
- *
- */
- public void testResolvedJndiNamesWithMDPolicy()
- {
- JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
- beanMD.setJndiBindingPolicy(EjbNameJndiBindingPolicy.class.getName());
- String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
- assertEquals("testResolvedJndiNamesWithMDPolicy-ejb", resolvedJndiName);
- String resolvedJndiNameRemote = beanMD.determineResolvedJndiName(KnownInterfaces.REMOTE, null);
- assertEquals("testResolvedJndiNamesWithMDPolicy-ejbRemote", resolvedJndiNameRemote);
- String resolvedJndiNameHome = beanMD.determineResolvedJndiName(KnownInterfaces.HOME, null);
- assertEquals("testResolvedJndiNamesWithMDPolicy-ejbHome", resolvedJndiNameHome);
- String resolvedJndiNameLocal = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL, null);
- assertEquals("testResolvedJndiNamesWithMDPolicy-ejbLocal", resolvedJndiNameLocal);
- String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME, null);
- assertEquals("testResolvedJndiNamesWithMDPolicy-ejbLocalHome", resolvedJndiNameLocalHome);
- String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", null);
- assertEquals("testResolvedJndiNamesWithMDPolicy-ejb/org.jboss.test.some.IFace", resolvedJndiNameIface);
- }
- /**
- * Test the determineResolvedJndiName with a jndiBindingPolicy passed into
- * determineResolvedJndiName
- *
- */
- public void testResolvedJndiNamesWithExternalPolicy()
- {
- JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
- EjbNameJndiBindingPolicy policy = new EjbNameJndiBindingPolicy();
- String resolvedJndiName = beanMD.determineResolvedJndiName(null, policy);
- assertEquals("testResolvedJndiNamesWithExternalPolicy-ejb", resolvedJndiName);
- String resolvedJndiNameRemote = beanMD.determineResolvedJndiName(KnownInterfaces.REMOTE, policy);
- assertEquals("testResolvedJndiNamesWithExternalPolicy-ejbRemote", resolvedJndiNameRemote);
- String resolvedJndiNameHome = beanMD.determineResolvedJndiName(KnownInterfaces.HOME, policy);
- assertEquals("testResolvedJndiNamesWithExternalPolicy-ejbHome", resolvedJndiNameHome);
- String resolvedJndiNameLocal = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL, policy);
- assertEquals("testResolvedJndiNamesWithExternalPolicy-ejbLocal", resolvedJndiNameLocal);
- String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME, policy);
- assertEquals("testResolvedJndiNamesWithExternalPolicy-ejbLocalHome", resolvedJndiNameLocalHome);
- String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", policy);
- assertEquals("testResolvedJndiNamesWithExternalPolicy-ejb/org.jboss.test.some.IFace", resolvedJndiNameIface);
- }
-
- /**
- * Creates a JBossSessionBeanMetaData with associated JBossMetaData with:
- * ejbName = getName() + "-ejb"
- * ejbClass = "org.jboss.ejb."+ getName()
- * jndiName = getName() + "-jndi-name"
- * @return JBossSessionBeanMetaData
- */
- protected JBossEnterpriseBeanMetaData getEjbMetaData()
- {
- String name = super.getName();
- JBossMetaData jbossMetaData = new JBossMetaData();
- DeploymentSummary deploymentSummary = new DeploymentSummary();
- deploymentSummary.setDeploymentName(name);
- deploymentSummary.setDeploymentScopeBaseName("base");
- deploymentSummary.setLoader(getClass().getClassLoader());
- jbossMetaData.setDeploymentSummary(deploymentSummary);
- JBossSessionBeanMetaData sbeanMD = new JBossSessionBeanMetaData();
- sbeanMD.setEjbName(name+"-ejb");
- sbeanMD.setEjbClass("org.jboss.ejb."+name);
- sbeanMD.setJndiName(name+"-jndi-name");
- JBossEnterpriseBeansMetaData beans = new JBossEnterpriseBeansMetaData();
- beans.setEjbJarMetaData(jbossMetaData);
- beans.add(sbeanMD);
- jbossMetaData.setEnterpriseBeans(beans);
- return sbeanMD;
- }
- /**
- * Creates a JBossEntityBeanMetaData with associated JBossMetaData with:
- * ejbName = getName() + "-ejb"
- * ejbClass = "org.jboss.ejb."+ getName()
- * jndiName = getName() + "-jndi-name"
- * @return JBossEntityBeanMetaData
- */
- protected JBossEnterpriseBeanMetaData getEntityMetaData()
- {
- String name = super.getName();
- JBossMetaData jbossMetaData = new JBossMetaData();
- DeploymentSummary deploymentSummary = new DeploymentSummary();
- deploymentSummary.setDeploymentName(name);
- deploymentSummary.setDeploymentScopeBaseName("base");
- deploymentSummary.setLoader(getClass().getClassLoader());
- jbossMetaData.setDeploymentSummary(deploymentSummary);
- JBossEntityBeanMetaData sbeanMD = new JBossEntityBeanMetaData();
- sbeanMD.setEjbName(name+"-ejb");
- sbeanMD.setEjbClass("org.jboss.ejb."+name);
- sbeanMD.setJndiName(name+"-jndi-name");
- JBossEnterpriseBeansMetaData beans = new JBossEnterpriseBeansMetaData();
- beans.setEjbJarMetaData(jbossMetaData);
- beans.add(sbeanMD);
- jbossMetaData.setEnterpriseBeans(beans);
- return sbeanMD;
- }
-}
Copied: projects/metadata/tags/1.0.0.Beta15/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java (from rev 73241, projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java)
===================================================================
--- projects/metadata/tags/1.0.0.Beta15/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java (rev 0)
+++ projects/metadata/tags/1.0.0.Beta15/src/test/java/org/jboss/test/metadata/ejb/ResolvedJndiNameUnitTestCase.java 2008-05-09 21:58:18 UTC (rev 73243)
@@ -0,0 +1,251 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.test.metadata.ejb;
+
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.EjbNameJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests of the JBossEnterpriseBeanMetaData.determineResolvedJndiName behavior
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ResolvedJndiNameUnitTestCase
+ extends TestCase
+{
+
+ public void testResolvedJndiName()
+ {
+ JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
+ String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
+ assertEquals("testResolvedJndiName-jndi-name", resolvedJndiName);
+ }
+ public void testResolvedJndiNameWithMappedName()
+ {
+ JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
+ beanMD.setMappedName("testResolvedJndiName-mapped-name");
+ String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
+ assertEquals("testResolvedJndiName-mapped-name", resolvedJndiName);
+ }
+ public void testResolvedJndiNames()
+ {
+ JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
+ String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
+ assertEquals("testResolvedJndiNames-jndi-name", resolvedJndiName);
+ String resolvedJndiNameRemote = beanMD.determineResolvedJndiName(KnownInterfaces.REMOTE, null);
+ assertEquals("testResolvedJndiNames-jndi-name/remote", resolvedJndiNameRemote);
+ String resolvedJndiNameHome = beanMD.determineResolvedJndiName(KnownInterfaces.HOME, null);
+ assertEquals("testResolvedJndiNames-jndi-name/remoteHome", resolvedJndiNameHome);
+ String resolvedJndiNameLocal = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL, null);
+ assertEquals("testResolvedJndiNames-jndi-name/local", resolvedJndiNameLocal);
+ String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME, null);
+ assertEquals("testResolvedJndiNames-jndi-name/localHome", resolvedJndiNameLocalHome);
+ String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", null);
+ assertEquals("testResolvedJndiNames-jndi-name/org.jboss.test.some.IFace", resolvedJndiNameIface);
+ }
+ /**
+ * JBMETA-36, JBMETA-37
+ */
+ public void testResolvedJndiNamesWithKnownIfaces()
+ {
+ JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
+ JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
+ sbeanMD.setLocal("org.jboss.ifaces.LocalIF");
+ sbeanMD.setLocalHome("org.jboss.ifaces.LocalHomeIF");
+ sbeanMD.setHome("org.jboss.ifaces.HomeIF");
+ sbeanMD.setRemote("org.jboss.ifaces.RemoteIF");
+ BusinessLocalsMetaData locals = new BusinessLocalsMetaData();
+ locals.add("org.jboss.ifaces.LocalIF");
+ locals.add("org.jboss.ifaces.LocalIF2");
+ sbeanMD.setBusinessLocals(locals);
+ BusinessRemotesMetaData remotes = new BusinessRemotesMetaData();
+ remotes.add("org.jboss.ifaces.RemoteIF");
+ remotes.add("org.jboss.ifaces.RemoteIF2");
+ sbeanMD.setBusinessRemotes(remotes);
+
+ String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name", resolvedJndiName);
+ String resolvedJndiNameRemote = beanMD.determineResolvedJndiName("org.jboss.ifaces.RemoteIF", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/remote-org.jboss.ifaces.RemoteIF", resolvedJndiNameRemote);
+ String resolvedJndiNameRemote2 = beanMD.determineResolvedJndiName("org.jboss.ifaces.RemoteIF2", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/remote-org.jboss.ifaces.RemoteIF2", resolvedJndiNameRemote2);
+ String resolvedJndiNameHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.HomeIF", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/remoteHome", resolvedJndiNameHome);
+ String resolvedJndiNameLocal = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalIF", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/local-org.jboss.ifaces.LocalIF", resolvedJndiNameLocal);
+ String resolvedJndiNameLocal2 = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalIF2", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/local-org.jboss.ifaces.LocalIF2", resolvedJndiNameLocal2);
+ String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalHomeIF", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/localHome", resolvedJndiNameLocalHome);
+ String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces-jndi-name/org.jboss.test.some.IFace", resolvedJndiNameIface);
+ }
+ public void testResolvedJndiNamesWithKnownIfaces2x()
+ {
+ JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
+ beanMD.getJBossMetaData().setEjbVersion("2.1");
+
+ JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
+ sbeanMD.setLocal("org.jboss.ifaces.LocalIF");
+ sbeanMD.setLocalHome("org.jboss.ifaces.LocalHomeIF");
+ sbeanMD.setHome("org.jboss.ifaces.HomeIF");
+ sbeanMD.setRemote("org.jboss.ifaces.RemoteIF");
+
+
+ String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces2x-jndi-name", resolvedJndiName);
+ String resolvedJndiNameHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.HomeIF", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfaces2x-jndi-name", resolvedJndiNameHome);
+ String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalHomeIF", null);
+ assertEquals(sbeanMD.determineLocalJndiName(), resolvedJndiNameLocalHome);
+ }
+
+ public void testResolvedJndiNamesWithKnownIfacesEntity()
+ {
+ JBossEnterpriseBeanMetaData beanMD = getEntityMetaData();
+ JBossEntityBeanMetaData sbeanMD = (JBossEntityBeanMetaData) beanMD;
+ sbeanMD.setLocal("org.jboss.ifaces.LocalIF");
+ sbeanMD.setLocalHome("org.jboss.ifaces.LocalHomeIF");
+ sbeanMD.setHome("org.jboss.ifaces.HomeIF");
+ sbeanMD.setRemote("org.jboss.ifaces.RemoteIF");
+
+ String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
+ assertEquals("testResolvedJndiNamesWithKnownIfacesEntity-jndi-name", resolvedJndiName);
+ String resolvedJndiNameHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.HomeIF", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfacesEntity-jndi-name/remoteHome", resolvedJndiNameHome);
+ String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName("org.jboss.ifaces.LocalHomeIF", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfacesEntity-jndi-name/localHome", resolvedJndiNameLocalHome);
+ String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", null);
+ assertEquals("testResolvedJndiNamesWithKnownIfacesEntity-jndi-name/org.jboss.test.some.IFace", resolvedJndiNameIface);
+ }
+
+ /**
+ * Test the determineResolvedJndiName with a jndiBindingPolicy on the
+ * JBossEnterpriseBeanMetaData
+ *
+ */
+ public void testResolvedJndiNamesWithMDPolicy()
+ {
+ JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
+ beanMD.setJndiBindingPolicy(EjbNameJndiBindingPolicy.class.getName());
+ String resolvedJndiName = beanMD.determineResolvedJndiName(null, null);
+ assertEquals("testResolvedJndiNamesWithMDPolicy-ejb", resolvedJndiName);
+ String resolvedJndiNameRemote = beanMD.determineResolvedJndiName(KnownInterfaces.REMOTE, null);
+ assertEquals("testResolvedJndiNamesWithMDPolicy-ejbRemote", resolvedJndiNameRemote);
+ String resolvedJndiNameHome = beanMD.determineResolvedJndiName(KnownInterfaces.HOME, null);
+ assertEquals("testResolvedJndiNamesWithMDPolicy-ejbHome", resolvedJndiNameHome);
+ String resolvedJndiNameLocal = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL, null);
+ assertEquals("testResolvedJndiNamesWithMDPolicy-ejbLocal", resolvedJndiNameLocal);
+ String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME, null);
+ assertEquals("testResolvedJndiNamesWithMDPolicy-ejbLocalHome", resolvedJndiNameLocalHome);
+ String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", null);
+ assertEquals("testResolvedJndiNamesWithMDPolicy-ejb/org.jboss.test.some.IFace", resolvedJndiNameIface);
+ }
+ /**
+ * Test the determineResolvedJndiName with a jndiBindingPolicy passed into
+ * determineResolvedJndiName
+ *
+ */
+ public void testResolvedJndiNamesWithExternalPolicy()
+ {
+ JBossEnterpriseBeanMetaData beanMD = getEjbMetaData();
+ EjbNameJndiBindingPolicy policy = new EjbNameJndiBindingPolicy();
+ String resolvedJndiName = beanMD.determineResolvedJndiName(null, policy);
+ assertEquals("testResolvedJndiNamesWithExternalPolicy-ejb", resolvedJndiName);
+ String resolvedJndiNameRemote = beanMD.determineResolvedJndiName(KnownInterfaces.REMOTE, policy);
+ assertEquals("testResolvedJndiNamesWithExternalPolicy-ejbRemote", resolvedJndiNameRemote);
+ String resolvedJndiNameHome = beanMD.determineResolvedJndiName(KnownInterfaces.HOME, policy);
+ assertEquals("testResolvedJndiNamesWithExternalPolicy-ejbHome", resolvedJndiNameHome);
+ String resolvedJndiNameLocal = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL, policy);
+ assertEquals("testResolvedJndiNamesWithExternalPolicy-ejbLocal", resolvedJndiNameLocal);
+ String resolvedJndiNameLocalHome = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME, policy);
+ assertEquals("testResolvedJndiNamesWithExternalPolicy-ejbLocalHome", resolvedJndiNameLocalHome);
+ String resolvedJndiNameIface = beanMD.determineResolvedJndiName("org.jboss.test.some.IFace", policy);
+ assertEquals("testResolvedJndiNamesWithExternalPolicy-ejb/org.jboss.test.some.IFace", resolvedJndiNameIface);
+ }
+
+ /**
+ * Creates a JBossSessionBeanMetaData with associated JBossMetaData with:
+ * ejbName = getName() + "-ejb"
+ * ejbClass = "org.jboss.ejb."+ getName()
+ * jndiName = getName() + "-jndi-name"
+ * @return JBossSessionBeanMetaData
+ */
+ protected JBossEnterpriseBeanMetaData getEjbMetaData()
+ {
+ String name = super.getName();
+ JBossMetaData jbossMetaData = new JBossMetaData();
+ jbossMetaData.setEjbVersion("3.0");
+ DeploymentSummary deploymentSummary = new DeploymentSummary();
+ deploymentSummary.setDeploymentName(name);
+ deploymentSummary.setDeploymentScopeBaseName("base");
+ deploymentSummary.setLoader(getClass().getClassLoader());
+ jbossMetaData.setDeploymentSummary(deploymentSummary);
+ JBossSessionBeanMetaData sbeanMD = new JBossSessionBeanMetaData();
+ sbeanMD.setEjbName(name+"-ejb");
+ sbeanMD.setEjbClass("org.jboss.ejb."+name);
+ sbeanMD.setJndiName(name+"-jndi-name");
+ JBossEnterpriseBeansMetaData beans = new JBossEnterpriseBeansMetaData();
+ beans.setEjbJarMetaData(jbossMetaData);
+ beans.add(sbeanMD);
+ jbossMetaData.setEnterpriseBeans(beans);
+ return sbeanMD;
+ }
+ /**
+ * Creates a JBossEntityBeanMetaData with associated JBossMetaData with:
+ * ejbName = getName() + "-ejb"
+ * ejbClass = "org.jboss.ejb."+ getName()
+ * jndiName = getName() + "-jndi-name"
+ * @return JBossEntityBeanMetaData
+ */
+ protected JBossEnterpriseBeanMetaData getEntityMetaData()
+ {
+ String name = super.getName();
+ JBossMetaData jbossMetaData = new JBossMetaData();
+ jbossMetaData.setEjbVersion("3.0");
+ DeploymentSummary deploymentSummary = new DeploymentSummary();
+ deploymentSummary.setDeploymentName(name);
+ deploymentSummary.setDeploymentScopeBaseName("base");
+ deploymentSummary.setLoader(getClass().getClassLoader());
+ jbossMetaData.setDeploymentSummary(deploymentSummary);
+ JBossEntityBeanMetaData sbeanMD = new JBossEntityBeanMetaData();
+ sbeanMD.setEjbName(name+"-ejb");
+ sbeanMD.setEjbClass("org.jboss.ejb."+name);
+ sbeanMD.setJndiName(name+"-jndi-name");
+ JBossEnterpriseBeansMetaData beans = new JBossEnterpriseBeansMetaData();
+ beans.setEjbJarMetaData(jbossMetaData);
+ beans.add(sbeanMD);
+ jbossMetaData.setEnterpriseBeans(beans);
+ return sbeanMD;
+ }
+}
More information about the jboss-cvs-commits
mailing list