moved to FWS

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@81980 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-09-25 13:42:08 +00:00
parent c076114c62
commit 6a0d97c3a1
5 changed files with 32379 additions and 40 deletions

File diff suppressed because it is too large Load Diff

32
pom.xml
View File

@ -10,7 +10,7 @@
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<name>gCube Social Networking Library</name>
<description>
The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities.
@ -23,7 +23,7 @@
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
<gwtVersion>2.5.1</gwtVersion>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.6</maven.compiler.source>
@ -33,6 +33,17 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>1.3.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.netflix.astyanax</groupId>
@ -40,16 +51,13 @@
<version>1.56.21</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>gcf</artifactId>
<version>[1.4.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>ghn-client-runtime</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>runtime</scope>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<version>[0.1.0-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>com.google</groupId>
@ -64,7 +72,6 @@
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -76,19 +83,16 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<!-- "provided" so that we don't deploy -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
<build>

View File

@ -4,7 +4,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.netflix.astyanax.AstyanaxContext;
import com.netflix.astyanax.Cluster;
@ -33,7 +34,7 @@ public class CassandraClusterConnection {
/**
* logger
*/
static GCUBEClientLog _log = new GCUBEClientLog(CassandraClusterConnection.class);
private static final Logger _log = LoggerFactory.getLogger(CassandraClusterConnection.class);
/**
* keyspace location

View File

@ -9,7 +9,6 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang.NullArgumentException;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.portal.databook.shared.Comment;
import org.gcube.portal.databook.shared.Feed;
import org.gcube.portal.databook.shared.FeedType;
@ -27,6 +26,8 @@ import org.gcube.portal.databook.shared.ex.NotificationChannelTypeNotFoundExcept
import org.gcube.portal.databook.shared.ex.NotificationIDNotFoundException;
import org.gcube.portal.databook.shared.ex.NotificationTypeNotFoundException;
import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.netflix.astyanax.MutationBatch;
import com.netflix.astyanax.connectionpool.OperationResult;
@ -51,7 +52,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
/**
* logger
*/
static GCUBEClientLog _log = new GCUBEClientLog(DBCassandraAstyanaxImpl.class);
private static final Logger _log = LoggerFactory.getLogger(DBCassandraAstyanaxImpl.class);
/**
* Column Family names
*/

View File

@ -1,18 +1,22 @@
package org.gcube.portal.databook.server;
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.Properties;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.client.AtomicCondition;
import org.gcube.common.core.informationsystem.client.ISClient;
import org.gcube.common.core.informationsystem.client.queries.GCUBERuntimeResourceQuery;
import org.gcube.common.core.resources.GCUBERuntimeResource;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portal.databook.shared.ex.TooManyRunningClustersException;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Massimiliano Assante ISTI-CNR
*
@ -24,7 +28,8 @@ public class RunningCluster implements Serializable {
/**
* logger
*/
static GCUBEClientLog _log = new GCUBEClientLog(RunningCluster.class);
private static final Logger _log = LoggerFactory.getLogger(RunningCluster.class);
/**
* properties to read
*/
@ -68,7 +73,7 @@ public class RunningCluster implements Serializable {
*/
private RunningCluster() {
try {
List<GCUBERuntimeResource> resources = getConfigurationFromIS();
List<ServiceEndpoint> resources = getConfigurationFromIS();
if (resources.size() > 1) {
_log.error("Too many Runtime Resource having name " + RUNTIME_RESOURCE_NAME +" in this scope ");
throw new TooManyRunningClustersException("There exist more than 1 Runtime Resource in this scope having name "
@ -79,10 +84,11 @@ public class RunningCluster implements Serializable {
loadDefaultConfiguration();
}
else {
for (GCUBERuntimeResource res : resources) {
host = res.getAccessPoints().get(0).getEndpoint();
clusterName = res.getAccessPoints().get(0).getDescription();
keyspaceName = res.getAccessPoints().get(0).getEntryname();
for (ServiceEndpoint res : resources) {
AccessPoint found = res.profile().accessPoints().iterator().next();
host = found.address();
clusterName = found.description();
keyspaceName = found.name();
}
}
} catch (Exception e) {
@ -94,15 +100,18 @@ public class RunningCluster implements Serializable {
* @return the
* @throws Exception
*/
private List<GCUBERuntimeResource> getConfigurationFromIS() throws Exception {
ISClient client = GHNContext.getImplementation(ISClient.class);
GHNContext ctx = GHNContext.getContext();
String scope = "/" + (String) ctx.getProperty(GHNContext.INFRASTRUCTURE_NAME, true);
GCUBERuntimeResourceQuery query = client.getQuery(GCUBERuntimeResourceQuery.class);
query.addAtomicConditions(new AtomicCondition("/Profile/Name", RUNTIME_RESOURCE_NAME));
query.addAtomicConditions(new AtomicCondition("/Profile/Platform/Name", PLATFORM_NAME));
List<GCUBERuntimeResource> toReturn;
return client.execute(query, GCUBEScope.getScope(scope));
private List<ServiceEndpoint> getConfigurationFromIS() throws Exception {
PortalContext context = PortalContext.getConfiguration();
String scope = "/" + context.getInfrastructureName();
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope);
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Name/text() eq '"+ RUNTIME_RESOURCE_NAME +"'");
query.addCondition("$resource/Profile/Platform/Name/text() eq '"+ PLATFORM_NAME +"'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> toReturn = client.submit(query);
ScopeProvider.instance.set(currScope);
return toReturn;
}
/**
*