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:
parent
4b6d48850b
commit
55eac59040
10
pom.xml
10
pom.xml
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in New Issue