This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MultiCloudJ is a cloud-agnostic Java SDK providing unified interfaces for cloud services across AWS, GCP, and Alibaba Cloud. The SDK uses Java Service Provider Interface (SPI) pattern to load provider-specific implementations at runtime.
The project follows a hierarchical module organization:
Common Modules:
multicloudj-common: Core abstractions, exceptions, and utilities shared across all servicesmulticloudj-common-aws: AWS-specific common utilities and abstractionsmulticloudj-common-gcp: GCP-specific common utilities and abstractionsmulticloudj-common-ali: Alibaba Cloud-specific common utilities and abstractions
Service Modules: Each service has a -client module (cloud-agnostic API) and provider-specific implementation modules:
- Blob Storage:
blob/blob-client(API),blob/blob-aws,blob/blob-gcp,blob/blob-ali - Document Store:
docstore/docstore-client(API),docstore/docstore-aws,docstore/docstore-gcp-firestore,docstore/docstore-gcp-spanner,docstore/docstore-ali - STS (Security Token Service):
sts/sts-client(API),sts/sts-aws,sts/sts-gcp,sts/sts-ali - PubSub:
pubsub/pubsub-client(API),pubsub/pubsub-aws,pubsub/pubsub-gcp
Other Modules:
examples: Example code demonstrating SDK usagecoverage-report: Aggregated code coverage reports
The SDK uses Java ServiceLoader for provider discovery. Provider-specific implementations are loaded dynamically based on providerId (e.g., "aws", "gcp", "ali"). All provider implementations:
- Extend abstract classes from
-clientmodules (e.g.,AbstractBlobStore,AbstractBlobClient) - Implement the
Providerinterface withgetProviderId()method - Are registered in
META-INF/services/files for ServiceLoader
Services expose two types of clients:
- Service-level clients (e.g.,
BlobClient): Service-wide operations like listing buckets - Resource-level clients (e.g.,
BucketClient,TopicClient): Operations on specific resources
Clients are instantiated using builder pattern: BlobClient.builder("aws").withRegion("us-west-2").build()
# Full build with all unit tests
a. mvn clean install
# Build without tests, before running any tests, always run this step.
b. mvn clean install -DskipTests
# Run unit tests only
c. mvn clean test
# Run the full test suite including unit and integration tests
d. mvn clean verify
# Run tests for specific module, but make sure you run command b. before this
e. mvn test -pl blob/blob-aws
# Run specific test class, but make sure you run command b. before this
f. mvn test -pl blob/blob-aws -Dtest=AwsBlobStoreTest
# Run integration tests with recording mode (updates test fixtures)
g. mvn test -pl blob/blob-aws -Dtest=AwsBlobStoreIT -Drecord
- Unit tests (
*Test.java): Mock-based tests, no external dependencies - Conformance tests (
AbstractBlobStoreIT, etc.): Base test suites in-clientmodules that provider implementations extend to ensure API compliance- Conformance tests are also integration tests. Conformance tests are written once on Abstract class such as
AbstractBlobStoreITand executed by each cloud such asAwsBlobStoreIT. - We never run the conformance tests through abstract class, only the implementation gets executed such as
AwsBlobStoreIT - Conformance tests are executed in 2 modes:
- record mode: with
-Drecordand the credentials are supplied. This mode uses wiremock as a forward proxy and record all the http transactions as request/response - replay mode: default mode with no credentials required. This mode uses wiremock as a forward proxy and replays the previously recorded responses by record mode.
- record mode: with
- Conformance tests are also integration tests. Conformance tests are written once on Abstract class such as
Conformance tests require valid cloud credentials:
- AWS: Set
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN, if they are not available, ask the user. - GCP: Set
GOOGLE_APPLICATION_CREDENTIALSpointing to service account JSON, if they are not available, ask the user. - Alibaba: It depends upon the cloud service, for tablestore it's:
TABLESTORE_ACCESS_KEY_ID,TABLESTORE_ACCESS_KEY_SECRET,TABLESTORE_SESSION_TOKEN
- Never add cloud specific dependency in cloud-agnostic package.
- for example,
docstore-clientshould never depend uponmulticloud-common-gcp,docstore-awsetc
- for example,
- Never put any provider specific code, documentation, keywords in client, driver packages such as anything in
docstore-clientmodule.
- Define cloud-agnostic API in
-clientfor end user, for exampleBucketClient,DocstoreClient - Define cloud-agnostic API in
-clientmodule's abstract class in driver such asAbstractBlobStore,AbstractDocstore - Implement functionality in each provider-specific module (aws, gcp, ali)
- Add unit tests to provider modules
- Add/update conformance tests in
-clientmodule - Ensure checkstyle passes (Google Java Style Guide), the checkstyle.xml are in config/
Features must be implementable across all supported cloud providers. If a feature is provider-specific, discuss in an issue before implementing. The SDK prioritizes cross-cloud compatibility over provider-specific capabilities.
Look for the local instructions in ~/.claude/config.md for git push to take the auth issues
- Java Version: Requires Java 11+, targets Java 11 bytecode
- Build Tool: Maven 3.8+
- Parent POM:
multicloudj-parentin rootpom.xml - Version Management: Uses
${revision}property with flatten-maven-plugin - Code Coverage: JaCoCo plugin enabled, reports in
coverage-reportmodule