Scope is now read from the ScopeProvider and no longer as parameter of the plugin. To launch the plugin also a valid application token is now needed. Moved to version 1.1.2

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-data-indexer-se-plugin@141537 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-01-13 09:18:22 +00:00
parent 14a2df21a6
commit 58a3e89c56
3 changed files with 18 additions and 14 deletions

View File

@ -1,4 +1,7 @@
<ReleaseNotes>
<Changeset component="org.gcube.socialnetworkingsocial-data-indexer-se-plugin.1-1-2" date="2017-02-01">
<Change>Minor fixes</Change>
</Changeset>
<Changeset component="org.gcube.socialnetworkingsocial-data-indexer-se-plugin.1-1-1" date="2016-10-20">
<Change>Astyanax dependency version updated: moved to 2.0.2 (as declared by Portal-BOM)</Change>
</Changeset>

View File

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.socialnetworking</groupId>
<artifactId>social-data-indexer-se-plugin</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>Social Data Indexer Smart Executor Plugin</name>
<description>Social Data Indexer Smart Executor Plugin</description>

View File

@ -29,6 +29,7 @@ import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
import org.gcube.portal.databook.server.DatabookStore;
import org.gcube.portal.databook.shared.Attachment;
@ -82,22 +83,22 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
try{
// TODO auth 2.0 doesn't allow scope set anymore, we will need to pass a valid token
// for the scope in which we would like the plugin to be run
logger.info("Reading scope from ScopeProvider");
String scope = null;
String scope = ScopeProvider.instance.get();
// retrieve the scope from inputs, if any
if(inputs.containsKey("scope"))
scope = (String) inputs.get("scope");
else
logger.error("Scope variable is not set. The context will be evaluated later...");
logger.info("Scope read is " + scope);
// connection to cassandra
store = new DBCassandraAstyanaxImpl(scope);
if(scope == null || scope.isEmpty()){
logger.error("Running scope is missing! Exiting");
return;
}
// retrieve ElasticSearch Endpoint and set hosts/port numbers
ElasticSearchRunningCluster elasticCluster = new ElasticSearchRunningCluster(scope);
// connection to cassandra (remove the first / from the scope)
store = new DBCassandraAstyanaxImpl(scope.replaceFirst("/", ""));
// retrieve ElasticSearch Endpoint and set hosts/port numbers (remove the first / from the scope)
ElasticSearchRunningCluster elasticCluster = new ElasticSearchRunningCluster(scope.replaceFirst("/", ""));
// save info
clusterName = elasticCluster.getClusterName();
@ -179,7 +180,7 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
logger.info("Closing connection to elasticsearch cluster. " + client.toString());
client.close();
}
// close connection to cassandra
if(store != null){
logger.info("Closing connection to cassandra nodes. " + store.toString());