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 *
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * Copyright 2015 ForgeRock AS.
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington */
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonpackage com.sun.identity.cli;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport java.lang.annotation.Annotation;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport java.util.HashSet;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport java.util.Set;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.guice.core.GuiceModuleLoader;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.license.LicenseGuiceModule;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.license.LicensePresenterGuiceModule;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport org.forgerock.openam.shared.guice.SharedGuiceModule;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonimport com.google.inject.Module;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington/**
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * Guice module loader for loading CLI specific Guice modules.
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington *
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * <p>This is required so as to be able to load the {@link CliGuiceModule} which contains duplicate
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * bindings from CoreGuiceModule which cannot be loaded by the server.</p>
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington *
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington * @since 13.0.0
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington */
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunningtonpublic class CliGuiceModuleLoader implements GuiceModuleLoader {
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington @Override
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington public Set<Class<? extends Module>> getGuiceModules(Class<? extends Annotation> moduleAnnotation) {
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington Set<Class<? extends Module>> moduleClasses = new HashSet<>();
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington moduleClasses.add(LicensePresenterGuiceModule.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington moduleClasses.add(SharedGuiceModule.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington moduleClasses.add(LicenseGuiceModule.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington moduleClasses.add(CliGuiceModule.class);
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington return moduleClasses;
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington }
231b2dbbbc26e620c41026c9211d248e47859b51Phill Cunnington}