use of org.onosproject.app.ApplicationEvent in project onos by opennetworkinglab.
the class SimpleApplicationStore method activate.
@Override
public void activate(ApplicationId appId) {
Application app = apps.get(appId);
if (app != null) {
setActive(appId.name());
states.put(appId, ACTIVE);
delegate.notify(new ApplicationEvent(APP_ACTIVATED, app));
}
}
use of org.onosproject.app.ApplicationEvent in project onos by opennetworkinglab.
the class SimpleApplicationStore method setPermissions.
@Override
public void setPermissions(ApplicationId appId, Set<Permission> permissions) {
Application app = getApplication(appId);
if (app != null) {
this.permissions.put(appId, permissions);
delegate.notify(new ApplicationEvent(APP_PERMISSIONS_CHANGED, app));
}
}
use of org.onosproject.app.ApplicationEvent in project onos by opennetworkinglab.
the class SimpleApplicationStore method deactivate.
@Override
public void deactivate(ApplicationId appId) {
Application app = apps.get(appId);
if (app != null) {
clearActive(appId.name());
states.put(appId, INSTALLED);
delegate.notify(new ApplicationEvent(APP_DEACTIVATED, app));
}
}
use of org.onosproject.app.ApplicationEvent in project onos by opennetworkinglab.
the class DistributedApplicationStore method setupApplicationAndNotify.
private void setupApplicationAndNotify(ApplicationId appId, Application app, InternalState state) {
// ACTIVATED state is handled separately in NextAppToActivateValueListener
if (state == INSTALLED) {
fetchBitsIfNeeded(app);
if (log.isTraceEnabled()) {
log.trace("{} has been installed", app.id());
}
notifyDelegate(new ApplicationEvent(APP_INSTALLED, app));
} else if (state == DEACTIVATED) {
if (log.isTraceEnabled()) {
log.trace("{} has been deactivated", app.id());
}
clearActive(appId.name());
notifyDelegate(new ApplicationEvent(APP_DEACTIVATED, app));
localStartedApps.remove(appId.name());
}
}
use of org.onosproject.app.ApplicationEvent in project onos by opennetworkinglab.
the class DistributedApplicationStore method setPermissions.
@Override
public void setPermissions(ApplicationId appId, Set<Permission> permissions) {
AtomicBoolean permissionsChanged = new AtomicBoolean(false);
Versioned<InternalApplicationHolder> appHolder = apps.computeIf(appId, v -> v != null && !Sets.symmetricDifference(v.permissions(), permissions).isEmpty(), (k, v) -> {
permissionsChanged.set(true);
return new InternalApplicationHolder(v.app(), v.state(), ImmutableSet.copyOf(permissions));
});
if (permissionsChanged.get()) {
if (log.isTraceEnabled()) {
log.trace("Permission changed for {}", appId);
}
notifyDelegate(new ApplicationEvent(APP_PERMISSIONS_CHANGED, appHolder.value().app()));
}
}
Aggregations