public void verifyPlatformApplication(AmazonSNS client) { try { if (!BatchCreatePlatformEndpointSample.listOfRegions .contains(this.region = this.applicationArn.split(":")[3])) { System.err.println("[ERROR] The region " + region + " is invalid"); System.exit(BatchCreatePlatformEndpointSample.MALFORMED_PROPERTIES_ERROR_CODE); } } catch (ArrayIndexOutOfBoundsException aioobe) { System.err.println("[ERROR] The ARN " + this.applicationArn + " is malformed"); System.exit(BatchCreatePlatformEndpointSample.MALFORMED_PROPERTIES_ERROR_CODE); } client.setEndpoint("https://sns." + this.region + ".amazonaws.com/"); try { GetPlatformApplicationAttributesRequest applicationAttributesRequest = new GetPlatformApplicationAttributesRequest(); applicationAttributesRequest .setPlatformApplicationArn(this.applicationArn); @SuppressWarnings("unused") GetPlatformApplicationAttributesResult getAttributesResult = client .getPlatformApplicationAttributes(applicationAttributesRequest); } catch (NotFoundException nfe) { System.err .println("[ERROR: APP NOT FOUND] The application ARN provided: " + this.applicationArn + " does not correspond to any existing platform applications. " + nfe.getMessage()); System.exit(BatchCreatePlatformEndpointSample.NOT_FOUND_ERROR_CODE); } catch (InvalidParameterException ipe) { System.err .println("[ERROR: APP ARN INVALID] The application ARN provided: " + this.applicationArn + " is malformed" + ipe.getMessage()); System.exit(BatchCreatePlatformEndpointSample.NOT_FOUND_ERROR_CODE); } }
@Override public boolean load(GetPlatformApplicationAttributesRequest request, ResultCapture<GetPlatformApplicationAttributesResult> extractor) { return resource.load(request, extractor); }
/** * Makes a call to the service to load this resource's attributes if they * are not loaded yet, and use a ResultCapture to retrieve the low-level * client response * The following request parameters will be populated from the data of this * <code>PlatformApplication</code> resource, and any conflicting parameter * value set in the request will be overridden: * <ul> * <li> * <b><code>PlatformApplicationArn</code></b> * - mapped from the <code>Arn</code> identifier. * </li> * </ul> * * <p> * * @return Returns {@code true} if the resource is not yet loaded when this * method was invoked, which indicates that a service call has been * made to retrieve the attributes. * @see GetPlatformApplicationAttributesRequest */ boolean load(GetPlatformApplicationAttributesRequest request, ResultCapture<GetPlatformApplicationAttributesResult> extractor);