Skip to content

Commit a6b551a

Browse files
committed
[ignore] Reformat code
1 parent d86e4f0 commit a6b551a

File tree

2 files changed

+38
-43
lines changed

2 files changed

+38
-43
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/FunEnvironment.java

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
package org.exist.xquery.functions.fn;
2323

2424
import java.util.Map;
25+
2526
import org.apache.logging.log4j.LogManager;
2627
import org.apache.logging.log4j.Logger;
2728
import org.exist.dom.QName;
@@ -41,29 +42,29 @@
4142

4243
public class FunEnvironment extends BasicFunction {
4344

44-
protected static final Logger logger = LogManager.getLogger(FunEnvironment.class);
45+
private static final Logger LOGGER = LogManager.getLogger(FunEnvironment.class);
4546

4647
public final static FunctionSignature[] signature = {
47-
new FunctionSignature(
48-
new QName("available-environment-variables", Function.BUILTIN_FUNCTION_NS),
49-
"Returns a list of environment variable names.",
50-
null,
51-
new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_MORE,
52-
"Returns a sequence of strings, being the names of the environment variables. User must be DBA.")
53-
),
54-
new FunctionSignature(
55-
new QName("environment-variable", Function.BUILTIN_FUNCTION_NS),
56-
"Returns the value of a system environment variable, if it exists.",
57-
new SequenceType[] {
58-
new FunctionParameterSequenceType("name", Type.STRING,
59-
Cardinality.EXACTLY_ONE, "Name of environment variable.")
60-
},
61-
new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_ONE, "Corrensponding value of the environment variable, "
62-
+ "if there is no environment variable with a matching name, the function returns the empty sequence. User must be DBA.")
63-
)
48+
new FunctionSignature(
49+
new QName("available-environment-variables", Function.BUILTIN_FUNCTION_NS),
50+
"Returns a list of environment variable names.",
51+
null,
52+
new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_MORE,
53+
"Returns a sequence of strings, being the names of the environment variables. User must be DBA.")
54+
),
55+
new FunctionSignature(
56+
new QName("environment-variable", Function.BUILTIN_FUNCTION_NS),
57+
"Returns the value of a system environment variable, if it exists.",
58+
new SequenceType[]{
59+
new FunctionParameterSequenceType("name", Type.STRING,
60+
Cardinality.EXACTLY_ONE, "Name of environment variable.")
61+
},
62+
new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_ONE, "Corrensponding value of the environment variable, "
63+
+ "if there is no environment variable with a matching name, the function returns the empty sequence. User must be DBA.")
64+
)
6465
};
6566

66-
public FunEnvironment(XQueryContext context, FunctionSignature signature) {
67+
public FunEnvironment(final XQueryContext context, final FunctionSignature signature) {
6768
super(context, signature);
6869
}
6970

@@ -72,7 +73,7 @@ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathExce
7273

7374
if (!context.getSubject().hasDbaRole()) {
7475
final String txt = "Permission denied, calling user '" + context.getSubject().getName() + "' must be a DBA to call this function.";
75-
logger.error(txt);
76+
LOGGER.error(txt);
7677
return Sequence.EMPTY_SEQUENCE;
7778
}
7879

exist-core/src/main/java/org/exist/xquery/functions/util/SystemProperty.java

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,45 @@
2222
package org.exist.xquery.functions.util;
2323

2424
import org.exist.SystemProperties;
25-
import org.exist.dom.QName;
2625
import org.exist.xquery.BasicFunction;
27-
import org.exist.xquery.Cardinality;
2826
import org.exist.xquery.FunctionSignature;
2927
import org.exist.xquery.XPathException;
3028
import org.exist.xquery.XQueryContext;
31-
import org.exist.xquery.value.FunctionParameterSequenceType;
32-
import org.exist.xquery.value.FunctionReturnSequenceType;
3329
import org.exist.xquery.value.Sequence;
34-
import org.exist.xquery.value.SequenceType;
3530
import org.exist.xquery.value.StringValue;
3631
import org.exist.xquery.value.Type;
3732

33+
import static org.exist.xquery.FunctionDSL.param;
34+
import static org.exist.xquery.FunctionDSL.returnsOpt;
35+
import static org.exist.xquery.functions.util.UtilModule.functionSignature;
36+
3837
/**
39-
* Libary function to retrieve the value of a system property.
38+
* Library function to retrieve the value of a system property.
39+
*
4040
* @author Wolfgang Meier
4141
* @author Loren Cahlander
4242
*/
4343
public class SystemProperty extends BasicFunction {
4444

45-
public final static FunctionSignature signature = new FunctionSignature(
46-
new QName("system-property", UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
47-
"Returns the value of a system property. Similar to the corresponding XSLT function. " +
48-
"Predefined properties are: vendor, vendor-url, product-name, product-version, product-build, and all Java " +
49-
"system properties.",
50-
new SequenceType[] {
51-
new FunctionParameterSequenceType("property-name", Type.STRING, Cardinality.EXACTLY_ONE, "The name of the system property to retrieve the value of.")
52-
},
53-
new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_ONE, "the value of the named system property")
45+
public final static FunctionSignature signature = functionSignature(
46+
"system-property",
47+
"Returns the value of a system property. Similar to the corresponding XSLT function. " +
48+
"Predefined properties are: vendor, vendor-url, product-name, product-version, product-build, and all Java " +
49+
"System Properties.",
50+
returnsOpt(Type.STRING, "the value of the named system property"),
51+
param("property-name", Type.STRING, "The name of the system property to retrieve the value of.")
5452
);
5553

56-
public SystemProperty(XQueryContext context, FunctionSignature signature) {
54+
public SystemProperty(final XQueryContext context, final FunctionSignature signature) {
5755
super(context, signature);
5856
}
5957

60-
/* (non-Javadoc)
61-
* @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence)
62-
*/
6358
@Override
64-
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
65-
59+
public Sequence eval(final Sequence[] args, final Sequence contextSequence) throws XPathException {
6660
final String key = args[0].getStringValue();
6761
String value = SystemProperties.getInstance().getSystemProperty(key, null);
68-
if(value == null) {
69-
value = System.getProperty(key);
62+
if (value == null) {
63+
value = System.getProperty(key);
7064
}
7165
return value == null ? Sequence.EMPTY_SEQUENCE : new StringValue(this, value);
7266
}

0 commit comments

Comments
 (0)