/*-
 * ~~~~~~licensing~~~~~~
 * connection-producer
 * ==========
 * Copyright (C) 2020 - 2021 EmDev LLC
 * ==========
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ~~~~~~/licensing~~~~~~
 */
package ru.entaxy.esb.platform.runtime.base.connecting.producer.connection;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.api.Adapter;
import ru.entaxy.esb.platform.runtime.base.connecting.connection.Connection;
import ru.entaxy.esb.platform.runtime.base.connecting.connection.ConnectionImpl;
import ru.entaxy.esb.platform.runtime.base.connecting.producer.Producer;

import java.util.HashMap;
import java.util.Map;

public class ConnectionProducer implements Producer {

    private static final Logger log = LoggerFactory.getLogger(ConnectionProducer.class);
    private static final Map<String,Adapter> adapterMap = new HashMap<>();

    @Override
    public Connection createConnection(JsonObject jsonConnection) {
        return new Gson().fromJson(jsonConnection, ConnectionImpl.class);
    }

    @Override
    public Connection useConnection(JsonObject jsonConnection) {
        return null;
    }

}
