public SaslSecPropsWrapper()

in plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SaslSecPropsWrapper.java [63:148]


    public SaslSecPropsWrapper( String parameters )
    {
        if ( !Strings.isEmpty( Strings.trim( parameters ) ) )
        {
            // Split the string along the spaces
            String[] properties = parameters.split( "," );
            
            for ( String property : properties )
            {
                if ( Strings.isEmpty( Strings.trim( property ) ) )
                {
                    continue;
                }
                
                int pos = property.indexOf( '=' );
                
                if ( pos == -1 )
                {
                    // No value
                    SaslSecPropEnum flag = SaslSecPropEnum.getSaslSecProp( Strings.trim( property ) );
                    
                    switch ( flag )
                    {
                        case FORWARD_SEC :
                        case NO_ACTIVE :
                        case NO_ANONYMOUS :
                        case NO_DICT :
                        case NO_PLAIN :
                        case PASS_CRED :
                        case NONE :
                            flags.add( flag );
                            break;
                            
                        case MAX_BUF_SIZE :
                        case MAX_SSF :
                        case MIN_SSF :
                        case UNKNOWN :
                            // Nothing to do...
                    }
                }
                else
                {
                    // Fetch the name
                    String name = property.substring( 0, pos );
                    SaslSecPropEnum flag = SaslSecPropEnum.getSaslSecProp( Strings.trim( name ) );
                    
                    try
                    {
                        int value = Integer.parseInt( Strings.trim( property.substring( pos + 1 ) ) );
                        
                        if ( value >= 0 )
                        {
                            switch ( flag )
                            {
                                case MAX_BUF_SIZE :
                                    maxBufSize = Integer.valueOf( value );
                                    break;
                                    
                                case MAX_SSF :
                                    maxSsf = Integer.valueOf( value );
                                    break;
                                    
                                case MIN_SSF :
                                    minSsf = Integer.valueOf( value );
                                    break;
                                    
                                case FORWARD_SEC :
                                case NO_ACTIVE :
                                case NO_ANONYMOUS :
                                case NO_DICT :
                                case NO_PLAIN :
                                case PASS_CRED :
                                case NONE :
                                case UNKNOWN :
                                    // Nothing to do... This is an error
                            }
                        }
                    }
                    catch ( NumberFormatException nfe )
                    {
                        // Nothing to do
                    }
                }
            }
        }
    }