Package org.wso2.carbon.rulecep.commons.descriptions.rule

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription


        RuleEngine ruleEngine =
                RuleServiceManger.getInstance().getRuleServerManagerService().createRuleEngine(
                        axisService.getClassLoader());
        RuleServiceExtensionDescription extensionDescription =
                (RuleServiceExtensionDescription) serviceDescription.getServiceExtensionDescription();
        RuleSetDescription ruleSetDescription = extensionDescription.getRuleSetDescription();
        Object ruleSource = ruleSetDescription.getRuleSource();

        int tenantId =  SuperTenantCarbonContext.getCurrentContext(axisService).getTenantId();
        if (ruleSource == null) {
            Object value = loadRuleScript(axisService.getClassLoader(), ruleSetDescription,
                    resourceLoader,tenantId);
            if (value == null) {
                throw new LoggedRuntimeException("Cannot load the rule script from" +
                        " the " + ruleSetDescription, log);
            }
            ruleSetDescription.setRuleSource(value);
        }

        String uri = ruleEngine.addRuleSet(ruleSetDescription);
        return new RuleServiceEngine(axisService, ruleEngine, uri);
    }
View Full Code Here


            ServiceDescription ruleServiceDescription = getRuleServiceDescription(request);
            if (ruleServiceDescription != null) {
                ruleServiceDescription.setExtension(RuleConstants.RULE_SERVICE_ARCHIVE_EXTENSION);
                RuleServiceExtensionDescription extensionDescription =
                        (RuleServiceExtensionDescription) ruleServiceDescription.getServiceExtensionDescription();
                RuleSetDescription ruleSetDescription =
                        extensionDescription.getRuleSetDescription();
                if (ruleSetDescription != null) {
                    ruleSetDescription.setPath(fileName);
                    ruleSetDescription.setKey("");
                    ruleSetDescription.setRuleSource(null); //remove rule source
                }
            }
        } catch (Exception e) {
            throw new RuleServiceClientException("Error uploading rule script : " + fileName, log);
        }
View Full Code Here

                                      XPathSerializer xPathSerializer,
                                      ExtensionSerializer configurationExtensionSerializer) {

        OMElement ruleElement = fac.createOMElement("rule", synNS);

        RuleSetDescription ruleSetDescription = ruleMediatorDescription.getRuleSetDescription();
        if (ruleSetDescription != null) {
            OMElement ruleSetElement = fac.createOMElement(CommonsConstants.ELE_RULESET, synNS);
            RuleSetDescriptionSerializer.serialize(ruleSetDescription, xPathSerializer,
                    ruleSetElement, configurationExtensionSerializer);
            ruleElement.addChild(ruleSetElement);
View Full Code Here

        ruleEngine = Util.getRuleServerManagerService().createRuleEngine(
                        Thread.currentThread().getContextClassLoader());
       
        String ruleFile = handlerConfig.get("file");
        ruleFile = CarbonUtils.getCarbonConfigDirPath() + "/" + ruleFile;
        RuleSetDescription ruleSetDescription = new RuleSetDescription();
       
        try {
            ruleSetDescription.setRuleSource(new FileInputStream(ruleFile));
        } catch (FileNotFoundException e) {
            String msg = "file not found. file name: " + ruleFile + ".";
            throw new BillingException(msg, e);
        }
       
View Full Code Here

    public synchronized void updateRules() throws ThrottlingException {
        ruleEngine =
                Util.getRuleServerManagerService().createRuleEngine(
                        Thread.currentThread().getContextClassLoader());
        RuleSetDescription ruleSetDescription = new RuleSetDescription();
        Resource ruleContentResource;
        // getting the resource content.
        try {
            UserRegistry systemRegistry = Util.getSuperTenantGovernanceSystemRegistry();
            ruleContentResource =
                    systemRegistry.get(StratosConstants.THROTTLING_RULES_PATH);
        } catch (RegistryException e) {
            String msg =
                    "Error in reading the rule resource content. resource path: " +
                            StratosConstants.THROTTLING_RULES_PATH + ".";
            log.error(msg, e);
            throw new ThrottlingException(msg, e);
        } catch (Exception e) {
            String msg = "Error in loading the rules.";
            log.error(msg, e);
            throw new ThrottlingException(msg, e);
        }

        try {
            ruleSetDescription.setRuleSource(ruleContentResource.getContentStream());
        } catch (RegistryException e) {
            String msg = "Error in loading the rules from the content stream.";
            log.error(msg, e);
            throw new ThrottlingException(msg, e);
        }
View Full Code Here

//        configuration.addOutputResourceDescription(outputThree);
//        configuration.addOutputResourceDescription(outputOne);
        ruleMediatorDescription.addResultDescription(outputsTwo);


        RuleSetDescription setDescription = new RuleSetDescription();
        setDescription.setBindURI("RoutingRules");
        setDescription.setRuleSource(createOMElement(drlRule));

        PropertyDescription creationDescription = new PropertyDescription();
        creationDescription.setName(RuleConstants.SOURCE);
        creationDescription.setValue("drl");
        setDescription.addCreationProperty(creationDescription);

        ruleMediatorDescription.setRuleSetDescription(setDescription);
        RuleMediator ruleMediator = new RuleMediator(ruleMediatorDescription);
        ruleMediator.init(null);
View Full Code Here

//        configuration.addOutputResourceDescription(outputThree);
//        configuration.addOutputResourceDescription(outputOne);
        ruleMediatorDescription.addResultDescription(outputsTwo);


        RuleSetDescription setDescription = new RuleSetDescription();
        setDescription.setBindURI("RoutingRules");
        setDescription.setRuleSource(createOMElement(drlRule));

        PropertyDescription creationDescription = new PropertyDescription();
        creationDescription.setName(RuleConstants.SOURCE);
        creationDescription.setValue("drl");
        setDescription.addCreationProperty(creationDescription);

        ruleMediatorDescription.setRuleSetDescription(setDescription);
        RuleMediator ruleMediator = new RuleMediator(ruleMediatorDescription);
        ruleMediator.init(null);
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

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.