Search in sources :

Example 1 with Configurator

use of org.codice.ddf.admin.configurator.Configurator in project admin-console-beta by connexta.

the class SaveContextPolices method performFunction.

@Override
public ListField<ContextPolicyBin> performFunction() {
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.updateConfigFile(POLICY_MANAGER_PID, new PolicyManagerServiceProperties().contextPoliciesToPolicyManagerProps(contextPolicies.getList()), true);
    OperationReport configReport = configurator.commit("Web Context Policy saved with details: {}", contextPolicies.toString());
    if (configReport.containsFailedResults()) {
        addResultMessage(failedPersistError());
    }
    return containsErrorMsgs() ? null : contextPolicies;
}
Also used : PolicyManagerServiceProperties(org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport)

Example 2 with Configurator

use of org.codice.ddf.admin.configurator.Configurator in project admin-console-beta by connexta.

the class SaveWhitelistContexts method performFunction.

@Override
public ListField<ContextPath> performFunction() {
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.updateConfigFile(PolicyManagerServiceProperties.POLICY_MANAGER_PID, new PolicyManagerServiceProperties().whiteListToPolicyManagerProps(contexts), true);
    OperationReport configReport = configurator.commit("Whitelist Contexts saved with details: {}", contexts.toString());
    if (configReport.containsFailedResults()) {
        addResultMessage(failedPersistError());
    }
    return configReport.containsFailedResults() ? null : contexts;
}
Also used : PolicyManagerServiceProperties(org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport)

Example 3 with Configurator

use of org.codice.ddf.admin.configurator.Configurator in project admin-console-beta by connexta.

the class ServiceCommons method createManagedService.

public static ReportImpl createManagedService(Map<String, Object> serviceProps, String factoryPid, ConfiguratorFactory configuratorFactory) {
    ReportImpl report = new ReportImpl();
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.createManagedService(factoryPid, serviceProps);
    if (configurator.commit("Service saved with details [{}]", serviceProps.toString()).containsFailedResults()) {
        report.addResultMessage(failedPersistError());
    }
    return report;
}
Also used : Configurator(org.codice.ddf.admin.configurator.Configurator) ReportImpl(org.codice.ddf.admin.common.report.ReportImpl)

Example 4 with Configurator

use of org.codice.ddf.admin.configurator.Configurator in project admin-console-beta by connexta.

the class ServiceCommons method deleteService.

public static ReportImpl deleteService(PidField servicePid, ConfiguratorFactory configuratorFactory) {
    ReportImpl report = new ReportImpl();
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.deleteManagedService(servicePid.getValue());
    if (configurator.commit("Deleted source with pid [{}].", servicePid.getValue()).containsFailedResults()) {
        report.addResultMessage(failedDeleteError());
    }
    return report;
}
Also used : Configurator(org.codice.ddf.admin.configurator.Configurator) ReportImpl(org.codice.ddf.admin.common.report.ReportImpl)

Example 5 with Configurator

use of org.codice.ddf.admin.configurator.Configurator in project admin-console-beta by connexta.

the class InstallEmbeddedLdap method performFunction.

@Override
public BooleanField performFunction() {
    // TODO: tbatie - 4/4/17 - This should return back the setup config
    Configurator configurator = configuratorFactory.getConfigurator();
    switch(useCase.getValue()) {
        case LOGIN:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_LOGIN_FEATURE);
            configurator.startFeature(DEFAULT_EMBEDDED_LDAP_LOGIN_CONFIG_FEATURE);
            break;
        case ATTRIBUTE_STORE:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_CLAIMS_HANDLER_FEATURE);
            configurator.startFeature(DEFAULT_EMBEDDED_LDAP_CLAIMS_HANDLER_CONFIG_FEATURE);
            break;
        case LOGIN_AND_ATTRIBUTE_STORE:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_LOGIN_FEATURE);
            configurator.startFeature(LDAP_CLAIMS_HANDLER_FEATURE);
            configurator.startFeature(ALL_DEFAULT_EMBEDDED_LDAP_CONFIG_FEATURE);
            break;
        default:
            LOGGER.debug("Unrecognized LDAP use case \"{}\". No commits will be made. ", useCase.getValue());
            // TODO: tbatie - 4/4/17 - change this to specify the arg that was unknown
            addResultMessage(new ErrorMessage("FAILED_PERSIST"));
            return new BooleanField(false);
    }
    OperationReport report = configurator.commit();
    if (report.containsFailedResults()) {
        addResultMessage(new ErrorMessage("CANNOT_INSTALL"));
        return new BooleanField(false);
    }
    return new BooleanField(true);
}
Also used : BooleanField(org.codice.ddf.admin.common.fields.base.scalar.BooleanField) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport) ErrorMessage(org.codice.ddf.admin.common.report.message.ErrorMessage)

Aggregations

Configurator (org.codice.ddf.admin.configurator.Configurator)8 OperationReport (org.codice.ddf.admin.configurator.OperationReport)6 ReportImpl (org.codice.ddf.admin.common.report.ReportImpl)3 PolicyManagerServiceProperties (org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties)2 Path (java.nio.file.Path)1 BooleanField (org.codice.ddf.admin.common.fields.base.scalar.BooleanField)1 ErrorMessage (org.codice.ddf.admin.common.report.message.ErrorMessage)1