1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tradefed.config; 18 19 import java.io.InputStream; 20 21 /** 22 * An interface for config server. 23 * 24 * <p>Instead of starting with a host config file, a Tradefed instnace can start with an {@link 25 * IConfigurationServer}. A tradefed starts with {@link IConfigurationServer} will load current 26 * host's config from the remote storage and load all dependent configs as needed. Tradefed can 27 * either start with {@link IConfigurationServer} or config file, but not both. 28 */ 29 public interface IConfigurationServer { 30 31 /** 32 * Get config content by its name. 33 * 34 * @param name config's name 35 * @return an {@link InputStream} is the config file content. 36 * @throws ConfigurationException 37 */ getConfig(String name)38 public InputStream getConfig(String name) throws ConfigurationException; 39 40 /** 41 * Get current host's config file name for the current Tradefed session. Instead of reading the 42 * host config file from local files, Tradefed start with an {@link IConfigurationServer} will 43 * get the host config from the server. 44 * 45 * @return a host config file name. 46 * @throws ConfigurationException 47 */ getCurrentHostConfig()48 public String getCurrentHostConfig() throws ConfigurationException; 49 } 50