public static ServiceState ReadEffectiveComponentState(string targetServerFqdn, MultiValuedProperty <string> adComponentStates, ServerComponentStateSources sourcesToUse, string component, ServiceState defaultState) { bool flag; List <ServerComponentStates.ItemEntry> list; List <ServerComponentStates.ItemEntry> list2; return(ServerComponentStates.ReadEffectiveComponentState(targetServerFqdn, adComponentStates, sourcesToUse, component, defaultState, out flag, out list, out list2)); }
private static List <ServerComponentStates.ItemEntry> GetReconciledStates(string targetServerFqdn, MultiValuedProperty <string> adComponentStates, ServerComponentStateSources sourcesToUse, string component, out List <ServerComponentStates.ItemEntry> localStates, out List <ServerComponentStates.ItemEntry> remoteStates) { localStates = null; remoteStates = null; List <ServerComponentStates.ItemEntry> localStatesTemp = null; List <ServerComponentStates.ItemEntry> result = null; if (sourcesToUse.HasFlag(ServerComponentStateSources.Registry)) { Exception ex = ServerComponentStateManager.RunLocalRegistryOperationNoThrow(delegate { localStatesTemp = ServerComponentStates.GetLocalStates(targetServerFqdn, component); }); if (ex != null && !sourcesToUse.HasFlag(ServerComponentStateSources.AD)) { throw new ServerComponentApiException(DirectoryStrings.ServerComponentLocalRegistryError(ex.ToString()), ex); } localStates = localStatesTemp; result = localStatesTemp; } if (sourcesToUse.HasFlag(ServerComponentStateSources.AD)) { remoteStates = ServerComponentStates.GetRemoteStates(adComponentStates, component); result = remoteStates; } if (localStates != null && remoteStates != null) { result = ServerComponentStates.ReconcileStates(localStates, remoteStates); } return(result); }
public static ServiceState ReadEffectiveComponentState(string targetServerFqdn, MultiValuedProperty <string> adComponentStates, ServerComponentStateSources sourcesToUse, string component, ServiceState defaultState, out bool serverWideIsInactive, out List <ServerComponentStates.ItemEntry> returnLocalStates, out List <ServerComponentStates.ItemEntry> returnRemoteStates) { if (!ServerComponentStates.IsValidName(component)) { throw new ArgumentException(DirectoryStrings.ComponentNameInvalid); } if (sourcesToUse == (ServerComponentStateSources)0) { throw new ArgumentException("sourcesToUse argument must have at least one source"); } serverWideIsInactive = false; List <ServerComponentStates.ItemEntry> reconciledStates = ServerComponentStates.GetReconciledStates(targetServerFqdn, adComponentStates, sourcesToUse, component, out returnLocalStates, out returnRemoteStates); if (!string.Equals(component, ServerComponentStates.MonitoringComponentId, StringComparison.OrdinalIgnoreCase) && !string.Equals(component, ServerComponentStates.RecoveryActionsEnabledComponentId, StringComparison.OrdinalIgnoreCase)) { ServiceState effectiveState; if (string.Equals(component, ServerComponentStates.ServerWideOfflineComponentId, StringComparison.OrdinalIgnoreCase)) { effectiveState = ServerComponentStates.GetEffectiveState(reconciledStates, ServiceState.Active); if (effectiveState != ServiceState.Active) { serverWideIsInactive = true; } return(effectiveState); } List <ServerComponentStates.ItemEntry> list; List <ServerComponentStates.ItemEntry> list2; List <ServerComponentStates.ItemEntry> reconciledStates2 = ServerComponentStates.GetReconciledStates(targetServerFqdn, adComponentStates, sourcesToUse, ServerComponentStates.ServerWideOfflineComponentId, out list, out list2); effectiveState = ServerComponentStates.GetEffectiveState(reconciledStates2, ServiceState.Active); if (effectiveState != ServiceState.Active) { serverWideIsInactive = true; return(ServiceState.Inactive); } } return(ServerComponentStates.GetEffectiveState(reconciledStates, defaultState)); }
internal static ServiceState ReadDirectComponentState(string targetServerFqdn, MultiValuedProperty <string> adComponentStates, ServerComponentStateSources sourcesToUse, string component, ServiceState defaultState, out List <ServerComponentStates.ItemEntry> returnLocalStates, out List <ServerComponentStates.ItemEntry> returnRemoteStates) { if (!ServerComponentStates.IsValidName(component)) { throw new ArgumentException(DirectoryStrings.ComponentNameInvalid); } List <ServerComponentStates.ItemEntry> reconciledStates = ServerComponentStates.GetReconciledStates(targetServerFqdn, adComponentStates, sourcesToUse, component, out returnLocalStates, out returnRemoteStates); return(ServerComponentStates.GetEffectiveState(reconciledStates, defaultState)); }