This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/jena.git
commit af87ae0720f21b2f0693b53ece3feb850f9af3c8 Author: Andy Seaborne <[email protected]> AuthorDate: Tue Jul 15 21:17:07 2025 +0100 Tidy code --- .../xsd/impl/XSDAbstractDateTimeType.java | 39 ++++++++++----------- .../apache/jena/fuseki/main/cmds/FusekiMain.java | 40 +++++++++++----------- .../apache/jena/fuseki/mod/FusekiServerRunner.java | 14 +++++--- .../java/org/apache/jena/shacl/test_vocab/SHT.java | 14 ++++---- 4 files changed, 56 insertions(+), 51 deletions(-) diff --git a/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XSDAbstractDateTimeType.java b/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XSDAbstractDateTimeType.java index af4b5e6a3e..8f9a4fedc3 100644 --- a/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XSDAbstractDateTimeType.java +++ b/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XSDAbstractDateTimeType.java @@ -35,35 +35,35 @@ public class XSDAbstractDateTimeType extends XSDDatatype { public XSDAbstractDateTimeType(String typename) { super(typename); } - + /** * Compares two instances of values of the given datatype. - * This ignores lang tags and just uses the java.lang.Number + * This ignores lang tags and just uses the java.lang.Number * equality. */ @Override public boolean isEqual(LiteralLabel value1, LiteralLabel value2) { return value1.getValue().equals(value2.getValue()); } - + /** Mask to indicate whether year is present */ public static final short YEAR_MASK = 0x1; - + /** Mask to indicate whether month is present */ public static final short MONTH_MASK = 0x2; - + /** Mask to indicate whether day is present */ public static final short DAY_MASK = 0x4; - + /** Mask to indicate whether time is present */ public static final short TIME_MASK = 0x8; - + /** Mask to indicate all date/time are present */ public static final short FULL_MASK = 0xf; - - + + // -------------------------------------------------------------------- -// This code is adapated from Xerces 2.6.0 AbstractDateTimeDV. +// This code is adapated from Xerces 2.6.0 AbstractDateTimeDV. // Copyright (c) 1999-2003 The Apache Software Foundation. All rights // reserved. // -------------------------------------------------------------------- @@ -71,7 +71,7 @@ public class XSDAbstractDateTimeType extends XSDDatatype { //define constants protected final static int CY = 0, M = 1, D = 2, h = 3, m = 4, s = 5, ms = 6, msscale=8, utc=7, hh=0, mm=1; - + //size for all objects must have the same fields: //CCYY, MM, DD, h, m, s, ms + timeZone protected final static int TOTAL_SIZE = 9; @@ -82,7 +82,6 @@ public class XSDAbstractDateTimeType extends XSDDatatype { protected final static int MONTH=01; protected final static int DAY = 15; - /** * Parses time hh:mm:ss.sss and time zone if any * @@ -117,7 +116,7 @@ public class XSDAbstractDateTimeType extends XSDDatatype { if (stop == end) return; - + //get miliseconds (ms) start = stop; int millisec = buffer.charAt(start) == '.' ? start : -1; @@ -284,7 +283,7 @@ public class XSDAbstractDateTimeType extends XSDDatatype { public static final boolean isDigit(char ch) { return ch >= '0' && ch <= '9'; } - + // if the character is in the range 0x30 ~ 0x39, return its int value (0~9), // otherwise, return -1 public static final int getDigit(char ch) { @@ -397,7 +396,7 @@ public class XSDAbstractDateTimeType extends XSDDatatype { append(message, (char)date[utc], 0); return message.toString(); } - + /** Append the fraction time part of a date/time vector to * a string buffer. */ @@ -412,7 +411,7 @@ public class XSDAbstractDateTimeType extends XSDDatatype { while (trunc > 0 && msString.charAt(trunc-1) == '0') trunc --; buff.append(msString.substring(0, trunc)); } - + protected void append(StringBuilder message, int value, int nch) { if (value < 0) { message.append('-'); @@ -438,15 +437,15 @@ public class XSDAbstractDateTimeType extends XSDDatatype { } } - + // -------------------------------------------------------------------- -// End of code is adapated from Xerces 2.6.0 AbstractDateTimeDV. +// End of code is adapated from Xerces 2.6.0 AbstractDateTimeDV. // -------------------------------------------------------------------- - + /** * Normalization. If the value is narrower than the current data type * (e.g. value is xsd:date but the time is xsd:datetime) returns - * the narrower type for the literal. + * the narrower type for the literal. * If the type is narrower than the value then it may normalize * the value (e.g. set the mask of an XSDDateTime) * Currently only used to narrow gener XSDDateTime objects diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/cmds/FusekiMain.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/cmds/FusekiMain.java index 015d97f9b0..7a2f85939c 100644 --- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/cmds/FusekiMain.java +++ b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/cmds/FusekiMain.java @@ -62,6 +62,26 @@ public class FusekiMain extends CmdARQ { /** Default HTTPS port when running from the command line. */ public static int defaultHttpsPort = 3043; + /** + * Build, but do not start, a server based on command line syntax. + */ + public static FusekiServer build(String... args) { + FusekiServer.Builder builder = builder(args); + return builder.build(); + } + + /** + * Create a server and run, within the same JVM. + * This is the command line entry point. + * This function does not return. + * See also {@link #build} to create and return a server. + */ + public static void run(String... argv) { + JenaSystem.init(); + InitFusekiMain.init(); + new FusekiMain(argv).mainRun(); + } + private static ArgDecl argMem = new ArgDecl(ArgDecl.NoValue, "mem"); private static ArgDecl argUpdate = new ArgDecl(ArgDecl.NoValue, "update", "allowUpdate"); private static ArgDecl argFile = new ArgDecl(ArgDecl.HasValue, "file"); @@ -140,26 +160,6 @@ public class FusekiMain extends CmdARQ { return builder; } - /** - * Build, but do not start, a server based on command line syntax. - */ - public static FusekiServer build(String... args) { - FusekiServer.Builder builder = builder(args); - return builder.build(); - } - - /** - * Create a server and run, within the same JVM. - * This is the command line entry point. - * This function does not return. - * See also {@link #build} to create and return a server. - */ - public static void run(String... argv) { - JenaSystem.init(); - InitFusekiMain.init(); - new FusekiMain(argv).mainRun(); - } - /** * Registers a custom arguments module. * diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mod/FusekiServerRunner.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mod/FusekiServerRunner.java index e6443a2def..fc4a158166 100644 --- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mod/FusekiServerRunner.java +++ b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mod/FusekiServerRunner.java @@ -40,11 +40,14 @@ import org.apache.jena.fuseki.mod.ui.FMod_UI; public class FusekiServerRunner { public static void main(String... args) { - //runAsync(args).join(); - prepareFusekiMain(); + prepareFusekiServerConstruct(); FusekiMain.run(args); + // Does not return. } + /** + * Run {@link FusekiServer} with {@link FusekiModules} as given by {@link #serverModules()}. + */ public static FusekiServer runAsync(String... args) { FusekiServer server = construct(args); try { @@ -64,15 +67,18 @@ public class FusekiServerRunner { } } + /** + * Build but do not start, a {@link FusekiServer} with {@link FusekiModules} as given by {@link #serverModules()}. + */ public static FusekiServer construct(String... args) { - prepareFusekiMain(); + prepareFusekiServerConstruct(); // Make server FusekiServer server = FusekiServer.construct(args); resetFusekiMain(); return server; } - private static void prepareFusekiMain() { + private static void prepareFusekiServerConstruct() { String fusekiBase = Lib.getenv(FusekiServerCtl.envFusekiBase); if ( fusekiBase == null ) fusekiBase = FusekiServerCtl.dftFusekiBase; diff --git a/jena-shacl/src/test/java/org/apache/jena/shacl/test_vocab/SHT.java b/jena-shacl/src/test/java/org/apache/jena/shacl/test_vocab/SHT.java index 06ede09786..2f6ffb2abf 100644 --- a/jena-shacl/src/test/java/org/apache/jena/shacl/test_vocab/SHT.java +++ b/jena-shacl/src/test/java/org/apache/jena/shacl/test_vocab/SHT.java @@ -25,18 +25,18 @@ import org.apache.jena.rdf.model.ResourceFactory; public class SHT { public static final String BASE_URI = "http://www.w3.org/ns/shacl-test"; - + public static final String NS = BASE_URI + "#"; - + public final static Resource CoreOnly = ResourceFactory.createResource(NS + "CoreOnly"); - + public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); - + public final static Resource Failure = ResourceFactory.createResource(NS + "Failure"); - + public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); - + public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); - + public final static Resource Validate = ResourceFactory.createResource(NS + "Validate"); }
