コード例 #1
0
  /**
   * Creates the Java request path code for a SpectraS3 request
   *
   * @param ds3Request A request
   * @return The Java request path code for an SpectraS3 request
   */
  protected static String getSpectraDs3RequestPath(final Ds3Request ds3Request) {
    final StringBuilder builder = new StringBuilder();
    if (ds3Request.getClassification() != Classification.spectrads3
        && ds3Request.getClassification() != Classification.spectrainternal) {
      return builder.toString();
    }
    if (ds3Request.getResource() == null) {
      return builder.append("\"/_rest_/\"").toString();
    }

    builder.append("\"/_rest_/").append(ds3Request.getResource().toString().toLowerCase());
    if (isNotificationRequest(ds3Request)
        && ds3Request.getIncludeInPath()
        && (getNotificationType(ds3Request) == NotificationType.DELETE
            || getNotificationType(ds3Request) == NotificationType.GET)) {
      builder.append("/\"").append(" + this.getNotificationId().toString()");
    } else if (hasBucketNameInPath(ds3Request)) {
      builder.append("/\"").append(" + this.bucketName");
    } else if (isResourceAnArg(ds3Request.getResource(), ds3Request.getIncludeInPath())) {
      final Arguments resourceArg = getArgFromResource(ds3Request.getResource());
      builder.append("/\"").append(" + ").append(resourceArgToString(resourceArg));
    } else {
      builder.append("\"");
    }
    return builder.toString();
  }
コード例 #2
0
 /**
  * Creates the Java request path code for an AmazonS3 request
  *
  * @param ds3Request A request
  * @return The Java request path code for an AmazonS3 request
  */
 protected static String getAmazonS3RequestPath(final Ds3Request ds3Request) {
   final StringBuilder builder = new StringBuilder();
   if (ds3Request.getClassification() != Classification.amazons3) {
     return builder.toString();
   }
   builder.append("\"/\"");
   if (ds3Request.getBucketRequirement() == Requirement.REQUIRED) {
     builder.append(" + this.bucketName");
   }
   if (ds3Request.getObjectRequirement() == Requirement.REQUIRED) {
     builder.append(" + \"/\" + this.objectName");
   }
   return builder.toString();
 }