Exemplo n.º 1
0
  /**
   * Creates the .net request path code for a SpectraS3 request
   *
   * @param ds3Request A request
   * @return The .net request path code for an SpectraS3 request
   */
  protected static String getSpectraDs3RequestPath(final Ds3Request ds3Request) {
    final StringBuilder builder = new StringBuilder();
    if (ds3Request.getClassification() != Classification.spectrads3) {
      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(" + NotificationId.ToString()");
    } else if (hasBucketNameInPath(ds3Request)) {
      builder.append("/\"").append(" + BucketName");
    } else if (isResourceAnArg(ds3Request.getResource(), ds3Request.getIncludeInPath())) {
      final Arguments resourceArg = getArgFromResource(ds3Request.getResource());
      builder.append("/\"").append(" + ").append(capFirst(NetHelper.argToString(resourceArg)));
    } else {
      builder.append("\"");
    }
    return builder.toString();
  }
Exemplo n.º 2
0
  /** Creates the C# request path code for a Ds3 request */
  public static String toRequestPath(final Ds3Request ds3Request) {
    final StringBuilder builder = new StringBuilder();

    if (ds3Request.getClassification() == Classification.amazons3) {
      builder.append(getAmazonS3RequestPath(ds3Request));
    } else if (ds3Request.getClassification() == Classification.spectrads3) {
      builder.append(getSpectraDs3RequestPath(ds3Request));
    }

    return builder.toString();
  }
Exemplo n.º 3
0
 /**
  * Creates the C# request path code for an AmazonS3 request
  *
  * @param ds3Request A request
  * @return The .net 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(" + BucketName");
   }
   if (ds3Request.getObjectRequirement() == Requirement.REQUIRED) {
     builder.append(" + \"/\" + ObjectName");
   }
   return builder.toString();
 }