001package org.apache.maven.wagon.providers.ssh.interactive;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022/**
023 * Dummy Implementation for <code>InteractiveUserInfo</code>, nice for
024 * non-Interactive environments
025 *
026 * @author Juan F. Codagnone
027 * @see org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo
028 * @since Sep 12, 2005
029 */
030public class NullInteractiveUserInfo
031    implements InteractiveUserInfo
032{
033    private final boolean promptYesNoResult;
034
035    /**
036     * @see #NullInteractiveUserInfo(boolean)
037     */
038    public NullInteractiveUserInfo()
039    {
040        this( false ); // the safest value
041    }
042
043    /**
044     * Creates a <code>NullInteractiveUserInfo</code> with a hardcoded
045     * prompYesNo result
046     *
047     * @param promptYesNoResult the hardcoded result
048     */
049    public NullInteractiveUserInfo( final boolean promptYesNoResult )
050    {
051        this.promptYesNoResult = promptYesNoResult;
052    }
053
054    /**
055     * @see InteractiveUserInfo#promptYesNo(java.lang.String)
056     */
057    public boolean promptYesNo( final String message )
058    {
059        return promptYesNoResult;
060    }
061
062    /**
063     * @see InteractiveUserInfo#showMessage(java.lang.String)
064     */
065    public void showMessage( final String message )
066    {
067        // nothing to do
068    }
069
070    public String promptPassword( String message )
071    {
072        return null;
073    }
074
075    public String promptPassphrase( String message )
076    {
077        return null;
078    }
079}