private static String getRequiredAttribute(Node node, String key) { Node valueNode = node.getAttributes().getNamedItem(key); if (valueNode == null) { throw new ConfigurationException("Required attribute by name '" + key + "' not found"); } return valueNode.getTextContent(); }
private void registerEventTypeIfNotExists(String eventTypeName, Map<String, Object> typeMap) { try { LOG.info("Registering event type, " +eventTypeName); epService.getEPAdministrator().getConfiguration().addEventType(eventTypeName, typeMap); eventTypeNames.add(eventTypeName); } catch (ConfigurationException e) { e.printStackTrace(); LOG.error("Event type does already exist, " +eventTypeName); } }
private ConfigurationInformation takeSnapshot(Configuration configuration) { try { return (ConfigurationInformation) SerializableObjectCopier.copy(configuration); } catch (IOException e) { throw new ConfigurationException("Failed to snapshot configuration instance through serialization : " + e.getMessage(), e); } catch (ClassNotFoundException e) { throw new ConfigurationException("Failed to snapshot configuration instance through serialization : " + e.getMessage(), e); } } }
public void setMetricsReportingDisabled() { try { metricReportingService.setMetricsReportingDisabled(); } catch (RuntimeException e) { throw new ConfigurationException("Error enabling metric reporting: " + e.getMessage(), e); } }
public void setMetricsReportingInterval(String stmtGroupName, long newInterval) { try { metricReportingService.setMetricsReportingInterval(stmtGroupName, newInterval); } catch (RuntimeException e) { throw new ConfigurationException("Error updating interval for metric reporting: " + e.getMessage(), e); } }
public void setMetricsReportingStmtEnabled(String statementName) { try { metricReportingService.setMetricsReportingStmtEnabled(statementName); } catch (RuntimeException e) { throw new ConfigurationException("Error enabling metric reporting for statement: " + e.getMessage(), e); } }
public void setMetricsReportingStmtDisabled(String statementName) throws ConfigurationException { StatementMetricHandle handle = statementMetricHandles.get(statementName); if (handle == null) { throw new ConfigurationException("Statement by name '" + statementName + "' not found in metrics collection"); } handle.setEnabled(false); }
public void setMetricsReportingStmtEnabled(String statementName) throws ConfigurationException { StatementMetricHandle handle = statementMetricHandles.get(statementName); if (handle == null) { throw new ConfigurationException("Statement by name '" + statementName + "' not found in metrics collection"); } handle.setEnabled(true); }
public void setMetricsReportingEnabled() { try { metricReportingService.setMetricsReportingEnabled(); } catch (RuntimeException e) { throw new ConfigurationException("Error enabling metric reporting: " + e.getMessage(), e); } }
public void setMetricsReportingStmtDisabled(String statementName) { try { metricReportingService.setMetricsReportingStmtDisabled(statementName); } catch (RuntimeException e) { throw new ConfigurationException("Error enabling metric reporting for statement: " + e.getMessage(), e); } }
/** * Sets a new interval for a statement group identified by name. * @param stmtGroupName name of statement group as assigned through configuration * @param newInterval new interval, or a -1 or zero value to disable reporting */ public void setStatementGroupInterval(String stmtGroupName, long newInterval) { StmtGroupMetrics metrics = statementGroups.get(stmtGroupName); if (metrics != null) { metrics.setInterval(newInterval); } else { throw new ConfigurationException("Statement group by name '" + stmtGroupName + "' could not be found"); } }
private static void checkKeysExist(EventType baseEventType, String alias, String[] keyProperties, String revisionEventTypeAlias) { String propertyNames[] = baseEventType.getPropertyNames(); for (String keyProperty : keyProperties) { boolean exists = false; for (String propertyName : propertyNames) { if (propertyName.equals(keyProperty)) { exists = true; break; } } if (!exists) { throw new ConfigurationException("Key property '" + keyProperty + "' as defined in the configuration for revision event type '" + revisionEventTypeAlias + "' does not exists in event type '" + alias + "'"); } } } }
public void addEventTypeAliasSimpleName(Class javaEventClass) { try { eventAdapterService.addBeanType(javaEventClass.getSimpleName(), javaEventClass); } catch (EventAdapterException t) { throw new ConfigurationException(t.getMessage(), t); } }
private static Map<String, Class> createPropertyTypes(Properties properties) { Map<String, Class> propertyTypes = new HashMap<String, Class>(); for(Map.Entry<Object, Object> entry : properties.entrySet()) { String className = (String) entry.getValue(); if ("string".equals(className)) { className = String.class.getName(); } // use the boxed type for primitives String boxedClassName = JavaClassHelper.getBoxedClassName(className); Class clazz; try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); clazz = Class.forName(boxedClassName, true, cl); } catch (ClassNotFoundException ex) { throw new ConfigurationException("Unable to load class '" + boxedClassName + "', class not found", ex); } propertyTypes.put((String) entry.getKey(), clazz); } return propertyTypes; }
/** * Add the plug-in objects for another collection. * @param other is the collection to add */ public void addObjects(PluggableObjectCollection other) { for (Map.Entry<String, Map<String, Pair<Class, PluggableObjectType>>> entry : other.getPluggables().entrySet()) { Map<String, Pair<Class, PluggableObjectType>> namespaceMap = pluggables.get(entry.getKey()); if (namespaceMap == null) { namespaceMap = new HashMap<String, Pair<Class, PluggableObjectType>>(); pluggables.put(entry.getKey(), namespaceMap); } for (String name : entry.getValue().keySet()) { if (namespaceMap.containsKey(name)) { throw new ConfigurationException("Duplicate object detected in namespace '" + entry.getKey() + "' by name '" + name + "'"); } } namespaceMap.putAll(entry.getValue()); } }
public void addVariable(String variableName, Class type, Object initializationValue) throws ConfigurationException { try { variableService.createNewVariable(variableName, type, initializationValue, null); } catch (VariableExistsException e) { throw new ConfigurationException("Error creating variable: " + e.getMessage(), e); } catch (VariableTypeException e) { throw new ConfigurationException("Error creating variable: " + e.getMessage(), e); } }
public void addEventTypeAliasNestable(String eventTypeAlias, Map<String, Object> typeMap, String[] superTypes) throws ConfigurationException { Set<String> superTypeAliases = null; if ((superTypes != null) && (superTypes.length > 0)) { superTypeAliases = new HashSet<String>(Arrays.asList(superTypes)); } try { eventAdapterService.addNestableMapType(eventTypeAlias, typeMap, superTypeAliases); } catch (EventAdapterException t) { throw new ConfigurationException(t.getMessage(), t); } }
public void addEventTypeAlias(String eventTypeAlias, Map<String, Class> typeMap) { try { eventAdapterService.addMapType(eventTypeAlias, typeMap, null); } catch (EventAdapterException t) { throw new ConfigurationException(t.getMessage(), t); } }
public void addEventTypeAliasNestable(String eventTypeAlias, Map<String, Object> typeMap) throws ConfigurationException { try { eventAdapterService.addNestableMapType(eventTypeAlias, typeMap, null); } catch (EventAdapterException t) { throw new ConfigurationException(t.getMessage(), t); } }
public void addNestableEventTypeAlias(String eventTypeAlias, Map<String, Object> typeMap) { try { eventAdapterService.addNestableMapType(eventTypeAlias, typeMap, null); } catch (EventAdapterException t) { throw new ConfigurationException(t.getMessage(), t); } }