本文整理汇总了Java中org.apache.felix.scr.annotations.Modified类的典型用法代码示例。如果您正苦于以下问题:Java Modified类的具体用法?Java Modified怎么用?Java Modified使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Modified类属于org.apache.felix.scr.annotations包,在下文中一共展示了Modified类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Activate
@Modified
protected final void activate(final Map<String, Object> config) {
Map<String, Object> properties = Collections.emptyMap();
if (config != null) {
properties = config;
}
booleanProp = PropertiesUtil.toBoolean(properties.get(BOOLEAN_PROPERTY_NAME), BOOLEAN_PROPERTY_DEFAULT_VALUE);
stringProp = PropertiesUtil.toString(properties.get(STRING_PROPERTY_NAME), STRING_PROPERTY_DEFAULT_VALUE);
dropdownProp = PropertiesUtil.toString(properties.get(DROPDOWN_PROPERTY_NAME), DROPDOWN_PROPERTY_DEFAULT_VALUE);
stringArrayProp = PropertiesUtil.toStringArray(properties.get(STRING_ARRAY_PROPERTY_NAME));
passwordProp = PropertiesUtil.toString(properties.get(PASSWORD_PROPERTY_NAME), "").toCharArray();
longProp = PropertiesUtil.toLong(properties.get(LONG_PROPERTY_NAME), LONG_PROPERTY_DEFAULT_VALUE);
}
示例2: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public void modified(ComponentContext context) {
if (context == null) {
netconfReplyTimeout = DEFAULT_REPLY_TIMEOUT_SECONDS;
log.info("No component configuration");
return;
}
Dictionary<?, ?> properties = context.getProperties();
int newNetconfReplyTimeout;
try {
String s = get(properties, PROP_NETCONF_REPLY_TIMEOUT);
newNetconfReplyTimeout = isNullOrEmpty(s) ?
netconfReplyTimeout : Integer.parseInt(s.trim());
} catch (NumberFormatException e) {
log.warn("Component configuration had invalid value", e);
return;
}
netconfReplyTimeout = newNetconfReplyTimeout;
log.info("Settings: {} = {}", PROP_NETCONF_REPLY_TIMEOUT, netconfReplyTimeout);
}
示例3: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的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");
}
示例4: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
log.info("Received configuration change...");
Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
String newIp = get(properties, "aliasIp");
String newMask = get(properties, "aliasMask");
String newAdapter = get(properties, "aliasAdapter");
// Process any changes in the parameters...
if (!Objects.equals(newIp, aliasIp) ||
!Objects.equals(newMask, aliasMask) ||
!Objects.equals(newAdapter, aliasAdapter)) {
synchronized (this) {
log.info("Reconfiguring with aliasIp={}, aliasMask={}, aliasAdapter={}, wasLeader={}",
newIp, newMask, newAdapter, wasLeader);
if (wasLeader) {
removeIpAlias(aliasIp, aliasMask, aliasAdapter);
addIpAlias(newIp, newMask, newAdapter);
}
aliasIp = newIp;
aliasMask = newMask;
aliasAdapter = newAdapter;
}
}
}
示例5: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public void modified(ComponentContext context) {
int newRate = DEFAULT_RATE;
if (context != null) {
Dictionary properties = context.getProperties();
try {
String s = get(properties, "rate");
newRate = isNullOrEmpty(s)
? rate : Integer.parseInt(s.trim());
} catch (Exception e) {
return;
}
}
if (newRate != rate) {
log.info("Per node rate changed to {}", newRate);
rate = newRate;
stopTest();
runner.execute(this::startTest);
}
}
示例6: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的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);
}
}
示例7: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public void modified(ComponentContext context) {
Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
int newMessageHandlerThreadPoolSize;
try {
String s = get(properties, "messageHandlerThreadPoolSize");
newMessageHandlerThreadPoolSize =
isNullOrEmpty(s) ? messageHandlerThreadPoolSize : Integer.parseInt(s.trim());
} catch (NumberFormatException e) {
log.warn(e.getMessage());
newMessageHandlerThreadPoolSize = messageHandlerThreadPoolSize;
}
// Any change in the following parameters implies thread pool restart
if (newMessageHandlerThreadPoolSize != messageHandlerThreadPoolSize) {
setMessageHandlerThreadPoolSize(newMessageHandlerThreadPoolSize);
restartMessageHandlerThreadPool();
}
log.info(FORMAT, messageHandlerThreadPoolSize);
}
示例8: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String newLinkWeightFunction = get(properties, "linkWeightFunction");
if (newLinkWeightFunction != null &&
!Objects.equals(newLinkWeightFunction, linkWeightFunction)) {
linkWeightFunction = newLinkWeightFunction;
LinkWeight weight = linkWeightFunction.equals(LINK_METRIC) ?
new MetricLinkWeight() :
linkWeightFunction.equals(GEO_DISTANCE) ?
new GeoDistanceLinkWeight(deviceService) : null;
setDefaultLinkWeight(weight);
}
log.info(FORMAT, linkWeightFunction);
}
示例9: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public void modified(ComponentContext context) {
Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
try {
String s = get(properties, "defaultVlan");
defaultVlan = isNullOrEmpty(s) ? DEFAULT_VLAN : Integer.parseInt(s.trim());
Boolean o = Tools.isPropertyEnabled(properties, "enableDhcpIgmpOnProvisioning");
if (o != null) {
enableDhcpIgmpOnProvisioning = o;
}
} catch (Exception e) {
defaultVlan = DEFAULT_VLAN;
}
}
示例10: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public boolean modified(ComponentContext context) {
if (context == null) {
log.info("No configuration change, using defaults: pktRate={}",
DEFAULT_RATE);
return false;
}
Dictionary<?, ?> properties = context.getProperties();
int newRate;
try {
String s = String.valueOf(properties.get("pktRate"));
newRate = isNullOrEmpty(s) ? pktRate : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) {
log.warn(e.getMessage());
newRate = pktRate;
}
if (newRate != pktRate) {
pktRate = newRate;
packetDriver.submit(new PacketDriver());
log.info("Using new settings: pktRate={}", pktRate);
return true;
}
return false;
}
示例11: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public void modified(ComponentContext context) {
if (context == null) {
loadSuppressionRules();
return;
}
@SuppressWarnings("rawtypes")
Dictionary properties = context.getProperties();
String s = get(properties, PROP_DISABLE_LD);
if (!Strings.isNullOrEmpty(s)) {
disableLinkDiscovery = Boolean.valueOf(s);
}
s = get(properties, PROP_USE_BDDP);
if (!Strings.isNullOrEmpty(s)) {
useBDDP = Boolean.valueOf(s);
}
s = get(properties, PROP_LLDP_SUPPRESSION);
if (!Strings.isNullOrEmpty(s)) {
lldpSuppression = s;
}
loadSuppressionRules();
}
示例12: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
Integer sharedThreadPoolSizeConfig =
getIntegerProperty(properties, "sharedThreadPoolSize");
if (sharedThreadPoolSizeConfig == null) {
log.info("Shared Pool Size is not configured, default value is {}",
sharedThreadPoolSize);
} else {
if (sharedThreadPoolSizeConfig > 0) {
sharedThreadPoolSize = sharedThreadPoolSizeConfig;
SharedExecutors.setPoolSize(sharedThreadPoolSize);
log.info("Configured. Shared Pool Size is configured to {}",
sharedThreadPoolSize);
} else {
log.warn("Shared Pool Size size must be greater than 0");
}
}
}
示例13: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
void modified(Map<String, Object> configuration) throws Exception {
ZookeeperConfig config = new ZookeeperConfig();
configurer.configure(configuration, this);
configurer.configure(configuration, config);
if (!StringUtils.isNullOrBlank(config.getZookeeperUrl())) {
State prev = state.get();
ZookeeperConfig oldConfiguration = prev != null ? prev.configuration : null;
if (!config.equals(oldConfiguration)) {
State next = new State(config);
if (state.compareAndSet(prev, next)) {
executor.submit(next);
if (prev != null) {
prev.close();
}
} else {
next.close();
}
}
}
}
示例14: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public void modified(ComponentContext context) {
if (context != null) {
Dictionary<?, ?> properties = context.getProperties();
pollFrequency = Tools.getIntegerProperty(properties, "pollFrequency",
DEFAULT_POLL_FREQUENCY_SECONDS);
log.info("Configured. Poll frequency is configured to {} seconds", pollFrequency);
}
if (!scheduledTasks.isEmpty()) {
//cancel all previous tasks
scheduledTasks.values().forEach(task -> task.cancel(false));
//resubmit task with new timeout.
Set<DeviceId> deviceSubjects =
cfgService.getSubjects(DeviceId.class, GeneralProviderDeviceConfig.class);
deviceSubjects.forEach(deviceId -> {
if (!compareScheme(deviceId)) {
// not under my scheme, skipping
log.debug("{} is not my scheme, skipping", deviceId);
return;
}
scheduledTasks.put(deviceId, schedulePolling(deviceId, true));
});
}
}
示例15: modified
import org.apache.felix.scr.annotations.Modified; //导入依赖的package包/类
@Modified
public void modified(ComponentContext context) {
if (context != null) {
Dictionary<?, ?> properties = context.getProperties();
pollFrequency = Tools.getIntegerProperty(properties, "pollFrequency",
DEFAULT_POLL_FREQUENCY_SECONDS);
log.info("Configured. Poll frequency is configured to {} seconds", pollFrequency);
maxRetries = Tools.getIntegerProperty(properties, "maxRetries",
DEFAULT_MAX_RETRIES);
log.info("Configured. Number of retries is configured to {} times", maxRetries);
}
if (scheduledTask != null) {
scheduledTask.cancel(false);
}
scheduledTask = schedulePolling();
}