Class InstanceEnvironmentRegistry

java.lang.Object
org.gcube.informationsystem.resourceregistry.instances.InstanceEnvironmentRegistry

public class InstanceEnvironmentRegistry extends Object
Server-side registry and resolution hub for InstanceEnvironment objects.

This class is a 100% stateless utility resolution hub. It retrieves current request credentials and builds transient, lightweight InstanceEnvironment hierarchies dynamically on-the-fly to guarantee strict multi-node distributed cache coherence.

Author:
Luca Frosini (ISTI - CNR)
  • Method Details

    • getCurrentRequestEnvironment

      public static InstanceEnvironment getCurrentRequestEnvironment() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Resolves the InstanceEnvironment that corresponds to the caller's token Context (TokenContextResolution.current()).
      Returns:
      the resolved InstanceEnvironment for the current request
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the security context has not been set or the context cannot be resolved
    • getRequestEnvironmentByContextPath

      public static InstanceEnvironment getRequestEnvironmentByContextPath(String path) throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException
      Resolves the InstanceEnvironment for the given context path. Delegates resolution entirely to ContextRepository, which manages the caching layer before hitting the database.
      Parameters:
      path - the fully-qualified context path, e.g. /gcube/devsec/devVRE
      Returns:
      the resolved InstanceEnvironment
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException - if the context cannot be resolved
    • getEnvironmentByUUID

      public static InstanceEnvironment getEnvironmentByUUID(UUID uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Resolves the InstanceEnvironment for the given context UUID. Loads the Context via ContextRepository and recursively resolves the parent chain dynamically on-the-fly without JVM-local caching.
      Parameters:
      uuid - the UUID of the context
      Returns:
      the resolved InstanceEnvironment
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the context cannot be found