use of org.apache.openejb.loader.Options in project tomee by apache.
the class MulticastDiscoveryAgent method init.
@Override
public void init(final Properties props) {
final Options options = new Options(props);
options.setLogger(new OptionsLog(LOGGER));
host = props.getProperty("bind", host);
loopbackMode = options.get("loopback_mode", loopbackMode);
port = options.get("port", port);
heartRate = options.get("heart_rate", heartRate);
final Tracker.Builder builder = new Tracker.Builder();
builder.setGroup(props.getProperty("group", builder.getGroup()));
builder.setHeartRate(heartRate);
builder.setMaxMissedHeartbeats(options.get("max_missed_heartbeats", builder.getMaxMissedHeartbeats()));
builder.setMaxReconnectDelay(options.get("max_reconnect_delay", builder.getMaxReconnectDelay()));
builder.setReconnectDelay(options.get("reconnect_delay", builder.getReconnectDelay()));
builder.setExponentialBackoff(options.get("exponential_backoff", builder.getExponentialBackoff()));
builder.setMaxReconnectAttempts(options.get("max_reconnect_attempts", builder.getMaxReconnectAttempts()));
tracker = builder.build();
}
use of org.apache.openejb.loader.Options in project tomee by apache.
the class MultipointDiscoveryAgent method init.
@Override
public void init(final Properties props) {
final Options options = new Options(props);
options.setLogger(new OptionsLog(LOGGER));
host = props.getProperty("bind", host);
port = options.get("port", port);
initialServers = options.get("initialServers", initialServers);
heartRate = options.get("heart_rate", heartRate);
discoveryHost = options.get("discoveryHost", host);
name = name != null ? name : options.get("discoveryName", MultipointServer.randomColor());
reconnectDelay = options.get("reconnectDelay", new Duration("30 seconds"));
final Set<URI> uris = new LinkedHashSet<>();
// Connect the initial set of peer servers
final StringTokenizer st = new StringTokenizer(initialServers, ",");
while (st.hasMoreTokens()) {
final String string = st.nextToken().trim();
if (string.startsWith("conn://")) {
final URI uri = URI.create(string);
uris.add(uri);
} else {
final URI uri = URI.create("conn://" + string);
uris.add(uri);
}
}
roots = uris;
final Tracker.Builder builder = new Tracker.Builder();
builder.setHeartRate(heartRate);
builder.setGroup(props.getProperty("group", builder.getGroup()));
builder.setMaxMissedHeartbeats(options.get("max_missed_heartbeats", builder.getMaxMissedHeartbeats()));
builder.setMaxReconnectDelay(options.get("max_reconnect_delay", builder.getMaxReconnectDelay()));
builder.setReconnectDelay(options.get("reconnect_delay", builder.getReconnectDelay()));
builder.setExponentialBackoff(options.get("exponential_backoff", builder.getExponentialBackoff()));
builder.setMaxReconnectAttempts(options.get("max_reconnect_attempts", builder.getMaxReconnectAttempts()));
builder.setDebug(debug);
tracker = builder.build();
}
use of org.apache.openejb.loader.Options in project tomee by apache.
the class JettyHttpServer method init.
@Override
public void init(final Properties props) throws Exception {
final Options options = new Options(props);
port = options.get("port", 8080);
// Create all the Jetty objects but dont' start them
server = new Server();
final Connector connector = new SelectChannelConnector();
connector.setPort(port);
server.setConnectors(new Connector[] { connector });
final ContextHandler context = new ContextHandler();
context.setContextPath("/");
final ServletContext servletContext = context.getServletContext();
server.setHandler(context);
final Handler handler = new AbstractHandler() {
@Override
public void handle(final String target, final HttpServletRequest req, final HttpServletResponse res, final int dispatch) throws IOException, ServletException {
try {
((Request) req).setHandled(true);
final HttpRequest httpRequest = new ServletRequestAdapter(req, res, servletContext);
final HttpResponse httpResponse = new ServletResponseAdapter(res);
JettyHttpServer.this.listener.onMessage(httpRequest, httpResponse);
} catch (IOException | ServletException e) {
throw e;
} catch (Exception e) {
throw new ServletException(e);
}
}
};
final SessionHandler sessionHandler = new SessionHandler();
final SessionManager sessionManager = new HashSessionManager();
sessionManager.setIdManager(new HashSessionIdManager());
sessionHandler.setSessionManager(sessionManager);
sessionHandler.setHandler(handler);
context.setHandler(sessionHandler);
}
use of org.apache.openejb.loader.Options in project tomee by apache.
the class MulticastPulseAgent method init.
@Override
public void init(final Properties p) throws Exception {
final Options o = new Options(p);
o.setLogger(new OptionsLog(LOG));
this.ignore.add("localhost");
this.ignore.add("::1");
this.ignore.add("127.0.0.1");
try {
final String[] ignoreList = o.get("ignore", "").split(",");
for (final String s : ignoreList) {
if (null != s && s.trim().length() > 0) {
this.ignore.add(s.trim().toLowerCase());
}
}
} catch (final Exception e) {
LOG.warning("Invalid ignore parameter. Should be a lowercase single host or comma seperated list of hosts to ignore like: ignore=host1,host2,ipv4,ipv6");
}
this.multicast = o.get("bind", this.multicast);
this.port = o.get("port", this.port);
this.group = o.get("group", this.group);
final InetAddress ia = InetAddress.getByName(this.multicast);
this.address = new InetSocketAddress(ia, this.port);
this.buildPacket();
}
use of org.apache.openejb.loader.Options in project tomee by apache.
the class Assembler method init.
@Override
public void init(final Properties props) throws OpenEJBException {
this.props = new Properties(props);
final Options options = new Options(props, SystemInstance.get().getOptions());
final String className = options.get("openejb.configurator", "org.apache.openejb.config.ConfigurationFactory");
if ("org.apache.openejb.config.ConfigurationFactory".equals(className)) {
// no need to use reflection
configFactory = new ConfigurationFactory();
} else {
configFactory = (OpenEjbConfigurationFactory) toolkit.newInstance(className);
}
configFactory.init(props);
SystemInstance.get().setComponent(OpenEjbConfigurationFactory.class, configFactory);
}
Aggregations