[jboss-cvs] JBossAS SVN: r94389 - in projects/ejb3/trunk/metadata-impl: src/main/java/org/jboss/ejb3/metadata/impl/javaee and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 5 15:27:36 EDT 2009


Author: jaikiran
Date: 2009-10-05 15:27:36 -0400 (Mon, 05 Oct 2009)
New Revision: 94389

Added:
   projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/MessageDestinationRefMetadataImpl.java
   projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/RemoveMethodMetadataImpl.java
   projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/SecurityRoleRefMetadataImpl.java
   projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/SessionBeanMetadataImpl.java
Modified:
   projects/ejb3/trunk/metadata-impl/pom.xml
Log:
EJBTHREE-1932 Initial implementation of the ejb3-metadata-spi and also enforced JDK1.6 in the metadata-impl pom

Modified: projects/ejb3/trunk/metadata-impl/pom.xml
===================================================================
--- projects/ejb3/trunk/metadata-impl/pom.xml	2009-10-05 19:25:29 UTC (rev 94388)
+++ projects/ejb3/trunk/metadata-impl/pom.xml	2009-10-05 19:27:36 UTC (rev 94389)
@@ -18,6 +18,30 @@
     JBoss EJB3 Metadata Implementation based on org.jboss.metadata:metadata-ejb.
   </description>
   
+    <build>
+        <plugins>
+            <!--  Enforce JDK6 -->
+            <plugin>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                  <execution>
+                    <id>enforce-jdk6</id>
+                    <goals>
+                      <goal>enforce</goal>
+                    </goals>
+                    <configuration>
+                      <rules>
+                        <requireJavaVersion>
+                            <version>1.6</version>
+                        </requireJavaVersion> 
+                      </rules>
+                    </configuration>
+                  </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+      
   <dependencies>
     
     <dependency>

Added: projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/MessageDestinationRefMetadataImpl.java
===================================================================
--- projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/MessageDestinationRefMetadataImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/MessageDestinationRefMetadataImpl.java	2009-10-05 19:27:36 UTC (rev 94389)
@@ -0,0 +1,255 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.ejb3.metadata.impl.javaee;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.ejb3.metadata.spi.javaee.DescriptionMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.InjectionTargetMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.MessageDestinationUsageType;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+
+/**
+ * MessageDestinationRefMetadataImpl
+ * 
+ * Represents the metadata for a message-destination-ref
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class MessageDestinationRefMetadataImpl extends IdMetadataImpl implements MessageDestinationRefMetaData
+{
+
+   /** 
+    * The {@link MessageDestinationReferenceMetaData} from which this {@link MessageDestinationRefMetadataImpl}
+    * was constructed
+    */
+   private MessageDestinationReferenceMetaData delegate;
+
+   /**
+    * Injection targets
+    */
+   private List<InjectionTargetMetaData> injectionTargets;
+
+   /**
+    * mapped-name
+    */
+   private String mappedName;
+
+   /**
+    * Message destination link
+    */
+   private String messageDestinationLink;
+
+   /**
+    * Name of the message destination reference
+    */
+   private String messageDestinationRefName;
+
+   /**
+    * Fully qualified classname of the interface of 
+    * the message destination type
+    */
+   private String messageDestinationType;
+
+   /**
+    * message destination usage
+    */
+   private MessageDestinationUsageType messageDestUsage;
+
+   /**
+    * Constructs a {@link MessageDestinationRefMetadataImpl} from a {@link MessageDestinationReferenceMetaData}
+    * 
+    * @param messageDestRef
+    * @throws NullPointerException If the passed <code>messageDestRef</code> is null
+    */
+   public MessageDestinationRefMetadataImpl(MessageDestinationReferenceMetaData messageDestRef)
+   {
+      super(messageDestRef.getId());
+      this.initialize(messageDestRef);
+   }
+
+   /**
+    * Initializes this {@link MessageDestinationRefMetadataImpl} from the state in
+    * <code>messageDestRef</code>
+    * 
+    * @param messageDestRef
+    * @throws NullPointerException If the passed <code>messageDestRef</code> is null
+    */
+   private void initialize(MessageDestinationReferenceMetaData messageDestRef)
+   {
+      // set the delegate
+      this.delegate = messageDestRef;
+
+      this.mappedName = this.delegate.getMappedName();
+      this.messageDestinationLink = this.delegate.getLink();
+      this.messageDestinationRefName = this.delegate.getMessageDestinationRefName();
+      this.messageDestinationType = this.delegate.getType();
+
+      // message destination usage
+      org.jboss.metadata.javaee.spec.MessageDestinationUsageType delegateMessageDestUsage = this.delegate
+            .getMessageDestinationUsage();
+      if (delegateMessageDestUsage != null)
+      {
+         if (delegateMessageDestUsage == org.jboss.metadata.javaee.spec.MessageDestinationUsageType.Consumes)
+         {
+            this.messageDestUsage = MessageDestinationUsageType.CONSUMES;
+         }
+         else if (delegateMessageDestUsage == org.jboss.metadata.javaee.spec.MessageDestinationUsageType.Produces)
+         {
+            this.messageDestUsage = MessageDestinationUsageType.PRODUCES;
+         }
+         else if (delegateMessageDestUsage == org.jboss.metadata.javaee.spec.MessageDestinationUsageType.ConsumesProduces)
+         {
+            this.messageDestUsage = MessageDestinationUsageType.CONSUMES_PRODUCES;
+         }
+      }
+
+      // injection targets
+      Set<ResourceInjectionTargetMetaData> injectionTargetsMD = this.delegate.getInjectionTargets();
+      if (injectionTargetsMD != null)
+      {
+         this.injectionTargets = new ArrayList<InjectionTargetMetaData>(injectionTargetsMD.size());
+         for (ResourceInjectionTargetMetaData injectionTarget : injectionTargetsMD)
+         {
+            this.injectionTargets.add(new InjectionTargetMetadataImpl(injectionTarget));
+         }
+      }
+
+   }
+
+   /** 
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#getDescription()
+    */
+   public List<DescriptionMetaData> getDescription()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#getInjectionTargets()
+    */
+   public List<InjectionTargetMetaData> getInjectionTargets()
+   {
+      return this.injectionTargets;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#getMappedName()
+    */
+   public String getMappedName()
+   {
+      return this.mappedName;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#getMessageDestinationLink()
+    */
+   public String getMessageDestinationLink()
+   {
+      return this.messageDestinationLink;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#getMessageDestinationRefName()
+    */
+   public String getMessageDestinationRefName()
+   {
+      return this.messageDestinationRefName;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#getMessageDestinationType()
+    */
+   public String getMessageDestinationType()
+   {
+      return this.messageDestinationType;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#getMessageDestinationUsage()
+    */
+   public MessageDestinationUsageType getMessageDestinationUsage()
+   {
+      return this.messageDestUsage;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#setInjectionTargets(java.util.List)
+    */
+   public void setInjectionTargets(List<InjectionTargetMetaData> injectionTargets)
+   {
+      this.injectionTargets = injectionTargets;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#setMappedName(java.lang.String)
+    */
+   public void setMappedName(String mappedName)
+   {
+      this.mappedName = mappedName;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#setMessageDestinationLink(java.lang.String)
+    */
+   public void setMessageDestinationLink(String messageDestinationLink)
+   {
+      this.messageDestinationLink = messageDestinationLink;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#setMessageDestinationRefName(java.lang.String)
+    */
+   public void setMessageDestinationRefName(String messageDestinationRefName)
+   {
+      this.messageDestinationRefName = messageDestinationRefName;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#setMessageDestinationType(java.lang.String)
+    */
+   public void setMessageDestinationType(String messageDestinationType)
+   {
+      this.messageDestinationType = messageDestinationType;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData#setMessageDestinationUsage(org.jboss.ejb3.metadata.spi.javaee.MessageDestinationUsageType)
+    */
+   public void setMessageDestinationUsage(MessageDestinationUsageType messageDestinationUsage)
+   {
+      this.messageDestUsage = messageDestinationUsage;
+
+   }
+
+}

Added: projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/RemoveMethodMetadataImpl.java
===================================================================
--- projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/RemoveMethodMetadataImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/RemoveMethodMetadataImpl.java	2009-10-05 19:27:36 UTC (rev 94389)
@@ -0,0 +1,123 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.ejb3.metadata.impl.javaee;
+
+import org.jboss.ejb3.metadata.spi.javaee.NamedMethodMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.RemoveMethodMetaData;
+
+/**
+ * RemoveMethodMetadataImpl
+ *
+ * Represents the metadata for remove-method
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class RemoveMethodMetadataImpl extends IdMetadataImpl implements RemoveMethodMetaData
+{
+
+   /** 
+    * The {@link org.jboss.metadata.ejb.spec.RemoveMethodMetaData} from which
+    * this {@link RemoveMethodMetadataImpl} was constructed
+    */
+   private org.jboss.metadata.ejb.spec.RemoveMethodMetaData delegate;
+
+   /**
+    * The remove method of the bean
+    */
+   private NamedMethodMetaData beanMethod;
+
+   /**
+    * A flag which decided whether the bean should 
+    * be retained on exception
+    */
+   private boolean retainIfException;
+
+   /**
+    * Constructs a {@link RemoveMethodMetadataImpl} from a {@link org.jboss.metadata.ejb.spec.RemoveMethodMetaData}
+    * 
+    * @param removeMethod
+    * @throws NullPointerException If the passed <code>removeMethod</code> is null
+    */
+   public RemoveMethodMetadataImpl(org.jboss.metadata.ejb.spec.RemoveMethodMetaData removeMethod)
+   {
+      super(removeMethod.getId());
+      this.initialize(removeMethod);
+   }
+
+   /**
+    * Initializes this {@link RemoveMethodMetadataImpl} from the state in <code>removeMethod</code>
+    * 
+    * @param removeMethod
+    * @throws NullPointerException If the passed <code>removeMethod</code> is null
+    */
+   private void initialize(org.jboss.metadata.ejb.spec.RemoveMethodMetaData removeMethod)
+   {
+      // set the delegate
+      this.delegate = removeMethod;
+
+      // bean method
+      org.jboss.metadata.ejb.spec.NamedMethodMetaData delegateBeanMethod = this.delegate.getBeanMethod();
+      if (delegateBeanMethod != null)
+      {
+         this.beanMethod = new NamedMethodMetadataImpl(delegateBeanMethod);
+      }
+
+      // retain-if-exception
+      this.retainIfException = this.delegate.isRetainIfException();
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.RemoveMethodMetaData#getBeanMethod()
+    */
+   public NamedMethodMetaData getBeanMethod()
+   {
+      return this.beanMethod;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.RemoveMethodMetaData#isRetainIfException()
+    */
+   public boolean isRetainIfException()
+   {
+      return this.retainIfException;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.RemoveMethodMetaData#setBeanMethod(org.jboss.ejb3.metadata.spi.javaee.NamedMethodMetaData)
+    */
+   public void setBeanMethod(NamedMethodMetaData removeMethod)
+   {
+      this.beanMethod = removeMethod;
+
+   }
+
+   /** 
+    * @see org.jboss.ejb3.metadata.spi.javaee.RemoveMethodMetaData#setRetainIfException(boolean)
+    */
+   public void setRetainIfException(boolean retainIfException)
+   {
+      this.retainIfException = retainIfException;
+
+   }
+
+}

Added: projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/SecurityRoleRefMetadataImpl.java
===================================================================
--- projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/SecurityRoleRefMetadataImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/SecurityRoleRefMetadataImpl.java	2009-10-05 19:27:36 UTC (rev 94389)
@@ -0,0 +1,127 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.ejb3.metadata.impl.javaee;
+
+import java.util.List;
+
+import org.jboss.ejb3.metadata.spi.javaee.DescriptionMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.SecurityRoleRefMetaData;
+
+/**
+ * SecurityRoleRefMetadataImpl
+ *
+ * Represents the metadata for security-role-ref
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SecurityRoleRefMetadataImpl extends IdMetadataImpl implements SecurityRoleRefMetaData
+{
+
+   /**
+    * {@link org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData} from which this
+    * {@link SecurityRoleRefMetadataImpl} was constructed
+    */
+   private org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData delegate;
+
+   /**
+    * role link
+    */
+   private String roleLink;
+
+   /**
+    * role name
+    */
+   private String roleName;
+
+   /**
+    * Constructs a {@link SecurityRoleRefMetadataImpl} from a {@link SecurityRoleRefMetaData}
+    * 
+    * @param securityRoleRef
+    * @throws NullPointerException If the passed <code>securityRoleRef</code> is null
+    */
+   public SecurityRoleRefMetadataImpl(org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData securityRoleRef)
+   {
+      super(securityRoleRef.getId());
+      this.initialize(securityRoleRef);
+   }
+
+   /**
+    * Initializes this {@link SecurityRoleRefMetadataImpl} from the state in <code>securityRoleRef</code>
+    * 
+    * @param securityRoleRef
+    * @throws NullPointerException If the passed <code>securityRoleRef</code> is null
+    */
+   private void initialize(org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData securityRoleRef)
+   {
+      // set the delegate
+      this.delegate = securityRoleRef;
+      
+      this.roleLink = this.delegate.getRoleLink();
+      this.roleName = this.delegate.getRoleName();
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SecurityRoleRefMetaData#getDescription()
+    */
+   public List<DescriptionMetaData> getDescription()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SecurityRoleRefMetaData#getRoleLink()
+    */
+   public String getRoleLink()
+   {
+      return this.roleLink;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SecurityRoleRefMetaData#getRoleName()
+    */
+   public String getRoleName()
+   {
+      return this.roleName;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SecurityRoleRefMetaData#setRoleLink(java.lang.String)
+    */
+   public void setRoleLink(String value)
+   {
+      this.roleLink = value;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SecurityRoleRefMetaData#setRoleName(java.lang.String)
+    */
+   public void setRoleName(String value)
+   {
+      this.roleName = value;
+
+   }
+
+}

Added: projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/SessionBeanMetadataImpl.java
===================================================================
--- projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/SessionBeanMetadataImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/metadata-impl/src/main/java/org/jboss/ejb3/metadata/impl/javaee/SessionBeanMetadataImpl.java	2009-10-05 19:27:36 UTC (rev 94389)
@@ -0,0 +1,616 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.ejb3.metadata.impl.javaee;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.TransactionManagementType;
+
+import org.jboss.ejb3.metadata.spi.javaee.AroundInvokeMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.InitMethodMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.LifecycleCallbackMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.MessageDestinationRefMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.NamedMethodMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.RemoveMethodMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.SecurityRoleRefMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData;
+import org.jboss.ejb3.metadata.spi.javaee.SessionType;
+import org.jboss.metadata.ejb.spec.AroundInvokesMetaData;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
+import org.jboss.metadata.ejb.spec.InitMethodsMetaData;
+import org.jboss.metadata.ejb.spec.RemoveMethodsMetaData;
+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.SecurityRoleRefsMetaData;
+
+/**
+ * SessionBeanMetadataImpl
+ *
+ * Represents the metadata for a session bean
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SessionBeanMetadataImpl extends EnterpriseBeanMetadataImpl implements SessionBeanMetaData
+{
+
+   /**
+    * The {@link org.jboss.metadata.ejb.spec.SessionBeanMetaData} from which this
+    * {@link SessionBeanMetadataImpl} was constructed
+    */
+   private org.jboss.metadata.ejb.spec.SessionBeanMetaData delegate;
+
+   /**
+    * The around-invoke methods for this bean
+    */
+   private List<AroundInvokeMetaData> aroundInvokes;
+
+   /**
+    * Fully qualified classnames of the business local interfaces of this 
+    * session bean
+    */
+   private Set<String> businessLocals;
+
+   /**
+    * Fully qualified classnames of the business remote interfaces of the 
+    * session bean
+    */
+   private Set<String> businessRemotes;
+
+   /**
+    * Fully qualified classname of the home interface of this bean
+    */
+   private String home;
+
+   /**
+    * Init methods of this session bean
+    */
+   private List<InitMethodMetaData> initMethods;
+
+   /**
+    * Fully qualified classname of the (EJB 2.x) local interface
+    * of this session bean
+    */
+   private String local;
+
+   /**
+    * Fully qualified classname of the local home interface of
+    * this session bean
+    */
+   private String localHome;
+
+   /**
+    * Message destination references
+    */
+   private List<MessageDestinationRefMetaData> messageDestinationRefs;
+
+   /**
+    * Post activates of this bean
+    */
+   private List<LifecycleCallbackMetaData> postActivates;
+
+   /**
+    * Pre passivates of this bean
+    */
+   private List<LifecycleCallbackMetaData> prePassivates;
+
+   /**
+    * Fully qualified classname of the (EJB 2.x) remote interface 
+    * of this bean
+    */
+   private String remote;
+
+   /**
+    * Remove methods of this session bean
+    */
+   private List<RemoveMethodMetaData> removeMethods;
+
+   /**
+    * Security role references
+    */
+   private List<SecurityRoleRefMetaData> securityRoleRefs;
+
+   /**
+    * Fully qualified classname of the service endpoint
+    */
+   private String serviceEndpoint;
+
+   /**
+    * Session type of the bean
+    */
+   private SessionType sessionType;
+
+   /**
+    * timeout method of this bean
+    */
+   private NamedMethodMetaData timeoutMethod;
+
+   /**
+    * Transaction management type of this bean
+    */
+   private TransactionManagementType transactionManagementType;
+
+   /**
+    * Constructs a {@link SessionBeanMetadataImpl} out of a {@link org.jboss.metadata.ejb.spec.SessionBeanMetaData}
+    * 
+    * @param sessionBean
+    * @throws NullPointerException If the passed <code>sessionBean</code> is null
+    */
+   public SessionBeanMetadataImpl(org.jboss.metadata.ejb.spec.SessionBeanMetaData sessionBean)
+   {
+      super(sessionBean);
+      this.initialize(sessionBean);
+   }
+
+   /**
+    * Initializes this {@link SessionBeanMetadataImpl} from the state in <code>sessionBean</code>
+    * 
+    * @param sessionBean
+    * @throws NullPointerException If the passed <code>sessionBean</code> is null
+    */
+   private void initialize(org.jboss.metadata.ejb.spec.SessionBeanMetaData sessionBean)
+   {
+      // set the delegate
+      this.delegate = sessionBean;
+
+      this.home = this.delegate.getHome();
+      this.local = this.delegate.getLocal();
+      this.localHome = this.delegate.getLocalHome();
+      this.remote = this.delegate.getRemote();
+      this.serviceEndpoint = this.delegate.getServiceEndpoint();
+
+      // transaction management type
+      this.transactionManagementType = this.delegate.getTransactionType();
+
+      // session type
+      org.jboss.metadata.ejb.spec.SessionType delegateSessionType = this.delegate.getSessionType();
+      if (delegateSessionType != null)
+      {
+         this.sessionType = delegateSessionType == org.jboss.metadata.ejb.spec.SessionType.Stateless
+               ? SessionType.STATELESS
+               : SessionType.STATEFUL;
+      }
+
+      // around invokes
+      AroundInvokesMetaData delegateAroundInvokes = this.delegate.getAroundInvokes();
+      if (delegateAroundInvokes != null)
+      {
+         this.aroundInvokes = new ArrayList<AroundInvokeMetaData>(delegateAroundInvokes.size());
+         for (org.jboss.metadata.ejb.spec.AroundInvokeMetaData aroundInvoke : delegateAroundInvokes)
+         {
+            this.aroundInvokes.add(new AroundInvokeMetadataImpl(aroundInvoke));
+         }
+      }
+
+      // business locals
+      BusinessLocalsMetaData delegateBusinessLocalsMD = this.delegate.getBusinessLocals();
+      if (delegateBusinessLocalsMD != null)
+      {
+         this.businessLocals = new HashSet<String>(delegateBusinessLocalsMD.size());
+         for (String businessLocal : delegateBusinessLocalsMD)
+         {
+            this.businessLocals.add(businessLocal);
+         }
+      }
+
+      // business remotes
+      BusinessRemotesMetaData delegateBusinessRemotesMD = this.delegate.getBusinessRemotes();
+      if (delegateBusinessRemotesMD != null)
+      {
+         this.businessRemotes = new HashSet<String>(delegateBusinessRemotesMD.size());
+         for (String businessRemote : delegateBusinessRemotesMD)
+         {
+            this.businessRemotes.add(businessRemote);
+         }
+      }
+
+      // init methods
+      InitMethodsMetaData delegateInitMethods = this.delegate.getInitMethods();
+      if (delegateInitMethods != null)
+      {
+         this.initMethods = new ArrayList<InitMethodMetaData>(delegateInitMethods.size());
+         for (org.jboss.metadata.ejb.spec.InitMethodMetaData initMethod : delegateInitMethods)
+         {
+            this.initMethods.add(new InitMethodMetadataImpl(initMethod));
+         }
+      }
+
+      // message destination refs
+      MessageDestinationReferencesMetaData delegateMessageDestRefs = this.delegate.getMessageDestinationReferences();
+      if (delegateMessageDestRefs != null)
+      {
+         this.messageDestinationRefs = new ArrayList<MessageDestinationRefMetaData>(delegateMessageDestRefs.size());
+         for (MessageDestinationReferenceMetaData messageDestRef : delegateMessageDestRefs)
+         {
+            this.messageDestinationRefs.add(new MessageDestinationRefMetadataImpl(messageDestRef));
+         }
+
+      }
+
+      // post activates
+      LifecycleCallbacksMetaData delegatePostActivates = this.delegate.getPostActivates();
+      if (delegatePostActivates != null)
+      {
+         this.postActivates = new ArrayList<LifecycleCallbackMetaData>(delegatePostActivates.size());
+         for (org.jboss.metadata.javaee.spec.LifecycleCallbackMetaData postActivate : delegatePostActivates)
+         {
+            this.postActivates.add(new LifecycleCallbackMetadataImpl(postActivate));
+         }
+      }
+
+      // pre passivates
+      LifecycleCallbacksMetaData delegatePrePassivates = this.delegate.getPrePassivates();
+      if (delegatePrePassivates != null)
+      {
+         this.prePassivates = new ArrayList<LifecycleCallbackMetaData>(delegatePrePassivates.size());
+         for (org.jboss.metadata.javaee.spec.LifecycleCallbackMetaData prePassivate : delegatePrePassivates)
+         {
+            this.prePassivates.add(new LifecycleCallbackMetadataImpl(prePassivate));
+         }
+      }
+
+      // remove methods
+      RemoveMethodsMetaData delegateRemoveMethods = this.delegate.getRemoveMethods();
+      if (delegateRemoveMethods != null)
+      {
+         this.removeMethods = new ArrayList<RemoveMethodMetaData>(delegateRemoveMethods.size());
+         for (org.jboss.metadata.ejb.spec.RemoveMethodMetaData removeMethod : delegateRemoveMethods)
+         {
+            this.removeMethods.add(new RemoveMethodMetadataImpl(removeMethod));
+         }
+      }
+
+      // security role references
+      SecurityRoleRefsMetaData delegateSecurityRoleRefs = this.delegate.getSecurityRoleRefs();
+      if (delegateSecurityRoleRefs != null)
+      {
+         this.securityRoleRefs = new ArrayList<SecurityRoleRefMetaData>(delegateSecurityRoleRefs.size());
+         for (org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData securityRoleRef : delegateSecurityRoleRefs)
+         {
+            this.securityRoleRefs.add(new SecurityRoleRefMetadataImpl(securityRoleRef));
+         }
+      }
+
+      // timeout method
+      org.jboss.metadata.ejb.spec.NamedMethodMetaData delegateTimeoutMethod = this.delegate.getTimeoutMethod();
+      if (delegateTimeoutMethod != null)
+      {
+         this.timeoutMethod = new NamedMethodMetadataImpl(delegateTimeoutMethod);
+      }
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getAroundInvokes()
+    */
+   public List<AroundInvokeMetaData> getAroundInvokes()
+   {
+      return this.aroundInvokes;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getBusinessLocals()
+    */
+   public Set<String> getBusinessLocals()
+   {
+      return this.businessLocals;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getBusinessRemotes()
+    */
+   public Set<String> getBusinessRemotes()
+   {
+      return this.businessRemotes;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getHome()
+    */
+   public String getHome()
+   {
+      return this.home;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getInitMethods()
+    */
+   public List<InitMethodMetaData> getInitMethods() throws IllegalStateException
+   {
+      if (!this.isStateful())
+      {
+         throw new IllegalStateException("init-method is applicable only for stateful beans. This bean "
+               + this.getEjbName() + " is not stateful");
+      }
+      return this.initMethods;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getLocal()
+    */
+   public String getLocal()
+   {
+      return this.local;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getLocalHome()
+    */
+   public String getLocalHome()
+   {
+      return this.localHome;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getMessageDestinationRefs()
+    */
+   public List<MessageDestinationRefMetaData> getMessageDestinationRefs()
+   {
+      return this.messageDestinationRefs;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getPostActivates()
+    */
+   public List<LifecycleCallbackMetaData> getPostActivates()
+   {
+      return this.postActivates;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getPrePassivates()
+    */
+   public List<LifecycleCallbackMetaData> getPrePassivates()
+   {
+      return this.prePassivates;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getRemote()
+    */
+   public String getRemote()
+   {
+      return this.remote;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getRemoveMethods()
+    */
+   public List<RemoveMethodMetaData> getRemoveMethods() throws IllegalStateException
+   {
+      if (!this.isStateful())
+      {
+         throw new IllegalStateException("remove-method is applicable only for stateful beans. This bean: "
+               + this.getEjbName() + " is not stateful");
+      }
+      return this.removeMethods;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getSecurityRoleRefs()
+    */
+   public List<SecurityRoleRefMetaData> getSecurityRoleRefs()
+   {
+      return this.securityRoleRefs;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getServiceEndpoint()
+    */
+   public String getServiceEndpoint() throws IllegalStateException
+   {
+      return this.serviceEndpoint;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getSessionType()
+    */
+   public SessionType getSessionType()
+   {
+      return this.sessionType;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getTimeoutMethod()
+    */
+   public NamedMethodMetaData getTimeoutMethod()
+   {
+      return this.timeoutMethod;
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#getTransactionType()
+    */
+   public TransactionManagementType getTransactionType()
+   {
+      return this.transactionManagementType;
+   }
+
+   /** 
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#isStateful()
+    */
+   public boolean isStateful()
+   {
+      return this.delegate.isStateful();
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#isStateless()
+    */
+   public boolean isStateless()
+   {
+      return this.delegate.isStateless();
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setAroundInvokes(java.util.List)
+    */
+   public void setAroundInvokes(List<AroundInvokeMetaData> aroundInvokes)
+   {
+      this.aroundInvokes = aroundInvokes;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setBusinessLocals(java.util.Set)
+    */
+   public void setBusinessLocals(Set<String> businessLocals)
+   {
+      this.businessLocals = businessLocals;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setBusinessRemotes(java.util.Set)
+    */
+   public void setBusinessRemotes(Set<String> businessRemotes)
+   {
+      this.businessRemotes = businessRemotes;
+
+   }
+
+   /** 
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setHome(java.lang.String)
+    */
+   public void setHome(String homeInterface)
+   {
+      this.home = homeInterface;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setInitMethods(java.util.List)
+    */
+   public void setInitMethods(List<InitMethodMetaData> initMethods) throws IllegalStateException
+   {
+      this.initMethods = initMethods;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setLocal(java.lang.String)
+    */
+   public void setLocal(String local)
+   {
+      this.local = local;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setLocalHome(java.lang.String)
+    */
+   public void setLocalHome(String localHome)
+   {
+      this.localHome = localHome;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setPostActivates(java.util.List)
+    */
+   public void setPostActivates(List<LifecycleCallbackMetaData> postActivates)
+   {
+      this.postActivates = postActivates;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setPrePassivates(java.util.List)
+    */
+   public void setPrePassivates(List<LifecycleCallbackMetaData> prePassivates)
+   {
+      this.prePassivates = prePassivates;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setRemote(java.lang.String)
+    */
+   public void setRemote(String remoteInterface)
+   {
+      this.remote = remoteInterface;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setRemoveMethods(java.util.List)
+    */
+   public void setRemoveMethods(List<RemoveMethodMetaData> removeMethods) throws IllegalStateException
+   {
+      if (!this.isStateful())
+      {
+         throw new IllegalStateException("remove-method is applicable only for stateful beans. This bean: "
+               + this.getEjbName() + " is not stateful");
+      }
+      this.removeMethods = removeMethods;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setSecurityRoleRefs(java.util.List)
+    */
+   public void setSecurityRoleRefs(List<SecurityRoleRefMetaData> securityRoleRefs)
+   {
+      this.securityRoleRefs = securityRoleRefs;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setServiceEndpoint(java.lang.String)
+    */
+   public void setServiceEndpoint(String value) throws IllegalStateException
+   {
+      this.serviceEndpoint = value;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setSessionType(SessionType)
+    */
+   public void setSessionType(SessionType value)
+   {
+      this.sessionType = value;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setTimeoutMethod(org.jboss.ejb3.metadata.spi.javaee.NamedMethodMetaData)
+    */
+   public void setTimeoutMethod(NamedMethodMetaData timeoutMethod)
+   {
+      this.timeoutMethod = timeoutMethod;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.metadata.spi.javaee.SessionBeanMetaData#setTransactionType(TransactionManagementType)
+    */
+   public void setTransactionType(TransactionManagementType transactionType)
+   {
+      this.transactionManagementType = transactionType;
+   }
+
+}




More information about the jboss-cvs-commits mailing list