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 implementations, a JNDI configuration has some
027 * special properties defining the subset of the JNDI tree to be managed. This class provides fluent methods for setting
028 * these. The {@code getParameters()} method puts all properties defined by the user in a map from where they can be
029 * accessed by a builder for JNDI configurations.
030 * </p>
031 * <p>
032 * This class is not thread-safe. It is intended that an instance is constructed and initialized by a single thread
033 * during configuration of a {@code ConfigurationBuilder}.
034 * </p>
035 *
036 * @since 2.0
037 */
038public class JndiBuilderParametersImpl extends BasicBuilderParameters implements JndiBuilderProperties<JndiBuilderParametersImpl> {
039    /** Constant for the name of the context property. */
040    private static final String PROP_CONTEXT = "context";
041
042    /** Constant for the name of the prefix property. */
043    private static final String PROP_PREFIX = "prefix";
044
045    @Override
046    public JndiBuilderParametersImpl setContext(final Context ctx) {
047        storeProperty(PROP_CONTEXT, ctx);
048        return this;
049    }
050
051    @Override
052    public JndiBuilderParametersImpl setPrefix(final String p) {
053        storeProperty(PROP_PREFIX, p);
054        return this;
055    }
056}