package org.cru.godtools.s3;

import com.google.common.base.Strings;

/**
 * Created by ryancarlson on 7/11/15.
 */
public class AmazonS3GodToolsConfig
{
	public static final String BUCKET_NAME = "cru-godtools";

	private static final String META = "meta";
	private static final String PACKAGES = "packages/";
	private static final String LANGUAGES = "languages/";
	private static final String ALL = "all/";
	private static final String CURRENT = "current/";
	private static final String XML = ".XML";
	private static final String ZIP = ".ZIP";

	public static String getMetaKey(String languageCode, String packageCode)
	{
		if(!Strings.isNullOrEmpty(languageCode) && !Strings.isNullOrEmpty(packageCode))
		{
			return META + CURRENT + languageCode + "/" + packageCode + "/" + META + XML;
		}
		if(!Strings.isNullOrEmpty(languageCode))
		{
			return META + CURRENT + languageCode + "/" + META + XML;
		}

		return META + CURRENT + META + XML;
	}

	public static String getPackagesKey(String languageCode, String packageCode)
	{
		return PACKAGES + CURRENT + languageCode + "/" + ALL + languageCode + ZIP;
	}

	public static String getLanguagesKey(String languageCode, String packagesCode)
	{
		return LANGUAGES + CURRENT + languageCode + "/" + ALL + languageCode + ZIP;
	}
}

@@ -247,16 +247,17 @@
  = %22meta
+/
 %22;%0A%09priv
@@ -351,32 +351,81 @@
 = %22languages/%22;%0A
+%09private static final String META_FILE = %22meta%22;%0A
 %09private static 
@@ -539,19 +539,19 @@
 XML = %22.
-XML
+xml
 %22;%0A%09priv
@@ -582,19 +582,19 @@
 ZIP = %22.
-ZIP
+zip
 %22;%0A%0A%09pub
@@ -816,32 +816,37 @@
 ode + %22/%22 + META
+_FILE
  + XML;%0A%09%09%7D%0A%09%09if
@@ -936,24 +936,29 @@
 + %22/%22 + META
+_FILE
  + XML;%0A%09%09%7D%0A
@@ -988,16 +988,21 @@
 T + META
+_FILE
  + XML;%0A

Fix broken key generation code