Brett Chabot | 74121d8 | 2010-01-28 20:14:27 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 com.android.tradefed.device.IDeviceRecovery; |
| 20 | import com.android.tradefed.log.ILeveledLogOutput; |
| 21 | import com.android.tradefed.result.ITestInvocationListener; |
| 22 | import com.android.tradefed.targetsetup.IBuildProvider; |
| 23 | import com.android.tradefed.targetsetup.ITargetPreparer; |
| 24 | |
Brett Chabot | ccdf327 | 2010-02-27 18:59:03 -0800 | [diff] [blame] | 25 | import java.util.Collection; |
Brett Chabot | 74121d8 | 2010-01-28 20:14:27 -0800 | [diff] [blame] | 26 | |
| 27 | import junit.framework.Test; |
| 28 | |
| 29 | /** |
| 30 | * Configuration information for a TradeFederation invocation. |
| 31 | * |
| 32 | * Each TradeFederation invocation has a single {@link IConfiguration}. An {@link IConfiguration} |
| 33 | * stores all the delegate objects that should be used during the invocation, and their associated |
| 34 | * {@link Option}'s |
| 35 | */ |
| 36 | public interface IConfiguration { |
| 37 | |
Brett Chabot | 74121d8 | 2010-01-28 20:14:27 -0800 | [diff] [blame] | 38 | /** |
| 39 | * Gets the {@link IBuildProvider} from the configuration. |
| 40 | * |
| 41 | * @return the {@link IBuildProvider} provided in the configuration |
| 42 | * @throws ConfigurationException if config object could not be fully loaded, or was not the |
| 43 | * correct type |
| 44 | */ |
| 45 | public IBuildProvider getBuildProvider() throws ConfigurationException; |
| 46 | |
| 47 | /** |
| 48 | * Gets the {@link ITargetPreparer} from the configuration. |
| 49 | * |
| 50 | * @return the {@link IBuildProvider} provided in the configuration |
| 51 | * @throws ConfigurationException if config object could not be fully loaded, or was not the |
| 52 | * correct type |
| 53 | */ |
| 54 | public ITargetPreparer getTargetPreparer() throws ConfigurationException; |
| 55 | |
| 56 | /** |
| 57 | * Gets the {@link Test} to run from the configuration. |
| 58 | * |
| 59 | * @return the {@link Test} provided in the configuration |
| 60 | * @throws ConfigurationException if config object could not be fully loaded, or was not the |
| 61 | * correct type |
| 62 | */ |
| 63 | public Test getTest() throws ConfigurationException; |
| 64 | |
| 65 | /** |
| 66 | * Gets the {@link ITestInvocationListener} to use from the configuration. |
| 67 | * |
| 68 | * @return the {@link Test} provided in the configuration |
| 69 | * @throws ConfigurationException if config object could not be fully loaded, or was not the |
| 70 | * correct type |
| 71 | */ |
| 72 | public ITestInvocationListener getTestInvocationListener() throws ConfigurationException; |
| 73 | |
| 74 | /** |
| 75 | * Gets the {@link IDeviceRecovery} to use from the configuration. |
| 76 | * |
| 77 | * @return the {@link IDeviceRecovery} provided in the configuration. |
| 78 | * @throws ConfigurationException if config object could not be fully loaded, or was not the |
| 79 | * correct type |
| 80 | */ |
| 81 | public IDeviceRecovery getDeviceRecovery() throws ConfigurationException; |
| 82 | |
| 83 | /** |
| 84 | * Gets the {@link ILeveledLogOutput} to use from the configuration. |
| 85 | * |
| 86 | * @return the {@link ILeveledLogOutput} provided in the configuration. |
| 87 | * @throws ConfigurationException if config object could not be fully loaded, or was not the |
| 88 | * correct type |
| 89 | */ |
| 90 | public ILeveledLogOutput getLogOutput() throws ConfigurationException; |
| 91 | |
| 92 | /** |
| 93 | * Generic interface to get the configuration object with the given name. |
| 94 | * |
| 95 | * This will create the object if necessary, and set all of its {@link Option} fields with |
| 96 | * values supplied in the configuration. |
| 97 | * |
| 98 | * In addition, if the current {@link IConfiguration} will be injected if the object |
| 99 | * extends {@link IConfigurationReceiver}. |
| 100 | * |
| 101 | * @param name the unique name of the configuration object |
| 102 | * @param expectedType the expected object type |
| 103 | * |
| 104 | * @return the configuration object, with all its {@link Option} fields set |
| 105 | * |
| 106 | * @throws ConfigurationException if config object could not be fully loaded, or was not the |
| 107 | * correct type |
| 108 | */ |
| 109 | public Object getConfigurationObject(String name, Class<?> expectedType) |
| 110 | throws ConfigurationException; |
| 111 | |
| 112 | /** |
Brett Chabot | ccdf327 | 2010-02-27 18:59:03 -0800 | [diff] [blame] | 113 | * Gets a list of all configuration objects. |
| 114 | * |
| 115 | * @return a {@link Collection} of all configuration objects |
| 116 | * @throws {@link ConfigurationException} if the config objects could not be fully loaded |
| 117 | */ |
Brett Chabot | e278a5b | 2010-06-01 16:20:14 -0700 | [diff] [blame^] | 118 | public Collection<Object> getConfigurationObjects() throws ConfigurationException; |
Brett Chabot | 74121d8 | 2010-01-28 20:14:27 -0800 | [diff] [blame] | 119 | } |