Package org.jboss.metadata.javaee.spec

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


    public static void handleMethods(DeploymentDescriptorEnvironment env, EEModuleDescription eeModuleDescription, String defaultClassName) throws DeploymentUnitProcessingException {

        final RemoteEnvironment environment = env.getEnvironment();

        // post-construct(s) of the interceptor configured (if any) in the deployment descriptor
        LifecycleCallbacksMetaData postConstructs = environment.getPostConstructs();
        if (postConstructs != null) {
            for (LifecycleCallbackMetaData postConstruct : postConstructs) {
                String className = postConstruct.getClassName();
                if (className == null || className.isEmpty()) {
                    if (defaultClassName == null) {
                        continue;
                    } else {
                        className = defaultClassName;
                    }
                }
                final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                String methodName = postConstruct.getMethodName();
                MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
                builder.setPostConstruct(methodIdentifier);
                eeModuleDescription.addInterceptorMethodOverride(className, builder.build());
            }
        }

        // pre-destroy(s) of the interceptor configured (if any) in the deployment descriptor
        LifecycleCallbacksMetaData preDestroys = environment.getPreDestroys();
        if (preDestroys != null) {
            for (LifecycleCallbackMetaData preDestroy : preDestroys) {
                String className = preDestroy.getClassName();
                if (className == null || className.isEmpty()) {
                    if (defaultClassName == null) {
View Full Code Here


                }
            }
        }

        // post-construct(s) of the interceptor configured (if any) in the deployment descriptor
        LifecycleCallbacksMetaData postConstructs = metaData.getPostConstructs();
        if (postConstructs != null) {
            for (LifecycleCallbackMetaData postConstruct : postConstructs) {
                final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                String methodName = postConstruct.getMethodName();
                MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
                builder.setPostConstruct(methodIdentifier);
                if (postConstruct.getClassName() == null || postConstruct.getClassName().isEmpty()) {
                    final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass.getModuleClass(), methodIdentifier).getDeclaringClass().getName();
                    component.addInterceptorMethodOverride(className, builder.build());
                } else {
                    component.addInterceptorMethodOverride(postConstruct.getClassName(), builder.build());
                }
            }
        }

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

        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

                    }
                }
            }

            // post-construct(s) of the interceptor configured (if any) in the deployment descriptor
            LifecycleCallbacksMetaData postConstructs = interceptor.getPostConstructs();
            if (postConstructs != null) {
                for (LifecycleCallbackMetaData postConstruct : postConstructs) {
                    final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                    String methodName = postConstruct.getMethodName();
                    MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName, InvocationContext.class);
                    builder.setPostConstruct(methodIdentifier);
                    if (postConstruct.getClassName() == null || postConstruct.getClassName().isEmpty()) {
                        eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
                    } else {
                        eeModuleDescription.addInterceptorMethodOverride(postConstruct.getClassName(), builder.build());
                    }
                }
            }

            // pre-destroy(s) of the interceptor configured (if any) in the deployment descriptor
            LifecycleCallbacksMetaData preDestroys = interceptor.getPreDestroys();
            if (preDestroys != null) {
                for (LifecycleCallbackMetaData preDestroy : preDestroys) {
                    final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                    String methodName = preDestroy.getMethodName();
                    MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName, InvocationContext.class);
                    builder.setPreDestroy(methodIdentifier);
                    if (preDestroy.getClassName() == null || preDestroy.getClassName().isEmpty()) {
                        eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
                    } else {
                        eeModuleDescription.addInterceptorMethodOverride(preDestroy.getClassName(), builder.build());
                    }
                }
            }

            // pre-passivates(s) of the interceptor configured (if any) in the deployment descriptor
            LifecycleCallbacksMetaData prePassivates = interceptor.getPrePassivates();
            if (prePassivates != null) {
                for (LifecycleCallbackMetaData prePassivate : prePassivates) {
                    final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                    String methodName = prePassivate.getMethodName();
                    MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName, InvocationContext.class);
                    builder.setPrePassivate(methodIdentifier);
                    if (prePassivate.getClassName() == null || prePassivate.getClassName().isEmpty()) {
                        eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
                    } else {
                        eeModuleDescription.addInterceptorMethodOverride(prePassivate.getClassName(), builder.build());
                    }
                }
            }

            // pre-passivates(s) of the interceptor configured (if any) in the deployment descriptor
            LifecycleCallbacksMetaData postActivates = interceptor.getPostActivates();
            if (postActivates != null) {
                for (LifecycleCallbackMetaData postActivate : postActivates) {
                    final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                    String methodName = postActivate.getMethodName();
                    MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName, InvocationContext.class);
View Full Code Here

    */
   private void processPostConstructs() throws ClassNotFoundException, SecurityException, NoSuchMethodException
   {
      processPostConstructs(mainClass);
     
      LifecycleCallbacksMetaData callbacks = xml.getPostConstructs();
      if(callbacks != null)
      {
         for(LifecycleCallbackMetaData callback : callbacks)
         {
            String className = callback.getClassName();
View Full Code Here

                        interceptorDescription.addAroundInvokeMethod(aroundInvokeMethodDescription);
                    }
                }

                // post-construct(s) of the interceptor configured (if any) in the deployment descriptor
                LifecycleCallbacksMetaData postConstructs = interceptor.getPostConstructs();
                if (postConstructs != null) {
                    for (LifecycleCallbackMetaData postConstruct : postConstructs) {
                        String methodName = postConstruct.getMethodName();
                        MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(Void.TYPE, methodName, new Class<?>[]{InvocationContext.class});
                        // TODO: This constructor for InterceptorMethodDescription needs a review. How does one get hold of the "declaraingClass"
                        // for a DD based interceptor configuration. Why not just specify the instance class and then "find" the correct method
                        // internally
                        InterceptorMethodDescription postConstructInterceptor = new InterceptorMethodDescription(interceptor.getInterceptorClass(), interceptor.getInterceptorClass(), methodIdentifier, false);
                        // add it to the interceptor description
                        interceptorDescription.addPostConstructMethod(postConstructInterceptor);
                    }
                }

                // pre-destroy(s) of the interceptor configured (if any) in the deployment descriptor
                LifecycleCallbacksMetaData preDestroys = interceptor.getPreDestroys();
                if (preDestroys != null) {
                    for (LifecycleCallbackMetaData preDestroy : preDestroys) {
                        String methodName = preDestroy.getMethodName();
                        MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(Void.TYPE, methodName, new Class<?>[]{InvocationContext.class});
                        // TODO: This constructor for InterceptorMethodDescription needs a review. How does one get hold of the "declaraingClass"
View Full Code Here

            return;
        }
        final ClassIndex componentClass = classIndex.classIndex(component.getComponentClassName());

        // post-construct(s) of the interceptor configured (if any) in the deployment descriptor
        LifecycleCallbacksMetaData postConstructs = environment.getPostConstructs();
        if (postConstructs != null) {
            for (LifecycleCallbackMetaData postConstruct : postConstructs) {
                final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                String methodName = postConstruct.getMethodName();
                MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
                builder.setPostConstruct(methodIdentifier);
                if (postConstruct.getClassName() == null || postConstruct.getClassName().isEmpty()) {
                    final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass.getModuleClass(), methodIdentifier).getDeclaringClass().getName();
                    component.addInterceptorMethodOverride(className, builder.build());
                } else {
                    component.addInterceptorMethodOverride(postConstruct.getClassName(), builder.build());
                }
            }
        }

        // pre-destroy(s) of the interceptor configured (if any) in the deployment descriptor
        LifecycleCallbacksMetaData preDestroys = environment.getPreDestroys();
        if (preDestroys != null) {
            for (LifecycleCallbackMetaData preDestroy : preDestroys) {
                final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
                String methodName = preDestroy.getMethodName();
                MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
View Full Code Here

                        interceptorDescription.addAroundInvokeMethod(aroundInvokeMethodDescription);
                    }
                }

                // post-construct(s) of the interceptor configured (if any) in the deployment descriptor
                LifecycleCallbacksMetaData postConstructs = interceptor.getPostConstructs();
                if (postConstructs != null) {
                    for (LifecycleCallbackMetaData postConstruct : postConstructs) {
                        String methodName = postConstruct.getMethodName();
                        MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(Void.TYPE, methodName, new Class<?>[]{InvocationContext.class});
                        // TODO: This constructor for InterceptorMethodDescription needs a review. How does one get hold of the "declaraingClass"
                        // for a DD based interceptor configuration. Why not just specify the instance class and then "find" the correct method
                        // internally
                        InterceptorMethodDescription postConstructInterceptor = new InterceptorMethodDescription(interceptor.getInterceptorClass(), interceptor.getInterceptorClass(), methodIdentifier, false);
                        // add it to the interceptor description
                        interceptorDescription.addPostConstruct(postConstructInterceptor);
                    }
                }

                // pre-destroy(s) of the interceptor configured (if any) in the deployment descriptor
                LifecycleCallbacksMetaData preDestroys = interceptor.getPreDestroys();
                if (preDestroys != null) {
                    for (LifecycleCallbackMetaData preDestroy : preDestroys) {
                        String methodName = preDestroy.getMethodName();
                        MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(Void.TYPE, methodName, new Class<?>[]{InvocationContext.class});
                        // TODO: This constructor for InterceptorMethodDescription needs a review. How does one get hold of the "declaraingClass"
View Full Code Here

   {
      // Setup meta data
      LifecycleCallbackMetaData postConstruct = new LifecycleCallbackMetaData();
      postConstruct.setMethodName("otherPostConstruct");
     
      LifecycleCallbacksMetaData postConstructs = new LifecycleCallbacksMetaData();
      postConstructs.add(postConstruct);
     
      JBossEnvironmentRefsGroupMetaData env = new JBossEnvironmentRefsGroupMetaData();
      env.setPostConstructs(postConstructs);
     
      JBossSessionBeanMetaData beanMetaData = new JBossSessionBeanMetaData();
View Full Code Here

   }
  
   @XmlTransient
   public LifecycleCallbacksMetaData getPostConstructs()
   {
      LifecycleCallbacksMetaData lcs = null;
      if(jndiEnvironmentRefsGroup != null)
         lcs = jndiEnvironmentRefsGroup.getPostConstructs();
      return lcs;
   }
View Full Code Here

   }

   @XmlTransient
   public LifecycleCallbacksMetaData getPreDestroys()
   {
      LifecycleCallbacksMetaData lcs = null;
      if(jndiEnvironmentRefsGroup != null)
         lcs = jndiEnvironmentRefsGroup.getPreDestroys();
      return lcs;
   }
View Full Code Here

TOP

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

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.