Package org.wso2.carbon.rule.core

Examples of org.wso2.carbon.rule.core.LoggedRuntimeException


        if (message instanceof MessageContext) {
            MessageContext messageContext = ((MessageContext) message);
            return new ReturnValue(messageContext.getEnvelope(), true);
        }
        throw new LoggedRuntimeException("Invalid context object, expected Synapse Message Context",
                log);
    }
View Full Code Here


            Object result = mapper.getObjectFromOMNode((OMNode) tobeAdapted,new Properties());

            if (result instanceof Mediator) {
                return result;
            } else {
                throw new LoggedRuntimeException("Incompatible value for the sequence " +
                        result, log);
            }

        } else {
            throw new LoggedRuntimeException("Incompatible value for the sequence  " +
                    tobeAdapted, log);
        }
    }
View Full Code Here

     * @return The XML representation of rule mediator   (OMElement)
     */
    public OMElement serializeSpecificMediator(Mediator m) {

        if (!(m instanceof RuleMediator)) {
            throw new LoggedRuntimeException("Invalid Mediator has passed to serializer", log);
        }
        RuleMediator ruleMediator = (RuleMediator) m;
        RuleMediatorDescription ruleMediatorDescription = ruleMediator.getRuleMediatorDescription();
        OMElement ruleElement =
                RuleMediatorDescriptionSerializer.serialize(ruleMediatorDescription,
View Full Code Here

        Object ruleScript = description.getRuleSource();
        Map<String, Object> properties = PropertyDescriptionEvaluator.evaluate(
                description.getCreationProperties());
        InputStream in = ObjectToStreamConverter.toInputStream(ruleScript, properties);
        if (in == null) {
            throw new LoggedRuntimeException("The input stream form rule script is null.",
                    log);
        }

        ResourceTypeDetectionStrategy strategy = new DefaultResourceTypeDetectionStrategy();
        ResourceType resourceType = strategy.getResourceType(properties);

        knowledgeBuilder.add(ResourceFactory.newInputStreamResource(in), resourceType);
        if (knowledgeBuilder.hasErrors()) {
            throw new LoggedRuntimeException("Error during creating rule set: " +
                    knowledgeBuilder.getErrors(), log);
        }

        Collection<KnowledgePackage> pkgs = knowledgeBuilder.getKnowledgePackages();
        knowledgeBase.addKnowledgePackages(pkgs);
View Full Code Here

            }
            StatefulKnowledgeSession ruleSession = knowledgeBase.newStatefulKnowledgeSession(
                    configuration, null);

            if (ruleSession == null) {
                throw new LoggedRuntimeException("The created stateful rule session is null", log);
            }
            return new DroolsStatefulSession(ruleSession, properties);
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Using stateless rule session");
            }
            // create stateless rule session
            StatelessKnowledgeSession ruleSession =
                    knowledgeBase.newStatelessKnowledgeSession(configuration);

            if (ruleSession == null) {
                throw new LoggedRuntimeException("The created stateless rule session is null", log);
            }
            return new DroolsStatelessSession(ruleSession);
        }
    }
View Full Code Here

        } else if (tobeAdapted instanceof OMElement) {
            OMElement omElement = (OMElement) tobeAdapted;
            if (PayloadHelper.MAPELT.equals(omElement.getQName())) {
                return new SimpleMapImpl(omElement);
            } else {
                throw new LoggedRuntimeException("Incompatible value for the map " + "Wrong QName" +
                        omElement.getQName() + " expected " + PayloadHelper.MAPELT, log);
            }
        } else {
            throw new LoggedRuntimeException("Incompatible value for the map " +
                    tobeAdapted, log);
        }
    }
View Full Code Here

                               Object result,
                               Object context,
                               MessageInterceptor messageInterceptor) {

        if (description == null) {
            throw new LoggedRuntimeException("Cannot find Resource description. " +
                    "Invalid Resource !!", log);
        }
        if (result == null) {
            return false;
        }
View Full Code Here

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

     */
    public List execute(List<Object> facts) {
        try {
            return statelessRuleSession.executeRules(facts);
        } catch (InvalidRuleSessionException e) {
            throw new LoggedRuntimeException("Error was occurred when executing StateLess Session",
                    e, log);
        } catch (RemoteException e) {
            throw new LoggedRuntimeException("Error was occurred when executing StateLess Session",
                    e, log);
        }
    }
View Full Code Here

     */
    public void release() {
        try {
            statelessRuleSession.release();
        } catch (RemoteException e) {
            throw new LoggedRuntimeException("Error was occurred when executing StateLess Session",
                    e, log);
        } catch (InvalidRuleSessionException e) {
            throw new LoggedRuntimeException("Error was occurred when executing StateLess Session",
                    e, log);
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.rule.core.LoggedRuntimeException

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.