001/**
002 *
003 * Copyright 2020 Florian Schmaus
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smack;
018
019import java.io.InputStream;
020import java.util.logging.Logger;
021
022public class Smack {
023
024    private static final Logger LOGGER = Logger.getLogger(Smack.class.getName());
025
026    private static final String SMACK_ORG = "org.jivesoftware";
027
028    public static final String SMACK_PACKAGE = SMACK_ORG + ".smack";
029
030    /**
031     * Returns the Smack version information, eg "1.3.0".
032     *
033     * @return the Smack version information.
034     */
035    public static String getVersion() {
036        return SmackInitialization.SMACK_VERSION;
037    }
038
039    private static final String NOTICE_RESOURCE = SMACK_PACKAGE + "/NOTICE";
040
041    public static InputStream getNoticeStream() {
042        return ClassLoader.getSystemResourceAsStream(NOTICE_RESOURCE);
043    }
044
045    public static void ensureInitialized() {
046        if (SmackConfiguration.isSmackInitialized()) {
047            return;
048        }
049
050        String version = getVersion();
051        LOGGER.finest("Smack " + version + " has been initialized");
052    }
053}