Class AnnotationModelDemo

java.lang.Object
org.j7m.middleware.demo.annotation.AnnotationModelDemo

public final class AnnotationModelDemo extends Object
Runnable Phase 6.11 walkthrough for the annotation-first application model.

The demo is written for application developers who want to see how the J7M annotations reduce manual wiring and document design intent without changing the underlying ObjectRef, security, saga, queue, or isolation contracts. It discovers @J7mApplication, @J7mService, and @RemoteMethod metadata with AnnotationModelProcessor, builds stable descriptors, and validates that supported security, idempotency, deadline, retry, queue, saga, isolation, and observability annotations are represented as safe descriptor or metadata examples.

The same run constructs application components through the J7M-native DefaultJ7mInjector. Constructor injection, named resources, configuration values, current application context, current invocation context, and current principal context are demonstrated through public capability bindings only. Lifecycle annotations are enforced by invoking @Initialize, @Startup, @Drain, and @Shutdown hooks in deterministic order. The security example evaluates descriptor metadata locally to show an authorized and denied path; exported production calls still depend on the normal runtime authorization policy. Idempotency, retry, backpressure, queue, saga, and isolation annotations are descriptor-only in this demo.

@Sensitive redaction is demonstrated by carrying sentinel configuration and sensitive business values through audit/status output and printing only redacted summaries. This class is intentionally not a production runtime, dispatcher, authorization engine, queue worker, saga orchestrator, or isolation provider. It uses local fake public capability proxies, starts no external services, loads no vendor adapters, and requires no external DI framework. Developers should expect output that lists the derived descriptor, lifecycle order, security and idempotency metadata, descriptor-only queue/saga/isolation metadata, denied-call behavior, and redaction status. See docs/examples/annotation-coverage.md and the examples/annotation-first-* sources for copyable application patterns.

  • Method Details

    • main

      public static void main(String[] args)
      Runs the local descriptor, injection, lifecycle, security, and redaction demonstration.

      The method exercises annotation descriptor processing with explicit application and service classes rather than classpath scanning. It then creates components through DefaultJ7mInjector, opens scoped invocation/principal context with J7mContext, invokes lifecycle hooks, calls one annotated service method, and prints a safe operational summary. Constructor injection, scoped context injection, lifecycle hook invocation, and local denied-path evaluation are enforced in this demo. Idempotency, retry, backpressure, queue, saga, isolation, and observability annotations are shown as descriptor-only metadata.

      The code is safe to copy as a pattern for explicit descriptor validation, injector construction, lifecycle ordering, and redacted demo output. It is intentionally simplified by using fake public capability proxies instead of real queue dispatch, saga orchestration, service export, or isolation enforcement. The printed output must not contain the sentinel secret or sensitive amount values.

      Parameters:
      args - ignored command-line arguments