-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: rxjava2 feature See micronaut-projects/micronaut-core#5976 See micronaut-projects/micronaut-core#5977 * Reorganize feature additions Co-authored-by: jameskleeh <james.kleeh@gmail.com>
- Loading branch information
1 parent
3e45d0a
commit 8ad12c2
Showing
10 changed files
with
474 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
starter-core/src/main/java/io/micronaut/starter/feature/reactor/ReactorHttpClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2017-2020 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. | ||
*/ | ||
package io.micronaut.starter.feature.reactor; | ||
|
||
import io.micronaut.core.annotation.NonNull; | ||
import io.micronaut.starter.application.ApplicationType; | ||
import io.micronaut.starter.application.generator.GeneratorContext; | ||
import io.micronaut.starter.build.dependencies.Dependency; | ||
import io.micronaut.starter.feature.Category; | ||
import io.micronaut.starter.feature.Feature; | ||
import jakarta.inject.Singleton; | ||
|
||
@Singleton | ||
public class ReactorHttpClient implements Feature { | ||
|
||
@Override | ||
public boolean supports(ApplicationType applicationType) { | ||
return true; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String getName() { | ||
return "reactor-http-client"; | ||
} | ||
|
||
@Override | ||
public boolean isVisible() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getCategory() { | ||
return Category.CLIENT; | ||
} | ||
|
||
@Override | ||
public void apply(GeneratorContext generatorContext) { | ||
generatorContext.addDependency(Dependency.builder() | ||
.groupId(Reactor.MICRONAUT_REACTOR_GROUP_ID) | ||
.artifactId("micronaut-reactor-http-client") | ||
.compile()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
starter-core/src/main/java/io/micronaut/starter/feature/rxjava/RxJavaThreeHttpClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2017-2020 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. | ||
*/ | ||
package io.micronaut.starter.feature.rxjava; | ||
|
||
import io.micronaut.core.annotation.NonNull; | ||
import io.micronaut.starter.application.ApplicationType; | ||
import io.micronaut.starter.application.generator.GeneratorContext; | ||
import io.micronaut.starter.build.dependencies.Dependency; | ||
import io.micronaut.starter.feature.Category; | ||
import io.micronaut.starter.feature.Feature; | ||
|
||
import jakarta.inject.Singleton; | ||
|
||
@Singleton | ||
public class RxJavaThreeHttpClient implements Feature { | ||
@Override | ||
public boolean supports(ApplicationType applicationType) { | ||
return true; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String getName() { | ||
return "rxjava3-http-client"; | ||
} | ||
|
||
@Override | ||
public boolean isVisible() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getCategory() { | ||
return Category.CLIENT; | ||
} | ||
|
||
@Override | ||
public void apply(GeneratorContext generatorContext) { | ||
generatorContext.addDependency(Dependency.builder() | ||
.groupId(RxJavaThree.MICRONAUT_RXJAVA3_GROUP_ID) | ||
.artifactId("micronaut-rxjava3-http-client") | ||
.compile()); | ||
} | ||
|
||
} |
91 changes: 91 additions & 0 deletions
91
starter-core/src/main/java/io/micronaut/starter/feature/rxjava/RxJavaTwo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright 2017-2020 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. | ||
*/ | ||
package io.micronaut.starter.feature.rxjava; | ||
|
||
import io.micronaut.core.annotation.NonNull; | ||
import io.micronaut.starter.application.ApplicationType; | ||
import io.micronaut.starter.application.generator.GeneratorContext; | ||
import io.micronaut.starter.build.dependencies.Dependency; | ||
import io.micronaut.starter.feature.Category; | ||
import io.micronaut.starter.feature.Feature; | ||
|
||
import io.micronaut.starter.feature.FeatureContext; | ||
import io.micronaut.starter.feature.other.HttpClient; | ||
import io.micronaut.starter.feature.server.Netty; | ||
import jakarta.inject.Singleton; | ||
|
||
@Singleton | ||
public class RxJavaTwo implements Feature { | ||
public static final String MICRONAUT_RXJAVA2_GROUP_ID = "io.micronaut.rxjava2"; | ||
|
||
private final RxJavaTwoHttpServerNetty rxJavaTwoHttpServerNetty; | ||
private final RxJavaTwoHttpClient rxJavaTwoHttpClient; | ||
|
||
public RxJavaTwo(RxJavaTwoHttpServerNetty rxJavaTwoHttpServerNetty, RxJavaTwoHttpClient rxJavaTwoHttpClient) { | ||
this.rxJavaTwoHttpServerNetty = rxJavaTwoHttpServerNetty; | ||
this.rxJavaTwoHttpClient = rxJavaTwoHttpClient; | ||
} | ||
|
||
@Override | ||
public boolean supports(ApplicationType applicationType) { | ||
return true; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String getName() { | ||
return "rxjava2"; | ||
} | ||
|
||
@Override | ||
public String getTitle() { | ||
return "RxJava 2"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Adds support for RxJava 2 to a Micronaut application; Converters and Instrumentation for RxJava 2 types, RxJava 2 compatible HTTP Client"; | ||
} | ||
|
||
@Override | ||
public String getCategory() { | ||
return Category.REACTIVE; | ||
} | ||
|
||
@Override | ||
public String getMicronautDocumentation() { | ||
return "https://micronaut-projects.github.io/micronaut-rxjava2/snapshot/guide/index.html"; | ||
} | ||
|
||
@Override | ||
public void processSelectedFeatures(FeatureContext featureContext) { | ||
if (featureContext.isPresent(Netty.class)) { | ||
featureContext.addFeature(rxJavaTwoHttpServerNetty); | ||
} | ||
if (featureContext.isPresent(HttpClient.class)) { | ||
featureContext.addFeature(rxJavaTwoHttpClient); | ||
} | ||
} | ||
|
||
@Override | ||
public void apply(GeneratorContext generatorContext) { | ||
generatorContext.addDependency(Dependency.builder() | ||
.groupId(MICRONAUT_RXJAVA2_GROUP_ID) | ||
.artifactId("micronaut-rxjava2") | ||
.compile()); | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
starter-core/src/main/java/io/micronaut/starter/feature/rxjava/RxJavaTwoHttpClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2017-2020 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. | ||
*/ | ||
package io.micronaut.starter.feature.rxjava; | ||
|
||
import io.micronaut.core.annotation.NonNull; | ||
import io.micronaut.starter.application.ApplicationType; | ||
import io.micronaut.starter.application.generator.GeneratorContext; | ||
import io.micronaut.starter.build.dependencies.Dependency; | ||
import io.micronaut.starter.feature.Category; | ||
import io.micronaut.starter.feature.Feature; | ||
|
||
import jakarta.inject.Singleton; | ||
|
||
@Singleton | ||
public class RxJavaTwoHttpClient implements Feature { | ||
@Override | ||
public boolean supports(ApplicationType applicationType) { | ||
return true; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String getName() { | ||
return "rxjava2-http-client"; | ||
} | ||
|
||
@Override | ||
public boolean isVisible() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getCategory() { | ||
return Category.CLIENT; | ||
} | ||
|
||
@Override | ||
public void apply(GeneratorContext generatorContext) { | ||
generatorContext.addDependency(Dependency.builder() | ||
.groupId(RxJavaTwo.MICRONAUT_RXJAVA2_GROUP_ID) | ||
.artifactId("micronaut-rxjava2-http-client") | ||
.compile()); | ||
} | ||
|
||
} |
Oops, something went wrong.