本文整理汇总了Java中org.onlab.util.Tools.get方法的典型用法代码示例。如果您正苦于以下问题:Java Tools.get方法的具体用法?Java Tools.get怎么用?Java Tools.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onlab.util.Tools
的用法示例。
在下文中一共展示了Tools.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String updatedUrl;
updatedUrl = Tools.get(properties, VTN_SERVICE_URL);
if (!Strings.isNullOrEmpty(updatedUrl) && !updatedUrl.equals(vtnServiceUrl)) {
vtnServiceUrl = updatedUrl;
vtnServiceApi = new DefaultVtnServiceApi(vtnServiceUrl, access);
}
updatedUrl = Tools.get(properties, VTN_PORT_URL);
if (!Strings.isNullOrEmpty(updatedUrl) && !updatedUrl.equals(vtnPortUrl)) {
vtnPortUrl = updatedUrl;
vtnPortApi = new DefaultVtnPortApi(vtnPortUrl, access);
}
log.info("Modified");
}
示例2: readComponentConfiguration
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Extracts properties from the component configuration context.
*
* @param context the component context
*/
private void readComponentConfiguration(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String newXosServerAddress =
Tools.get(properties, XOS_SERVER_ADDRESS_PROPERTY_NAME);
if (!isNullOrEmpty(newXosServerAddress)) {
xosServerAddress = newXosServerAddress;
}
String newXosServerPortString =
Tools.get(properties, XOS_SERVER_PORT_PROPERTY_NAME);
if (!isNullOrEmpty(newXosServerPortString)) {
xosServerPort = Integer.parseInt(newXosServerPortString);
}
String newXosProviderServiceString =
Tools.get(properties, XOS_PROVIDER_SERVICE_PROPERTY_NAME);
if (!isNullOrEmpty(newXosProviderServiceString)) {
xosProviderService = Integer.parseInt(newXosProviderServiceString);
}
}
示例3: readComponentConfiguration
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Extracts properties from the component configuration context.
*
* @param context the component context
*/
private void readComponentConfiguration(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String metricNameStr = Tools.get(properties, "metricNames");
metricNames = metricNameStr != null ? metricNameStr : DEFAULT_METRIC_NAMES;
log.info("Configured. Metric name is {}", metricNames);
Boolean monitorAllEnabled = Tools.isPropertyEnabled(properties, "monitorAll");
if (monitorAllEnabled == null) {
log.info("Monitor all metrics is not configured, " +
"using current value of {}", monitorAll);
} else {
monitorAll = monitorAllEnabled;
log.info("Configured. Monitor all metrics is {}",
monitorAll ? "enabled" : "disabled");
}
}
示例4: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
if (context == null) {
log.info("Settings: useFlowObjectives={}", useFlowObjectives);
return;
}
boolean newFlowObjectives;
try {
String s = Tools.get(context.getProperties(), "useFlowObjectives");
newFlowObjectives = isNullOrEmpty(s) ? useFlowObjectives : Boolean.parseBoolean(s.trim());
} catch (ClassCastException e) {
newFlowObjectives = useFlowObjectives;
}
if (useFlowObjectives != newFlowObjectives) {
useFlowObjectives = newFlowObjectives;
changeCompilers();
log.info("Settings: useFlowObjectives={}", useFlowObjectives);
}
}
示例5: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
if (properties == null) {
return;
}
String strDistributed = Tools.get(properties, "distributed");
boolean expectDistributed = Boolean.parseBoolean(strDistributed);
// Start route store during first start or config change
// NOTE: new route store will be empty
if (currentRouteStore == null || expectDistributed != distributed) {
if (expectDistributed) {
currentRouteStore = distributedRouteStore;
} else {
currentRouteStore = localRouteStore;
}
this.distributed = expectDistributed;
log.info("Switched to {} route store", distributed ? "distributed" : "local");
}
}
示例6: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
String propertyValue =
Tools.get(context.getProperties(), NUM_THREAD);
int newNumThreads = isNullOrEmpty(propertyValue) ? numThreads : Integer.parseInt(propertyValue);
if (newNumThreads != numThreads && newNumThreads > 0) {
numThreads = newNumThreads;
ExecutorService oldWorkerExecutor = executorService;
executorService = newFixedThreadPool(numThreads,
groupedThreads(GROUP_THREAD_NAME, WORKER_PATTERN, log));
if (oldWorkerExecutor != null) {
oldWorkerExecutor.shutdown();
}
log.info("Reconfigured number of worker threads to {}", numThreads);
}
}
示例7: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
if (context == null) {
nonDisruptiveInstallationWaitingTime = DEFAULT_NON_DISRUPTIVE_INSTALLATION_WAITING_TIME;
log.info("Restored default installation time for non-disruptive reallocation (1 sec.)");
return;
}
String s = Tools.get(context.getProperties(), "nonDisruptiveInstallationWaitingTime");
int nonDisruptiveTime = isNullOrEmpty(s) ? nonDisruptiveInstallationWaitingTime : Integer.parseInt(s);
if (nonDisruptiveTime != nonDisruptiveInstallationWaitingTime) {
nonDisruptiveInstallationWaitingTime = nonDisruptiveTime;
log.info("Reconfigured non-disruptive reallocation with installation delay {} sec.",
nonDisruptiveInstallationWaitingTime);
}
}
示例8: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
if (properties == null) {
return;
}
String strClearRoutes = Tools.get(properties, "clearRoutes");
clearRoutes = Boolean.parseBoolean(strClearRoutes);
log.info("clearRoutes set to {}", clearRoutes);
}
示例9: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
if (properties == null) {
return;
}
String strRouteToNextHop = Tools.get(properties, "routeToNextHop");
routeToNextHop = Boolean.parseBoolean(strRouteToNextHop);
log.info("routeToNextHop set to {}", routeToNextHop);
}
示例10: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String updatedConfig = Tools.get(properties, ALLOW_HOST_DISCOVERY);
if (!Strings.isNullOrEmpty(updatedConfig)) {
allowHostDiscovery = Boolean.valueOf(updatedConfig);
log.info("Host discovery is set to {}", updatedConfig);
}
log.info("Modified");
}
示例11: readComponentConfiguration
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Extracts properties from the component configuration context.
*
* @param context the component context
*/
private void readComponentConfiguration(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String addressStr = Tools.get(properties, "address");
address = addressStr != null ? addressStr : DEFAULT_ADDRESS;
log.info("Configured. Ganglia server address is {}", address);
String metricNameStr = Tools.get(properties, "metricNames");
metricNames = metricNameStr != null ? metricNameStr : DEFAULT_METRIC_NAMES;
log.info("Configured. Metric name is {}", metricNames);
Integer portConfigured = Tools.getIntegerProperty(properties, "port");
if (portConfigured == null) {
port = DEFAULT_PORT;
log.info("Ganglia port is not configured, default value is {}", port);
} else {
port = portConfigured;
log.info("Configured. Ganglia port is configured to {}", port);
}
Integer ttlConfigured = Tools.getIntegerProperty(properties, "ttl");
if (ttlConfigured == null) {
ttl = DEFAULT_TTL;
log.info("Ganglia TTL is not configured, default value is {}", ttl);
} else {
ttl = ttlConfigured;
log.info("Configured. Ganglia TTL is configured to {}", ttl);
}
Boolean monitorAllEnabled = Tools.isPropertyEnabled(properties, "monitorAll");
if (monitorAllEnabled == null) {
log.info("Monitor all metrics is not configured, " +
"using current value of {}", monitorAll);
} else {
monitorAll = monitorAllEnabled;
log.info("Configured. Monitor all metrics is {}",
monitorAll ? "enabled" : "disabled");
}
}
示例12: readComponentConfiguration
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Extracts properties from the component configuration context.
*
* @param context the component context
*/
private void readComponentConfiguration(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String addressStr = Tools.get(properties, "address");
address = addressStr != null ? addressStr : DEFAULT_ADDRESS;
log.info("Configured. InfluxDB server address is {}", address);
String databaseStr = Tools.get(properties, "database");
database = databaseStr != null ? databaseStr : DEFAULT_DATABASE;
log.info("Configured. InfluxDB server database is {}", database);
String usernameStr = Tools.get(properties, "username");
username = usernameStr != null ? usernameStr : DEFAULT_USERNAME;
log.info("Configured. InfluxDB server username is {}", username);
String passwordStr = Tools.get(properties, "password");
password = passwordStr != null ? passwordStr : DEFAULT_PASSWORD;
log.info("Configured. InfluxDB server password is {}", password);
Integer portConfigured = Tools.getIntegerProperty(properties, "port");
if (portConfigured == null) {
port = DEFAULT_PORT;
log.info("InfluxDB port is not configured, default value is {}", port);
} else {
port = portConfigured;
log.info("Configured. InfluxDB port is configured to {}", port);
}
}
示例13: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
if (context == null) {
skipReleaseResourcesOnWithdrawal = DEFAULT_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL;
logConfig("Default config");
return;
}
String s = Tools.get(context.getProperties(), "skipReleaseResourcesOnWithdrawal");
boolean newTestEnabled = isNullOrEmpty(s) ? skipReleaseResourcesOnWithdrawal : Boolean.parseBoolean(s.trim());
if (skipReleaseResourcesOnWithdrawal && !newTestEnabled) {
store.unsetDelegate(testOnlyDelegate);
store.setDelegate(delegate);
skipReleaseResourcesOnWithdrawal = false;
logConfig("Reconfigured skip release resources on withdrawal");
} else if (!skipReleaseResourcesOnWithdrawal && newTestEnabled) {
store.unsetDelegate(delegate);
store.setDelegate(testOnlyDelegate);
skipReleaseResourcesOnWithdrawal = true;
logConfig("Reconfigured skip release resources on withdrawal");
}
s = Tools.get(context.getProperties(), "numThreads");
int newNumThreads = isNullOrEmpty(s) ? numThreads : Integer.parseInt(s);
if (newNumThreads != numThreads) {
numThreads = newNumThreads;
ExecutorService oldWorkerExecutor = workerExecutor;
workerExecutor = newFixedThreadPool(numThreads, groupedThreads("onos/intent", "worker-%d", log));
if (oldWorkerExecutor != null) {
oldWorkerExecutor.shutdown();
}
logConfig("Reconfigured number of worker threads");
}
}
示例14: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
if (context == null) {
return;
}
Dictionary properties = context.getProperties();
//TODO for reduction check if the new capacity is smaller than the size of the current mapping
String propertyString = Tools.get(properties, "maxCapacity");
//Ignore if propertyString is empty or null
if (!Strings.isNullOrEmpty(propertyString)) {
try {
int temp = Integer.parseInt(propertyString);
//Ensure value is non-negative but allow zero as a way to shutdown the link
if (temp >= 0) {
maxCapacity = temp;
}
} catch (NumberFormatException e) {
//Malformed arguments lead to no change of value (user should be notified of error)
log.error("The value '{}' for maxCapacity was not parsable as an integer.", propertyString, e);
}
} else {
//Notify of empty value but do not return (other properties will also go in this function)
log.error("The value for maxCapacity was set to an empty value.");
}
}
示例15: modified
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String updatedMac;
updatedMac = Tools.get(properties, DHCP_SERVER_MAC);
if (!Strings.isNullOrEmpty(updatedMac) && !updatedMac.equals(dhcpServerMac)) {
dhcpServerMac = updatedMac;
}
log.info("Modified");
}