Class MicroserviceSystem

java.lang.Object
edu.university.ecs.lab.common.models.ir.MicroserviceSystem
All Implemented Interfaces:
JsonSerializable

public class MicroserviceSystem extends Object implements JsonSerializable
Represents the intermediate structure of a microservice system.
  • Field Details

    • name

      private String name
      The name of the system
    • commitID

      private String commitID
      The commit ID of the system
    • microservices

      private Set<Microservice> microservices
      Set of microservices in the system
    • orphans

      private Set<ProjectFile> 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 interface JsonSerializable
      Returns:
      a JsonObject representing this
    • findMicroserviceByPath

      public Microservice findMicroserviceByPath(String path)
      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

      public 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 use
      Parameters:
      microservice - the microservice to orphanize
    • adopt

      public void adopt(Microservice microservice)
      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

      public JClass findClass(String path)
      Get the class of a given endpoint
      Parameters:
      path - endpoint
      Returns:
      class that endpoint is in
    • findFile

      public ProjectFile findFile(String path)
      Get the file of a given endpoint
      Parameters:
      path - endpoint
      Returns:
      file that endpoint is in
    • getMicroserviceFromFile

      public String getMicroserviceFromFile(String path)
      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

      public void orphanizeAndAdopt(Microservice microservice)