Skip to content

Commit

Permalink
Merge pull request #182 from jamezp/LOGMGR-193
Browse files Browse the repository at this point in the history
[LOGMGR-193] Remove the Namespace enum type and setter. The string se…
  • Loading branch information
jamezp authored Apr 10, 2018
2 parents 6fb73c9 + 0ffd379 commit 3a1be48
Showing 1 changed file with 6 additions and 36 deletions.
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

0 comments on commit 3a1be48

Please sign in to comment.