Skip to content

Commit 529f5cd

Browse files
committed
Reformat all files
Using the newly set up code formatting infrastructure
1 parent 5b50528 commit 529f5cd

File tree

424 files changed

+29108
-29566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

424 files changed

+29108
-29566
lines changed

backend/backend/src/main/java/de/aaaaaaah/velcom/backend/GlobalConfig.java

Lines changed: 225 additions & 228 deletions
Large diffs are not rendered by default.

backend/backend/src/main/java/de/aaaaaaah/velcom/backend/KnownHostsIgnoringSshdFactory.java

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,31 @@
1111
import org.eclipse.jgit.transport.sshd.ServerKeyDatabase;
1212
import org.eclipse.jgit.transport.sshd.SshdSessionFactory;
1313

14-
/**
15-
* A {@link SshdSessionFactory} that ignores server keys.
16-
*/
14+
/** A {@link SshdSessionFactory} that ignores server keys. */
1715
public class KnownHostsIgnoringSshdFactory extends SshdSessionFactory {
1816

19-
public KnownHostsIgnoringSshdFactory(KeyCache keyCache, ProxyDataFactory proxies) {
20-
super(keyCache, proxies);
21-
}
17+
public KnownHostsIgnoringSshdFactory(KeyCache keyCache, ProxyDataFactory proxies) {
18+
super(keyCache, proxies);
19+
}
2220

23-
@Override
24-
protected ServerKeyDatabase getServerKeyDatabase(File homeDir, File sshDir) {
25-
return new ServerKeyDatabase() {
26-
@Override
27-
public List<PublicKey> lookup(String connectAddress, InetSocketAddress remoteAddress,
28-
Configuration config) {
29-
return Collections.emptyList();
30-
}
21+
@Override
22+
protected ServerKeyDatabase getServerKeyDatabase(File homeDir, File sshDir) {
23+
return new ServerKeyDatabase() {
24+
@Override
25+
public List<PublicKey> lookup(
26+
String connectAddress, InetSocketAddress remoteAddress, Configuration config) {
27+
return Collections.emptyList();
28+
}
3129

32-
@Override
33-
public boolean accept(String connectAddress, InetSocketAddress remoteAddress,
34-
PublicKey serverKey, Configuration config, CredentialsProvider provider) {
35-
return true;
36-
}
37-
};
38-
}
30+
@Override
31+
public boolean accept(
32+
String connectAddress,
33+
InetSocketAddress remoteAddress,
34+
PublicKey serverKey,
35+
Configuration config,
36+
CredentialsProvider provider) {
37+
return true;
38+
}
39+
};
40+
}
3941
}

backend/backend/src/main/java/de/aaaaaaah/velcom/backend/RunnerAwareServerFactory.java

Lines changed: 135 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -24,141 +24,139 @@
2424
*/
2525
public class RunnerAwareServerFactory implements ServerFactory {
2626

27-
private static final Logger LOGGER = LoggerFactory.getLogger(RunnerAwareServerFactory.class);
28-
29-
private static final RunnerAwareServerFactory instance = new RunnerAwareServerFactory();
30-
31-
private ServerFactory underlying;
32-
private GlobalConfig config;
33-
private Dispatcher dispatcher;
34-
private BenchRepo benchRepo;
35-
private final Serializer serializer;
36-
37-
private RunnerAwareServerFactory() {
38-
this.serializer = new Serializer();
39-
}
40-
41-
@Override
42-
public Server build(Environment environment) {
43-
ensureIsInitialized();
44-
45-
Server server = underlying.build(environment);
46-
47-
HttpConnectorFactory connectorFactory = new HttpConnectorFactory();
48-
connectorFactory.setPort(config.getRunnerPort());
49-
Connector connector = connectorFactory
50-
.build(server, environment.metrics(), "Runner", new ExecutorThreadPool(32));
51-
server.addConnector(
52-
connector
53-
);
54-
Map<Connector, Handler> handlerMap = new HashMap<>();
55-
56-
for (Connector serverConnector : server.getConnectors()) {
57-
handlerMap.put(serverConnector, server.getHandler());
58-
}
59-
60-
MutableServletContextHandler handler = new MutableServletContextHandler();
61-
handler.getServletContext().addServlet(
62-
"Runner Websocket servlet",
63-
new ServerMasterWebsocketServlet(dispatcher, serializer, config.getRunnerToken(), benchRepo)
64-
)
65-
.addMapping("/runner-connector");
66-
handlerMap.put(connector, handler);
67-
68-
server.setHandler(new RoutingHandler(handlerMap));
69-
70-
LOGGER.debug("Registered the websocket servlet");
71-
72-
return server;
73-
}
74-
75-
@Override
76-
public void configure(Environment environment) {
77-
underlying.configure(environment);
78-
}
79-
80-
81-
/**
82-
* Sets the config to use.
83-
*
84-
* @param config the config to use
85-
* @throws IllegalStateException if a config has already been set
86-
*/
87-
public void setConfig(GlobalConfig config) {
88-
if (this.config != null) {
89-
throw new IllegalStateException("I already have a config!");
90-
}
91-
this.config = config;
92-
}
93-
94-
/**
95-
* Sets the server factory to delegate to.
96-
*
97-
* @param underlying the underlying server factory
98-
* @throws IllegalStateException if a server factory has already been set
99-
*/
100-
public void setServerFactory(ServerFactory underlying) {
101-
if (this.underlying != null) {
102-
throw new IllegalStateException("I already have a server factory!");
103-
}
104-
105-
this.underlying = underlying;
106-
}
107-
108-
/**
109-
* Sets the dispatcher to use.
110-
*
111-
* @param dispatcher the dispatcher
112-
* @throws IllegalStateException if a dispatcher has already been set
113-
*/
114-
public void setDispatcher(Dispatcher dispatcher) {
115-
if (this.dispatcher != null) {
116-
throw new IllegalStateException("I already have a dispatcher!");
117-
}
118-
this.dispatcher = dispatcher;
119-
}
120-
121-
/**
122-
* Sets the bench reo to use.
123-
*
124-
* @param benchRepo the bench repo
125-
* @throws IllegalStateException if a bench repo has already been set
126-
*/
127-
public void setBenchRepo(BenchRepo benchRepo) {
128-
if (this.benchRepo != null) {
129-
throw new IllegalStateException("I already have a bench repo!");
130-
}
131-
this.benchRepo = benchRepo;
132-
}
133-
134-
/**
135-
* Returns whether the factory lacks an underlying server factory.
136-
*
137-
* @return true if no underlying server factory is available
138-
*/
139-
public boolean lacksFactory() {
140-
return underlying == null;
141-
}
142-
143-
private void ensureIsInitialized() {
144-
if (config == null) {
145-
throw new IllegalStateException("Config not initialized");
146-
}
147-
if (underlying == null) {
148-
throw new IllegalStateException("Server factory not initialized");
149-
}
150-
if (dispatcher == null) {
151-
throw new IllegalStateException("Dispatcher not initialized");
152-
}
153-
}
154-
155-
156-
/**
157-
* Returns the instance of the {@link RunnerAwareServerFactory}.
158-
*
159-
* @return the instance
160-
*/
161-
public static RunnerAwareServerFactory getInstance() {
162-
return instance;
163-
}
27+
private static final Logger LOGGER = LoggerFactory.getLogger(RunnerAwareServerFactory.class);
28+
29+
private static final RunnerAwareServerFactory instance = new RunnerAwareServerFactory();
30+
31+
private ServerFactory underlying;
32+
private GlobalConfig config;
33+
private Dispatcher dispatcher;
34+
private BenchRepo benchRepo;
35+
private final Serializer serializer;
36+
37+
private RunnerAwareServerFactory() {
38+
this.serializer = new Serializer();
39+
}
40+
41+
@Override
42+
public Server build(Environment environment) {
43+
ensureIsInitialized();
44+
45+
Server server = underlying.build(environment);
46+
47+
HttpConnectorFactory connectorFactory = new HttpConnectorFactory();
48+
connectorFactory.setPort(config.getRunnerPort());
49+
Connector connector =
50+
connectorFactory.build(server, environment.metrics(), "Runner", new ExecutorThreadPool(32));
51+
server.addConnector(connector);
52+
Map<Connector, Handler> handlerMap = new HashMap<>();
53+
54+
for (Connector serverConnector : server.getConnectors()) {
55+
handlerMap.put(serverConnector, server.getHandler());
56+
}
57+
58+
MutableServletContextHandler handler = new MutableServletContextHandler();
59+
handler
60+
.getServletContext()
61+
.addServlet(
62+
"Runner Websocket servlet",
63+
new ServerMasterWebsocketServlet(
64+
dispatcher, serializer, config.getRunnerToken(), benchRepo))
65+
.addMapping("/runner-connector");
66+
handlerMap.put(connector, handler);
67+
68+
server.setHandler(new RoutingHandler(handlerMap));
69+
70+
LOGGER.debug("Registered the websocket servlet");
71+
72+
return server;
73+
}
74+
75+
@Override
76+
public void configure(Environment environment) {
77+
underlying.configure(environment);
78+
}
79+
80+
/**
81+
* Sets the config to use.
82+
*
83+
* @param config the config to use
84+
* @throws IllegalStateException if a config has already been set
85+
*/
86+
public void setConfig(GlobalConfig config) {
87+
if (this.config != null) {
88+
throw new IllegalStateException("I already have a config!");
89+
}
90+
this.config = config;
91+
}
92+
93+
/**
94+
* Sets the server factory to delegate to.
95+
*
96+
* @param underlying the underlying server factory
97+
* @throws IllegalStateException if a server factory has already been set
98+
*/
99+
public void setServerFactory(ServerFactory underlying) {
100+
if (this.underlying != null) {
101+
throw new IllegalStateException("I already have a server factory!");
102+
}
103+
104+
this.underlying = underlying;
105+
}
106+
107+
/**
108+
* Sets the dispatcher to use.
109+
*
110+
* @param dispatcher the dispatcher
111+
* @throws IllegalStateException if a dispatcher has already been set
112+
*/
113+
public void setDispatcher(Dispatcher dispatcher) {
114+
if (this.dispatcher != null) {
115+
throw new IllegalStateException("I already have a dispatcher!");
116+
}
117+
this.dispatcher = dispatcher;
118+
}
119+
120+
/**
121+
* Sets the bench reo to use.
122+
*
123+
* @param benchRepo the bench repo
124+
* @throws IllegalStateException if a bench repo has already been set
125+
*/
126+
public void setBenchRepo(BenchRepo benchRepo) {
127+
if (this.benchRepo != null) {
128+
throw new IllegalStateException("I already have a bench repo!");
129+
}
130+
this.benchRepo = benchRepo;
131+
}
132+
133+
/**
134+
* Returns whether the factory lacks an underlying server factory.
135+
*
136+
* @return true if no underlying server factory is available
137+
*/
138+
public boolean lacksFactory() {
139+
return underlying == null;
140+
}
141+
142+
private void ensureIsInitialized() {
143+
if (config == null) {
144+
throw new IllegalStateException("Config not initialized");
145+
}
146+
if (underlying == null) {
147+
throw new IllegalStateException("Server factory not initialized");
148+
}
149+
if (dispatcher == null) {
150+
throw new IllegalStateException("Dispatcher not initialized");
151+
}
152+
}
153+
154+
/**
155+
* Returns the instance of the {@link RunnerAwareServerFactory}.
156+
*
157+
* @return the instance
158+
*/
159+
public static RunnerAwareServerFactory getInstance() {
160+
return instance;
161+
}
164162
}

0 commit comments

Comments
 (0)