Reintroduced ScopeProvider to avoid problem in the next release

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@124140 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-02-12 16:15:41 +00:00
parent ceebe58946
commit d3dab39dfb
2 changed files with 9 additions and 2 deletions

View File

@ -47,6 +47,12 @@
<artifactId>accounting-lib</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>

View File

@ -9,7 +9,7 @@ import java.util.ServiceLoader;
import org.gcube.accounting.analytics.exception.NoAvailableScopeException;
import org.gcube.accounting.analytics.exception.NoUsableAccountingPersistenceQueryFound;
import org.gcube.accounting.datamodel.BasicUsageRecord;
import org.gcube.common.scope.api.ScopeProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -34,7 +34,8 @@ public abstract class AccountingPersistenceBackendQueryFactory {
* the #AccountingPersistenceQuery
*/
public synchronized static AccountingPersistenceBackendQuery getInstance() throws NoAvailableScopeException, NoUsableAccountingPersistenceQueryFound {
String scope = BasicUsageRecord.getScopeFromToken();
//String scope = BasicUsageRecord.getScopeFromToken();
String scope = ScopeProvider.instance.get();
if(scope==null){
throw new NoAvailableScopeException();
}