added storagemanager
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@90286 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
05c63f1d30
commit
75885be62e
17
pom.xml
17
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslsocial</artifactId>
|
||||
<version>0.7.1-SNAPSHOT</version>
|
||||
<version>0.7.2-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Social Portal ASL Extension</name>
|
||||
<description>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
|
@ -90,6 +90,17 @@
|
|||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-core</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-wrapper</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
|
@ -98,7 +109,7 @@
|
|||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</dependency>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.applicationsupportlayer.social.ftp;
|
||||
package org.gcube.applicationsupportlayer.social.storage;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
@ -74,7 +74,13 @@ public class FTPManager {
|
|||
ftpUrl = ac.address();
|
||||
httpBaseURL = res.profile().runtime().hostedOn();
|
||||
user = ac.username();
|
||||
|
||||
|
||||
//set the scope
|
||||
String currScope = ScopeProvider.instance.get();
|
||||
ScopeProvider.instance.set("/"+PortalContext.getConfiguration().getInfrastructureName());
|
||||
pwd = StringEncrypter.getEncrypter().decrypt(ac.password());
|
||||
ScopeProvider.instance.set(currScope);
|
||||
|
||||
// Connect to the FTP server
|
||||
client.connect(ftpUrl);
|
|
@ -0,0 +1,46 @@
|
|||
package org.gcube.applicationsupportlayer.social.storage;
|
||||
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.contentmanagement.blobstorage.service.IClient;
|
||||
import org.gcube.contentmanager.storageclient.wrapper.AccessType;
|
||||
import org.gcube.contentmanager.storageclient.wrapper.MemoryType;
|
||||
import org.gcube.contentmanager.storageclient.wrapper.StorageClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
*
|
||||
* @author Massimiliano Assante, ISTI-CNR
|
||||
*
|
||||
*/
|
||||
public class StorageManager {
|
||||
private static final Logger _log = LoggerFactory.getLogger(StorageManager.class);
|
||||
|
||||
|
||||
private static final String STORAGE_OWNER = "gCubeSocialFramework";
|
||||
|
||||
private static StorageManager singleton;
|
||||
|
||||
private static IClient client;
|
||||
|
||||
private StorageManager() {
|
||||
try {
|
||||
//set the scope
|
||||
String currScope = ScopeProvider.instance.get();
|
||||
ScopeProvider.instance.set("/"+PortalContext.getConfiguration().getInfrastructureName());
|
||||
client = new StorageClient(STORAGE_OWNER, AccessType.PRIVATE, MemoryType.PERSISTENT).getClient();
|
||||
ScopeProvider.instance.set(currScope);
|
||||
singleton = this;
|
||||
_log.trace("Social Framework Storage initialized - OK");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static IClient getClient() {
|
||||
if (singleton == null) {
|
||||
singleton = new StorageManager();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue