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

pipeline.developerexamples.cloudengine.flowelements.SimpleCloudEngineBuilder Maven / Gradle / Ivy

There is a newer version: 4.3.13
Show newest version
/* ********************************************************************
 * Copyright (C) 2019  51Degrees Mobile Experts Limited.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 * ******************************************************************** */

package pipeline.developerexamples.cloudengine.flowelements;

import pipeline.developerexamples.cloudengine.data.StarSignData;
import fiftyone.pipeline.cloudrequestengine.flowelements.CloudRequestEngine;
import fiftyone.pipeline.core.data.FlowData;
import fiftyone.pipeline.core.data.factories.ElementDataFactory;
import fiftyone.pipeline.core.flowelements.FlowElement;
import fiftyone.pipeline.engines.flowelements.CloudAspectEngineBuilderBase;
import fiftyone.pipeline.engines.services.MissingPropertyServiceDefault;
import org.slf4j.ILoggerFactory;

import java.util.List;


//! [class]
public class SimpleCloudEngineBuilder
    extends CloudAspectEngineBuilderBase<
            SimpleCloudEngineBuilder,
            SimpleCloudEngine> {
    private CloudRequestEngine cloudRequestEngine;

    public SimpleCloudEngineBuilder(
        ILoggerFactory loggerFactory,
        CloudRequestEngine engine) {
        super(loggerFactory);
        this.cloudRequestEngine = engine;
    }

    @Override
    protected SimpleCloudEngine newEngine(List properties) {
        SimpleCloudEngine engine = new SimpleCloudEngine(
            loggerFactory.getLogger(SimpleCloudEngine.class.getName()),
            new ElementDataFactory() {
                @Override
                public StarSignData create(
                    FlowData flowData,
                    FlowElement flowElement) {
                    return new StarSignDataInternal(
                        loggerFactory.getLogger(StarSignDataInternal.class.getName()),
                        flowData,
                        (SimpleCloudEngine)flowElement,
                        MissingPropertyServiceDefault.getInstance());
                }
            },
            cloudRequestEngine);
        return engine;
    }

    public SimpleCloudEngine build() throws Exception {
        return buildEngine();
    }
}
//! [class]




© 2015 - 2024 Weber Informatics LLC | Privacy Policy