Package org.ow2.easybeans.component.itf

Examples of org.ow2.easybeans.component.itf.EZBStatisticComponent


        // 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

            if (this.warService == null) {
                logger.warn("There are WAR files in the EAR ''{0}'' but the 'web' service is not available", earDeployable);
            } else {

                // Build context for sending parameters
                Context ctx = new ContextImpl(earURL.toExternalForm());
                try {
                    ctx.rebind("earURL", earURL);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the EAR URL parameter '" + earURL + "'", e);
                }
                // Get URLS of the wars and context-root
                List<URL> urls = new LinkedList<URL>();
                List<String> ctxRoots = new LinkedList<String>();
                for (WARDeployable warDeployable : wars) {

                    // URL
                    URL url = null;
                    try {
                        url = warDeployable.getArchive().getURL();
                    } catch (ArchiveException e) {
                        throw new DeployerException("Cannot get the URL for the archive '" + warDeployable.getArchive() + "'",
                                e);
                    }
                    urls.add(url);

                    // Context-root
                    ctxRoots.add(warDeployable.getContextRoot());

                }
                try {
                    ctx.rebind("urls", urls.toArray(new URL[urls.size()]));
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the urls parameter '" + urls + "'", e);
                }

                // Bind the parent classloader of the web application
                try {
                    ctx.rebind("parentClassLoader", parentClassLoader);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the parentClassLoader parameter '" + parentClassLoader + "'", e);
                }

                // Bind the earClassLoader of the web application
                try {
                    ctx.rebind("earClassLoader", earClassLoader);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the earClassLoader parameter '" + earClassLoader + "'", e);
                }

                // No alt-dd yet, give an empty array
                try {
                    ctx.rebind("altDDs", new URL[urls.size()]);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the altDDs parameter.'", e);
                }

                // Build context roots
                try {
                    ctx.rebind("contextRoots", ctxRoots.toArray(new String[ctxRoots.size()]));
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the contextRoots parameter '" + urls + "'", e);
                }

                try {
View Full Code Here

        List<RARDeployable> rars = earDeployable.getRARDeployables();
        if (rars.size() > 0) {
            if (this.rarService == null) {
                logger.warn("There are RAR files in the EAR ''{0}'' but the resource service is not available", earDeployable);
            } else {
                Context ctx = new ContextImpl(earURL.toExternalForm());
                try {
                    ctx.rebind("earUrl", earURL);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the EAR URL parameter '" + earURL + "'", e);
                }
                List<URL> urls = new ArrayList<URL>();
                for (RARDeployable rarDeployable : rars) {
                    try {
                        urls.add(rarDeployable.getArchive().getURL());
                    } catch (ArchiveException e) {
                        throw new DeployerException("Cannot get the URL for the archive '" + rarDeployable.getArchive() + "'",
                                e);
                    }
                }
                try {
                    ctx.rebind("urls", urls.toArray(new URL[urls.size()]));
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the urls parameter '" + urls + "'", e);
                }
                try {
                    ctx.rebind("earClassLoader", earClassLoader);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the earClassLoader parameter '" + earClassLoader + "'", e);
                }
                try {
                    ctx.rebind("altDDs", new URL[urls.size()]);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the altDDs parameter.'", e);
                }

                try {
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.component.itf.EZBStatisticComponent

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.