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

ch.dissem.bitmessage.repository.JdbcMessageRepository Maven / Gradle / Ivy

Go to download

A Java implementation of the Bitmessage protocol. This contains JDBC implementations of the repositories.

There is a newer version: 2.0.4
Show newest version
/*
 * Copyright 2015 Christian Basler
 *
 * 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.
 */

package ch.dissem.bitmessage.repository;

import ch.dissem.bitmessage.entity.Plaintext;
import ch.dissem.bitmessage.entity.valueobject.InventoryVector;
import ch.dissem.bitmessage.entity.valueobject.Label;
import ch.dissem.bitmessage.exception.ApplicationException;
import ch.dissem.bitmessage.ports.AbstractMessageRepository;
import ch.dissem.bitmessage.ports.MessageRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import static ch.dissem.bitmessage.repository.JdbcHelper.writeBlob;

public class JdbcMessageRepository extends AbstractMessageRepository implements MessageRepository {
    private static final Logger LOG = LoggerFactory.getLogger(JdbcMessageRepository.class);

    private final JdbcConfig config;

    public JdbcMessageRepository(JdbcConfig config) {
        this.config = config;
    }

    @Override
    protected List