dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39973
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20234: Minor
------------------------------------------------------------
revno: 20234
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-09-18 20:01:58 +0200
message:
Minor
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/fileresource/FileResourceContentStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/BaseJCloudsFileResourceContentStore.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/fileresource/FileResourceContentStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/fileresource/FileResourceContentStore.java 2015-09-18 16:04:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/fileresource/FileResourceContentStore.java 2015-09-18 18:01:58 +0000
@@ -36,6 +36,8 @@
public interface FileResourceContentStore
{
ByteSource getFileResourceContent( String key );
- String saveFileResourceContent( String key, ByteSource content, long size, String contentMD5 );
+
+ String saveFileResourceContent( String key, ByteSource content, long size, String contentMd5 );
+
void deleteFileResourceContent( String key );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/BaseJCloudsFileResourceContentStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/BaseJCloudsFileResourceContentStore.java 2015-09-18 17:50:30 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/BaseJCloudsFileResourceContentStore.java 2015-09-18 18:01:58 +0000
@@ -28,11 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.hash.HashCode;
-import com.google.common.io.ByteSource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Optional;
+import java.util.Properties;
+
import org.apache.commons.io.input.NullInputStream;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jclouds.ContextBuilder;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.BlobStoreContext;
@@ -40,10 +41,8 @@
import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Optional;
-import java.util.Properties;
+import com.google.common.hash.HashCode;
+import com.google.common.io.ByteSource;
/**
* @author Halvdan Hoem Grelland
@@ -51,8 +50,6 @@
public abstract class BaseJCloudsFileResourceContentStore
implements FileResourceContentStore
{
- Log log = LogFactory.getLog( BaseJCloudsFileResourceContentStore.class );
-
private BlobStore blobStore;
private BlobStoreContext blobStoreContext;
@@ -86,9 +83,13 @@
public void init()
{
- blobStoreContext = ContextBuilder.newBuilder( getJCloudsProviderKey() )
- .credentials( getCredentials().identity, getCredentials().credential )
- .overrides( getOverrides() ).build( BlobStoreContext.class );
+ Credentials credentials = getCredentials();
+ Properties overrides = getOverrides();
+ String providerKey = getJCloudsProviderKey();
+
+ blobStoreContext = ContextBuilder.newBuilder( providerKey )
+ .credentials( credentials.identity, credentials.credential )
+ .overrides( overrides ).build( BlobStoreContext.class );
blobStore = blobStoreContext.getBlobStore();
@@ -133,9 +134,9 @@
};
}
- public String saveFileResourceContent( String key, ByteSource content, long size, String contentMD5 )
+ public String saveFileResourceContent( String key, ByteSource content, long size, String contentMd5 )
{
- Blob blob = createBlob( key, content, size, contentMD5 );
+ Blob blob = createBlob( key, content, size, contentMd5 );
if ( blob == null )
{
@@ -171,12 +172,12 @@
return blobStore.putBlob( getContainer(), blob );
}
- private Blob createBlob( String key, ByteSource content, long size, String contentMD5 )
+ private Blob createBlob( String key, ByteSource content, long size, String contentMd5 )
{
return blobStore.blobBuilder( key )
.payload( content )
.contentLength( size )
- .contentMD5( HashCode.fromString( contentMD5 ) )
+ .contentMD5( HashCode.fromString( contentMd5 ) )
.build();
}
}