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

Examples of org.wso2.carbon.rulecep.commons.descriptions.service.OperationDescription


            PrivilegedCarbonContext.endTenantFlow();
        }
    }

    private void setTenantCredentialsInCarbonContext() {
        PrivilegedCarbonContext cc = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        cc.setTenantId(ownerTenantId);
        cc.setTenantDomain(ownerTenantDomain);
    }
View Full Code Here


            if (serviceDescription.getTargetNSPrefix() == null) {
                serviceDescription.setTargetNSPrefix(TARGET_NAMESPACE_PREFIX);
            }
        } else if (OperationDescription.TYPE.equals(extensibleConfiguration.geType())) {

            OperationDescription operationDescription =
                    (OperationDescription) extensibleConfiguration;
            operationDescription.setForceInOnly(true);
            CEPOperationExtensionDescription extensionDescription =
                    new CEPOperationExtensionDescription();

            QName parentQName = element.getQName();
            QNameFactory qNameFactory = QNameFactory.getInstance();

            QName inStreamQName = qNameFactory.createQName(CommonsConstants.ELE_INPUT_EVENT_STREAM,
                    parentQName);
            OMElement inStreamElement = element.getFirstChildWithName(inStreamQName);
            if (inStreamElement != null) {
                EventStreamDescription streamDescription =
                        EventStreamDescriptionFactory.create(inStreamElement, xPathFactory);
                extensionDescription.setInputEventStream(streamDescription);
            }

            QName outStreamQName = qNameFactory.createQName(CommonsConstants.ELE_OUTPUT_EVENT_STREAM,
                    parentQName);
            OMElement outStreamElement = element.getFirstChildWithName(outStreamQName);
            if (outStreamElement != null) {
                EventStreamDescription streamDescription =
                        EventStreamDescriptionFactory.create(outStreamElement, xPathFactory);
                extensionDescription.setOutputEventStream(streamDescription);
            }
            operationDescription.setExtensionDescription(extensionDescription);
        }
    }
View Full Code Here

                parent.addChild(ruleSetElement);
            }
            return parent;
        } else if (OperationDescription.TYPE.equals(configuration.geType())) {

            OperationDescription operationDescription = (OperationDescription) configuration;
            CEPOperationExtensionDescription extensionDescription =
                    (CEPOperationExtensionDescription)
                            operationDescription.getExtensionDescription();

            if (extensionDescription != null) {
                OMNamespaceFactory omNamespaceFactory = OMNamespaceFactory.getInstance();
                OMNamespace omNamespace = omNamespaceFactory.createOMNamespace(
                        parent.getNamespace().getNamespaceURI(), "");
View Full Code Here

        if (!"step5".equals(stepID)) {
            return;
        }

        String operationName = request.getParameter("operationName");
        OperationDescription description =
                serviceDescription.getRuleServiceOperationDescription(operationName);
        if (description == null) {
            description = new OperationDescription();
            description.setName(new QName(operationName));//TODO
            serviceDescription.addRuleServiceOperationDescription(description);
        } else {
            description.clearFacts();
            description.clearResults();
        }

        NameSpacesFactory nameSpacesFactory = NameSpacesFactory.getInstance();

        String factCountParameter = request.getParameter("factCount");

        if (factCountParameter != null && !"".equals(factCountParameter)) {
            int factCount = 0;
            try {
                factCount = Integer.parseInt(factCountParameter.trim());

                for (int i = 0; i < factCount; i++) {
                    String name = request.getParameter("factName" + i);
                    String type = request.getParameter("factType" + i);

                    if (type != null && !"".equals(type)) {
                        ResourceDescription resourceDescription = new ResourceDescription();
                        description.addFactDescription(resourceDescription);
                        resourceDescription.addNameSpaces(
                                nameSpacesFactory.createNameSpaces("factValue" + i,
                                        operationName, request.getSession()));
                        resourceDescription.setType(type.trim());
                        if (name != null && !"".equals(name)) {
                            resourceDescription.setName(name.trim());
                        }
                    }
                }
            } catch (NumberFormatException ignored) {
            }
        }

        String wrapperName = request.getParameter("wrapperName");
        if (wrapperName == null || "".equals(wrapperName)) {
            wrapperName = RuleConstants.DEFAULT_WRAPPER_NAME;
        }

        ResourceDescription wrapperDescription = new ResourceDescription();
        wrapperDescription.setType(OMElementResourceAdapter.TYPE);
        wrapperDescription.setName(wrapperName);
        String resultCountParameter = request.getParameter("resultCount");

        if (resultCountParameter != null && !"".equals(resultCountParameter)) {
            int resultCount = 0;
            try {
                resultCount = Integer.parseInt(resultCountParameter.trim());

                for (int i = 0; i < resultCount; i++) {
                    String name = request.getParameter("resultName" + i);
                    String type = request.getParameter("resultType" + i);

                    if (type != null && !"".equals(type)) {
                        ResourceDescription resourceDescription = new ResourceDescription();
                        wrapperDescription.addChildResource(resourceDescription);
                        resourceDescription.addNameSpaces(
                                nameSpacesFactory.createNameSpaces("resultValue" + i,
                                        operationName, request.getSession()));
                        resourceDescription.setType(type.trim());
                        if (name != null && !"".equals(name)) {
                            resourceDescription.setName(name.trim());
                        }
                    }
                }
            } catch (NumberFormatException ignored) {
            }
        }
        if (wrapperDescription.hasChildren()) {
            description.addResultDescription(wrapperDescription);
        }
    }
View Full Code Here

        Iterator<OperationDescription> iterator =
                ruleServiceDescription.getOperationDescriptions();
        MessageReceiverFactory messageReceiverFactory =
                deployerInformation.getMessageReceiverFactory();
        while (iterator.hasNext()) {
            OperationDescription opDes = iterator.next();
            AxisOperation axisOperation = axisService.getOperation(opDes.getName());
            // creates a rule service message receiver
            List<ResourceDescription> inputs = opDes.getFactDescriptions();
            List<ResourceDescription> outputs = opDes.getResultDescriptions();

            // if the operation is in-out but there is no result
            if (!(axisOperation instanceof InOnlyAxisOperation)) {

                if (outputs.isEmpty()) {
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

            // Adding static subscriptions
            List<Subscription> staticSubscriptionList =
                    eventSource.getSubscriptionManager().getStaticSubscriptions();
            for (Iterator<Subscription> iterator = staticSubscriptionList.iterator();
                 iterator.hasNext();) {
                Subscription staticSubscription = iterator.next();
                OMElement staticSubElem =
                        fac.createOMElement("subscription", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                staticSubElem.addAttribute(
                        fac.createOMAttribute("id", nullNS, staticSubscription.getId()));
                OMElement filterElem =
                        fac.createOMElement("filter", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                filterElem.addAttribute(fac.createOMAttribute("source", nullNS,
                        (String) staticSubscription.getFilterValue()));
                filterElem.addAttribute(fac.createOMAttribute("dialect", nullNS,
                        (String) staticSubscription.getFilterDialect()));
                staticSubElem.addChild(filterElem);
                OMElement endpointElem =
                        fac.createOMElement("endpoint", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                OMElement addressElem =
                        fac.createOMElement("address", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                addressElem.addAttribute(
                        fac.createOMAttribute("uri", nullNS, staticSubscription.getEndpointUrl()));
                endpointElem.addChild(addressElem);
                staticSubElem.addChild(endpointElem);
                if (staticSubscription.getExpires() != null) {
                    OMElement expiresElem =
                            fac.createOMElement("expires", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                    fac.createOMText(expiresElem,
                            ConverterUtil.convertToString(staticSubscription.getExpires()));
                    staticSubElem.addChild(expiresElem);
                }
                evenSourceElem.addChild(staticSubElem);
            }
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

                    .getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "class"));
            if (clazz != null) {
                String className = clazz.getAttributeValue();
                try {
                    Class subscriptionManagerClass = Class.forName(className);
                    SubscriptionManager manager =
                            (SubscriptionManager) subscriptionManagerClass.newInstance();
                    Iterator itr = subscriptionManagerElem.getChildrenWithName(PROPERTIES_QNAME);
                    while (itr.hasNext()) {
                        OMElement propElem = (OMElement) itr.next();
                        String propName =
                                propElem.getAttribute(new QName("name")).getAttributeValue();
                        String propValue =
                                propElem.getAttribute(new QName("value")).getAttributeValue();
                        if (propName != null && !"".equals(propName.trim()) &&
                                propValue != null && !"".equals(propValue.trim())) {

                            propName = propName.trim();
                            propValue = propValue.trim();

                            PasswordManager passwordManager =
                                    PasswordManager.getInstance();
                            String key = eventSource.getName() + "." + propName;

                            if (passwordManager.isInitialized()
                                    && passwordManager.isTokenProtected(key)) {
                                eventSource.putConfigurationProperty(propName, propValue);
                                propValue = passwordManager.resolve(propValue);
                            }

                            manager.addProperty(propName, propValue);
                        }
                    }
                    eventSource.setSubscriptionManager(manager);
                    eventSource.getSubscriptionManager()
                            .init(); // Initialise before doing further processing, required for static subscriptions
View Full Code Here

TOP

Related Classes of org.wso2.carbon.rulecep.commons.descriptions.service.OperationDescription

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.