An API to access, manage and store device topologies.You can see a template for a topology from here
- suitable IDE for JAVA (e.g. Eclipse,IntelliJ)
- Gradle for building the library
- Junit4 for testing
- Gson for parsing the JSON file
- Read a topology from a given JSON file and store it in the memory.
- Write a given topology from the memory to a JSON file.
- Query about which topologies are currently in the memory.
- Delete a given topology from memory.
- Query about which devices are in a given topology.
- Query about which devices are connected to a given NetList node in a given topology.
- Import
topologyAPI
package in your program, ex:
import TopologyAPI.*;
The API mainly consists of 3 classes as follows:
- TopologyAPI Class: represents the interfacing class to access the API features.
- JsonIO Class: Provides TopologyAPI with helper methods to manipulate JSON files.
- DataBase Class: represents the storage layer for the API.
The UML Diagram for TopologyAPI and JsonIO
readJSON(String FilePath):
- Description: read topology from the given JSON file.
- Parameters:
FilePath
: the path of the given JSON file.
- Return:
void
.
writeJSON(String TopologyId,String FilePath):
- Description: writes the given topology in a JSON file.
- Parameters:
TopologyId
: the ID of the topology that wanted to be written into disk as a JSON file.FilePath
: the path of the file that the topology will be written into.
- Return:
void
.
queryTopologies():
- Description: gives the user a copy of the list of topologies currently stored in memory.
- Parameters:
void
. - Return:
ArrayList<Topology>
.
queryDevices(String TopologyId):
- Description: gives the user a copy of the list of the components of the given device.
- Parameters:
TopologyId
: the ID of the topology to query its components.
- Return:
ArrayList<Device>
.
queryDevicesWithNetListNode(String TopologyId,String NetListNodeID):
- Description: gives the user a copy of the list of components that are connected to the given node.
- Parameters:
TopologyId
: the ID of the topology.NetListNodeID
: the given node to query components connected to it.
- Return:
ArrayList<Device>
.
deleteTopology(String TopologyId):
- Description: delete the given topology from the memory.
- Parameters:
TopologyId
: the ID of the topology that will be deleted.
- Return:
void
.
The topologies stored in memory is modeled with the following classes:
- Topology Class: It models the topology as an ID and an array of devices, each element in this array is of type
Device
. - Device Class: It models the device as an ID, type, characteristics and NetList.