Home | History | Annotate | Download | only in host
      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 
     17 package com.android.tradefed.host;
     18 
     19 import com.android.tradefed.config.Option;
     20 import com.android.tradefed.config.OptionClass;
     21 
     22 import java.io.File;
     23 
     24 /**
     25  * Host options holder class.
     26  * This class is used to store host-wide options.
     27  */
     28 @OptionClass(alias = "host_options", global_namespace = false)
     29 public class HostOptions implements IHostOptions {
     30 
     31     @Option(name = "concurrent-flasher-limit", description =
     32             "The maximum number of concurrent flashers (may be useful to avoid memory constraints)")
     33     private Integer mConcurrentFlasherLimit = 1;
     34 
     35     @Option(
     36         name = "concurrent-download-limit",
     37         description =
     38                 "The maximum number of concurrent downloads (may be useful to avoid network "
     39                         + "constraints)"
     40     )
     41     private Integer mConcurrentDownloadLimit = null;
     42 
     43     @Option(
     44         name = "fastboot-tmpdir",
     45         description = "The location of temporary directory used by fastboot"
     46     )
     47     private File mFastbootTmpDir = null;
     48 
     49     @Option(name = "download-cache-dir", description = "the directory for caching downloaded "
     50             + "flashing files. Should be on the same filesystem as java.io.tmpdir.  Consider "
     51             + "changing the java.io.tmpdir property if you want to move downloads to a different "
     52             + "filesystem.")
     53     private File mDownloadCacheDir = new File(System.getProperty("java.io.tmpdir"), "lc_cache");
     54 
     55     /**
     56      * {@inheritDoc}
     57      */
     58     @Override
     59     public Integer getConcurrentFlasherLimit() {
     60         return mConcurrentFlasherLimit;
     61     }
     62 
     63     /** {@inheritDoc} */
     64     @Override
     65     public Integer getConcurrentDownloadLimit() {
     66         return mConcurrentDownloadLimit;
     67     }
     68 
     69     /** {@inheritDoc} */
     70     @Override
     71     public File getFastbootTmpDir() {
     72         return mFastbootTmpDir;
     73     }
     74 
     75     @Override
     76     public File getDownloadCacheDir() {
     77         return mDownloadCacheDir;
     78     }
     79 }
     80