minor fix

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@133397 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-10-21 20:57:32 +00:00
parent 4b6d48850b
commit 55eac59040
2 changed files with 5 additions and 35 deletions

10
pom.xml
View File

@ -78,11 +78,11 @@
<artifactId>portal-manager</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.accounting</groupId>
<artifactId>accounting-lib</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.accounting</groupId> -->
<!-- <artifactId>accounting-lib</artifactId> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>

View File

@ -11,10 +11,6 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
import org.gcube.accounting.datamodel.UsageRecord.OperationResult;
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
import org.gcube.accounting.persistence.AccountingPersistence;
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
import org.gcube.common.authorization.library.utils.Caller;
@ -33,7 +29,6 @@ public class RequestsAuthAccountingFilter implements ContainerRequestFilter{
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(RequestsAuthAccountingFilter.class);
private static final String AUTH_TOKEN = "gcube-token";
private final static AccountingPersistence accountingPersistence = AccountingPersistenceFactory.getPersistence();
@Override
public void filter(ContainerRequestContext requestContext)
@ -106,29 +101,4 @@ public class RequestsAuthAccountingFilter implements ContainerRequestFilter{
return res;
}
/**
* Accounts service requests
*/
private static void accountRequest(String username){
// Create a new Service Usage Record
ServiceUsageRecord usageRecord = new ServiceUsageRecord();
try{
// TODO
usageRecord.setResourceProperty(ServiceUsageRecord.CONSUMER_ID, username);
usageRecord.setOperationResult(OperationResult.SUCCESS);
usageRecord.setCallerHost("node13.d4science.org");
usageRecord.setHost("node22.d4science.org");
usageRecord.setServiceClass("VREManagement");
usageRecord.setServiceName("SmartExecutor");
usageRecord.setCalledMethod("launch");
usageRecord.setResourceProperty(ServiceUsageRecord.DURATION, "300");
accountingPersistence.account(usageRecord);
}catch(Exception e){
logger.error("Unable to account this service usage record", e);
}
}
}