Package org.ow2.util.ee.deploy.api.deployer

Examples of org.ow2.util.ee.deploy.api.deployer.IDeployerManager


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

        // Add the configuration URL to the existing list
        this.embedded = new Embedded();
        this.embedded.getServerConfig().getConfigurationURLs().add(xmlConfigurationURL);

        // Use JOnAS deployer
        IDeployerManager deployerManager = new DeployerManager();
        this.embedded.setDeployerManager(deployerManager);
        try {
            JOnASDeployer deployer = new JOnASDeployer();
            deployer.setEmbedded(this.embedded);
            deployerManager.register(deployer);
        } catch (DeployerException e) {
            throw new ResourceAdapterInternalException("Cannot register the JOnAS deployer", e);
        }

View Full Code Here

    public void start() {
        logger.info("Configuring EasyBeans for Web Container type ''{0}''", this.containerType);

        // Create embedded instance
        this.embedded = new Embedded();
        IDeployerManager deployerManager = new DeployerManager();
        this.embedded.setDeployerManager(deployerManager);

        AbsDeployer deployer = null;

        // Register the deployers
        switch (this.containerType) {
        // Use Tomcat deployer if it is Tomcat
        case TOMCAT6:
            try {
                deployer = new Tomcat6Deployer();
            } catch (DeployerException e) {
                logger.warn("Unable to set Tomcat6 deployer.", e);
            }
            break;
        case JETTY6:
            try {
                JettyDeployer.setContextEvent(this.servletContextEvent);
                deployer = new JettyDeployer();
            } catch (DeployerException e) {
                logger.warn("Unable to set the servlet context event on the jetty deployer."
                        + "The default deployer will be used.", e);
            }
            break;
        case JETTY7:
            try {
                deployer = new Jetty7Deployer(this.servletContextEvent);
            } catch (DeployerException e) {
                logger.warn("Unable to set the servlet context event on the jetty deployer."
                        + "The default deployer will be used.", e);
            }
            break;
        case UNKNOWN:
        default:
            logger.info("Using default deployer as the web container has not be detected");
        deployer = new EasyBeansDeployer();
            break;

        }
        // reset the deployer
        deployer.setEmbedded(this.embedded);
        deployerManager.register(deployer);

        // user configuration ?
        URL xmlConfigurationURL = Thread.currentThread().getContextClassLoader().getResource(EasyBeans.USER_XML_FILE);

        if (xmlConfigurationURL == null) {
View Full Code Here

     * Deploy an EJB or an EAR.
     * If deployable file is already deployed, redeploy the file.
     * @param filename A deployable
     */
    public void deployArchive(final String filename) {
        IDeployerManager deployer = this.server.getDeployerManager();
        if (deployer != null) {
            File file = new File(filename);
            try {
                IArchive archive = removeArchiveIfDeployed(file);

                if (archive != null) {
                    IDeployable deployable = DeployableHelper.getDeployable(archive);
                    if (deployable instanceof EJBDeployable || deployable instanceof EARDeployable) {
                        deployer.deploy(deployable);
                    } else {
                        logger.warn("Archive \"" + file.getName() + "\" not available.");
                    }
                }
            } catch (DeployerException ex) {
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

TOP

Related Classes of org.ow2.util.ee.deploy.api.deployer.IDeployerManager

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.