001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.server.core.replication;
021
022 /**
023 * An enum used to store the Bind Methods : SIMPLE or SASL
024 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
025 * @version $Rev$, $Date$
026 *
027 */
028 public enum BindMethod
029 {
030 /** SIMPLE bind */
031 SIMPLE( "simple" ),
032
033 /** SASL bind */
034 SASL( "sasl" ),
035
036 /** Unkwnon bind method */
037 UNKWNOWN( "" );
038
039 /** A storage for the String representation of the BindMethod */
040 private String bindMethod;
041
042
043 /**
044 * Build the Enum's instances.
045 */
046 private BindMethod( String bindMethod )
047 {
048 this.bindMethod = bindMethod;
049 }
050
051
052 public static BindMethod getInstance( String bindMethod )
053 {
054 if ( SIMPLE.bindMethod.equalsIgnoreCase( bindMethod ) )
055 {
056 return SIMPLE;
057 }
058
059 if ( SASL.bindMethod.equalsIgnoreCase( bindMethod ) )
060 {
061 return SASL;
062 }
063
064 return UNKWNOWN;
065 }
066 }