Home | History | Annotate | Download | only in config
      1 /*
      2  * Copyright (C) 2016 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 package com.android.tradefed.config;
     17 
     18 import com.android.tradefed.build.IBuildProvider;
     19 import com.android.tradefed.device.IDeviceRecovery;
     20 import com.android.tradefed.device.IDeviceSelection;
     21 import com.android.tradefed.device.TestDeviceOptions;
     22 import com.android.tradefed.targetprep.ITargetPreparer;
     23 
     24 import java.util.List;
     25 
     26 /**
     27  * Device Configuration Holder Interface.
     28  * Use to represent an object that can hold the information for the configuration of a device.
     29  */
     30 public interface IDeviceConfiguration {
     31 
     32     /**
     33      * Return The Name of the device specified in the field "name" of the configuration.
     34      */
     35     public String getDeviceName();
     36 
     37     /**
     38      * Return The list of all the configuration objects held the instance of
     39      * {@link IDeviceConfiguration}
     40      */
     41     public List<Object> getAllObjects();
     42 
     43     /**
     44      * Pass one of the allowed objects that the Configuration Holder can keep track of.
     45      * <p>
     46      * Complete list of allowed objects are: {@link IBuildProvider}, {@link ITargetPreparer},
     47      * {@link IDeviceRecovery}, {@link IDeviceSelection}, {@link TestDeviceOptions}
     48      *
     49      * @param config object from a type above.
     50      * @throws ConfigurationException in case the object passed doesn't match the allowed types.
     51      */
     52     public void addSpecificConfig(Object config) throws ConfigurationException;
     53 
     54     /**
     55      * Keep track of the frequency of the object so we can properly inject option against it.
     56      *
     57      * @param config the object we are tracking the frequency.
     58      * @param frequency frequency associated with the object.
     59      */
     60     public void addFrequency(Object config, Integer frequency);
     61 
     62     /** Returns the frequency of the object. */
     63     public Integer getFrequency(Object config);
     64 
     65     /** Return {@link IBuildProvider} that the device configuration holder has reference to. */
     66     public IBuildProvider getBuildProvider();
     67 
     68     /**
     69      * Return a list of {@link ITargetPreparer} that the device configuration holder has.
     70      */
     71     public List<ITargetPreparer> getTargetPreparers();
     72 
     73     /**
     74      * Return {@link IDeviceRecovery} that the device configuration holder has.
     75      */
     76     public IDeviceRecovery getDeviceRecovery();
     77 
     78     /**
     79      * Return {@link TestDeviceOptions} that the device configuration holder has.
     80      */
     81     public TestDeviceOptions getDeviceOptions();
     82 
     83     /**
     84      * Return {@link IDeviceSelection} that the device configuration holder has.
     85      */
     86     public IDeviceSelection getDeviceRequirements();
     87 
     88     /**
     89      * Return a shallow copy of this {@link IDeviceConfiguration} object.
     90      */
     91     public IDeviceConfiguration clone();
     92 }
     93