Package org.jboss.metadata.javaee.spec

Examples of org.jboss.metadata.javaee.spec.EJBReferenceMetaData


   {
      Environment envRefs = bean.getJndiEnvironmentRefsGroup();
      assertNotNull(envRefs);
      EJBReferencesMetaData ejbReferences = envRefs.getEjbReferences();
      assertNotNull(ejbReferences);
      EJBReferenceMetaData ejbRef = ejbReferences.get("session1EjbRef1Name");
      assertNotNull(ejbRef);
     
      assertEquals("session1Invoker1EjbName1", ejbRef.getInvokerBinding("invokerProxyBinding1Name"));
      assertEquals("session1Invoker2EjbName1", ejbRef.getInvokerBinding("invokerProxyBinding2Name"));
   }
View Full Code Here


   private void assertJBossEjbRef(JBossMetaData jboss)
   {
      JBossEnterpriseBeanMetaData bean = jboss.getEnterpriseBean("SessionB");
      assertNotNull(bean);
      EJBReferenceMetaData ejbRef = bean.getEjbReferenceByName("ejb/NoLinkSessionA");
      assertNotNull(ejbRef);
      assertEquals("naming/SessionA", ejbRef.getJndiName());
   }
View Full Code Here

         {
            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());
               }
            }
         }
      }
     
View Full Code Here

         {
            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());
               }
            }
         }
      }
     
View Full Code Here

      JBossMetaData jbossMergedMetaData = new JBossMetaData();
      jbossMergedMetaData.merge(jbossMetaData, merged);

      JBossEnterpriseBeanMetaData bean2 = merged.getEnterpriseBean("EjbLink2Bean");
      assertNotNull(bean2);
      EJBReferenceMetaData ref1 = bean2.getEjbReferenceByName("ejb/EjbLink1Bean");
      assertNotNull(ref1);
      EJBLocalReferenceMetaData ref3 = bean2.getEjbLocalReferenceByName("ejb/EjbLink3Bean");
      assertNotNull(ref3);

      JBossEnterpriseBeanMetaData bean3 = merged.getEnterpriseBean("EjbLink3Bean");
View Full Code Here

      JBossMetaData jbossMergedMetaData = new JBossMetaData();
      jbossMergedMetaData.merge(jbossMetaData, merged);

      EnterpriseBeanMetaData bean2 = merged.getEnterpriseBean("EjbLink2Bean");
      assertNotNull(bean2);
      EJBReferenceMetaData ref1 = bean2.getEjbReferenceByName("ejb/EjbLink1Bean");
      assertNotNull(ref1);
      EJBLocalReferenceMetaData ref3 = bean2.getEjbLocalReferenceByName("ejb/EjbLink3Bean");
      assertNotNull(ref3);

      EnterpriseBeanMetaData bean3 = merged.getEnterpriseBean("EjbLink3Bean");
View Full Code Here

      localRef.setJndiName(localRef.getEjbRefName() + "Original");
      localRefs.add(localRef);
      originalEnv.setEjbLocalReferences(localRefs);
     
      EJBReferencesMetaData ejbRefs = new EJBReferencesMetaData();
      EJBReferenceMetaData ejbRef = new EJBReferenceMetaData();
      ejbRef.setEjbRefName("ejbRef1");
      ejbRef.setJndiName(ejbRef.getEjbRefName() + "Original");
      ejbRefs.add(ejbRef);
      ejbRef = new EJBReferenceMetaData();
      ejbRef.setEjbRefName("ejbRef2");
      ejbRef.setJndiName(ejbRef.getEjbRefName() + "Original");
      ejbRefs.add(ejbRef);
      originalEnv.setEjbReferences(ejbRefs);
     
      EnvironmentEntriesMetaData envEntries = new EnvironmentEntriesMetaData();
      EnvironmentEntryMetaData envEntry = new EnvironmentEntryMetaData();
      envEntry.setEnvEntryName("entry1");
      envEntry.setJndiName(envEntry.getEnvEntryName() + "Original");
      envEntries.add(envEntry);
      envEntry = new EnvironmentEntryMetaData();
      envEntry.setEnvEntryName("entry2");
      envEntry.setJndiName(envEntry.getEnvEntryName() + "Original");
      envEntries.add(envEntry);
      originalEnv.setEnvironmentEntries(envEntries);
     
      MessageDestinationReferencesMetaData destRefs = new MessageDestinationReferencesMetaData();
      MessageDestinationReferenceMetaData destRef = new MessageDestinationReferenceMetaData();
      destRef.setMessageDestinationRefName("destRef1");
      destRef.setJndiName(destRef.getMessageDestinationRefName() + "Original");
      destRefs.add(destRef);
      destRef = new MessageDestinationReferenceMetaData();
      destRef.setMessageDestinationRefName("destRef2");
      destRef.setJndiName(destRef.getMessageDestinationRefName() + "Original");
      destRefs.add(destRef);
      originalEnv.setMessageDestinationReferences(destRefs);
     
      PersistenceContextReferencesMetaData pctxRefs = new PersistenceContextReferencesMetaData();
      PersistenceContextReferenceMetaData pctxRef = new PersistenceContextReferenceMetaData();
      pctxRef.setPersistenceContextRefName("pctxRef1");
      pctxRef.setJndiName(pctxRef.getPersistenceContextRefName() + "Original");
      pctxRefs.add(pctxRef);
      pctxRef = new PersistenceContextReferenceMetaData();
      pctxRef.setPersistenceContextRefName("pctxRef2");
      pctxRef.setJndiName(pctxRef.getPersistenceContextRefName() + "Original");
      pctxRefs.add(pctxRef);
      originalEnv.setPersistenceContextRefs(pctxRefs);

      PersistenceUnitReferencesMetaData pUnitRefs = new PersistenceUnitReferencesMetaData();
      PersistenceUnitReferenceMetaData pUnitRef = new PersistenceUnitReferenceMetaData();
      pUnitRef.setPersistenceUnitRefName("pUnitRef1");
      pUnitRef.setJndiName(pUnitRef.getPersistenceUnitRefName() + "Original");
      pUnitRefs.add(pUnitRef);
      pUnitRef = new PersistenceUnitReferenceMetaData();
      pUnitRef.setPersistenceUnitRefName("pUnitRef2");
      pUnitRef.setJndiName(pUnitRef.getPersistenceUnitRefName() + "Original");
      pUnitRefs.add(pUnitRef);
      originalEnv.setPersistenceUnitRefs(pUnitRefs);
     
      LifecycleCallbacksMetaData callbacks = new LifecycleCallbacksMetaData();
      LifecycleCallbackMetaData callback = new LifecycleCallbackMetaData();
      callback.setClassName("class1");
      callback.setMethodName("postCtor1Original");
      callbacks.add(callback);
      callback = new LifecycleCallbackMetaData();
      callback.setClassName("class2");
      callback.setMethodName("postCtor2Original");
      callbacks.add(callback);
      originalEnv.setPostConstructs(callbacks);
     
      callbacks = new LifecycleCallbacksMetaData();
      callback = new LifecycleCallbackMetaData();
      callback.setClassName("class1");
      callback.setMethodName("preDestroy1Original");
      callbacks.add(callback);
      callback = new LifecycleCallbackMetaData();
      callback.setClassName("class2");
      callback.setMethodName("preDestroy2Original");
      callbacks.add(callback);
      originalEnv.setPreDestroys(callbacks);
     
      ResourceEnvironmentReferencesMetaData resEnvRefs = new ResourceEnvironmentReferencesMetaData();
      ResourceEnvironmentReferenceMetaData resEnvRef = new ResourceEnvironmentReferenceMetaData();
      resEnvRef.setResourceEnvRefName("resEnvRef1");
      resEnvRef.setJndiName(resEnvRef.getResourceEnvRefName() + "Original");
      resEnvRefs.add(resEnvRef);
      resEnvRef = new ResourceEnvironmentReferenceMetaData();
      resEnvRef.setResourceEnvRefName("resEnvRef2");
      resEnvRef.setJndiName(resEnvRef.getResourceEnvRefName() + "Original");
      resEnvRefs.add(resEnvRef);
      originalEnv.setResourceEnvironmentReferences(resEnvRefs);
     
      ResourceReferencesMetaData resRefs = new ResourceReferencesMetaData();
      ResourceReferenceMetaData resRef = new ResourceReferenceMetaData();
      resRef.setResourceRefName("resRef1");
      resRef.setJndiName(resRef.getResourceRefName() + "Original");
      resRefs.add(resRef);
      resRef = new ResourceReferenceMetaData();
      resRef.setResourceRefName("resRef2");
      resRef.setJndiName(resRef.getResourceRefName() + "Original");
      resRefs.add(resRef);
      originalEnv.setResourceReferences(resRefs);
     
      JBossServiceReferencesMetaData serviceRefs = new JBossServiceReferencesMetaData();
      JBossServiceReferenceMetaData serviceRef = new JBossServiceReferenceMetaData();
      serviceRef.setServiceRefName("serviceRef1");
      serviceRef.setJndiName(serviceRef.getServiceRefName() + "Original");
      serviceRefs.add(serviceRef);
      serviceRef = new JBossServiceReferenceMetaData();
      serviceRef.setServiceRefName("serviceRef2");
      serviceRef.setJndiName(serviceRef.getServiceRefName() + "Original");
      serviceRefs.add(serviceRef);
      originalEnv.setServiceReferences(serviceRefs);
     
      // override
      JBossSessionBeanMetaData override = new JBossSessionBeanMetaData();
      override.setEjbName("session");
      JBossEnvironmentRefsGroupMetaData overrideEnv = new JBossEnvironmentRefsGroupMetaData();
      override.setJndiEnvironmentRefsGroup(overrideEnv);
      overrideEnv.setAnnotatedEjbReferences(new AnnotatedEJBReferencesMetaData());

      localRefs = new EJBLocalReferencesMetaData();
      localRef = new EJBLocalReferenceMetaData();
      localRef.setEjbRefName("localRef2");
      localRef.setJndiName(localRef.getEjbRefName() + "Override");
      localRefs.add(localRef);
      overrideEnv.setEjbLocalReferences(localRefs);
     
      ejbRefs = new EJBReferencesMetaData();
      ejbRef = new EJBReferenceMetaData();
      ejbRef.setEjbRefName("ejbRef2");
      ejbRef.setJndiName(ejbRef.getEjbRefName() + "Override");
      ejbRefs.add(ejbRef);
      overrideEnv.setEjbReferences(ejbRefs);

      envEntries = new EnvironmentEntriesMetaData();
      envEntry = new EnvironmentEntryMetaData();
      envEntry.setEnvEntryName("entry2");
      envEntry.setJndiName(envEntry.getEnvEntryName() + "Override");
      envEntries.add(envEntry);
      envEntry = new EnvironmentEntryMetaData();
      envEntry.setEnvEntryName("entry3");
      envEntry.setJndiName(envEntry.getEnvEntryName() + "Override");
      envEntries.add(envEntry);
      overrideEnv.setEnvironmentEntries(envEntries);

      destRefs = new MessageDestinationReferencesMetaData();
      destRef = new MessageDestinationReferenceMetaData();
      destRef.setMessageDestinationRefName("destRef2");
      destRef.setJndiName(destRef.getMessageDestinationRefName() + "Override");
      destRefs.add(destRef);
      overrideEnv.setMessageDestinationReferences(destRefs);
     
      pctxRefs = new PersistenceContextReferencesMetaData();
      pctxRef = new PersistenceContextReferenceMetaData();
      pctxRef.setPersistenceContextRefName("pctxRef2");
      pctxRef.setJndiName(pctxRef.getPersistenceContextRefName() + "Override");
      pctxRefs.add(pctxRef);
      pctxRef = new PersistenceContextReferenceMetaData();
      pctxRef.setPersistenceContextRefName("pctxRef3");
      pctxRef.setJndiName(pctxRef.getPersistenceContextRefName() + "Override");
      pctxRefs.add(pctxRef);
      overrideEnv.setPersistenceContextRefs(pctxRefs);
     
      pUnitRefs = new PersistenceUnitReferencesMetaData();
      pUnitRef = new PersistenceUnitReferenceMetaData();
      pUnitRef.setPersistenceUnitRefName("pUnitRef2");
      pUnitRef.setJndiName(pUnitRef.getPersistenceUnitRefName() + "Override");
      pUnitRefs.add(pUnitRef);
      pUnitRef = new PersistenceUnitReferenceMetaData();
      pUnitRef.setPersistenceUnitRefName("pUnitRef3");
      pUnitRef.setJndiName(pUnitRef.getPersistenceUnitRefName() + "Override");
      pUnitRefs.add(pUnitRef);
      overrideEnv.setPersistenceUnitRefs(pUnitRefs);
     
      callbacks = new LifecycleCallbacksMetaData();
      callback = new LifecycleCallbackMetaData();
      callback.setClassName("class2");
      callback.setMethodName("postCtor2Override");
      callbacks.add(callback);
      callback = new LifecycleCallbackMetaData();
      callback.setClassName("class3");
      callback.setMethodName("postCtor3Override");
      callbacks.add(callback);
      overrideEnv.setPostConstructs(callbacks);

      callbacks = new LifecycleCallbacksMetaData();
      callback = new LifecycleCallbackMetaData();
      callback.setClassName("class2");
      callback.setMethodName("preDestroy2Override");
      callbacks.add(callback);
      callback = new LifecycleCallbackMetaData();
      callback.setClassName("class3");
      callback.setMethodName("preDestroy3Override");
      callbacks.add(callback);
      overrideEnv.setPreDestroys(callbacks);

      resEnvRefs = new ResourceEnvironmentReferencesMetaData();
      resEnvRef = new ResourceEnvironmentReferenceMetaData();
      resEnvRef.setResourceEnvRefName("resEnvRef2");
      resEnvRef.setJndiName(resEnvRef.getResourceEnvRefName() + "Override");
      resEnvRefs.add(resEnvRef);
      resEnvRef = new ResourceEnvironmentReferenceMetaData();
      resEnvRef.setResourceEnvRefName("resEnvRef3");
      resEnvRef.setJndiName(resEnvRef.getResourceEnvRefName() + "Override");
      resEnvRefs.add(resEnvRef);
      overrideEnv.setResourceEnvironmentReferences(resEnvRefs);
     
      resRefs = new ResourceReferencesMetaData();
      resRef = new ResourceReferenceMetaData();
      resRef.setResourceRefName("resRef2");
      resRef.setJndiName(resRef.getResourceRefName() + "Override");
      resRefs.add(resRef);
      overrideEnv.setResourceReferences(resRefs);

      serviceRefs = new JBossServiceReferencesMetaData();
      serviceRef = new JBossServiceReferenceMetaData();
      serviceRef.setServiceRefName("serviceRef2");
      serviceRef.setJndiName(serviceRef.getServiceRefName() + "Override");
      serviceRefs.add(serviceRef);
      serviceRef = new JBossServiceReferenceMetaData();
      serviceRef.setServiceRefName("serviceRef3");
      serviceRef.setJndiName(serviceRef.getServiceRefName() + "Override");
      serviceRefs.add(serviceRef);
      overrideEnv.setServiceReferences(serviceRefs);
     
      // merged
      JBossSessionBeanMetaData merged = new JBossSessionBeanMetaData();
      JBossEnterpriseBeansMetaData mergedBeans = new JBossEnterpriseBeansMetaData();
      mergedBeans.setEjbJarMetaData(new JBoss50MetaData());
      merged.setEnterpriseBeansMetaData(mergedBeans);
      merged.merge(override, original);
      JBossEnvironmentRefsGroupMetaData mergedEnv = (JBossEnvironmentRefsGroupMetaData) merged.getJndiEnvironmentRefsGroup();
      assertNotNull(mergedEnv);
     
      // Simple in here
      assertNotNull(merged.getAnnotatedEjbReferences());
     

      // local refs
      localRefs = mergedEnv.getEjbLocalReferences();
      assertNotNull(localRefs);
      assertEquals(2, localRefs.size());
      localRef = localRefs.get("localRef1");
      assertNotNull(localRef);
      assertEquals(localRef.getEjbRefName() + "Original", localRef.getJndiName());
      localRef = localRefs.get("localRef2");
      assertNotNull(localRef);
      assertEquals(localRef.getEjbRefName() + "Override", localRef.getJndiName());
     
      ejbRefs = mergedEnv.getEjbReferences();
      assertNotNull(ejbRefs);
      assertEquals(2, ejbRefs.size());
      ejbRef = ejbRefs.get("ejbRef1");
      assertNotNull(ejbRef);
      assertEquals(ejbRef.getEjbRefName() + "Original", ejbRef.getJndiName());
      ejbRef = ejbRefs.get("ejbRef2");
      assertNotNull(ejbRef);
      assertEquals(ejbRef.getEjbRefName() + "Override", ejbRef.getJndiName());
     
      envEntries = mergedEnv.getEnvironmentEntries();
      assertNotNull(envEntries);
      assertEquals(3, envEntries.size());
      envEntry = envEntries.get("entry1");
View Full Code Here

         {
            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());
               }
            }
         }
      }
     
View Full Code Here

/*      */
/* 1494 */         if (invokerBinding.getEjbRefs() != null)
/*      */         {
/* 1496 */           for (InvokerBindingMetaData.EjbRef ejbRef : invokerBinding.getEjbRefs())
/*      */           {
/* 1498 */             EJBReferenceMetaData targetEjbRef = this.jndiEnvironmentRefsGroup.getEjbReferenceByName(ejbRef.getEjbRefName());
/* 1499 */             if (targetEjbRef == null)
/* 1500 */               throw new IllegalStateException("ejb-ref " + ejbRef.getEjbRefName() + " found on invoker " + invokerBinding.getName() + " but it does not exist for ejb: " + getName());
/* 1501 */             targetEjbRef.addInvokerBinding(invokerBinding.getName(), ejbRef.getJndiName());
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */     InvokerBindingMetaData invokerBinding;
View Full Code Here

/* 265 */     return new OldMetaDataIterator(ejbLocalRefs, EJBLocalReferenceMetaData.class, EjbLocalRefMetaData.class);
/*     */   }
/*     */
/*     */   public EjbRefMetaData getEjbRefByName(String name)
/*     */   {
/* 277 */     EJBReferenceMetaData result = ((JBossEnterpriseBeanMetaData)getDelegate()).getEjbReferenceByName(name);
/* 278 */     if (result != null)
/* 279 */       return new EjbRefMetaData(result);
/* 280 */     return null;
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.javaee.spec.EJBReferenceMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.