Generic GraphQL client for Adobe Experience Manager (AEM), packaged as an OSGi bundle.
- JDK 8 (CI uses
cimg/openjdk:8.0; compiler source/target is 1.8) mvn clean install— build, test, and verify formattingmvn clean install -P format-code— auto-format code and sort imports before buildingmvn install -P autoInstallBundle— build and deploy bundle to local AEM instance
- Unit tests: JUnit 4 + Mockito 1.x + wcm.io AEM Mock. Run with
mvn test - Coverage: JaCoCo enforces ≥80% branch coverage; build fails if not met
- Formatter: Eclipse-based rules in
eclipse-formatter.xml(4-space indent, 140-char line width, spaces not tabs). Validated duringverifyphase; auto-fix with-P format-code - Import order:
java,javax,org, then others; static imports last. Enforced by impsort-maven-plugin; auto-fix with-P format-code - License headers: Apache 2.0 header required on all source files. Enforced by apache-rat-plugin during
compilephase
Single-module project (bundle packaging).
| Package | Description |
|---|---|
c.a.c.c.graphql.client |
Public API — GraphqlClient interface, request/response types, configuration |
c.a.c.c.graphql.client.impl |
OSGi component implementation — HTTP client, caching, metrics, adapter factory |
c.a.c.c.graphql.client.impl.circuitbreaker |
Failsafe-based circuit breaker policies (server error, timeout, unavailable) |
c.a.c.c = com.adobe.cq.commerce
- OSGi Declarative Services:
GraphqlClientImplis a factory component configured viaGraphqlClientConfiguration(OSGi metatype annotation interface). Instances are registered with anidentifierservice property used to look up clients from JCR resources - Adapter pattern:
GraphqlClientAdapterFactoryadapts Sling resources toGraphqlClientby matching thecq:graphqlClientresource property to the client identifier - HTTP: Apache HttpClient 4.x with pooled connection manager. Configurable timeouts, keep-alive, TLS settings
- Caching: Guava
Cachekeyed by request + options. Cache names, sizes, and TTLs configured per-client via OSGi. Mutations bypass cache.CacheInvalidatorsupports selective invalidation by store view, cache name, or pattern - Fault tolerance:
FaultTolerantExecutoruses Failsafe circuit breaker (optional, enabled via config).DefaultExecutoris the non-resilient alternative - Metrics: Dropwizard Metrics for HTTP connection pool and cache stats, wired via optional OSGi reference to a named
MetricRegistry - Serialization: Gson for JSON request/response marshalling. Response is generic:
GraphqlResponse<T, U>where T = data type, U = error type