231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington/*
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * The contents of this file are subject to the terms of the Common Development and
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * Distribution License (the License). You may not use this file except in compliance with the
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * License.
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington *
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * specific language governing permission and limitations under the License.
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington *
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * When distributing Covered Software, include this CDDL Header Notice in each file and include
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * Header, with the fields enclosed by brackets [] replaced by your own identifying
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * information: "Portions copyright [year] [name of copyright owner]".
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington *
98edafaa1060580ef39bce8710345d9fe25b5b04Jaco Jooste * Copyright 2015-2016 ForgeRock AS.
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington */
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonpackage com.sun.identity.cli;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
fa05e27a78ade0db2062df64ae7f47b36d4cbf59Andrew Forrestimport org.forgerock.http.Client;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.configuration.ResourceTypeConfiguration;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.configuration.ResourceTypeConfigurationImpl;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.constraints.ConstraintValidator;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.constraints.ConstraintValidatorImpl;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.service.ApplicationService;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.service.ApplicationServiceFactory;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.service.ApplicationServiceImpl;
98edafaa1060580ef39bce8710345d9fe25b5b04Jaco Joosteimport org.forgerock.openam.entitlement.service.EntitlementConfigurationFactory;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.service.ResourceTypeService;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.entitlement.service.ResourceTypeServiceImpl;
21a7dedf73d1ce1a0280e04ecedeea1075ffae81Ram Anaswaraimport org.forgerock.openam.entitlement.utils.NullNotificationBroker;
21a7dedf73d1ce1a0280e04ecedeea1075ffae81Ram Anaswaraimport org.forgerock.openam.notifications.NotificationBroker;
11b21972363c8a33a23740ce821de9027ee8b1e5Phill Cunningtonimport org.forgerock.openam.session.SessionCache;
2139cfcea25893c1d74a9d91d3e449a456d07df8Peter Majorimport org.forgerock.openam.shared.guice.CloseableHttpClientProvider;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
21a7dedf73d1ce1a0280e04ecedeea1075ffae81Ram Anaswaraimport com.google.inject.AbstractModule;
21a7dedf73d1ce1a0280e04ecedeea1075ffae81Ram Anaswaraimport com.google.inject.assistedinject.FactoryModuleBuilder;
21a7dedf73d1ce1a0280e04ecedeea1075ffae81Ram Anaswaraimport com.sun.identity.entitlement.EntitlementConfiguration;
21a7dedf73d1ce1a0280e04ecedeea1075ffae81Ram Anaswaraimport com.sun.identity.entitlement.opensso.EntitlementService;
21a7dedf73d1ce1a0280e04ecedeea1075ffae81Ram Anaswara
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington/**
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * Guice module for bindings that are required for the command line tools to work but are declared
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * in other Guice modules but we do not want/cannot have all of the other bindings declared in them
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * as well.
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington *
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * @since 13.0.0
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington */
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonpublic class CliGuiceModule extends AbstractModule {
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington @Override
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington protected void configure() {
21a7dedf73d1ce1a0280e04ecedeea1075ffae81Ram Anaswara bind(NotificationBroker.class).to(NullNotificationBroker.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington bind(ResourceTypeConfiguration.class).to(ResourceTypeConfigurationImpl.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington bind(ResourceTypeService.class).to(ResourceTypeServiceImpl.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington bind(ConstraintValidator.class).to(ConstraintValidatorImpl.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington install(new FactoryModuleBuilder()
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington .implement(ApplicationService.class, ApplicationServiceImpl.class)
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington .build(ApplicationServiceFactory.class));
11b21972363c8a33a23740ce821de9027ee8b1e5Phill Cunnington
98edafaa1060580ef39bce8710345d9fe25b5b04Jaco Jooste install(new FactoryModuleBuilder()
98edafaa1060580ef39bce8710345d9fe25b5b04Jaco Jooste .implement(EntitlementConfiguration.class, EntitlementService.class)
98edafaa1060580ef39bce8710345d9fe25b5b04Jaco Jooste .build(EntitlementConfigurationFactory.class));
98edafaa1060580ef39bce8710345d9fe25b5b04Jaco Jooste
11b21972363c8a33a23740ce821de9027ee8b1e5Phill Cunnington bind(SessionCache.class).toInstance(SessionCache.getInstance());
fa05e27a78ade0db2062df64ae7f47b36d4cbf59Andrew Forrest
2139cfcea25893c1d74a9d91d3e449a456d07df8Peter Major bind(Client.class).toProvider(CloseableHttpClientProvider.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington }
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington}