    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *     http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.configuration2.builder;
    018
    019import javax.naming.Context;
    020
    021/**
    022 * <p>
    023 * A specialized parameters object for JNDI configurations.
    024 * </p>
    025 * <p>
    026 * In addition to the basic properties common to all configuration
    027 * implementations, a JNDI configuration has some special properties defining
    028 * the subset of the JNDI tree to be managed. This class provides fluent methods
    029 * for setting these. The {@code getParameters()} method puts all properties
    030 * defined by the user in a map from where they can be accessed by a builder for
    031 * JNDI configurations.
    032 * </p>
    033 * <p>
    034 * This class is not thread-safe. It is intended that an instance is constructed
    035 * and initialized by a single thread during configuration of a
    036 * {@code ConfigurationBuilder}.
    037 * </p>
    038 *
    039 * @since 2.0
    040 */
    041public class JndiBuilderParametersImpl extends BasicBuilderParameters implements
    042        JndiBuilderProperties<JndiBuilderParametersImpl>
    043{
    044    /** Constant for the name of the context property. */
    045    private static final String PROP_CONTEXT = "context";
    046
    047    /** Constant for the name of the prefix property. */
    048    private static final String PROP_PREFIX = "prefix";
    049
    050    @Override
    051    public JndiBuilderParametersImpl setContext(final Context ctx)
    052    {
    053        storeProperty(PROP_CONTEXT, ctx);
    054        return this;
    055    }
    056
    057    @Override
    058    public JndiBuilderParametersImpl setPrefix(final String p)
    059    {
    060        storeProperty(PROP_PREFIX, p);
    061        return this;
    062    }
    063}