本文整理汇总了Java中org.osgi.service.cm.ConfigurationEvent.getPid方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationEvent.getPid方法的具体用法?Java ConfigurationEvent.getPid怎么用?Java ConfigurationEvent.getPid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgi.service.cm.ConfigurationEvent
的用法示例。
在下文中一共展示了ConfigurationEvent.getPid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configurationEvent
import org.osgi.service.cm.ConfigurationEvent; //导入方法依赖的package包/类
@Override
public void configurationEvent(final ConfigurationEvent event) {
final int type = event.getType();
final String pid = event.getPid();
if (type == CM_UPDATED) {
final Map<String, Boolean> configuredFeatures = getConfiguredFeatures(pid, configurationAdmin);
for (final Entry<String, Boolean> entry : configuredFeatures.entrySet()) {
final String featureID = entry.getKey();
final boolean isEnabled = entry.getValue();
final Collection<Feature> features = allFeatures.get(pid);
//@formatter:off
features.stream()
.filter(f -> f.id.equalsIgnoreCase(featureID))
.peek(f -> logger.log(LOG_INFO, String.format("Updated feature [%s] to [%b]", f.toString(), isEnabled)))
.forEach(f -> f.isEnabled = isEnabled);
//@formatter:on
}
} else {
allFeatures.removeAll(pid);
}
}
示例2: configurationEvent
import org.osgi.service.cm.ConfigurationEvent; //导入方法依赖的package包/类
@Override
public void configurationEvent(ConfigurationEvent event) {
try {
ConfigurationEventProperties cep = new ConfigurationEventProperties();
cep.factoryPid = event.getFactoryPid();
cep.pid = event.getPid();
if (ConfigurationEvent.CM_DELETED != event.getType()) {
Configuration configuration = cm.getConfiguration(event
.getPid());
cep.location = configuration.getBundleLocation();
Dictionary<String, Object> properties = configuration
.getProperties();
if (properties == null) {
cep.properties = new HashMap<>();
} else
cep.properties = toMap(properties);
}
ea.postEvent(new Event(TOPIC, dtos.asMap(cep)));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: configurationEvent
import org.osgi.service.cm.ConfigurationEvent; //导入方法依赖的package包/类
@Override
// [TODO] #47 Revisit configurationEvent on JmxAttributeProvider
// This is an asynchronous callback. How is data integrity preserved?
// Should this depend the the lifecycle of dependent components?
public void configurationEvent(ConfigurationEvent event) {
String pid = event.getPid();
if (pid.equals(MANAGEMENT_PID) && event.getType() == ConfigurationEvent.CM_UPDATED) {
processConfiguration();
}
}
示例4: configurationEvent
import org.osgi.service.cm.ConfigurationEvent; //导入方法依赖的package包/类
public void configurationEvent(ConfigurationEvent event) {
String pid = event.getPid();
ResourceEvent resourceEvent;
ConfigurationResource configurationResource;
try {
Configuration configuration = m_configAdmin.getConfiguration(pid);
if (!m_configurationResourceMap.containsKey(pid)) {
configurationResource = new ConfigurationResource(configuration);
synchronized (m_lock ) {
m_configurationResourceMap.put(pid, configurationResource);
}
resourceEvent = ResourceEvent.CREATED;
} else {
synchronized (m_lock ) {
configurationResource = m_configurationResourceMap.get(pid);
}
if (event.getType() != ConfigurationEvent.CM_DELETED) {
resourceEvent = ResourceEvent.UPDATED;
} else {
resourceEvent = ResourceEvent.DELETED;
synchronized (m_lock ) {
m_configurationResourceMap.remove(pid);
}
}
}
Everest.postResource(resourceEvent, configurationResource);
} catch (IOException e) {
// something gone wrong
//TODO
e.printStackTrace();
}
}