com.kii.cloud.storage
Class Kii

java.lang.Object
  extended by com.kii.cloud.storage.Kii

public final class Kii
extends java.lang.Object

This class provides:

  • Manages application key and application id. Call initialize(String, String, String) prior to use SDK.
  • Cancel async task by cancelTask(int)
  • Provides SDK information.


    Nested Class Summary
    static class Kii.Site
               
     
    Field Summary
    protected  java.lang.String mAppId
              Application ID which is provided by Developer Portal
    protected  java.lang.String mAppKey
              Application key which is provided by Developer Portal
     
    Method Summary
    static KiiBucket bucket(java.lang.String bucketName)
              Returns the KiiBucket which is open for application user.
    static boolean cancelTask(int token)
              Cancel the background task.
    static KiiFileBucket fileBucket(java.lang.String bucketName)
              Returns the KiiFileBucket which stores KiiFiles.
    static java.lang.String getAppId()
              Application ID
    static java.lang.String getAppKey()
              Application Key
    static java.lang.String getBaseURL()
              URL for KiiCloudStorage Server
    static java.lang.String getBuildNumber()
              KiiCloudStorage SDK Build Number
    static java.lang.String getSDKVersion()
              KiiCloudStorage SDK Version Number
    static KiiGroup group(java.lang.String groupName)
              Create a group own by current user.
    No other member will be added to the group.
    : Group owner(current log-in user) will be added as a group member by default.
    static KiiGroup group(java.lang.String groupName, java.util.List<KiiUser> groupMembers)
              Create a group own by current user assigning the specified users as group members.
    : Group owner will be added as a group member also by default.
    static void initialize(java.lang.String appId, java.lang.String appKey)
              Initialize KiiCloudStorage SDK and this must be call prior to all APIs call.
    static void initialize(java.lang.String appId, java.lang.String appKey, Kii.Site site)
              Initialize KiiCloudStorage SDK and this must be call prior to all APIs call.
    static void initialize(java.lang.String appId, java.lang.String appKey, java.lang.String serverUrl)
              Initialize KiiCloudStorage SDK and this must be call prior to all APIs call.
    static KiiSocialConnect socialConnect(KiiSocialConnect.SocialNetwork network)
              Return an instance of the KiiSocialConnect.
    static KiiTopic topic(java.lang.String name)
              Get instance of app scope topic.
    static KiiUser user()
              Returns logged in user.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    mAppId

    protected java.lang.String mAppId
    Application ID which is provided by Developer Portal


    mAppKey

    protected java.lang.String mAppKey
    Application key which is provided by Developer Portal

    Method Detail

    bucket

    public static KiiBucket bucket(java.lang.String bucketName)
    Returns the KiiBucket which is open for application user.

    Parameters:
    bucketName - is a name of KiiBucket.
    Returns:
    KiiBucket open for application user.
    Throws:
    java.lang.IllegalArgumentException - when bucketName is not acceptable format. For details please refer to KiiBucket.isValidBucketName(String)

    cancelTask

    public static boolean cancelTask(int token)
    Cancel the background task.
    NOTE: This method should be executed in UI thread.

    Parameters:
    token - is a unique id given when an asynchronous task is called
    Returns:
    true if cancel is successful else false. Cancel can fail if token is not found.
    Throws:
    WrongThreadException - Thrown if this method is not executed in UI thread.

    fileBucket

    public static KiiFileBucket fileBucket(java.lang.String bucketName)
    Returns the KiiFileBucket which stores KiiFiles. kiiFileBucket always Belongs to current login user. Same as calling KiiUser.fileBucket(String)

    Parameters:
    bucketName - is a name of KiiBucket.
    Returns:
    KiiFileBucket which stores KiiFiles.
    Throws:
    java.lang.IllegalStateException - Thrown if user is not logged in.
    java.lang.IllegalArgumentException - Thrown when bucketName is not acceptable format. For details please refer to KiiFileBucket.isValidFileBucketName(String)

    getAppId

    public static java.lang.String getAppId()
    Application ID


    getAppKey

    public static java.lang.String getAppKey()
    Application Key


    getBaseURL

    public static java.lang.String getBaseURL()
    URL for KiiCloudStorage Server


    getBuildNumber

    public static java.lang.String getBuildNumber()
    KiiCloudStorage SDK Build Number


    getSDKVersion

    public static java.lang.String getSDKVersion()
    KiiCloudStorage SDK Version Number


    group

    public static KiiGroup group(java.lang.String groupName)
    Create a group own by current user.
    No other member will be added to the group.
    : Group owner(current log-in user) will be added as a group member by default. This api will NOT access to server immediately. After call this api, call save() to save the group to the cloud.

    Parameters:
    groupName - Name of the group.
    Returns:
    KiiGroup instance.

    group

    public static KiiGroup group(java.lang.String groupName,
                                 java.util.List<KiiUser> groupMembers)
    Create a group own by current user assigning the specified users as group members.
    : Group owner will be added as a group member also by default. This api will NOT access to server immediately. After call this api, call save() to save the group to the cloud.

    Parameters:
    groupName - Name of the group.
    groupMembers - Members of the group. Group owner will be added as a group member no matter owner is in the list or not.
    Returns:
    KiiGroup instance.

    initialize

    public static void initialize(java.lang.String appId,
                                  java.lang.String appKey)
    Initialize KiiCloudStorage SDK and this must be call prior to all APIs call. It is pointing to the Default Development KiiCloud Server.

    Parameters:
    appId - application ID found in your Kii developer console
    appKey - application key found in your Kii developer console
    Throws:
    java.lang.IllegalArgumentException - Thrown if specified appId/appKey is null or different from original when SDK is already initialized.

    initialize

    public static void initialize(java.lang.String appId,
                                  java.lang.String appKey,
                                  Kii.Site site)
    Initialize KiiCloudStorage SDK and this must be call prior to all APIs call.

    Parameters:
    appId - application ID found in your Kii developer console.
    appKey - application key found in your Kii developer console.
    site - KiiCloud site.
    Throws:
    java.lang.IllegalArgumentException - Thrown specified appId/appKey/site is null or different from original when SDK is already initialized.

    initialize

    public static void initialize(java.lang.String appId,
                                  java.lang.String appKey,
                                  java.lang.String serverUrl)
    Initialize KiiCloudStorage SDK and this must be call prior to all APIs call.

    Parameters:
    appId - application ID found in your Kii developer console
    appKey - application key found in your Kii developer console
    serverUrl - the KiiCloud base URL
    Throws:
    java.lang.IllegalArgumentException - Thrown if specified appId/appKey/serverUrl is null or different from original when SDK is already initialized.

    socialConnect

    public static KiiSocialConnect socialConnect(KiiSocialConnect.SocialNetwork network)
    Return an instance of the KiiSocialConnect. This API needs specified social network service name.

    Parameters:
    network - Social network service name.
    Returns:
    KiiSocialConnect instance.

    topic

    public static KiiTopic topic(java.lang.String name)
    Get instance of app scope topic. The topic bound to the application.

    Parameters:
    name -
    Returns:
    KiiTopic bound to the application.

    user

    public static KiiUser user()
    Returns logged in user.

    Returns:
    user logged in. null if no user logged in.