Package com.espertech.esper.client

Examples of com.espertech.esper.client.EPStatement


                statementName = options.getStatementNameResolver() != null ? options.getStatementNameResolver().getStatementName(ctx) : null;
                userObject = options.getStatementUserObjectResolver() != null ? options.getStatementUserObjectResolver().getUserObject(ctx) : null;
            }

            try {
                EPStatement stmt;
                if (optionalStatementIdGenerator == null) {
                    if (options.getIsolatedServiceProvider() == null) {
                        stmt = epService.createEPL(item.getExpression(), statementName, userObject);
                    }
                    else {
                        EPServiceProviderIsolated unit = statementIsolationService.getIsolationUnit(options.getIsolatedServiceProvider(), -1);
                        stmt = unit.getEPAdministrator().createEPL(item.getExpression(), statementName, userObject);
                    }
                }
                else {
                    String statementId = optionalStatementIdGenerator.getNextStatementId();
                    if (options.getIsolatedServiceProvider() == null) {
                        stmt = epService.createEPLStatementId(item.getExpression(), statementName, userObject, statementId);
                    }
                    else {
                        EPServiceProviderIsolated unit = statementIsolationService.getIsolationUnit(options.getIsolatedServiceProvider(), -1);
                        EPAdministratorIsolatedSPI spi = (EPAdministratorIsolatedSPI) unit.getEPAdministrator();
                        stmt = spi.createEPLStatementId(item.getExpression(), statementName, userObject, statementId);
                    }
                }
                statementNames.add(new DeploymentInformationItem(stmt.getName(), stmt.getText()));
                statements.add(stmt);

                Set<String> types = statementEventTypeRef.getTypesForStatementName(stmt.getName());
                if (types != null) {
                    eventTypesReferenced.addAll(types);
                }
            }
            catch (EPException ex) {
                exceptions.add(new DeploymentItemException(ex.getMessage(), item.getExpression(), ex, item.getLineNumber()));
                if (options.isFailFast()) {
                    break;
                }
            }
        }

        if (!exceptions.isEmpty()) {
            if (options.isRollbackOnFail()) {
                log.debug("Rolling back intermediate statements for deployment");
                for (EPStatement stmt : statements) {
                    try {
                        stmt.destroy();
                    }
                    catch (Exception ex) {
                        log.debug("Failed to destroy created statement during rollback: " + ex.getMessage(), ex);
                    }
                }
                EPLModuleUtil.undeployTypes(eventTypesReferenced, statementEventTypeRef, eventAdapterService, filterService);
            }
            String text = "Deployment failed";
            if (options.isValidateOnly()) {
                text = "Validation failed";
            }
            throw buildException(text, module, exceptions);
        }

        if (options.isValidateOnly()) {
            log.debug("Rolling back created statements for validate-only");
            for (EPStatement stmt : statements) {
                try {
                    stmt.destroy();
                }
                catch (Exception ex) {
                    log.debug("Failed to destroy created statement during rollback: " + ex.getMessage(), ex);
                }
            }
View Full Code Here


        }

        List<DeploymentInformationItem> revertedStatements = new ArrayList<DeploymentInformationItem>();
        Set<String> referencedTypes = new HashSet<String>();
        for (DeploymentInformationItem item : reverted) {
            EPStatement statement = epService.getStatement(item.getStatementName());
            if (statement == null) {
                log.debug("Deployment id '" + info.getDeploymentId() + "' statement name '" + item + "' not found");
                continue;
            }
            referencedTypes.addAll(statementEventTypeRef.getTypesForStatementName(statement.getName()));
            if (statement.isDestroyed()) {
                continue;
            }
            try {
                statement.destroy();
            }
            catch (RuntimeException ex) {
                log.warn("Unexpected exception destroying statement: " + ex.getMessage(), ex);
            }
            revertedStatements.add(item);
View Full Code Here

TOP

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

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.