diff --git a/.classpath b/.classpath
index 5402ac0..7de8e04 100644
--- a/.classpath
+++ b/.classpath
@@ -1,20 +1,21 @@
-
+
-
+
+
@@ -31,5 +32,5 @@
-
+
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index d81dc60..b77a9a0 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -3,6 +3,8 @@
+
+
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/TaxonomyRowTable.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/TaxonomyRowTable.java
index ea24db0..022b766 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/TaxonomyRowTable.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/TaxonomyRowTable.java
@@ -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 = "";
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/asl/SessionUtil.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/asl/SessionUtil.java
index a46f66e..a92fce2 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/asl/SessionUtil.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/asl/SessionUtil.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.gcube.portlets.user.speciesdiscovery.server.asl;
@@ -27,12 +27,12 @@ import org.gcube.portlets.user.speciesdiscovery.shared.cluster.ClusterCommonName
import org.gcube.portlets.user.speciesdiscovery.shared.cluster.ClusterCommonNameDataSourceForTaxonomyRow;
/**
- *
+ *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SessionUtil {
-
+
public static final String SPECIES_SERVICE = "SPECIES_SERVICE";
public static final String SEARCH_SESSION = "SEARCH_SESSION";
public static final String TAXONOMY_OCCURRENCE = "TAXONOMY_OCCURRENCE";
@@ -51,10 +51,10 @@ public class SessionUtil {
private static final String CACHE_HASH_MAP_CHILDREN_TAXONOMY = "CACHE_HASH_MAP_CHILDREN_TAXONOMY";
private static final String CACHE_HASH_MAP_SYNONYMS_TAXONOMY = "CACHE_HASH_MAP_SYNONYMS_TAXONOMY";
private static final String CACHE_HASH_MAP_TAXONOMYID_TAXONOMY = "CACHE_HASH_MAP_TAXONOMYID_TAXONOMY";
-
+
protected static Logger logger = Logger.getLogger(SessionUtil.class);
-
-
+
+
public static EntityManagerFactory getEntityManagerFactory(ASLSession session) {
return (EntityManagerFactory) session.getAttribute(ENTITY_FACTORY);
}
@@ -62,41 +62,40 @@ public class SessionUtil {
public static void setEntityManagerFactory(ASLSession session, EntityManagerFactory factory) {
session.setAttribute(ENTITY_FACTORY, factory);
}
-
+
public static SpeciesService getService(ASLSession session) throws Exception
{
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);
}
-
+
return service;
}
-
+
@SuppressWarnings("unchecked")
public static FetchingSession extends FetchingElement> getCurrentSearchSession(ASLSession session)
{
return (FetchingSession extends FetchingElement>) session.getAttribute(SEARCH_SESSION);
}
-
+
public static void setCurrentSearchSession(ASLSession session, FetchingSession extends FetchingElement> searchSession){
session.setAttribute(SEARCH_SESSION, searchSession);
}
-
-
+
+
@SuppressWarnings("unchecked")
public static FetchingSession getCurrentOccurrenceSession(ASLSession session){
return (FetchingSession) session.getAttribute(TAXONOMY_OCCURRENCE);
}
-
-
+
+
public static void setCurrentOccurrenceSession(ASLSession session, FetchingSession searchSession){
session.setAttribute(TAXONOMY_OCCURRENCE, searchSession);
}
-
+
// public static void setCurrentTaxonomyChildrenSession(ASLSession session, FetchingSession searchSession)
// {
// session.setAttribute(TAXONOMY_CHILD, searchSession);
@@ -114,10 +113,10 @@ public class SessionUtil {
// user = "lucio.lelii";
// user = "pasquale.pagano";
// user = "francesco.mangiacrapa";
-
+
String scope = "/gcube/devsec"; //Development
// String scope = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityResearchEnvironment"; //Production
-
+
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, user);
session.setScope(scope);
@@ -125,7 +124,7 @@ public class SessionUtil {
logger.warn("TaxonomySearchServiceImpl STARTING IN TEST MODE - NO USER FOUND");
logger.warn("Created fake Asl session for user "+user + " with scope "+scope);
// session.setScope("/gcube/devsec");
-
+
return session;
}
@@ -133,12 +132,12 @@ public class SessionUtil {
}
//MODIFIED******************************************************************************************
-
+
public static void setCurrentEJBResultRow(ASLSession session, ResultRowPersistence resultRowPersistence) {
session.setAttribute(EJB_RESULT_ROW, resultRowPersistence);
}
-
+
public static ResultRowPersistence getCurrentEJBResultRow(ASLSession session) {
return (ResultRowPersistence) session.getAttribute(EJB_RESULT_ROW);
}
@@ -146,39 +145,39 @@ public class SessionUtil {
public static void setCurrentEJBTaxonRow(ASLSession session,TaxonRowPersistence taxonRowPersistence) {
session.setAttribute(EJB_TAXON_ROW, taxonRowPersistence);
}
-
+
public static TaxonRowPersistence getCurrentEJBTaxonRow(ASLSession session) {
return (TaxonRowPersistence) session.getAttribute(EJB_TAXON_ROW);
}
-
+
public static void setCurrentEJBOccurrence(ASLSession session, OccurrenceRowPersistence occurrenceRowPersistence) {
session.setAttribute(EJB_OCCURENCE, occurrenceRowPersistence);
}
-
+
public static OccurrenceRowPersistence getCurrentEJBOccurrence(ASLSession session) {
return (OccurrenceRowPersistence) session.getAttribute(EJB_OCCURENCE);
}
-
+
@SuppressWarnings("unchecked")
public static TaxonomyRowPersistence getCurrentEJBTaxonomyItem(ASLSession session) {
return (TaxonomyRowPersistence) session.getAttribute(EJB_TAXONOMY);
}
-
+
public static void setCurrentEJBTaxonomyItem(ASLSession session, TaxonomyRowPersistence taxonomyItemDAO) {
session.setAttribute(EJB_TAXONOMY, taxonomyItemDAO);
-
+
}
public static void setCurrentEJBOccurrencesJob(ASLSession session, OccurrenceJobPersistence occurrenceJobPersistence) {
session.setAttribute(EJB_OCCURRENCES_JOB, occurrenceJobPersistence);
-
+
}
-
+
@SuppressWarnings("unchecked")
public static OccurrenceJobPersistence getCurrentDaoOccurrencesJob(ASLSession session) {
return (OccurrenceJobPersistence) session.getAttribute(EJB_OCCURRENCES_JOB);
}
-
+
@SuppressWarnings("unchecked")
public static TaxonomyJobPersistence getCurrentDAOTaxonomyJob(ASLSession session) {
return (TaxonomyJobPersistence) session.getAttribute(EJB_TAXONOMY_JOB);
@@ -195,17 +194,17 @@ public class SessionUtil {
public static void setCurrentQuery(ASLSession aslSession, String lastQuery) {
logger.trace("Last query in session: "+lastQuery);
aslSession.setAttribute(CURRENT_SPD_QUERY, lastQuery);
-
+
}
-
+
/**
- *
+ *
* @param aslSession
*/
public static String getCurrentQuery(ASLSession aslSession) {
return (String) aslSession.getAttribute(CURRENT_SPD_QUERY);
-
+
}
/**
@@ -213,89 +212,89 @@ public class SessionUtil {
*/
public static void setCurrentClusterCommonNameForResultRow(ASLSession session, HashMap hashClusterCommonNameDataSource) {
session.setAttribute(CLUSTER_COMMONNAME_FOR_RESULTROW, hashClusterCommonNameDataSource);
-
+
}
-
+
/**
* @param hashClusterCommonNameDataSource
- * @return
+ * @return
*/
public static HashMap getCurrentClusterCommonNameForResultRow(ASLSession session) {
return (HashMap) session.getAttribute(CLUSTER_COMMONNAME_FOR_RESULTROW);
-
+
}
-
-
+
+
/**
* @param hashClusterCommonNameDataSource
*/
public static void setCurrentClusterCommonNameForTaxonomyRow(ASLSession session, HashMap hashClusterCommonNameDataSource) {
session.setAttribute(CLUSTER_COMMONNAME_FOR_TAXONOMYROW, hashClusterCommonNameDataSource);
-
- }
-
- /**
- * @param hashClusterCommonNameDataSource
- * @return
- */
- public static HashMap getCurrentClusterCommonNameForTaxonomyRow(ASLSession session) {
- return (HashMap) session.getAttribute(CLUSTER_COMMONNAME_FOR_TAXONOMYROW);
-
+
}
/**
- * @return
- *
+ * @param hashClusterCommonNameDataSource
+ * @return
+ */
+ public static HashMap getCurrentClusterCommonNameForTaxonomyRow(ASLSession session) {
+ return (HashMap) session.getAttribute(CLUSTER_COMMONNAME_FOR_TAXONOMYROW);
+
+ }
+
+ /**
+ * @return
+ *
*/
public static HashMap getHashMapChildrenTaxonomyCache(ASLSession session) {
return (HashMap) session.getAttribute(CACHE_HASH_MAP_CHILDREN_TAXONOMY);
-
+
}
-
+
/**
- * @return
- *
+ * @return
+ *
*/
public static void setHashMapChildrenTaxonomyCache(ASLSession session, Map list) {
session.setAttribute(CACHE_HASH_MAP_CHILDREN_TAXONOMY, list);
-
+
}
-
-
+
+
/**
- * @return
- *
+ * @return
+ *
*/
public static HashMap getHashMapSynonymsTaxonomyCache(ASLSession session) {
return (HashMap) session.getAttribute(CACHE_HASH_MAP_SYNONYMS_TAXONOMY);
-
+
}
-
+
/**
- * @return
- *
+ * @return
+ *
*/
public static void setHashMapSynonymsTaxonomyCache(ASLSession session, Map list) {
session.setAttribute(CACHE_HASH_MAP_SYNONYMS_TAXONOMY, list);
-
+
}
-
-
+
+
/**
- * @return
- *
+ * @return
+ *
*/
public static HashMap getHashMapTaxonomyByIdsCache(ASLSession session) {
return (HashMap) session.getAttribute(CACHE_HASH_MAP_TAXONOMYID_TAXONOMY);
-
+
}
-
+
/**
- * @return
- *
+ * @return
+ *
*/
public static void setHashMapTaxonomyByIdsCache(ASLSession session, Map list) {
session.setAttribute(CACHE_HASH_MAP_TAXONOMYID_TAXONOMY, list);
-
+
}
}
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/persistence/DaoSession.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/persistence/DaoSession.java
index 2533add..ef21d44 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/persistence/DaoSession.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/persistence/DaoSession.java
@@ -23,44 +23,44 @@ import org.gcube.portlets.user.speciesdiscovery.shared.DatabaseServiceException;
*
*/
public class DaoSession {
-
+
protected static final String PROPERTY_CATALINA_HOME = "catalina.home";
protected static final String CATALINA_HOME = "CATALINA_HOME";
protected static final String PERSISTENCE_H2DBSPECIES_H2 = "persistence/h2dbspecies/h2";
public static Logger logger = Logger.getLogger(DaoSession.class);
private static final String JDBCDRIVER = "jdbc:h2:";
-
-
+
+
public static String getUsernameScopeValue(String username, String scope){
-
+
scope = scope.replaceAll("/","");
username = username.replaceAll("\\.","");
return username+scope;
}
-
-
-
+
+
+
/**
- *
+ *
* @return $CATALINA_HOME
- * @throws Exception
+ * @throws Exception
*/
public static String getTomcatFolder(){
-
+
String catalinaHome = System.getenv(CATALINA_HOME) != null ? System.getenv(CATALINA_HOME) : System.getProperty(PROPERTY_CATALINA_HOME);
-
+
if(catalinaHome == null || catalinaHome.isEmpty())
logger.error("CATALINA_HOME ENVIROMENT NOT FOUND - RETURNED / PATH");
-
-
+
+
return catalinaHome.endsWith("/") ? catalinaHome : catalinaHome+"/";
}
-
-
+
+
public static String getConnectionUrl(ASLSession session){
-
+
String username = session.getUsername();
String scope = session.getScopeName();
return JDBCDRIVER +getTomcatFolder()+PERSISTENCE_H2DBSPECIES_H2+getUsernameScopeValue(username,scope)+";create=true";
@@ -82,26 +82,26 @@ public class DaoSession {
}
}
-
+
//MODIFIED**************************************************************************************+
-
-
-
+
+
+
public static EntityManager newEntityManager(ASLSession session){
-
+
return getEntityManagerFactory(session).createEntityManager();
}
-
+
public static EntityManagerFactory getEntityManagerFactory(ASLSession session){
-
+
EntityManagerFactory factory = SessionUtil.getEntityManagerFactory(session);
-
+
if(factory==null){
factory = createEntityManagerFactory(session);
SessionUtil.setEntityManagerFactory(session, factory);
}
-
+
return factory;
}
@@ -109,22 +109,22 @@ public class DaoSession {
{
OccurrenceJobPersistence occurrencesJobDao = SessionUtil.getCurrentDaoOccurrencesJob(session);
-
+
if(occurrencesJobDao==null){
occurrencesJobDao = initOccurrencesJobsDao(session);
SessionUtil.setCurrentEJBOccurrencesJob(session, occurrencesJobDao);
}
-
+
return occurrencesJobDao;
}
-
+
public static TaxonomyJobPersistence getTaxonomyJobDAO(ASLSession session) throws Exception
{
TaxonomyJobPersistence taxonomyJobPeristence = SessionUtil.getCurrentDAOTaxonomyJob(session);
-
+
if(taxonomyJobPeristence==null){
taxonomyJobPeristence = initTaxonomyJobsDao(session);
SessionUtil.setCurrentDAOTaxonomyJob(session, taxonomyJobPeristence);
@@ -132,12 +132,11 @@ public class DaoSession {
return taxonomyJobPeristence;
}
-
+
public static EntityManagerFactory createEntityManagerFactory(ASLSession session){
-
+
Map properties = new HashMap();
// properties.put("javax.persistence.jdbc.driver", jdbcDriverH2);
-
try{
properties.put("javax.persistence.jdbc.url", getConnectionUrl(session));
}
@@ -149,19 +148,19 @@ public class DaoSession {
}
//emf = Persistence.createEntityManagerFactory("jpablogPUnit");
return Persistence.createEntityManagerFactory("SPD_PERSISTENCE_FACTORY",properties);
-
+
}
-
-
+
+
public static OccurrenceJobPersistence initOccurrencesJobsDao(ASLSession session) throws Exception
{
-
+
String username = session.getUsername();
String scope = session.getScopeName();
return createOccurrencesJobDao(username, scope, session);
-
+
}
-
+
public static TaxonomyJobPersistence initTaxonomyJobsDao(ASLSession session) throws Exception{
TaxonomyJobPersistence occurrenceJobPersistence = new TaxonomyJobPersistence(getEntityManagerFactory(session));
@@ -169,34 +168,34 @@ public class DaoSession {
return occurrenceJobPersistence;
}
-
+
public static OccurrenceJobPersistence createOccurrencesJobDao(String username, String scope, ASLSession session) throws Exception{
-
+
OccurrenceJobPersistence occurrenceJobPersistence = new OccurrenceJobPersistence(getEntityManagerFactory(session));
SessionUtil.setCurrentEJBOccurrencesJob(session, occurrenceJobPersistence);
-
+
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
-
+
return occurrenceJobPersistence;
}
-
+
public static ResultRowPersistence initResultRowDao(ASLSession session) throws Exception
{
-
+
ResultRowPersistence resultRowPersistence = new ResultRowPersistence(getEntityManagerFactory(session));
SessionUtil.setCurrentEJBResultRow(session, resultRowPersistence);
-
+
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
-
+
return resultRowPersistence;
}
-
+
public static OccurrenceRowPersistence getOccurrenceDAO(ASLSession session) throws Exception
{
OccurrenceRowPersistence occurrenceEJB = SessionUtil.getCurrentEJBOccurrence(session);
-
+
if(occurrenceEJB==null){
occurrenceEJB = initOccurrenceDao(session);
SessionUtil.setCurrentEJBOccurrence(session, occurrenceEJB);
@@ -207,60 +206,60 @@ public class DaoSession {
public static TaxonRowPersistence initTaxonDao(ASLSession session) throws Exception
{
-
+
TaxonRowPersistence taxonRowPersistence = new TaxonRowPersistence(getEntityManagerFactory(session));
SessionUtil.setCurrentEJBTaxonRow(session, taxonRowPersistence);
-
+
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
-
+
return taxonRowPersistence;
}
-
+
private static OccurrenceRowPersistence initOccurrenceDao(ASLSession session) throws Exception {
OccurrenceRowPersistence occurrenceRowPersistence = new OccurrenceRowPersistence(getEntityManagerFactory(session));
SessionUtil.setCurrentEJBOccurrence(session, occurrenceRowPersistence);
-
+
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
-
+
return occurrenceRowPersistence;
-
+
}
-
+
public static TaxonRowPersistence getTaxonDAO(ASLSession session) throws Exception
{
TaxonRowPersistence taxonDao = SessionUtil.getCurrentEJBTaxonRow(session);
-
+
if(taxonDao==null){
taxonDao = initTaxonDao(session);
SessionUtil.setCurrentEJBTaxonRow(session, taxonDao);
}
-
+
// System.out.println("Return taxon Dao : " + taxonDao + " table name: " + taxonDao.getTableConfig().getTableName());
// System.out.println("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
return taxonDao;
}
-
+
public static TaxonomyRowPersistence getTaxonomyDAO(ASLSession session) throws Exception
{
logger.trace("In getTaxonomyDAO...");
-
+
TaxonomyRowPersistence taxonItemDAO = SessionUtil.getCurrentEJBTaxonomyItem(session);
-
+
if(taxonItemDAO==null){
taxonItemDAO = initTaxonomyItemDao(session, "taxonomyrow");
SessionUtil.setCurrentEJBTaxonomyItem(session, taxonItemDAO);
}
-
+
// logger.trace("Return taxonomy row Dao : " + taxonItemDAO + " table name: " + taxonItemDAO.getTableConfig().getTableName());
// logger.trace("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
return taxonItemDAO;
}
-
+
private static TaxonomyRowPersistence initTaxonomyItemDao(ASLSession session, String tableName) throws Exception{
TaxonomyRowPersistence taxonomyRP = new TaxonomyRowPersistence(getEntityManagerFactory(session));
@@ -268,26 +267,26 @@ public class DaoSession {
return taxonomyRP;
}
-
+
public static ResultRowPersistence getResultRowDAO(ASLSession session) throws Exception
- {
-
+ {
+
logger.trace("In getResultRowDAO...");
-
+
ResultRowPersistence resultRowEJB = SessionUtil.getCurrentEJBResultRow(session);
-
+
if(resultRowEJB==null){
resultRowEJB = initResultRowDao(session);
SessionUtil.setCurrentEJBResultRow(session, resultRowEJB);
}
-
+
// logger.trace("Return result row Dao : " + resultRowEJB + " table name: " + resultRowDAO.getTableConfig().getTableName());
// logger.trace("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
return resultRowEJB;
}
-
-
-
+
+
+
}
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/service/SpeciesService.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/service/SpeciesService.java
index 583edd7..5d706ad 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/service/SpeciesService.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/service/SpeciesService.java
@@ -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 stream = classificationCall.getTaxaByIds(ids);
return new StreamIterator(stream);
}
@@ -211,7 +172,6 @@ public class SpeciesService {
logger.trace("retrieveSynonymsById...");
try {
- ScopeProvider.instance.set(scope);
Stream stream =
classificationCall.getSynonymsById(id);
return new StreamIterator(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 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 listDsModel =
new ArrayList();
- ScopeProvider.instance.set(scope);
System.out.println("setting scope " + scope);
List plugin = call.getPluginsDescription();
if (plugin != null) {
@@ -475,9 +429,6 @@ public class SpeciesService {
throws SearchServiceException {
try {
- // Stream 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 stream = occurrencesCall.getByKeys(keys);
@@ -504,7 +455,6 @@ public class SpeciesService {
try {
// Stream idsStream = convert(ids);
- ScopeProvider.instance.set(scope);
Stream stream = occurrencesCall.getByIds(ids);
return new StreamIterator(stream);
}
@@ -530,7 +480,6 @@ public class SpeciesService {
try {
// Stream 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 items =
classificationCall.getTaxonChildrenById(parentId);
return new StreamIterator(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 ids)
throws Exception {
- ScopeProvider.instance.set(scope);
try {
Stream 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()) {
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/GetWorkspaceUtil.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/GetWorkspaceUtil.java
index d9b85b1..894e917 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/GetWorkspaceUtil.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/GetWorkspaceUtil.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.gcube.portlets.user.speciesdiscovery.server.util;
@@ -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
@@ -17,26 +16,20 @@ import org.gcube.common.scope.api.ScopeProvider;
public class GetWorkspaceUtil {
protected static Logger logger = Logger.getLogger(GetWorkspaceUtil.class);
-
+
public static Workspace getWorskspace(ASLSession session) throws Exception {
-
+
if(session==null)
throw new Exception("ASL session is null");
-
+
if(session.getScope()==null)
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());
-
}
}
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/CommonName.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/CommonName.java
index b034246..944de2b 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/CommonName.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/CommonName.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.gcube.portlets.user.speciesdiscovery.shared;
@@ -10,16 +10,18 @@ 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 {
/**
- *
+ *
*/
private static final long serialVersionUID = 1140787822064828769L;
@@ -27,22 +29,22 @@ public class CommonName implements Serializable {
public final static String NAME= "name";
public final static String LANGUAGE= "language";
public final static String REFERENCE_RESULTROW_ID = "resultRowId";
-
+
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int internalId;
-
-
+
+
protected int id;
-
+
private int resultRowId;
protected String name;
protected String language;
-
+
public CommonName(){}
-
+
/**
* @param name
* @param language
@@ -97,5 +99,5 @@ public class CommonName implements Serializable {
public int getResultRowId() {
return resultRowId;
}
-
+
}
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/Coordinate.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/Coordinate.java
index b832714..a538dc3 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/Coordinate.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/Coordinate.java
@@ -1,26 +1,28 @@
/**
- *
+ *
*/
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 {
+
/**
- *
+ *
*/
private static final long serialVersionUID = -2357675565732391317L;
-
+
protected float latitude;
protected float longitude;
-
+
public Coordinate(){}
-
+
/**
* @param latitude
* @param longitude
@@ -29,35 +31,35 @@ public class Coordinate implements Serializable {
this.latitude = latitude;
this.longitude = longitude;
}
-
+
/**
* @return the latitude
*/
public float getLatitude() {
return latitude;
}
-
+
/**
* @param latitude the latitude to set
*/
public void setLatitude(float latitude) {
this.latitude = latitude;
}
-
+
/**
* @return the longitude
*/
public float getLongitude() {
return longitude;
}
-
+
/**
* @param longitude the longitude to set
*/
public void setLongitude(float longitude) {
this.longitude = longitude;
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSource.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSource.java
index 25cec0c..14e2688 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSource.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSource.java
@@ -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)
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceCapability.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceCapability.java
index 6ddffc9..28b6489 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceCapability.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceCapability.java
@@ -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 listFilters;
private SpeciesCapability capability;
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceModel.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceModel.java
index d39b7df..05b84d6 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceModel.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceModel.java
@@ -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 listCapabilities;
private DataSourceRepositoryInfo dataSourceRepositoryInfo;
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceRepositoryInfo.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceRepositoryInfo.java
index 7ac4d25..dae9191 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceRepositoryInfo.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DataSourceRepositoryInfo.java
@@ -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 properties;
diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DownloadState.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DownloadState.java
index 2546e4d..ba3924e 100644
--- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DownloadState.java
+++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/shared/DownloadState.java
@@ -2,13 +2,15 @@ package org.gcube.portlets.user.speciesdiscovery.shared;
import java.io.Serializable;
-public enum DownloadState implements Serializable {
- PENDING,
- ONGOING,
- ONGOINGWITHFAILURES,
- FAILED,
- COMPLETED,
- COMPLETEDWITHFAILURES,
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public enum DownloadState implements IsSerializable, Serializable {
+ PENDING,
+ ONGOING,
+ ONGOINGWITHFAILURES,
+ FAILED,
+ COMPLETED,
+ COMPLETEDWITHFAILURES,
SAVING,
SAVED,
SERVICE_UNKNOWN
diff --git a/src/test/java/log4j/log4j.properties b/src/test/java/log4j/log4j.properties
new file mode 100644
index 0000000..7983f47
--- /dev/null
+++ b/src/test/java/log4j/log4j.properties
@@ -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
+