Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LOGMGR-193] Remove the Namespace enum type and setter. The string se… #182

Merged
merged 1 commit into from
Apr 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 6 additions & 36 deletions src/main/java/org/jboss/logmanager/formatters/XmlFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,7 @@
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"})
public class XmlFormatter extends StructuredFormatter {

/**
* The namespaces for logged records.
*/
public enum Namespace {
LOGGING_1_0("urn:jboss:logmanager:formatter:1.0");

private final String uri;

Namespace(final String uri) {
this.uri = uri;
}

/**
* Get the URI of this namespace.
*
* @return the URI
*/
public String getUriString() {
return uri;
}
}
public static final String DEFAULT_NAMESPACE = "urn:jboss:logmanager:formatter:1.0";

private final XMLOutputFactory factory = XMLOutputFactory.newFactory();

Expand All @@ -76,13 +56,13 @@ public String getUriString() {
* Creates a new XML formatter.
*/
public XmlFormatter() {
namespaceUri = Namespace.LOGGING_1_0.getUriString();
namespaceUri = DEFAULT_NAMESPACE;
}

/**
* Creates a new XML formatter.
* <p>
* If the {@code keyOverrides} is empty the default {@linkplain Namespace#LOGGING_1_0 namespace} will be used.
* If the {@code keyOverrides} is empty the default {@linkplain #DEFAULT_NAMESPACE namespace} will be used.
* </p>
*
* @param keyOverrides a string representation of a map to override keys
Expand All @@ -92,7 +72,7 @@ public XmlFormatter() {
public XmlFormatter(final String keyOverrides) {
super(keyOverrides);
if (keyOverrides == null || keyOverrides.isEmpty()) {
namespaceUri = Namespace.LOGGING_1_0.getUriString();
namespaceUri = DEFAULT_NAMESPACE;
} else {
namespaceUri = null;
}
Expand All @@ -101,15 +81,15 @@ public XmlFormatter(final String keyOverrides) {
/**
* Creates a new XML formatter.
* <p>
* If the {@code keyOverrides} is empty the default {@linkplain Namespace#LOGGING_1_0 namespace} will be used.
* If the {@code keyOverrides} is empty the default {@linkplain #DEFAULT_NAMESPACE namespace} will be used.
* </p>
*
* @param keyOverrides a map of overrides for the default keys
*/
public XmlFormatter(final Map<Key, String> keyOverrides) {
super(keyOverrides);
if (keyOverrides == null || keyOverrides.isEmpty()) {
namespaceUri = Namespace.LOGGING_1_0.getUriString();
namespaceUri = DEFAULT_NAMESPACE;
} else {
namespaceUri = null;
}
Expand Down Expand Up @@ -161,16 +141,6 @@ public String getNamespaceUri() {
return namespaceUri;
}

/**
* Sets the namespace URI used for each record if {@link #isPrintNamespace()} is {@code true}.
*
* @param namespace the namespace to use or {@code null} if no namespace URI should be used regardless of the
* {@link #isPrintNamespace()} value
*/
public void setNamespaceUri(final Namespace namespace) {
this.namespaceUri = (namespace == null ? null : namespace.getUriString());
}

/**
* Sets the namespace URI used for each record if {@link #isPrintNamespace()} is {@code true}.
*
Expand Down