
package com.intellij.javaee.run.configuration;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.javaee.appServerIntegrations.ApplicationServer;
import com.intellij.javaee.run.localRun.ExecutableObjectStartupPolicy;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import consulo.javaee.bundle.JavaEEServerBundleType;

public abstract class J2EEConfigurationFactory
{
	public static J2EEConfigurationFactory getInstance()
	{
		return ServiceManager.getService(J2EEConfigurationFactory.class);
	}

	public abstract RunConfiguration createJ2EERunConfiguration(ConfigurationFactory factory,
			Project project,
			ServerModel serverSpecific,
			JavaEEServerBundleType integration,
			boolean isLocal,
			JavaCommandLineStartupPolicy startupPolicy);

	public abstract RunConfiguration createJ2EERunConfiguration(ConfigurationFactory factory,
			Project project,
			ServerModel serverSpecific,
			JavaEEServerBundleType integration,
			boolean isLocal,
			ExecutableObjectStartupPolicy startupPolicy);

	@Nullable
	public abstract RunnerAndConfigurationSettings createSettingsByFile(@Nonnull PsiFile psiFile, @Nonnull J2EEConfigurationType configurationType);

	public abstract RunnerAndConfigurationSettings addAppServerConfiguration(@Nonnull Project project, @Nonnull ConfigurationFactory type, @Nonnull ApplicationServer appServer);

	public abstract ConfigurationFactory createFactory(J2EEConfigurationType type, boolean isLocal, String name);

	public abstract boolean isConfigurationApplicable(@Nonnull J2EEConfigurationType type, @Nonnull Project project);
}
