001/* 002 * jPOS Project [http://jpos.org] 003 * Copyright (C) 2000-2026 jPOS Software SRL 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jpos.core; 020 021 022import java.util.Set; 023 024/** 025 * 026 * CardAgents relies on a Configuration object to provide 027 * runtime configuration parameters such as merchant number, etc. 028 * 029 * @author apr@cs.com.uy 030 * @version $Id$ 031 * @since jPOS 1.1 032 * 033 */ 034public interface Configuration { 035 /** 036 * Returns the value of a configuration property. 037 * @param propertyName the property name 038 * @return the property value, or an empty string if not found 039 */ 040 String get(String propertyName); 041 /** 042 * Returns all property values with the given name. 043 * @param propertyName the property name 044 * @return all matching values, or a zero-length array 045 */ 046 String[] getAll(String propertyName); 047 /** 048 * Returns all values of a configuration property as an int array. 049 * @param propertyName the property name 050 * @return all values as int array 051 */ 052 int[] getInts(String propertyName); 053 /** 054 * Returns all values of a configuration property as a long array. 055 * @param propertyName the property name 056 * @return all values as long array 057 */ 058 long[] getLongs(String propertyName); 059 /** 060 * Returns all values of a configuration property as a double array. 061 * @param propertyName the property name 062 * @return all values as double array 063 */ 064 double[] getDoubles(String propertyName); 065 /** 066 * Returns all values of a configuration property as a boolean array. 067 * @param propertyName the property name 068 * @return all values as boolean array 069 */ 070 boolean[] getBooleans(String propertyName); 071 /** 072 * Returns the value of a configuration property, or a default. 073 * @param propertyName the property name 074 * @param defaultValue value to return if not found 075 * @return the property value or {@code defaultValue} 076 */ 077 String get(String propertyName, String defaultValue); 078 /** 079 * Returns the value of a configuration property as an int. 080 * @param propertyName the property name 081 * @return the value as an int, or 0 if not found 082 */ 083 int getInt(String propertyName); 084 /** 085 * Returns the value of a configuration property as an int, or a default. 086 * @param propertyName the property name 087 * @param defaultValue default if not found 088 * @return the value as an int 089 */ 090 int getInt(String propertyName, int defaultValue); 091 /** 092 * Returns the value of a configuration property as a long. 093 * @param propertyName the property name 094 * @return the value as a long, or 0 if not found 095 */ 096 long getLong(String propertyName); 097 /** 098 * Returns the value of a configuration property as a long, or a default. 099 * @param propertyName the property name 100 * @param defaultValue default if not found 101 * @return the value as a long 102 */ 103 long getLong(String propertyName, long defaultValue); 104 /** 105 * Returns the value of a configuration property as a double. 106 * @param propertyName the property name 107 * @return the value as a double, or 0.0 if not found 108 */ 109 double getDouble(String propertyName); 110 /** 111 * Returns the value of a configuration property as a double, or a default. 112 * @param propertyName the property name 113 * @param defaultValue default if not found 114 * @return the value as a double 115 */ 116 double getDouble(String propertyName, double defaultValue); 117 /** 118 * Returns the value of a configuration property as a boolean. 119 * @param propertyName the property name 120 * @return the value as a boolean, or false if not found 121 */ 122 boolean getBoolean(String propertyName); 123 /** 124 * Returns the value of a configuration property as a boolean, or a default. 125 * @param propertyName the property name 126 * @param defaultValue default if not found 127 * @return the value as a boolean 128 */ 129 boolean getBoolean(String propertyName, boolean defaultValue); 130 /** 131 * Stores a property value. 132 * @param name the property name 133 * @param value the value (typically a String or String[]) 134 */ 135 void put(String name, Object value); 136 /** 137 * Returns the set of all property names in this configuration. 138 * @return the property name set 139 */ 140 Set<String> keySet(); 141}