Skip to content

Commit

Permalink
Apply checkstyle in baseapp and proxyserver
Browse files Browse the repository at this point in the history
This is a pure reformat without behavior changes.
  • Loading branch information
ebyhr authored and mosabua committed Dec 21, 2023
1 parent 5848f1e commit 19ed81e
Show file tree
Hide file tree
Showing 14 changed files with 929 additions and 846 deletions.
4 changes: 4 additions & 0 deletions baseapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<artifactId>baseapp</artifactId>
<packaging>jar</packaging>

<properties>
<air.check.skip-checkstyle>false</air.check.skip-checkstyle>
</properties>

<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package io.trino.gateway.baseapp;

import io.dropwizard.core.Configuration;
import java.util.List;

public class AppConfiguration extends Configuration {
import java.util.List;

// List of Modules with FQCN (Fully Qualified Class Name)
private List<String> modules;
public class AppConfiguration
extends Configuration
{
// List of Modules with FQCN (Fully Qualified Class Name)
private List<String> modules;

// List of ManagedApps with FQCN (Fully Qualified Class Name)
private List<String> managedApps;
// List of ManagedApps with FQCN (Fully Qualified Class Name)
private List<String> managedApps;

public AppConfiguration()
{
Expand Down Expand Up @@ -42,29 +44,29 @@ public String toString()

public boolean equals(final Object o)
{
if (o == this) {
return true;
}
if (!(o instanceof AppConfiguration)) {
return false;
}
if (o == this) {
return true;
}
if (!(o instanceof AppConfiguration)) {
return false;
}
final AppConfiguration other = (AppConfiguration) o;
if (!other.canEqual((Object) this)) {
return false;
}
if (!super.equals(o)) {
return false;
}
final Object this$modules = this.getModules();
final Object other$modules = other.getModules();
if (this$modules == null ? other$modules != null : !this$modules.equals(other$modules)) {
return false;
}
final Object this$managedApps = this.getManagedApps();
final Object other$managedApps = other.getManagedApps();
if (this$managedApps == null ? other$managedApps != null : !this$managedApps.equals(other$managedApps)) {
return false;
}
if (!other.canEqual((Object) this)) {
return false;
}
if (!super.equals(o)) {
return false;
}
final Object thisModules = this.getModules();
final Object otherModules = other.getModules();
if (thisModules == null ? otherModules != null : !thisModules.equals(otherModules)) {
return false;
}
final Object thisManagedApps = this.getManagedApps();
final Object otherManagedApps = other.getManagedApps();
if (thisManagedApps == null ? otherManagedApps != null : !thisManagedApps.equals(otherManagedApps)) {
return false;
}
return true;
}

Expand All @@ -75,12 +77,12 @@ protected boolean canEqual(final Object other)

public int hashCode()
{
final int PRIME = 59;
final int prime = 59;
int result = super.hashCode();
final Object $modules = this.getModules();
result = result * PRIME + ($modules == null ? 43 : $modules.hashCode());
final Object $managedApps = this.getManagedApps();
result = result * PRIME + ($managedApps == null ? 43 : $managedApps.hashCode());
final Object modules = this.getModules();
result = result * prime + (modules == null ? 43 : modules.hashCode());
final Object managedApps = this.getManagedApps();
result = result * prime + (managedApps == null ? 43 : managedApps.hashCode());
return result;
}
}
78 changes: 41 additions & 37 deletions baseapp/src/main/java/io/trino/gateway/baseapp/AppModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,45 @@

import java.util.stream.Stream;

public abstract class AppModule<T extends AppConfiguration, E> extends AbstractModule {
private final T configuration;
private final E environment;

public AppModule(T config, E env) {
this.configuration = config;
this.environment = env;
}

@Override
protected void configure() {}

protected int getApplicationPort() {
Stream<ConnectorFactory> connectors =
configuration.getServerFactory() instanceof DefaultServerFactory
? ((DefaultServerFactory) configuration.getServerFactory())
.getApplicationConnectors().stream()
: Stream.of((SimpleServerFactory) configuration.getServerFactory())
.map(SimpleServerFactory::getConnector);

return connectors
.filter(connector -> connector.getClass().isAssignableFrom(HttpConnectorFactory.class))
.map(connector -> (HttpConnectorFactory) connector)
.mapToInt(HttpConnectorFactory::getPort)
.findFirst()
.orElseThrow(IllegalStateException::new);
}

public T getConfiguration()
{
return this.configuration;
}

public E getEnvironment()
{
return this.environment;
}
public abstract class AppModule<T extends AppConfiguration, E>
extends AbstractModule
{
private final T configuration;
private final E environment;

public AppModule(T config, E env)
{
this.configuration = config;
this.environment = env;
}

@Override
protected void configure() {}

protected int getApplicationPort()
{
Stream<ConnectorFactory> connectors =
configuration.getServerFactory() instanceof DefaultServerFactory
? ((DefaultServerFactory) configuration.getServerFactory())
.getApplicationConnectors().stream()
: Stream.of((SimpleServerFactory) configuration.getServerFactory())
.map(SimpleServerFactory::getConnector);

return connectors
.filter(connector -> connector.getClass().isAssignableFrom(HttpConnectorFactory.class))
.map(connector -> (HttpConnectorFactory) connector)
.mapToInt(HttpConnectorFactory::getPort)
.findFirst()
.orElseThrow(IllegalStateException::new);
}

public T getConfiguration()
{
return this.configuration;
}

public E getEnvironment()
{
return this.environment;
}
}
Loading

0 comments on commit 19ed81e

Please sign in to comment.