InvocationContext
Keywords: net.corda.core.context.InvocationContext class
Date: 2023-09-18

net.corda.core.context

## Class InvocationContext

- net.corda.core.context.InvocationContext

-     public class InvocationContext

  Models the information needed to trace an invocation in Corda. Includes initiating actor, origin, trace information, and optional external trace information to correlate clients' IDs.

- - ### Field Detail

    - #### Companion

          public static net.corda.core.context.InvocationContext.Companion Companion

  - ### Constructor Detail

    - #### InvocationContext

          public InvocationContext(@NotNull
                                   InvocationOrigin origin,
                                   @NotNull
                                   Trace trace,
                                   @Nullable
                                   Actor actor,
                                   @Nullable
                                   Trace externalTrace,
                                   @Nullable
                                   Actor impersonatedActor,
                                   @Nullable
                                   java.util.List<? extends java.lang.Object> arguments,
                                   @Nullable
                                   java.lang.String clientId,
                                   @Nullable
                                   net.corda.core.internal.telemetry.SerializedTelemetry serializedTelemetry)

      Models the information needed to trace an invocation in Corda. Includes initiating actor, origin, trace information, and optional external trace information to correlate clients' IDs.

      Parameters:
        `origin` - Origin of the invocation.
        `trace` - Corda invocation trace.
        `actor` - Acting agent of the invocation, used to derive the security principal.
        `externalTrace` - Optional external invocation trace for cross-system logs correlation.
        `impersonatedActor` - Optional impersonated actor, used for logging but not for authorisation.

    - #### InvocationContext

          public InvocationContext(@NotNull
                                   InvocationOrigin origin,
                                   @NotNull
                                   Trace trace,
                                   @Nullable
                                   Actor actor,
                                   @Nullable
                                   Trace externalTrace,
                                   @Nullable
                                   Actor impersonatedActor)

    - #### InvocationContext

          public InvocationContext(@NotNull
                                   InvocationOrigin origin,
                                   @NotNull
                                   Trace trace,
                                   @Nullable
                                   Actor actor,
                                   @Nullable
                                   Trace externalTrace,
                                   @Nullable
                                   Actor impersonatedActor,
                                   @Nullable
                                   java.util.List<? extends java.lang.Object> arguments,
                                   @Nullable
                                   java.lang.String clientId)

  - ### Method Detail

    - #### principal

          @NotNull
          public java.security.Principal principal()

      Associated security principal.

    - #### copy

          @NotNull
          public InvocationContext copy(@NotNull
                                                 InvocationOrigin origin,
                                                 @NotNull
                                                 Trace trace,
                                                 @Nullable
                                                 Actor actor,
                                                 @Nullable
                                                 Trace externalTrace,
                                                 @Nullable
                                                 Actor impersonatedActor)

    - #### copy

          @NotNull
          public InvocationContext copy(@NotNull
                                                 InvocationOrigin origin,
                                                 @NotNull
                                                 Trace trace,
                                                 @Nullable
                                                 Actor actor,
                                                 @Nullable
                                                 Trace externalTrace,
                                                 @Nullable
                                                 Actor impersonatedActor,
                                                 @Nullable
                                                 java.util.List<? extends java.lang.Object> arguments,
                                                 @Nullable
                                                 java.lang.String clientId)

    - #### getOrigin

          @NotNull
          public InvocationOrigin getOrigin()

      Origin of the invocation.

    - #### getTrace

          @NotNull
          public Trace getTrace()

      Corda invocation trace.

    - #### getActor

          @Nullable
          public Actor getActor()

      Acting agent of the invocation,

      used to derive the security principal.

    - #### getExternalTrace

          @Nullable
          public Trace getExternalTrace()

      Optional external invocation trace for cross-system logs correlation.

    - #### getImpersonatedActor

          @Nullable
          public Actor getImpersonatedActor()

      Optional impersonated actor,

      used for logging but not for authorisation.

    - #### getArguments

          @Nullable
          public java.util.List<java.lang.Object> getArguments()

    - #### getClientId

          @Nullable
          public java.lang.String getClientId()

    - #### getSerializedTelemetry

          @Nullable
          public net.corda.core.internal.telemetry.SerializedTelemetry getSerializedTelemetry()

    - #### component1

          @NotNull
          public InvocationOrigin component1()

      Origin of the invocation.

    - #### component2

          @NotNull
          public Trace component2()

      Corda invocation trace.

    - #### component3

          @Nullable
          public Actor component3()

      Acting agent of the invocation,

      used to derive the security principal.

    - #### component4

          @Nullable
          public Trace component4()

      Optional external invocation trace for cross-system logs correlation.

    - #### component5

          @Nullable
          public Actor component5()

      Optional impersonated actor,

      used for logging but not for authorisation.

    - #### component6

          @Nullable
          public java.util.List<java.lang.Object> component6()

    - #### component7

          @Nullable
          public java.lang.String component7()

    - #### component8

          @Nullable
          public net.corda.core.internal.telemetry.SerializedTelemetry component8()

    - #### copy

          @NotNull
          public InvocationContext copy(@NotNull
                                                 InvocationOrigin origin,
                                                 @NotNull
                                                 Trace trace,
                                                 @Nullable
                                                 Actor actor,
                                                 @Nullable
                                                 Trace externalTrace,
                                                 @Nullable
                                                 Actor impersonatedActor,
                                                 @Nullable
                                                 java.util.List<? extends java.lang.Object> arguments,
                                                 @Nullable
                                                 java.lang.String clientId,
                                                 @Nullable
                                                 net.corda.core.internal.telemetry.SerializedTelemetry serializedTelemetry)

      Models the information needed to trace an invocation in Corda. Includes initiating actor, origin, trace information, and optional external trace information to correlate clients' IDs.

    - #### toString

          @NotNull
          public java.lang.String toString()

      Models the information needed to trace an invocation in Corda. Includes initiating actor, origin, trace information, and optional external trace information to correlate clients' IDs.

    - #### hashCode

          public int hashCode()

      Models the information needed to trace an invocation in Corda. Includes initiating actor, origin, trace information, and optional external trace information to correlate clients' IDs.

    - #### equals

          public boolean equals(@Nullable
                                java.lang.Object p)

      Models the information needed to trace an invocation in Corda. Includes initiating actor, origin, trace information, and optional external trace information to correlate clients' IDs.

    - #### newInstance

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext newInstance(@NotNull
                                                                                          InvocationOrigin origin,
                                                                                          @NotNull
                                                                                          Trace trace,
                                                                                          @Nullable
                                                                                          Actor actor,
                                                                                          @Nullable
                                                                                          Trace externalTrace,
                                                                                          @Nullable
                                                                                          Actor impersonatedActor,
                                                                                          @NotNull
                                                                                          java.util.List<? extends java.lang.Object> arguments,
                                                                                          @Nullable
                                                                                          java.lang.String clientId,
                                                                                          @Nullable
                                                                                          net.corda.core.internal.telemetry.SerializedTelemetry serializedTelemetry)

      Creates an `class InvocationContext` with a `class Trace` that defaults to a java.util.UUID as value and java.time.Instant.now timestamp.

      See Also:
        `class InvocationContext`, `class Trace`, java.util.UUID, java.time.Instant.now

    - #### newInstance

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext newInstance(@NotNull
                                                                                          InvocationOrigin origin,
                                                                                          @NotNull
                                                                                          Trace trace,
                                                                                          @Nullable
                                                                                          Actor actor,
                                                                                          @Nullable
                                                                                          Trace externalTrace,
                                                                                          @Nullable
                                                                                          Actor impersonatedActor,
                                                                                          @NotNull
                                                                                          java.util.List<? extends java.lang.Object> arguments,
                                                                                          @Nullable
                                                                                          java.lang.String clientId)

      Creates an `class InvocationContext` with a `class Trace` that defaults to a java.util.UUID as value and java.time.Instant.now timestamp.

      See Also:
        `class InvocationContext`, `class Trace`, java.util.UUID, java.time.Instant.now

    - #### newInstance

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext newInstance(@NotNull
                                                                                          InvocationOrigin origin,
                                                                                          @NotNull
                                                                                          Trace trace,
                                                                                          @Nullable
                                                                                          Actor actor,
                                                                                          @Nullable
                                                                                          Trace externalTrace,
                                                                                          @Nullable
                                                                                          Actor impersonatedActor,
                                                                                          @NotNull
                                                                                          java.util.List<? extends java.lang.Object> arguments)

      Creates an `class InvocationContext` with a `class Trace` that defaults to a java.util.UUID as value and java.time.Instant.now timestamp.

      See Also:
        `class InvocationContext`, `class Trace`, java.util.UUID, java.time.Instant.now

    - #### newInstance

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext newInstance(@NotNull
                                                                                          InvocationOrigin origin,
                                                                                          @NotNull
                                                                                          Trace trace,
                                                                                          @Nullable
                                                                                          Actor actor,
                                                                                          @Nullable
                                                                                          Trace externalTrace,
                                                                                          @Nullable
                                                                                          Actor impersonatedActor)

      Creates an `class InvocationContext` with a `class Trace` that defaults to a java.util.UUID as value and java.time.Instant.now timestamp.

      See Also:
        `class InvocationContext`, `class Trace`, java.util.UUID, java.time.Instant.now

    - #### newInstance

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext newInstance(@NotNull
                                                                                          InvocationOrigin origin,
                                                                                          @NotNull
                                                                                          Trace trace,
                                                                                          @Nullable
                                                                                          Actor actor,
                                                                                          @Nullable
                                                                                          Trace externalTrace)

      Creates an `class InvocationContext` with a `class Trace` that defaults to a java.util.UUID as value and java.time.Instant.now timestamp.

      See Also:
        `class InvocationContext`, `class Trace`, java.util.UUID, java.time.Instant.now

    - #### newInstance

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext newInstance(@NotNull
                                                                                          InvocationOrigin origin,
                                                                                          @NotNull
                                                                                          Trace trace,
                                                                                          @Nullable
                                                                                          Actor actor)

      Creates an `class InvocationContext` with a `class Trace` that defaults to a java.util.UUID as value and java.time.Instant.now timestamp.

      See Also:
        `class InvocationContext`, `class Trace`, java.util.UUID, java.time.Instant.now

    - #### newInstance

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext newInstance(@NotNull
                                                                                          InvocationOrigin origin,
                                                                                          @NotNull
                                                                                          Trace trace)

      Creates an `class InvocationContext` with a `class Trace` that defaults to a java.util.UUID as value and java.time.Instant.now timestamp.

      See Also:
        `class InvocationContext`, `class Trace`, java.util.UUID, java.time.Instant.now

    - #### newInstance

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext newInstance(@NotNull
                                                                                          InvocationOrigin origin)

      Creates an `class InvocationContext` with a `class Trace` that defaults to a java.util.UUID as value and java.time.Instant.now timestamp.

      See Also:
        `class InvocationContext`, `class Trace`, java.util.UUID, java.time.Instant.now

    - #### rpc

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext rpc(@NotNull
                                                                                  Actor actor,
                                                                                  @NotNull
                                                                                  Trace trace,
                                                                                  @Nullable
                                                                                  Trace externalTrace,
                                                                                  @Nullable
                                                                                  Actor impersonatedActor,
                                                                                  @NotNull
                                                                                  java.util.List<? extends java.lang.Object> arguments,
                                                                                  @Nullable
                                                                                  net.corda.core.internal.telemetry.SerializedTelemetry serializedTelemetry)

      Creates an `class InvocationContext` with `class InvocationOrigin.RPC` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.RPC`

    - #### rpc

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext rpc(@NotNull
                                                                                  Actor actor,
                                                                                  @NotNull
                                                                                  Trace trace,
                                                                                  @Nullable
                                                                                  Trace externalTrace,
                                                                                  @Nullable
                                                                                  Actor impersonatedActor,
                                                                                  @NotNull
                                                                                  java.util.List<? extends java.lang.Object> arguments)

      Creates an `class InvocationContext` with `class InvocationOrigin.RPC` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.RPC`

    - #### rpc

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext rpc(@NotNull
                                                                                  Actor actor,
                                                                                  @NotNull
                                                                                  Trace trace,
                                                                                  @Nullable
                                                                                  Trace externalTrace,
                                                                                  @Nullable
                                                                                  Actor impersonatedActor)

      Creates an `class InvocationContext` with `class InvocationOrigin.RPC` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.RPC`

    - #### rpc

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext rpc(@NotNull
                                                                                  Actor actor,
                                                                                  @NotNull
                                                                                  Trace trace,
                                                                                  @Nullable
                                                                                  Trace externalTrace)

      Creates an `class InvocationContext` with `class InvocationOrigin.RPC` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.RPC`

    - #### rpc

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext rpc(@NotNull
                                                                                  Actor actor,
                                                                                  @NotNull
                                                                                  Trace trace)

      Creates an `class InvocationContext` with `class InvocationOrigin.RPC` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.RPC`

    - #### rpc

          @JvmStatic
           @JvmOverloads
           @NotNull
          public static InvocationContext rpc(@NotNull
                                                                                  Actor actor)

      Creates an `class InvocationContext` with `class InvocationOrigin.RPC` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.RPC`

    - #### peer

          @JvmStatic
           @NotNull
          public static InvocationContext peer(@NotNull
                                                                    CordaX500Name party,
                                                                    @NotNull
                                                                    Trace trace,
                                                                    @Nullable
                                                                    Trace externalTrace,
                                                                    @Nullable
                                                                    Actor impersonatedActor)

      Creates an `class InvocationContext` with `class InvocationOrigin.Peer` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.Peer`

    - #### service

          @JvmStatic
           @NotNull
          public static InvocationContext service(@NotNull
                                                                       java.lang.String serviceClassName,
                                                                       @NotNull
                                                                       CordaX500Name owningLegalIdentity,
                                                                       @NotNull
                                                                       Trace trace,
                                                                       @Nullable
                                                                       Trace externalTrace)

      Creates an `class InvocationContext` with `class InvocationOrigin.Service` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.Service`

    - #### scheduled

          @JvmStatic
           @NotNull
          public static InvocationContext scheduled(@NotNull
                                                                         ScheduledStateRef scheduledState,
                                                                         @NotNull
                                                                         Trace trace,
                                                                         @Nullable
                                                                         Trace externalTrace)

      Creates an `class InvocationContext` with `class InvocationOrigin.Scheduled` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.Scheduled`

    - #### shell

          @JvmStatic
           @NotNull
          public static InvocationContext shell(@NotNull
                                                                     Trace trace,
                                                                     @Nullable
                                                                     Trace externalTrace)

      Creates an `class InvocationContext` with `class InvocationOrigin.Shell` origin.

      See Also:
        `class InvocationContext`, `class InvocationOrigin.Shell`