view pkg/imports/dmv.go @ 1855:bbd653a43a6a

Distance marks virtual import: Added stub.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 17 Jan 2019 11:45:33 +0100
parents
children 9780cb4ef6a6
line wrap: on
line source

// This is Free Software under GNU Affero General Public License v >= 3.0
// without warranty, see README.md and license for details.
//
// SPDX-License-Identifier: AGPL-3.0-or-later
// License-Filename: LICENSES/AGPL-3.0.txt
//
// Copyright (C) 2018 by via donau
//   – Österreichische Wasserstraßen-Gesellschaft mbH
// Software engineering by Intevation GmbH
//
// Author(s):
//  * Sascha L. Teichmann <sascha.teichmann@intevation.de>

package imports

import (
	"context"
	"database/sql"
	"errors"

	"gemma.intevation.de/gemma/pkg/common"
)

type DistanceMarksVirtual struct {
	// URL is the URL of the SOAP service.
	URL string `json:"url"`
	// Username is the username used to authenticate.
	Username string `json:"username"`
	// Passwort is the password to authenticate.
	Password string `json:"password"`
	// Insecure indicates if HTTPS traffic
	// should validate certificates or not.
	Insecure bool `json:"insecure"`
}

const DMVJobKind JobKind = "dmv"

type dmvJobCreator struct{}

func init() {
	RegisterJobCreator(DMVJobKind, dmvJobCreator{})
}

func (dmvJobCreator) Description() string { return "distance marks virtual" }

func (dmvJobCreator) AutoAccept() bool { return true }

func (dmvJobCreator) Create(_ JobKind, data string) (Job, error) {
	dmv := new(DistanceMarksVirtual)
	if err := common.FromJSONString(data, dmv); err != nil {
		return nil, err
	}
	return dmv, nil
}

func (dmvJobCreator) Depends() []string {
	return []string{
		"distance_marks_virtual",
	}
}

// StageDone does nothing as there is no staging for distance marks virtual.
func (dmvJobCreator) StageDone(context.Context, *sql.Tx, int64) error { return nil }

// CleanUp does nothing as there is nothing to cleanup with distance marks virtual.
func (*DistanceMarksVirtual) CleanUp() error { return nil }

func (dmv *DistanceMarksVirtual) Do(
	ctx context.Context,
	importID int64,
	conn *sql.Conn,
	feedback Feedback,
) (interface{}, error) {

	// TODO: Implement me!

	return nil, errors.New("Not implemented, yet!")
}