// Path: src/com/atsebak/embeddedlinuxjvm/localization/EmbeddedLinuxJVMBundle.java
// public final class EmbeddedLinuxJVMBundle {
// 
//     @NonNls
//     private static final String BUNDLE = "com.atsebak.embeddedlinuxjvm.localization.EmbeddedLinuxJVMBundle";
//     private static Reference<ResourceBundle> ourBundle;
// 
//     /**
//      * Private Constructor
//      */
//     private EmbeddedLinuxJVMBundle() {
//     }
// 
//     /**
//      * @param key
//      * @param params
//      * @return
//      */
//     public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
//         return BundleBase.message(getBundle(), key, params);
//     }
// 
//     /**
//      * @return
//      */
//     private static ResourceBundle getBundle() {
//         ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
//         if (bundle == null) {
//             bundle = ResourceBundle.getBundle(BUNDLE);
//             ourBundle = new SoftReference<ResourceBundle>(bundle);
//         }
//         return bundle;
//     }
// 
//     /**
//      * @param key The Key
//      * @return The Localized Text
//      */
//     public static String getString(@PropertyKey(resourceBundle = BUNDLE) final String key) {
//         return getBundle().getString(key);
//     }
// }
// 
// Path: src/com/atsebak/embeddedlinuxjvm/runner/conf/EmbeddedLinuxJVMRunConfiguration.java
// public class EmbeddedLinuxJVMRunConfiguration extends LocatableConfigurationBase implements RunProfileWithCompileBeforeLaunchOption {
//     private EmbeddedLinuxJVMRunConfigurationRunnerParameters embeddedLinuxJVMRunConfigurationRunnerParameters = new EmbeddedLinuxJVMRunConfigurationRunnerParameters();
// 
//     /**
//      * Run Configurations To Run App
//      *
//      * @param project
//      * @param factory
//      */
//     protected EmbeddedLinuxJVMRunConfiguration(final Project project, final ConfigurationFactory factory, String name) {
//         super(project, factory, name);
//     }
// 
//     /**
//      * Settings Editor
//      * @return
//      */
//     @NotNull
//     @Override
//     public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
//         return new RunConfigurationEditor(getProject());
//     }
// 
//     /**
//      * Creates new running paramters instance
//      * @return
//      */
//     protected EmbeddedLinuxJVMRunConfigurationRunnerParameters createRunnerParametersInstance() {
//         return new EmbeddedLinuxJVMRunConfigurationRunnerParameters();
//     }
// 
// 
//     /**
//      * Read External
//      * @param element
//      * @throws InvalidDataException
//      */
//     @Override
//     public void readExternal(Element element) throws InvalidDataException {
//         super.readExternal(element);
//         embeddedLinuxJVMRunConfigurationRunnerParameters = createRunnerParametersInstance();
//         XmlSerializer.deserializeInto(embeddedLinuxJVMRunConfigurationRunnerParameters, element);
//     }
// 
//     /**
//      * Write External
//      * @param element
//      * @throws WriteExternalException
//      */
//     @Override
//     public void writeExternal(Element element) throws WriteExternalException {
//         super.writeExternal(element);
//         if (embeddedLinuxJVMRunConfigurationRunnerParameters != null) {
//             XmlSerializer.serializeInto(embeddedLinuxJVMRunConfigurationRunnerParameters, element);
//         }
//     }
// 
//     /**
//      * Gets the state of the execution environment
//      * @param executor
//      * @param env
//      * @return
//      * @throws ExecutionException
//      */
//     @Override
//     public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
//         return new AppCommandLineState(env, this);
//     }
// 
// 
//     /**
//      * Checks weather all the supplied paramters from the user are correct
//      * @throws RuntimeConfigurationException
//      */
//     @Override
//     public void checkConfiguration() throws RuntimeConfigurationException {
//         EmbeddedLinuxJVMRunnerValidator.checkJavaSettings(this);
//         EmbeddedLinuxJVMRunnerValidator.checkEmbeddedSettings(getRunnerParameters());
//     }
// 
//     /**
//      * Gets runner paramters instance
//      * @return
//      */
//     public EmbeddedLinuxJVMRunConfigurationRunnerParameters getRunnerParameters() {
//         return embeddedLinuxJVMRunConfigurationRunnerParameters;
//     }
// 
//     /**
//      * Gets modules
//      *
//      * @return
//      */
//     @NotNull
//     @Override
//     public Module[] getModules() {
//         return new Module[0];
//     }
// }


import com.atsebak.embeddedlinuxjvm.localization.EmbeddedLinuxJVMBundle;
import com.atsebak.embeddedlinuxjvm.runner.conf.EmbeddedLinuxJVMRunConfiguration;
import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.configurations.JavaRunConfigurationModule;
import com.intellij.execution.configurations.RuntimeConfigurationException;
import com.intellij.execution.configurations.RuntimeConfigurationWarning;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiClass;
package com.atsebak.embeddedlinuxjvm.runner.data;



public class EmbeddedLinuxJVMRunnerValidator {
    /**
     * Validates the PI Settings are Entered Correctly
     *
     * @param rp
     * @throws RuntimeConfigurationException
     */
    public static void checkEmbeddedSettings(EmbeddedLinuxJVMRunConfigurationRunnerParameters rp) throws RuntimeConfigurationWarning {
        if (StringUtil.isEmptyOrSpaces(rp.getHostname())) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.hostname"));
        }
        if (StringUtil.isEmptyOrSpaces(rp.getPort())) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.port"));
        }
        if (StringUtil.isEmptyOrSpaces(rp.getUsername())) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.username"));
        }
        if (StringUtil.isEmptyOrSpaces(rp.getKeyPath()) && rp.isUsingKey()) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.key"));
        }
        if(StringUtil.isEmptyOrSpaces(String.valueOf(rp.getSshPort()))) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.sshport"));
        }
    }

    /**
     * Validates if the Java Settings are Entered Correctly
     *
     * @param configuration
     * @throws RuntimeConfigurationException
     */
// Path: src/com/atsebak/embeddedlinuxjvm/localization/EmbeddedLinuxJVMBundle.java
// public final class EmbeddedLinuxJVMBundle {
// 
//     @NonNls
//     private static final String BUNDLE = "com.atsebak.embeddedlinuxjvm.localization.EmbeddedLinuxJVMBundle";
//     private static Reference<ResourceBundle> ourBundle;
// 
//     /**
//      * Private Constructor
//      */
//     private EmbeddedLinuxJVMBundle() {
//     }
// 
//     /**
//      * @param key
//      * @param params
//      * @return
//      */
//     public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
//         return BundleBase.message(getBundle(), key, params);
//     }
// 
//     /**
//      * @return
//      */
//     private static ResourceBundle getBundle() {
//         ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
//         if (bundle == null) {
//             bundle = ResourceBundle.getBundle(BUNDLE);
//             ourBundle = new SoftReference<ResourceBundle>(bundle);
//         }
//         return bundle;
//     }
// 
//     /**
//      * @param key The Key
//      * @return The Localized Text
//      */
//     public static String getString(@PropertyKey(resourceBundle = BUNDLE) final String key) {
//         return getBundle().getString(key);
//     }
// }
// 
// Path: src/com/atsebak/embeddedlinuxjvm/runner/conf/EmbeddedLinuxJVMRunConfiguration.java
// public class EmbeddedLinuxJVMRunConfiguration extends LocatableConfigurationBase implements RunProfileWithCompileBeforeLaunchOption {
//     private EmbeddedLinuxJVMRunConfigurationRunnerParameters embeddedLinuxJVMRunConfigurationRunnerParameters = new EmbeddedLinuxJVMRunConfigurationRunnerParameters();
// 
//     /**
//      * Run Configurations To Run App
//      *
//      * @param project
//      * @param factory
//      */
//     protected EmbeddedLinuxJVMRunConfiguration(final Project project, final ConfigurationFactory factory, String name) {
//         super(project, factory, name);
//     }
// 
//     /**
//      * Settings Editor
//      * @return
//      */
//     @NotNull
//     @Override
//     public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
//         return new RunConfigurationEditor(getProject());
//     }
// 
//     /**
//      * Creates new running paramters instance
//      * @return
//      */
//     protected EmbeddedLinuxJVMRunConfigurationRunnerParameters createRunnerParametersInstance() {
//         return new EmbeddedLinuxJVMRunConfigurationRunnerParameters();
//     }
// 
// 
//     /**
//      * Read External
//      * @param element
//      * @throws InvalidDataException
//      */
//     @Override
//     public void readExternal(Element element) throws InvalidDataException {
//         super.readExternal(element);
//         embeddedLinuxJVMRunConfigurationRunnerParameters = createRunnerParametersInstance();
//         XmlSerializer.deserializeInto(embeddedLinuxJVMRunConfigurationRunnerParameters, element);
//     }
// 
//     /**
//      * Write External
//      * @param element
//      * @throws WriteExternalException
//      */
//     @Override
//     public void writeExternal(Element element) throws WriteExternalException {
//         super.writeExternal(element);
//         if (embeddedLinuxJVMRunConfigurationRunnerParameters != null) {
//             XmlSerializer.serializeInto(embeddedLinuxJVMRunConfigurationRunnerParameters, element);
//         }
//     }
// 
//     /**
//      * Gets the state of the execution environment
//      * @param executor
//      * @param env
//      * @return
//      * @throws ExecutionException
//      */
//     @Override
//     public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
//         return new AppCommandLineState(env, this);
//     }
// 
// 
//     /**
//      * Checks weather all the supplied paramters from the user are correct
//      * @throws RuntimeConfigurationException
//      */
//     @Override
//     public void checkConfiguration() throws RuntimeConfigurationException {
//         EmbeddedLinuxJVMRunnerValidator.checkJavaSettings(this);
//         EmbeddedLinuxJVMRunnerValidator.checkEmbeddedSettings(getRunnerParameters());
//     }
// 
//     /**
//      * Gets runner paramters instance
//      * @return
//      */
//     public EmbeddedLinuxJVMRunConfigurationRunnerParameters getRunnerParameters() {
//         return embeddedLinuxJVMRunConfigurationRunnerParameters;
//     }
// 
//     /**
//      * Gets modules
//      *
//      * @return
//      */
//     @NotNull
//     @Override
//     public Module[] getModules() {
//         return new Module[0];
//     }
// }


// Path: src/com/atsebak/embeddedlinuxjvm/runner/data/EmbeddedLinuxJVMRunnerValidator.java
import com.atsebak.embeddedlinuxjvm.localization.EmbeddedLinuxJVMBundle;
import com.atsebak.embeddedlinuxjvm.runner.conf.EmbeddedLinuxJVMRunConfiguration;
import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.configurations.JavaRunConfigurationModule;
import com.intellij.execution.configurations.RuntimeConfigurationException;
import com.intellij.execution.configurations.RuntimeConfigurationWarning;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiClass;

package com.atsebak.embeddedlinuxjvm.runner.data;



public class EmbeddedLinuxJVMRunnerValidator {
    /**
     * Validates the PI Settings are Entered Correctly
     *
     * @param rp
     * @throws RuntimeConfigurationException
     */
    public static void checkEmbeddedSettings(EmbeddedLinuxJVMRunConfigurationRunnerParameters rp) throws RuntimeConfigurationWarning {
        if (StringUtil.isEmptyOrSpaces(rp.getHostname())) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.hostname"));
        }
        if (StringUtil.isEmptyOrSpaces(rp.getPort())) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.port"));
        }
        if (StringUtil.isEmptyOrSpaces(rp.getUsername())) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.username"));
        }
        if (StringUtil.isEmptyOrSpaces(rp.getKeyPath()) && rp.isUsingKey()) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.key"));
        }
        if(StringUtil.isEmptyOrSpaces(String.valueOf(rp.getSshPort()))) {
            throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.sshport"));
        }
    }

    /**
     * Validates if the Java Settings are Entered Correctly
     *
     * @param configuration
     * @throws RuntimeConfigurationException
     */
    public static void checkJavaSettings(EmbeddedLinuxJVMRunConfiguration configuration) throws RuntimeConfigurationException {