Package com.espertech.esper.client

Examples of com.espertech.esper.client.ConfigurationException


    public void setMetricsReportingEnabled()
    {
        if (!specification.isEnableMetricsReporting())
        {
            throw new ConfigurationException("Metrics reporting must be enabled through initialization-time configuration");
        }
        scheduleExecutions();
        MetricReportingPath.setMetricsEnabled(true);
    }
View Full Code Here


    {
        Element root = doc.getDocumentElement();
        String nodeName = root.getNodeName();
        if (!nodeName.equals("xml-axiom"))
        {
            throw new ConfigurationException("Expected root element 'xml-axiom' not found in document, found '" + nodeName + "' instead");
        }
        return handleAxiom(root);
    }
View Full Code Here

        }
        final String finalUpsertName = upsertName;

        EventType eventType = engineSPI.getEventAdapterService().getExistsTypeByName(upsert.getStream());
        if (eventType == null) {
            throw new ConfigurationException("Event type by name '" + upsert.getStream() + "' not found");
        }

        try {
            DatabaseConnectionFactory connectionFactory = databaseConfigSvc.getConnectionFactory(upsert.getConnection());

            String[] keys = new String[upsert.getKeys().size()];
            int[] keyTypes = new int[upsert.getKeys().size()];
            EventPropertyGetter[] keyGetters = new EventPropertyGetter[upsert.getKeys().size()];

            int index = 0;
            for (Column key : upsert.getKeys()) {
                keys[index] = key.getColumn();
                keyTypes[index] = SQLTypeMapUtil.getSQLTypeByName(key.getType());
                keyGetters[index] = eventType.getGetter(key.getProperty());
                if (keyGetters[index] == null) {
                    throw new ConfigurationException("Property name '" + key.getProperty() + "' not found for type '" + eventType + "'");
                }
                index++;
            }

            String[] values = new String[upsert.getValues().size()];
            int[] valueTypes = new int[upsert.getValues().size()];
            EventPropertyGetter[] valueGetters = new EventPropertyGetter[upsert.getValues().size()];

            index = 0;
            for (Column value : upsert.getValues()) {
                values[index] = value.getColumn();
                valueTypes[index] = SQLTypeMapUtil.getSQLTypeByName(value.getType());
                valueGetters[index] = eventType.getGetter(value.getProperty());

                if (valueGetters[index] == null) {
                    throw new ConfigurationException("Property name '" + value.getProperty() + "' not found for type '" + eventType + "'");
                }
                index++;
            }

            StoreExceptionHandler handler = new StoreExceptionHandler() {
                public void handle(String message, SQLException ex)
                {
                    log.error("Error executing '" + finalUpsertName + "'");
                }
            };

            MultiKeyMultiValueTable table = new MultiKeyMultiValueTable(upsert.getTableName(), keys, keyTypes,
                    values, valueTypes, handler);

            RunnableUpsertContext context = new RunnableUpsertContext(upsertName, connectionFactory, table, keyGetters, valueGetters, upsert.getRetry(), upsert.getRetryIntervalSec());
            return new RunnableUpsertFactory(context);
        }
        catch (ConfigurationException ex) {
            throw ex;
        }
        catch (Throwable t) {
            throw new ConfigurationException("Error configuring " + upsertName + " :" + t.getMessage());
        }
    }
View Full Code Here

        }
        final String finalDmlName = dmlName;

        EventType eventType = engineSPI.getEventAdapterService().getExistsTypeByName(dmlQuery.getStream());
        if (eventType == null) {
            throw new ConfigurationException("Event type by name '" + dmlQuery.getStream() + "' not found");
        }

        try {
            DatabaseConnectionFactory connectionFactory = databaseConfigSvc.getConnectionFactory(dmlQuery.getConnection());

            Map<Integer, BindingEntry> bindings = new HashMap<Integer, BindingEntry>();
            for (BindingParameter params : dmlQuery.getBindings()) {
                EventPropertyGetter valueGetter = eventType.getGetter(params.getPropertyName());
                bindings.put(params.getPosition(), new BindingEntry(valueGetter));
            }

            StoreExceptionHandler handler = new StoreExceptionHandler() {
                public void handle(String message, SQLException ex)
                {
                    log.error("Error executing '" + finalDmlName + "'");
                }
            };

            DMLStatement dmlStmt = new DMLStatement(handler, dmlQuery.getSql(), bindings);

            RunnableDMLContext context = new RunnableDMLContext(dmlName, connectionFactory, dmlStmt, dmlQuery.getRetry(), dmlQuery.getRetryIntervalSec());
            return new RunnableDMLFactory(context);
        }
        catch (ConfigurationException ex) {
            throw ex;
        }
        catch (Throwable t) {
            throw new ConfigurationException("Error configuring " + dmlName + " :" + t.getMessage());
        }
    }
View Full Code Here

        if (workqueueName == null) {
            return EXEC_SAME_THREAD;
        }
        ExecutorService svc = services.get(workqueueName);
        if (svc == null) {
            throw new ConfigurationException("Executor by name '"+ workqueueName + "' has not been defined");
        }
        return svc;
    }
View Full Code Here

                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;
View Full Code Here

    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);
    }
View Full Code Here

    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);
    }
View Full Code Here

    public void setMetricsReportingEnabled()
    {
        if (!specification.isEnableMetricsReporting())
        {
            throw new ConfigurationException("Metrics reporting must be enabled through initialization-time configuration");
        }
        scheduleExecutions();
        MetricReportingPath.setMetricsEnabled(true);
    }
View Full Code Here

    public static void validateTimestampProperties(EventType eventType, String startTimestampProperty, String endTimestampProperty)
            throws ConfigurationException {

        if (startTimestampProperty != null) {
            if (eventType.getGetter(startTimestampProperty) == null) {
                throw new ConfigurationException("Declared start timestamp property name '" + startTimestampProperty + "' was not found");
            }
            Class type = eventType.getPropertyType(startTimestampProperty);
            if (!JavaClassHelper.isDatetimeClass(type)) {
                throw new ConfigurationException("Declared start timestamp property '" + startTimestampProperty + "' is expected to return a Date, Calendar or long-typed value but returns '" + type.getName() + "'");
            }
        }

        if (endTimestampProperty != null) {
            if (startTimestampProperty == null) {
                throw new ConfigurationException("Declared end timestamp property requires that a start timestamp property is also declared");
            }
            if (eventType.getGetter(endTimestampProperty) == null) {
                throw new ConfigurationException("Declared end timestamp property name '" + endTimestampProperty + "' was not found");
            }
            Class type = eventType.getPropertyType(endTimestampProperty);
            if (!JavaClassHelper.isDatetimeClass(type)) {
                throw new ConfigurationException("Declared end timestamp property '" + endTimestampProperty + "' is expected to return a Date, Calendar or long-typed value but returns '" + type.getName() + "'");
            }
            Class startType = eventType.getPropertyType(startTimestampProperty);
            if (JavaClassHelper.getBoxedType(startType) != JavaClassHelper.getBoxedType(type)) {
                throw new ConfigurationException("Declared end timestamp property '" + endTimestampProperty + "' is expected to have the same property type as the start-timestamp property '" + startTimestampProperty + "'");
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.espertech.esper.client.ConfigurationException

Copyright © 2018 www.massapicom. 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.