[jboss-cvs] JBossAS SVN: r62965 - in trunk/ejb3/src/main/org/jboss/ejb3: clientmodule and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 10 06:57:20 EDT 2007


Author: wolfc
Date: 2007-05-10 06:57:19 -0400 (Thu, 10 May 2007)
New Revision: 62965

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDD.java
   trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDDObjectFactory.java
Log:
EJBTHREE-957: message-destination-ref parsing in app client

Modified: trunk/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java	2007-05-10 10:55:51 UTC (rev 62964)
+++ trunk/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java	2007-05-10 10:57:19 UTC (rev 62965)
@@ -416,7 +416,8 @@
 
    public String resolveMessageDestination(String link)
    {
-      throw new RuntimeException("NYI");
+      // Resolving something here is a nop
+      return null;
    }
    
    public VirtualFile getRootFile()

Modified: trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java	2007-05-10 10:55:51 UTC (rev 62964)
+++ trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java	2007-05-10 10:57:19 UTC (rev 62965)
@@ -41,13 +41,17 @@
 import org.jboss.ejb3.DependencyPolicy;
 import org.jboss.ejb3.DeploymentScope;
 import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
 import org.jboss.ejb3.Ejb3Module;
 import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
 import org.jboss.ejb3.deployers.JBoss5DeploymentScope;
 import org.jboss.ejb3.deployers.JBoss5DeploymentUnit;
 import org.jboss.ejb3.enc.DeploymentEjbResolver;
+import org.jboss.ejb3.enc.MessageDestinationResolver;
 import org.jboss.ejb3.entity.PersistenceUnitDeployment;
 import org.jboss.ejb3.metamodel.ApplicationClientDD;
+import org.jboss.ejb3.metamodel.AssemblyDescriptor;
+import org.jboss.ejb3.metamodel.MessageDestination;
 import org.jboss.injection.DependsHandler;
 import org.jboss.injection.EJBHandler;
 import org.jboss.injection.EncInjector;
@@ -93,9 +97,12 @@
    private Context enc;
 
    private DeploymentEjbResolver ejbResolver;
+   private DeploymentScope deploymentScope;
    private ObjectName objectName;
    private DependencyPolicy dependencyPolicy = new JBoss5DependencyPolicy();
 
+   private MessageDestinationResolver messageDestinationResolver;
+
    public ClientENCInjectionContainer(org.jboss.deployers.spi.deployer.DeploymentUnit unit, ApplicationClientDD xml, Class<?> mainClass, String applicationClientName, ClassLoader classLoader, Context encCtx) throws NamingException
    {
       if(mainClass == null)
@@ -133,15 +140,16 @@
       }
       */
 
-      DeploymentScope scope = null;
+      //DeploymentScope scope = null;
       if (unit.getDeploymentContext().getParent() != null)
       {
-         scope = new JBoss5DeploymentScope(unit.getDeploymentContext().getParent());
+         this.deploymentScope = new JBoss5DeploymentScope(unit.getDeploymentContext().getParent());
       }
 
-      ejbResolver = new ClientEjbResolver(scope, unit.getDeploymentContext().getRoot().getName());
+      ejbResolver = new ClientEjbResolver(deploymentScope, unit.getDeploymentContext().getRoot().getName());
+      messageDestinationResolver = new MessageDestinationResolver(deploymentScope, xml.getMessageDestinations());
 
-      String on = Ejb3Module.BASE_EJB3_JMX_NAME + createScopeKernelName(unit, scope) + ",name=" + applicationClientName;
+      String on = Ejb3Module.BASE_EJB3_JMX_NAME + createScopeKernelName(unit, deploymentScope) + ",name=" + applicationClientName;
       try
       {
          this.objectName = new ObjectName(on);
@@ -363,7 +371,28 @@
 
    public String resolveMessageDestination(String link)
    {
-      throw new RuntimeException("NYI");
+//      // FIXME: this is a copy of DeploymentEjbResolver & Ejb3Deployment.resolveMessageDestination
+//      int hashIndex = link.indexOf('#');
+//      if (hashIndex != -1)
+//      {
+//         if (deploymentScope == null)
+//         {
+//            log.warn("ejb link '" + link + "' is relative, but no deployment scope found");
+//            return null;
+//         }
+//         String relativePath = link.substring(0, hashIndex);
+//         Ejb3Deployment dep = deploymentScope.findRelativeDeployment(relativePath);
+//         if (dep == null)
+//         {
+//            log.warn("can't find a deployment for path '" + relativePath + "' of ejb link '" + link + "'");
+//            return null;
+//         }
+//         String name = link.substring(hashIndex + 1);
+//         // call resolve, because get is private (and should stay that way)
+//         return dep.resolveMessageDestination(name);
+//      }
+//      return getMessageDestination(link);
+      return messageDestinationResolver.resolveMessageDestination(link);
    }
    
    public void start()

Modified: trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDD.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDD.java	2007-05-10 10:55:51 UTC (rev 62964)
+++ trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDD.java	2007-05-10 10:57:19 UTC (rev 62965)
@@ -23,8 +23,10 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 
 import org.jboss.logging.Logger;
 import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
@@ -52,6 +54,8 @@
 //   protected HashMap<String, MessageDestinationRef> messageDestinationRefs = new HashMap<String, MessageDestinationRef>();
 //   protected List<PersistenceUnitRef> persistenceUnitRefs = new ArrayList<PersistenceUnitRef>();
    
+   private Collection<MessageDestination> messageDestinations = new HashSet<MessageDestination>();
+   
    private List<LifecycleCallback> postConstructs = new ArrayList<LifecycleCallback>();
    private List<LifecycleCallback> preDestroys = new ArrayList<LifecycleCallback>();
    private String callbackHandlerClass = null;
@@ -98,6 +102,23 @@
       this.jndiName = jndiName;
    }
    
+   public void addMessageDestination(MessageDestination dest)
+   {
+      assert dest.getMessageDestinationName() != null : "message destination name is null";
+      
+      messageDestinations.add(dest);
+   }
+   
+//   public MessageDestination findMessageDestination(String name)
+//   {
+//      return messageDestinations.get(name);
+//   }
+   
+   public Collection<MessageDestination> getMessageDestinations()
+   {
+      return messageDestinations;
+   }
+   
    public boolean isMetaDataComplete()
    {
       return metadataComplete;

Modified: trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDDObjectFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDDObjectFactory.java	2007-05-10 10:55:51 UTC (rev 62964)
+++ trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDDObjectFactory.java	2007-05-10 10:57:19 UTC (rev 62965)
@@ -28,6 +28,7 @@
 import org.jboss.metamodel.descriptor.DDObjectFactory;
 import org.jboss.metamodel.descriptor.EjbRef;
 import org.jboss.metamodel.descriptor.EnvEntry;
+import org.jboss.metamodel.descriptor.MessageDestinationRef;
 import org.jboss.util.xml.JBossEntityResolver;
 import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.Unmarshaller;
@@ -96,6 +97,16 @@
       else throw new IllegalArgumentException(localName);
    }
 
+   public void addChild(ApplicationClientDD parent, MessageDestination dest, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.addMessageDestination(dest);
+   }
+   
+   public void addChild(ApplicationClientDD parent, MessageDestinationRef ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.addMessageDestinationRef(ref);
+   }
+   
    public void addChild(ApplicationClientDD parent, ServiceRefMetaData serviceref,
                         UnmarshallingContext navigator, String namespaceURI, String localName)
    {
@@ -117,6 +128,10 @@
       {
          child = new LifecycleCallback();
       }
+      else if (localName.equals("message-destination"))
+      {
+         child = new MessageDestination();
+      }
 
       // ignore things like display-name & description
 
@@ -182,4 +197,12 @@
          lifecycleCallback.setLifecycleCallbackMethod(value);
       else throw new IllegalArgumentException(localName);
    }
+   
+   public void setValue(MessageDestination destination, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("message-destination-name"))
+      {
+         destination.setMessageDestinationName(getValue(localName, value));
+      }
+   }
 }




More information about the jboss-cvs-commits mailing list