Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move classes from jdk package into core so that less need to be public #110

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions avaje-jex/src/main/java/io/avaje/jex/DJex.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import io.avaje.inject.BeanScope;
import io.avaje.jex.core.CoreServiceLoader;
import io.avaje.jex.core.CoreServiceManager;
import io.avaje.jex.core.HealthPlugin;
import io.avaje.jex.jdk.JdkServerStart;
import io.avaje.jex.core.JdkServerStart;
import io.avaje.jex.routes.RoutesBuilder;
import io.avaje.jex.routes.SpiRoutes;
import io.avaje.jex.spi.*;
Expand Down Expand Up @@ -121,6 +120,6 @@ public Server start() {
new RoutesBuilder(routing, config.ignoreTrailingSlashes())
.build();

return new JdkServerStart().start(this, routes, CoreServiceManager.create(this));
return new JdkServerStart().start(this, routes);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import java.io.IOException;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import java.util.ArrayList;
import java.util.LinkedHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,23 @@
import io.avaje.jex.Routing;
import io.avaje.jex.core.json.JacksonJsonService;
import io.avaje.jex.core.json.JsonbJsonService;
import io.avaje.jex.jdk.JdkContext;
import io.avaje.jex.spi.JsonService;
import io.avaje.jex.spi.TemplateRender;

/**
* Core implementation of SpiServiceManager provided to specific implementations like jetty etc.
*/
public final class CoreServiceManager implements SpiServiceManager {
final class CoreServiceManager implements SpiServiceManager {

private static final System.Logger log = AppLog.getLogger("io.avaje.jex");
public static final String UTF_8 = "UTF-8";
static final String UTF_8 = "UTF-8";

private final HttpMethodMap methodMap = new HttpMethodMap();
private final JsonService jsonService;
private final ExceptionManager exceptionHandler;
private final TemplateManager templateManager;

public static SpiServiceManager create(Jex jex) {
static SpiServiceManager create(Jex jex) {
return new Builder(jex).build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import java.io.InputStream;
import java.io.OutputStream;
Expand All @@ -9,9 +9,8 @@

import io.avaje.jex.Context;
import io.avaje.jex.Routing;
import io.avaje.jex.core.SpiServiceManager;

public final class CtxServiceManager implements SpiServiceManager {
final class CtxServiceManager implements SpiServiceManager {

private final String scheme;
private final String contextPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import io.avaje.jex.http.ErrorCode;
import io.avaje.jex.http.HttpResponseException;
import io.avaje.jex.http.InternalServerErrorException;
import io.avaje.jex.jdk.JdkContext;

public final class ExceptionManager {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import static io.avaje.jex.core.Constants.APPLICATION_JSON;
import static io.avaje.jex.core.Constants.APPLICATION_X_JSON_STREAM;
Expand Down Expand Up @@ -31,13 +31,12 @@
import io.avaje.jex.Context;
import io.avaje.jex.compression.CompressedOutputStream;
import io.avaje.jex.compression.CompressionConfig;
import io.avaje.jex.core.Constants;
import io.avaje.jex.http.ErrorCode;
import io.avaje.jex.http.RedirectException;
import io.avaje.jex.security.BasicAuthCredentials;
import io.avaje.jex.security.Role;

public final class JdkContext implements Context {
final class JdkContext implements Context {

private static final String UTF8 = "UTF8";
private static final int SC_MOVED_TEMPORARILY = 302;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import com.sun.net.httpserver.HttpServer;
import io.avaje.applog.AppLog;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import java.io.IOException;
import java.io.UncheckedIOException;
Expand All @@ -13,7 +13,6 @@
import io.avaje.jex.AppLifecycle;
import io.avaje.jex.Jex;
import io.avaje.jex.JexConfig;
import io.avaje.jex.core.SpiServiceManager;
import io.avaje.jex.routes.SpiRoutes;

import static java.lang.System.Logger.Level.INFO;
Expand All @@ -22,7 +21,8 @@ public final class JdkServerStart {

private static final System.Logger log = AppLog.getLogger("io.avaje.jex");

public Jex.Server start(Jex jex, SpiRoutes routes, SpiServiceManager serviceManager) {
public Jex.Server start(Jex jex, SpiRoutes routes) {
SpiServiceManager serviceManager = CoreServiceManager.create(jex);
try {
final var config = jex.config();
final var socketAddress = createSocketAddress(config);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

/** status of the request */
enum Mode {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import java.io.IOException;
import java.util.List;
Expand All @@ -14,7 +14,7 @@
import io.avaje.jex.http.NotFoundException;
import io.avaje.jex.routes.SpiRoutes;

public final class RoutingHandler implements HttpHandler {
final class RoutingHandler implements HttpHandler {

private final SpiRoutes routes;
private final CtxServiceManager mgr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

import io.avaje.jex.Context;
import io.avaje.jex.Routing;
import io.avaje.jex.jdk.CtxServiceManager;
import io.avaje.jex.jdk.JdkContext;

/**
* Core service methods available to Context implementations.
Expand Down
2 changes: 1 addition & 1 deletion avaje-jex/src/test/java/io/avaje/jex/StaticFileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.junit.jupiter.api.Test;

import io.avaje.jex.StaticContentConfig.ResourceLocation;
import io.avaje.jex.jdk.TestPair;
import io.avaje.jex.core.TestPair;

class StaticFileTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import io.avaje.jex.Jex;
import io.avaje.jex.StaticContentConfig.ResourceLocation;
import io.avaje.jex.core.Constants;
import io.avaje.jex.jdk.TestPair;
import io.avaje.jex.core.TestPair;

class CompressionTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Context;
import io.avaje.jex.Jex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import io.avaje.jex.http.ErrorCode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.http.client.HttpClient;
import io.avaje.http.client.JacksonBodyAdapter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.http.client.HttpClient;
import io.avaje.http.client.JacksonBodyAdapter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

public class HelloBean {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jsonb.Json;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import io.avaje.jex.core.HealthPlugin;

public class Main {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;

import java.net.http.HttpResponse;
import java.util.Map;
import java.util.UUID;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.jex.Jex;
import org.junit.jupiter.api.AfterAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.avaje.jex.jdk;
package io.avaje.jex.core;

import io.avaje.http.client.HttpClient;
import io.avaje.http.client.HttpClientRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/example-jdk-jsonb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To Run:
./target/mytest

# produces
# Oct 21, 2022 1:39:36 PM io.avaje.jex.jdk.JdkServerStart start
# Oct 21, 2022 1:39:36 PM io.avaje.jex.core.JdkServerStart start
# INFO: started server on port 7003 version 2.5-SNAPSHOT
```

Expand Down
Loading