public class HogeUtils { private static boolean isDomainHogeSetup = false; protected static void checkAndCreateDomainHoge() { if (isDomainHogeSetup) { return; } AmazonSimpleDB sdb = new AmazonSimpleDBClient(new AWSCredentials() { @Override public String getAWSSecretKey() { return "********************"; } @Override public String getAWSAccessKeyId() { return "********************"; } }); sdb.createDomain(new CreateDomainRequest("hoge")); isDomainHogeSetup = true; } }
あとはSimpleDBにアクセスする処理の最初にcheckAndCreateDomainHoge()メソッドを読んでおけばOKです。