Configuration management for any software system


Consider a class called the Configuration. This class “encapsulates” the configuration management for any software system. For illustration, once created, the user can simply ask the configuration object for value(s) to a certain configuration key. Let’s take a look at a few illustrations:

String filename = “config.txt”;
Configuration config = new Configuration( new File(filename) );
 
int numUser = config.getInteger( “num_users” );
String name = config.getString( “player1” );
 
In above illustration, the config object is constructed and its contents are expressed in the file config.txt. The format of the config.txt file is as:

key = value
key2 = value2
## lines with comments begins with the #

The complete Configuration class must implement the given methods:

Class Configuration {
// constructors
Configuration() { … }
Configuration( File file) { … }
Configuration(String filename) { … }
// accessors
int getSize() { … }
String getString( String key ) { … }
int getInteger( String key ) { … }
String[] getKeys() { … } // return all keys
// mutators
void push(String key, String value) {  }
String[] pop() { }  // returns String array[] = { key, value }
}

Your Configuration class will encompass two sub classes: (1) ConfigurationQueue and (2) ConfigurationStack.  The push and pop functions will behave differently depending on whether your class is a Stack or a Queue.

Your App class is given and you must not change this class at all. Your homework will need creating three files: Configuration.java ConfigurationQueue.java and ConfigurationStack.java.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Configuration management for any software system
Reference No:- TGS0474

Expected delivery within 24 Hours