Package com.espertech.esper.client

Examples of com.espertech.esper.client.ConfigurationException


    private void handleAddPluggableObject(String factoryClassName, String namespace, String name, PluggableObjectType type, Serializable optionalCustomConfig) {

        if (factoryClassName == null)
        {
            throw new ConfigurationException("Factory class name has not been supplied for object '" + name + "'");
        }
        if (namespace == null)
        {
            throw new ConfigurationException("Namespace name has not been supplied for object '" + name + "'");
        }
        if (name == null)
        {
            throw new ConfigurationException("Name has not been supplied for object in namespace '" + namespace + "'");
        }

        Class clazz;
        try
        {
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            clazz = Class.forName(factoryClassName, true, cl);
        }
        catch (ClassNotFoundException ex)
        {
            throw new ConfigurationException("View factory class " + factoryClassName + " could not be loaded");
        }

        Map<String, Pair<Class, PluggableObjectEntry>> namespaceMap = pluggables.get(namespace);
        if (namespaceMap == null)
        {
View Full Code Here


        }

        for (ConfigurationPlugInPatternObject entry : configEntries)
        {
            if (entry.getPatternObjectType() == null) {
                throw new ConfigurationException("Pattern object type has not been supplied for object '" + entry.getName() + "'");
            }

            PluggableObjectType typeEnum;
            if (entry.getPatternObjectType() == ConfigurationPlugInPatternObject.PatternObjectType.GUARD) {
                typeEnum =  PluggableObjectType.PATTERN_GUARD;
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

        // Configure sockets (input adapter)
        Set<Integer> ports = new HashSet<Integer>();
        for (Map.Entry<String, SocketConfig> entry : config.getSockets().entrySet()) {
            if (sockets.containsKey(entry.getKey())) {
                throw new ConfigurationException("A socket by name '" + entry.getKey() + "' has already been configured.");
            }

            int port = entry.getValue().getPort();
            if (ports.contains(port)) {
                throw new ConfigurationException("A socket for port '" + port + "' has already been configured.");
            }
            ports.add(port);

            EsperSocketService socketService = new EsperSocketService(entry.getKey(), entry.getValue());
            sockets.put(entry.getKey(), socketService);
View Full Code Here

        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new ConfigurationException("Failed to read schema '" + schemaResource + "' : " + ex.getMessage(), ex);
        }

        // Map schema to internal representation
        return map(model, maxRecusiveDepth);
    }
View Full Code Here

        // Uses Xerxes internal classes
        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
        registry.addSource(new DOMXSImplementationSourceImpl());
        Object xsImplementation = registry.getDOMImplementation("XS-Loader");
        if (xsImplementation == null) {
            throw new ConfigurationException("Failed to retrieve XS-Loader implementation from registry obtained via DOMImplementationRegistry.newInstance, please check that registry.getDOMImplementation(\"XS-Loader\") returns an instance");
        }
        if (!JavaClassHelper.isImplementsInterface(xsImplementation.getClass(), XSImplementation.class)) {
            String message = "The XS-Loader instance returned by the DOM registry class '" + xsImplementation.getClass().getName() + "' does not implement the interface '" + XSImplementation.class.getName() + "'; If you have a another Xerces distribution in your classpath please ensure the classpath order loads the JRE Xerces distribution or set the DOMImplementationRegistry.PROPERTY system property";
            throw new ConfigurationException(message);
        }
        XSImplementation impl =(XSImplementation) xsImplementation;
        XSLoader schemaLoader = impl.createXSLoader(null);
        schemaLoader.getConfig().setParameter("error-handler", new XSDSchemaMapperErrorHandler(schemaResource));
        XSModel xsModel;
        if (input != null) {
            xsModel = schemaLoader.load(input);
        }
        else {
            xsModel = schemaLoader.loadURI(baseURI);

            // If having trouble loading from the uri, try to attempt from file system.
            if (xsModel == null) {
                String schema;
                try {
                    schema = FileUtil.readTextFile(new File(url.toURI()));
                }
                catch (IOException e) {
                    throw new ConfigurationException("Failed to read file '" + url.toURI() + "':" + e.getMessage(), e);
                }

                log.debug("Found and obtained schema: " + schema);
                xsModel = schemaLoader.load(new LSInputImpl(schema));
                log.debug("Model for schema: " + xsModel);
            }
        }

        if (xsModel == null)
        {
            throw new ConfigurationException("Failed to read schema via URL '" + schemaResource + '\'');
        }

        return xsModel;
    }
View Full Code Here

        {
            obj = clazz.newInstance();
        }
        catch (InstantiationException e)
        {
            throw new ConfigurationException("Class '" + clazz + "' cannot be instantiated");
        }
        catch (IllegalAccessException e)
        {
            throw new ConfigurationException("Illegal access instantiating class '" + clazz + "'");
        }

        // find method : static DataSource createDataSource(Properties properties)
        Method method;
        try
        {
            method = clazz.getMethod("createDataSource", Properties.class);
        }
        catch (NoSuchMethodException e)
        {
            throw new ConfigurationException("Class '" + clazz + "' does not provide a static method by name createDataSource accepting a single Properties object as parameter");
        }
        if (method == null)
        {
            throw new ConfigurationException("Class '" + clazz + "' does not provide a static method by name createDataSource accepting a single Properties object as parameter");           
        }
        if (method.getReturnType() != DataSource.class)
        {
            throw new ConfigurationException("On class '" + clazz + "' the static method by name createDataSource does not return a DataSource");                       
        }

        Object result;
        try
        {
            result = method.invoke(obj, dsConfig.getProperties());
        }
        catch (IllegalAccessException e)
        {
            throw new ConfigurationException("Class '" + clazz + "' failed in method createDataSource :" + e.getMessage(), e);
        }
        catch (InvocationTargetException e)
        {
            throw new ConfigurationException("Class '" + clazz + "' failed in method createDataSource :" + e.getMessage(), e);
        }
        if (result == null)
        {
            throw new ConfigurationException("Method createDataSource returned a null value for DataSource");
        }

        dataSource = (DataSource) result;
    }
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

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.