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

com.eventsourcing.index.CommandJournalPersistence Maven / Gradle / Ivy

There is a newer version: 0.4.6
Show newest version
/**
 * Copyright (c) 2016, All Contributors (see CONTRIBUTORS file)
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.eventsourcing.index;

import com.eventsourcing.Command;
import com.eventsourcing.EntityHandle;
import com.eventsourcing.Journal;
import com.googlecode.cqengine.index.Index;
import com.googlecode.cqengine.index.support.CloseableIterator;
import com.googlecode.cqengine.persistence.support.ObjectStore;
import com.googlecode.cqengine.query.option.QueryOptions;

public class CommandJournalPersistence> extends JournalPersistence {
    public CommandJournalPersistence(Journal journal, Class klass) {
        super(journal, klass);
    }

    @Override
    public ObjectStore> createObjectStore() {
        return new CommandJournalObjectStore<>(journal, klass);
    }

    @Override
    public boolean supportsIndex(Index> index) {
        return true;
    }

    @Override
    public void openRequestScopeResources(QueryOptions queryOptions) {

    }

    @Override
    public void closeRequestScopeResources(QueryOptions queryOptions) {

    }

    static class CommandJournalObjectStore> extends JournalObjectStore {

        public CommandJournalObjectStore(Journal journal, Class klass) {
            super(journal, klass);
        }

        @Override
        public CloseableIterator> iterator(QueryOptions queryOptions) {
            return journal.commandIterator(klass);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy