<commit_before>package org.csstudio.archive.rdb;

import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;

import org.apache.log4j.Logger;
import org.csstudio.apputil.args.ArgParser;
import org.csstudio.apputil.args.BooleanOption;
import org.csstudio.apputil.args.IntegerOption;
import org.csstudio.apputil.args.StringOption;
import org.csstudio.archive.rdb.engineconfig.SampleEngineConfig;
import org.csstudio.archive.rdb.engineconfig.SampleEngineHelper;
import org.csstudio.archive.rdb.engineconfig.XMLExport;
import org.csstudio.archive.rdb.engineconfig.XMLImport;
import org.csstudio.platform.logging.CentralLogger;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;

/** Eclipse Application to import engine configuration file into RDB.
 *  @author <NAME>
 */
public class EngineConfigImportApp implements IApplication
{
    /** "Main" Routine
     *  @see IApplication#start(IApplicationContext)
     */
    @SuppressWarnings("nls")
    public Object start(IApplicationContext context) throws Exception
    {
        // Handle command-line options
        final String args[] =
            (String []) context.getArguments().get("application.args");
        final ArgParser parser = new ArgParser();
        final BooleanOption help = new BooleanOption(parser,
                "-help", "show help");
        final StringOption filename = new StringOption(parser,
                "-config", "XML Engine config file", "");
        final StringOption  rdb_url = new StringOption(parser,
                "-rdb_url", "RDB URL", RDBArchivePreferences.getURL());
        final StringOption  user = new StringOption(parser,
                "-rdb_user", "RDB User", RDBArchivePreferences.getUser());
        final StringOption  password = new StringOption(parser,
                "-rdb_password", "RDB Password", RDBArchivePreferences.getPassword());
        final StringOption  engine_name = new StringOption(parser,
                "-engine", "Engine Name", "");
        final BooleanOption export = new BooleanOption(parser,
                "-export", "export configuration as XML");
        final StringOption  engine_description = new StringOption(parser,
                "-description", "Engine Description", "Imported");
        final StringOption  engine_host = new StringOption(parser,
                "-host", "Engine Host", "localhost");
        final IntegerOption engine_port = new IntegerOption(parser,
                "-port", "Engine Port", 4812);
        final BooleanOption replace_engine = new BooleanOption(parser,
                "-replace_engine", "Replace existing engine config, or stop?");
        final BooleanOption steal_channels = new BooleanOption(parser,
                "-steal_channels", "Steal channels that are already in other engine");<commit_msg>Describe arguments<commit_after>package org.csstudio.archive.rdb;

import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;

import org.apache.log4j.Logger;
import org.csstudio.apputil.args.ArgParser;
import org.csstudio.apputil.args.BooleanOption;
import org.csstudio.apputil.args.IntegerOption;
import org.csstudio.apputil.args.StringOption;
import org.csstudio.archive.rdb.engineconfig.SampleEngineConfig;
import org.csstudio.archive.rdb.engineconfig.SampleEngineHelper;
import org.csstudio.archive.rdb.engineconfig.XMLExport;
import org.csstudio.archive.rdb.engineconfig.XMLImport;
import org.csstudio.platform.logging.CentralLogger;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;

/** Eclipse Application to import engine configuration file into RDB.
 *  @author <NAME>
 */
public class EngineConfigImportApp implements IApplication
{
    /** "Main" Routine
     *  @see IApplication#start(IApplicationContext)
     */
    @SuppressWarnings("nls")
    public Object start(IApplicationContext context) throws Exception
    {
        // Handle command-line options
        final String args[] =
            (String []) context.getArguments().get("application.args");
        final ArgParser parser = new ArgParser();
        final BooleanOption help = new BooleanOption(parser,
                "-help", "show help");
        final StringOption filename = new StringOption(parser,
                "-config", "my_config.xml", "XML Engine config file", "");
        final StringOption  rdb_url = new StringOption(parser,
                "-rdb_url", "jdbc:...", "RDB URL", RDBArchivePreferences.getURL());
        final StringOption  user = new StringOption(parser,
                "-rdb_user", "user", "RDB User", RDBArchivePreferences.getUser());
        final StringOption  password = new StringOption(parser,
                "-rdb_password", "password", "RDB Password", RDBArchivePreferences.getPassword());
        final StringOption  engine_name = new StringOption(parser,
                "-engine", "my_engine", "Engine Name", "");
        final BooleanOption export = new BooleanOption(parser,
                "-export", "export configuration as XML");
        final StringOption  engine_description = new StringOption(parser,
                "-description", "'My Engine'", "Engine Description", "Imported");
        final StringOption  engine_host = new StringOption(parser,
                "-host", "my.host.org", "Engine Host", "localhost");
        final IntegerOption engine_port = new IntegerOption(parser,
                "-port", "4812", "Engine Port", 4812);
        final BooleanOption replace_engine = new BooleanOption(parser,
                "-replace_engine", "Replace existing engine config, or stop?");
        final BooleanOption steal_channels = new BooleanOption(parser,
                "-steal_channels", "Steal channels that are already in other engine");
{'fraction_non_alphanumeric': 0.1065587880874505, 'fraction_numerical': 0.0024100533654673783, 'mean_word_length': 3.332587621178225, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5112312', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1513, 'n_words': 385}