List of usage examples for java.rmi.registry Registry REGISTRY_PORT
int REGISTRY_PORT
To view the source code for java.rmi.registry Registry REGISTRY_PORT.
Click Source Link
From source file:de.tudarmstadt.lt.lm.app.ListServices.java
/** * //from ww w.j a v a2 s . com */ public ListServices(String[] args) { Options opts = new Options(); opts.addOption(OptionBuilder.withLongOpt("help").withDescription("Display help message.").create("?")); opts.addOption(OptionBuilder.withLongOpt("host").withArgName("hostname").hasArg() .withDescription("specifies the hostname on which the rmi registry listens (default: localhost)") .create("h")); opts.addOption(OptionBuilder.withLongOpt("port").withArgName("port-number").hasArg().withDescription(String .format("specifies the port on which rmi registry listens (default: %d)", Registry.REGISTRY_PORT)) .create("p")); try { CommandLine cmd = new ExtendedGnuParser(true).parse(opts, args); if (cmd.hasOption("help")) CliUtils.print_usage_quit(StartLM.class.getSimpleName(), opts, null, 0); _port = Integer.parseInt(cmd.getOptionValue("port", String.valueOf(Registry.REGISTRY_PORT))); _host = cmd.getOptionValue("host", "localhost"); } catch (Exception e) { LOG.error("{}: {}", e.getClass().getSimpleName(), e.getMessage()); CliUtils.print_usage_quit(StartLM.class.getSimpleName(), opts, String.format("%s: %s%n", e.getClass().getSimpleName(), e.getMessage()), 1); } }
From source file:de.tudarmstadt.lt.lm.app.StartRMI.java
@SuppressWarnings("static-access") public StartRMI(String[] args) { LOG.warn("This main is only for convencience and might be deprectated soon. Consider using {}.", StartLM.class.getName()); Options opts = new Options(); opts.addOption(OptionBuilder.withLongOpt("help").withDescription("Display help message.").create("?")); opts.addOption(OptionBuilder.withLongOpt("port").withArgName("port-number").hasArg().withDescription(String .format("specifies the port on which rmi registry listens (default: %d)", Registry.REGISTRY_PORT)) .create("p")); try {/*from w w w .j av a 2s . com*/ CommandLine cmd = new ExtendedGnuParser(true).parse(opts, args); if (cmd.hasOption("help")) CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, null, 0); _port = Integer.parseInt(cmd.getOptionValue("port", String.valueOf(Registry.REGISTRY_PORT))); } catch (Exception e) { LOG.error("{}: {}", e.getClass().getSimpleName(), e.getMessage()); CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, String.format("%s: %s%n", e.getClass().getSimpleName(), e.getMessage()), 1); } }
From source file:de.tudarmstadt.lt.lm.app.NgramProbs.java
/** * /* w w w. jav a2s.c o m*/ */ @SuppressWarnings("static-access") public NgramProbs(String args[]) { Options opts = new Options(); opts.addOption(new Option("?", "help", false, "display this message")); opts.addOption(OptionBuilder.withLongOpt("port").withArgName("port-number").hasArg() .withDescription( String.format("Specifies the port on which the rmi registry listens (default: %d).", Registry.REGISTRY_PORT)) .create("p")); opts.addOption(OptionBuilder.withLongOpt("host").withArgName("hostname").hasArg() .withDescription("Specifies the hostname on which the rmi registry listens (default: localhost).") .create("h")); opts.addOption(OptionBuilder.withLongOpt("file").withArgName("name").hasArg().withDescription( "Specify the file or directory that contains '.txt' with one ngram per line. Specify '-' to pipe from stdin. (default: '-').") .create("f")); opts.addOption(OptionBuilder.withLongOpt("out").withArgName("name").hasArg() .withDescription("Specify the output file. Specify '-' to use stdout. (default: '-').") .create("o")); opts.addOption(OptionBuilder.withLongOpt("name").withArgName("identifier").isRequired().hasArg() .withDescription("Specify the name of the language model provider that you want to connect to.") .create("i")); try { CommandLine cmd = new ExtendedGnuParser(true).parse(opts, args); if (cmd.hasOption("help")) CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, null, 0); _host = cmd.getOptionValue("host", "localhost"); _rmiport = Integer.parseInt(cmd.getOptionValue("port", String.valueOf(Registry.REGISTRY_PORT))); _file = cmd.getOptionValue("file", "-"); _out = cmd.getOptionValue("out", "-"); _name = cmd.getOptionValue("name"); _host = cmd.getOptionValue("host", "localhost"); } catch (Exception e) { LOG.error("{}: {}- {}", _rmi_string, e.getClass().getSimpleName(), e.getMessage()); CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, String.format("%s: %s%n", e.getClass().getSimpleName(), e.getMessage()), 1); } _rmi_string = String.format("rmi://%s:%d/%s", _host, _rmiport, _name); }
From source file:de.tudarmstadt.lt.lm.app.LineProbPerp.java
@SuppressWarnings("static-access") public LineProbPerp(String args[]) { Options opts = new Options(); opts.addOption(new Option("?", "help", false, "display this message")); opts.addOption(OptionBuilder.withLongOpt("port").withArgName("port-number").hasArg() .withDescription(/*w ww.j a v a 2 s . co m*/ String.format("Specifies the port on which the rmi registry listens (default: %d).", Registry.REGISTRY_PORT)) .create("rp")); opts.addOption(OptionBuilder.withLongOpt("host").withArgName("hostname").hasArg() .withDescription("Specifies the hostname on which the rmi registry listens (default: localhost).") .create("h")); opts.addOption(OptionBuilder.withLongOpt("file").withArgName("name").hasArg().withDescription( "Specify the file or directory that contains '.txt' files that are used as source for testing perplexity with the specified language model. Specify '-' to pipe from stdin. (default: '-').") .create("f")); opts.addOption(OptionBuilder.withLongOpt("out").withArgName("name").hasArg() .withDescription("Specify the output file. Specify '-' to use stdout. (default: '-').") .create("o")); opts.addOption(OptionBuilder.withLongOpt("name").withArgName("identifier").isRequired().hasArg() .withDescription("Specify the name of the language model provider that you want to connect to.") .create("i")); opts.addOption(OptionBuilder.withLongOpt("runparallel") .withDescription("Specify if processing should happen in parallel.").create("p")); try { CommandLine cmd = new ExtendedGnuParser(true).parse(opts, args); if (cmd.hasOption("help")) CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, null, 0); _host = cmd.getOptionValue("host", "localhost"); _rmiport = Integer.parseInt(cmd.getOptionValue("port", String.valueOf(Registry.REGISTRY_PORT))); _file = cmd.getOptionValue("file", "-"); _out = cmd.getOptionValue("out", "-"); _name = cmd.getOptionValue("name"); _parallel = cmd.hasOption("runparallel"); } catch (Exception e) { LOG.error("{}: {}- {}", _rmi_string, e.getClass().getSimpleName(), e.getMessage()); CliUtils.print_usage_quit(System.err, getClass().getSimpleName(), opts, USAGE_HEADER, String.format("%s: %s%n", e.getClass().getSimpleName(), e.getMessage()), 1); } _rmi_string = String.format("rmi://%s:%d/%s", _host, _rmiport, _name); }
From source file:de.tudarmstadt.lt.lm.app.PerplexityClient.java
/** * /*from w ww . j a va2s . c o m*/ */ @SuppressWarnings("static-access") public PerplexityClient(String args[]) { Options opts = new Options(); opts.addOption(new Option("?", "help", false, "display this message")); opts.addOption(OptionBuilder.withLongOpt("port").withArgName("port-number").hasArg() .withDescription( String.format("Specifies the port on which the rmi registry listens (default: %d).", Registry.REGISTRY_PORT)) .create("p")); opts.addOption(OptionBuilder.withLongOpt("selftest") .withDescription("Run a selftest, compute perplexity of ngrams in specified LM.").create("s")); opts.addOption(OptionBuilder.withLongOpt("quiet").withDescription("Run with minimum outout on stdout.") .create("q")); opts.addOption(OptionBuilder.withLongOpt("skipoov").hasOptionalArg().withArgName("{true|false}") .withDescription("Do not consider oov terms, i.e. ngrams that end in an oov term. (default: false)") .create()); opts.addOption(OptionBuilder.withLongOpt("skipoovreflm").hasOptionalArg().withArgName("{true|false}") .withDescription( "Do not consider oov terms regarding the oovreflm, i.e. ngrams that end in an oov term. (default: false)") .create()); opts.addOption(OptionBuilder.withLongOpt("oovreflm").withArgName("identifier").hasArg().withDescription( "Do not consider oov terms with respect to the provided lm, i.e. ngrams that end in an oov term in the referenced lm. (default use current lm)") .create()); opts.addOption(OptionBuilder.withLongOpt("host").withArgName("hostname").hasArg() .withDescription("Specifies the hostname on which the rmi registry listens (default: localhost).") .create("h")); opts.addOption(OptionBuilder.withLongOpt("file").withArgName("name").hasArg().withDescription( "Specify the file or directory that contains '.txt' files that are used as source for testing perplexity with the specified language model. Specify '-' to pipe from stdin. (default: '-').") .create("f")); opts.addOption(OptionBuilder.withLongOpt("out").withArgName("name").hasArg() .withDescription("Specify the output file. Specify '-' to use stdout. (default: '-').") .create("o")); opts.addOption(OptionBuilder.withLongOpt("id").withArgName("identifier").isRequired().hasArg() .withDescription("Specify the name of the language model provider that you want to connect to.") .create("i")); opts.addOption(OptionBuilder.withLongOpt("one_ngram_per_line").hasOptionalArg().withArgName("{true|false}") .withDescription( "Specify if the input file contains one ngram per line or sentences. (default: false)") .create()); try { CommandLine cmd = new ExtendedGnuParser(true).parse(opts, args); if (cmd.hasOption("help")) CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, null, 0); _host = cmd.getOptionValue("host", "localhost"); _rmiport = Integer.parseInt(cmd.getOptionValue("port", String.valueOf(Registry.REGISTRY_PORT))); _file = cmd.getOptionValue("file", "-"); _out = cmd.getOptionValue("out", "-"); _id = cmd.getOptionValue("id"); _host = cmd.getOptionValue("host", "localhost"); _selftest = cmd.hasOption("selftest"); _quiet = cmd.hasOption("quiet"); _no_oov = cmd.hasOption("skipoov"); if (_no_oov && cmd.getOptionValue("skipoov") != null) _no_oov = Boolean.parseBoolean(cmd.getOptionValue("skipoov")); _no_oov_reflm = cmd.hasOption("skipoovreflm"); if (_no_oov_reflm && cmd.getOptionValue("skipoovreflm") != null) _no_oov_reflm = Boolean.parseBoolean(cmd.getOptionValue("skipoovreflm")); _one_ngram_per_line = cmd.hasOption("one_ngram_per_line"); if (_one_ngram_per_line && cmd.getOptionValue("one_ngram_per_line") != null) _one_ngram_per_line = Boolean.parseBoolean(cmd.getOptionValue("one_ngram_per_line")); _oovreflm_name = cmd.getOptionValue("oovreflm"); } catch (Exception e) { LOG.error("{}: {}- {}", _rmi_string, e.getClass().getSimpleName(), e.getMessage()); CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, String.format("%s: %s%n", e.getClass().getSimpleName(), e.getMessage()), 1); } _rmi_string = String.format("rmi://%s:%d/%s", _host, _rmiport, _id); }
From source file:de.tudarmstadt.lt.lm.app.SentPerp.java
/** * //from ww w . j a v a 2 s . com */ @SuppressWarnings("static-access") public SentPerp(String args[]) { Options opts = new Options(); opts.addOption(new Option("?", "help", false, "display this message")); opts.addOption(OptionBuilder.withLongOpt("port").withArgName("port-number").hasArg() .withDescription( String.format("Specifies the port on which the rmi registry listens (default: %d).", Registry.REGISTRY_PORT)) .create("p")); opts.addOption(OptionBuilder.withLongOpt("selftest") .withDescription("Run a selftest, compute perplexity of ngrams in specified LM.").create("s")); opts.addOption(OptionBuilder.withLongOpt("quiet").withDescription("Run with minimum outout on stdout.") .create("q")); opts.addOption(OptionBuilder.withLongOpt("noov").hasOptionalArg().withArgName("{true|false}") .withDescription("Do not consider oov terms, i.e. ngrams that end in an oov term. (default: false)") .create()); opts.addOption(OptionBuilder.withLongOpt("oovreflm").withArgName("identifier").hasArg().withDescription( "Do not consider oov terms with respect to the provided lm, i.e. ngrams that end in an oov term in the referenced lm. (default use current lm)") .create()); opts.addOption(OptionBuilder.withLongOpt("host").withArgName("hostname").hasArg() .withDescription("Specifies the hostname on which the rmi registry listens (default: localhost).") .create("h")); opts.addOption(OptionBuilder.withLongOpt("file").withArgName("name").hasArg().withDescription( "Specify the file or directory that contains '.txt' files that are used as source for testing perplexity with the specified language model. Specify '-' to pipe from stdin. (default: '-').") .create("f")); opts.addOption(OptionBuilder.withLongOpt("out").withArgName("name").hasArg() .withDescription("Specify the output file. Specify '-' to use stdout. (default: '-').") .create("o")); opts.addOption(OptionBuilder.withLongOpt("name").withArgName("identifier").isRequired().hasArg() .withDescription("Specify the name of the language model provider that you want to connect to.") .create("i")); try { CommandLine cmd = new ExtendedGnuParser(true).parse(opts, args); if (cmd.hasOption("help")) CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, null, 0); _host = cmd.getOptionValue("host", "localhost"); _rmiport = Integer.parseInt(cmd.getOptionValue("port", String.valueOf(Registry.REGISTRY_PORT))); _file = cmd.getOptionValue("file", "-"); _out = cmd.getOptionValue("out", "-"); _name = cmd.getOptionValue("name"); _host = cmd.getOptionValue("host", "localhost"); _selftest = cmd.hasOption("selftest"); _quiet = cmd.hasOption("quiet"); _no_oov = cmd.hasOption("noov"); if (_no_oov && cmd.getOptionValue("noov") != null) _no_oov = Boolean.parseBoolean(cmd.getOptionValue("noov")); _oovreflm_name = cmd.getOptionValue("oovreflm"); } catch (Exception e) { LOG.error("{}: {}- {}", _rmi_string, e.getClass().getSimpleName(), e.getMessage()); CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, String.format("%s: %s%n", e.getClass().getSimpleName(), e.getMessage()), 1); } _rmi_string = String.format("rmi://%s:%d/%s", _host, _rmiport, _name); }
From source file:de.tudarmstadt.lt.lm.app.PerpDoc.java
/** * //from ww w . j ava2 s . co m */ @SuppressWarnings("static-access") public PerpDoc(String args[]) { Options opts = new Options(); opts.addOption(new Option("?", "help", false, "display this message")); opts.addOption(OptionBuilder.withLongOpt("port").withArgName("port-number").hasArg() .withDescription( String.format("Specifies the port on which the rmi registry listens (default: %d).", Registry.REGISTRY_PORT)) .create("p")); opts.addOption(OptionBuilder.withLongOpt("selftest") .withDescription("Run a selftest, compute perplexity of ngrams in specified LM.").create("s")); opts.addOption(OptionBuilder.withLongOpt("quiet").withDescription("Run with minimum outout on stdout.") .create("q")); opts.addOption(OptionBuilder.withLongOpt("noov").hasOptionalArg().withArgName("{true|false}") .withDescription("Do not consider oov terms, i.e. ngrams that end in an oov term. (default: false)") .create()); opts.addOption(OptionBuilder.withLongOpt("oovreflm").withArgName("identifier").hasArg().withDescription( "Do not consider oov terms with respect to the provided lm, i.e. ngrams that end in an oov term in the referenced lm. (default use current lm)") .create()); opts.addOption(OptionBuilder.withLongOpt("host").withArgName("hostname").hasArg() .withDescription("Specifies the hostname on which the rmi registry listens (default: localhost).") .create("h")); opts.addOption(OptionBuilder.withLongOpt("file").withArgName("name").hasArg().withDescription( "Specify the file or directory that contains '.txt' files that are used as source for testing perplexity with the specified language model. Specify '-' to pipe from stdin. (default: '-').") .create("f")); opts.addOption(OptionBuilder.withLongOpt("out").withArgName("name").hasArg() .withDescription("Specify the output file. Specify '-' to use stdout. (default: '-').") .create("o")); opts.addOption(OptionBuilder.withLongOpt("name").withArgName("identifier").isRequired().hasArg() .withDescription("Specify the name of the language model provider that you want to connect to.") .create("i")); try { CommandLine cmd = new ExtendedGnuParser(true).parse(opts, args); if (cmd.hasOption("help")) CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, null, 0); _host = cmd.getOptionValue("host", "localhost"); _rmiport = Integer.parseInt(cmd.getOptionValue("port", String.valueOf(Registry.REGISTRY_PORT))); _file = cmd.getOptionValue("file", "-"); _out = cmd.getOptionValue("out", "-"); _name = cmd.getOptionValue("name"); _host = cmd.getOptionValue("host", "localhost"); _selftest = cmd.hasOption("selftest"); _quiet = cmd.hasOption("quiet"); _no_oov = cmd.hasOption("noov"); if (_no_oov && cmd.getOptionValue("noov") != null) _no_oov = Boolean.parseBoolean(cmd.getOptionValue("noov")); _oovreflm_name = cmd.getOptionValue("oovreflm"); } catch (Exception e) { LOG.error("{}: {}- {}", _rmi_string, e.getClass().getSimpleName(), e.getMessage()); CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, String.format("%s: %s%n", e.getClass().getSimpleName(), e.getMessage()), 1); } _rmi_string = String.format("rmi://%s:%d/%s", _host, _rmiport, _name); }
From source file:de.tudarmstadt.lt.ltbot.postprocessor.DecesiveValueProducerPerplexity.java
public DecesiveValueProducerPerplexity() { setServiceID("defaultlm"); setRmihost("localhost"); setRmiport(Registry.REGISTRY_PORT); TextExtractor extractor = new TextExtractor(); extractor.setUtf8Cleaner(new UTF8CleanerMin()); extractor.setHtmlTextExtractor(new JSoupTextExtractor()); setTextExtractor(extractor);/* w w w.j a v a2 s .co m*/ setExtraInfoValueFieldName(EXTRA_INFO_PERPLEXITY); }
From source file:com.mindquarry.jcr.jackrabbit.JCRTestBaseStandalone.java
@Override protected void setUp() throws Exception { this.logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); // remove old repository File repoFolder = new File("target/repository"); //$NON-NLS-1$ removeRepository(repoFolder);/* ww w . java 2 s . c o m*/ InputStream repoConfigIn = getClass().getResourceAsStream(REPO_CONFIG_FILE); File tempRepoConfigFile = File.createTempFile("repository", "xml"); //$NON-NLS-1$ //$NON-NLS-2$ tempRepoConfigFile.deleteOnExit(); OutputStream tempRepoConfigOut = new FileOutputStream(tempRepoConfigFile); try { IOUtils.copy(repoConfigIn, tempRepoConfigOut); } finally { repoConfigIn.close(); tempRepoConfigOut.close(); } Repository repo = new TransientRepository(tempRepoConfigFile.getAbsolutePath(), "target/repository"); //$NON-NLS-1$ ServerAdapterFactory factory = new ServerAdapterFactory(); RemoteRepository remoteRepo = factory.getRemoteRepository(repo); reg = LocateRegistry.createRegistry(Registry.REGISTRY_PORT); reg.rebind(REMOTE_REPO_NAME, remoteRepo); session = repo.login(new SimpleCredentials(LOGIN, PWD.toCharArray()), WORKSPACE); InputStream nodeTypeDefIn = getClass().getResourceAsStream(MQ_JCR_XML_NODETYPES_FILE); JackrabbitInitializerHelper.setupRepository(session, new InputStreamReader(nodeTypeDefIn), ""); //$NON-NLS-1$ }
From source file:de.tudarmstadt.lt.lm.web.servlet.LanguageModelProviderServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); String port = config.getInitParameter("rmiport"); _host = config.getInitParameter("rmihost"); if (_host == null || port == null) { LOG.warn("rmihost or rmiport parameter not specified. Please specify correct parameters in web.xml:{}.", getClass().getSimpleName()); if (_host == null) _host = "localhost"; if (port == null) port = String.valueOf(Registry.REGISTRY_PORT); }/*ww w .jav a2 s. co m*/ try { _port = Integer.parseInt(port); } catch (NumberFormatException e) { LOG.warn( "rmiport option value '{}' could not be parsed: {} {}. Please specify correct parameter in web.xml:{}.", port, e, getClass().getSimpleName(), e.getMessage(), getClass().getSimpleName()); _port = Registry.REGISTRY_PORT; } }