org.osgi.service.component.annotations.Modified Java Examples

The following examples show how to use org.osgi.service.component.annotations.Modified. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RouteStoreImpl.java    From onos with Apache License 2.0 6 votes vote down vote up
@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");
    }

}
 
Example #2
Source File: GarbageGroupDossierScheduler.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
@Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 4, TimeUnit.HOUR);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
		  
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #3
Source File: GarbageCollectorScheduler.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
@Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 1, TimeUnit.DAY);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
		  
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #4
Source File: OpenstackRoutingSnatHandler.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
protected void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();
    Boolean flag;

    flag = Tools.isPropertyEnabled(properties, USE_STATEFUL_SNAT);
    if (flag == null) {
        log.info("useStatefulSnat is not configured, " +
                "using current value of {}", useStatefulSnat);
    } else {
        useStatefulSnat = flag;
        log.info("Configured. useStatefulSnat is {}",
                useStatefulSnat ? "enabled" : "disabled");
    }

    resetSnatRules();
}
 
Example #5
Source File: DistributedGroupStore.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();

    try {
        String s = get(properties, GARBAGE_COLLECT);
        garbageCollect = isNullOrEmpty(s) ? GARBAGE_COLLECT_DEFAULT : Boolean.parseBoolean(s.trim());

        s = get(properties, GARBAGE_COLLECT_THRESH);
        gcThresh = isNullOrEmpty(s) ? GARBAGE_COLLECT_THRESH_DEFAULT : Integer.parseInt(s.trim());

        s = get(properties, ALLOW_EXTRANEOUS_GROUPS);
        allowExtraneousGroups = isNullOrEmpty(s) ? ALLOW_EXTRANEOUS_GROUPS_DEFAULT : Boolean.parseBoolean(s.trim());
    } catch (Exception e) {
        gcThresh = GARBAGE_COLLECT_THRESH_DEFAULT;
        garbageCollect = GARBAGE_COLLECT_DEFAULT;
        allowExtraneousGroups = ALLOW_EXTRANEOUS_GROUPS_DEFAULT;
    }
}
 
Example #6
Source File: FirmwareUpdateServiceImpl.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
@Modified
protected synchronized void modified(Map<String, Object> config) {
    logger.debug("Modifying the configuration of the firmware update service.");

    if (!isValid(config)) {
        return;
    }

    cancelFirmwareUpdateStatusInfoJob();

    firmwareStatusInfoJobPeriod = config.containsKey(PERIOD_CONFIG_KEY) ? (Integer) config.get(PERIOD_CONFIG_KEY)
            : firmwareStatusInfoJobPeriod;
    firmwareStatusInfoJobDelay = config.containsKey(DELAY_CONFIG_KEY) ? (Integer) config.get(DELAY_CONFIG_KEY)
            : firmwareStatusInfoJobDelay;
    firmwareStatusInfoJobTimeUnit = config.containsKey(TIME_UNIT_CONFIG_KEY)
            ? TimeUnit.valueOf((String) config.get(TIME_UNIT_CONFIG_KEY))
            : firmwareStatusInfoJobTimeUnit;

    if (!firmwareUpdateHandlers.isEmpty()) {
        createFirmwareUpdateStatusInfoJob();
    }
}
 
Example #7
Source File: TimerScheduler.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
@Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 10, TimeUnit.MINUTE);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
		  
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #8
Source File: ClusterIpManager.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
protected void modified(ComponentContext context) {
    log.info("Received configuration change...");
    Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
    String newIp = get(properties, ALIAS_IP);
    String newMask = get(properties, ALIAS_MASK);
    String newAdapter = get(properties, ALIAS_ADAPTER);

    // 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;
        }
    }
}
 
Example #9
Source File: ActionOverdueScheduler.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
@Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 1, TimeUnit.DAY);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #10
Source File: RegistrationSyncScheduler.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
@Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 1, TimeUnit.MINUTE);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
		  
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #11
Source File: PcepTunnelProvider.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();
    int newTunnelStatsPollFrequency;
    try {
        String s = get(properties, POLL_FREQUENCY);
        newTunnelStatsPollFrequency = isNullOrEmpty(s) ? tunnelStatsPollFrequency : Integer.parseInt(s.trim());

    } catch (NumberFormatException | ClassCastException e) {
        newTunnelStatsPollFrequency = tunnelStatsPollFrequency;
    }

    if (newTunnelStatsPollFrequency != tunnelStatsPollFrequency) {
        tunnelStatsPollFrequency = newTunnelStatsPollFrequency;
        collectors.values().forEach(tsc -> tsc.adjustPollInterval(tunnelStatsPollFrequency));
        log.info("New setting: tunnelStatsPollFrequency={}", tunnelStatsPollFrequency);
    }
}
 
Example #12
Source File: DistributedConsensusLoadTest.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    int newRate = RATE_DEFAULT;
    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);
    }
}
 
Example #13
Source File: JaasAuthenticationProvider.java    From openhab-core with Eclipse Public License 2.0 6 votes vote down vote up
@Modified
protected void modified(Map<String, Object> properties) {
    if (properties == null) {
        realmName = DEFAULT_REALM;
        return;
    }

    Object propertyValue = properties.get("realmName");
    if (propertyValue != null) {
        if (propertyValue instanceof String) {
            realmName = (String) propertyValue;
        } else {
            realmName = propertyValue.toString();
        }
    } else {
        // value could be unset, we should reset its value
        realmName = DEFAULT_REALM;
    }
}
 
Example #14
Source File: DossierStatisticEngine.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
	   * activate: Called whenever the properties for the component change (ala Config Admin)
	   * or OSGi is activating the component.
	   * @param properties The properties map from Config Admin.
	   * @throws SchedulerException in case of error.
	   */
	  @Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 10, TimeUnit.MINUTE);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
		  
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #15
Source File: DistributedLeadershipStore.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    if (context == null) {
        return;
    }

    Dictionary<?, ?> properties = context.getProperties();
    long newElectionTimeoutMillis;
    try {
        String s = get(properties, ELECTION_TIMEOUT_MILLIS);
        newElectionTimeoutMillis = isNullOrEmpty(s) ? electionTimeoutMillis : Long.parseLong(s.trim());
    } catch (NumberFormatException | ClassCastException e) {
        log.warn("Malformed configuration detected; using defaults", e);
        newElectionTimeoutMillis = ELECTION_TIMEOUT_MILLIS_DEFAULT;
    }

    if (newElectionTimeoutMillis != electionTimeoutMillis) {
        electionTimeoutMillis = newElectionTimeoutMillis;
        leaderElector = storageService.leaderElectorBuilder()
                .withName("onos-leadership-elections")
                .withElectionTimeout(electionTimeoutMillis)
                .withRelaxedReadConsistency()
                .build()
                .asLeaderElector();
    }
}
 
Example #16
Source File: PersonStatisticSheduler.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
	   * activate: Called whenever the properties for the component change (ala Config Admin)
	   * or OSGi is activating the component.
	   * @param properties The properties map from Config Admin.
	   * @throws SchedulerException in case of error.
	   */
	  @Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 10, TimeUnit.MINUTE);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
		  
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #17
Source File: StatisticsReportScheduler.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
	   * activate: Called whenever the properties for the component change (ala Config Admin)
	   * or OSGi is activating the component.
	   * @param properties The properties map from Config Admin.
	   * @throws SchedulerException in case of error.
	   */
	  @Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 10, TimeUnit.MINUTE);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
		  
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #18
Source File: RestDeviceProvider.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    int previousPollFrequency = pollFrequency;

    if (context != null) {
        Dictionary<?, ?> properties = context.getProperties();
        pollFrequency = Tools.getIntegerProperty(properties, POLL_FREQUENCY,
                                                 POLL_FREQUENCY_DEFAULT);
        replyTimeout = Tools.getIntegerProperty(properties, TIMEOUT,
                TIMEOUT_DEFAULT);
        log.info("Configured. Poll frequency = {} seconds, reply timeout = {} seconds ",
                pollFrequency, replyTimeout);
    }

    // Re-schedule only if frequency has changed
    if (!scheduledTask.isCancelled() && (previousPollFrequency != pollFrequency)) {
        log.info("Re-scheduling port statistics task with frequency {} seconds", pollFrequency);
        scheduledTask.cancel(true);
        scheduledTask = schedulePolling();
    }
}
 
Example #19
Source File: NetconfDeviceProvider.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    if (context != null) {
        Dictionary<?, ?> properties = context.getProperties();
        int newPollFrequency = Tools.getIntegerProperty(properties, POLL_FREQUENCY_SECONDS,
                POLL_FREQUENCY_SECONDS_DEFAULT);

        if (newPollFrequency != pollFrequency) {
            pollFrequency = newPollFrequency;

            if (scheduledTask != null) {
                scheduledTask.cancel(false);
            }
            scheduledTask = schedulePolling();
            log.info("Configured. Poll frequency is configured to {} seconds", pollFrequency);
        }

        maxRetries = Tools.getIntegerProperty(properties, MAX_RETRIES, MAX_RETRIES_DEFAULT);
        log.info("Configured. Number of retries is configured to {} times", maxRetries);
    }
}
 
Example #20
Source File: FifteenMinutes.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
	   * activate: Called whenever the properties for the component change (ala Config Admin)
	   * or OSGi is activating the component.
	   * @param properties The properties map from Config Admin.
	   * @throws SchedulerException in case of error.
	   */
	  @Activate
	  @Modified
	  protected void activate(Map<String,Object> properties) throws SchedulerException {
		  String listenerClass = getClass().getName();
		  Trigger jobTrigger = _triggerFactory.createTrigger(listenerClass, listenerClass, new Date(), null, 15, TimeUnit.MINUTE);

		  _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger);
		  _schedulerEntryImpl = new StorageTypeAwareSchedulerEntryImpl(_schedulerEntryImpl, StorageType.MEMORY_CLUSTERED);
		  
//		  _schedulerEntryImpl.setTrigger(jobTrigger);

		  if (_initialized) {
			  deactivate();
		  }

	    _schedulerEngineHelper.register(this, _schedulerEntryImpl, DestinationNames.SCHEDULER_DISPATCH);
	    _initialized = true;
	  }
 
Example #21
Source File: Bmv2PreControllerImpl.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
protected void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();

    Integer newNumConnRetries = Tools.getIntegerProperty(properties, "numConnectionRetries");
    if (newNumConnRetries != null && newNumConnRetries >= 0) {
        numConnectionRetries = newNumConnRetries;
    } else {
        log.warn("numConnectionRetries must be equal to or greater than 0");
    }

    Integer newTimeBtwRetries = Tools.getIntegerProperty(properties, "timeBetweenRetries");
    if (newTimeBtwRetries != null && newTimeBtwRetries >= 0) {
        timeBetweenRetries = newTimeBtwRetries;
    } else {
        log.warn("timeBetweenRetries must be equal to or greater than 0");
    }

    Integer newDeviceLockWaitingTime = Tools.getIntegerProperty(properties, "deviceLockWaitingTime");
    if (newDeviceLockWaitingTime != null && newDeviceLockWaitingTime >= 0) {
        deviceLockWaitingTime = newDeviceLockWaitingTime;
    } else {
        log.warn("deviceLockWaitingTime must be equal to or greater than 0");
    }
}
 
Example #22
Source File: DistributedPacketStore.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();

    int newMessageHandlerThreadPoolSize;

    try {
        String s = get(properties, DPS_MESSAGE_HANDLER_THREAD_POOL_SIZE);

        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);
}
 
Example #23
Source File: OpenstackVtapManager.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
protected void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();

    boolean updatedTunnelNicira = Tools.isPropertyEnabled(properties, TUNNEL_NICIRA);
    if (tunnelNicira != updatedTunnelNicira) {
        if (Objects.equals(localNodeId, leadershipService.getLeader(appId.name()))) {
            // Update the tunnel flow rule by reflecting the change.
            osNodeService.completeNodes(COMPUTE)
                    .forEach(osNode -> applyVtapNetwork(getVtapNetwork(), osNode, false));
            tunnelNicira = updatedTunnelNicira;
            osNodeService.completeNodes(COMPUTE).stream()
                    .filter(osNode -> osNode.state() == COMPLETE)
                    .forEach(osNode -> applyVtapNetwork(getVtapNetwork(), osNode, true));
            log.debug("Apply {} nicira extension for tunneling", tunnelNicira ? "enable" : "disable");
        } else {
            tunnelNicira = updatedTunnelNicira;
        }
    }

    log.info("Modified");
}
 
Example #24
Source File: HostManager.java    From onos with Apache License 2.0 6 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    boolean oldValue = monitorHosts;
    readComponentConfiguration(context);
    if (probeRate > 0) {
        monitor.setProbeRate(probeRate);
    } else {
        log.warn("ProbeRate cannot be less than 0");
    }

    if (oldValue != monitorHosts) {
        if (monitorHosts) {
            startMonitoring();
        } else {
            stopMonitoring();
        }
    }
}
 
Example #25
Source File: SafeCallerImpl.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Modified
public void modified(@Nullable Map<String, Object> properties) {
    if (properties != null) {
        String enabled = (String) properties.get("singleThread");
        manager.setEnforceSingleThreadPerIdentifier("true".equalsIgnoreCase(enabled));
    }
}
 
Example #26
Source File: AutomaticInboxProcessor.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Modified
protected void modified(@Nullable Map<String, @Nullable Object> properties) {
    if (properties != null) {
        Object value = properties.get(AUTO_IGNORE_CONFIG_PROPERTY);
        autoIgnore = value == null || !"false".equals(value.toString());
        value = properties.get(ALWAYS_AUTO_APPROVE_CONFIG_PROPERTY);
        alwaysAutoApprove = value != null && "true".equals(value.toString());
        autoApproveInboxEntries();
    }
}
 
Example #27
Source File: I18nProviderImpl.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Modified
protected synchronized void modified(Map<String, Object> config) {
    final String language = toStringOrNull(config.get(LANGUAGE));
    final String script = toStringOrNull(config.get(SCRIPT));
    final String region = toStringOrNull(config.get(REGION));
    final String variant = toStringOrNull(config.get(VARIANT));
    final String location = toStringOrNull(config.get(LOCATION));
    final String zoneId = toStringOrNull(config.get(TIMEZONE));
    final String measurementSystem = toStringOrNull(config.get(MEASUREMENT_SYSTEM));

    setTimeZone(zoneId);
    setLocation(location);
    setLocale(language, script, region, variant);
    setMeasurementSystem(measurementSystem);
}
 
Example #28
Source File: WebClientFactoryImpl.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Modified
protected void modified(Map<String, Object> parameters) {
    getConfigParameters(parameters);
    if (threadPool != null) {
        threadPool.setMinThreads(minThreadsShared);
        threadPool.setMaxThreads(maxThreadsShared);
        threadPool.setIdleTimeout(keepAliveTimeoutShared * 1000);
    }
}
 
Example #29
Source File: MeterManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Modified
public void modified(ComponentContext context) {
    if (context != null) {
        readComponentConfiguration(context);
    }
    defaultProvider.init(deviceService, createProviderService(defaultProvider),
                         mastershipService, fallbackMeterPollFrequency);
}
 
Example #30
Source File: NeighbourResolutionManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Modified
protected void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();
    Boolean flag;

    flag = Tools.isPropertyEnabled(properties, NRM_NDP_ENABLED);
    if (flag != null) {
        ndpEnabled = flag;
        log.info("IPv6 neighbor discovery is {}",
                ndpEnabled ? "enabled" : "disabled");
    }

    flag = Tools.isPropertyEnabled(properties, NRM_ARP_ENABLED);
    if (flag != null) {
        arpEnabled = flag;
        log.info("Address resolution protocol is {}",
                 arpEnabled ? "enabled" : "disabled");
    }

    flag = Tools.isPropertyEnabled(properties, NRM_REQUEST_INTERCEPTS_ENABLED);
    if (flag == null) {
        log.info("Request intercepts is not configured, " +
                         "using current value of {}", requestInterceptsEnabled);
    } else {
        requestInterceptsEnabled = flag;
        log.info("Configured. Request intercepts is {}",
                 requestInterceptsEnabled ? "enabled" : "disabled");
    }

    synchronized (packetHandlers) {
        if (!packetHandlers.isEmpty() && requestInterceptsEnabled) {
            requestPackets();
        } else {
            cancelPackets();
        }
    }
}