/********************************************************* begin of preamble
**
** Copyright (C) 2003-2010 Software- und Organisations-Service GmbH.
** All rights reserved.
**
** This file may be used under the terms of either the
**
** GNU General Public License version 2.0 (GPL)
**
** as published by the Free Software Foundation
** http://www.gnu.org/licenses/gpl-2.0.txt and appearing in the file
** LICENSE.GPL included in the packaging of this file.
**
** or the
**
** Agreement for Purchase and Licensing
**
** as offered by Software- und Organisations-Service GmbH
** in the respective terms of supply that ship with this file.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
********************************************************** end of preamble*/
package com.sos.JSHelper.Options;
import com.sos.JSHelper.Exceptions.JobSchedulerException;
/**
* \class SOSOptionAuthenticationMethod
*
* \brief SOSOptionAuthenticationMethod -
*
* \details
*
* \section SOSOptionAuthenticationMethod.java_intro_sec Introduction
*
* \section SOSOptionAuthenticationMethod.java_samples Some Samples
*
* \code
* .... code goes here ...
* \endcode
*
* <p style="text-align:center">
* <br />---------------------------------------------------------------------------
* <br /> APL/Software GmbH - Berlin
* <br />##### generated by ClaviusXPress (http://www.sos-berlin.com) #########
* <br />---------------------------------------------------------------------------
* </p>
* \author KB
* @version $Id: SOSOptionAuthenticationMethod.java 14729 2011-07-05 20:47:16Z sos $16.05.2010
* \see reference
*
* Created on 16.05.2010 19:43:37
*/
/**
* @author KB
*
*/
public class SOSOptionAuthenticationMethod extends SOSOptionString {
/**
*
*/
private static final long serialVersionUID = 806321970898790899L;
public enum enuAuthenticationMethods {
publicKey, password, notDefined
}
private final String conClassName = "SOSOptionAuthenticationMethod";
private enuAuthenticationMethods enuMethod = enuAuthenticationMethods.notDefined;
// SOSOptionAuthenticationMethod() {
// //
// }
/**
* \brief SOSOptionAuthenticationMethod
*
* \details
*
* @param pPobjParent
* @param pPstrKey
* @param pPstrDescription
* @param pPstrValue
* @param pPstrDefaultValue
* @param pPflgIsMandatory
*/
public SOSOptionAuthenticationMethod(JSOptionsClass pPobjParent, String pPstrKey, String pPstrDescription, String pPstrValue, String pPstrDefaultValue,
boolean pPflgIsMandatory) {
super(pPobjParent, pPstrKey, pPstrDescription, pPstrValue, pPstrDefaultValue, pPflgIsMandatory);
}
/**
*
* \brief Value
*
* \details
*
* \return
*
* @param pstrAuthenticationMethod
*/
public void Value(final String pstrAuthenticationMethod) {
@SuppressWarnings("unused")
final String conMethodName = conClassName + "::Value";
try {
if (pstrAuthenticationMethod.equalsIgnoreCase("publickey")) {
super.Value(pstrAuthenticationMethod);
this.enuMethod = enuAuthenticationMethods.publicKey;
}
else {
if (pstrAuthenticationMethod.equalsIgnoreCase("password")) {
super.Value(pstrAuthenticationMethod);
this.enuMethod = enuAuthenticationMethods.password;
}
else {
super.Value("*invalid*");
this.enuMethod = enuAuthenticationMethods.notDefined;
}
}
}
catch (Exception e) {
e.printStackTrace();
}
} // private void Value
public void Value(final enuAuthenticationMethods penuAuthMethod) {
@SuppressWarnings("unused")
final String conMethodName = conClassName + "::Value";
switch (penuAuthMethod) {
case password:
super.Value("password");
this.enuMethod = penuAuthMethod;
break;
case publicKey:
super.Value("publickey");
this.enuMethod = penuAuthMethod;
break;
default:
throw new JobSchedulerException("Invalid AuthenticationMethod");
}
}
public void isPassword(boolean flgF) {
if (flgF) {
this.Value("password");
}
}
public boolean isPassword() {
@SuppressWarnings("unused")
final String conMethodName = conClassName + "::isPassword";
return (enuMethod == enuAuthenticationMethods.password);
} // private boolean isPassword
/**
*
* \brief isPublicKey
*
* \details
*
* \return boolean
*
* @return
*/
public boolean isPublicKey() {
@SuppressWarnings("unused")
final String conMethodName = conClassName + "::isPublicKey";
return (enuMethod == enuAuthenticationMethods.publicKey);
} // private boolean isPublicKey
/**
*
* \brief AuthenticationMethod
*
* \details
*
* \return enuAuthenticationMethods
*
* @return
*/
public enuAuthenticationMethods AuthenticationMethod() {
@SuppressWarnings("unused")
final String conMethodName = conClassName + "::AuthenticationMethod";
return enuMethod;
} // private enuMethod AuthenticationMethod
}