}
private void populateLaunchConfigFactory(LaunchConfigData data, DefaultLaunchConfigFactory launchConfigFactory) {
Properties properties = data.getProperties();
Map<String, String> envVars = data.getEnvVars();
TypeCoercingProperties props = data.getTypeCoercingProperties();
Class<HandlerFactory> handlerFactoryClass;
try {
handlerFactoryClass = props.asClass(HANDLER_FACTORY, HandlerFactory.class);
if (handlerFactoryClass == null) {
throw new LaunchException("No handler factory class specified (config property: " + HANDLER_FACTORY + ")");
}
int defaultPort = LaunchConfig.DEFAULT_PORT;
if (envVars.containsKey(LaunchConfigs.Environment.PORT)) {
try {
String stringValue = envVars.get(LaunchConfigs.Environment.PORT);
defaultPort = Integer.valueOf(stringValue);
} catch (NumberFormatException e) {
throw new LaunchException("Environment var '" + LaunchConfigs.Environment.PORT + "' is not an integer", e);
}
}
int port = props.asInt(PORT, defaultPort);
InetAddress address = props.asInetAddress(ADDRESS);
URI publicAddress = props.asURI(PUBLIC_ADDRESS);
boolean development = props.asBoolean(DEVELOPMENT, false);
int threads = props.asInt(THREADS, DEFAULT_THREADS);
List<String> indexFiles = props.asList(INDEX_FILES);
String sslKeystore = props.asString(SSL_KEYSTORE_FILE, null);
String sslKeystorePassword = props.asString(SSL_KEYSTORE_PASSWORD, "");
int maxContentLength = props.asInt(MAX_CONTENT_LENGTH, DEFAULT_MAX_CONTENT_LENGTH);
boolean timeResponses = props.asBoolean(TIME_RESPONSES, false);
boolean compressResponses = props.asBoolean(COMPRESS_RESPONSES, false);
long compressionMinSize = props.asLong(COMPRESSION_MIN_SIZE, DEFAULT_COMPRESSION_MIN_SIZE);
List<String> compressionMimeTypeWhiteList = props.asList(COMPRESSION_MIME_TYPE_WHITE_LIST);
List<String> compressionMimeTypeBlackList = props.asList(COMPRESSION_MIME_TYPE_BLACK_LIST);
Map<String, String> otherProperties = Maps.newHashMap();
PropertiesUtil.extractProperties("other.", properties, otherProperties);
launchConfigFactory.setBaseDir(data.getBaseDir());