Package org.ow2.easybeans.component.itf

Examples of org.ow2.easybeans.component.itf.EZBEventComponent


            if (this.clusterViewManager != null) {
                try {
                    this.clusterViewManager.stop();
                } catch (Exception e) {
                    this.logger.error("Cannot stop the server-side manager", e);
                    throw new EZBComponentException("Cannot stop the server-side manager", e);
                }
            }
        }
        this.logger.info("CMI extension stopped.");
View Full Code Here


        //Create the event dispatcher
        this.dispatcher = new EventDispatcher();
        this.dispatcher.start();

        // Register to event component.
        EZBEventComponent eventComponent = getComponent(EZBEventComponent.class);
        if (eventComponent != null) {
            eventComponent.registerJ2EEManagedObject(this, this.dispatcher);
        }

        // Register to jmx component will be done by the mbean itself.

        // Register to statistic component.
        EZBStatisticComponent statisticComponent = getComponent(EZBStatisticComponent.class);
        if (statisticComponent != null) {
            statisticComponent.registerJ2EEManagedObject(this);
        }

        // Register some NamingExtension (used to fill the java:comp Context)
        if (eventComponent != null) {
            for (IEventListener extension : this.defaultNamingExtensions) {
                eventComponent.getEventService().registerListener(extension,
                                                                  NAMING_EXTENSION_POINT);
            }
        }

        // Dispatch life cycle event.
View Full Code Here

        }

        // Unregister from jmx component will be done by the mbean itself.

        // Unregister from event component.
        EZBEventComponent eventComponent = getComponent(EZBEventComponent.class);
        if (eventComponent != null) {
            eventComponent.unregisterJ2EEManagedObject(this);

            // Unregister the NamingExtensions (used to fill the java:comp Context)
            for (IEventListener extension : this.defaultNamingExtensions) {
                eventComponent.getEventService().unregisterListener(extension);
            }

        }

        // Destroy the event dispatcher.
View Full Code Here

        this.dispatcher.start();

        this.j2eeManagedObjectId = J2EEManagedObjectNamingHelper.getJ2EEManagedObjectId(this);

        // Register to event component.
        EZBEventComponent eventComponent = getComponent(EZBEventComponent.class);
        if (eventComponent != null) {
            eventComponent.registerJ2EEManagedObject(this, this.dispatcher);
        }

        // Register to jmx component will be done by the mbean itself.

        // Register to statistic component.
View Full Code Here

     * @throws EZBContainerException if binding fails.
     */
    protected void createBeanFactories() throws EZBContainerException {

        // Check that the event component is here
        EZBEventComponent eventComponent = getComponent(EZBEventComponent.class);
        if (eventComponent == null) {
            throw new EZBContainerException("Event component is required !");
        }

        // Create/Start/Register a new event dispatcher
        IEventDispatcher eventDispatcher = eventComponent.createEventDispatcher();
        eventDispatcher.start();

        // The topic is common for all EZBContainer and Factory
        eventComponent.getEventService().registerDispatcher(Embedded.NAMING_EXTENSION_POINT,
                                                            eventDispatcher);

        logger.debug("EventService instance {0}", eventComponent.getEventService());

        // Wrap in a try/finally block to be able to stop/unregister the dispatcher afterall
        try {
            this.ejbJarInfo = new EJBJarInfo();
            // bind session beans
            EjbJarArchiveMetadata ejbMetadata = this.deployment.getEjbJarArchiveMetadata();
            if (ejbMetadata != null) {
                List<String> beanNames = this.deployment.getEjbJarArchiveMetadata().getBeanNames();
                for (String beanName : beanNames) {
                    for (EasyBeansEjbJarClassMetadata classAnnotationMetadata : this.deployment.getEjbJarArchiveMetadata()
                            .getClassesForBean(beanName)) {
                        Factory<?, ?> factory = null;
                        if (classAnnotationMetadata.isSession()) {
                            factory = createSessionBeanFactory(classAnnotationMetadata);
                        } else if (classAnnotationMetadata.isMdb()) {
                            factory = createMessageDrivenBeanFactory(classAnnotationMetadata);
                        }

                        // Post-Configure the created factories.
                        if (factory != null) {

                            // Adds more runtime info
                            IBeanInfo beanInfo = factory.getBeanInfo();

                            // EJB Name
                            beanInfo.setName(classAnnotationMetadata.getJCommonBean().getName());

                            // Adds security info.
                            beanInfo.setSecurityInfo(SecurityInfoHelper.getSecurityInfo(classAnnotationMetadata));

                            // Adds Business method info.
                            beanInfo.setBusinessMethodsInfo(BusinessMethodsInfoHelper.getMethods(classAnnotationMetadata));

                            // Cluster config
                            beanInfo.setCluster(classAnnotationMetadata.getCluster());

                            // Set invocation context factor

                            if (Boolean.getBoolean("easybeans.dynamicinterceptors")) {
                              factory.setInvocationContextFactory(new EasyBeansInvocationContextFactory(classAnnotationMetadata,
                                   this.classLoader));
                            }
                            // Sets the bean info
                            this.ejbJarInfo.addBeanInfo(beanInfo);

                            // Build java: Context
                            Context javaContext;
                            try {
                                javaContext = JavaContextHelper.build(classAnnotationMetadata, factory, eventDispatcher);
                            } catch (JavaContextHelperException e) {
                                throw new EZBContainerException("Cannot build environment", e);
                            }

                            // Set java: context
                            factory.setJavaContext(javaContext);

                            // Add Management
                            try {
                                MBeansHelper.getInstance().registerMBean(factory);
                            } catch (MBeansException me) {
                                throw new EZBContainerException("Cannot register the factory MBean", me);
                            }

                            // Pool config
                            poolConfiguration(factory, classAnnotationMetadata);

                            // Init factory
                            try {
                                factory.init();
                            } catch (FactoryException e) {
                                throw new EZBContainerException("Cannot initialize the factory.", e);
                            }

                            // Add the factory to the managed factories
                            this.factories.put(beanName, factory);

                        }
                    }
                }
                //Register clustered beans if necessary.
                eventDispatcher.dispatch(new EventLifeCycleClusteredBean(Embedded.NAMING_EXTENSION_POINT,
                        EZBClusteredBeanEvent.STARTING, this.bindingReferences));

                // Bind references only once
                bindReferences();

                // Permission Manager.
                try {
                    this.permissionManager = new PermissionManager(getArchive().getURL(), this.ejbJarInfo);
                    // translate metadata into permission
                    this.permissionManager.translateMetadata();
                    // commit
                    this.permissionManager.commit();
                } catch (PermissionManagerException e) {
                    throw new EZBContainerException("Cannot create permission manager", e);
                } catch (ArchiveException e) {
                    throw new EZBContainerException("Cannot create permission manager", e);
                }

            }
        } finally {
            eventDispatcher.stop();
            eventComponent.getEventService().unregisterDispatcher(Embedded.NAMING_EXTENSION_POINT);
        }
    }
View Full Code Here

        }

        // Unregister from jmx component will be done by the mbean itself.

        // Unregister from event component.
        EZBEventComponent eventComponent = getComponent(EZBEventComponent.class);
        if (eventComponent != null) {
            eventComponent.unregisterJ2EEManagedObject(this);
        }



        // Destroy the event dispatcher.
View Full Code Here

     * Init the factory.
     * @throws FactoryException if the initialization fails.
     */
    public void init() throws FactoryException {
        // Register to event component.
        EZBEventComponent eventComponent = getComponent(EZBEventComponent.class);
        if (eventComponent != null) {
            eventComponent.registerJ2EEManagedObject(this, this.dispatcher);
        }

        // Register to jmx component will be done by the mbean itself.

        // Register to statistic component.
View Full Code Here

        }

        // Unregister from jmx component will be done by the mbean itself.

        // Unregister from event component.
        EZBEventComponent eventComponent = getComponent(EZBEventComponent.class);
        if (eventComponent != null) {
            eventComponent.unregisterJ2EEManagedObject(this);
        }

        // Unref the event dispatcher.
        this.dispatcher = null;
View Full Code Here

                throw new EmbeddedException("Can not stop the Depmonitor component", e);
            }
        }

        // Get the event component.
        EZBEventComponent eventComponent = this.embedded.getComponent(EZBEventComponent.class);
        if (eventComponent == null) {
            throw new EmbeddedException("The Event component is not found. It is necesary to run the plugin.");
        } else if (persistenceListener != null) {
            this.persistenceSupport = new PersistenceSupport(eventComponent);
            this.persistenceSupport.addListener(persistenceListener);
View Full Code Here

        } else {
            throw new EZBContainerException("unknown session type for: " + sessionBean);
        }

        // Build runtime information
        SessionBeanInfo sessionBeanInfo = new SessionBeanInfo();
        sessionBeanInfo.setTransactionManagementType(sessionBean.getTransactionManagementType());
        sessionBeanInfo.setApplicationExceptions(sessionBean.getEjbJarDeployableMetadata().getApplicationExceptions());
        // Only for singleton
        if (sessionBean.isSingleton()) {
            sessionBeanInfo.setStartup(sessionBean.isStartup());
        }

        sessionFactory.setSessionBeanInfo(sessionBeanInfo);

        // Build WS deploy/time info
        if (sessionBean.getWebServiceMarker() != null) {
            // Bean is annotated with @WebService or @WebServiceprovider
            IWebServiceInfo info = createWebServiceInfo(sessionBean, factoryName);
            sessionBeanInfo.setWebServiceInfo(info);
        } // else this bean is not webservices annotated

        // get interfaces of bean
        IJLocal localItfs = sessionBean.getLocalInterfaces();
        IJRemote remoteItfs = sessionBean.getRemoteInterfaces();

        if (localItfs != null) {
            sessionBeanInfo.setLocalInterfaces(localItfs.getInterfaces());
            for (String itf : localItfs.getInterfaces()) {
                this.bindingReferences.add(createLocalItfRef(itf,
                                                             getEmbedded().getID(),
                                                             getId(),
                                                             factoryName,
                                                             sessionBean,
                                                             sessionFactory));
            }
        }
        if (remoteItfs != null) {
            sessionBeanInfo.setRemoteInterfaces(remoteItfs.getInterfaces());
            for (String itf : remoteItfs.getInterfaces()) {
                this.bindingReferences.add(createRemoteItfRef(itf,
                                                              getId(),
                                                              factoryName,
                                                              sessionBean,
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.component.itf.EZBEventComponent

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.