package org.gcube.application.geoportal.service.engine; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import org.gcube.application.geoportal.common.rest.InterfaceConstants; import org.gcube.application.geoportal.model.fault.ConfigurationException; import org.gcube.application.geoportal.service.utils.ContextUtils; import org.gcube.contentmanagement.blobstorage.service.IClient; import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException; import org.gcube.contentmanager.storageclient.wrapper.AccessType; import org.gcube.contentmanager.storageclient.wrapper.MemoryType; import org.gcube.contentmanager.storageclient.wrapper.StorageClient; public class StorageClientProvider implements Engine{ @Override public IClient getObject() throws ConfigurationException { return new StorageClient(InterfaceConstants.SERVICE_CLASS, InterfaceConstants.SERVICE_NAME, ContextUtils.getCurrentCaller(), AccessType.SHARED, MemoryType.VOLATILE).getClient(); } @Override public void shustdown() { // TODO Auto-generated method stub } @Override public void init() { // TODO Auto-generated method stub } //wrapping methods public InputStream open(String id) throws MalformedURLException, RemoteBackendException, IOException, ConfigurationException { return new URL(getObject().getHttpsUrl().RFileById(id)).openConnection().getInputStream(); } }