Package org.switchyard.component.common.knowledge.config.model.v1

Examples of org.switchyard.component.common.knowledge.config.model.v1.V1MappingModel


     */
    protected ListenersModel toListenersModel(Listener[] listenerAnnotations, KnowledgeNamespace knowledgeNamespace) {
        if (listenerAnnotations == null || listenerAnnotations.length == 0) {
            return null;
        }
        ListenersModel listenersModel = new V1ListenersModel(knowledgeNamespace.uri());
        for (Listener listenerAnnotation : listenerAnnotations) {
            ListenerModel listenerModel = new V1ListenerModel(knowledgeNamespace.uri());
            listenerModel.setClazz(listenerAnnotation.value());
            listenersModel.addListener(listenerModel);
        }
        return listenersModel;
    }
View Full Code Here


        if (loggerAnnotations == null || loggerAnnotations.length == 0) {
            return null;
        }
        LoggersModel loggersModel = new V1LoggersModel(knowledgeNamespace.uri());
        for (Logger loggerAnnotation : loggerAnnotations) {
            LoggerModel loggerModel = new V1LoggerModel(knowledgeNamespace.uri());
            int interval = loggerAnnotation.interval();
            if (interval > -1) {
                loggerModel.setInterval(interval);
            }
            String log = loggerAnnotation.log();
            if (!UNDEFINED.equals(log)) {
                loggerModel.setLog(log);
            }
            LoggerType loggerType = loggerAnnotation.type();
            if (!LoggerType.THREADED_FILE.equals(loggerType)) {
                loggerModel.setType(loggerType);
            }
            loggersModel.addLogger(loggerModel);
        }
        return loggersModel;
    }
View Full Code Here

     */
    protected LoggersModel toLoggersModel(Logger[] loggerAnnotations, KnowledgeNamespace knowledgeNamespace) {
        if (loggerAnnotations == null || loggerAnnotations.length == 0) {
            return null;
        }
        LoggersModel loggersModel = new V1LoggersModel(knowledgeNamespace.uri());
        for (Logger loggerAnnotation : loggerAnnotations) {
            LoggerModel loggerModel = new V1LoggerModel(knowledgeNamespace.uri());
            int interval = loggerAnnotation.interval();
            if (interval > -1) {
                loggerModel.setInterval(interval);
            }
            String log = loggerAnnotation.log();
            if (!UNDEFINED.equals(log)) {
                loggerModel.setLog(log);
            }
            LoggerType loggerType = loggerAnnotation.type();
            if (!LoggerType.THREADED_FILE.equals(loggerType)) {
                loggerModel.setType(loggerType);
            }
            loggersModel.addLogger(loggerModel);
        }
        return loggersModel;
    }
View Full Code Here

    protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) {
        if (manifestAnnotations == null || manifestAnnotations.length == 0) {
            return null;
        }
        Manifest manifestAnnotation = manifestAnnotations[0];
        ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri());
        Container[] container = manifestAnnotation.container();
        if (container != null && container.length > 0) {
            manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace));
        }
        manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace));
        return manifestModel;
    }
View Full Code Here

        String processId = bpm.processId();
        if (UNDEFINED.equals(processId)) {
            processId = bpmName;
        }
        componentImplementationModel.setProcessId(processId);
        OperationsModel operationsModel = new V1OperationsModel(bpmNamespace.uri());
        JavaService javaService = JavaService.fromClass(bpmInterface);
        for (Method method : bpmClass.getDeclaredMethods()) {
            BPMOperationType operationType = null;
            String eventId = null;
            Global[] globalMappingAnnotations = null;
            Input[] inputMappingAnnotations = null;
            Output[] outputMappingAnnotations = null;
            Fault[] faultMappingAnnotations = null;
            if (START_PROCESS_FILTER.matches(method)) {
                operationType = BPMOperationType.START_PROCESS;
                StartProcess startProcessAnnotation = method.getAnnotation(StartProcess.class);
                globalMappingAnnotations = startProcessAnnotation.globals();
                inputMappingAnnotations = startProcessAnnotation.inputs();
                outputMappingAnnotations = startProcessAnnotation.outputs();
                faultMappingAnnotations = startProcessAnnotation.faults();
            } else if (SIGNAL_EVENT_FILTER.matches(method)) {
                operationType = BPMOperationType.SIGNAL_EVENT;
                SignalEvent signalEventAnnotation = method.getAnnotation(SignalEvent.class);
                eventId = Strings.trimToNull(signalEventAnnotation.eventId());
                globalMappingAnnotations = signalEventAnnotation.globals();
                inputMappingAnnotations = signalEventAnnotation.inputs();
                outputMappingAnnotations = signalEventAnnotation.outputs();
                faultMappingAnnotations = signalEventAnnotation.faults();
            } else if (SIGNAL_EVENT_ALL_FILTER.matches(method)) {
                operationType = BPMOperationType.SIGNAL_EVENT_ALL;
                SignalEventAll signalEventAllAnnotation = method.getAnnotation(SignalEventAll.class);
                eventId = Strings.trimToNull(signalEventAllAnnotation.eventId());
                globalMappingAnnotations = signalEventAllAnnotation.globals();
                inputMappingAnnotations = signalEventAllAnnotation.inputs();
                outputMappingAnnotations = signalEventAllAnnotation.outputs();
                faultMappingAnnotations = signalEventAllAnnotation.faults();
            } else if (ABORT_PROCESS_INSTANCE_FILTER.matches(method)) {
                operationType = BPMOperationType.ABORT_PROCESS_INSTANCE;
                AbortProcessInstance abortProcessInstanceAnnotation = method.getAnnotation(AbortProcessInstance.class);
                globalMappingAnnotations = new Global[]{};
                inputMappingAnnotations = new Input[]{};
                outputMappingAnnotations = abortProcessInstanceAnnotation.outputs();
                faultMappingAnnotations = abortProcessInstanceAnnotation.faults();
            }
            if (operationType != null) {
                ServiceOperation serviceOperation = javaService.getOperation(method.getName());
                if (serviceOperation != null) {
                    OperationModel operationModel = new V1BPMOperationModel(bpmNamespace.uri());
                    operationModel.setEventId(eventId);
                    operationModel.setName(serviceOperation.getName());
                    operationModel.setType(operationType);
                    operationModel.setGlobals(toGlobalsModel(globalMappingAnnotations, bpmNamespace));
                    operationModel.setInputs(toInputsModel(inputMappingAnnotations, bpmNamespace));
                    operationModel.setOutputs(toOutputsModel(outputMappingAnnotations, bpmNamespace));
                    operationModel.setFaults(toFaultsModel(faultMappingAnnotations, bpmNamespace));
                    operationsModel.addOperation(operationModel);
                }
            }
        }
        if (!operationsModel.getOperations().isEmpty()) {
            componentImplementationModel.setOperations(operationsModel);
        }
        componentImplementationModel.setChannels(toChannelsModel(bpm.channels(), bpmNamespace, componentModel, switchyardNamespace));
        componentImplementationModel.setListeners(toListenersModel(bpm.listeners(), bpmNamespace));
        componentImplementationModel.setLoggers(toLoggersModel(bpm.loggers(), bpmNamespace));
View Full Code Here

                    break;
                }
            }
        }
        RulesComponentImplementationModel componentImplementationModel = new V1RulesComponentImplementationModel(rulesNamespace.uri());
        OperationsModel operationsModel = new V1OperationsModel(rulesNamespace.uri());
        JavaService javaService = JavaService.fromClass(rulesInterface);
        for (Method method : rulesClass.getDeclaredMethods()) {
            RulesOperationType operationType = null;
            String eventId = null;
            Global[] globalMappingAnnotations = null;
            Input[] inputMappingAnnotations = null;
            Output[] outputMappingAnnotations = null;
            Fault[] faultMappingAnnotations = null;
            if (EXECUTE_FILTER.matches(method)) {
                operationType = RulesOperationType.EXECUTE;
                Execute executeAnnotation = method.getAnnotation(Execute.class);
                globalMappingAnnotations = executeAnnotation.globals();
                inputMappingAnnotations = executeAnnotation.inputs();
                outputMappingAnnotations = executeAnnotation.outputs();
                faultMappingAnnotations = executeAnnotation.faults();
            } else if (INSERT_FILTER.matches(method)) {
                operationType = RulesOperationType.INSERT;
                Insert insertAnnotation = method.getAnnotation(Insert.class);
                globalMappingAnnotations = insertAnnotation.globals();
                inputMappingAnnotations = insertAnnotation.inputs();
                outputMappingAnnotations = insertAnnotation.outputs();
                faultMappingAnnotations = insertAnnotation.faults();
            } else if (FIRE_ALL_RULES_FILTER.matches(method)) {
                operationType = RulesOperationType.FIRE_ALL_RULES;
                FireAllRules fireAllRulesAnnotation = method.getAnnotation(FireAllRules.class);
                globalMappingAnnotations = fireAllRulesAnnotation.globals();
                inputMappingAnnotations = fireAllRulesAnnotation.inputs();
                outputMappingAnnotations = fireAllRulesAnnotation.outputs();
                faultMappingAnnotations = fireAllRulesAnnotation.faults();
            } else if (FIRE_UNTIL_HALT_FILTER.matches(method)) {
                operationType = RulesOperationType.FIRE_UNTIL_HALT;
                FireUntilHalt fireUntilHaltAnnotation = method.getAnnotation(FireUntilHalt.class);
                eventId = Strings.trimToNull(fireUntilHaltAnnotation.eventId());
                globalMappingAnnotations = fireUntilHaltAnnotation.globals();
                inputMappingAnnotations = fireUntilHaltAnnotation.inputs();
                outputMappingAnnotations = fireUntilHaltAnnotation.outputs();
                faultMappingAnnotations = fireUntilHaltAnnotation.faults();
            }
            if (operationType != null) {
                ServiceOperation serviceOperation = javaService.getOperation(method.getName());
                if (serviceOperation != null) {
                    OperationModel operationModel = new V1RulesOperationModel(rulesNamespace.uri());
                    operationModel.setEventId(eventId);
                    operationModel.setName(serviceOperation.getName());
                    operationModel.setType(operationType);
                    operationModel.setGlobals(toGlobalsModel(globalMappingAnnotations, rulesNamespace));
                    operationModel.setInputs(toInputsModel(inputMappingAnnotations, rulesNamespace));
                    operationModel.setOutputs(toOutputsModel(outputMappingAnnotations, rulesNamespace));
                    operationModel.setFaults(toFaultsModel(faultMappingAnnotations, rulesNamespace));
                    operationsModel.addOperation(operationModel);
                }
            }
        }
        if (!operationsModel.getOperations().isEmpty()) {
            componentImplementationModel.setOperations(operationsModel);
        }
        componentImplementationModel.setChannels(toChannelsModel(rules.channels(), rulesNamespace, componentModel, switchyardNamespace));
        componentImplementationModel.setListeners(toListenersModel(rules.listeners(), rulesNamespace));
        componentImplementationModel.setLoggers(toLoggersModel(rules.loggers(), rulesNamespace));
View Full Code Here

    protected OutputsModel toOutputsModel(Output[] outputs, KnowledgeNamespace knowledgeNamespace) {
        OutputsModel outputsModel = null;
        if (outputs != null) {
            for (Output output : outputs) {
                if (output != null) {
                    OutputModel outputModel = new V1OutputModel(knowledgeNamespace.uri());
                    String from = output.from();
                    if (!UNDEFINED.equals(from)) {
                        outputModel.setFrom(from);
                    }
                    String to = output.to();
                    if (!UNDEFINED.equals(to)) {
                        outputModel.setTo(to);
                    }
                    if (outputsModel == null) {
                        outputsModel = new V1OutputsModel(knowledgeNamespace.uri());
                    }
                    outputsModel.addOutput(outputModel);
View Full Code Here

                    String to = output.to();
                    if (!UNDEFINED.equals(to)) {
                        outputModel.setTo(to);
                    }
                    if (outputsModel == null) {
                        outputsModel = new V1OutputsModel(knowledgeNamespace.uri());
                    }
                    outputsModel.addOutput(outputModel);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.switchyard.component.common.knowledge.config.model.v1.V1MappingModel

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.