Class MicroserviceSystem
java.lang.Object
edu.university.ecs.lab.common.models.ir.MicroserviceSystem
- All Implemented Interfaces:
JsonSerializable
Represents the intermediate structure of a microservice system.
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
The commit ID of the systemprivate Set<Microservice>
Set of microservices in the systemprivate String
The name of the systemprivate Set<ProjectFile>
Set of present files (class or configurations) who have no microservice -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
adopt
(Microservice microservice) Given a new or modified microservice, we must adopt awaiting orphans based on their file paths containing the microservices (folder) pathGet the class of a given endpointGet the file of a given endpointfindMicroserviceByPath
(String path) Returns the microservice whose path is the start of the passed pathThis method returns the name of the microservice associated with a file that exists in the system.void
orphanize
(Microservice microservice) Given an existing microservice, if it must now be orphanized then all JClasses belonging to that service will be added to the system's pool of orphans for later usevoid
orphanizeAndAdopt
(Microservice microservice) com.google.gson.JsonObject
-
Field Details
-
name
The name of the system -
commitID
The commit ID of the system -
microservices
Set of microservices in the system -
orphans
Set of present files (class or configurations) who have no microservice
-
-
Constructor Details
-
MicroserviceSystem
public MicroserviceSystem()
-
-
Method Details
-
toJsonObject
public com.google.gson.JsonObject toJsonObject()- Specified by:
toJsonObject
in interfaceJsonSerializable
- Returns:
- a JsonObject representing this
-
findMicroserviceByPath
Returns the microservice whose path is the start of the passed path- Parameters:
path
- the path to search for- Returns:
- microservice instance of matching path or null
-
orphanize
Given an existing microservice, if it must now be orphanized then all JClasses belonging to that service will be added to the system's pool of orphans for later use- Parameters:
microservice
- the microservice to orphanize
-
adopt
Given a new or modified microservice, we must adopt awaiting orphans based on their file paths containing the microservices (folder) path- Parameters:
microservice
- the microservice adopting orphans
-
findClass
Get the class of a given endpoint- Parameters:
path
- endpoint- Returns:
- class that endpoint is in
-
findFile
Get the file of a given endpoint- Parameters:
path
- endpoint- Returns:
- file that endpoint is in
-
getMicroserviceFromFile
This method returns the name of the microservice associated with a file that exists in the system. Note this method will not work if the file is not present somewhere in the system- Parameters:
path
- the ProjectFile path- Returns:
- string name of microservice or "" if it does not exist
-
orphanizeAndAdopt
-