Package org.ow2.asm.commons

Examples of org.ow2.asm.commons.AdviceAdapterUnitTest$B


        for (ICommonMethodMetadata<?, ?, ?> postConstructMethodMetadata : postConstructMethods) {
            Method postConstructMethod = null;
            try {
                postConstructMethod = clazz.getDeclaredMethod(postConstructMethodMetadata.getJMethod().getName());
            } catch (NoSuchMethodException e) {
                throw new ArchiveInjectionException("Cannot invoke postconstruct method", e);
            }

            boolean accessible = postConstructMethod.isAccessible();
            try {
                postConstructMethod.setAccessible(true);
                postConstructMethod.invoke(instance);
            } catch (IllegalAccessException e) {
                throw new ArchiveInjectionException("Cannot invoke postconstruct method", e);
            } catch (InvocationTargetException e) {
                throw new ArchiveInjectionException("Cannot invoke postconstruct method", e);
            } finally {
                postConstructMethod.setAccessible(accessible);
            }
        }
View Full Code Here


            // OK, now that JNDI name is here, get value
            try {
                value = new InitialContext().lookup(jndiName);
            } catch (NamingException e) {
                throw new ArchiveInjectionException("Cannot get object with JNDI Name '" + jndiName + "' for ejb '" + ejb
                        + "'.", e);
            }
        }

        // Set value
View Full Code Here

        // No value, needs to find it
        if (value == null) {
            try {
                value = new InitialContext().lookup(name);
            } catch (NamingException e) {
                throw new ArchiveInjectionException("Cannot get object with JNDI Name '" + name + "' for Resource '"
                        + jJavaxPersistenceUnit + "'.", e);
            }
        }

        // Set value
View Full Code Here

            // OK, now that JNDI name is here, get value
            try {
                value = new InitialContext().lookup(mappedName);
            } catch (NamingException e) {
                throw new ArchiveInjectionException("Cannot get object with JNDI Name '" + mappedName + "' for Resource '"
                        + jAnnotationResource + "'.", e);
            }
        }

        // Set value
View Full Code Here

            // Set value
            try {
                method.invoke(instance, value);
            } catch (IllegalAccessException e) {
                throw new ArchiveInjectionException("Cannot set given value on the method '" + jMethod + "'.", e);
            } catch (IllegalArgumentException e) {
                throw new ArchiveInjectionException("Cannot set given value on the method '" + jMethod + "'.", e);
            } catch (InvocationTargetException e) {
                throw new ArchiveInjectionException("Cannot set given value on the method '" + jMethod + "'.", e);
            }
        } finally {
            // set back accessible attribute
            method.setAccessible(accessible);
        }
View Full Code Here

        JField jField = fieldMetadata.getJField();
        Field field = null;
        try {
            field = clazz.getDeclaredField(jField.getName());
        } catch (NoSuchFieldException e) {
            throw new ArchiveInjectionException("Cannot get field '" + jField + "' on the class '" + clazz.getName() + "'", e);
        }

        // if instance is null, we're using static injection.
        // But check that in this case, the field is a static field !
        int modifier = field.getModifiers();
        if (!Modifier.isStatic(modifier)) {
            logger.error("The field ''{0}'' of the class ''{1}'' is not a static field and as the injection is being done in a static way, this field won't be defined !",
                            field, clazz);
            return;
        }


        boolean accessible = field.isAccessible();
        try {
            // needs to be allowed to change value of the field
            field.setAccessible(true);

            // Set value
            try {
                field.set(instance, value);
            } catch (IllegalAccessException e) {
                throw new ArchiveInjectionException("Cannot set given value on the field '" + jField + "'.", e);
            }
        } finally {
            // set back accessible attribute
            field.setAccessible(accessible);
        }
View Full Code Here

            Object o = null;
            try {
                o = new InitialContext().lookup("EZB_Remote_JNDIResolver");
            } catch (NamingException e) {
                // No Remote JNDI resolver, so throws exception
                throw new ArchiveInjectionException("No Remote EJB3 JNDI Resolver found", e);
            }

            // Object is here, so we can cast it
            this.jndiResolver = (EZBRemoteJNDIResolver) PortableRemoteObject.narrow(o, EZBRemoteJNDIResolver.class);
        }
View Full Code Here

        List<EZBJNDIData> jndiDataList = null;
        try {
            jndiDataList = getJNDIResolver().getMessageDestinationJNDINames(messageDestinationName);
        } catch (RemoteException re) {
            // No Remote JNDI resolver, so throw first exception
            throw new ArchiveInjectionException("Unable to get JNDI Name for '" + messageDestinationName + "'", re);
        }

        // Data is here, check if it is empty or not
        if (jndiDataList.size() == 0) {
            throw new ArchiveInjectionException("Unable to get JNDI Name for message destination '" + messageDestinationName
                    + "', no data was found on the remote side.");
        } else if (jndiDataList.size() > 1) {
            // too many entries
            logger.warn("There may be a problem for message destination '" + messageDestinationName + "', too many answers : '"
                    + jndiDataList + "'. Using the first entry");
View Full Code Here

        List<EZBJNDIBeanData> jndiDataList = null;
        try {
            jndiDataList = getJNDIResolver().getEJBJNDINames(interfaceName, beanName);
        } catch (RemoteException re) {
            // No Remote JNDI resolver, so throw first exception
            throw new ArchiveInjectionException("Unable to get JNDI Name for '" + interfaceName + "'/'" + beanName + "'", re);
        }

        // Data is here, check if it is empty or not
        if (jndiDataList.size() == 0) {
            throw new ArchiveInjectionException("Unable to get JNDI Name for '" + interfaceName + "'/'" + beanName
                    + "', no data was found on the remote side.");
        } else if (jndiDataList.size() > 1) {
            // too many entries
            logger.warn("There may be a problem for bean '" + interfaceName + "'/'" + beanName + "', too many answers : '"
                    + jndiDataList + "'. Using the first entry");
View Full Code Here

        // Create classloader with these URLs
        URL[] arrayURLs = urls.toArray(new URL[urls.size()]);

        // Child of the EAR classloader with RARs
        ClassLoader ejbClassLoader = new EasyBeansClassLoader(arrayURLs, earClassLoader);

        // Get Persistence unit manager
        PersistenceUnitManager persistenceUnitManager = getPersistenceUnitManager(earDeployable, ejbClassLoader);

        // Get Extra libraries
View Full Code Here

TOP

Related Classes of org.ow2.asm.commons.AdviceAdapterUnitTest$B

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.