Repository: graphql-java-kickstart/graphql-java-servlet
Branch: master
Commit: 1b69c873421b
Files: 206
Total size: 394.0 KB
Directory structure:
gitextract_cv18k8ke/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ ├── config.yml
│ │ └── feature_request.md
│ ├── add-javax-suffix.sh
│ ├── release.sh
│ ├── replaceJakartaWithJavax.sh
│ ├── tag-release.sh
│ └── workflows/
│ ├── pull-request.yml
│ ├── release.yml
│ └── snapshot.yml
├── .gitignore
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── build.gradle
├── examples/
│ └── osgi/
│ ├── apache-karaf-feature/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── feature/
│ │ └── feature.xml
│ ├── apache-karaf-package/
│ │ └── pom.xml
│ ├── buildAndRun.sh
│ ├── pom.xml
│ └── providers/
│ ├── pom.xml
│ └── src/
│ └── main/
│ └── java/
│ └── graphql/
│ └── servlet/
│ └── examples/
│ └── osgi/
│ └── ExampleGraphQLProvider.java
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── graphql-java-kickstart/
│ ├── bnd.bnd
│ ├── build.gradle
│ └── src/
│ └── main/
│ └── java/
│ └── graphql/
│ └── kickstart/
│ └── execution/
│ ├── BatchedDataLoaderGraphQLBuilder.java
│ ├── DecoratedExecutionResult.java
│ ├── DefaultGraphQLRootObjectBuilder.java
│ ├── ExtensionsDeserializer.java
│ ├── FutureBatchedExecutionResult.java
│ ├── FutureErrorExecutionResult.java
│ ├── FutureExecutionResult.java
│ ├── FutureSingleExecutionResult.java
│ ├── GraphQLBatchedQueryResult.java
│ ├── GraphQLErrorQueryResult.java
│ ├── GraphQLInvoker.java
│ ├── GraphQLInvokerProxy.java
│ ├── GraphQLObjectMapper.java
│ ├── GraphQLQueryInvoker.java
│ ├── GraphQLQueryResult.java
│ ├── GraphQLRequest.java
│ ├── GraphQLRootObjectBuilder.java
│ ├── GraphQLSingleQueryResult.java
│ ├── ObjectMapDeserializationException.java
│ ├── ObjectMapDeserializeHelper.java
│ ├── OperationNameExtractor.java
│ ├── StaticGraphQLRootObjectBuilder.java
│ ├── StringUtils.java
│ ├── VariablesDeserializer.java
│ ├── config/
│ │ ├── ConfiguringObjectMapperProvider.java
│ │ ├── DefaultExecutionStrategyProvider.java
│ │ ├── DefaultGraphQLSchemaProvider.java
│ │ ├── ExecutionStrategyProvider.java
│ │ ├── GraphQLBuilder.java
│ │ ├── GraphQLBuilderConfigurer.java
│ │ ├── GraphQLSchemaProvider.java
│ │ ├── GraphQLServletObjectMapperConfigurer.java
│ │ ├── InstrumentationProvider.java
│ │ └── ObjectMapperProvider.java
│ ├── context/
│ │ ├── ContextSetting.java
│ │ ├── ContextSettingNotConfiguredException.java
│ │ ├── DefaultGraphQLContext.java
│ │ ├── DefaultGraphQLContextBuilder.java
│ │ ├── GraphQLContextBuilder.java
│ │ └── GraphQLKickstartContext.java
│ ├── error/
│ │ ├── DefaultGraphQLErrorHandler.java
│ │ ├── DefaultGraphQLServletObjectMapperConfigurer.java
│ │ ├── GenericGraphQLError.java
│ │ ├── GraphQLErrorHandler.java
│ │ └── RenderableNonNullableFieldWasNullError.java
│ ├── input/
│ │ ├── GraphQLBatchedInvocationInput.java
│ │ ├── GraphQLInvocationInput.java
│ │ ├── GraphQLSingleInvocationInput.java
│ │ ├── PerQueryBatchedInvocationInput.java
│ │ └── PerRequestBatchedInvocationInput.java
│ ├── instrumentation/
│ │ ├── AbstractTrackingApproach.java
│ │ ├── DataLoaderDispatcherInstrumentationState.java
│ │ ├── FieldLevelTrackingApproach.java
│ │ ├── NoOpInstrumentationProvider.java
│ │ ├── RequestLevelTrackingApproach.java
│ │ ├── RequestStack.java
│ │ ├── TrackingApproach.java
│ │ └── TrackingApproachException.java
│ └── subscriptions/
│ ├── AtomicSubscriptionSubscription.java
│ ├── DefaultSubscriptionSession.java
│ ├── GraphQLSubscriptionInvocationInputFactory.java
│ ├── GraphQLSubscriptionMapper.java
│ ├── SessionSubscriber.java
│ ├── SessionSubscriptions.java
│ ├── SubscriptionConnectionListener.java
│ ├── SubscriptionException.java
│ ├── SubscriptionProtocolFactory.java
│ ├── SubscriptionSession.java
│ └── apollo/
│ ├── ApolloCommandProvider.java
│ ├── ApolloSubscriptionConnectionListener.java
│ ├── ApolloSubscriptionConsumer.java
│ ├── ApolloSubscriptionKeepAliveRunner.java
│ ├── ApolloSubscriptionProtocolFactory.java
│ ├── ApolloSubscriptionSession.java
│ ├── KeepAliveSubscriptionConnectionListener.java
│ ├── OperationMessage.java
│ ├── SubscriptionCommand.java
│ ├── SubscriptionConnectionInitCommand.java
│ ├── SubscriptionConnectionTerminateCommand.java
│ ├── SubscriptionStartCommand.java
│ └── SubscriptionStopCommand.java
├── graphql-java-servlet/
│ ├── bnd.bnd
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ └── java/
│ │ └── graphql/
│ │ └── kickstart/
│ │ └── servlet/
│ │ ├── AbstractGraphQLHttpServlet.java
│ │ ├── AbstractGraphQLInvocationInputParser.java
│ │ ├── AsyncTaskDecorator.java
│ │ ├── AsyncTaskExecutor.java
│ │ ├── AsyncTimeoutListener.java
│ │ ├── BatchedQueryResponseWriter.java
│ │ ├── ConfiguredGraphQLHttpServlet.java
│ │ ├── ErrorQueryResponseWriter.java
│ │ ├── ExecutionResultSubscriber.java
│ │ ├── GraphQLConfiguration.java
│ │ ├── GraphQLGetInvocationInputParser.java
│ │ ├── GraphQLHttpServlet.java
│ │ ├── GraphQLInvocationInputParser.java
│ │ ├── GraphQLMultipartInvocationInputParser.java
│ │ ├── GraphQLPostInvocationInputParser.java
│ │ ├── GraphQLWebsocketServlet.java
│ │ ├── HttpRequestHandler.java
│ │ ├── HttpRequestHandlerImpl.java
│ │ ├── HttpRequestInvoker.java
│ │ ├── HttpRequestInvokerImpl.java
│ │ ├── InvocationInputParseException.java
│ │ ├── ListenerHandler.java
│ │ ├── OsgiGraphQLHttpServlet.java
│ │ ├── OsgiGraphQLHttpServletConfiguration.java
│ │ ├── OsgiSchemaBuilder.java
│ │ ├── PartIOException.java
│ │ ├── QueryResponseWriter.java
│ │ ├── QueryResponseWriterFactory.java
│ │ ├── QueryResponseWriterFactoryImpl.java
│ │ ├── SingleAsynchronousQueryResponseWriter.java
│ │ ├── SingleQueryResponseWriter.java
│ │ ├── StaticDataPublisher.java
│ │ ├── SubscriptionAsyncListener.java
│ │ ├── apollo/
│ │ │ ├── ApolloScalars.java
│ │ │ ├── ApolloWebSocketSubscriptionProtocolFactory.java
│ │ │ └── ApolloWebSocketSubscriptionSession.java
│ │ ├── cache/
│ │ │ ├── BufferedHttpServletResponse.java
│ │ │ ├── CacheReader.java
│ │ │ ├── CachedResponse.java
│ │ │ ├── CachingHttpRequestInvoker.java
│ │ │ ├── CachingQueryResponseWriter.java
│ │ │ ├── CachingQueryResponseWriterFactory.java
│ │ │ └── GraphQLResponseCacheManager.java
│ │ ├── config/
│ │ │ ├── DefaultGraphQLSchemaServletProvider.java
│ │ │ └── GraphQLSchemaServletProvider.java
│ │ ├── context/
│ │ │ ├── DefaultGraphQLServletContext.java
│ │ │ ├── DefaultGraphQLServletContextBuilder.java
│ │ │ ├── DefaultGraphQLWebSocketContext.java
│ │ │ ├── GraphQLServletContext.java
│ │ │ ├── GraphQLServletContextBuilder.java
│ │ │ └── GraphQLWebSocketContext.java
│ │ ├── core/
│ │ │ ├── DefaultGraphQLRootObjectBuilder.java
│ │ │ ├── GraphQLMBean.java
│ │ │ ├── GraphQLServletListener.java
│ │ │ ├── GraphQLServletRootObjectBuilder.java
│ │ │ └── internal/
│ │ │ ├── GraphQLThreadFactory.java
│ │ │ ├── VariableMapException.java
│ │ │ └── VariableMapper.java
│ │ ├── input/
│ │ │ ├── BatchInputPreProcessResult.java
│ │ │ ├── BatchInputPreProcessor.java
│ │ │ ├── GraphQLInvocationInputFactory.java
│ │ │ └── NoOpBatchInputPreProcessor.java
│ │ ├── osgi/
│ │ │ ├── GraphQLCodeRegistryProvider.java
│ │ │ ├── GraphQLDirectiveProvider.java
│ │ │ ├── GraphQLFieldProvider.java
│ │ │ ├── GraphQLMutationProvider.java
│ │ │ ├── GraphQLProvider.java
│ │ │ ├── GraphQLQueryProvider.java
│ │ │ ├── GraphQLSubscriptionProvider.java
│ │ │ └── GraphQLTypesProvider.java
│ │ └── subscriptions/
│ │ ├── FallbackSubscriptionConsumer.java
│ │ ├── FallbackSubscriptionProtocolFactory.java
│ │ ├── WebSocketSendSubscriber.java
│ │ ├── WebSocketSubscriptionProtocolFactory.java
│ │ └── WebSocketSubscriptionSession.java
│ └── test/
│ └── groovy/
│ └── graphql/
│ └── kickstart/
│ └── servlet/
│ ├── AbstractGraphQLHttpServletSpec.groovy
│ ├── BatchedQueryResponseWriterTest.groovy
│ ├── DataLoaderDispatchingSpec.groovy
│ ├── GraphQLServletListenerSpec.groovy
│ ├── OsgiGraphQLHttpServletSpec.groovy
│ ├── PartIOExceptionTest.groovy
│ ├── RequestTester.groovy
│ ├── SingleAsynchronousQueryResponseWriterTest.groovy
│ ├── SingleQueryResponseWriterTest.groovy
│ ├── TestBatchInputPreProcessor.java
│ ├── TestException.groovy
│ ├── TestGraphQLErrorException.groovy
│ ├── TestMultipartPart.groovy
│ ├── TestUtils.groovy
│ └── cache/
│ ├── CacheReaderTest.groovy
│ └── CachingHttpRequestInvokerTest.groovy
├── lombok.config
├── renovate.json
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Question
url: https://github.com/graphql-java-kickstart/graphql-java-servlet/discussions
about: Anything you are not sure about? Ask the community in Discussions!
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .github/add-javax-suffix.sh
================================================
#!/bin/bash
addSuffix() {
local result
result=$(grep include settings.gradle | awk '{print $2}' | tr -d "'" | tr -d ':')
readarray -t <<<"$result"
modules=("${MAPFILE[@]}")
updateLocalDependencies
}
updateLocalDependencies() {
for module in "${modules[@]}"; do
cp -rf "$module" "$module"-javax
rm -rf "$module"
for dependency in "${modules[@]}"; do
sed -i -E "s/project\(('|\"):${dependency}('|\")\)/project\(':${dependency}-javax'\)/" "$module"-"javax"/build.gradle
done
done
updateGradleSettings
}
updateGradleSettings() {
for module in "${modules[@]}"; do
echo "Replace ${module} with ${module}-javax in settings.gradle"
sed -i -E "s/('|\"):${module}('|\")/':${module}-javax'/" settings.gradle
done
cat settings.gradle
}
echo "Add suffix -javax to modules"
addSuffix
ls -lh
================================================
FILE: .github/release.sh
================================================
#!/bin/bash
set -ev
FLAVOUR="${1}"
removeSnapshots() {
sed -i 's/-SNAPSHOT//' gradle.properties
}
echo "Publishing release to Maven Central"
removeSnapshots
if [ "${FLAVOUR}" == 'javax' ]; then
.github/add-javax-suffix.sh
fi
./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository
================================================
FILE: .github/replaceJakartaWithJavax.sh
================================================
#!/bin/bash
# Set jdk11 as source and target
sed -i 's/SOURCE_COMPATIBILITY=.*/SOURCE_COMPATIBILITY=11/' gradle.properties
sed -i 's/TARGET_COMPATIBILITY=.*/TARGET_COMPATIBILITY=11/' gradle.properties
# Replace jakarta imports and dependencies with javax
grep -rl 'import jakarta' ./graphql-java-servlet | xargs sed -i 's/import jakarta/import javax/g'
sed -i 's/.*jakarta.websocket:jakarta.websocket-client-api.*//' graphql-java-servlet/build.gradle
sed -i \
's/jakarta.servlet:jakarta.servlet-api.*/javax.servlet:javax.servlet-api:$LIB_JAVAX_SERVLET"/' \
graphql-java-servlet/build.gradle
sed -i \
's/jakarta.websocket.*/javax.websocket:javax.websocket-api:$LIB_JAVAX_WEBSOCKET"/' \
graphql-java-servlet/build.gradle
# Final check if there are something else to replace
grep -rl 'jakarta' ./graphql-java-servlet | xargs sed -i 's/jakarta/javax/g'
# Set the version 5 for spring framework
sed -i \
's/org.springframework:spring-test.*/org.springframework:spring-test:$LIB_SPRINGFRAMEWORK_5"/' \
graphql-java-servlet/build.gradle
sed -i \
's/org.springframework:spring-web.*/org.springframework:spring-web:$LIB_SPRINGFRAMEWORK_5"/' \
graphql-java-servlet/build.gradle
echo "Replaced jakarta occurrences with javax"
================================================
FILE: .github/tag-release.sh
================================================
#!/bin/bash
set -ev
getVersion() {
./gradlew properties -q | grep -E "^version" | awk '{print $2}' | tr -d '[:space:]'
}
removeSnapshots() {
sed -i 's/-SNAPSHOT//' gradle.properties
}
commitRelease() {
local APP_VERSION
APP_VERSION=$(getVersion)
git commit -a -m "Update version for release"
git tag -a "v${APP_VERSION}" -m "Tag release version"
}
bumpVersion() {
echo "Bump version number"
local APP_VERSION
APP_VERSION=$(getVersion | xargs)
local SEMANTIC_REGEX='^([0-9]+)\.([0-9]+)(\.([0-9]+))?$'
if [[ ${APP_VERSION} =~ ${SEMANTIC_REGEX} ]]; then
if [[ ${BASH_REMATCH[4]} ]]; then
nextVersion=$((BASH_REMATCH[4] + 1))
nextVersion="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${nextVersion}-SNAPSHOT"
else
nextVersion=$((BASH_REMATCH[2] + 1))
nextVersion="${BASH_REMATCH[1]}.${nextVersion}-SNAPSHOT"
fi
echo "Next version: ${nextVersion}"
sed -i -E "s/^version(\s)?=.*/version=${nextVersion}/" gradle.properties
git commit -a -m "Bumped version for next release"
else
echo "No semantic version and therefore cannot publish to maven repository: '${APP_VERSION}'"
fi
}
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
echo "Deploying release to Maven Central"
removeSnapshots
commitRelease
bumpVersion
git push --follow-tags
================================================
FILE: .github/workflows/pull-request.yml
================================================
name: "Pull request"
on:
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
validation:
name: Gradle Wrapper Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
test:
name: Test run
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
java: [ 17, 19 ]
needs: validation
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: ${{ matrix.java }}
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Make gradlew executable (non-Windows only)
if: matrix.os != 'windows-latest'
run: chmod +x ./gradlew
- name: Gradle Check (non-Windows)
if: matrix.os != 'windows-latest'
run: ./gradlew --info check
- name: Gradle Check (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: gradlew --info check
build:
name: Sonar analysis
needs: validation
runs-on: ubuntu-latest
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/checkout@v4
if: env.SONAR_TOKEN != null
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
if: env.SONAR_TOKEN != null
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Cache SonarCloud packages
if: env.SONAR_TOKEN != null
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
if: env.SONAR_TOKEN != null
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build and analyze
if: env.SONAR_TOKEN != null
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build jacocoTestReport sonarqube --info
================================================
FILE: .github/workflows/release.yml
================================================
name: "Publish release"
on: [ workflow_dispatch ]
jobs:
validation:
name: Gradle Wrapper Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
test-jakarta:
name: Test run jakarta
needs: validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 17
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Gradle Check
run: ./gradlew --info check
build-jakarta:
name: Publish release jakarta
needs: test-jakarta
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 17
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Prepare environment
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.GPG_SIGNING_SECRET_KEY_RING_FILE }}
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
- name: Publish release
env:
SIGNING_KEY_ID: ${{ secrets.GPG_SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.GPG_SIGNING_SECRET_KEY_RING_FILE }}
OSS_USER_TOKEN_KEY: ${{ secrets.OSS_USER_TOKEN_KEY }}
OSS_USER_TOKEN_PASS: ${{ secrets.OSS_USER_TOKEN_PASS }}
run: .github/release.sh
test-javax:
name: Test run javax
needs: validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 11
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Replace jakarta with javax
run: .github/replaceJakartaWithJavax.sh
- name: Gradle Check
run: ./gradlew --info check
build-javax:
name: Publish release javax
needs: test-javax
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 11
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Prepare environment
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.GPG_SIGNING_SECRET_KEY_RING_FILE }}
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
- name: Replace jakarta with javax
run: .github/replaceJakartaWithJavax.sh
- name: Publish release
env:
SIGNING_KEY_ID: ${{ secrets.GPG_SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.GPG_SIGNING_SECRET_KEY_RING_FILE }}
OSS_USER_TOKEN_KEY: ${{ secrets.OSS_USER_TOKEN_KEY }}
OSS_USER_TOKEN_PASS: ${{ secrets.OSS_USER_TOKEN_PASS }}
run: .github/release.sh javax
tag:
name: Tag release
needs: [ build-jakarta, build-javax ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 17
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Tag release
run: .github/tag-release.sh
================================================
FILE: .github/workflows/snapshot.yml
================================================
name: "Publish snapshot"
on:
push:
branches:
- master
jobs:
validation:
name: Gradle Wrapper Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
test-jakarta:
name: Test run jakarta
needs: validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 17
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Gradle Check
run: ./gradlew --info check
build-jakarta:
name: Publish snapshot jakarta
needs: test-jakarta
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 17
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Gradle Publish Snapshot
if: env.OSS_USER_TOKEN_KEY != null
env:
OSS_USER_TOKEN_KEY: ${{ secrets.OSS_USER_TOKEN_KEY }}
OSS_USER_TOKEN_PASS: ${{ secrets.OSS_USER_TOKEN_PASS }}
run: ./gradlew clean build publish -x test
test-javax:
name: Test run javax
needs: validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 11
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Replace jakarta with javax
run: .github/replaceJakartaWithJavax.sh
- name: Gradle Check
run: ./gradlew --info check
build-javax:
name: Publish snapshot javax
needs: test-javax
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
- name: Cache Gradle
uses: actions/cache@v4
env:
java-version: 11
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-${{ env.java-version }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Replace jakarta with javax
run: .github/replaceJakartaWithJavax.sh
- name: Add suffix to modules
run: .github/add-javax-suffix.sh
- name: Gradle Publish Snapshot
if: env.OSS_USER_TOKEN_KEY != null
env:
OSS_USER_TOKEN_KEY: ${{ secrets.OSS_USER_TOKEN_KEY }}
OSS_USER_TOKEN_PASS: ${{ secrets.OSS_USER_TOKEN_PASS }}
run: ./gradlew clean build publish -x test
sonar:
name: Sonar analysis
needs: validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: env.SONAR_TOKEN != null
run: ./gradlew build jacocoTestReport sonarqube --info
================================================
FILE: .gitignore
================================================
.gradle/
build/
*.iml
*.ipr
*.iws
.idea/*
!.idea/codeStyles/
target/
/out/
.classpath
.project
.settings
bin
.DS_Store
/**/out/
/projectFilesBackup/.idea/workspace.xml
================================================
FILE: CONTRIBUTING.md
================================================
# How to contribute
We're really glad you're reading this, because we need more volunteer developers
to help with this project!
We can use all the help we can get on all our [GraphQL Java Kickstart](https://github.com/graphql-java-kickstart)
projects. This work ranges from adding new features, fixing bugs, and answering questions to writing documentation.
## Answering questions and writing documentation
A lot of the questions asked on Spectrum or Github are caused by a lack of documentation.
We should strive from now on to answer questions by adding content to
our [documentation](https://github.com/graphql-java-kickstart/documentation) and referring
them to the newly created content.
Continuous integration will make sure that the changes are automatically deployed to
https://www.graphql-java-kickstart.com.
## Submitting changes
Please send a Pull Request with a clear list of what you've done using the
[Github flow](https://guides.github.com/introduction/flow/). We can always use more
test coverage, so we'd love to see that in the pull requests too. And make sure to
follow our coding conventions (below) and make sure all your commits are atomic
(one feature per commit).
## Coding conventions
We use Google Style guides for our projects. See the
[Java Style Guide](https://google.github.io/styleguide/javaguide.html) for a detailed
description. You can download the
[IntelliJ Java Google Style](https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml)
to import in these settings in IntelliJ.
These conventions are checked during the build phase. If the build fails because
the code is not using the correct style you can fix this easily by running a gradle task
```bash
./gradlew googleJavaFormat
```
### SonarLint
It would also be very helpful to install the SonarLint plugin in your IDE and fix any
relevant SonarLint issues before pushing a PR. We're aware that the current state
of the code raises a lot of SonarLint issues out of the box, but any help in reducing
that is appreciated. More importantly we don't increase that technical debt.
================================================
FILE: LICENSE
================================================
Copyright 2016 Yurii Rashkovskii and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
================================================
FILE: README.md
================================================
# GraphQL Java Servlet
[](https://maven-badges.herokuapp.com/maven-central/com.graphql-java-kickstart/graphql-java-servlet)
[](https://github.com/graphql-java-kickstart/graphql-java-servlet/actions?query=workflow%3A%22Publish+snapshot%22)
[](https://sonarcloud.io/dashboard?id=graphql-java-kickstart_graphql-java-servlet)
[](https://github.com/graphql-java-kickstart/graphql-java-servlet/graphs/contributors)
[](https://github.com/graphql-java-kickstart/graphql-java-servlet/discussions)
## We are looking for contributors!
Are you interested in improving our documentation, working on the codebase, reviewing PRs?
[Reach out to us on Discussions](https://github.com/graphql-java-kickstart/graphql-java-servlet/discussions) and join the team!
We hope you'll get involved! Read our [Contributors' Guide](CONTRIBUTING.md) for more details.
## Overview
Implementation of GraphQL Java Servlet including support for Relay.js, Apollo and OSGi out of the box.
This project wraps the Java implementation of GraphQL provided by [GraphQL Java](https://www.graphql-java.com).
See [GraphQL Java documentation](https://www.graphql-java.com/documentation/latest/) for more in depth details
regarding GraphQL Java itself.
We try to stay up to date with GraphQL Java as much as possible maintaining the retro-compatibility
with javax and Springframework 5.
On each release we publish three flavours of this project:
- [latest jakarta](#jakarta-and-springframework-6)
- [jakarta5](#jakarta5)
- [javax](#javax-and-springframework-5)
All of them also supports legacy projects that can compile with older JDK versions: the minimum JDK
version supported is the `11`.
## Jakarta and Springframework 6.*
This is the main flavour using the latest version of `Jakarta` (currently the `6.*`) and the latest
version of `Springframework` (currently the `6.*`). All the codebase can be found in the branch:
`master`
```xml
com.graphql-java-kickstart
graphql-java-servlet
${graphql-java-servlet.version}
```
## Jakarta5
This flavour use the `jakarta` version `5.*` and it is meant to be used for all the projects that
are already migrated to jakarta, but they are waiting that `jakarta6` will become more broadly used.
All the codebase can be found in the branch: `jakarta5`
```xml
com.graphql-java-kickstart
graphql-java-servlet-jakarta5
${graphql-java-servlet-jakarta5.version}
```
## Javax and Springframework 5.*
This is the legacy flavour using the `javax` dependency and the version `5.*` of `Springframework`
(since it is still broadly used by a lot of projects). All the codebase can be found in the branch:
`master`
```xml
com.graphql-java-kickstart
graphql-java-servlet-javax
${graphql-java-servlet.version}
```
## Installation and getting started
See [Getting started](https://graphql-java-kickstart.github.io/servlet/getting-started/) for more
detailed instructions.
================================================
FILE: build.gradle
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 oEmbedler Inc. and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://repo.spring.io/plugins-release' }
}
}
plugins {
id "biz.aQute.bnd.builder" version "6.4.0" apply false
id "org.sonarqube" version "5.1.0.4882"
id "jacoco"
id "io.github.gradle-nexus.publish-plugin" version '2.0.0'
}
sonarqube {
properties {
property "sonar.projectKey", "graphql-java-kickstart_graphql-java-servlet"
property "sonar.organization", "graphql-java-kickstart"
property "sonar.host.url", "https://sonarcloud.io"
}
}
subprojects {
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'org.sonarqube'
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'signing'
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://repo.spring.io/libs-milestone" }
}
dependencies {
compileOnly "org.projectlombok:lombok:$LIB_LOMBOK_VER"
annotationProcessor "org.projectlombok:lombok:$LIB_LOMBOK_VER"
testCompileOnly "org.projectlombok:lombok:$LIB_LOMBOK_VER"
testAnnotationProcessor "org.projectlombok:lombok:$LIB_LOMBOK_VER"
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
compileJava {
sourceCompatibility = SOURCE_COMPATIBILITY
targetCompatibility = TARGET_COMPATIBILITY
}
compileTestJava {
sourceCompatibility = SOURCE_COMPATIBILITY_TEST
targetCompatibility = TARGET_COMPATIBILITY_TEST
}
compileJava.dependsOn(processResources)
test {
useJUnitPlatform()
afterSuite { desc, result ->
if (!desc.parent) {
if (result.testCount == 0) {
throw new IllegalStateException("No tests were found. Failing the build")
}
}
}
}
jacocoTestReport {
reports {
xml.required = true
html.required = false
csv.required = false
}
}
if (!it.name.startsWith('example')) {
jar {
from "LICENSE.md"
}
java {
withSourcesJar()
withJavadocJar()
}
if (!version.toString().endsWith('-SNAPSHOT')) {
ext["signing.keyId"] = System.env.SIGNING_KEY_ID
ext["signing.password"] = System.env.SIGNING_PASSWORD
ext["signing.secretKeyRingFile"] = System.env.SIGNING_SECRET_KEY_RING_FILE
signing {
sign publishing.publications
}
}
publishing {
publications {
mavenJava(MavenPublication) {
version version
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = PROJECT_NAME
description = 'relay.js-compatible GraphQL servlet'
url = 'https://github.com/graphql-java-kickstart/graphql-java-servlet'
inceptionYear = '2016'
scm {
url = 'https://github.com/graphql-java-kickstart/graphql-java-servlet'
connection = 'scm:https://github.com/graphql-java-kickstart/graphql-java-servlet.git'
developerConnection = 'scm:git://github.com/graphql-java-kickstart/graphql-java-servlet.git'
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'oliemansm'
name = 'Michiel Oliemans'
}
developer {
id = 'yrashk'
name = 'Yurii Rashkovskii'
email = 'yrashk@gmail.com'
}
developer {
id = 'apottere'
name = 'Andrew Potter'
email = 'apottere@gmail.com'
}
}
}
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
username = System.env.OSS_USER_TOKEN_KEY ?: project.findProperty('OSS_USER_TOKEN_KEY') ?: ''
password = System.env.OSS_USER_TOKEN_PASS ?: project.findProperty('OSS_USER_TOKEN_PASS') ?: ''
}
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
================================================
FILE: examples/osgi/apache-karaf-feature/pom.xml
================================================
graphql-java-servlet-osgi-examples-karaf-feature
karaf-maven-plugin
true
true
80
true
org.apache.karaf.tooling
4.2.10
maven-install-plugin
org.apache.maven.plugins
2.5.2
maven-deploy-plugin
org.apache.maven.plugins
2.8.2
jackson-core
com.fasterxml.jackson.core
${jackson.version}
jackson-annotations
com.fasterxml.jackson.core
${jackson.version}
jackson-databind
com.fasterxml.jackson.core
${jackson.version}
jackson-datatype-jdk8
com.fasterxml.jackson.datatype
${jackson.version}
guava
com.google.guava
[24.1.1,)
commons-fileupload
commons-fileupload
[1.3.3,)
antlr4-runtime
org.antlr
4.7.1
graphql-java-servlet
com.graphql-java-kickstart
${graphql.java.servlet.version}
graphql-java
com.graphql-java
${graphql.java.version}
graphql-java-annotations
com.graphql-java
0.13.1
graphql-java-servlet-osgi-examples-providers
com.graphql-java-kickstart
${project.version}
slf4j-api
org.slf4j
1.7.25
slf4j-log4j12
org.slf4j
1.7.25
4.0.0
feature
graphql-java-servlet-osgi-examples
com.graphql-java-kickstart
10.1.0
2.13.4.2
================================================
FILE: examples/osgi/apache-karaf-feature/src/main/feature/feature.xml
================================================
scr
war
http
================================================
FILE: examples/osgi/apache-karaf-package/pom.xml
================================================
graphql-java-servlet-osgi-examples-apache-karaf-package
maven-resources-plugin
resources
process-resources
org.apache.maven.plugins
2.6
karaf-maven-plugin
minimal
wrapper
graphql-java-servlet-osgi-examples-karaf-feature
true
org.apache.karaf.tooling
${karaf.version}
maven-install-plugin
org.apache.maven.plugins
2.5.2
maven-deploy-plugin
org.apache.maven.plugins
2.8.2
src/main/resources
false
**/*
src/main/filtered-resources
true
**/*
framework
org.apache.karaf.features
kar
${karaf.version}
standard
features
org.apache.karaf.features
runtime
xml
${karaf.version}
enterprise
features
org.apache.karaf.features
runtime
xml
${karaf.version}
graphql-java-servlet-osgi-examples-karaf-feature
features
com.graphql-java-kickstart
runtime
xml
${project.version}
4.0.0
karaf-assembly
graphql-java-servlet-osgi-examples
com.graphql-java-kickstart
10.1.0
================================================
FILE: examples/osgi/buildAndRun.sh
================================================
#!/usr/bin/env bash
mvn clean install
pushd apache-karaf-package/target || exit 1
tar zxvf graphql-java-servlet-osgi-examples-apache-karaf-package-10.1.0.tar.gz
cd graphql-java-servlet-osgi-examples-apache-karaf-package-10.1.0/bin || exit 1
./karaf debug
popd || exit 1
================================================
FILE: examples/osgi/pom.xml
================================================
graphql-java-servlet-osgi-examples
com.graphql-java-kickstart
4.0.0
providers
apache-karaf-feature
apache-karaf-package
pom
11.0.0-SNAPSHOT
16.1
4.2.10
11
11
10.1.0
================================================
FILE: examples/osgi/providers/pom.xml
================================================
graphql-java-servlet-osgi-examples-providers
maven-bundle-plugin
true
org.apache.felix
3.3.0
graphql-java-servlet
com.graphql-java-kickstart
provided
${graphql.java.servlet.version}
graphql-java
com.graphql-java
provided
${graphql.java.version}
osgi.enterprise
org.osgi
provided
6.0.0
org.apache.felix.scr.ds-annotations
org.apache.felix
provided
1.2.4
4.0.0
bundle
graphql-java-servlet-osgi-examples
com.graphql-java-kickstart
10.1.0
================================================
FILE: examples/osgi/providers/src/main/java/graphql/servlet/examples/osgi/ExampleGraphQLProvider.java
================================================
package graphql.servlet.examples.osgi;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLType;
import graphql.kickstart.servlet.osgi.GraphQLMutationProvider;
import graphql.kickstart.servlet.osgi.GraphQLQueryProvider;
import graphql.kickstart.servlet.osgi.GraphQLTypesProvider;
import org.osgi.service.component.annotations.Component;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static graphql.Scalars.GraphQLString;
import static graphql.schema.GraphQLFieldDefinition.*;
@Component(
name = "ExampleGraphQLProvider",
immediate = true
)
public class ExampleGraphQLProvider implements GraphQLQueryProvider, GraphQLMutationProvider,
GraphQLTypesProvider {
public Collection getQueries() {
List fieldDefinitions = new ArrayList();
fieldDefinitions.add(newFieldDefinition()
.type(GraphQLString)
.name("hello")
.description(
"Basic example of a GraphQL Java Servlet provider using the Apache Karaf OSGi Runtime")
.staticValue("world")
.build());
return fieldDefinitions;
}
public Collection getMutations() {
return new ArrayList();
}
public Collection getTypes() {
return new ArrayList();
}
}
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
================================================
FILE: gradle.properties
================================================
version=16.0.0
group=com.graphql-java-kickstart
PROJECT_NAME=graphql-java-servlet
PROJECT_DESC=GraphQL Java Kickstart
PROJECT_GIT_REPO_URL=https://github.com/graphql-java-kickstart/graphql-java-servlet
PROJECT_LICENSE=MIT
PROJECT_LICENSE_URL=https://github.com/graphql-java-kickstart/spring-java-servlet/blob/master/LICENSE.md
PROJECT_DEV_ID=oliemansm
PROJECT_DEV_NAME=Michiel Oliemans
LIB_GRAPHQL_JAVA_VER=22.3
LIB_JACKSON_VER=2.17.2
LIB_SLF4J_VER=2.0.16
LIB_LOMBOK_VER=1.18.34
# These constants are necessary to the automatic release of javax flavour
LIB_JAVAX_SERVLET=4.0.1
LIB_JAVAX_WEBSOCKET=1.1
LIB_SPRINGFRAMEWORK_5=5.3.25
SOURCE_COMPATIBILITY=11
TARGET_COMPATIBILITY=11
SOURCE_COMPATIBILITY_TEST=17
TARGET_COMPATIBILITY_TEST=17
================================================
FILE: gradlew
================================================
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
================================================
FILE: gradlew.bat
================================================
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: graphql-java-kickstart/bnd.bnd
================================================
Export-Package: graphql.kickstart.*
Import-Package: !lombok,*
================================================
FILE: graphql-java-kickstart/build.gradle
================================================
apply plugin: 'biz.aQute.bnd.builder'
jar {
bndfile = 'bnd.bnd'
}
apply plugin: 'java-library-distribution'
dependencies {
// GraphQL
api "com.graphql-java:graphql-java:$LIB_GRAPHQL_JAVA_VER"
implementation "org.slf4j:slf4j-api:$LIB_SLF4J_VER"
// JSON
api "com.fasterxml.jackson.core:jackson-core:$LIB_JACKSON_VER"
api "com.fasterxml.jackson.core:jackson-annotations:$LIB_JACKSON_VER"
api "com.fasterxml.jackson.core:jackson-databind:2.17.2"
api "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$LIB_JACKSON_VER"
}
================================================
FILE: graphql-java-kickstart/src/main/java/graphql/kickstart/execution/BatchedDataLoaderGraphQLBuilder.java
================================================
package graphql.kickstart.execution;
import graphql.GraphQL;
import graphql.kickstart.execution.config.GraphQLBuilder;
import graphql.kickstart.execution.input.GraphQLBatchedInvocationInput;
import graphql.kickstart.execution.input.GraphQLSingleInvocationInput;
public class BatchedDataLoaderGraphQLBuilder {
GraphQL newGraphQL(GraphQLBatchedInvocationInput invocationInput, GraphQLBuilder graphQLBuilder) {
return invocationInput.getInvocationInputs().stream()
.findFirst()
.map(GraphQLSingleInvocationInput::getSchema)
.map(schema -> graphQLBuilder.build(schema, graphQLBuilder.getInstrumentationSupplier()))
.orElseThrow(
() ->
new IllegalArgumentException(
"Batched invocation input must contain at least one query"));
}
}
================================================
FILE: graphql-java-kickstart/src/main/java/graphql/kickstart/execution/DecoratedExecutionResult.java
================================================
package graphql.kickstart.execution;
import graphql.ExecutionResult;
import graphql.GraphQLError;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.reactivestreams.Publisher;
@RequiredArgsConstructor
class DecoratedExecutionResult implements ExecutionResult {
private final ExecutionResult result;
boolean isAsynchronous() {
return result.getData() instanceof Publisher;
}
@Override
public List getErrors() {
return result.getErrors();
}
@Override
public T getData() {
return result.getData();
}
@Override
public boolean isDataPresent() {
return result.isDataPresent();
}
@Override
public Map