Problem formulation Consider a process of Information Securi
Problem formulation:
Consider a process of Information Security Audit that almost every organization has to pass from time to time. Part of the process is the assessment of assets from the perspective of security risk analysis. There are 3 security services: confidentiality, integrity, and availability and each of these services can be considered in the context of some application (software). For example, availability: every institution maintains academic records of all students. Such records are stored in a database, and this database is managed and accessed by means of DBMS (database management system) software, that in turn runs on some hardware server (asset). That server has many components, i.e. power supplies, NICs, HDD/SSDs, etc which may fail and their failure may cause failure of the server and therefore inability (failure of availability service) of users to access the application.
Your task is to write a Java program that would represent an asset. Later on, you will be asked to extend this program and implement different types of assets as well as different types of applications and their relationship. As of now your program contain two classes:
Asset
Driver
The former class, i.e. Asset, has to have the following attributes and methods:
String Type. Can be one of the following: Server, Switch, Router, PSU (power supply unit), HDD, SSD, NIC (network interface card)
int ID A unique number that identify any given asset.
String Name General description of the asset including (if needed) vendor, hardware, model, etc.
String serial Serial number of the asset which is a combination of characters usually found on a sticker affixed on some surface of the asset
int PID Parent ID -- ID of the asset that appears to be \"parent\" to this one. For example Server asset is the \"parent\" of NIC asset because NIC is plugged into the server. In case when asset has no parent, this value has to be set to -1.
\"Getters\" and \"setters\" for all attributes
Default constructor (one that takes no parameters and uses default values of attributes)
Method String toString() that returns textual presentation of an asset object. Values of all attributes must be used in compilation of that string.
The latter class, i.e. Driver is used to host main() method that would instantiate a few objects of class Asset (use some illustrative cases like 1 server, 1 switch, 2 PSUs, 3 NICs, etc) and store references to those objects in an array. Then it would iterate through the array and for every asset it would print result returned by toString() method.
Solution
public class Driver{
public static void main(String []args){
//create an array of size 3
Asset assets[]=new Asset[3];
//initilaize asset1 object
assets[0]=new Asset();
assets[0].setType(\"Server\");
assets[0].setId(123);
assets[0].setName(\"MyServer\");
assets[0].setSerial(\"WERY1233Y\");
assets[0].setPid(-1);
//initilaize asset1 object
assets[1]=new Asset();
assets[1].setType(\"Switch\");
assets[1].setId(456);
assets[1].setName(\"MySwitch\");
assets[1].setSerial(\"WREG7678\");
assets[1].setPid(123);
//initilaize asset1 object
assets[2]=new Asset();
assets[2].setType(\"PSU\");
assets[2].setId(1124);
assets[2].setName(\"MYPSU\");
assets[2].setSerial(\"WDFYYFGNJ123\");
assets[2].setPid(123);
//iterate throgh array and dsiplay data
for(int i=0;i<assets.length;i++)
System.out.println(assets[i]);
}
}
//asset class which encapsulate the asset detaiils
class Asset
{
//instance variables of asset
String type;
int id;
String name;
String serial;
int pid;
//default constructor
Asset()
{
type=\"\";
id=0;
name=\"\";
serial=\"\";
pid=0;
}
//setters for each of instyance variable
public void setType(String t)
{
type=t;
}
public void setId(int id)
{
this.id=id;
}
public void setName(String n)
{
name=n;
}
public void setSerial(String s)
{
serial=s;
}
public void setPid(int pid)
{
this.pid=pid;
}
//getters for each of instyance variable
public String getType()
{
return type;
}
public int getId()
{
return id;
}
public String getName()
{
return name;
}
public String getSerial()
{
return serial;
}
public int getPid()
{
return pid;
}
//toString() of asset
public String toString()
{
return \"\ *****************INFORMATION***************************\ Type: \"+type+\"\\tID: \"+id+\"\\t\\tName: \"+name+\"\ Serial No: \"+serial+\"\\tPID: \"+pid+\"\ *************************************\";
}
}


