// Path: noark-extraction-validator/src/main/java/com/documaster/validator/config/delegates/Delegate.java
// public interface Delegate {
// 
// 	void validate() throws ParameterException;
// }
// 
// Path: noark-extraction-validator/src/main/java/com/documaster/validator/config/properties/InternalProperties.java
// public abstract class InternalProperties extends CompositeConfiguration {
// 
// 	public InternalProperties(List<String> propertyFiles) throws IOException, ConfigurationException {
// 
// 		if (propertyFiles == null || propertyFiles.isEmpty()) {
// 
// 			throw new IllegalArgumentException("Property files not specified.");
// 		}
// 
// 		for (String file : propertyFiles) {
// 
// 			try (InputStream is = getClass().getClassLoader().getResourceAsStream(file)) {
// 
// 				PropertiesConfiguration configuration = new PropertiesConfiguration();
// 				configuration.load(is);
// 
// 				addConfiguration(configuration);
// 			}
// 		}
// 	}
// }


import com.documaster.validator.config.delegates.Delegate;
import com.documaster.validator.config.properties.InternalProperties;
import org.apache.commons.lang.StringUtils;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.ParameterDescription;
import com.beust.jcommander.ParameterException;
import com.beust.jcommander.ParametersDelegate;
/**
 * Noark Extraction Validator
 * Copyright (C) 2016, Documaster AS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.documaster.validator.config.commands;



public abstract class Command<T extends InternalProperties> {

	private JCommander argParser;

	public Command() {

	}

	public Command(JCommander argParser) {

		this.argParser = argParser;
	}

	/**
	 * Validates all {@link ParametersDelegate}s in this {@link Command}.
	 *
	 * @throws ParameterException
	 * 		if the validation fails
	 */
	public void validate() throws ParameterException {

		for (Field field : getClass().getDeclaredFields()) {
// Path: noark-extraction-validator/src/main/java/com/documaster/validator/config/delegates/Delegate.java
// public interface Delegate {
// 
// 	void validate() throws ParameterException;
// }
// 
// Path: noark-extraction-validator/src/main/java/com/documaster/validator/config/properties/InternalProperties.java
// public abstract class InternalProperties extends CompositeConfiguration {
// 
// 	public InternalProperties(List<String> propertyFiles) throws IOException, ConfigurationException {
// 
// 		if (propertyFiles == null || propertyFiles.isEmpty()) {
// 
// 			throw new IllegalArgumentException("Property files not specified.");
// 		}
// 
// 		for (String file : propertyFiles) {
// 
// 			try (InputStream is = getClass().getClassLoader().getResourceAsStream(file)) {
// 
// 				PropertiesConfiguration configuration = new PropertiesConfiguration();
// 				configuration.load(is);
// 
// 				addConfiguration(configuration);
// 			}
// 		}
// 	}
// }


// Path: noark-extraction-validator/src/main/java/com/documaster/validator/config/commands/Command.java
import com.documaster.validator.config.delegates.Delegate;
import com.documaster.validator.config.properties.InternalProperties;
import org.apache.commons.lang.StringUtils;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.ParameterDescription;
import com.beust.jcommander.ParameterException;
import com.beust.jcommander.ParametersDelegate;

/**
 * Noark Extraction Validator
 * Copyright (C) 2016, Documaster AS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.documaster.validator.config.commands;



public abstract class Command<T extends InternalProperties> {

	private JCommander argParser;

	public Command() {

	}

	public Command(JCommander argParser) {

		this.argParser = argParser;
	}

	/**
	 * Validates all {@link ParametersDelegate}s in this {@link Command}.
	 *
	 * @throws ParameterException
	 * 		if the validation fails
	 */
	public void validate() throws ParameterException {

		for (Field field : getClass().getDeclaredFields()) {
			if (field.getAnnotation(ParametersDelegate.class) != null && Delegate.class