public String toExpressionString() { throw new EPException(ERROR_MSG); }
private static CronOperator assignOperator(int nodeType) { if ((nodeType == EsperEPL2GrammarParser.LAST) || (nodeType == EsperEPL2GrammarParser.LAST_OPERATOR)) { return CronOperator.last; } else if (nodeType == EsperEPL2GrammarParser.WEEKDAY_OPERATOR) { return CronOperator.w; } else if (nodeType == EsperEPL2GrammarParser.LW) { return CronOperator.lw; } throw new EPException("Unrecognized cron-operator node type '" + nodeType + "'"); }
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData) { throw new EPException(ERROR_MSG); }
public final Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw new EPException(e); } }
private static void generateExceptionNestedProp(String name, Object value) throws EPException { String clazzName = (value == null) ? "null" : value.getClass().getSimpleName(); throw new EPException("Nestable map type configuration encountered an unexpected property type of '" + clazzName + "' for property '" + name + "', expected java.lang.Class or java.util.Map"); }
public AggregationSupport makePlugInAggregator(String functionName) { try { return engineImportService.resolveAggregation(functionName); } catch (EngineImportUndefinedException e) { throw new EPException("Failed to make new aggregation function instance for '" + functionName + "'", e); } catch (EngineImportException e) { throw new EPException("Failed to make new aggregation function instance for '" + functionName + "'", e); } }
private void checkForRepeatedPropertyNames(EventType eventType, Map<String, Object> properties) { for(String property : eventType.getPropertyNames()) { if(properties.keySet().contains(property)) { throw new EPException("Property " + property + " occurs in both the underlying event and in the additional properties"); } } } }
/** * Handle the exception, displaying a nice message and converting to {@link EPException}. * @param logger is the logger to use for error logging * @param e is the exception * @param params the method parameters * @param subscriber the object to deliver to * @param method the method to call * @throws EPException converted from the passed invocation exception */ protected static void handle(Log logger, InvocationTargetException e, Object[] params, Object subscriber, FastMethod method) throws EPException { String message = "Invocation exception when invoking method '" + method.getName() + "' on subscriber class '" + subscriber.getClass().getSimpleName() + "' for parameters " + ((params == null) ? "null" : Arrays.toString(params)) + " : " + e.getTargetException().getClass().getSimpleName() + " : " + e.getTargetException().getMessage(); logger.error(message, e.getTargetException()); throw new EPException(message, e.getTargetException()); }
public void sendEvent(Object event) { if (!(event instanceof Map)) { throw new EPException("Unexpected event object of type " + event.getClass().getName() + ", expected " + Map.class.getName()); } Map<String, Object> map = (Map<String, Object>) event; MapEventBean mapEvent = new MapEventBean(map, mapEventType); runtimeEventSender.processWrappedEvent(mapEvent); } }
/** * Use the configuration specified in the given application * file. The format of the file is defined in * <tt>esper-configuration-2.0.xsd</tt>. * * @param configFile <tt>File</tt> from which you wish to load the configuration * @return A configuration configured via the file * @throws EPException when the file could not be found */ public Configuration configure(File configFile) throws EPException { if (log.isDebugEnabled()) { log.debug( "configuring from file: " + configFile.getName() ); } try { ConfigurationParser.doConfigure(this, new FileInputStream(configFile), configFile.toString()); } catch (FileNotFoundException fnfe) { throw new EPException( "could not find file: " + configFile, fnfe ); } return this; }
/** * Use the configuration specified by the given URL. * The format of the document obtained from the URL is defined in * <tt>esper-configuration-2.0.xsd</tt>. * * @param url URL from which you wish to load the configuration * @return A configuration configured via the file * @throws EPException is thrown when the URL could not be access */ public Configuration configure(URL url) throws EPException { if (log.isDebugEnabled()) { log.debug( "configuring from url: " + url.toString() ); } try { ConfigurationParser.doConfigure(this, url.openStream(), url.toString()); return this; } catch (IOException ioe) { throw new EPException("could not configure from URL: " + url, ioe ); } }
private void dispatch() { try { services.getDispatchService().dispatch(); } catch (RuntimeException ex) { throw new EPException(ex); } }
protected EventPropertyGetter doResolvePropertyGetter(String property) { TypedEventPropertyGetter getter = propertyGetterCache.get(property); if (getter != null) { return getter; } try { getter = SchemaXMLPropertyParser.parse(property,getXPathFactory(),getRootElementName(),rootElementNamespace,xsModel); propertyGetterCache.put(property, getter); return getter; } catch (XPathExpressionException e) { throw new EPException("Error constructing XPath expression from property name '" + property + '\'', e); } }
protected EventPropertyGetter doResolvePropertyGetter(String property) { TypedEventPropertyGetter getter = propertyGetterCache.get(property); if (getter != null) { return getter; } XPathExpression xPathExpression = null; try { String xPathExpr = SimpleXMLPropertyParser.parse(property,getRootElementName(), defaultNamespacePrefix, isResolvePropertiesAbsolute); XPath xpath = getXPathFactory().newXPath(); xpath.setNamespaceContext(namespaceContext); xPathExpression = xpath.compile(xPathExpr); } catch (XPathExpressionException e) { throw new EPException("Error constructing XPath expression from property name '" + property + '\'', e); } getter = new XPathPropertyGetter(property, xPathExpression, XPathConstants.STRING, null); propertyGetterCache.put(property, getter); return getter; } }
/** * Returns the XPathConstants type for a given Xerces type definition. * @param definition is the schema element definition * @return XPathConstants type */ public static QName simpleTypeToQName(XSSimpleTypeDecl definition) { switch (definition.getPrimitiveKind()) { case XSSimpleType.PRIMITIVE_BOOLEAN: return XPathConstants.BOOLEAN; case XSSimpleType.PRIMITIVE_DOUBLE: return XPathConstants.NUMBER; case XSSimpleType.PRIMITIVE_STRING: return XPathConstants.STRING; case XSSimpleType.PRIMITIVE_DECIMAL: return XPathConstants.NUMBER; default: throw new EPException("Unexpected schema simple type encountered '" + definition.getPrimitiveKind() + '\''); } }
public EPStatementObjectModel compileEPL(String eplStatement) throws EPException { StatementSpecRaw statementSpec = compileEPL(eplStatement, null, services, defaultStreamSelector); StatementSpecUnMapResult unmapped = StatementSpecMapper.unmap(statementSpec); if (unmapped.getIndexedParams().size() != 0) { throw new EPException("Invalid use of substitution parameters marked by '?' in statement, use the prepare method to prepare statements with substitution parameters"); } return unmapped.getObjectModel(); }
public void sendEvent(Object event) { // type check if (event.getClass() != beanEventType.getUnderlyingType()) { synchronized (this) { if (!compatibleClasses.contains(event.getClass())) { if (JavaClassHelper.isSubclassOrImplementsInterface(event.getClass(), beanEventType.getUnderlyingType())) { compatibleClasses.add(event.getClass()); } else { throw new EPException("Event object of type " + event.getClass().getName() + " does not equal, extend or implement the type " + beanEventType.getUnderlyingType().getName() + " of event type '" + beanEventType.getAlias() + "'"); } } } } runtime.processWrappedEvent(new BeanEventBean(event, beanEventType)); } }
private void readSchema(String schemaResource) throws IllegalAccessException, InstantiationException, ClassNotFoundException, EPException, URISyntaxException { URL url = ResourceLoader.resolveClassPathOrURLResource("schema", schemaResource); String uri = url.toURI().toString(); // Uses Xerxes internal classes DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); registry.addSource(new DOMXSImplementationSourceImpl()); XSImplementation impl =(XSImplementation) registry.getDOMImplementation("XS-Loader"); XSLoader schemaLoader = impl.createXSLoader(null); xsModel = schemaLoader.loadURI(uri); if (xsModel == null) { throw new EPException("Failed to read schema via URL '" + schemaResource + '\''); } }
public EventBean[] typeCast(List<EventBean> events, EventType targetType) { EventBean[] convertedArray = new EventBean[events.size()]; int count = 0; for (EventBean event : events) { EventBean converted; if (event instanceof WrapperEventBean) { WrapperEventBean wrapper = (WrapperEventBean) event; converted = createWrapper(wrapper.getUnderlyingEvent(), wrapper.getDecoratingProperties(), targetType); } else if (event instanceof MapEventBean) { MapEventBean mapEvent = (MapEventBean) event; converted = this.createMapFromValues(mapEvent.getProperties(), targetType); } else { throw new EPException("Unknown event type " + event.getEventType()); } convertedArray[count] = converted; count++; } return convertedArray; }
public void processWrappedEvent(EventBean eventBean) { // Acquire main processing lock which locks out statement management services.getEventProcessingRWLock().acquireReadLock(); try { processMatches(eventBean); } catch (RuntimeException ex) { throw new EPException(ex); } finally { services.getEventProcessingRWLock().releaseReadLock(); } // Dispatch results to listeners // Done outside of the read-lock to prevent lockups when listeners create statements dispatch(); // Work off the event queue if any events accumulated in there via a route() or insert-into processThreadWorkQueue(); }