001package co.codewizards.cloudstore.core.appid;
002
003/**
004 * Service providing the identity of the currently running application.
005 * <p>
006 * CloudStore might be used as the base for another application, i.e. as a library.
007 * In this case, the identity of this other application should use consistent file and
008 * directory names, e.g. for its configuration. So for example, the configuration directory
009 * "~/.cloudstore" should be "~/.myapp" instead.
010 * <p>
011 * Additionally, the auto-update must use a different web-site.
012 * <p>
013 * Therefore, the other application should implement an {@code AppId} with a higher
014 * {@link #getPriority() priority} than the {@link CloudStoreAppId} (having the negative
015 * priority -100).
016 *
017 * @author Marco หงุ่ยตระกูล-Schulze - marco at codewizards dot co
018 */
019public interface AppId {
020
021        /**
022         * Gets the priority of this {@code AppId} implementation. The {@link AppIdRegistry} chooses
023         * the {@code AppId} with the highest priority (the greatest number).
024         * @return the priority of this {@code AppId} implementation.
025         */
026        int getPriority();
027
028        /**
029         * Gets the simple (short) ID without any qualifier prefix.
030         * <p>
031         * Example: "cloudstore"
032         * @return the simple (short) ID without any qualifier prefix. Never <code>null</code>.
033         */
034        String getSimpleId();
035
036        /**
037         * Gets the qualified (long) ID.
038         * <p>
039         * Example: "co.codewizards.cloudstore"
040         * @return the qualified (long) ID. Never <code>null</code>.
041         */
042        String getQualifiedId();
043
044        /**
045         * Gets the name used by humans.
046         * <p>
047         * Example: "CloudStore"
048         * @return the name used by humans. Never <code>null</code>.
049         */
050        String getName();
051
052        /**
053         * Gets the base-URL. Certain sub-URLs are expected beneath it.
054         * <p>
055         * <b>Important:</b> This URL must end on '/'!
056         * <p>
057         * Example: "http://cloudstore.codewizards.co/" (one of the expected sub-URLs is "http://cloudstore.codewizards.co/update/"
058         * where meta-data about the current version is expected).
059         * @return the base-URL (ending on '/'). Never <code>null</code>.
060         */
061        String getWebSiteBaseUrl();
062
063}