Class ResourceBindingFactory

java.lang.Object
org.j7m.middleware.application.distributed.ResourceBindingFactory
All Implemented Interfaces:
org.j7m.middleware.application.components.ManagedHostBindings.Factory

public final class ResourceBindingFactory extends Object implements org.j7m.middleware.application.components.ManagedHostBindings.Factory
Trusted optional host adapter for named D resources, separate from ObjectRef business RPC. Raw group resources accept NEVER only: their native leader protocol is intrinsic and unchanged. Partition registrations support authoritative ownership refresh with no same-call replay.
  • Constructor Details

    • ResourceBindingFactory

      public ResourceBindingFactory(Map<String, ResourceBindingFactory.Registration> resources, Set<String> policies)
      Registers finite explicitly authorized named resource capabilities.
      Parameters:
      resources - at most256 immutable named registrations
      policies - host-approved binding policy IDs, at most256
      Throws:
      IllegalArgumentException - for invalid IDs/capacity
  • Method Details

    • deduplicationContext

      public static ResourceBindingFactory.Registration deduplicationContext()
      Registers a provider-only lookup of the current acquired deduplication claim. The returned value is the actual lifetime-bound capability, never a mutable global facade.
      Returns:
      NEVER-only registration requiring an active managed deduplication invocation
    • ownershipContext

      public static ResourceBindingFactory.Registration ownershipContext()
      Registers provider-only lookup of the actual current native ownership claim. An existing claim object never rebinds to another owner. Lookup outside an owned invocation fails, and refresh modes cannot manufacture a new lease or revive a revoked context.
      Returns:
      NEVER-only invocation capability registration
    • sagaContext

      public static ResourceBindingFactory.Registration sagaContext()
      Supplies the actual current saga callback context through a provider only.
      Returns:
      host registration that cannot capture a context across callbacks
    • jobContext

      public static ResourceBindingFactory.Registration jobContext()
      Supplies the actual current job callback context through a provider only.
      Returns:
      NEVER-only registration that cannot capture or retarget callback ownership
    • saga

      Registers one host-selected saga client with a revocable binding view. Closing this binding blocks new client operations without closing shared native endpoints.
      Parameters:
      client - trusted definition/version facade
      Returns:
      NEVER-refresh registration; each operation resolves actual admitted ownership
      Throws:
      NullPointerException - for a missing client
    • resourceTransactionContext

      public static ResourceBindingFactory.Registration resourceTransactionContext()
      Registers provider-only access to the actual current native resource transaction.
      Returns:
      NEVER-only borrowed invocation capability registration
    • jdbcTransactionContext

      public static ResourceBindingFactory.Registration jdbcTransactionContext()
      Registers provider-only access to the actual current local JDBC transaction context.
      Returns:
      NEVER-only borrowed invocation capability registration
    • jdbcConnection

      public static ResourceBindingFactory.Registration jdbcConnection()
      Registers the current transaction's exact guarded Connection, without a global switching proxy.
      Returns:
      provider-only NEVER registration; lookup requires actual owned USER context
    • partitionProgram

      public static ResourceBindingFactory.Registration partitionProgram(ManagedPartitionClient client)
      Borrows a typed encoded-program client with its own authoritative per-operation D08 routing. The binding supports NEVER selection because the client already resolves current ownership. Its concrete program/schema contract is validated on every operation; typed query additionally checks the requested Java view type. No generic DI graph extension is needed. Closing the binding revokes its scoped view before further codec/RPC entry, without closing the trusted host's original client, schemas or shared endpoints.
      Parameters:
      client - prepared thread-safe authorized client for one concrete program and scope
      Returns:
      explicit typed client capability registration
      Throws:
      NullPointerException - for a missing client
    • group

      public static ResourceBindingFactory.Registration group(org.j7m.middleware.distributed.ResourceEndpoint endpoint)
      Borrows a raw group endpoint; native D leader following and durable identities are preserved.
      Parameters:
      endpoint - already authenticated authorized resource endpoint
      Returns:
      registration supporting NEVER selection
    • partitionGroup

      public static ResourceBindingFactory.Registration partitionGroup(org.j7m.middleware.distributed.PartitionEndpoint endpoint)
      Borrows a raw single-owner partition group endpoint; no ownership refresh is claimed.
      Parameters:
      endpoint - authenticated authorized group endpoint
      Returns:
      registration supporting NEVER selection
    • partition

      public static ResourceBindingFactory.Registration partition(String partition, org.j7m.middleware.distributed.PartitionAdminClient topology, Map<String, org.j7m.middleware.distributed.PartitionEndpoint> groups, Duration preparationBudget)
      Registers an authoritative partition identity with bounded preparation and trusted clients.
      Parameters:
      partition - stable partition identity
      topology - separately authorized topology read facade
      groups - authorized group endpoints
      preparationBudget - positive at most30seconds
      Returns:
      registration supporting all three binding modes
      Throws:
      IllegalArgumentException - for invalid preparation budget
    • queueGroup

      public static ResourceBindingFactory.Registration queueGroup(String partition, String scope, org.j7m.middleware.distributed.PartitionEndpoint endpoint, long epoch)
      Constructs an authorized scope-bound queue client over a fixed owner group. Native leader following and identical-ID MOVED/FROZEN handling remain queue protocol behavior.
      Parameters:
      partition - stable queue partition
      scope - authenticated endpoint tenant scope
      endpoint - borrowed authorized group endpoint
      epoch - positive fixed ownership epoch
      Returns:
      NEVER-only typed registration; closing revokes its endpoint wrapper
    • executionGroup

      public static ResourceBindingFactory.Registration executionGroup(String partition, String scope, org.j7m.middleware.distributed.PartitionEndpoint endpoint, long epoch)
      Constructs an authorized scope-bound execution client over a fixed owner group.
      Parameters:
      partition - stable execution partition
      scope - authenticated endpoint tenant scope
      endpoint - borrowed authorized group endpoint
      epoch - positive fixed ownership epoch
      Returns:
      NEVER-only typed execution registration
    • queue

      public static ResourceBindingFactory.Registration queue(String partition, String scope, org.j7m.middleware.distributed.PartitionAdminClient topology, Map<String, org.j7m.middleware.distributed.PartitionEndpoint> groups, Duration preparationBudget)
      Constructs a real queue facade with authoritative owner routing and stable durable identities. Binding refresh never repeats an endpoint invocation. Native queue retries only its documented identical-ID MOVED/FROZEN protocol, never an IOException/UNKNOWN or a new business identity.
      Parameters:
      partition - stable queue partition
      scope - authenticated tenant scope
      topology - borrowed authorized topology reader
      groups - borrowed authorized group clients
      preparationBudget - positive preparation bound at most30seconds
      Returns:
      typed queue registration supporting all refresh modes
    • execution

      public static ResourceBindingFactory.Registration execution(String partition, String scope, org.j7m.middleware.distributed.PartitionAdminClient topology, Map<String, org.j7m.middleware.distributed.PartitionEndpoint> groups, Duration preparationBudget)
      Constructs a real jobs/sagas/RPC execution client with authoritative owner routing. External effects are never invoked by this factory or client; UNKNOWN needs reconciliation.
      Parameters:
      partition - stable execution partition
      scope - authenticated tenant scope
      topology - borrowed authorized topology reader
      groups - borrowed authorized group clients
      preparationBudget - positive preparation bound at most30seconds
      Returns:
      typed execution registration supporting all refresh modes
    • execution

      public static ResourceBindingFactory.Registration execution(String partition, String scope, org.j7m.middleware.distributed.PartitionAdminClient topology, Map<String, org.j7m.middleware.distributed.PartitionEndpoint> groups, Duration preparationBudget, Supplier<Map<String,String>> context, org.j7m.middleware.distributed.ExecutionClient.Observer observer)
      Constructs an instrumented typed execution binding without a vendor dependency.
      Parameters:
      partition - stable execution partition
      scope - authenticated tenant scope
      topology - borrowed authorized topology reader
      groups - borrowed authorized group clients
      preparationBudget - positive bounded preparation time
      context - calling-thread W3C carrier supplier, never credentials
      observer - no-throw execution lifecycle observer
      Returns:
      typed execution registration preserving supplied context/instrumentation hooks
    • validate

      public void validate(org.j7m.middleware.application.api.ManagedDependency dependency, org.j7m.middleware.annotations.Scope.Kind scope)
      Specified by:
      validate in interface org.j7m.middleware.application.components.ManagedHostBindings.Factory
    • bind

      public org.j7m.middleware.application.components.ManagedHostBindings.BoundValue bind(org.j7m.middleware.application.api.ManagedDependency dependency) throws Exception
      Specified by:
      bind in interface org.j7m.middleware.application.components.ManagedHostBindings.Factory
      Throws:
      Exception