You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2015/08/30 21:46:17 UTC
[2/3] logging-log4j2 git commit: LOG4J2-952 - Create initialize
lifecycle phase. Rename classes to be Builders
LOG4J2-952 - Create initialize lifecycle phase. Rename classes to be Builders
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/20fd2273
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/20fd2273
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/20fd2273
Branch: refs/heads/LOG4J2-952
Commit: 20fd22733df1b03a10132f84369dbd20abfb55ab
Parents: b8f29d8
Author: Ralph Goers <rg...@nextiva.com>
Authored: Sun Aug 30 12:33:58 2015 -0700
Committer: Ralph Goers <rg...@nextiva.com>
Committed: Sun Aug 30 12:38:24 2015 -0700
----------------------------------------------------------------------
.../logging/log4j/core/AbstractLifeCycle.java | 5 +
.../apache/logging/log4j/core/LifeCycle.java | 4 +
.../core/config/AbstractConfiguration.java | 21 +-
.../log4j/core/config/ConfigurationFactory.java | 4 +-
.../config/assembler/api/AppenderAssembler.java | 43 ---
.../assembler/api/AppenderComponentBuilder.java | 43 +++
.../assembler/api/AppenderRefAssembler.java | 30 --
.../api/AppenderRefComponentBuilder.java | 30 ++
.../assembler/api/ComponentAssembler.java | 94 ------
.../config/assembler/api/ComponentBuilder.java | 95 ++++++
.../assembler/api/CompositeFilterAssembler.java | 30 --
.../api/CompositeFilterComponentBuilder.java | 30 ++
.../assembler/api/ConfigurationAssembler.java | 252 ---------------
.../api/ConfigurationAssemblerFactory.java | 39 ---
.../assembler/api/ConfigurationBuilder.java | 253 +++++++++++++++
.../api/ConfigurationBuilderFactory.java | 39 +++
.../assembler/api/CustomLevelAssembler.java | 24 --
.../api/CustomLevelComponentBuilder.java | 24 ++
.../config/assembler/api/FilterAssembler.java | 24 --
.../assembler/api/FilterComponentBuilder.java | 24 ++
.../config/assembler/api/LayoutAssembler.java | 24 --
.../assembler/api/LayoutComponentBuilder.java | 24 ++
.../config/assembler/api/LoggerAssembler.java | 37 ---
.../assembler/api/LoggerComponentBuilder.java | 37 +++
.../assembler/api/RootLoggerAssembler.java | 37 ---
.../api/RootLoggerComponentBuilder.java | 37 +++
.../impl/DefaultAppenderAssembler.java | 44 ---
.../impl/DefaultAppenderComponentBuilder.java | 46 +++
.../impl/DefaultAppenderRefAssembler.java | 39 ---
.../DefaultAppenderRefComponentBuilder.java | 41 +++
.../impl/DefaultComponentAssembler.java | 127 --------
.../assembler/impl/DefaultComponentBuilder.java | 128 ++++++++
.../impl/DefaultCompositeFilterAssembler.java | 40 ---
.../DefaultCompositeFilterComponentBuilder.java | 42 +++
.../impl/DefaultConfigurationAssembler.java | 318 ------------------
.../impl/DefaultConfigurationBuilder.java | 319 +++++++++++++++++++
.../impl/DefaultCustomLevelAssembler.java | 33 --
.../DefaultCustomLevelComponentBuilder.java | 33 ++
.../assembler/impl/DefaultFilterAssembler.java | 33 --
.../impl/DefaultFilterComponentBuilder.java | 34 ++
.../assembler/impl/DefaultLayoutAssembler.java | 30 --
.../impl/DefaultLayoutComponentBuilder.java | 31 ++
.../assembler/impl/DefaultLoggerAssembler.java | 63 ----
.../impl/DefaultLoggerComponentBuilder.java | 66 ++++
.../impl/DefaultRootLoggerAssembler.java | 62 ----
.../impl/DefaultRootLoggerComponentBuilder.java | 65 ++++
.../PropertiesConfigurationFactory.java | 85 +++--
.../log4j/core/net/server/JmsServer.java | 4 +
.../util/DefaultShutdownCallbackRegistry.java | 4 +
.../log4j/core/config/TestConfigurator.java | 16 +-
.../assembler/CustomConfigurationFactory.java | 10 +-
.../test/resources/log4j2-properties.properties | 2 +
52 files changed, 1535 insertions(+), 1484 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
index f4fabab..08d273b 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
@@ -111,6 +111,11 @@ public class AbstractLifeCycle implements LifeCycle, Serializable {
}
@Override
+ public void initialize() {
+ this.state = State.INITIALIZED;
+ }
+
+ @Override
public void start() {
this.setStarted();
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/LifeCycle.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LifeCycle.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LifeCycle.java
index 7dfdbe9..4562f5a 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LifeCycle.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LifeCycle.java
@@ -33,6 +33,8 @@ public interface LifeCycle {
* Status of a life cycle like a {@link LoggerContext}.
*/
public enum State {
+ /** Object is in its initial state and not yet initialized */
+ INITIAL,
/** Initialized but not yet started. */
INITIALIZED,
/** In the process of starting. */
@@ -51,6 +53,8 @@ public interface LifeCycle {
* @return the life-cycle state
*/
State getState();
+
+ void initialize();
void start();
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
index aedd25b..d16e556 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
@@ -117,6 +117,7 @@ public abstract class AbstractConfiguration extends AbstractFilterable implement
componentMap.put(Configuration.CONTEXT_PROPERTIES, properties);
pluginManager = new PluginManager(Node.CATEGORY);
rootNode = new Node();
+ setState(State.INITIAL);
}
@Override
@@ -138,9 +139,8 @@ public abstract class AbstractConfiguration extends AbstractFilterable implement
* Initialize the configuration.
*/
@Override
- public void start() {
- LOGGER.debug("Starting configuration {}", this);
- this.setStarting();
+ public void initialize() {
+ LOGGER.debug("Initializing configuration {}", this);
pluginManager.collectPlugins(pluginPackages);
final PluginManager levelPlugins = new PluginManager(Level.CATEGORY);
levelPlugins.collectPlugins(pluginPackages);
@@ -159,6 +159,21 @@ public abstract class AbstractConfiguration extends AbstractFilterable implement
setup();
setupAdvertisement();
doConfigure();
+ setState(State.INITIALIZED);
+ LOGGER.debug("Configuration {} initialized", this);
+ }
+
+ /**
+ * Start the configuration
+ */
+ @Override
+ public void start() {
+ // Preserve the prior behavior of initializing during start if not initialized.
+ if (getState().equals(State.INITIAL)) {
+ initialize();
+ }
+ LOGGER.debug("Starting configuration {}", this);
+ this.setStarting();
final Set<LoggerConfig> alreadyStarted = new HashSet<>();
for (final LoggerConfig logger : loggers.values()) {
logger.start();
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
index 7ff8a2b..f0d85b8 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
@@ -35,7 +35,7 @@ import java.util.concurrent.locks.ReentrantLock;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.config.assembler.api.ConfigurationAssemblerFactory;
+import org.apache.logging.log4j.core.config.assembler.api.ConfigurationBuilderFactory;
import org.apache.logging.log4j.core.config.plugins.util.PluginManager;
import org.apache.logging.log4j.core.config.plugins.util.PluginType;
import org.apache.logging.log4j.core.lookup.Interpolator;
@@ -71,7 +71,7 @@ import org.apache.logging.log4j.util.Strings;
* be called in their respective order. DefaultConfiguration is always called
* last if no configuration has been returned.
*/
-public abstract class ConfigurationFactory extends ConfigurationAssemblerFactory {
+public abstract class ConfigurationFactory extends ConfigurationBuilderFactory {
/**
* Allow the ConfigurationFactory class to be specified as a system property.
*/
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderAssembler.java
deleted file mode 100644
index 95d343a..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderAssembler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-/**
- * Assembler for constructing Appenders.
- */
-public interface AppenderAssembler extends ComponentAssembler<AppenderAssembler> {
-
- /**
- * Add a Layout to the Appender component.
- * @param assembler The LayoutAssembler with all of its attributes set.
- * @return this Assembler.
- */
- AppenderAssembler add(LayoutAssembler assembler);
-
- /**
- * Add a Filter to the Appender component.
- * @param assembler The FilterAssembler with all of its attributes and sub components set.
- * @return this Assembler.
- */
- AppenderAssembler add(FilterAssembler assembler);
-
- /**
- * Return the name of the Appender.
- * @return the name of the Appender.
- */
- String getName();
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderComponentBuilder.java
new file mode 100644
index 0000000..3bed6b2
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderComponentBuilder.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+/**
+ * Assembler for constructing Appenders.
+ */
+public interface AppenderComponentBuilder extends ComponentBuilder<AppenderComponentBuilder> {
+
+ /**
+ * Add a Layout to the Appender component.
+ * @param assembler The LayoutComponentBuilder with all of its attributes set.
+ * @return this Assembler.
+ */
+ AppenderComponentBuilder add(LayoutComponentBuilder assembler);
+
+ /**
+ * Add a Filter to the Appender component.
+ * @param assembler The FilterComponentBuilder with all of its attributes and sub components set.
+ * @return this Assembler.
+ */
+ AppenderComponentBuilder add(FilterComponentBuilder assembler);
+
+ /**
+ * Return the name of the Appender.
+ * @return the name of the Appender.
+ */
+ String getName();
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderRefAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderRefAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderRefAssembler.java
deleted file mode 100644
index c055faa..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderRefAssembler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-/**
- * Assembler for constructing AppenderRefs.
- */
-public interface AppenderRefAssembler extends ComponentAssembler<AppenderRefAssembler> {
-
- /**
- * Add a Filter to the Appender component.
- * @param assembler The FilterAssembler with all of its attributes and sub components set.
- * @return this Assembler.
- */
- AppenderRefAssembler add(FilterAssembler assembler);
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderRefComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderRefComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderRefComponentBuilder.java
new file mode 100644
index 0000000..c492fe3
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/AppenderRefComponentBuilder.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+/**
+ * Assembler for constructing AppenderRefs.
+ */
+public interface AppenderRefComponentBuilder extends ComponentBuilder<AppenderRefComponentBuilder> {
+
+ /**
+ * Add a Filter to the Appender component.
+ * @param assembler The FilterComponentBuilder with all of its attributes and sub components set.
+ * @return this Assembler.
+ */
+ AppenderRefComponentBuilder add(FilterComponentBuilder assembler);
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ComponentAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ComponentAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ComponentAssembler.java
deleted file mode 100644
index 3c21e5a..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ComponentAssembler.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.config.Configuration;
-
-/**
- * Assembler for arbitrary components and the base class for the provided components.
- */
-@SuppressWarnings("rawtypes")
-public interface ComponentAssembler<T extends ComponentAssembler> extends Assembler<Component> {
-
- /**
- * Add an attribute to the component.
- * @param key The attribute key.
- * @param value The value of the attribute.
- * @return The ComponentAssembler.
- */
- T addAttribute(String key, String value);
-
- /**
- * Add a logging Level attribute to the component.
- * @param key The attribute key.
- * @param level The logging Level.
- * @return The ComponentAssembler.
- */
- T addAttribute(String key, Level level);
-
- /**
- * Add an enumeration.
- * @param key The attribute key.
- * @param value The enumeration.
- * @return The ComponentAssembler.
- */
- T addAttribute(String key, Enum<?> value);
-
- /**
- * Add an integer attribute.
- * @param key The attribute key.
- * @param value The integer value.
- * @return The ComponentAssembler.
- */
- T addAttribute(String key, int value);
-
- /**
- * Add a boolean attribute.
- * @param key The attribute key.
- * @param value The integer value.
- * @return The ComponentAssembler.
- */
- T addAttribute(String key, boolean value);
-
- /**
- * Add an Object attribute.
- * @param key The attribute key.
- * @param value The integer value.
- * @return The ComponentAssembler.
- */
- T addAttribute(String key, Object value);
-
- /**
- * Add a sub component.
- * @param assembler The Assembler for the subcomponent with all of its attributes and sub-components set.
- * @return The ComponentAssembler.
- */
- T addComponent(ComponentAssembler<?> assembler);
-
- /**
- * Return the name of the component, if any.
- * @return The components name or null if it doesn't have one.
- */
- String getName();
-
- /**
- * Retrieve the ConfigurationAssembler.
- * @return The ConfiguratonAssembler.
- */
- ConfigurationAssembler<? extends Configuration> getAssembler();
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ComponentBuilder.java
new file mode 100644
index 0000000..12aea81
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ComponentBuilder.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.util.Builder;
+
+/**
+ * Assembler for arbitrary components and the base class for the provided components.
+ */
+@SuppressWarnings("rawtypes")
+public interface ComponentBuilder<T extends ComponentBuilder> extends Builder<Component> {
+
+ /**
+ * Add an attribute to the component.
+ * @param key The attribute key.
+ * @param value The value of the attribute.
+ * @return The ComponentBuilder.
+ */
+ T addAttribute(String key, String value);
+
+ /**
+ * Add a logging Level attribute to the component.
+ * @param key The attribute key.
+ * @param level The logging Level.
+ * @return The ComponentBuilder.
+ */
+ T addAttribute(String key, Level level);
+
+ /**
+ * Add an enumeration.
+ * @param key The attribute key.
+ * @param value The enumeration.
+ * @return The ComponentBuilder.
+ */
+ T addAttribute(String key, Enum<?> value);
+
+ /**
+ * Add an integer attribute.
+ * @param key The attribute key.
+ * @param value The integer value.
+ * @return The ComponentBuilder.
+ */
+ T addAttribute(String key, int value);
+
+ /**
+ * Add a boolean attribute.
+ * @param key The attribute key.
+ * @param value The integer value.
+ * @return The ComponentBuilder.
+ */
+ T addAttribute(String key, boolean value);
+
+ /**
+ * Add an Object attribute.
+ * @param key The attribute key.
+ * @param value The integer value.
+ * @return The ComponentBuilder.
+ */
+ T addAttribute(String key, Object value);
+
+ /**
+ * Add a sub component.
+ * @param assembler The Assembler for the subcomponent with all of its attributes and sub-components set.
+ * @return The ComponentBuilder.
+ */
+ T addComponent(ComponentBuilder<?> assembler);
+
+ /**
+ * Return the name of the component, if any.
+ * @return The components name or null if it doesn't have one.
+ */
+ String getName();
+
+ /**
+ * Retrieve the ConfigurationBuilder.
+ * @return The ConfiguratonAssembler.
+ */
+ ConfigurationBuilder<? extends Configuration> getBuilder();
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CompositeFilterAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CompositeFilterAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CompositeFilterAssembler.java
deleted file mode 100644
index 4ab8f7e..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CompositeFilterAssembler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-/**
- * Wraps multiple filter assemblers.
- */
-public interface CompositeFilterAssembler extends ComponentAssembler<CompositeFilterAssembler> {
-
- /**
- * Add a FilterComponent.
- * @param assembler The FilterAssembler with all of its attributes and sub-components set.
- * @return The CompositeFilterAssembler.
- */
- CompositeFilterAssembler add(FilterAssembler assembler);
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CompositeFilterComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CompositeFilterComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CompositeFilterComponentBuilder.java
new file mode 100644
index 0000000..1b6d795
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CompositeFilterComponentBuilder.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+/**
+ * Wraps multiple filter assemblers.
+ */
+public interface CompositeFilterComponentBuilder extends ComponentBuilder<CompositeFilterComponentBuilder> {
+
+ /**
+ * Add a FilterComponent.
+ * @param assembler The FilterComponentBuilder with all of its attributes and sub-components set.
+ * @return The CompositeFilterComponentBuilder.
+ */
+ CompositeFilterComponentBuilder add(FilterComponentBuilder assembler);
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationAssembler.java
deleted file mode 100644
index 600515b..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationAssembler.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.Filter;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.ConfigurationSource;
-
-/**
- * Interface for assembling logging configurations.
- */
-public interface ConfigurationAssembler<T extends Configuration> extends Assembler<T> {
-
- /**
- * Set the name of the configuration.
- *
- * @param name the name of the {@link Configuration}. By default is {@code "Constructed"}.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> setConfigurationName(String name);
-
- /**
- * Set the configuration source, if one exists.
- * @param configurationSource the ConfigurationSource.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> setConfigurationSource(ConfigurationSource configurationSource);
-
- /**
- * Set the level of the StatusLogger.
- * @param level The logging level.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> setStatusLevel(Level level);
-
- /**
- * Set whether the logging should include constructing Plugins.
- * @param verbosity "disable" will hide messages from plugin construction.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> setVerbosity(String verbosity);
-
- /**
- * Set the list of packages to search for plugins.
- * @param packages The comma separated list of packages.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> setPackages(String packages);
-
- /**
- * Set whether the shutdown hook should be disabled.
- * @param flag "disable" will prevent the shutdown hook from being set.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> setShutdownHook(String flag);
-
- /**
- * Sets the interval at which the configuration file should be checked for changes.
- * @param intervalSeconds The number of seconds that should pass between checks of the configuration file.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> setMonitorInterval(String intervalSeconds);
-
- /**
- * Adds an AppenderComponent.
- * @param assembler The AppenderAssembler with all of its attributes and sub components set.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> add(AppenderAssembler assembler);
-
- /**
- * Adds a CustomLevel component.
- * @param assembler The CustomLevelAssembler with all of its attributes set.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> add(CustomLevelAssembler assembler);
-
- /**
- * Add a Logger component.
- * @param assembler The LoggerAssembler with all of its attributes and sub components set.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> add(LoggerAssembler assembler);
-
- /**
- * Add the root Logger component.
- * @param assembler The RootLoggerAssembler with all of its attributes and sub components set.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> add(RootLoggerAssembler assembler);
-
- /**
- * Add a Filter component.
- * @param assembler the FilterAssembler with all of its attributes and sub components set.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> add(FilterAssembler assembler);
-
- /**
- * Add a Property key and value.
- * @param key The property key.
- * @param value The property value.
- * @return this Assembler instance.
- */
- ConfigurationAssembler<T> addProperty(String key, String value);
-
- /**
- * Returns an Assembler for creating Appenders.
- * @param name The name of the Appender.
- * @param pluginName The Plugin type of the Appender.
- * @return the AppenderAssembler.
- */
- AppenderAssembler newAppender(String name, String pluginName);
-
-
- /**
- * Returns an Assembler for creating AppenderRefs.
- * @param ref The name of the Appender being referenced.
- * @return the AppenderRefAssembler.
- */
- AppenderRefAssembler newAppenderRef(String ref);
-
- /**
- * Returns an Assembler for creating generic components.
- * @param name The name of the component (may be null).
- * @param pluginName The Plugin type of the component.
- * @return The ComponentAssembler.
- */
- @SuppressWarnings("rawtypes")
- ComponentAssembler newComponent(String name, String pluginName);
-
- /**
- * Returns an Assembler for creating generic components.
- * @param name The name of the component (may be null).
- * @param pluginName The Plugin type of the component.
- * @param value The value of the component.
- * @return The ComponentAssembler.
- */
- @SuppressWarnings("rawtypes")
- ComponentAssembler<ComponentAssembler> newComponent(String name, String pluginName, String value);
-
- /**
- * Returns an Asssembler for creating CustomLevels
- * @param name The name of the custom level.
- * @param level The integer value to be assigned to the level.
- * @return The CustomLevelAssembler.
- */
- CustomLevelAssembler newCustomLevel(String name, int level);
-
- /**
- * Returns an Asssembler for creating Filters.
- * @param pluginName The Plugin type of the Filter.
- * @param onMatch "ACCEPT", "DENY", or "NEUTRAL"
- * @param onMisMatch "ACCEPT", "DENY", or "NEUTRAL"
- * @return The FilterAssembler.
- */
- FilterAssembler newFilter(String pluginName, Filter.Result onMatch, Filter.Result onMisMatch);
-
- /**
- * Returns an Asssembler for creating Filters.
- * @param pluginName The Plugin type of the Filter.
- * @param onMatch "ACCEPT", "DENY", or "NEUTRAL"
- * @param onMisMatch "ACCEPT", "DENY", or "NEUTRAL"
- * @return The FilterAssembler.
- */
- FilterAssembler newFilter(String pluginName, String onMatch, String onMisMatch);
-
- /**
- * Returns an Assembler for creating Layouts.
- * @param type The Plugin type of the Layout.
- * @return The LayoutAssembler.
- */
- LayoutAssembler newLayout(String pluginName);
-
- /**
- * Returns an Assembler for creating Loggers.
- * @param name The name of the Logger.
- * @param level The logging Level to be assigned to the Logger.
- * @return The LoggerAssembler.
- */
- LoggerAssembler newLogger(String name, Level level);
-
-
- /**
- * Returns an Assembler for creating Loggers.
- * @param name The name of the Logger.
- * @param level The logging Level to be assigned to the Logger.
- * @return The LoggerAssembler.
- */
- LoggerAssembler newLogger(String name, String level);
-
- /**
- * Returns an Assembler for creating Async Loggers.
- * @param name The name of the Logger.
- * @param level The logging Level to be assigned to the Logger.
- * @return The LoggerAssembler.
- */
- LoggerAssembler newAsyncLogger(String name, Level level);
-
- /**
- * Returns an Assembler for creating Async Loggers.
- * @param name The name of the Logger.
- * @param level The logging Level to be assigned to the Logger.
- * @return The LoggerAssembler.
- */
- LoggerAssembler newAsyncLogger(String name, String level);
-
- /**
- * Returns an Assembler for creating the root Logger.
- * @param level The logging Level to be assigned to the root Logger.
- * @return The RootLoggerAssembler.
- */
- RootLoggerAssembler newRootLogger(Level level);
-
- /**
- * Returns an Assembler for creating the root Logger.
- * @param level The logging Level to be assigned to the root Logger.
- * @return The RootLoggerAssembler.
- */
- RootLoggerAssembler newRootLogger(String level);
-
-
- /**
- * Returns an Assembler for creating the async root Logger.
- * @param level The logging Level to be assigned to the root Logger.
- * @return The RootLoggerAssembler.
- */
- RootLoggerAssembler newAsyncRootLogger(Level level);
-
-
- /**
- * Returns an Assembler for creating the async root Logger.
- * @param level The logging Level to be assigned to the root Logger.
- * @return The RootLoggerAssembler.
- */
- RootLoggerAssembler newAsyncRootLogger(String level);
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationAssemblerFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationAssemblerFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationAssemblerFactory.java
deleted file mode 100644
index 85e1c89..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationAssemblerFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-
-package org.apache.logging.log4j.core.config.assembler.api;
-
-import org.apache.logging.log4j.core.config.assembler.impl.AssembledConfiguration;
-import org.apache.logging.log4j.core.config.assembler.impl.DefaultConfigurationAssembler;
-
-/**
- *
- */
-public class ConfigurationAssemblerFactory {
-
- /**
- * Returns the default ConfigurationAssembler to construct Log4j configurations.
- * @return The ConfigurationAssembler.
- */
- public static ConfigurationAssembler<AssembledConfiguration> newConfiguration() {
- return new DefaultConfigurationAssembler<>();
- }
-
- public static <T extends AssembledConfiguration> ConfigurationAssembler<T> newConfiguration(Class<T> clazz) {
- return new DefaultConfigurationAssembler<>(clazz);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationBuilder.java
new file mode 100644
index 0000000..72f5ec9
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationBuilder.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.ConfigurationSource;
+import org.apache.logging.log4j.core.util.Builder;
+
+/**
+ * Interface for assembling logging configurations.
+ */
+public interface ConfigurationBuilder<T extends Configuration> extends Builder<T> {
+
+ /**
+ * Set the name of the configuration.
+ *
+ * @param name the name of the {@link Configuration}. By default is {@code "Constructed"}.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> setConfigurationName(String name);
+
+ /**
+ * Set the configuration source, if one exists.
+ * @param configurationSource the ConfigurationSource.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> setConfigurationSource(ConfigurationSource configurationSource);
+
+ /**
+ * Set the level of the StatusLogger.
+ * @param level The logging level.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> setStatusLevel(Level level);
+
+ /**
+ * Set whether the logging should include constructing Plugins.
+ * @param verbosity "disable" will hide messages from plugin construction.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> setVerbosity(String verbosity);
+
+ /**
+ * Set the list of packages to search for plugins.
+ * @param packages The comma separated list of packages.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> setPackages(String packages);
+
+ /**
+ * Set whether the shutdown hook should be disabled.
+ * @param flag "disable" will prevent the shutdown hook from being set.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> setShutdownHook(String flag);
+
+ /**
+ * Sets the interval at which the configuration file should be checked for changes.
+ * @param intervalSeconds The number of seconds that should pass between checks of the configuration file.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> setMonitorInterval(String intervalSeconds);
+
+ /**
+ * Adds an AppenderComponent.
+ * @param assembler The AppenderComponentBuilder with all of its attributes and sub components set.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> add(AppenderComponentBuilder assembler);
+
+ /**
+ * Adds a CustomLevel component.
+ * @param assembler The CustomLevelComponentBuilder with all of its attributes set.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> add(CustomLevelComponentBuilder assembler);
+
+ /**
+ * Add a Logger component.
+ * @param assembler The LoggerComponentBuilder with all of its attributes and sub components set.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> add(LoggerComponentBuilder assembler);
+
+ /**
+ * Add the root Logger component.
+ * @param assembler The RootLoggerComponentBuilder with all of its attributes and sub components set.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> add(RootLoggerComponentBuilder assembler);
+
+ /**
+ * Add a Filter component.
+ * @param assembler the FilterComponentBuilder with all of its attributes and sub components set.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> add(FilterComponentBuilder assembler);
+
+ /**
+ * Add a Property key and value.
+ * @param key The property key.
+ * @param value The property value.
+ * @return this Assembler instance.
+ */
+ ConfigurationBuilder<T> addProperty(String key, String value);
+
+ /**
+ * Returns an Assembler for creating Appenders.
+ * @param name The name of the Appender.
+ * @param pluginName The Plugin type of the Appender.
+ * @return the AppenderComponentBuilder.
+ */
+ AppenderComponentBuilder newAppender(String name, String pluginName);
+
+
+ /**
+ * Returns an Assembler for creating AppenderRefs.
+ * @param ref The name of the Appender being referenced.
+ * @return the AppenderRefComponentBuilder.
+ */
+ AppenderRefComponentBuilder newAppenderRef(String ref);
+
+ /**
+ * Returns an Assembler for creating generic components.
+ * @param name The name of the component (may be null).
+ * @param pluginName The Plugin type of the component.
+ * @return The ComponentBuilder.
+ */
+ @SuppressWarnings("rawtypes")
+ ComponentBuilder newComponent(String name, String pluginName);
+
+ /**
+ * Returns an Assembler for creating generic components.
+ * @param name The name of the component (may be null).
+ * @param pluginName The Plugin type of the component.
+ * @param value The value of the component.
+ * @return The ComponentBuilder.
+ */
+ @SuppressWarnings("rawtypes")
+ ComponentBuilder<ComponentBuilder> newComponent(String name, String pluginName, String value);
+
+ /**
+ * Returns an Asssembler for creating CustomLevels
+ * @param name The name of the custom level.
+ * @param level The integer value to be assigned to the level.
+ * @return The CustomLevelComponentBuilder.
+ */
+ CustomLevelComponentBuilder newCustomLevel(String name, int level);
+
+ /**
+ * Returns an Asssembler for creating Filters.
+ * @param pluginName The Plugin type of the Filter.
+ * @param onMatch "ACCEPT", "DENY", or "NEUTRAL"
+ * @param onMisMatch "ACCEPT", "DENY", or "NEUTRAL"
+ * @return The FilterComponentBuilder.
+ */
+ FilterComponentBuilder newFilter(String pluginName, Filter.Result onMatch, Filter.Result onMisMatch);
+
+ /**
+ * Returns an Asssembler for creating Filters.
+ * @param pluginName The Plugin type of the Filter.
+ * @param onMatch "ACCEPT", "DENY", or "NEUTRAL"
+ * @param onMisMatch "ACCEPT", "DENY", or "NEUTRAL"
+ * @return The FilterComponentBuilder.
+ */
+ FilterComponentBuilder newFilter(String pluginName, String onMatch, String onMisMatch);
+
+ /**
+ * Returns an Assembler for creating Layouts.
+ * @param type The Plugin type of the Layout.
+ * @return The LayoutComponentBuilder.
+ */
+ LayoutComponentBuilder newLayout(String pluginName);
+
+ /**
+ * Returns an Assembler for creating Loggers.
+ * @param name The name of the Logger.
+ * @param level The logging Level to be assigned to the Logger.
+ * @return The LoggerComponentBuilder.
+ */
+ LoggerComponentBuilder newLogger(String name, Level level);
+
+
+ /**
+ * Returns an Assembler for creating Loggers.
+ * @param name The name of the Logger.
+ * @param level The logging Level to be assigned to the Logger.
+ * @return The LoggerComponentBuilder.
+ */
+ LoggerComponentBuilder newLogger(String name, String level);
+
+ /**
+ * Returns an Assembler for creating Async Loggers.
+ * @param name The name of the Logger.
+ * @param level The logging Level to be assigned to the Logger.
+ * @return The LoggerComponentBuilder.
+ */
+ LoggerComponentBuilder newAsyncLogger(String name, Level level);
+
+ /**
+ * Returns an Assembler for creating Async Loggers.
+ * @param name The name of the Logger.
+ * @param level The logging Level to be assigned to the Logger.
+ * @return The LoggerComponentBuilder.
+ */
+ LoggerComponentBuilder newAsyncLogger(String name, String level);
+
+ /**
+ * Returns an Assembler for creating the root Logger.
+ * @param level The logging Level to be assigned to the root Logger.
+ * @return The RootLoggerComponentBuilder.
+ */
+ RootLoggerComponentBuilder newRootLogger(Level level);
+
+ /**
+ * Returns an Assembler for creating the root Logger.
+ * @param level The logging Level to be assigned to the root Logger.
+ * @return The RootLoggerComponentBuilder.
+ */
+ RootLoggerComponentBuilder newRootLogger(String level);
+
+
+ /**
+ * Returns an Assembler for creating the async root Logger.
+ * @param level The logging Level to be assigned to the root Logger.
+ * @return The RootLoggerComponentBuilder.
+ */
+ RootLoggerComponentBuilder newAsyncRootLogger(Level level);
+
+
+ /**
+ * Returns an Assembler for creating the async root Logger.
+ * @param level The logging Level to be assigned to the root Logger.
+ * @return The RootLoggerComponentBuilder.
+ */
+ RootLoggerComponentBuilder newAsyncRootLogger(String level);
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationBuilderFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationBuilderFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationBuilderFactory.java
new file mode 100644
index 0000000..13fa3b5
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/ConfigurationBuilderFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+package org.apache.logging.log4j.core.config.assembler.api;
+
+import org.apache.logging.log4j.core.config.assembler.impl.AssembledConfiguration;
+import org.apache.logging.log4j.core.config.assembler.impl.DefaultConfigurationBuilder;
+
+/**
+ *
+ */
+public class ConfigurationBuilderFactory {
+
+ /**
+ * Returns the default ConfigurationBuilder to construct Log4j configurations.
+ * @return The ConfigurationBuilder.
+ */
+ public static ConfigurationBuilder<AssembledConfiguration> newConfigurationBuilder() {
+ return new DefaultConfigurationBuilder<>();
+ }
+
+ public static <T extends AssembledConfiguration> ConfigurationBuilder<T> newConfigurationBuilder(Class<T> clazz) {
+ return new DefaultConfigurationBuilder<T>(clazz);
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CustomLevelAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CustomLevelAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CustomLevelAssembler.java
deleted file mode 100644
index c37ab9e..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CustomLevelAssembler.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-/**
- * Assembler for constructing Filters
- */
-public interface CustomLevelAssembler extends ComponentAssembler<CustomLevelAssembler> {
-
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CustomLevelComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CustomLevelComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CustomLevelComponentBuilder.java
new file mode 100644
index 0000000..120e026
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/CustomLevelComponentBuilder.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+/**
+ * Assembler for constructing Filters
+ */
+public interface CustomLevelComponentBuilder extends ComponentBuilder<CustomLevelComponentBuilder> {
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/FilterAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/FilterAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/FilterAssembler.java
deleted file mode 100644
index cf95228..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/FilterAssembler.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-/**
- * Assembler for constructing Filters
- */
-public interface FilterAssembler extends ComponentAssembler<FilterAssembler> {
-
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/FilterComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/FilterComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/FilterComponentBuilder.java
new file mode 100644
index 0000000..2526963
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/FilterComponentBuilder.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+/**
+ * Assembler for constructing Filters
+ */
+public interface FilterComponentBuilder extends ComponentBuilder<FilterComponentBuilder> {
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LayoutAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LayoutAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LayoutAssembler.java
deleted file mode 100644
index 954ea51..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LayoutAssembler.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-/**
- * Assembler for constructing Layouts
- */
-public interface LayoutAssembler extends ComponentAssembler<LayoutAssembler> {
-
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LayoutComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LayoutComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LayoutComponentBuilder.java
new file mode 100644
index 0000000..b04f9c3
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LayoutComponentBuilder.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+/**
+ * Assembler for constructing Layouts
+ */
+public interface LayoutComponentBuilder extends ComponentBuilder<LayoutComponentBuilder> {
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LoggerAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LoggerAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LoggerAssembler.java
deleted file mode 100644
index fd6b673..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LoggerAssembler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-/**
- * Assembler for constructing Loggers.
- */
-public interface LoggerAssembler extends ComponentAssembler<LoggerAssembler> {
-
- /**
- * Add an Appender reference to the Logger component.
- * @param assembler The AppenderRefAssembler with all of its attributes and sub-components set.
- * @return this Assembler.
- */
- LoggerAssembler add(AppenderRefAssembler assembler);
-
- /**
- * Add a Filter to the Logger component.
- * @param assembler The FilterAssembler with all of its attributes and sub-components set.
- * @return this Assembler.
- */
- LoggerAssembler add(FilterAssembler assembler);
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LoggerComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LoggerComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LoggerComponentBuilder.java
new file mode 100644
index 0000000..628636c
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/LoggerComponentBuilder.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+/**
+ * Assembler for constructing Loggers.
+ */
+public interface LoggerComponentBuilder extends ComponentBuilder<LoggerComponentBuilder> {
+
+ /**
+ * Add an Appender reference to the Logger component.
+ * @param assembler The AppenderRefComponentBuilder with all of its attributes and sub-components set.
+ * @return this Assembler.
+ */
+ LoggerComponentBuilder add(AppenderRefComponentBuilder assembler);
+
+ /**
+ * Add a Filter to the Logger component.
+ * @param assembler The FilterComponentBuilder with all of its attributes and sub-components set.
+ * @return this Assembler.
+ */
+ LoggerComponentBuilder add(FilterComponentBuilder assembler);
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/RootLoggerAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/RootLoggerAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/RootLoggerAssembler.java
deleted file mode 100644
index dfd01ba..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/RootLoggerAssembler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.api;
-
-/**
- * Assembler for constructing the root Logger.
- */
-public interface RootLoggerAssembler extends ComponentAssembler<RootLoggerAssembler> {
-
- /**
- * Add an Appender reference to the Logger component.
- * @param assembler The AppenderRefAssembler with all of its attributes and sub-components set.
- * @return this Assembler.
- */
- RootLoggerAssembler add(AppenderRefAssembler assembler);
-
- /**
- * Add a Filter to the Logger component.
- * @param assembler The FilterAssembler with all of its attributes and sub-components set.
- * @return this Assembler.
- */
- RootLoggerAssembler add(FilterAssembler assembler);
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/RootLoggerComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/RootLoggerComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/RootLoggerComponentBuilder.java
new file mode 100644
index 0000000..edf12b4
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/api/RootLoggerComponentBuilder.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.api;
+
+/**
+ * Assembler for constructing the root Logger.
+ */
+public interface RootLoggerComponentBuilder extends ComponentBuilder<RootLoggerComponentBuilder> {
+
+ /**
+ * Add an Appender reference to the Logger component.
+ * @param assembler The AppenderRefComponentBuilder with all of its attributes and sub-components set.
+ * @return this Assembler.
+ */
+ RootLoggerComponentBuilder add(AppenderRefComponentBuilder assembler);
+
+ /**
+ * Add a Filter to the Logger component.
+ * @param assembler The FilterComponentBuilder with all of its attributes and sub-components set.
+ * @return this Assembler.
+ */
+ RootLoggerComponentBuilder add(FilterComponentBuilder assembler);
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderAssembler.java
deleted file mode 100644
index be94a88..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderAssembler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.impl;
-
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.assembler.api.AppenderAssembler;
-import org.apache.logging.log4j.core.config.assembler.api.FilterAssembler;
-import org.apache.logging.log4j.core.config.assembler.api.LayoutAssembler;
-
-/**
- * Holds the Appender Component attributes and subcomponents.
- */
-public class DefaultAppenderAssembler extends DefaultComponentAssembler<AppenderAssembler> implements AppenderAssembler {
-
- public DefaultAppenderAssembler(DefaultConfigurationAssembler<? extends Configuration> assembler, String name, String type) {
- super(assembler, name, type);
- }
-
- @Override
- public AppenderAssembler add(LayoutAssembler assembler) {
- addComponent(assembler);
- return this;
- }
-
- @Override
- public AppenderAssembler add(FilterAssembler assembler) {
- addComponent(assembler);
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderComponentBuilder.java
new file mode 100644
index 0000000..683cab5
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderComponentBuilder.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.impl;
+
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.assembler.api.AppenderComponentBuilder;
+import org.apache.logging.log4j.core.config.assembler.api.FilterComponentBuilder;
+import org.apache.logging.log4j.core.config.assembler.api.LayoutComponentBuilder;
+
+/**
+ * Holds the Appender Component attributes and subcomponents.
+ */
+public class DefaultAppenderComponentBuilder extends DefaultComponentBuilder<AppenderComponentBuilder> implements
+ AppenderComponentBuilder {
+
+ public DefaultAppenderComponentBuilder(DefaultConfigurationBuilder<? extends Configuration> assembler, String name,
+ String type) {
+ super(assembler, name, type);
+ }
+
+ @Override
+ public AppenderComponentBuilder add(LayoutComponentBuilder assembler) {
+ addComponent(assembler);
+ return this;
+ }
+
+ @Override
+ public AppenderComponentBuilder add(FilterComponentBuilder assembler) {
+ addComponent(assembler);
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderRefAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderRefAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderRefAssembler.java
deleted file mode 100644
index b91aa82..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderRefAssembler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.impl;
-
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.assembler.api.AppenderRefAssembler;
-import org.apache.logging.log4j.core.config.assembler.api.FilterAssembler;
-
-/**
- * Holds the Appender Component attributes and subcomponents.
- */
-public class DefaultAppenderRefAssembler extends DefaultComponentAssembler<AppenderRefAssembler> implements AppenderRefAssembler {
-
- public DefaultAppenderRefAssembler(DefaultConfigurationAssembler<? extends Configuration> assembler, String ref) {
- super(assembler, "AppenderRef");
- addAttribute("ref", ref);
- }
-
-
- @Override
- public AppenderRefAssembler add(FilterAssembler assembler) {
- addComponent(assembler);
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderRefComponentBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderRefComponentBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderRefComponentBuilder.java
new file mode 100644
index 0000000..609a434
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultAppenderRefComponentBuilder.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.config.assembler.impl;
+
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.assembler.api.AppenderRefComponentBuilder;
+import org.apache.logging.log4j.core.config.assembler.api.FilterComponentBuilder;
+
+/**
+ * Holds the Appender Component attributes and subcomponents.
+ */
+public class DefaultAppenderRefComponentBuilder extends DefaultComponentBuilder<AppenderRefComponentBuilder> implements
+ AppenderRefComponentBuilder {
+
+ public DefaultAppenderRefComponentBuilder(DefaultConfigurationBuilder<? extends Configuration> assembler,
+ String ref) {
+ super(assembler, "AppenderRef");
+ addAttribute("ref", ref);
+ }
+
+
+ @Override
+ public AppenderRefComponentBuilder add(FilterComponentBuilder assembler) {
+ addComponent(assembler);
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20fd2273/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultComponentAssembler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultComponentAssembler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultComponentAssembler.java
deleted file mode 100644
index a8851bd..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/assembler/impl/DefaultComponentAssembler.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.config.assembler.impl;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.assembler.api.Component;
-import org.apache.logging.log4j.core.config.assembler.api.ComponentAssembler;
-import org.apache.logging.log4j.core.config.assembler.api.ConfigurationAssembler;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Generic component that captures attributes and Components in preparation for assembling the Appender's
- * Component.
- */
-@SuppressWarnings("rawtypes")
-public class DefaultComponentAssembler<T extends ComponentAssembler> implements ComponentAssembler<T> {
-
- private ConfigurationAssembler<? extends Configuration> assembler;
- private String type;
- private Map<String, String> attributes = new HashMap<>();
- private List<Component> components = new ArrayList<>();
- private String name;
- private String value;
-
- public DefaultComponentAssembler(ConfigurationAssembler<? extends Configuration> assembler, String type) {
- this(assembler, null, type, null);
- }
-
- public DefaultComponentAssembler(ConfigurationAssembler<? extends Configuration> assembler, String name, String type) {
- this(assembler, name, type, null);
- }
-
- public DefaultComponentAssembler(ConfigurationAssembler<? extends Configuration> assembler, String name, String type, String value) {
- this.type = type;
- this.assembler = assembler;
- this.name = name;
- this.value = value;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T addAttribute(String key, Level level) {
- attributes.put(key, level.toString());
- return (T) this;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T addAttribute(String key, String value) {
- attributes.put(key, value);
- return (T) this;
- }
-
-
- @Override
- @SuppressWarnings("unchecked")
- public T addAttribute(String key, Enum<?> value) {
- attributes.put(key, value.name());
- return (T) this;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T addAttribute(String key, int value) {
- attributes.put(key, Integer.toString(value));
- return (T) this;
- }
-
-
- @Override
- @SuppressWarnings("unchecked")
- public T addAttribute(String key, boolean value) {
- attributes.put(key, Boolean.toString(value));
- return (T) this;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T addAttribute(String key, Object value) {
- attributes.put(key, value.toString());
- return (T) this;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T addComponent(ComponentAssembler<?> assembler) {
- components.add(assembler.assemble());
- return (T) this;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public ConfigurationAssembler<? extends Configuration> getAssembler() {
- return assembler;
- }
-
- @Override
- public Component assemble() {
- Component component = new Component(type, name, value);
- component.getAttributes().putAll(attributes);
- component.getComponents().addAll(components);
- return component;
- }
-}