com.aipo.aws.sns.SNS.java Source code

Java tutorial

Introduction

Here is the source code for com.aipo.aws.sns.SNS.java

Source

/*
 * This file is part of the com.aipo.aws package.
 * Copyright (C) 2004-2011 Aimluck,Inc.
 * http://www.aipo.com
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

package com.aipo.aws.sns;

import com.aipo.aws.AWSContext;
import com.amazonaws.services.sns.AmazonSNS;
import com.amazonaws.services.sns.AmazonSNSClient;

/**
 * 
 */
public class SNS {

    public static AmazonSNS getClient() {
        AWSContext awsContext = AWSContext.get();
        if (awsContext == null) {
            throw new IllegalStateException("AWSContext is not initialized.");
        }
        AmazonSNS client = new AmazonSNSClient(awsContext.getAwsCredentials());
        String endpoint = awsContext.getSnsEndpoint();
        if (endpoint != null && endpoint != "") {
            client.setEndpoint(endpoint);
        }
        return client;
    }

}