Package org.ow2.easybeans.api

Examples of org.ow2.easybeans.api.FactoryException


            } 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

        super.init();

        // Load the listener interface
        String listenerInterfaceName = getMessageDrivenInfo().getMessageListenerInterface();
        if (listenerInterfaceName == null) {
            throw new FactoryException("No MessageListener interface found for MDB '" + getClassName() + "' of container '"
                    + getContainer().getName() + "'");
        }
        try {
            this.listenerInterface = getContainer().getClassLoader().loadClass(listenerInterfaceName.replace("/", "."));
        } catch (ClassNotFoundException e) {
            throw new FactoryException("Cannot load MessageListener interface '" + listenerInterfaceName + "' found for MDB '"
                    + getClassName() + "' of container '" + getContainer().getName() + "'");
        }


        initActivationSpec();
View Full Code Here

            String jndiName = null;
            try {
                jndiName = getContainer().getConfiguration().getContainerJNDIResolver().getMessageDestinationJNDIUniqueName(
                        messageDestinationLink);
            } catch (EZBJNDIResolverException e) {
                throw new FactoryException("Unable to resolve message destination link '" + messageDestinationLink
                        + "' for bean '" + getBeanInfo().getName() + "'.", e);
            }
            properties.add(new JActivationConfigProperty("destination", jndiName));
            logger.info("Message destination link ''{0}'' resolved to ''{1}'' for bean ''{2}''", messageDestinationLink,
                    jndiName, getBeanInfo().getName());
View Full Code Here

        // get Method (reflection)
        Method m = null;
        try {
            m = this.activationSpec.getClass().getMethod(methodName, new Class[] {String.class});
        } catch (SecurityException e) {
            throw new FactoryException("Cannot get a method named '" + methodName
                    + "' on activation spec object '" + this.activationSpec + "'.", e);
        } catch (NoSuchMethodException e) {
            throw new FactoryException("Cannot get a method named '" + methodName
                    + "' on activation spec object '" + this.activationSpec + "'.", e);
        }

        // invoke method
        try {
            m.invoke(this.activationSpec, value);
        } catch (IllegalArgumentException e) {
            throw new FactoryException("Cannot invoke method named '" + methodName + "' with value '" + value
                    + "' on activation spec object '" + this.activationSpec + "'.", e);
        } catch (IllegalAccessException e) {
            throw new FactoryException("Cannot invoke method named '" + methodName + "' with value '" + value
                    + "' on activation spec object '" + this.activationSpec + "'.", e);
        } catch (InvocationTargetException e) {
            throw new FactoryException("Cannot invoke method named '" + methodName + "' with value '" + value
                    + "' on activation spec object '" + this.activationSpec + "'.", e);
        }


    }
View Full Code Here

     */
    protected void validateActivationSpec() throws FactoryException {
        try {
            this.activationSpec.validate();
        } catch (InvalidPropertyException e) {
            throw new FactoryException(
                    "Cannot validate the validation spec object for bean '" + getBeanInfo().getName() + "'.", e);
        }
    }
View Full Code Here

     */
    protected void activate() throws FactoryException {
        try {
            this.resourceAdapter.endpointActivation(this, this.activationSpec);
        } catch (ResourceException e) {
            throw new FactoryException(
                    "Cannot activate the activationspec object and us (MessageEndPointFactory) on the resource adapter",
                    e);
        }
    }
View Full Code Here

        Class clazz = null;
        try {
            clazz = getContainer().getClassLoader().loadClass(getClassName());
        } catch (ClassNotFoundException e) {
            throw new FactoryException("Cannot load the class for class name '" + getClassName() + "'", e);
        }
        setBeanClass(clazz);
        setHashes(Hash.hashClass(clazz));

        // Use the container event dispatcher.
        this.dispatcher = ((JContainer3) this.container).getEventDispatcher();

        try {
            this.namingManager = NamingManager.getInstance();
        } catch (NamingException e) {
            throw new FactoryException("Cannot get instance of the naming manager", e);
        }

        this.injectors = container.getConfiguration().getInjectors();

        // Get a timer service if a timer component is present.
View Full Code Here

        EasyBeansSingletonSB bean = null;
        if (getSessionBeanInfo().isStartup()) {
            try {
                bean = getBean(null);
            } catch (RuntimeException e) {
                throw new FactoryException("Cannot initialize Singleton bean", e);
            } finally {
                if (bean != null) {
                    try {
                        getPool().release(bean);
                    } catch (PoolException e) {
                        throw new FactoryException("Cannot release bean", e);
                    }
                }
            }

        }
View Full Code Here

                    throw new EZBComponentException("Cannot start the CMI Server", e);
                }
            }
        }
        // register the listener.
        EZBEventListener eventListener = new CmiEventListener();
        this.eventComponent.registerEventListener(eventListener);

        this.logger.debug("The CMI configuration extension has been added.");
    }
View Full Code Here

TOP

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

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.