View Javadoc

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *  http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17
    18  package org.apache.any23.writer;
    19
    20  import java.io.OutputStream;
    21
    22  import org.apache.any23.configuration.Settings;
    23  import org.eclipse.rdf4j.rio.RDFFormat;
    24
    25  /**
    26   * The superinterface of all {@link TripleHandler} factory interfaces. Do not implement this interface directly.
    27   * Instead, implement one of the subinterfaces {@link TripleWriterFactory} or {@link DecoratingWriterFactory}.
    28   *
    29   * @author Peter Ansell (p_ansell@yahoo.com)
    30   * @author Hans Brende (hansbrende@apache.org)
    31   */
    32  public interface WriterFactory {
    33
    34      /**
    35       * @deprecated since 2.3. Use {@link TripleWriterFactory#getTripleFormat()} instead.
    36       *
    37       * @return the {@link org.eclipse.rdf4j.rio.RDFFormat} being handled
    38       */
    39      @Deprecated
    40      RDFFormat getRdfFormat();
    41
    42      String getIdentifier();
    43
    44      /**
    45       * @deprecated since 2.3. Use {@link TripleWriterFactory#getTripleFormat()}.{@link TripleFormat#getMimeType()
    46       *             getMimeType()} instead.
    47       *
    48       * @return a String representing the Mimetype being handled in this Writer
    49       */
    50      @Deprecated
    51      String getMimeType();
    52
    53      /**
    54       * @deprecated since 2.3. Use {@link TripleWriterFactory#getTripleWriter(OutputStream, Settings)} instead.
    55       *
    56       * @param os
    57       *            a {@link java.io.OutputStream} to be written to the FormatWriter handler
    58       *
    59       * @return a {@link org.apache.any23.writer.FormatWriter} ready to be implemented
    60       */
    61      @Deprecated
    62      FormatWriter getRdfWriter(OutputStream os);
    63  }
    64
    65  interface BaseWriterFactory<Output> extends WriterFactory {
    66
    67      Settings getSupportedSettings();
    68
    69      TripleHandler getTripleWriter(Output output, Settings settings);
    70
    71      @Override
    72      @Deprecated
    73      default FormatWriter getRdfWriter(OutputStream os) {
    74          throw new UnsupportedOperationException("this class does not support getRdfWriter()");
    75      }
    76
    77      @Override
    78      @Deprecated
    79      default String getMimeType() {
    80          throw new UnsupportedOperationException("this class does not support getMimeType()");
    81      }
    82
    83      @Override
    84      @Deprecated
    85      default RDFFormat getRdfFormat() {
    86          throw new UnsupportedOperationException("this class does not support getRdfFormat()");
    87      }
    88  }