Example usage for twitter4j.conf Configuration getMediaProviderAPIKey

List of usage examples for twitter4j.conf Configuration getMediaProviderAPIKey

Introduction

In this page you can find the example usage for twitter4j.conf Configuration getMediaProviderAPIKey.

Prototype

String getMediaProviderAPIKey();

Source Link

Usage

From source file:cmu.edu.homework.mediaUpload.PhotoUploadFactory.java

License:Apache License

/**
 * Creates an PhotoUploadFactory with the specified configuration
 * @param conf configuration to be associated
 *//*  ww  w  .  jav  a 2 s . c om*/
public PhotoUploadFactory(Configuration conf) {
    String mediaProvider = conf.getMediaProvider().toLowerCase();
    if ("twitter".equals(mediaProvider)) {
        defaultMediaProvider = TWITTER;
    } else if ("imgly".equals(mediaProvider) || "img_ly".equals(mediaProvider)) {
        defaultMediaProvider = IMG_LY;
    } else if ("twipple".equals(mediaProvider)) {
        defaultMediaProvider = TWIPPLE;
    } else if ("yfrog".equals(mediaProvider)) {
        defaultMediaProvider = YFROG;
    } else if ("mobypicture".equals(mediaProvider)) {
        defaultMediaProvider = MOBYPICTURE;
    } else {
        throw new IllegalArgumentException("unsupported media provider:" + mediaProvider);
    }
    this.conf = conf;
    apiKey = conf.getMediaProviderAPIKey();
}

From source file:cmu.edu.homework.mediaUpload.VideoUploadFactory.java

License:Apache License

/**
 * Creates an VideoUploadFactory with the specified configuration
 * @param conf configuration to be associated
 *//*from w  ww.ja va  2  s.  co m*/
public VideoUploadFactory(Configuration conf) {
    String mediaProvider = conf.getMediaProvider().toLowerCase();
    if ("twitter".equals(mediaProvider)) {
        defaultMediaProvider = TWITTER;
    } else if ("imgly".equals(mediaProvider) || "img_ly".equals(mediaProvider)) {
        defaultMediaProvider = IMG_LY;
    } else if ("twipple".equals(mediaProvider)) {
        defaultMediaProvider = TWIPPLE;
    } else if ("yfrog".equals(mediaProvider)) {
        defaultMediaProvider = YFROG;
    } else if ("mobypicture".equals(mediaProvider)) {
        defaultMediaProvider = MOBYPICTURE;
    } else {
        throw new IllegalArgumentException("unsupported media provider:" + mediaProvider);
    }
    this.conf = conf;
    apiKey = conf.getMediaProviderAPIKey();
}