Example usage for com.amazonaws.services.sns.model CreatePlatformEndpointResult getEndpointArn

List of usage examples for com.amazonaws.services.sns.model CreatePlatformEndpointResult getEndpointArn

Introduction

In this page you can find the example usage for com.amazonaws.services.sns.model CreatePlatformEndpointResult getEndpointArn.

Prototype


public String getEndpointArn() 

Source Link

Document

EndpointArn returned from CreateEndpoint action.

Usage

From source file:AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(SampleMessageGenerator.Platform platform, String principal, String credential,
        String platformToken, String applicationName,
        Map<SampleMessageGenerator.Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform./*from   www.  j a v  a  2s .  c om*/
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.aws.sns.service.notifications.sns.AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap, String messageText,
        String payloadAction, String collapseKey) {

    // Create Platform Application. This corresponds to an app on a
    // platform.//from  ww w  .  ja  v  a  2  s.co  m
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap,
            messageText, payloadAction, collapseKey);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.cloudbees.gasp.services.APNRegistrationService.java

License:Apache License

@POST
@Path("register")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response doRegister(@FormParam("token") String token) {
    try {/*from w  w  w  .  j av  a 2  s .c om*/
        // Create an SNS app endpoint
        CreatePlatformEndpointResult platformEndpointResult = snsMobile
                .createPlatformEndpoint("Gasp APN Platform Endpoint", token, snsMobile.getApnPlatformArn());

        APNDataStore.registerArn(token, platformEndpointResult.getEndpointArn());
        LOGGER.info("Registered: " + platformEndpointResult.getEndpointArn());

    } catch (AmazonServiceException ase) {
        LOGGER.debug("AmazonServiceException");
        LOGGER.debug("  Error Message:    " + ase.getMessage());
        LOGGER.debug("  HTTP Status Code: " + ase.getStatusCode());
        LOGGER.debug("  AWS Error Code:   " + ase.getErrorCode());
        LOGGER.debug("  Error Type:       " + ase.getErrorType());
        LOGGER.debug("  Request ID:       " + ase.getRequestId());
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    } catch (AmazonClientException ace) {
        LOGGER.debug("AmazonClientException");
        LOGGER.debug("  Error Message: " + ace.getMessage());
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }

    return Response.status(Response.Status.OK).build();
}

From source file:com.cloudbees.gasp.services.GCMRegistrationService.java

License:Apache License

@POST
@Path("register")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response doRegister(@FormParam("regId") String regId) {

    try {//w w w.  jav a  2  s .  c o  m
        CreatePlatformEndpointResult platformEndpointResult = snsMobile
                .createPlatformEndpoint("Gasp GCM Platform Endpoint", regId, snsMobile.getGcmPlatformArn());

        GCMDataStore.registerArn(regId, platformEndpointResult.getEndpointArn());
        LOGGER.info("Registered: " + platformEndpointResult.getEndpointArn());

    } catch (AmazonServiceException ase) {
        LOGGER.debug("AmazonServiceException");
        LOGGER.debug("  Error Message:    " + ase.getMessage());
        LOGGER.debug("  HTTP Status Code: " + ase.getStatusCode());
        LOGGER.debug("  AWS Error Code:   " + ase.getErrorCode());
        LOGGER.debug("  Error Type:       " + ase.getErrorType());
        LOGGER.debug("  Request ID:       " + ase.getRequestId());
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    } catch (AmazonClientException ace) {
        LOGGER.debug("AmazonClientException");
        LOGGER.debug("  Error Message: " + ace.getMessage());
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }

    return Response.status(Response.Status.OK).build();
}

From source file:com.dev.appx.sns.tools.AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform.//w ww  .ja  va 2  s. co  m
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.gafful.AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform./*w  w w. j  ava2 s .  c  o  m*/
    //      CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(
    //            applicationName, platform, principal, credential);
    //      System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    //      String platformApplicationArn = platformApplicationResult
    //            .getPlatformApplicationArn();

    String platformApplicationArn = "arn:aws:sns:us-east-1:856247355946:app/GCM/testiWalletPush";

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    //      deletePlatformApplication(platformApplicationArn);
}

From source file:com.gafful.AmazonSNSClientWrapper.java

License:Open Source License

public void createPlatformEndpointResult(Platform platform, String platformApplicationArn, String platformToken,
        Map<Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform./*from   www. ja v a 2  s.  c o m*/
    //      CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(
    //            applicationName, platform, principal, credential);
    //      System.out.println(platformApplicationResult);
    //
    //      // The Platform Application Arn can be used to uniquely identify the
    //      // Platform Application.
    //      String platformApplicationArn = platformApplicationResult
    //            .getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.hrt.modules.aws.sns.AmazonSnsClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform.//w w w . j a v a2 s.  co  m
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    System.out.println("\n\n>>>>>>    platformEndpointResult.getEndpointArn()  =  "
            + platformEndpointResult.getEndpointArn() + "\n\n");

    //      String ARN = "arn:aws:sns:us-west-2:043482212558:endpoint/APNS_SANDBOX/Homeroom-Notifications/6c6c1c8e-19be-3a9c-82e4-b5fab2e2a603";
    //      PublishResult publishResult = publish( ARN, platform, attrsMap);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");

    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.mistminds.service.AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap,
        Map<String, String> pushData) {
    // Create Platform Application. This corresponds to an app on a
    // platform.// w  ww  .  j  a  v  a2s.c o  m
    pushData.remove("installationId");
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap,
            pushData);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.onemenu.server.util.awsnotification.tools.AmazonSNSClientWrapper.java

License:Open Source License

public void notification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap, String message) {
    // Create Platform Application. This corresponds to an app on a
    // platform.//ww w  .ja  v  a 2s .c o  m
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap, message);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}