Examples of EZBContainer


Examples of org.ow2.easybeans.api.EZBContainer

            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

Examples of org.ow2.easybeans.api.EZBContainer

     * {@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

Examples of org.ow2.easybeans.api.EZBContainer

     * {@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

Examples of org.ow2.easybeans.api.EZBContainer

        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

Examples of org.ow2.easybeans.api.EZBContainer

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

Examples of org.ow2.easybeans.api.EZBContainer

     * @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

Examples of org.ow2.easybeans.api.EZBContainer

            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

Examples of org.ow2.easybeans.api.EZBContainer

        }

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

Examples of org.ow2.easybeans.api.EZBContainer

        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

Examples of org.ow2.easybeans.api.EZBContainer

        // Get the EasyBeans embedded instance
        EZBServer embedded = EmbeddedManager.getEmbedded(easyBeansServerID);

        // Get the container object
        EZBContainer container = embedded.getContainer(containerID);
        // get the factory
        Factory<?, ?> factory = container.getFactory(factoryName);

        // Ensure operation state is valid
        OperationState operationState = factory.getOperationState();
        if (DEPENDENCY_INJECTION == operationState || LIFECYCLE_CALLBACK_INTERCEPTOR == operationState
                || AFTER_COMPLETION == operationState) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.