public ClasspathImportServiceRuntime getClasspathImportServiceRuntime() { return servicesContext.getClasspathImportServiceRuntime(); }
private static void resolveAssertionService(EPRuntime runtime) { String provider = System.getProperty(PROVIDER_PROPERTY); if (provider == null) { throw new RuntimeException("Failed to find '" + PROVIDER_PROPERTY + "' system property"); } if (provider.toLowerCase(Locale.ENGLISH).trim().equals("default")) { assertionService = new DefaultInstrumentationAssertionService(); } else { EPRuntimeSPI spi = (EPRuntimeSPI) runtime; assertionService = (InstrumentationAssertionService) JavaClassHelper.instantiate(InstrumentationAssertionService.class, provider, spi.getServicesContext().getClasspathImportServiceRuntime().getClassForNameProvider()); } }
public void start() { if (log.isInfoEnabled()) { log.info("Starting EsperIO Kafka Output Adapter for runtime URI '{}'", runtimeURI); } // Obtain runtime EPRuntimeSPI runtime = (EPRuntimeSPI) EPRuntimeProvider.getRuntime(runtimeURI); // Obtain and invoke flow controlle String className = getRequiredProperty(properties, OUTPUT_FLOWCONTROLLER_CONFIG); EsperIOKafkaOutputFlowController controller; try { controller = (EsperIOKafkaOutputFlowController) JavaClassHelper.instantiate(EsperIOKafkaOutputFlowController.class, className, runtime.getServicesContext().getClasspathImportServiceRuntime().getClassForNameProvider()); EsperIOKafkaOutputFlowControllerContext context = new EsperIOKafkaOutputFlowControllerContext(runtime, properties); controller.initialize(context); } catch (Throwable t) { throw new ConfigurationException("Unexpected exception invoking flow-controller initialize method on class " + className + " for runtime URI '" + runtimeURI + "': " + t.getMessage(), t); } if (log.isInfoEnabled()) { log.info("Completed starting EsperIO Kafka Output Adapter for runtime URI '{}'", runtimeURI); } }
public void init(EsperIOKafkaInputProcessorContext context) { this.runtime = context.getRuntime(); String timestampExtractorClassName = context.getProperties().getProperty(EsperIOKafkaConfig.INPUT_TIMESTAMPEXTRACTOR_CONFIG); if (timestampExtractorClassName != null) { timestampExtractor = (EsperIOKafkaInputTimestampExtractor) JavaClassHelper.instantiate(EsperIOKafkaInputTimestampExtractor.class, timestampExtractorClassName, context.getRuntime().getServicesContext().getClasspathImportServiceRuntime().getClassForNameProvider()); } }
eventBeanManufacturer = EventTypeUtility.getManufacturer(eventType, writableProperties, runtime.getServicesContext().getClasspathImportServiceRuntime(), false, runtime.getServicesContext().getEventTypeAvroHandler()).getManufacturer(runtime.getServicesContext().getEventBeanTypedEventFactory()); } catch (EventBeanManufactureException e) { log.info("Unable to create manufacturer for event type: " + e.getMessage(), e);
EsperIOKafkaInputSubscriber subscriber; try { subscriber = (EsperIOKafkaInputSubscriber) JavaClassHelper.instantiate(EsperIOKafkaInputSubscriber.class, subscriberClassName, runtime.getServicesContext().getClasspathImportServiceRuntime().getClassForNameProvider()); EsperIOKafkaInputSubscriberContext subscriberContext = new EsperIOKafkaInputSubscriberContext(consumer, runtime, properties); subscriber.subscribe(subscriberContext); processor = (EsperIOKafkaInputProcessor) JavaClassHelper.instantiate(EsperIOKafkaInputProcessor.class, processorClassName, runtime.getServicesContext().getClasspathImportServiceRuntime().getClassForNameProvider()); EsperIOKafkaInputProcessorContext processorContext = new EsperIOKafkaInputProcessorContext(consumer, runtime, properties, this); processor.init(processorContext);
eventBeanManufacturer = EventTypeUtility.getManufacturer(eventType, writableProperties, runtime.getServicesContext().getClasspathImportServiceRuntime(), false, runtime.getServicesContext().getEventTypeAvroHandler()).getManufacturer(runtime.getServicesContext().getEventBeanTypedEventFactory()); } catch (EventBeanManufactureException e) { log.info("Unable to create manufacturer for event type: " + e.getMessage(), e);
if (entry.getValue().isNio()) { try { runtime.getServicesContext().getClasspathImportServiceRuntime().getClassForNameProvider().classForName("org.apache.http.nio.NHttpServiceHandler"); } catch (ClassNotFoundException e) { throw new ConfigurationException("NIO Handler not found in classpath, please ensure httpcore-nio exists in classpath.");
databaseConfigSvc = new DatabaseConfigServiceImpl(config.getJdbcConnections(), runtime.getServicesContext().getClasspathImportServiceRuntime()); executorFactory = new ExecutorServices(runtime, config.getExecutors());
StatementSubstitutionParameterOption substitutionParameterResolver, EPRuntimeSPI epRuntime) throws PathException, EPDeployException { ModuleProviderResult provider = ModuleProviderUtil.analyze(compiled, epRuntime.getServicesContext().getClasspathImportServiceRuntime()); String moduleName = provider.getModuleProvider().getModuleName(); EPServicesContext services = epRuntime.getServicesContext();
public static FAFProvider queryMethod(EPCompiled compiled, EPServicesContext services) { ByteArrayProvidingClassLoader classLoader = new ByteArrayProvidingClassLoader(compiled.getClasses(), services.getClasspathImportServiceRuntime().getClassLoader());
public void setUpdateListeners(EPStatementListenerSet updateListeners, boolean isRecovery) { // indicate that listeners were updated for potential persistence of listener set, once the statement context is known if (epStatement != null) { if (!isRecovery) { StatementContext stmtCtx = epStatement.getStatementContext(); epServicesContext.getEpServicesHA().getListenerRecoveryService().put(stmtCtx.getStatementId(), stmtCtx.getStatementName(), updateListeners.getListeners()); } } this.statementListenerSet = updateListeners; isMakeNatural = statementListenerSet.getSubscriber() != null; isMakeSynthetic = !(statementListenerSet.getListeners().length == 0) || statementInformationals.isAlwaysSynthesizeOutputEvents(); if (statementListenerSet.getSubscriber() == null) { statementResultNaturalStrategy = null; isMakeNatural = false; return; } try { statementResultNaturalStrategy = ResultDeliveryStrategyFactory.create(epStatement, statementListenerSet.getSubscriber(), statementListenerSet.getSubscriberMethodName(), selectClauseTypes, selectClauseColumnNames, runtime.getURI(), runtime.getServicesContext().getClasspathImportServiceRuntime()); isMakeNatural = true; } catch (ResultDeliveryStrategyInvalidException ex) { throw new EPSubscriberException(ex.getMessage(), ex); } }
private void finishInitialization(EPRuntime runtime, CSVInputAdapterSpec spec) { assertValidParameters(runtime, spec); EPRuntimeSPI spi = (EPRuntimeSPI) runtime; scheduleSlot = new ScheduleBucket(-1).allocateSlot(); reader = new CSVReader(spec.getAdapterInputSource()); reader.setLooping(spec.isLooping()); String[] firstRow = getFirstRow(); Map<String, Object> givenPropertyTypes = constructPropertyTypes(spec.getEventTypeName(), spec.getPropertyTypes(), spi.getServicesContext().getEventTypeRepositoryBus()); propertyOrder = spec.getPropertyOrder() != null ? spec.getPropertyOrder() : CSVPropertyOrderHelper.resolvePropertyOrder(firstRow, givenPropertyTypes); reader.setIsUsingTitleRow(isUsingTitleRow(firstRow, propertyOrder)); if (!isUsingTitleRow(firstRow, propertyOrder)) { this.firstRow = firstRow; } propertyTypes = resolvePropertyTypes(givenPropertyTypes, spi.getServicesContext().getClasspathImportServiceRuntime()); if (givenPropertyTypes == null) { throw new EPException("CSV adapter requires a predefined event type name, the event type named '" + spec.getEventTypeName() + "' could not be found"); } coercer.setPropertyTypes(propertyTypes); }
private void finishInitialization(EPRuntime runtime, CSVInputAdapterSpec spec) { assertValidParameters(runtime, spec); EPRuntimeSPI spi = (EPRuntimeSPI) runtime; scheduleSlot = new ScheduleBucket(-1).allocateSlot(); reader = new CSVReader(spec.getAdapterInputSource()); reader.setLooping(spec.isLooping()); String[] firstRow = getFirstRow(); Map<String, Object> givenPropertyTypes = constructPropertyTypes(spec.getEventTypeName(), spec.getPropertyTypes(), spi.getServicesContext().getEventTypeRepositoryBus()); propertyOrder = spec.getPropertyOrder() != null ? spec.getPropertyOrder() : CSVPropertyOrderHelper.resolvePropertyOrder(firstRow, givenPropertyTypes); reader.setIsUsingTitleRow(isUsingTitleRow(firstRow, propertyOrder)); if (!isUsingTitleRow(firstRow, propertyOrder)) { this.firstRow = firstRow; } propertyTypes = resolvePropertyTypes(givenPropertyTypes, spi.getServicesContext().getClasspathImportServiceRuntime()); if (givenPropertyTypes == null) { throw new EPException("CSV adapter requires a predefined event type name, the event type named '" + spec.getEventTypeName() + "' could not be found"); } coercer.setPropertyTypes(propertyTypes); }