/** * @param cfg * <ul> * <li>delay (expressed in milliseconds) * </ul> */ public void setConfiguration (Configuration cfg) { delay = cfg.getInt ("delay"); }
public int getInt(String propertyName){ return cfg.getInt(prefix + propertyName); } public int getInt(String propertyName, int defaultValue){
public int getInt(String propertyName, int defaultValue){ return cfg.getInt(prefix + propertyName, defaultValue); } public void put (String name, Object value) {
/** * Default config params are: min-len Minimun length, * max-len Max length, break-on-error break condition. * @param cfg configuration instance * @throws ConfigurationException */ public void setConfiguration(Configuration cfg) throws ConfigurationException { this.cfg = cfg; this.minLen = cfg.getInt( "min-len", 0 ); this.maxLen = cfg.getInt( "max-len", 999999 ); this.breakOnError = cfg.getBoolean( "break-on-error", false ); }
protected void startService() { for (int i=0; i<cfg.getInt("sessions", 1); i++) new Thread(this).start(); } public void run () {
private SecretKey generateKey() throws NoSuchAlgorithmException { KeyGenerator keyGen = KeyGenerator.getInstance("AES"); keyGen.init(cfg.getInt("keylength", 256)); return keyGen.generateKey(); }
@Override public void setConfiguration(Configuration cfg) throws ConfigurationException { super.setConfiguration(cfg); port = cfg.getInt("port", 65000); }
/** * Configure the validator. @see ISOFieldValidator class. * Take config param "radix" wich specify the numeric radix. * @param cfg configuration instance * @throws ConfigurationException */ public void setConfiguration(Configuration cfg) throws ConfigurationException { super.setConfiguration( cfg ); this.radix = cfg.getInt( "radix", 10 ); }
public void setConfiguration (Configuration cfg) throws ConfigurationException { super.setConfiguration (cfg); this.timeout = cfg.getInt ("timeout", 0); } }
public void setConfiguration (Configuration cfg) { setTraceNumberField (cfg.getInt ("tracenofield")); } private void initMUX (ISOChannel c) {
@Override public void initChannel(SocketChannel ch) throws Exception { int timeout = cfg.getInt("timeout", 300); ch.pipeline().addLast(new IdleStateHandler(timeout,timeout,timeout)); if (enableTLS) { ch.pipeline().addLast(new SslHandler(getSSLEngine(sslContext), true)); } ch.pipeline().addLast(new HttpServerCodec()) ; ch.pipeline().addLast(new HttpObjectAggregator(512*1024)); ch.pipeline().addLast(new RestSession(RestServer.this)); } })
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; try { socket = new DatagramSocket(); port = cfg.getInt ("port", SYSLOG_PORT); host = InetAddress.getByName (cfg.get ("host", "localhost")); defaultFacility = cfg.getInt ("facility", LOG_USER); defaultSeverity = cfg.getInt ("severity", PRI_INFO); tags = cfg.get ("tags", "audit, syslog"); prefix = cfg.get ("prefix", null); } catch (Exception e) { throw new ConfigurationException (e); } } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { host = cfg.get ("host", null); if (host == null) throw new ConfigurationException ( "host property has not been specified" ); port = cfg.getInt ("port", 7); } }
/** * * Calls super.setConfiguration() and then reads the 'length-digits' property, * defaulting to 4 * * @param cfg Configuration * @throws ConfigurationException */ @Override public void setConfiguration (Configuration cfg) throws ConfigurationException { super.setConfiguration(cfg); setLengthDigits(cfg.getInt("length-digits", 4)); } }
public void setConfiguration(Configuration cfg) throws ConfigurationException { maxSize = cfg.getInt ("size", DEFAULT_SIZE); if (name != null) NameRegistrar.unregister (name); name = cfg.get ("name", null); if (name != null) NameRegistrar.register (name, this); } public void addListener (final LogListener listener) {
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; try { mux = (SpaceMUX) NameRegistrar.get (cfg.get ("mux")); } catch (NotFoundException e) { throw new ConfigurationException (e); } timeout = cfg.getLong ("timeout", 120000); pool = new ThreadPool (1, cfg.getInt ("pool", 100)); }
public void setConfiguration (Configuration cfg) throws ConfigurationException { super.setConfiguration (cfg); srcid = cfg.get ("srcid", "000000"); dstid = cfg.get ("dstid", "000000"); debugPoll = cfg.getBoolean("debug-poll", false); headerFormat = cfg.getInt("header-format", 2); replyKeepAlive = cfg.getBoolean("reply-keepalive", true); } }
@Override protected void startService() throws Exception { String username=cfg.get("auth-username","admin"); String authorizedKeysFilename=cfg.get("authorized-keys-file","cfg/authorized_keys"); String hostKeys=cfg.get("hostkeys-file","cfg/hostkeys.ser"); int port=cfg.getInt("port",2222); checkAuthorizedKeys(authorizedKeysFilename); String[] prefixes= getPrefixes(); sshd = SshServer.setUpDefaultServer(); sshd.setPort(port); sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File(hostKeys))); CliShellFactory csf = new CliShellFactory(getServer(), prefixes); sshd.setShellFactory(csf); sshd.setCommandFactory(csf); sshd.setUserAuthFactories(Collections.singletonList(new UserAuthPublicKeyFactory())); sshd.setPublickeyAuthenticator(new AuthorizedKeysFileBasedPKA(username, authorizedKeysFilename)); sshd.start(); log.info("Started SSHD @ port "+port); }