removed ScopeProvider.set everywhere

fixed occurrencescall

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@141544 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-01-13 10:00:53 +00:00
parent f82797b6f1
commit 2b71b38a8b
15 changed files with 261 additions and 282 deletions

View File

@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="lib" path="/home/francesco-mangiacrapa/libraries/asm-5.0.3/lib/asm-5.0.3.jar"/>
<classpathentry kind="src" output="target/species-discovery-3.8.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/species-discovery-3.9.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<classpathentry excluding="log4j/" kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry including="*.properties" kind="src" path="src/test/java/log4j"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
@ -31,5 +32,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/species-discovery-3.8.2-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/species-discovery-3.9.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -3,6 +3,8 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java/log4j"/>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="species-discovery"/>
</wb-module>

View File

@ -41,19 +41,8 @@ import org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyRow;
*/
public class TaxonomyRowTable extends HttpServlet {
/**
*
*/
protected static final String UTF_8 = "UTF-8";
/**
*
*/
private static final long serialVersionUID = 9157876104914505028L;
/**
*
*/
public static final String TEXT_HTML = "text/html; charset=UTF-8";
public static final String DOCTYPE = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";

View File

@ -68,8 +68,7 @@ public class SessionUtil {
SpeciesService service = (SpeciesService) session.getAttribute(SPECIES_SERVICE);
if (service==null) {
logger.trace("Service not found, creating it");
String scope = session.getScope();
service = new SpeciesService(scope, session);
service = new SpeciesService();
session.setAttribute(SPECIES_SERVICE, service);
}

View File

@ -137,7 +137,6 @@ public class DaoSession {
Map<String,String> properties = new HashMap<String, String>();
// properties.put("javax.persistence.jdbc.driver", jdbcDriverH2);
try{
properties.put("javax.persistence.jdbc.url", getConnectionUrl(session));
}

View File

@ -18,8 +18,6 @@ import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.spd.client.proxies.ClassificationClient;
import org.gcube.data.spd.client.proxies.ExecutorClient;
import org.gcube.data.spd.client.proxies.ManagerClient;
@ -59,59 +57,24 @@ public class SpeciesService {
protected Logger logger = Logger.getLogger(SpeciesService.class);
protected String scope;
protected ASLSession session;
protected ManagerClient call;
protected OccurrenceClient occurrencesCall;
protected ClassificationClient classificationCall;
protected ExecutorClient executorCall;
protected String lastQuery = "";
/**
* Instantiates a new species service.
*
* @param scope
* the scope
* @param session
* the session
* @throws Exception
* the exception
*/
public SpeciesService(String scope, ASLSession session)
throws Exception {
this(scope);
this.session = session;
}
/**
* Instantiates a new species service.
*
* @param scope
* the scope
* @throws Exception
* the exception
* @throws Exception the exception
*/
public SpeciesService(String scope)
throws Exception {
this.scope = scope;
ScopeProvider.instance.set(scope);
// this.call = manager().at(
// URI.create("http://node24.d.d4science.research-infrastructures.eu:9000")).withTimeout(3,
// TimeUnit.MINUTES).build();
// this.occurrencesCall = occurrences().at(
// URI.create("http://node24.d.d4science.research-infrastructures.eu:9000")).withTimeout(3,
// TimeUnit.MINUTES).build();
// this.classificationCall = classification().at(
// URI.create("http://node24.d.d4science.research-infrastructures.eu:9000")).withTimeout(3,
// TimeUnit.MINUTES).build();
public SpeciesService() throws Exception {
System.out.println("CALLING MANAGER ");
this.call = manager().withTimeout(3, TimeUnit.MINUTES).build();
this.executorCall = executor().withTimeout(3, TimeUnit.MINUTES).build();
OccurrenceClient a =
occurrences().withTimeout(3, TimeUnit.MINUTES).build();
this.classificationCall =
classification().withTimeout(3, TimeUnit.MINUTES).build();
this.occurrencesCall = occurrences().withTimeout(3, TimeUnit.MINUTES).build();
this.classificationCall = classification().withTimeout(3, TimeUnit.MINUTES).build();
}
/**
@ -129,7 +92,6 @@ public class SpeciesService {
this.scope = scope;
if (instanceOnlyOccurrence) {
ScopeProvider.instance.set(scope);
System.out.println("CALLING OCCURRENCE MANAGER ");
this.occurrencesCall = occurrences().withTimeout(3, TimeUnit.MINUTES).build();
}
@ -185,7 +147,6 @@ public class SpeciesService {
logger.trace("retrieveTaxonomyById...");
try {
ScopeProvider.instance.set(scope);
Stream<TaxonomyItem> stream = classificationCall.getTaxaByIds(ids);
return new StreamIterator<TaxonomyItem>(stream);
}
@ -211,7 +172,6 @@ public class SpeciesService {
logger.trace("retrieveSynonymsById...");
try {
ScopeProvider.instance.set(scope);
Stream<TaxonomyItem> stream =
classificationCall.getSynonymsById(id);
return new StreamIterator<TaxonomyItem>(stream);
@ -239,9 +199,7 @@ public class SpeciesService {
logger.trace("search by Query - query is: " + query);
// System.out.println("searchByQuery query: "+query);
try {
ScopeProvider.instance.set(scope);
lastQuery = query;
// System.err.println("ScopeProvider SCOPE "+ScopeProvider.instance.get());
logger.trace("call species service search...");
// System.out.println("call species service search...");
Stream<ResultElement> stream = call.search(query);
@ -286,10 +244,7 @@ public class SpeciesService {
throws SearchServiceException {
logger.trace("searchByQuery query: " + query);
// System.out.println("searchByQuery query: "+query);
try {
ScopeProvider.instance.set(scope);
// System.err.println("ScopeProvider SCOPE "+ScopeProvider.instance.get());
logger.trace("call species service search...");
System.out.println("call species service search...");
return call.search(query);
@ -316,7 +271,6 @@ public class SpeciesService {
try {
List<DataSourceModel> listDsModel =
new ArrayList<DataSourceModel>();
ScopeProvider.instance.set(scope);
System.out.println("setting scope " + scope);
List<PluginDescription> plugin = call.getPluginsDescription();
if (plugin != null) {
@ -475,9 +429,6 @@ public class SpeciesService {
throws SearchServiceException {
try {
// Stream<String> keysStream = convert(keys);
ScopeProvider.instance.set(scope);
logger.trace("Instancing scope: "+scope);
logger.trace("Calling occurrencesCall passing keys: "+keys);
logger.trace("occurrencesCall != null? "+(occurrencesCall==null));
Stream<OccurrencePoint> stream = occurrencesCall.getByKeys(keys);
@ -504,7 +455,6 @@ public class SpeciesService {
try {
// Stream<String> idsStream = convert(ids);
ScopeProvider.instance.set(scope);
Stream<OccurrencePoint> stream = occurrencesCall.getByIds(ids);
return new StreamIterator<OccurrencePoint>(stream);
}
@ -530,7 +480,6 @@ public class SpeciesService {
try {
// Stream<String> keysStream = convert(keys);
ScopeProvider.instance.set(scope);
return occurrencesCall.createLayer(streamKey);
}
catch (Exception e) {
@ -555,7 +504,6 @@ public class SpeciesService {
throws Exception {
try {
ScopeProvider.instance.set(scope);
Stream<TaxonomyItem> items =
classificationCall.getTaxonChildrenById(parentId);
return new StreamIterator<TaxonomyItem>(items);
@ -578,7 +526,6 @@ public class SpeciesService {
*/
public CompleteJobStatus getTaxonomyJobById(String jobId) {
ScopeProvider.instance.set(scope);
CompleteJobStatus status = null;
try {
status = this.executorCall.getStatus(jobId);
@ -609,7 +556,6 @@ public class SpeciesService {
throws Exception {
InputStream is = null;
ScopeProvider.instance.set(scope);
try {
String url = this.executorCall.getResultLink(jobIdentifier);
if (url == null || url.isEmpty()) {
@ -640,7 +586,6 @@ public class SpeciesService {
throws Exception {
InputStream is = null;
ScopeProvider.instance.set(scope);
try {
String url = this.executorCall.getErrorLink(jobIdentifier);
if (url == null || url.isEmpty()) {
@ -670,7 +615,6 @@ public class SpeciesService {
public boolean isAvailableTaxonomyJobErrorFileById(String jobIdentifier)
throws Exception {
ScopeProvider.instance.set(scope);
try {
String url = this.executorCall.getErrorLink(jobIdentifier);
if (url == null || url.isEmpty()) {
@ -700,7 +644,6 @@ public class SpeciesService {
public String createTaxonomyJobForDWCAByChildren(String taxonomyId)
throws Exception {
ScopeProvider.instance.set(scope);
try {
return this.executorCall.createDwCAByChildren(taxonomyId);
}
@ -722,7 +665,6 @@ public class SpeciesService {
public String createTaxonomyJobForDWCAByIds(List<String> ids)
throws Exception {
ScopeProvider.instance.set(scope);
try {
Stream<String> keysStream = convert(ids);
return executorCall.createDwCAByIds(keysStream);
@ -744,7 +686,6 @@ public class SpeciesService {
public void cancelTaxonomyJobById(String jobIdentifier) {
try {
ScopeProvider.instance.set(scope);
this.executorCall.removeJob(jobIdentifier);
}
catch (Exception e) {
@ -763,7 +704,6 @@ public class SpeciesService {
public CompleteJobStatus getOccurrenceJobById(String jobId) {
try {
ScopeProvider.instance.set(scope);
return this.executorCall.getStatus(jobId); // CHANGE INTO OCCURRENCE
// JOB
// **************************************************************************************
@ -793,7 +733,6 @@ public class SpeciesService {
throws Exception {
try {
ScopeProvider.instance.set(scope);
return this.executorCall.createCSV(streamKey);
}
catch (Exception e) {
@ -817,7 +756,6 @@ public class SpeciesService {
throws Exception {
try {
ScopeProvider.instance.set(scope);
return this.executorCall.createDarwincoreFromOccurrenceKeys(streamKey);
}
catch (Exception e) {
@ -841,7 +779,6 @@ public class SpeciesService {
throws Exception {
try {
ScopeProvider.instance.set(scope);
return this.executorCall.createCSVforOM(streamKey);
}
catch (Exception e) {
@ -863,7 +800,6 @@ public class SpeciesService {
public void cancelOccurrenceJobById(String jobIdentifier) {
try {
ScopeProvider.instance.set(scope);
this.executorCall.removeJob(jobIdentifier); // CHANGE INTO
// OCCURRENCE JOB
// **************************************************************************************
@ -888,7 +824,6 @@ public class SpeciesService {
throws Exception {
InputStream is = null;
ScopeProvider.instance.set(scope);
try {
String url = this.executorCall.getResultLink(jobIdentifier); // CHANGE
// INTO
@ -925,7 +860,6 @@ public class SpeciesService {
throws Exception {
InputStream is = null;
ScopeProvider.instance.set(scope);
try {
String url = this.executorCall.getErrorLink(jobIdentifier);
logger.trace("URL returned by species service is: " + url);
@ -955,7 +889,6 @@ public class SpeciesService {
public boolean isAvailableOccurrenceJobErrorFileById(String jobIdentifier)
throws Exception {
ScopeProvider.instance.set(scope);
try {
String url = this.executorCall.getErrorLink(jobIdentifier);
if (url == null || url.isEmpty()) {

View File

@ -7,7 +7,6 @@ import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.scope.api.ScopeProvider;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
@ -27,16 +26,10 @@ public class GetWorkspaceUtil {
throw new Exception("Scope into ASL session is null");
String scope = session.getScope().toString();
logger.trace("Get workspace for scope "+scope);
ScopeProvider.instance.set(scope);
logger.trace("ScopeProvider instancied for scope "+scope);
//logger.trace("Get workspace for scope "+scope);
//ScopeProvider.instance.set(scope);
//logger.trace("ScopeProvider instancied for scope "+scope);
logger.trace("retuning workspace for username "+session.getUsername());
return HomeLibrary.getUserWorkspace(session.getUsername());
}
}

View File

@ -10,13 +10,15 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
@Entity
public class CommonName implements Serializable {
public class CommonName implements IsSerializable, Serializable {
/**
*

View File

@ -5,11 +5,13 @@ package org.gcube.portlets.user.speciesdiscovery.shared;
import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class Coordinate implements Serializable {
public class Coordinate implements IsSerializable, Serializable {
/**
*

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.speciesdiscovery.shared;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@ -15,7 +17,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
* Jan 10, 2017
*/
@Entity
public class DataSource implements IsSerializable{
public class DataSource implements IsSerializable, Serializable{
/**
*
*/
private static final long serialVersionUID = -7978955895523864898L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.speciesdiscovery.shared;
import java.io.Serializable;
import java.util.ArrayList;
import com.google.gwt.user.client.rpc.IsSerializable;
@ -12,8 +13,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 10, 2017
*/
public class DataSourceCapability implements IsSerializable{
public class DataSourceCapability implements IsSerializable, Serializable{
/**
*
*/
private static final long serialVersionUID = 844266531985842984L;
private ArrayList<SpeciesCapability> listFilters;
private SpeciesCapability capability;

View File

@ -1,7 +1,10 @@
package org.gcube.portlets.user.speciesdiscovery.shared;
import java.io.Serializable;
import java.util.ArrayList;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* The Class DataSourceModel.
@ -9,8 +12,12 @@ import java.util.ArrayList;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 10, 2017
*/
public class DataSourceModel extends DataSource {
public class DataSourceModel extends DataSource implements IsSerializable, Serializable{
/**
*
*/
private static final long serialVersionUID = -8314335099130160226L;
private ArrayList<DataSourceCapability> listCapabilities;
private DataSourceRepositoryInfo dataSourceRepositoryInfo;

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.speciesdiscovery.shared;
import java.io.Serializable;
import java.util.Map;
import com.google.gwt.user.client.rpc.IsSerializable;
@ -11,8 +12,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 10, 2017
*/
public class DataSourceRepositoryInfo implements IsSerializable{
public class DataSourceRepositoryInfo implements IsSerializable, Serializable{
/**
*
*/
private static final long serialVersionUID = -2778021508260771963L;
private String logoUrl;
private String pageUrl;
private Map<String, String> properties;

View File

@ -2,7 +2,9 @@ package org.gcube.portlets.user.speciesdiscovery.shared;
import java.io.Serializable;
public enum DownloadState implements Serializable {
import com.google.gwt.user.client.rpc.IsSerializable;
public enum DownloadState implements IsSerializable, Serializable {
PENDING,
ONGOING,
ONGOINGWITHFAILURES,

View File

@ -0,0 +1,33 @@
# Set root category priority to WARN and its only appender to A1.
log4j.rootCategory=ERROR, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n
# Display any warnings generated by our code
#log4j.category.org.gcube=trace
#log4j.category.org.globus=trace
#log4j.category.isclient=INFO
#log4j.category.org.gcube.common.homelibrary.jcr=TRACE
log4j.category.org.gcube.portlets.user.workspace=TRACE
log4j.logger.org.gcube=TRACE
log4j.logger.org.gcube.application.framework.core.session=INFO
log4j.logger.org.gcube.contentmanager=ERROR
log4j.logger.org.gcube.common.scope=ERROR
log4j.logger.org.gcube.contentmanagement=ERROR
log4j.logger.org.gcube.resources.discovery.icclient=ERROR
log4j.logger.org.gcube.common.clients=ERROR
#log4j.logger.org.gcube.common.homelibrary.jcr=TRACE
log4j.logger.org.gcube.application.framework.accesslogger=ERROR
log4j.logger.org.apache.pdfbox.util.PDFStreamEngine=ERROR