Examples of CEPConfigurationException


Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

        OMElement mappingElement =
                inputElement.getFirstChildWithName(new QName(CEPConstants.CEP_CONF_NAMESPACE,
                        CEPConstants.CEP_CONF_ELE_MAPPING));

        if (mappingElement == null) {
            throw new CEPConfigurationException("no mapping element for topic " + topic);
        }

        input.setMapping(
                MappingHelper.fromOM(mappingElement));
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

                        new QName(CEPConstants.CEP_CONF_ATTR_NAME));

        if (name == null) {
            String errorMessage = "Provider name is not given in the cep config";
            log.error(errorMessage);
            throw new CEPConfigurationException(errorMessage);
        }
        cepEngineProvider.setName(name);

        String providerClassName =
                cepEngineProviderElement.getAttributeValue(
                        new QName(CEPConstants.CEP_CONF_ATTR_CLASS));
        if (providerClassName == null) {
            String errorMessage = "Provider class is not given in the cep config";
            log.error(errorMessage);
            throw new CEPConfigurationException(errorMessage);
        }

        // here we assume cep provider should have given as a fragment host for this bundle
        // TODO: is it necessary to publish provider as an OSGI service
        try {
            Class providerClass = Class.forName(providerClassName);
            cepEngineProvider.setProviderClass(providerClass);
            return cepEngineProvider;
        } catch (ClassNotFoundException e) {
            String errorMessage = "Can not load the " + providerClassName;
            log.error(errorMessage);
            throw new CEPConfigurationException(errorMessage, e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

        try {
            registry = CEPServiceValueHolder.getInstance().getRegistry(tenantId);
        } catch (RegistryException e) {
            String errorMessage = "Error in getting registry specific to tenant :" + tenantId;
            log.error(errorMessage, e);
            throw new CEPConfigurationException(errorMessage, e);
        }

        String parentCollectionPath = CEPConstants.CEP_CONF_ELE_CEP_BUCKETS + CEPConstants.CEP_REGISTRY_BS;
        try {
            if (registry.resourceExists(parentCollectionPath)) {
                if (registry.get(parentCollectionPath) instanceof Collection) {
                    Collection cepBucketsCollection = (Collection) registry.get(parentCollectionPath);
                    buckets = new Bucket[cepBucketsCollection.getChildCount()];
                    int bucketCount = 0;
                    for (String bucketName : cepBucketsCollection.getChildren()) {
                        Bucket bucket = new Bucket();
                        if (registry.get(bucketName) instanceof Collection) {
                            Collection bucketDetailsCollection = (Collection) registry.get(bucketName);
                            for (String attirbute : bucketDetailsCollection.getChildren()) {
                                if (registry.get(attirbute) instanceof Collection) {
                                    Input input;
                                    Query query;
                                    Collection attributeCollection = (Collection) registry.get(attirbute);
                                    for (String names : attributeCollection.getChildren()) {
                                        if (registry.get(names) instanceof Collection) {
                                            if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_INPUTS)
                                                    .equals(attirbute.substring(attirbute.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                input = new Input();
                                                Collection collection3 = (Collection) registry.get(names);
                                                for (String names2 : collection3.getChildren()) {
                                                    if (registry.get(names2) instanceof Collection) {
                                                        Collection mappingCollection = (Collection) registry.get(names2);
                                                        Mapping mapping = new Mapping();
                                                        for (String mappingChild : mappingCollection.getChildren()) {
                                                            if (registry.get(mappingChild) instanceof Collection) {
                                                                Collection mapCollection = (Collection) registry.get(mappingChild);
                                                                if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_XPATH_DEFS)
                                                                        .equals(mappingChild.substring(mappingChild.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                                    for (String defs : mapCollection.getChildren()) {
                                                                        Resource xpathDefResource = registry.get(defs);
                                                                        Hashtable propertiesHashtable = xpathDefResource.getProperties();
                                                                        Enumeration e = propertiesHashtable.keys();
                                                                        while (e.hasMoreElements()) {
                                                                            String key = (String) e.nextElement();
                                                                            ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                            XpathDefinition xpathDefinition = new XpathDefinition();
                                                                            xpathDefinition.setPrefix(key);
                                                                            xpathDefinition.setNamespace(values.get(0).toString());
                                                                            mapping.addXpathDefinition(xpathDefinition);
                                                                        }
                                                                    }
                                                                } else if (
                                                                        (CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_PROPERTIES)
                                                                                .equals(mappingChild.substring(mappingChild.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                                    for (String defs : mapCollection.getChildren()) {
                                                                        Resource xpathDefResource = registry.get(defs);
                                                                        Hashtable propertiesHashtable = xpathDefResource.getProperties();
                                                                        Enumeration e = propertiesHashtable.keys();
                                                                        Property property = new Property();
                                                                        while (e.hasMoreElements()) {
                                                                            String key = (String) e.nextElement();
                                                                            ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                            if (CEPConstants.CEP_REGISTRY_NAME.equals(key)) {
                                                                                property.setName(values.get(0).toString());
                                                                            } else if (CEPConstants.CEP_REGISTRY_TYPE.equals(key)) {
                                                                                property.setType(values.get(0).toString());
                                                                            } else if (CEPConstants.CEP_REGISTRY_XPATH.equals(key)) {
                                                                                property.setXpath(values.get(0).toString());
                                                                            }
                                                                        }
                                                                        mapping.addProperty(property);
                                                                    }
                                                                }
                                                            } else {
                                                                Resource resource = registry.get(mappingChild);
                                                                Hashtable propertiesHashtable = resource.getProperties();
                                                                Enumeration e = propertiesHashtable.keys();
                                                                while (e.hasMoreElements()) {
                                                                    String key = (String) e.nextElement();
                                                                    ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                    if (CEPConstants.CEP_REGISTRY_STREAM.equals(key)) {
                                                                        mapping.setStream(values.get(0).toString());
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        input.setMapping(mapping);
                                                    } else {
                                                        if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_DETAILS)
                                                                .equals(names2.substring(names2.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                            Resource resource = registry.get(names2);
                                                            Hashtable propertiesHashtable = resource.getProperties();
                                                            Enumeration e = propertiesHashtable.keys();
                                                            while (e.hasMoreElements()) {
                                                                String key = (String) e.nextElement();
                                                                ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                if (CEPConstants.CEP_REGISTRY_TOPIC.equals(key)) {
                                                                    input.setTopic(values.get(0).toString());
                                                                } else if (CEPConstants.CEP_CONF_ELE_BROKER_NAME.equals(key)) {
                                                                    input.setBrokerName(values.get(0).toString());
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                bucket.addInput(input);
                                            } else if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_QUERIES)
                                                    .equals(attirbute.substring(attirbute.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                query = new Query();
                                                Expression expression = new Expression();
                                                Output output = new Output();
                                                Collection collection3 = (Collection) registry.get(names);
                                                for (String names2 : collection3.getChildren()) {
                                                    if (registry.get(names2) instanceof Collection) {
                                                        Collection outputCollection = (Collection) registry.get(names2);
                                                        for (String outputS : outputCollection.getChildren()) {
                                                            if (registry.get(outputS) instanceof Collection) {
                                                                Collection outputMapping = (Collection) registry.get(outputS);
                                                                if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_ELEMENT_MAPPING)
                                                                        .equals(outputS.substring(outputS.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                                    ElementMapping elementMapping = new ElementMapping();
                                                                    for (String mappingName : outputMapping.getChildren()) {
                                                                        if (registry.get(mappingName) instanceof Collection) {
                                                                            Collection propertyCollection = (Collection) registry.get(mappingName);
                                                                            for (String propertyName : propertyCollection.getChildren()) {
                                                                                Resource propertyResource = registry.get(propertyName);
                                                                                Hashtable propertiesHashtable = propertyResource.getProperties();
                                                                                Enumeration e = propertiesHashtable.keys();
                                                                                Property property = new Property();
                                                                                while (e.hasMoreElements()) {
                                                                                    String key = (String) e.nextElement();
                                                                                    ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                                    if (CEPConstants.CEP_REGISTRY_NAME.equals(key)) {
                                                                                        property.setName(values.get(0).toString());
                                                                                    } else if (CEPConstants.CEP_REGISTRY_XML_FIELD_NAME.equals(key)) {
                                                                                        property.setXmlFieldName(values.get(0).toString());
                                                                                    } else if (CEPConstants.CEP_REGISTRY_XML_FIELD_TYPE.equals(key)) {
                                                                                        property.setXmlFieldType(values.get(0).toString());
                                                                                    }
                                                                                }
                                                                                elementMapping.addProperty(property);
                                                                            }
                                                                        } else {
                                                                            Resource outputdetailsResource = registry.get(mappingName);
                                                                            Hashtable propertiesHashtable = outputdetailsResource.getProperties();
                                                                            Enumeration e = propertiesHashtable.keys();
                                                                            while (e.hasMoreElements()) {
                                                                                String key = (String) e.nextElement();
                                                                                ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                                if (CEPConstants.CEP_REGISTRY_DOC_ELEMENT.equals(key)) {
                                                                                    elementMapping.setDocumentElement(values.get(0).toString());
                                                                                } else if (CEPConstants.CEP_REGISTRY_NS.equals(key)) {
                                                                                    elementMapping.setNamespace(values.get(0).toString());
                                                                                }
                                                                            }
                                                                        }
                                                                        output.setElementMapping(elementMapping);
                                                                    }
                                                                } else {
                                                                    XMLMapping xmlMapping = null;
                                                                    for (String mappingName : outputMapping.getChildren()) {
                                                                        xmlMapping = new XMLMapping();
                                                                        if (registry.get(mappingName) instanceof Collection) {

                                                                        } else {
                                                                            Resource outputdetailsResource = registry.get(mappingName);
                                                                            Hashtable propertiesHashtable = outputdetailsResource.getProperties();
                                                                            Enumeration e = propertiesHashtable.keys();
                                                                            while (e.hasMoreElements()) {
                                                                                String key = (String) e.nextElement();
                                                                                ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                                if (CEPConstants.CEP_REGISTRY_TEXT.equals(key)) {
                                                                                    xmlMapping.setMappingXMLText(values.get(0).toString());
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                    output.setXmlMapping(xmlMapping);
                                                                }
                                                            } else {
                                                                Resource outputdetailsResource = registry.get(outputS);
                                                                Hashtable propertiesHashtable = outputdetailsResource.getProperties();
                                                                Enumeration e = propertiesHashtable.keys();
                                                                while (e.hasMoreElements()) {
                                                                    String key = (String) e.nextElement();
                                                                    ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                    if (CEPConstants.CEP_REGISTRY_TOPIC.equals(key)) {
                                                                        output.setTopic(values.get(0).toString());
                                                                    } else if (CEPConstants.CEP_CONF_ELE_BROKER_NAME.equals(key)) {
                                                                        output.setBrokerName(values.get(0).toString());
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    } else {
                                                        Resource detailsResource = registry.get(names2);
                                                        Hashtable propertiesHashtable = detailsResource.getProperties();
                                                        Enumeration e = propertiesHashtable.keys();
                                                        while (e.hasMoreElements()) {
                                                            String key = (String) e.nextElement();
                                                            ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                            if (CEPConstants.CEP_REGISTRY_NAME.equals(key)) {
                                                                query.setName(values.get(0).toString());
                                                            } else if (CEPConstants.CEP_REGISTRY_TYPE.equals(key)) {
                                                                expression.setType(values.get(0).toString());
                                                            } /*else if (CEPConstants.CEP_REGISTRY_EXPRESSION.equals(key)) {
                                                            expression.setText(values.get(0).toString());
                                                        }*/
                                                        }
                                                        String content = new String((byte[]) detailsResource.getContent());
                                                        expression.setText(content);
                                                    }
                                                }
                                                query.setExpression(expression);
                                                query.setOutput(output);
                                                bucket.addQuery(query);
                                            }
                                        }
                                    }
                                } else {
                                    Resource propertyResource = registry.get(attirbute);
                                    Hashtable propeHashtable = propertyResource.getProperties();
                                    Enumeration e = propeHashtable.keys();
                                    while (e.hasMoreElements()) {
                                        String key = (String) e.nextElement();
                                        ArrayList values = (ArrayList) propeHashtable.get(key);
                                        if (CEPConstants.CEP_CONF_ELE_NAME.equals(key)) {
                                            bucket.setName(values.get(0).toString().trim());
                                        } else if (CEPConstants.CEP_CONF_ELE_DESCRIPTION.equals(key)) {
                                            if(values.get(0) != null){
                                                bucket.setDescription(values.get(0).toString().trim());
                                            }else {
                                                bucket.setDescription("");
                                            }
                                        } else if (CEPConstants.CEP_CONF_ELE_CEP_ENGINE_PROVIDER.equals(key)) {
                                            bucket.setEngineProvider(values.get(0).toString().trim());
                                        } else if (CEPConstants.CEP_CONF_ELE_CEP_BUCKET_OWNER.equals(key)){
                                            bucket.setOwner(values.get(0).toString());
                                        }
                                    }

                                }
                            }
                        }
                        buckets[bucketCount] = bucket;
                        bucketCount++;
                    }
                }
            }
        } catch (RegistryException e) {
            String errorMessage = "Unable to load buckets from registry ";
            log.error(errorMessage, e);
            throw new CEPConfigurationException(errorMessage, e);
        }
        log.debug("Loaded buckets from the registry successfully");
        return buckets;
    }
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

            }
        } catch (RegistryException e) {
            String errorMessage = "Can not add bucket to the registry ";
            log.error(errorMessage, e);
            throw new CEPConfigurationException(errorMessage, e);
        }
        log.debug("Added the bucket to the registry successfully");
    }
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

            }
        } catch (RegistryException e) {
            String errorMessage = "Can not modify the bucket in registry ";
            log.error(errorMessage, e);
            throw new CEPConfigurationException(errorMessage, e);
        }
        log.debug("Modified the bucket successfully");
    }
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

            Registry registry = CEPServiceValueHolder.getInstance().getRegistry(tenantId);
            registry.delete(CEPConstants.CEP_CONF_ELE_CEP_BUCKETS);
        } catch (RegistryException e) {
            String errorMessage = "Error in removing all buckets from registry ";
            log.error(errorMessage, e);
            throw new CEPConfigurationException(errorMessage, e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

            Registry registry = CEPServiceValueHolder.getInstance().getRegistry(tenantId);
            registry.delete(CEPConstants.CEP_CONF_ELE_CEP_BUCKETS + CEPConstants.CEP_REGISTRY_BS + bucketName);
        } catch (RegistryException e) {
            String errorMessage = "Error in removing bucket :" + bucketName + " from registry ";
            log.error(errorMessage, e);
            throw new CEPConfigurationException(errorMessage, e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

                registry.delete(queryPath);
            }
        } catch (RegistryException e) {
            String errorMessage = "Error in deleting the query to be deleted ";
            log.error(errorMessage, e);
            throw new CEPConfigurationException(errorMessage, e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

                registry.delete(inputPath);
            }
        } catch (RegistryException e) {
            String errorMessage = "Error in deleting the input to be deleted ";
            log.error(errorMessage, e);
            throw new CEPConfigurationException(errorMessage, e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.cep.core.exception.CEPConfigurationException

        CEPEngineProvider cepEngineProvider;
        this.axisConfiguration = axisConfiguration;
        if (bucket.getEngineProvider() == null) {
            String errorMessage = "No cep engine provider is given";
            log.error(errorMessage);
            throw new CEPConfigurationException(errorMessage);
        } else {
            cepEngineProvider = this.cepEngineProviderMap.get(bucket.getEngineProvider());
            if (cepEngineProvider == null) {
                // we save this bucket to unDeployed Buckets list and simply return
                this.unDeployedBuckets.add(bucket);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.