buf.append( EnvKeys.PROPERTIES ).append( id );
buf.append( EnvKeys.PARTITION_PROPERTIES ).append( id );
    public static ContextPartitionConfig getContextPartitionConfig( String id, Hashtable env )            throws NamingException    {        final StringBuffer buf = new StringBuffer();        final ContextPartitionConfig config = new ContextPartitionConfig();        final LockableAttributesImpl attrs = new LockableAttributesImpl();        // --------------------------------------------------------------------        // set id, empty attributes, and lookup the suffix for config        // --------------------------------------------------------------------        config.setId( id );        config.setAttributes( attrs );        buf.append( EnvKeys.SUFFIX ).append( id );        String suffix = ( String ) env.get(  buf.toString() );        if ( suffix != null )        {            suffix = new LdapName( suffix ).toString();        }        config.setSuffix( suffix );        // --------------------------------------------------------------------        // set partition class        // --------------------------------------------------------------------        buf.setLength( 0 );        buf.append( EnvKeys.PARTITION_CLASS ).append( id );        String partitionClass = ( String ) env.get(  buf.toString() );        if ( partitionClass != null )        {            config.setPartitionClass( partitionClass );        }        // --------------------------------------------------------------------        // set partition properties        // --------------------------------------------------------------------        buf.setLength( 0 );        buf.append( EnvKeys.PROPERTIES ).append( id );        String properties = ( String ) env.get(  buf.toString() );        if ( properties != null )        {            config.setProperties( properties );        }        // --------------------------------------------------------------------        // extract index list and set the list of indices in config        // --------------------------------------------------------------------        buf.setLength( 0 );        buf.append( EnvKeys.INDICES ).append( id );        String indexList = ( ( String ) env.get( buf.toString() ) );        if ( indexList == null || indexList.trim().length() == 0 )        {            config.setIndices( ArrayUtils.EMPTY_STRING_ARRAY );        }        else        {            indexList = StringTools.deepTrim( indexList );            config.setIndices( indexList.split( " " ) );        }        // --------------------------------------------------------------------        // extract attributes and values adding them to the config        // --------------------------------------------------------------------        buf.setLength( 0 );        buf.append( EnvKeys.ATTRIBUTES ).append( id );        /*         * before going on to extract attributes check to see if the         * attributes base plus id has an Attributes object set.  Users         * can programatically use Attributes objects rather than         * wrestle with individual key value pairs.         */        String keyBase = buf.toString();        if ( env.containsKey( keyBase ) )        {            config.setAttributes( ( Attributes ) env.get( keyBase ) );            return config;        }        /*         * looks like the environment attributes were not set programatically         * with an Attributes object for the base.  So we now add the extra         * '.' and go on to try and detect all the keys and their attributes.         */        buf.append( "." );        keyBase = buf.toString();        for ( Enumeration list = env.keys(); list.hasMoreElements(); )        {            String attrKey = ( String ) list.nextElement();            if ( attrKey.startsWith( keyBase ) )            {                LockableAttributeImpl attr = new LockableAttributeImpl( attrs,                        attrKey.substring( keyBase.length() ) ) ;                String valueList = ( String ) env.get( attrKey );                if ( valueList == null || valueList.trim().length() == 0 )                {                    // add the empty attribute                    attrs.put( attr );                    continue;                }                valueList = StringTools.deepTrim( valueList );                String[] values = valueList.split( " " );                for ( int ii = 0; ii < values.length; ii++ )                {                    attr.add( values[ii] );                }                attrs.put( attr );            }        }        return config;    }