in src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java [104:126]
public InstallTask createTask(final TaskResourceGroup group) {
final TaskResource toActivate = group.getActiveResource();
if ( !toActivate.getType().equals(InstallableResource.TYPE_CONFIG) ) {
return null;
}
final InstallTask result;
if (toActivate.getState() == ResourceState.UNINSTALL) {
// if this is an uninstall, check if we have to install an older version
// in this case we should do an update instead of uninstall/install (!)
final TaskResource second = group.getNextActiveResource();
if ( second != null
&& ( second.getState() == ResourceState.IGNORED || second.getState() == ResourceState.INSTALLED || second.getState() == ResourceState.INSTALL )
&& ( second.getDictionary() == null || second.getDictionary().get(InstallableResource.RESOURCE_IS_TEMPLATE) == null)) {
result = new ChangeStateTask(group, ResourceState.UNINSTALLED);
} else {
result = new ConfigRemoveTask(group, this.configAdmin);
}
} else {
result = new ConfigInstallTask(group, this.configAdmin);
}
return result;
}