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:
parent
52df5d8993
commit
9a5214828e
|
@ -1,7 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE xml>
|
<!DOCTYPE xml>
|
||||||
<ReleaseNotes>
|
<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>
|
<Change>Reorganize URLs to be REST compliant #10810</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.accounting.accounting-service.1-1-0" date="2017-10-09">
|
<Changeset component="org.gcube.accounting.accounting-service.1-1-0" date="2017-10-09">
|
||||||
|
|
3
pom.xml
3
pom.xml
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.accounting</groupId>
|
<groupId>org.gcube.accounting</groupId>
|
||||||
<artifactId>accounting-service</artifactId>
|
<artifactId>accounting-service</artifactId>
|
||||||
<version>1.2.0-SNAPSHOT</version>
|
<version>1.3.0-SNAPSHOT</version>
|
||||||
<name>accounting-service</name>
|
<name>accounting-service</name>
|
||||||
<description>Service Accounting Manger</description>
|
<description>Service Accounting Manger</description>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
@ -50,7 +50,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-smartgears-app</artifactId>
|
<artifactId>common-smartgears-app</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
|
|
|
@ -19,12 +19,15 @@ import org.gcube.accounting.persistence.AccountingPersistence;
|
||||||
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
|
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
|
||||||
import org.gcube.accounting.service.AccountingResource;
|
import org.gcube.accounting.service.AccountingResource;
|
||||||
import org.gcube.accounting.service.AccountingServiceInitializer;
|
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.DSMapper;
|
||||||
import org.gcube.documentstore.records.Record;
|
import org.gcube.documentstore.records.Record;
|
||||||
import org.gcube.smartgears.annotations.ManagedBy;
|
import org.gcube.smartgears.annotations.ManagedBy;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.sun.research.ws.wadl.HTTPMethods;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +44,8 @@ public class RecordManagement {
|
||||||
@POST
|
@POST
|
||||||
@Consumes({MediaType.TEXT_PLAIN, AccountingResource.APPLICATION_JSON_CHARSET_UTF_8})
|
@Consumes({MediaType.TEXT_PLAIN, AccountingResource.APPLICATION_JSON_CHARSET_UTF_8})
|
||||||
public Response add(String json) throws Exception {
|
public Response add(String json) throws Exception {
|
||||||
|
CalledMethodProvider.instance
|
||||||
|
.set(HTTPMethods.POST.name() + " /" + RecordManagement.RECORD_PATH_PART);
|
||||||
|
|
||||||
log.trace("Going to account : {}", json);
|
log.trace("Going to account : {}", json);
|
||||||
|
|
||||||
|
@ -62,11 +67,14 @@ public class RecordManagement {
|
||||||
public Response get(@NotNull @PathParam(TYPE_PATH_PART) String type,
|
public Response get(@NotNull @PathParam(TYPE_PATH_PART) String type,
|
||||||
@NotNull @PathParam(RECORD_ID_PATH_PART) String recordId) throws Exception {
|
@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);
|
log.debug("Requested {} having ID {}", type, recordId);
|
||||||
AccountingPersistenceQuery accountingPersistenceQuery = AccountingPersistenceQueryFactory.getInstance();
|
AccountingPersistenceQuery accountingPersistenceQuery = AccountingPersistenceQueryFactory.getInstance();
|
||||||
|
|
||||||
String record = accountingPersistenceQuery.getRecord(recordId, type);
|
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,15 @@ import org.gcube.accounting.persistence.AccountingPersistence;
|
||||||
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
|
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
|
||||||
import org.gcube.accounting.service.AccountingResource;
|
import org.gcube.accounting.service.AccountingResource;
|
||||||
import org.gcube.accounting.service.AccountingServiceInitializer;
|
import org.gcube.accounting.service.AccountingServiceInitializer;
|
||||||
|
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
|
||||||
import org.gcube.smartgears.annotations.ManagedBy;
|
import org.gcube.smartgears.annotations.ManagedBy;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.sun.research.ws.wadl.HTTPMethods;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alessandro Pieve (alessandro.pieve@isti.cnr.it)
|
* @author Alessandro Pieve (alessandro.pieve@isti.cnr.it)
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -39,6 +42,10 @@ public class ServiceState {
|
||||||
@GET
|
@GET
|
||||||
@Produces(AccountingResource.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(AccountingResource.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
public Response getState() throws JSONException {
|
public Response getState() throws JSONException {
|
||||||
|
|
||||||
|
CalledMethodProvider.instance
|
||||||
|
.set(HTTPMethods.GET.name() + " /" + STATE_PATH_PART);
|
||||||
|
|
||||||
String context = AccountingServiceInitializer.getCurrentContext();
|
String context = AccountingServiceInitializer.getCurrentContext();
|
||||||
logger.debug("Getting Service Status for context {}", context);
|
logger.debug("Getting Service Status for context {}", context);
|
||||||
|
|
||||||
|
@ -46,8 +53,6 @@ public class ServiceState {
|
||||||
jsonObject.append(SERVICE, RUNNING);
|
jsonObject.append(SERVICE, RUNNING);
|
||||||
jsonObject.append(CONTEXT, context);
|
jsonObject.append(CONTEXT, context);
|
||||||
|
|
||||||
Status responseStatus = Status.SERVICE_UNAVAILABLE;
|
|
||||||
|
|
||||||
AccountingPersistence accountingPersistence = AccountingPersistenceFactory.getPersistence();
|
AccountingPersistence accountingPersistence = AccountingPersistenceFactory.getPersistence();
|
||||||
try {
|
try {
|
||||||
jsonObject.append(INSERT_CONNECTION_UP, accountingPersistence.isConnectionActive());
|
jsonObject.append(INSERT_CONNECTION_UP, accountingPersistence.isConnectionActive());
|
||||||
|
@ -62,7 +67,7 @@ public class ServiceState {
|
||||||
jsonObject.append(QUERY_CONNECTION_UP, false);
|
jsonObject.append(QUERY_CONNECTION_UP, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response.status(responseStatus).entity(jsonObject.toString()).build();
|
return Response.status(Status.OK).entity(jsonObject.toString()).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue