@@ -0,0 +1,1364 @@
+package org.jimmutable.cloud.storage;%0D%0A%0D%0Aimport org.apache.logging.log4j.LogManager;%0D%0Aimport org.apache.logging.log4j.Logger;%0D%0Aimport org.jimmutable.cloud.CloudExecutionEnvironment;%0D%0Aimport org.jimmutable.cloud.storage.s3.StorageS3;%0D%0Aimport org.jimmutable.core.objects.StandardObject;%0D%0Aimport org.jimmutable.core.objects.common.Kind;%0D%0Aimport org.jimmutable.core.objects.common.ObjectId;%0D%0A%0D%0Apublic class StorageUtils%0D%0A%7B%0D%0A%09static private final Logger LOGGER = LogManager.getLogger(StorageUtils.class);%0D%0A%09static private final String CHARSET_NAME = %22UTF8%22;%0D%0A%09%0D%0A%09/**%0D%0A%09 * Generic method to take the error handling out of hand when trying to get an%0D%0A%09 * object out of storage. If anything fails on retrieving from storage this will%0D%0A%09 * return the default_value.%0D%0A%09 */%0D%0A%09private static StandardObject%3C?%3E getOptionalFromStorage( Kind kind, ObjectId id, StandardObject%3C?%3E default_value )%0D%0A%09%7B%0D%0A%09%09StandardObject%3C?%3E obj = null;%0D%0A%09%09try%0D%0A%09%09%7B%0D%0A%09%09%09obj = StandardObject.deserialize(new String(CloudExecutionEnvironment.getSimpleCurrent().getSimpleStorage().getCurrentVersion(new ObjectIdStorageKey(kind, id, StorageKeyExtension.JSON), null), CHARSET_NAME));%0D%0A%09%09%09if ( obj == null )%0D%0A%09%09%09%7B%0D%0A%09%09%09%09return default_value;%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09catch ( Exception e )%0D%0A%09%09%7B%0D%0A%09%09%09LOGGER.error(%22Could not retrieve StandardObject from Storage%22, e);%0D%0A%09%09%09return default_value;%0D%0A%09%09%7D%0D%0A%09%09return obj;%0D%0A%09%7D%0D%0A%7D%0D%0A

Add a util class for StorageUtils, a method to get a StandardObject out of Storage