All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.marklogic.hub.step.MarkLogicStepDefinitionProvider Maven / Gradle / Ivy

There is a newer version: 6.1.1
Show newest version
package com.marklogic.hub.step;

import com.fasterxml.jackson.databind.JsonNode;
import com.marklogic.client.DatabaseClient;
import com.marklogic.hub.dataservices.StepDefinitionService;

/**
 * Implementation that retrieves step definitions from MarkLogic via a data service.
 */
public class MarkLogicStepDefinitionProvider implements StepDefinitionProvider {

    private final StepDefinitionService service;

    public MarkLogicStepDefinitionProvider(DatabaseClient databaseClient) {
        this.service = StepDefinitionService.on(databaseClient);
    }

    @Override
    public StepDefinition getStepDefinition(String name, StepDefinition.StepDefinitionType type) {
        JsonNode json = service.getStepDefinition(name, type.name());
        StepDefinition step = StepDefinition.create(name, type);
        step.deserialize(json);
        return step;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy