Upgraded version and changelog after release 4.10.0 refs #10812. Merged changes made directly in release branch.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-service@163303 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-02-15 15:22:22 +00:00
parent 52df5d8993
commit 9a5214828e
4 changed files with 22 additions and 7 deletions

View File

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<ReleaseNotes>
<Changeset component="org.gcube.accounting.accounting-service.1-2-0" date="${buildDate}">
<Changeset component="org.gcube.accounting.accounting-service.1-3-0" date="${buildDate}">
<Change></Change>
</Changeset>
<Changeset component="org.gcube.accounting.accounting-service.1-2-0" date="2017-02-15">
<Change>Reorganize URLs to be REST compliant #10810</Change>
</Changeset>
<Changeset component="org.gcube.accounting.accounting-service.1-1-0" date="2017-10-09">

View File

@ -9,7 +9,7 @@
<groupId>org.gcube.accounting</groupId>
<artifactId>accounting-service</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<name>accounting-service</name>
<description>Service Accounting Manger</description>
<packaging>war</packaging>
@ -50,7 +50,6 @@
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears-app</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>

View File

@ -19,12 +19,15 @@ import org.gcube.accounting.persistence.AccountingPersistence;
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
import org.gcube.accounting.service.AccountingResource;
import org.gcube.accounting.service.AccountingServiceInitializer;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.documentstore.records.DSMapper;
import org.gcube.documentstore.records.Record;
import org.gcube.smartgears.annotations.ManagedBy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.research.ws.wadl.HTTPMethods;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@ -41,6 +44,8 @@ public class RecordManagement {
@POST
@Consumes({MediaType.TEXT_PLAIN, AccountingResource.APPLICATION_JSON_CHARSET_UTF_8})
public Response add(String json) throws Exception {
CalledMethodProvider.instance
.set(HTTPMethods.POST.name() + " /" + RecordManagement.RECORD_PATH_PART);
log.trace("Going to account : {}", json);
@ -62,11 +67,14 @@ public class RecordManagement {
public Response get(@NotNull @PathParam(TYPE_PATH_PART) String type,
@NotNull @PathParam(RECORD_ID_PATH_PART) String recordId) throws Exception {
CalledMethodProvider.instance
.set(HTTPMethods.GET.name() + " /" + TYPE_PATH_PART + "/" + RECORD_ID_PATH_PART);
log.debug("Requested {} having ID {}", type, recordId);
AccountingPersistenceQuery accountingPersistenceQuery = AccountingPersistenceQueryFactory.getInstance();
String record = accountingPersistenceQuery.getRecord(recordId, type);
return Response.status(200).entity(record).type(AccountingResource.APPLICATION_JSON_CHARSET_UTF_8).build();
return Response.status(Status.OK).entity(record).type(AccountingResource.APPLICATION_JSON_CHARSET_UTF_8).build();
}

View File

@ -12,12 +12,15 @@ import org.gcube.accounting.persistence.AccountingPersistence;
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
import org.gcube.accounting.service.AccountingResource;
import org.gcube.accounting.service.AccountingServiceInitializer;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.smartgears.annotations.ManagedBy;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.research.ws.wadl.HTTPMethods;
/**
* @author Alessandro Pieve (alessandro.pieve@isti.cnr.it)
* @author Luca Frosini (ISTI - CNR)
@ -39,6 +42,10 @@ public class ServiceState {
@GET
@Produces(AccountingResource.APPLICATION_JSON_CHARSET_UTF_8)
public Response getState() throws JSONException {
CalledMethodProvider.instance
.set(HTTPMethods.GET.name() + " /" + STATE_PATH_PART);
String context = AccountingServiceInitializer.getCurrentContext();
logger.debug("Getting Service Status for context {}", context);
@ -46,8 +53,6 @@ public class ServiceState {
jsonObject.append(SERVICE, RUNNING);
jsonObject.append(CONTEXT, context);
Status responseStatus = Status.SERVICE_UNAVAILABLE;
AccountingPersistence accountingPersistence = AccountingPersistenceFactory.getPersistence();
try {
jsonObject.append(INSERT_CONNECTION_UP, accountingPersistence.isConnectionActive());
@ -62,7 +67,7 @@ public class ServiceState {
jsonObject.append(QUERY_CONNECTION_UP, false);
}
return Response.status(responseStatus).entity(jsonObject.toString()).build();
return Response.status(Status.OK).entity(jsonObject.toString()).build();
}