All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.swarm.config.logging.LoggingProfile Maven / Gradle / Ivy

package org.wildfly.swarm.config.logging;

import org.wildfly.config.runtime.Implicit;
import org.wildfly.config.runtime.ResourceType;
import org.wildfly.config.runtime.ModelNodeBinding;
import java.util.List;
import org.wildfly.config.runtime.Subresource;
/**
 * The configuration of the logging subsystem.
 */
@ResourceType("logging-profile")
public class LoggingProfile {

	private String key;
	private LoggingProfileResources subresources = new LoggingProfileResources();
	private RootLogger rootLogger;

	public LoggingProfile(String key) {
		this.key = key;
	}

	public String getKey() {
		return this.key;
	}

	public LoggingProfileResources subresources() {
		return this.subresources;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.PeriodicRotatingFileHandler objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.PeriodicRotatingFileHandler objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile periodicRotatingFileHandlers(
			List value) {
		this.subresources.periodicRotatingFileHandlers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.PeriodicRotatingFileHandler object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.PeriodicRotatingFileHandler to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile periodicRotatingFileHandler(
			PeriodicRotatingFileHandler value) {
		this.subresources.periodicRotatingFileHandlers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.CustomFormatter objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.CustomFormatter objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile customFormatters(
			List value) {
		this.subresources.customFormatters.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.CustomFormatter object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.CustomFormatter to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile customFormatter(CustomFormatter value) {
		this.subresources.customFormatters.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.PeriodicSizeRotatingFileHandler objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.PeriodicSizeRotatingFileHandler objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile periodicSizeRotatingFileHandlers(
			List value) {
		this.subresources.periodicSizeRotatingFileHandlers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.PeriodicSizeRotatingFileHandler object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.PeriodicSizeRotatingFileHandler to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile periodicSizeRotatingFileHandler(
			PeriodicSizeRotatingFileHandler value) {
		this.subresources.periodicSizeRotatingFileHandlers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.ConsoleHandler objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.ConsoleHandler objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile consoleHandlers(
			List value) {
		this.subresources.consoleHandlers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.ConsoleHandler object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.ConsoleHandler to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile consoleHandler(ConsoleHandler value) {
		this.subresources.consoleHandlers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.Logger objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.Logger objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile loggers(
			List value) {
		this.subresources.loggers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.Logger object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.Logger to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile logger(Logger value) {
		this.subresources.loggers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.AsyncHandler objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.AsyncHandler objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile asyncHandlers(
			List value) {
		this.subresources.asyncHandlers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.AsyncHandler object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.AsyncHandler to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile asyncHandler(AsyncHandler value) {
		this.subresources.asyncHandlers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.FileHandler objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.FileHandler objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile fileHandlers(
			List value) {
		this.subresources.fileHandlers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.FileHandler object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.FileHandler to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile fileHandler(FileHandler value) {
		this.subresources.fileHandlers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.LogFile objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.LogFile objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile logFiles(
			List value) {
		this.subresources.logFiles.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.LogFile object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.LogFile to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile logFile(LogFile value) {
		this.subresources.logFiles.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.PatternFormatter objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.PatternFormatter objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile patternFormatters(
			List value) {
		this.subresources.patternFormatters.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.PatternFormatter object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.PatternFormatter to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile patternFormatter(PatternFormatter value) {
		this.subresources.patternFormatters.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.SizeRotatingFileHandler objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.SizeRotatingFileHandler objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile sizeRotatingFileHandlers(
			List value) {
		this.subresources.sizeRotatingFileHandlers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.SizeRotatingFileHandler object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.SizeRotatingFileHandler to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile sizeRotatingFileHandler(SizeRotatingFileHandler value) {
		this.subresources.sizeRotatingFileHandlers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.SyslogHandler objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.SyslogHandler objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile syslogHandlers(
			List value) {
		this.subresources.syslogHandlers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.SyslogHandler object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.SyslogHandler to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile syslogHandler(SyslogHandler value) {
		this.subresources.syslogHandlers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add all org.wildfly.swarm.config.logging.CustomHandler objects to this subresource
	 * @return this
	 * @param value List of org.wildfly.swarm.config.logging.CustomHandler objects.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile customHandlers(
			List value) {
		this.subresources.customHandlers.addAll(value);
		return (LoggingProfile) this;
	}

	/**
	 * Add the org.wildfly.swarm.config.logging.CustomHandler object to the list of subresources
	 * @param value The org.wildfly.swarm.config.logging.CustomHandler to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile customHandler(CustomHandler value) {
		this.subresources.customHandlers.add(value);
		return (LoggingProfile) this;
	}

	/**
	 * Child mutators for LoggingProfile
	 */
	public class LoggingProfileResources {
		/**
		 * Defines a handler which writes to a file, rotating the log after a time period derived from the given suffix string, which should be in a format understood by java.text.SimpleDateFormat.
		 */
		private List periodicRotatingFileHandlers = new java.util.ArrayList<>();
		/**
		 * A custom formatter to be used with handlers. Note that most log records are formatted in the printf format. Formatters may require invocation of the org.jboss.logmanager.ExtLogRecord#getFormattedMessage() for the message to be properly formatted.
		 */
		private List customFormatters = new java.util.ArrayList<>();
		/**
		 * Defines a handler which writes to a file, rotating the log after a time period derived from the given suffix string or after the size of the file grows beyond a certain point and keeping a fixed number of backups. The suffix should be in a format understood by the java.text.SimpleDateFormat. Any backups rotated by the suffix will not be purged during a size rotation.
		 */
		private List periodicSizeRotatingFileHandlers = new java.util.ArrayList<>();
		/**
		 * Defines a handler which writes to the console.
		 */
		private List consoleHandlers = new java.util.ArrayList<>();
		/**
		 * Defines a logger category.
		 */
		private List loggers = new java.util.ArrayList<>();
		/**
		 * Defines a handler which writes to the sub-handlers in an asynchronous thread. Used for handlers which introduce a substantial amount of lag.
		 */
		private List asyncHandlers = new java.util.ArrayList<>();
		/**
		 * Defines a handler which writes to a file.
		 */
		private List fileHandlers = new java.util.ArrayList<>();
		/**
		 * Log files that are available to be read.
		 */
		private List logFiles = new java.util.ArrayList<>();
		/**
		 * A pattern formatter to be used with handlers.
		 */
		private List patternFormatters = new java.util.ArrayList<>();
		/**
		 * Defines a handler which writes to a file, rotating the log after the size of the file grows beyond a certain point and keeping a fixed number of backups.
		 */
		private List sizeRotatingFileHandlers = new java.util.ArrayList<>();
		/**
		 * Defines a syslog handler.
		 */
		private List syslogHandlers = new java.util.ArrayList<>();
		/**
		 * Defines a custom logging handler. The custom handler must extend java.util.logging.Handler.
		 */
		private List customHandlers = new java.util.ArrayList<>();

		/**
		 * Get the list of org.wildfly.swarm.config.logging.PeriodicRotatingFileHandler resources
		 * @return the list of resources
		 */
		@Subresource
		public List periodicRotatingFileHandlers() {
			return this.periodicRotatingFileHandlers;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.CustomFormatter resources
		 * @return the list of resources
		 */
		@Subresource
		public List customFormatters() {
			return this.customFormatters;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.PeriodicSizeRotatingFileHandler resources
		 * @return the list of resources
		 */
		@Subresource
		public List periodicSizeRotatingFileHandlers() {
			return this.periodicSizeRotatingFileHandlers;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.ConsoleHandler resources
		 * @return the list of resources
		 */
		@Subresource
		public List consoleHandlers() {
			return this.consoleHandlers;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.Logger resources
		 * @return the list of resources
		 */
		@Subresource
		public List loggers() {
			return this.loggers;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.AsyncHandler resources
		 * @return the list of resources
		 */
		@Subresource
		public List asyncHandlers() {
			return this.asyncHandlers;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.FileHandler resources
		 * @return the list of resources
		 */
		@Subresource
		public List fileHandlers() {
			return this.fileHandlers;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.LogFile resources
		 * @return the list of resources
		 */
		@Subresource
		public List logFiles() {
			return this.logFiles;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.PatternFormatter resources
		 * @return the list of resources
		 */
		@Subresource
		public List patternFormatters() {
			return this.patternFormatters;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.SizeRotatingFileHandler resources
		 * @return the list of resources
		 */
		@Subresource
		public List sizeRotatingFileHandlers() {
			return this.sizeRotatingFileHandlers;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.SyslogHandler resources
		 * @return the list of resources
		 */
		@Subresource
		public List syslogHandlers() {
			return this.syslogHandlers;
		}

		/**
		 * Get the list of org.wildfly.swarm.config.logging.CustomHandler resources
		 * @return the list of resources
		 */
		@Subresource
		public List customHandlers() {
			return this.customHandlers;
		}
	}

	/**
	 * Defines the root logger for this log context.
	 */
	@Subresource
	public RootLogger rootLogger() {
		return this.rootLogger;
	}

	/**
	 * Defines the root logger for this log context.
	 */
	@SuppressWarnings("unchecked")
	public LoggingProfile rootLogger(RootLogger value) {
		this.rootLogger = value;
		return (LoggingProfile) this;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy