1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.maven.toolchain.io; 20 21 import java.io.File; 22 import java.io.IOException; 23 import java.io.InputStream; 24 import java.io.Reader; 25 import java.util.Map; 26 27 import org.apache.maven.toolchain.model.PersistedToolchains; 28 29 /** 30 * Handles deserialization of toolchains from some kind of textual format like XML. 31 * 32 * @since 3.3.0 33 * @deprecated since 4.0.0, use {@link org.apache.maven.api.services.xml.ToolchainsXmlFactory} instead 34 */ 35 @Deprecated(since = "4.0.0") 36 public interface ToolchainsReader { 37 38 /** 39 * The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code 40 * true}. If {@code false}, unknown elements will be ignored instead of causing a failure. 41 */ 42 String IS_STRICT = "org.apache.maven.toolchains.io.isStrict"; 43 44 /** 45 * Reads the toolchains from the specified file. 46 * 47 * @param input The file to deserialize the toolchains from, must not be {@code null}. 48 * @param options The options to use for deserialization, may be {@code null} to use the default values. 49 * @return The deserialized toolchains, never {@code null}. 50 * @throws IOException If the toolchains could not be deserialized. 51 * @throws ToolchainsParseException If the input format could not be parsed. 52 */ 53 PersistedToolchains read(File input, Map<String, ?> options) throws IOException, ToolchainsParseException; 54 55 /** 56 * Reads the toolchains from the specified character reader. The reader will be automatically closed before the 57 * method returns. 58 * 59 * @param input The reader to deserialize the toolchains from, must not be {@code null}. 60 * @param options The options to use for deserialization, may be {@code null} to use the default values. 61 * @return The deserialized toolchains, never {@code null}. 62 * @throws IOException If the toolchains could not be deserialized. 63 * @throws ToolchainsParseException If the input format could not be parsed. 64 */ 65 PersistedToolchains read(Reader input, Map<String, ?> options) throws IOException, ToolchainsParseException; 66 67 /** 68 * Reads the toolchains from the specified byte stream. The stream will be automatically closed before the method 69 * returns. 70 * 71 * @param input The stream to deserialize the toolchains from, must not be {@code null}. 72 * @param options The options to use for deserialization, may be {@code null} to use the default values. 73 * @return The deserialized toolchains, never {@code null}. 74 * @throws IOException If the toolchains could not be deserialized. 75 * @throws ToolchainsParseException If the input format could not be parsed. 76 */ 77 PersistedToolchains read(InputStream input, Map<String, ?> options) throws IOException, ToolchainsParseException; 78 }