Skip to content

Commit bf17540

Browse files
committed
GH-3673: Rework Fuseki start-up
1 parent f9b42ba commit bf17540

File tree

51 files changed

+1474
-899
lines changed

Some content is hidden

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

51 files changed

+1474
-899
lines changed

jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public class ARQConstants
9494
@Deprecated(forRemoval = true)
9595
public static final String CDTFunctionLibraryURI = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/" ;
9696

97-
9897
/** The ARQ function library URI space */
9998
public static final String ARQFunctionLibraryURI = "http://jena.apache.org/ARQ/function#" ;
10099

jena-cmds/src/main/java/org/apache/jena/cmd/TerminationException.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package org.apache.jena.cmd;
2020

21-
2221
/**
2322
* Exception used to indicate that the command should end now. Use instead of
2423
* System.exit so that a wrapper can catch (else a command server will exit wrongly).

jena-fuseki2/jena-fuseki-access/src/test/java/org/apache/jena/fuseki/access/TestSecurityFilterLocal.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ private static Stream<Arguments> provideArgs() {
6666

6767
List<Arguments> x = List.of
6868
(Arguments.of("TDB1/db", c1, true),
69-
Arguments.of("TDB2/db", c2, true),
70-
69+
Arguments.of("TDB2/db", c2, true),
7170
// By adding the general, but slower, DatasetGraphFilter
72-
Arguments.of("TDB/filtered", c1, false),
71+
Arguments.of("TDB1/filtered", c1, false),
7372
Arguments.of("TDB2/filtered", c2, false),
73+
7474
Arguments.of("TIM/filtered", c3, false),
7575
Arguments.of("Plain/filtered", c4, false)
7676
);

jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/cmds/Servlet404.java renamed to jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/Servlet404.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* SPDX-License-Identifier: Apache-2.0
1919
*/
2020

21-
package org.apache.jena.fuseki.main.cmds;
21+
package org.apache.jena.fuseki.servlets;
2222

2323
import java.io.IOException;
2424

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* SPDX-License-Identifier: Apache-2.0
19+
*/
20+
21+
package org.apache.jena.fuseki.main;
22+
23+
import org.apache.jena.fuseki.main.runner.FusekiArgs;
24+
import org.apache.jena.fuseki.main.runner.FusekiRunner;
25+
import org.apache.jena.fuseki.main.sys.FusekiModule;
26+
import org.apache.jena.fuseki.main.sys.FusekiModules;
27+
28+
/**
29+
* Programmatic ways to create a server builder using command line syntax.
30+
* <p>
31+
* This also has a convenience ways to run a server.
32+
* </p><p>
33+
* If used in testing, the following may be used:
34+
* <pre>
35+
* FusekiServer server = FusekiMain.runAync("--port=0", args);
36+
* String URL = server.serverURL();
37+
* // or server.getPort()
38+
* try {
39+
* ...
40+
* } finally { server.stop(); }
41+
* </pre>
42+
* Using port 0 causes the kernel to allocate a free port.
43+
* It is important for test to close servers promptly.
44+
*
45+
* @see FusekiRunner
46+
* @see FusekiServer
47+
*/
48+
public class FusekiMain {
49+
50+
/**
51+
* Build, but do not start, a server based on command line syntax.
52+
* @deprecated Use {@link #construct(String...)}
53+
*/
54+
@Deprecated(forRemoval = true)
55+
public static FusekiServer build(String... args) {
56+
return FusekiArgs.applyArgs(FusekiServer.create(), args).build();
57+
}
58+
59+
/**
60+
* Build, but do not start, a server based on command line syntax.
61+
*/
62+
public static FusekiServer construct(String... args) {
63+
return FusekiArgs.applyArgs(FusekiServer.create(), args).build();
64+
}
65+
66+
/**
67+
* Build, but do not start, a server based on modules and the command line syntax.
68+
*/
69+
public static FusekiServer construct(FusekiModules fusekiModules, String... args) {
70+
return FusekiArgs.applyArgs(FusekiServer.create(), fusekiModules, args).build();
71+
}
72+
73+
/**
74+
* Create a {@link org.apache.jena.fuseki.main.FusekiServer.Builder FusekiServer.Builder} which has
75+
* been setup according to the command line arguments.
76+
* The builder can be further modified.
77+
* @param args Command line syntax
78+
*/
79+
public static FusekiServer.Builder builder(String... args) {
80+
return builder(null, args);
81+
}
82+
83+
/**
84+
* Create a {@link org.apache.jena.fuseki.main.FusekiServer.Builder FusekiServer.Builder} which has
85+
* been setup according to the command line arguments.
86+
* The builder can be further modified.
87+
* @param fusekiModules {@link FusekiModule Fuseki modules} to include
88+
* @param args Command line syntax
89+
*/
90+
public static FusekiServer.Builder builder(FusekiModules fusekiModules, String... args) {
91+
FusekiServer.Builder builder = FusekiServer.create();
92+
FusekiArgs.applyArgs(builder, fusekiModules, args);
93+
return builder;
94+
}
95+
96+
/**
97+
* Run a server asynchronously based on the command line arguments.
98+
*/
99+
public static FusekiServer runAsync(String... args) {
100+
return construct(args).start();
101+
}
102+
103+
// /**
104+
// * Run a server synchronously, based on the command line arguments.
105+
// * This function does not return.
106+
// */
107+
// public static void run(String... args) {
108+
// build(args).start().join();
109+
// }
110+
}

jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiMainRunner.java

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)