mercredi 1 avril 2015

Java config storage choice

First of all, I'm new here as writer, but not as reader. I used stackoverflow for years to find a lot of useful information, but now I decided to join the community.


Now my question about the Java config storage choice.


The application


Currently I'm working on a Java (FX) project for myself. The Java application will be used on a few desktop machines. The goal of the application is to power on/off Linux devices over SSH (for example a server).


I want to make it possible for the user to add 5/10 devices with information of the device (name and IP), SSH credentials for the power on command and SSH credentials for the power off command (user, host, key, port, timeout, command).


There will be a JavaFX GUI, this GUI will have a menu bar with a menu called Devices to select, add, edit or delete a device. In the center of the GUI there will be 2 buttons, they will be used for the power on/off commands (or a switch).


Design



  • The programming language is Java.

  • The GUI is based on JavaFX.

  • For the power on/off commands I use the Command Design Pattern.


Storage


I tried different storage options (SQLite, Properties and XML) for storing information of the devices. But I didnt found out which option will fits the best in this situation.


The SQLite storage felt too big for this.


If I will go for seperated properties/XML storage, than there wille be around 5/10 different properties/XML files. Also the application has to switch between this files. A file will look like this:



device.name = Server
device.host = host.com

power_on.key = /path/to/rsa
power_on.user = user
power_on.host = host.com
power_on.port = 22
power_on.timeout = 10000
power_on.command = execute power on command

power_off.key = /path/to/rsa
power_off.user = user
power_off.host = host.com
power_off.port = 22
power_off.timeout = 10000
power_off.command = execute power off command


If I will go for 1 properties/XML file, than the file will look like this:



# Device 1
server.device.name = Server
server.device.host = host.com

server.power_on.key = /path/to/rsa
server.power_on.user = user
server.power_on.host = host.com
server.power_on.port = 22
server.power_on.timeout = 10000
server.power_on.command = execute power on command

server.power_off.key = /path/to/rsa
server.power_off.user = user
server.power_off.host = host.com
server.power_off.port = 22
server.power_off.timeout = 10000
server.power_off.command = execute power off command

# Device 2
pc.device.name = PC
pc.device.host = host.com

pc.power_on.key = /path/to/rsa
pc.power_on.user = user
pc.power_on.host = host.com
pc.power_on.port = 22
pc.power_on.timeout = 10000
pc.power_on.command = execute power on command

pc.power_off.key = /path/to/rsa
pc.power_off.user = user
pc.power_off.host = host.com
pc.power_off.port = 22
pc.power_off.timeout = 10000
pc.power_off.command = execute power off command


Question


My question is; which storage choice (and/or design pattern) will fits the best in this situation? It makes me really confused because I tried different things without any good solution yet.


I hope you guys can help me out with this. All feedback, suggestions etc are welcome. Thank you in advance!


Aucun commentaire:

Enregistrer un commentaire