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 * @version $Id: JndiBuilderParametersImpl.java 1842194 2018-09-27 22:24:23Z ggregory $ 040 * @since 2.0 041 */ 042public class JndiBuilderParametersImpl extends BasicBuilderParameters implements 043 JndiBuilderProperties<JndiBuilderParametersImpl> 044{ 045 /** Constant for the name of the context property. */ 046 private static final String PROP_CONTEXT = "context"; 047 048 /** Constant for the name of the prefix property. */ 049 private static final String PROP_PREFIX = "prefix"; 050 051 @Override 052 public JndiBuilderParametersImpl setContext(final Context ctx) 053 { 054 storeProperty(PROP_CONTEXT, ctx); 055 return this; 056 } 057 058 @Override 059 public JndiBuilderParametersImpl setPrefix(final String p) 060 { 061 storeProperty(PROP_PREFIX, p); 062 return this; 063 } 064}