List of usage examples for com.amazonaws.services.sns AmazonSNSClient getTopicAttributes
@Override
public GetTopicAttributesResult getTopicAttributes(String topicArn)
From source file:shnakkydoodle.notifying.provider.aws.AwsProvider.java
License:Open Source License
/** * Retrieve a notification topic// w w w . jav a 2s . co m * * @param name * @paramd Notifiation Topic */ @Override public NotificationTopic retrieveNotificationTopic(String name) { AmazonSNSClient snsClient = getSNSClient(); for (Topic topic : snsClient.listTopics().getTopics()) { GetTopicAttributesResult result = snsClient.getTopicAttributes(topic.getTopicArn()); if (result.getAttributes().get("DisplayName").equals(name)) { NotificationTopic instance = new NotificationTopic(); instance.setTopicId(topic.getTopicArn()); instance.setName(result.getAttributes().get("DisplayName")); instance.setDescription(""); return instance; } } return null; }
From source file:shnakkydoodle.notifying.provider.aws.AwsProvider.java
License:Open Source License
/** * Retrieve a specific notification topic for its id * /* ww w . j av a2 s . c o m*/ * @param topicId * @paramd Notifiation Topic */ @Override public NotificationTopic retrieveNotificationTopicForId(String topicId) { AmazonSNSClient snsClient = getSNSClient(); for (Topic topic : snsClient.listTopics().getTopics()) { GetTopicAttributesResult result = snsClient.getTopicAttributes(topic.getTopicArn()); if (topic.getTopicArn().equals(topicId)) { NotificationTopic instance = new NotificationTopic(); instance.setTopicId(topic.getTopicArn()); instance.setName(result.getAttributes().get("DisplayName")); instance.setDescription(""); return instance; } } return null; }
From source file:shnakkydoodle.notifying.provider.aws.AwsProvider.java
License:Open Source License
/** * Retrieve all notification topics/*from w w w.j a v a 2 s . c o m*/ * * @return NotificationTopics */ @Override public ArrayList<NotificationTopic> retrieveNotificationTopics() { ArrayList<NotificationTopic> data = new ArrayList<NotificationTopic>(); AmazonSNSClient snsClient = getSNSClient(); for (Topic topic : snsClient.listTopics().getTopics()) { GetTopicAttributesResult result = snsClient.getTopicAttributes(topic.getTopicArn()); NotificationTopic instance = new NotificationTopic(); instance.setTopicId(topic.getTopicArn()); instance.setName(result.getAttributes().get("DisplayName")); instance.setDescription(result.getAttributes().get("Description")); data.add(instance); } return data; }