LCOV - code coverage report
Current view: top level - sshd - SingleCommandPluginModule.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 0 6 0.0 %
Date: 2022-11-19 15:00:39 Functions: 0 3 0.0 %

          Line data    Source code
       1             : // Copyright (C) 2013 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.sshd;
      16             : 
      17             : import static com.google.common.base.Preconditions.checkState;
      18             : 
      19             : import com.google.gerrit.extensions.annotations.PluginName;
      20             : import com.google.inject.Inject;
      21             : import com.google.inject.binder.LinkedBindingBuilder;
      22             : import org.apache.sshd.server.command.Command;
      23             : 
      24             : /**
      25             :  * Binds one SSH command to the plugin name itself.
      26             :  *
      27             :  * <p>Cannot be combined with {@link PluginCommandModule}.
      28             :  */
      29           0 : public abstract class SingleCommandPluginModule extends CommandModule {
      30             :   private CommandName command;
      31             : 
      32             :   @Inject
      33             :   void setPluginName(@PluginName String name) {
      34           0 :     this.command = Commands.named(name);
      35           0 :   }
      36             : 
      37             :   @Override
      38             :   protected final void configure() {
      39           0 :     checkState(command != null, "@PluginName must be provided");
      40           0 :     configure(bind(Commands.key(command)));
      41           0 :   }
      42             : 
      43             :   protected abstract void configure(LinkedBindingBuilder<Command> bind);
      44             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750