Package org.jboss.metadata.ejb.spec

Examples of org.jboss.metadata.ejb.spec.SessionBeanMetaData


    protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final SessionBeanComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {

        if (componentConfiguration.getDescriptorData() == null) {
            return;
        }
        SessionBeanMetaData sessionBeanMetaData = componentConfiguration.getDescriptorData();
        if (sessionBeanMetaData instanceof SessionBean31MetaData) {
            SessionBean31MetaData descriptor = (SessionBean31MetaData) sessionBeanMetaData;

            //handle lock
            if (descriptor.getLockType() != null) {
View Full Code Here


    }

    @Override
    protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final SessionBeanComponentDescription description) throws DeploymentUnitProcessingException {
        final SessionBeanMetaData data = description.getDescriptorData();
        if (data != null) {
            if (data instanceof SessionBean31MetaData) {
                final SessionBean31MetaData sessionBeanData = (SessionBean31MetaData) data;
                final AsyncMethodsMetaData asyn = sessionBeanData.getAsyncMethods();
                if (asyn != null) {
View Full Code Here

        }

    }

    protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final StatefulComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
        SessionBeanMetaData beanMetaData = componentConfiguration.getDescriptorData();
        if (beanMetaData == null) {
            return;
        }
        if (beanMetaData.getRemoveMethods() == null || beanMetaData.getRemoveMethods().isEmpty()) {
            return;
        }

        final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);

        //We loop through twice, as the more more general form with no parameters is applied to all methods with that name
        //while the method that specifies the actual parameters override this
        for (final RemoveMethodMetaData removeMethod : beanMetaData.getRemoveMethods()) {
            if(removeMethod.getBeanMethod().getMethodParams() == null) {
                final NamedMethodMetaData methodData = removeMethod.getBeanMethod();
                final Collection<Method> methods = MethodResolutionUtils.resolveMethods(methodData, componentClass, reflectionIndex);
                for(Method method : methods) {
                    componentConfiguration.addRemoveMethod(MethodIdentifier.getIdentifierForMethod(method), removeMethod.isRetainIfException());
                }
            }
        }
        for (final RemoveMethodMetaData removeMethod : beanMetaData.getRemoveMethods()) {
            if(removeMethod.getBeanMethod().getMethodParams() != null) {
                final NamedMethodMetaData methodData = removeMethod.getBeanMethod();
                final Collection<Method> methods = MethodResolutionUtils.resolveMethods(methodData, componentClass, reflectionIndex);
                for(Method method : methods) {
                    componentConfiguration.addRemoveMethod(MethodIdentifier.getIdentifierForMethod(method), removeMethod.isRetainIfException());
View Full Code Here

            try
            {
               Class<?> ejbClass = classLoader.loadClass(bean.getEjbClass());
               if (bean.isSession())
               {
                  SessionBeanMetaData sb = (SessionBeanMetaData) bean;
                  JBossSessionBeanMetaData sessionBean = new JBossSessionBeanMetaData();
                  sessionBean.setEjbName(sb.getEjbName());
                  sessionBean.setEjbClass(sb.getEjbClass());

                  if (sb.isStateful())
                  {
                     StatefulProcessor processor = new StatefulProcessor(finder);
                     sessionBean.setSessionType(SessionType.Stateful);
                     processor.process(metaData, sessionBean, ejbClass);
                  }
View Full Code Here

      assertNotNull(jarMD);
      EnterpriseBeanMetaData beanMD = jarMD.getEnterpriseBean("MyStatelessBean");
      assertNotNull(beanMD);
      assertEquals(true, beanMD.isSession());
      assertTrue(beanMD instanceof SessionBeanMetaData);
      SessionBeanMetaData sbeanMD = (SessionBeanMetaData) beanMD;
      assertEquals(SessionType.Stateless, sbeanMD.getSessionType());
      AnnotatedEJBReferencesMetaData aejbRefs = sbeanMD.getAnnotatedEjbReferences();
      assertNotNull(aejbRefs);
      assertEquals(2, aejbRefs.size());
      getLog().debug(aejbRefs);
      AnnotatedEJBReferenceMetaData injectedField = aejbRefs.get("injectedField");
      assertNotNull(injectedField);
      assertEquals(MyStatelessLocal.class, injectedField.getBeanInterface());

      ResourceReferencesMetaData resRefs = sbeanMD.getResourceReferences();
      //
      assertEquals(3, resRefs.size());
      ResourceReferenceMetaData homePageRef = resRefs.get(MyStatelessBean.class.getName() + "/homePage");
      assertNotNull(homePageRef);
      assertEquals("java.net.URL", homePageRef.getType());
      Set<ResourceInjectionTargetMetaData> homePageRefTargets = homePageRef.getInjectionTargets();
      assertEquals(1, homePageRefTargets.size());
      ResourceInjectionTargetMetaData homePageRefTarget = homePageRefTargets.iterator().next();
      assertEquals("org.jboss.test.metadata.annotation.ejb3.MyStatelessBean", homePageRefTarget.getInjectionTargetClass());
      assertEquals("setHomePage", homePageRefTarget.getInjectionTargetName());
      ResourceReferenceMetaData googleHome = resRefs.get("googleHome");
      assertNotNull(googleHome);
      assertEquals("java.net.URL", googleHome.getType());
      assertEquals("http://www.google.com", googleHome.getMappedName());
      ResourceReferenceMetaData defaultDS = resRefs.get("jdbc/ds");
      assertNotNull(defaultDS);
      assertEquals("javax.sql.DataSource", defaultDS.getType());
      assertEquals("java:/DefaultDS", defaultDS.getMappedName());

      ResourceEnvironmentReferencesMetaData resEnvRefs = sbeanMD.getResourceEnvironmentReferences();
      assertEquals(1, resEnvRefs.size());
      ResourceEnvironmentReferenceMetaData contextRef = resEnvRefs.get(sbeanMD.getEjbClass() + "/context");
      assertNotNull(contextRef);
      assertEquals("javax.ejb.SessionContext", contextRef.getType());
      Set<ResourceInjectionTargetMetaData> contextRefTargets = contextRef.getInjectionTargets();
      assertEquals(1, contextRefTargets.size());
      ResourceInjectionTargetMetaData contextRefTarget = contextRefTargets.iterator().next();
      assertEquals("org.jboss.test.metadata.annotation.ejb3.MyStatelessBean", contextRefTarget.getInjectionTargetClass());
      assertEquals("context", contextRefTarget.getInjectionTargetName());

      EnvironmentEntriesMetaData envEntries = sbeanMD.getEnvironmentEntries();
      assertEquals(2, envEntries.size());
      EnvironmentEntryMetaData pi = envEntries.get(sbeanMD.getEjbClass() + "/pi");
      assertEquals("3.14159", pi.getValue());
      // TODO: should this be java.lang.Double?
      assertEquals("double", pi.getType());

      MessageDestinationReferencesMetaData msgRefs = sbeanMD.getMessageDestinationReferences();
      assertEquals(1, msgRefs.size());
      MessageDestinationReferenceMetaData mailQueue = msgRefs.get(sbeanMD.getEjbClass() + "/mailQueue");
      assertNotNull(mailQueue);
      assertEquals("javax.jms.Queue", mailQueue.getType());
   }
View Full Code Here

   {
      // Obtain Metadata
      EjbJar3xMetaData result = unmarshal();

      // Get metadata for our bean
      SessionBeanMetaData metaData = (SessionBeanMetaData) result.getEnterpriseBeans().get(
            "MultipleBusinessInterfacesBean");
      BusinessRemotesMetaData businessRemotesMetaData = metaData.getBusinessRemotes();
      BusinessLocalsMetaData businessLocalsMetaData = metaData.getBusinessLocals();
     
      // Ensure 2 business interfaces are defined for each local and remote
      assertTrue(businessRemotesMetaData.size()==2);
      assertTrue(businessLocalsMetaData.size()==2);
   }
View Full Code Here

            }
        }

        if (component.isStateful()) {

            final SessionBeanMetaData sessionBeanMetadata = (SessionBeanMetaData) metaData;
            // pre-passivate(s) of the interceptor configured (if any) in the deployment descriptor
            final LifecycleCallbacksMetaData prePassivates = sessionBeanMetadata.getPrePassivates();
            if (prePassivates != null) {
                for (final LifecycleCallbackMetaData prePassivate : prePassivates) {
                    final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                    final String methodName = prePassivate.getMethodName();
                    final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
                    builder.setPrePassivate(methodIdentifier);
                    if (prePassivate.getClassName() == null || prePassivate.getClassName().isEmpty()) {
                        final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass.getModuleClass(), methodIdentifier).getDeclaringClass().getName();
                        component.addInterceptorMethodOverride(className, builder.build());
                    } else {
                        component.addInterceptorMethodOverride(prePassivate.getClassName(), builder.build());
                    }
                }
            }

            final LifecycleCallbacksMetaData postActivates = sessionBeanMetadata.getPostActivates();
            if (postActivates != null) {
                for (final LifecycleCallbackMetaData postActivate : postActivates) {
                    final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                    final String methodName = postActivate.getMethodName();
                    final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
View Full Code Here

    protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final SessionBeanComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {

        if (componentConfiguration.getDescriptorData() == null) {
            return;
        }
        SessionBeanMetaData sessionBeanMetaData = componentConfiguration.getDescriptorData();
        if (sessionBeanMetaData instanceof SessionBean31MetaData) {
            SessionBean31MetaData descriptor = (SessionBean31MetaData) sessionBeanMetaData;

            //handle lock
            if (descriptor.getLockType() != null) {
View Full Code Here

            description.setAfterCompletion(classIndex.getMethod(void.class, "afterCompletion", boolean.class));
            description.setBeforeCompletion(classIndex.getMethod(void.class,"beforeCompletion"));
            return;
        }

        SessionBeanMetaData data = description.getDescriptorData();
        if (data instanceof SessionBean31MetaData) {
            SessionBean31MetaData metaData = (SessionBean31MetaData) data;
            if (metaData.getAfterBeginMethod() != null)
                description.setAfterBegin(MethodResolutionUtils.resolveMethod(metaData.getAfterBeginMethod(), componentClass,reflectionIndex));
            if (metaData.getAfterCompletionMethod() != null)
View Full Code Here

                    }
                }
            }
        }
        //now allow the annotations to be overridden by the DD
        final SessionBeanMetaData descriptorData = description.getDescriptorData();
        if (descriptorData != null) {

            if (descriptorData.getHome() != null) {
                home = descriptorData.getHome();
            }
            if (descriptorData.getLocalHome() != null) {
                localHome = descriptorData.getLocalHome();
            }
        }
        if (localHome != null) {
            description.addLocalHome(localHome);
        }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.ejb.spec.SessionBeanMetaData

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.