001/*
002 * Licensed to DuraSpace under one or more contributor license agreements.
003 * See the NOTICE file distributed with this work for additional information
004 * regarding copyright ownership.
005 *
006 * DuraSpace licenses this file to you under the Apache License,
007 * Version 2.0 (the "License"); you may not use this file except in
008 * compliance with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019/*
020 * Copyright 2015 DuraSpace, Inc.
021 *
022 * Licensed under the Apache License, Version 2.0 (the "License");
023 * you may not use this file except in compliance with the License.
024 * You may obtain a copy of the License at
025 *
026 *     http://www.apache.org/licenses/LICENSE-2.0
027 *
028 * Unless required by applicable law or agreed to in writing, software
029 * distributed under the License is distributed on an "AS IS" BASIS,
030 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
031 * See the License for the specific language governing permissions and
032 * limitations under the License.
033 */
034package org.fcrepo.kernel.modeshape.utils.iterators;
035
036import com.google.common.util.concurrent.ListenableFuture;
037import org.fcrepo.kernel.api.exception.MalformedRdfException;
038
039/**
040 * Implemented by something that can consume an {@link java.util.Iterator}. The
041 * assumption is that a reference to the appropriate iterator is managed as part
042 * of the state of any implementation.
043 * 
044 * @author ajs6f
045 * @since Oct 24, 2013
046 * @param <E> E
047 * @param <T> T
048 */
049public interface IteratorConsumer<E, T> {
050
051    /**
052     * Synchronous consumption.
053     * @throws MalformedRdfException if malformed rdf exception occurred
054     */
055    void consume() throws MalformedRdfException;
056
057    /**
058     * Asynchronous consumption.
059     *
060     * @return ListenableFuture
061     */
062    ListenableFuture<T> consumeAsync();
063
064}