public String toExpressionString() { throw new EPException(ERROR_MSG); }
public String getMessage() { StringBuilder msg = new StringBuilder(super.getMessage()); if (expression != null) { msg.append(" ["); msg.append(expression); msg.append(']'); } return msg.toString(); } }
@Override public void execute(Tuple input) { if(eplManager.isUpdate()) { try { eplManager.getCountDownLatch().await(); Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } } Map<String, Object> record = (Map<String, Object>) input.getValue(1); if (record.containsKey("funcid") && eplManager.getSchema(Integer.parseInt(record.get("funcid").toString())) != null) { try { eplManager.getEPRuntime().sendEvent(record, record.get("tableName").toString()); } catch (EPException e) { System.out.println(JSONObject.fromObject(record).toString()); e.printStackTrace(); } } collector.ack(input); }
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"); } } } }
throw new EPException("Could not get a DOM parser configuration: " + resourceName, ex); throw new EPException("Could not parse configuration: " + resourceName, ex); throw new EPException("Could not read configuration: " + resourceName, ex);
private String getUniqueStatementName(String statementName, String statementId) { String finalStatementName; if (stmtNameToIdMap.containsKey(statementName)) { int count = 0; while(true) { finalStatementName = statementName + "--" + count; if (!(stmtNameToIdMap.containsKey(finalStatementName))) { break; } if (count > Integer.MAX_VALUE - 2) { throw new EPException("Failed to establish a unique statement name"); } count++; } } else { finalStatementName = statementName; } stmtNameToIdMap.put(finalStatementName, statementId); return finalStatementName; }
/** * 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); } }
/** * Returns an input stream from an application resource in the classpath. * @param resource to get input stream for * @return input stream for resource */ protected static InputStream getResourceAsStream(String resource) { String stripped = resource.startsWith("/") ? resource.substring(1) : resource; InputStream stream = null; ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader!=null) { stream = classLoader.getResourceAsStream( stripped ); } if ( stream == null ) { ConfigurationParser.class.getResourceAsStream( resource ); } if ( stream == null ) { stream = ConfigurationParser.class.getClassLoader().getResourceAsStream( stripped ); } if ( stream == null ) { throw new EPException( resource + " not found" ); } return stream; }
/** * 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 ); } }
/** * Make a new pair of resources. * @return pair of resources */ protected Pair<Connection, PreparedStatement> makeNew() { log.info(".makeNew Obtaining new connection and statement"); Connection connection = null; try { connection = databaseConnectionFactory.getConnection(); } catch (DatabaseConfigException ex) { throw new EPException("Error obtaining connection", ex); } PreparedStatement preparedStatement = null; try { preparedStatement = connection.prepareStatement(sql); } catch (SQLException ex) { throw new EPException("Error preparing statement '" + sql + '\'', ex); } return new Pair<Connection, PreparedStatement>(connection, preparedStatement); }
throw new EPException( resource + " not found" );
throw new EPException(resourceName + " resource '" + resource + "' not found");
private void dispatch() { try { services.getDispatchService().dispatch(); } catch (RuntimeException ex) { throw new EPException(ex); } }