Examples of PEContainer


Examples of io.s4.processor.PEContainer

            EventClock s4EventClock = (EventClock)s4Clock;
            s4EventClock.updateTime(seedTime);
            System.out.println("Intializing event clock time with seed time " + s4EventClock.getCurrentTime());
        }
       
        PEContainer peContainer = (PEContainer) context.getBean("peContainer");

        Watcher w = (Watcher) context.getBean("watcher");
        w.setConfigFilename(configPath);

       
        // load extension modules
        String[] configFileNames = getModuleConfigFiles(extsHome, prop);
        if (configFileNames.length > 0) {
            String[] configFileUrls = new String[configFileNames.length];
            for (int i = 0; i < configFileNames.length; i++) {
                configFileUrls[i] = "file:" + configFileNames[i];
            }
            context = new FileSystemXmlApplicationContext(configFileUrls,
                                                          context);
        }

        // load application modules
        configFileNames = getModuleConfigFiles(appsHome, prop);
        if (configFileNames.length > 0) {
            String[] configFileUrls = new String[configFileNames.length];
            for (int i = 0; i < configFileNames.length; i++) {
                configFileUrls[i] = "file:" + configFileNames[i];
            }
            context = new FileSystemXmlApplicationContext(configFileUrls,
                                                          context);
            // attach any beans that implement ProcessingElement to the PE
            // Container
            String[] processingElementBeanNames = context.getBeanNamesForType(ProcessingElement.class);
            for (String processingElementBeanName : processingElementBeanNames) {
                Object bean = context.getBean(processingElementBeanName);
                try {
                    Method getS4ClockMethod = bean.getClass().getMethod("getS4Clock");
   
                    if (getS4ClockMethod.getReturnType().equals(Clock.class)) {
                        if (getS4ClockMethod.invoke(bean) == null) {
                            Method setS4ClockMethod = bean.getClass().getMethod("setS4Clock", Clock.class);
                            setS4ClockMethod.invoke(bean, coreContext.getBean("clock"));
                        }
                    }
                }
                catch (NoSuchMethodException mnfe) {
                    // acceptable
                }
                System.out.println("Adding processing element with bean name "
                        + processingElementBeanName + ", id "
                        + ((ProcessingElement) bean).getId());
                peContainer.addProcessor((ProcessingElement) bean);
            }
        } 
    }
View Full Code Here

Examples of org.apache.s4.processor.PEContainer

            EventClock s4EventClock = (EventClock)clock;
            s4EventClock.updateTime(seedTime);
            System.out.println("Intializing event clock time with seed time " + s4EventClock.getCurrentTime());
        }
       
        PEContainer peContainer = (PEContainer) context.getBean("peContainer");

        Watcher w = (Watcher) context.getBean("watcher");
        w.setConfigFilename(configPath);

       
        // load extension modules
        String[] configFileNames = getModuleConfigFiles(extsHome, prop);
        if (configFileNames.length > 0) {
            String[] configFileUrls = new String[configFileNames.length];
            for (int i = 0; i < configFileNames.length; i++) {
                configFileUrls[i] = "file:" + configFileNames[i];
            }
            context = new FileSystemXmlApplicationContext(configFileUrls,
                                                          context);
        }

        // load application modules
        configFileNames = getModuleConfigFiles(appsHome, prop);
        if (configFileNames.length > 0) {
            String[] configFileUrls = new String[configFileNames.length];
            for (int i = 0; i < configFileNames.length; i++) {
                configFileUrls[i] = "file:" + configFileNames[i];
            }
            context = new FileSystemXmlApplicationContext(configFileUrls,
                                                          context);
            // attach any beans that implement ProcessingElement to the PE
            // Container
            String[] processingElementBeanNames = context.getBeanNamesForType(AbstractPE.class);
            for (String processingElementBeanName : processingElementBeanNames) {
                AbstractPE bean = (AbstractPE) context.getBean(processingElementBeanName);
                bean.setClock(clock);
                try {
                    bean.setSafeKeeper((SafeKeeper) context.getBean("safeKeeper"));
                } catch (NoSuchBeanDefinitionException ignored) {
                    // no safe keeper = no checkpointing / recovery
                }
                // if the application did not specify an id, use the Spring bean name
                if (bean.getId() == null) {
                    bean.setId(processingElementBeanName);
                }
                System.out.println("Adding processing element with bean name "
                        + processingElementBeanName + ", id "
                        + ((AbstractPE) bean).getId());
                peContainer.addProcessor((AbstractPE) bean);
            }
        } 
    }
View Full Code Here

Examples of org.apache.s4.processor.PEContainer

            s4EventClock.updateTime(seedTime);
            System.out.println("Intializing event clock time with seed time "
                    + s4EventClock.getCurrentTime());
        }

        PEContainer peContainer = (PEContainer) context.getBean("peContainer");

        Watcher w = (Watcher) context.getBean("watcher");
        w.setConfigFilename(configBase + s4CoreConfFileName);

        // load extension modules
        // String[] configFileNames = getModuleConfigFiles(extsHome, prop);
        // if (configFileNames.length > 0) {
        // String[] configFileUrls = new String[configFileNames.length];
        // for (int i = 0; i < configFileNames.length; i++) {
        // configFileUrls[i] = "file:" + configFileNames[i];
        // }
        // context = new FileSystemXmlApplicationContext(configFileUrls,
        // context);
        // }

        // load application modules
        String applicationConfigFileName = configBase + "app_conf.xml";
        String[] configFileUrls = new String[] { "file:"
                + applicationConfigFileName };
        context = new FileSystemXmlApplicationContext(configFileUrls, context);
        // attach any beans that implement ProcessingElement to the PE
        // Container
        String[] processingElementBeanNames = context
                .getBeanNamesForType(AbstractPE.class);
        for (String processingElementBeanName : processingElementBeanNames) {
            Object bean = context.getBean(processingElementBeanName);
            try {
                Method getS4ClockMethod = bean.getClass().getMethod(
                        "getClock");

                if (getS4ClockMethod.getReturnType().equals(Clock.class)) {
                    if (getS4ClockMethod.invoke(bean) == null) {
                        Method setS4ClockMethod = bean.getClass().getMethod(
                                "setClock", Clock.class);
                        setS4ClockMethod.invoke(bean,
                                coreContext.getBean("clock"));
                    }
                }
                ((AbstractPE)bean).setSafeKeeper((SafeKeeper) context.getBean("safeKeeper"));
            } catch (NoSuchMethodException mnfe) {
                // acceptable
            }
            System.out.println("Adding processing element with bean name "
                    + processingElementBeanName + ", id "
                    + ((AbstractPE) bean).getId());
            peContainer.addProcessor((AbstractPE) bean);
        }

        appContext = context;
    }
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.