Package org.ow2.easybeans.api

Examples of org.ow2.easybeans.api.EZBContainer


            } catch (Exception e) {
                this.logger.error("Cannot configure Carol to use CMI", e);
                throw new EZBComponentException("Cannot configure Carol to use CMI", e);
            }

            ClusterViewManagerFactory clusterViewManagerFactory = ClusterViewManagerFactory.getFactory();

            // Start the manager
            try {
                this.clusterViewManager = (ServerClusterViewManager) clusterViewManagerFactory.create();
            } catch (Exception e) {
                this.logger.error("Cannot retrieve the CMI Server", e);
                throw new EZBComponentException("Cannot retrieve the CMI Server", e);
            }
            if (this.clusterViewManager != null
                    && this.clusterViewManager.getState().equals(ClusterViewManager.State.STOPPED)) {
                if (this.eventComponent != null) {
                    List<Component> components =
                        clusterViewManagerFactory.getConfig().getComponents().getComponents();
                    if (components != null) {
                        for (Component cmiEventComponent : components) {
                            if (org.ow2.cmi.component.event.EventComponent.class.isAssignableFrom(cmiEventComponent.getClass())) {
                                ((org.ow2.cmi.component.event.EventComponent) cmiEventComponent).setEventService(
                                        this.eventComponent.getEventService());
View Full Code Here


            return EASYBEANS_ROOT;
        } else if (EZBContainer.class.isAssignableFrom(clazz)) {
            // The object is an EJB container.

            EZBContainer container = (EZBContainer) instance;

            // Get the archive name (remove all character before the last slash/antislash).
            String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");

            // Compute the application id.
            return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName;
        } else if (Factory.class.isAssignableFrom(clazz)) {
            // The object is a bean factory.

            Factory<?, ?> factory = (Factory<?, ?>) instance;
            EZBContainer container = factory.getContainer();

            // Get the archive name (remove all character before the last slash/antislash).
            String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");

            // Get the bean class name (remove all character before the last point).
            String factoryName = factory.getClassName().replaceAll("(.*\\.)", "");

            // Compute the bean id.
            return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName + "/" + factoryName;
        } else {
            throw new java.lang.IllegalArgumentException("Name is not define for argument of type " + instance.getClass());
        }
    }
View Full Code Here

     * {@inheritDoc}
     */
    public String getAdditionnalProperties(final MDBMessageEndPointFactory instance) {
        StringBuilder sb = new StringBuilder();
        // EJBModule=?
        EZBContainer container = instance.getContainer();
        String parent = null;
        try {
            parent = MBeansHelper.getInstance().getObjectName(container);
            sb.append(getParentNameProperty(parent));
            sb.append(",");
View Full Code Here

     * {@inheritDoc}
     */
    public String getAdditionnalProperties(final T instance) {
        StringBuilder sb = new StringBuilder();
        // EJBModule=?
        EZBContainer container = instance.getContainer();
        String parent = null;
        try {
            parent = MBeansHelper.getInstance().getObjectName(container);
            sb.append(getParentNameProperty(parent));
            sb.append(",");
View Full Code Here

        String id = request.getContainerId();
        if (id == null) {
            throw new RemoteException("No valid container id");
        }
        // Get the container
        EZBContainer container = this.ejb3server.getContainer(id);
        if (container == null) {
            throw new RemoteException("Cannot find the container with id '" + id + "'.");
        }

        // Once the container is found, get the factory
        String factoryName = request.getFactory();


        // while container is not available, stop the current request
        while (!container.isAvailable()) {
            //TODO: change it to a semaphore ?
            try {
                Thread.sleep(WAIT_TIME);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        // Get the container
        Factory factory = container.getFactory(factoryName);
        if (factory == null) {
            throw new RemoteException("Cannot find the factory with name '" + factoryName + "'.");
        }

        // Now, need to invoke the bean
View Full Code Here

        // Use a ListIterator to allow us to safely remove EZBContainers
        // from the List being processed.
        List<EZBContainer> containersList = new ArrayList<EZBContainer>(this.containers.values());
        ListIterator<EZBContainer> li = containersList.listIterator();
        while (li.hasNext()) {
            EZBContainer container = li.next();
            container.stop();
            removeContainer(container);
        }

        // Unregister MBeans
        if (this.serverConfig.isUsingMBeans()) {
View Full Code Here

     * @return the created container.
     */
    public EZBContainer createContainer(final IDeployable<?> deployable) {
        EZBContainerConfig jConfig = new JContainerConfig(deployable);
        jConfig.setEZBServer(this);
        EZBContainer container = new JContainer3(jConfig);
        addContainer(container);

        return container;
    }
View Full Code Here

            logger.warn("Deployable ''{0}'' won't be deployed as the EasyBeans instance has been stopped", ejbDeployable);
            return;
        }

        logger.info("Deploying {0}", ejbDeployable);
        EZBContainer container = getEmbedded().createContainer(ejbDeployable);
        try {
            container.start();
        } catch (EZBContainerException e) {
            getEmbedded().removeContainer(container);
            throw new DeployerException("Cannot deploy the given EJB '" + ejbDeployable + "'.", e);
        }
    }
View Full Code Here

        }

        // Get Containers of this deployable
        List<EZBContainer> containers = new ArrayList<EZBContainer>();
        for (EJB3Deployable ejb3 : workingDeployable.getEJB3Deployables()) {
            EZBContainer container = getEmbedded().findContainer(ejb3.getArchive());
            // not found
            if (container == null) {
                logger.warn("No container found for the archive ''{0}'', creation has maybe failed", ejb3.getArchive());
                continue;
            }
            // found, add it
            containers.add(container);
        }

        // Remove all these containers
        for (EZBContainer container : containers) {
            // stop it
            container.stop();

            // remove it
            getEmbedded().removeContainer(container);
        }
    }
View Full Code Here

        if (ejb3Server == null) {
            throw new IllegalStateException("Cannot find the server with id '" + this.embeddedID + "'.");
        }

        // Get the container
        EZBContainer container = ejb3Server.getContainer(getContainerId());
        if (container == null) {
            throw new IllegalStateException("Cannot find the container with id '" + getContainerId() + "'.");
        }

        this.factory = container.getFactory(getFactoryName());
        if (this.factory == null) {
            throw new IllegalStateException("Cannot find the factory with name '" + getFactoryName() + "'.");
        }
    }
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.api.EZBContainer

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.