Class ManagedContainer

java.lang.Object
org.j7m.middleware.application.components.ManagedContainer
All Implemented Interfaces:
AutoCloseable

public final class ManagedContainer extends Object implements AutoCloseable
Opt-in application-owned container for finite generated component indexes. The full graph is validated before any product is created; activation products are then eagerly constructed. This API does not deploy applications, scan classpaths, invoke lifecycle hooks, refresh routes or change the legacy injector. Owned AutoCloseable values close in reverse creation order. A failed construction invalidates and disposes its resolving scope. Call scopes are explicit; async propagation and hosting integration are separate APIs.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    final class 
    Explicit call ownership boundary, shared neither implicitly nor through captured providers.
    static final class 
    Safe graph/lifecycle failure without application exception messages or qualifier values.
    static final record 
    Bounded aggregate lifecycle counters without component names or configuration values.
  • Method Summary

    Modifier and Type
    Method
    Description
    activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes)
    Validates and starts a finite activation with a4096-instance ownership/call limit.
    activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes, int capacity)
    Starts a finite activation with explicit ownership and open-call capacity.
    activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes, int capacity, LiveConfiguration configuration)
    Starts a bounded activation with configuration bindings validated before constructors.
    activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes, int capacity, LiveConfiguration configuration, ManagedHostBindings bindings)
    Validates and starts an activation with explicitly granted host integration capabilities.
    activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes, LiveConfiguration configuration)
    Starts a finite activation with explicit host-owned configuration.
    void
    Closes idle call scopes and then activation products.
    <T> T
    get(Class<T> type, String name, List<org.j7m.middleware.application.api.ManagedQualifier> qualifiers)
    Resolves an activation/prototype root; CALL roots require an explicit call scope.
    void
    lifecycle(org.j7m.middleware.application.api.ManagedLifecycle phase)
    Runs managed lifecycle phases over owned generated host adapters.
    Opens a detached explicit call scope.
    <T> org.j7m.middleware.application.api.ManagedProvider<T>
    provider(Class<T> type, String name, List<org.j7m.middleware.application.api.ManagedQualifier> qualifiers)
    Creates a lazy root lookup.
    Returns aggregate state without sensitive component metadata.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • activate

      public static ManagedContainer activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes)
      Validates and starts a finite activation with a4096-instance ownership/call limit.
      Parameters:
      indexes - explicit generated indexes, never a classpath scan
      Returns:
      active managed container
      Throws:
      IllegalStateException - for invalid graphs or construction failure
    • activate

      public static ManagedContainer activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes, int capacity)
      Starts a finite activation with explicit ownership and open-call capacity.
      Parameters:
      indexes - explicit version1 indexes
      capacity - maximum live owned values and separately maximum open call scopes,1..1000000
      Returns:
      active container
      Throws:
      IllegalStateException - for unsupported metadata, invalid graph or failed creation
    • activate

      public static ManagedContainer activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes, LiveConfiguration configuration)
      Starts a finite activation with explicit host-owned configuration. The container owns only its binding registrations, never the configuration owner.
      Parameters:
      indexes - explicit version1 indexes
      configuration - borrowed configuration owner
      Returns:
      active container with4096-instance capacity
      Throws:
      IllegalStateException - for invalid graphs/configuration or construction failure
    • activate

      public static ManagedContainer activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes, int capacity, LiveConfiguration configuration)
      Starts a bounded activation with configuration bindings validated before constructors.
      Parameters:
      indexes - explicit version1 indexes
      capacity - maximum owned instances and separately open calls
      configuration - borrowed nonnull host configuration
      Returns:
      active managed container
      Throws:
      IllegalStateException - for invalid configuration, metadata or graph
    • get

      public <T> T get(Class<T> type, String name, List<org.j7m.middleware.application.api.ManagedQualifier> qualifiers)
      Resolves an activation/prototype root; CALL roots require an explicit call scope.
      Type Parameters:
      T - requested contract
      Parameters:
      type - required contract
      name - exact name, never an unnamed fallback
      qualifiers - exact qualifiers
      Returns:
      selected product
      Throws:
      IllegalStateException - for invalid selection, scope or failed construction
    • activate

      public static ManagedContainer activate(Collection<? extends org.j7m.middleware.application.api.ManagedComponentIndex> indexes, int capacity, LiveConfiguration configuration, ManagedHostBindings bindings)
      Validates and starts an activation with explicitly granted host integration capabilities.
      Parameters:
      indexes - finite trusted generated definitions
      capacity - maximum owned instances and concurrent call scopes
      configuration - optional live configuration, required by config edges
      bindings - explicit immutable host capability registry, never application supplied
      Returns:
      started activation; host bindings are owned and closed on failure or shutdown
      Throws:
      IllegalStateException - for invalid graph, metadata, binding or construction failure
    • provider

      public <T> org.j7m.middleware.application.api.ManagedProvider<T> provider(Class<T> type, String name, List<org.j7m.middleware.application.api.ManagedQualifier> qualifiers)
      Creates a lazy root lookup. CALL values require CallScope.call to be active on this thread.
      Type Parameters:
      T - required contract
      Parameters:
      type - required contract
      name - exact name
      qualifiers - exact qualifiers
      Returns:
      provider which never captures an old call scope
      Throws:
      IllegalStateException - if selection is missing/ambiguous or the container is closed
    • openCall

      public ManagedContainer.CallScope openCall()
      Opens a detached explicit call scope. Use call() to make it visible to lazy providers.
      Returns:
      new independently owned scope
      Throws:
      IllegalStateException - if closed or the bounded call capacity is exhausted
    • status

      public ManagedContainer.Status status()
      Returns aggregate state without sensitive component metadata.
      Returns:
      immutable lifecycle counters
    • lifecycle

      public void lifecycle(org.j7m.middleware.application.api.ManagedLifecycle phase)
      Runs managed lifecycle phases over owned generated host adapters. Initialization/startup follow dependency construction order; drain/shutdown use reverse order. Newly created CALL/PROTOTYPE values inherit the activation's initialized/started phases and are shut down when their actual owning scope closes. Failed hooks never cause repeat cleanup.
      Parameters:
      phase - requested phase, never null
      Throws:
      IllegalStateException - on application hook failure or shutdown while calls are running
    • close

      public void close()
      Closes idle call scopes and then activation products. Running calls must drain explicitly. All remaining disposers run even if one fails. Repeated close never repeats disposal.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IllegalStateException - if calls are running or any disposer fails