Examples of RuleMediatorDescription


Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.mediator.RuleMediatorDescription

     * @param confElement The OMElement -  The XML representation of rule mediator
     * @return Returns an instance of rule mediator
     */
    public Mediator createSpecificMediator(OMElement confElement , Properties properties) {

        RuleMediatorDescription ruleMediatorDescription =
                RuleMediatorDescriptionFactory.create(confElement, XPATH_FACTORY, CONFIGURATION_EXTENSION_BUILDER);
        RuleMediator ruleMediator = new RuleMediator(ruleMediatorDescription);

        // after successfully creating the mediator
        // set its common attributes such as tracing etc
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.mediator.RuleMediatorDescription

        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,
                        SYNAPSE_XPATH_SERIALIZER, CONFIGURATION_EXTENSION_SERIALIZER);
        saveTracingState(ruleElement, ruleMediator);
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.mediator.RuleMediatorDescription

    public void testMediator() throws Exception {
        RuleServerManager ruleServerManager = new RuleServerManager();// TODO to get from a OSGI service
        RuleServerConfiguration configuration = new RuleServerConfiguration(
                new DroolsBackendRuntimeFactory());
        ruleServerManager.init(configuration); //TODO
        RuleMediatorDescription ruleMediatorDescription = new RuleMediatorDescription();
        ResourceDescription inputOne = new ResourceDescription();
        inputOne.setName("symbol");
        Symbol ibm = new Symbol("IBM");

        ResourceDescription childOfInputOne = new ResourceDescription();
        childOfInputOne.setName("symbol");
        childOfInputOne.setValue("IBM");
        childOfInputOne.setType(String.class.getName());
        inputOne.addChildResource(childOfInputOne);
        inputOne.setType(ibm.getClass().getName());
        inputOne.setValue(ibm);

        ResourceDescription outputOne = new ResourceDescription();
        outputOne.setName("symbolCustom");
//        outputOne.addChildResource(childOfInputOne);
        outputOne.setType(ibm.getClass().getName());

        ResourceDescription outputsTwo = new ResourceDescription();
        outputsTwo.setName("om");
        outputsTwo.setType(OMElementResourceAdapter.TYPE);
//        outputsTwo.addChildResource(childOfInputOne);

        ResourceDescription outputThree = new ResourceDescription();
        AXIOMXPath target = new AXIOMXPath("//m:request/m:symbol");
        target.addNamespace("m", "http://services.samples/xsd/xsd");
        outputThree.setName("symbol");
        outputThree.setType(String.class.getName());

        AXIOMXPath target2 = new AXIOMXPath("//m:request/m:Symbol");
        target2.addNamespace("m", "http://services.samples/xsd/xsd");

        outputOne.setExpression(target);
        outputsTwo.setExpression(target);
        outputThree.setExpression(target2);

//        PropertyDescription enrtyPoint = new PropertyDescription();
//        enrtyPoint.setName("symbol");
//        enrtyPoint.setValue("Stock Stream");
        SessionDescription sessionDescription = new SessionDescription();
        sessionDescription.setSessionType(SessionDescription.STATEFUL_SESSION);
//        sessionDescription.addSessionPropertyDescription(enrtyPoint);
        ruleMediatorDescription.setSessionDescription(sessionDescription);
        ruleMediatorDescription.addFactDescription(inputOne);
//        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);

        for (int i = 0; i < 3; i++) {
            MessageContext mcTemp = getMessageContext();
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.mediator.RuleMediatorDescription

            "end\n" +
            "]]></x>";

    public void testMediator() throws Exception {

        RuleMediatorDescription ruleMediatorDescription = new RuleMediatorDescription();
        ResourceDescription inputOne = new ResourceDescription();
        inputOne.setName("symbol");
        inputOne.setType(POJOResourceAdapter.TYPE);
        Symbol ibm = new Symbol("IBM");

        ResourceDescription childOfInputOne = new ResourceDescription();
        childOfInputOne.setName("symbol");
        childOfInputOne.setValue("IBM");
        childOfInputOne.setType(String.class.getName());
        ResourceDescription childOfInputTwo = new ResourceDescription();
        childOfInputTwo.setName("price");
        childOfInputTwo.setValue("10000.00");
        childOfInputTwo.setType(Double.class.getName());
        inputOne.addChildResource(childOfInputOne);
        inputOne.addChildResource(childOfInputTwo);
        inputOne.setType(ibm.getClass().getName());
        inputOne.setValue(ibm);

        ResourceDescription outputOne = new ResourceDescription();
        outputOne.setName("symbolCustom");
        outputOne.setType(POJOResourceAdapter.TYPE);
        outputOne.addChildResource(childOfInputOne);
        outputOne.setType(ibm.getClass().getName());

        ResourceDescription outputsTwo = new ResourceDescription();
        outputsTwo.setName("om");
        outputsTwo.setType(OMElementResourceAdapter.TYPE);
//        outputsTwo.addChildResource(childOfInputOne);

        ResourceDescription outputThree = new ResourceDescription();
        AXIOMXPath target = new AXIOMXPath("//m:request/m:symbol");
        target.addNamespace("m", "http://services.samples/xsd/xsd");
        outputThree.setName("symbol");
        outputThree.setType(String.class.getName());

        AXIOMXPath target2 = new AXIOMXPath("//m:request/m:Symbol");
        target2.addNamespace("m", "http://services.samples/xsd/xsd");

        outputOne.setExpression(target);
        outputsTwo.setExpression(target);
        outputThree.setExpression(target2);

//        PropertyDescription enrtyPoint = new PropertyDescription();
//        enrtyPoint.setName("symbol");
//        enrtyPoint.setValue("Stock Stream");
        SessionDescription sessionDescription = new SessionDescription();
        sessionDescription.setSessionType(SessionDescription.STATEFUL_SESSION);
        RuleServerManager ruleServerManager = new RuleServerManager();// TODO to get from a OSGI service
        RuleServerConfiguration configuration = new RuleServerConfiguration(new JSR94BackendRuntimeFactory());
        ruleServerManager.init(configuration); //TODO

//        sessionDescription.addSessionPropertyDescription(enrtyPoint);
        ruleMediatorDescription.setSessionDescription(sessionDescription);
        ruleMediatorDescription.addFactDescription(inputOne);
//        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);

        for (int i = 0; i < 3; i++) {
            MessageContext mcTemp = getMessageContext();
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.