/*
 * Copyright 2019, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.examples.todolist.server;

import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.firestore.Firestore;
import com.google.common.flogger.FluentLogger;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.cloud.FirestoreClient;
import io.spine.logging.Logging;
import org.slf4j.Logger;

import java.io.IOException;
import java.io.InputStream;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * A utility for working with the Firebase client API.
 */
final class FirebaseClients {

    private static final String FIREBASE_SERVICE_ACC_SECRET = "serviceAccount.json";
    private static final String DATABASE_URL = "https://spine-firestore-test.firebaseio.com";

    /**
     * The {@code private} constructor prevents the utility class instantiation.
     */
    private FirebaseClients() {}

    /**
     * Initializes the Cloud Firestore API with the service account credentials.
     *
     * <p>To performs the initialization successfully, the configuration file
     * {@code serviceAccount.json} should be present in the classpath.
     *
     * @return the initialized instance of {@link Firestore}
     */
    public static Firestore initializeFirestore() {
        InputStream firebaseSecret = FirebaseClients.class
                .getClassLoader()
                .getResourceAsStream(FIREBASE_SERVICE_ACC_SECRET);
        checkNotNull(firebaseSecret,
                     "Required credentials file '%s' does not exist.", FIREBASE_SERVICE_ACC_SECRET);
        GoogleCredentials credentials;
        try {
            credentials = GoogleCredentials.fromStream(firebaseSecret);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        FirebaseOptions options = new FirebaseOptions.Builder()
                .setDatabaseUrl(DATABASE_URL)
                .setCredentials(credentials)
                .build();
        FirebaseApp.initializeApp(options);
        Firestore firestore = FirestoreClient.getFirestore();
        return firestore;
    }
}

@@ -1148,55 +1148,8 @@
 re;%0A
-import com.google.common.flogger.FluentLogger;%0A
 impo
@@ -1281,66 +1281,8 @@
 ent;
-%0Aimport io.spine.logging.Logging;%0Aimport org.slf4j.Logger;
 %0A%0Aim
@@ -1687,60 +1687,39 @@
  /**
-%0A     * The %7B@code private%7D constructor prevents the
+ Prevents instantiation of this
  uti
@@ -1732,28 +1732,9 @@
 lass
- instantiation.%0A    
+.
  */%0A

Simplify Javadoc