Package org.ow2.util.ee.metadata.common.api.struct

Examples of org.ow2.util.ee.metadata.common.api.struct.IJEjbEJB


        // Now, search the MBean of this context
        ObjectName contextObjectName = null;
        try {
            contextObjectName = new ObjectName(buildObjectName(warDeployable));
        } catch (MalformedObjectNameException e) {
            throw new DeployerException("Cannot get the ObjectName for the WAR deployable '" + warDeployable + "'.", e);
        } catch (NullPointerException e) {
            throw new DeployerException("Cannot get the ObjectName for the WAR deployable '" + warDeployable + "'.", e);
        }

        // Now, search if the MBean of this context is present
        try {
            if (!MBeanServerHelper.getMBeanServerServer().isRegistered(contextObjectName)) {
                throw new DeployerException("There is no MBean with the ObjectName '" + contextObjectName
                        + "' in the MBean Server for the WAR deployable '" + warDeployable + "'.");
            }
        } catch (JMXRemoteException e) {
            throw new DeployerException("Cannot check if the MBean with the ObjectName '" + contextObjectName
                    + "'is registered in the MBean Server for the WAR deployable '" + warDeployable + "'.");
        }

        // Undeploy
        try {
            MBeanServerHelper.getMBeanServerServer().invoke(contextObjectName, DESTROY_OPERATION, null, null);
        } catch (InstanceNotFoundException e) {
            throw new DeployerException("Cannot remove the context '" + contextRoot + "' of the war deployable '"
                    + warDeployable + "'.", e);
        } catch (MBeanException e) {
            throw new DeployerException("Cannot remove the context '" + contextRoot + "' of the war deployable '"
                    + warDeployable + "'.", e);
        } catch (ReflectionException e) {
            throw new DeployerException("Cannot remove the context '" + contextRoot + "' of the war deployable '"
                    + warDeployable + "'.", e);
        } catch (JMXRemoteException e) {
            throw new DeployerException("Cannot remove the context '" + contextRoot + "' of the war deployable '"
                    + warDeployable + "'.", e);
        }

        logger.info("The context ''{0}'' of the War ''{1}'' has been undeployed", contextRoot, warDeployable);
    }
View Full Code Here


        // Build Engine object name
        ObjectName engineObjectName = null;
        try {
            engineObjectName = new ObjectName(ENGINE_OBJECT_NAME);
        } catch (MalformedObjectNameException e) {
            throw new DeployerException("Cannot build Tomcat Engine MBean.", e);
        } catch (NullPointerException e) {
            throw new DeployerException("Cannot build Tomcat Engine MBean.", e);
        }

        // Ask the MBean server
        Set<ObjectName> objectNames = null;
        try {
            // Get the list
            objectNames = MBeanServerHelper.getMBeanServerServer().queryNames(engineObjectName, null);
        } catch (JMXRemoteException e) {
            throw new DeployerException("Cannot get Tomcat Engine MBean.", e);
        }

        // Find objects ?
        if (objectNames.size() == 0) {
            throw new DeployerException("No Tomcat Engine MBean was found in the MBean server");
        }

        // Return the domain of this object name
        return (objectNames.iterator().next());
    }
View Full Code Here

    private String getDefaultHost() throws DeployerException {
        ObjectName engineObjectName = getEngineObjectName();
        try {
            return MBeanServerHelper.getMBeanServerServer().getAttribute(engineObjectName, "defaultHost").toString();
        } catch (AttributeNotFoundException e) {
            throw new DeployerException("Cannot get the default host on the object name '" + engineObjectName + "'.", e);
        } catch (InstanceNotFoundException e) {
            throw new DeployerException("Cannot get the default host on the object name '" + engineObjectName + "'.", e);
        } catch (MBeanException e) {
            throw new DeployerException("Cannot get the default host on the object name '" + engineObjectName + "'.", e);
        } catch (ReflectionException e) {
            throw new DeployerException("Cannot get the default host on the object name '" + engineObjectName + "'.", e);
        } catch (JMXRemoteException e) {
            throw new DeployerException("Cannot get the default host on the object name '" + engineObjectName + "'.", e);
        }
    }
View Full Code Here

        }

        // Client Archive ?
        if (CARDeployable.class.isInstance(deployable)) {
            // Create metadata
            ICarDeployableMetadata carDeployableMetadata = null;
            try {
                carDeployableMetadata = new CarDeployableMetadataFactory().createDeployableMetadata(CARDeployable.class
                        .cast(deployable), classLoader);
            } catch (DeployableMetadataException e) {
                throw new ArchiveInjectionException("Unable to get metadata on archive '" + this.archive + "'.", e);
            }

            // Use only common part
            this.metadataCollection = carDeployableMetadata.getCarClassMetadataCollection();
        } else {
            // TODO : adapt for other archives
            throw new UnsupportedOperationException("Can only manage injection for Client Deployable. Deployable found is '"
                    + deployable + "'.");
        }
View Full Code Here

        // Client Archive ?
        if (CARDeployable.class.isInstance(deployable)) {
            // Create metadata
            ICarDeployableMetadata carDeployableMetadata = null;
            try {
                carDeployableMetadata = new CarDeployableMetadataFactory().createDeployableMetadata(CARDeployable.class
                        .cast(deployable), classLoader);
            } catch (DeployableMetadataException e) {
                throw new ArchiveInjectionException("Unable to get metadata on archive '" + this.archive + "'.", e);
            }
View Full Code Here

            // inject field
            injectEJB(jejb, sharedMetadata, clazz, instance);
        }

        // Inject Resources
        IJAnnotationResource jAnnotationResource = sharedMetadata.getJAnnotationResource();
        if (jAnnotationResource != null) {
            // Update interface name
            jAnnotationResource.setType(getInterfaceName(sharedMetadata));

            // inject field
            injectResource(jAnnotationResource, sharedMetadata, clazz, instance);
        }
View Full Code Here

            throws ArchiveInjectionException {



        // Inject EJB
        IJEjbEJB jejb = sharedMetadata.getJEjbEJB();
        if (jejb != null) {
            // Update interface name
            jejb.setBeanInterface(getInterfaceName(sharedMetadata));

            // inject field
            injectEJB(jejb, sharedMetadata, clazz, instance);
        }
View Full Code Here

            // EJBs
            EZBJNDIResolver jndiResolver = this.injectionHolder.getJNDIResolver();
            if (jndiResolver != null) {
                for (IENCBinding<IJEjbEJB> binding : this.encBindingHolder.getEJBBindings()) {
                    String encName = binding.getName();
                    IJEjbEJB jEjbEJB = binding.getValue();
                    String interfaceName = jEjbEJB.getBeanInterface();
                    String beanName = jEjbEJB.getBeanName();

                    String jndiName;
                    try {
                        jndiName = jndiResolver.getEJBJNDIUniqueName(interfaceName, beanName);
View Full Code Here

            for (IJEjbEJB jEJB : jEjbs) {
                bindClassEJB(jEJB, mv);
            }
        }
        // &#64;EJB annotation
        IJEjbEJB jEJB = this.classAnnotationMetadata.getJEjbEJB();
        if (jEJB != null) {
            // For each ejb, do :
            bindClassEJB(jEJB, mv);
        }
View Full Code Here

                javaxPersistenceUnit.setName(getJndiName(javaxPersistenceUnit.getName(), fieldMetaData));
                bindClassPersistenceUnit(javaxPersistenceUnit, mv);
            }

            // &#64;EJB annotation
            IJEjbEJB jEjb = fieldMetaData.getJEjbEJB();
            if (jEjb != null) {
                // validate
                validateAccessFieldAnnotation(fieldMetaData);

                logger.debug("Add injection for EJB on attribute {0} of class {1}", fieldMetaData.getFieldName(),
                        this.classAnnotationMetadata.getClassName());

                // Gets the JNDI Resolver
                EZBContainerJNDIResolver containerJNDIResolver = (EZBContainerJNDIResolver) this.map
                        .get(EZBContainerJNDIResolver.class.getName());

                // ejbName ?
                String beanName = jEjb.getBeanName();

                // JNDI name
                String jndiName = null;

                // Mapped Name ? if not null, use it as JNDI name
                String mappedName = jEjb.getMappedName();
                if (mappedName != null && !mappedName.equals("")) {
                    jndiName = mappedName;
                }

                // JNDI name still null, ask the JNDI resolver
                if (jndiName == null) {
                    try {
                        jndiName = containerJNDIResolver.getEJBJNDIUniqueName(itfName, beanName);
                    } catch (EZBJNDIResolverException e) {
                        logger.error("No jndi name found on class {0} for interface {1} and beanName {2}",
                                this.classAnnotationMetadata.getClassName(), itfName, beanName);
                    }
                }

                // JNDI name not null
                if (jndiName != null) {
                    logger.debug("Result of Asking jndi name on class {0} for interface {1} and beanName {2}. Result = {3}",
                            this.classAnnotationMetadata.getClassName(), itfName, beanName, jndiName);
                    callAttributeJndi(jndiName, typeInterface, mv, fieldMetaData, this.classAnnotationMetadata
                            .getClassName(), REGISTRY);
                    callBindAttributeJndi(jEjb.getName(), jndiName, mv, fieldMetaData);
                }


            }
View Full Code Here

TOP

Related Classes of org.ow2.util.ee.metadata.common.api.struct.IJEjbEJB

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.