001// Copyright 2013 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007// http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.mongodb;
016
017/**
018 * Configuration symbols, for use with contributions to
019 * {@link org.apache.tapestry5.ioc.services.ApplicationDefaults}.
020 * All {@link org.apache.tapestry5.ioc.annotations.Symbol} are relative to the usage of
021 * <a href="http://www.mongodb.org">MongoDB</a> support within Apache Tapestry.
022 *
023 * @since 5.4
024 */
025public class MongoDBSymbols
026{
027    /**
028     * The {@link com.mongodb.WriteConcern} to use. Default to {@link com.mongodb.WriteConcern#ACKNOWLEDGED}.
029     */
030    public static final String WRITE_CONCERN = "tapestry.mongodb.write_concern";
031
032    /**
033     * The {@link com.mongodb.ReadPreference} to use. Default to {@link com.mongodb.ReadPreference#primary()}.
034     */
035    public static final String READ_PREFERENCE = "tapestry.mongodb.read_preference";
036
037    // ########################################################################
038
039    /**
040     * The maximum number of connections allowed per host for this Mongo instance. Defaults to 10.
041     */
042    public static final String CONNECTIONS_PER_HOSTS = "tapestry.mongodb.conns-per-host";
043
044    /**
045     * The MongoDB default database name to connect to. No default provided.
046     */
047    public static final String DEFAULT_DB_NAME = "tapestry.mongodb.default_db_name";
048
049    /**
050     * Where to use or not the <em>consisten request</em> paradigm. Default to false;
051     */
052    public static final String CONSISTENT_REQUEST = "tapestry.mongodb.consistent_request";
053
054        // ########################################################################
055
056        /**
057         * <code>true</code> if you need to connect to Mongo DB in <em>secure mode</em>,
058         * <code>false</code> otherwise.
059         * You need to set DB_USERNAME and DB_PASSWORD too if this is set to <code>true</code>.
060         * Defaults to <code>false</code>
061         */
062        public static final String SECURE_MODE = "tapestry.mongodb.secure_mode";
063
064        /**
065         * Username to use to connect Mongo DB.
066         * Defaults to empty string.
067         */
068        public static final String DB_USERNAME = "tapestry.mongodb.db_username";
069
070        /**
071         * Password to use to connect Mongo DB.
072         * Defaults to empty string.
073         */
074        public static final String DB_PASSWORD = "tapestry.mongodb.db_password";
075}