本文整理汇总了Java中eu.atos.sla.service.rest.helpers.AgreementHelper类的典型用法代码示例。如果您正苦于以下问题:Java AgreementHelper类的具体用法?Java AgreementHelper怎么用?Java AgreementHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AgreementHelper类属于eu.atos.sla.service.rest.helpers包,在下文中一共展示了AgreementHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActiveAgreements
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
@GET
@Path("active")
@Produces(MediaType.APPLICATION_XML)
public Response getActiveAgreements() {
logger.debug("StartOf getActiveAgreements - Get active agreements");
long actualDate = new Date().getTime();
Response result;
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getActiveAgreements(actualDate);
result = buildResponse(200, serializedAgreement);
} catch (HelperException e) {
logger.info("getActiveAgreements exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getActiveAgreements");
return result;
}
示例2: getActiveAgreements
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
@GET
@Path("active")
@Produces(MediaType.APPLICATION_XML)
public Response getActiveAgreements() {
logger.debug("StartOf getActiveAgreements - Get active agreements");
long actualDate = new Date().getTime();
Response result;
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getActiveAgreements(actualDate);
result = buildResponse(200, serializedAgreement);
} catch (HelperException e) {
logger.info("getActiveAgreements exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getActiveAgreements");
return result;
}
示例3: getAgreements
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Gets a the list of available agreements from where we can get metrics,
* host information, etc.
*
* <pre>
* GET /agreements{?providerId,consumerId,active}
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 OK
* Content-type: application/xml
* {@code
* <?xml version="1.0" encoding="UTF-8"?>
* <collection href="/agreements">
* <items offset="0" total="1">
* <wsag:Agreement xmlns:wsag="http://www.ggf.org/namespaces/ws-agreement"
* AgreementId="d25eea60-7cfe-11e3-baa7-0800200c9a66">
* ...
* </wsag:Agreement>
* </items>
* </collection>
* }
*
* </pre>
*
* Example:
* <li>curl http://localhost:8080/sla-service/agreements</li>
* <li>curl http://localhost:8080/sla-service/agreements?consumerId=user-10343</li>
*
* @throws JAXBException
*/
@GET
@Produces(MediaType.APPLICATION_XML)
public Response getAgreements(
@QueryParam("consumerId") String consumerId,
@QueryParam("providerId") String providerId,
@QueryParam("active") BooleanParam active) {
logger.debug("StartOf getAgreements - REQUEST for /agreements");
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getAgreements(consumerId, providerId, BooleanParam.getValue(active));
Response result = buildResponse(200, serializedAgreement);
logger.debug("EndOf getAgreements");
return result;
} catch (HelperException e) {
logger.info("getAgreements exception:"+e.getMessage());
return buildResponse(e);
}
}
示例4: getAgreementById
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Gets the information of an specific agreement. If the agreement it is not
* in the database, it returns 404 with empty payload
*
*
* <pre>
* GET /agreements/{id}
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 OK
* Content-type: application/xml
*
* <?xml version="1.0" encoding="UTF-8"?>
* <wsag:Agreement>...</wsag:Agreement>
*
*
*
* Example: <li>curl
* http://localhost:8080/sla-service/agreements/agreement04</li>
*
*
* @param id
* of the agreement
* @return XML information with the different details of the agreement
*/
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_XML)
public Response getAgreementById(@PathParam("id") String agreement_id) {
logger.debug("StartOf getAgreementById REQUEST for /agreements/" + agreement_id);
Response result;
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getAgreementByID(agreement_id);
if (serializedAgreement!=null){
result = buildResponse(200, serializedAgreement);
}else{
result = buildResponse(404, printError(404, "There are no getAgreements with agreementId " + agreement_id
+ " in the SLA Repository Database"));
}
} catch (HelperException e) {
logger.info("getAgreementById exception:"+e.getMessage());
result = buildResponse(e);
}
logger.debug("EndOf getAgreementById");
return result;
}
示例5: createAgreement
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Creates a new agreement
*
*
* <pre>
* POST /agreements
*
* Request:
* POST /agreements HTTP/1.1
* Accept: application/xml
*
* Response:
* HTTP/1.1 201 Created
* Content-type: application/xml
* Location: http://.../agreements/$uuid
*
* {@code
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
* <message code="201" message= "The agreement has been stored successfully in the SLA Repository Database"/>
* }
*
* </pre>
*
* Example:
* <li>curl -H "Content-type: application/xml" [email protected]
* localhost:8080/sla-service/agreements -X POST</li>
*
* @return XML information with the different details of the agreement
*/
@POST
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response createAgreement(@Context HttpHeaders hh,@Context UriInfo uriInfo, String payload){
logger.debug("StartOf createAgreement - Insert /agreements");
String location = null;
try{
AgreementHelper agreementRestService = getAgreementHelper();
location = agreementRestService.createAgreement(hh,uriInfo.getAbsolutePath().toString(), payload);
} catch (HelperException e) {
logger.info("createAgreement exception", e);
return buildResponse(e);
}
Response result = buildResponsePOST(HttpStatus.CREATED,
printMessage(
HttpStatus.CREATED,
"The agreement has been stored successfully in the SLA Repository Database with location:"+location),
location);
logger.debug("EndOf createAgreement");
return result;
}
示例6: deleteAgreement
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Deletes an agreement, passing the corresponding agreement_id as
* parameter.
*
*
* <pre>
* DELETE /agreements/{agreement_id}
*
* Request:
* DELETE /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 Ok
* Content-type: application/xml
*
* {@code
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
* <message code="201" message= "The agreement has been deleted successfully in the SLA Repository Database"/>
* }
*
* </pre>
*
* Example:
* <li>curl -X DELETE
* localhost:8080/sla-service/agreements/agreement04</li>
*
* @throws Exception
*/
@DELETE
@Path("{agreementId}")
@Produces(MediaType.APPLICATION_XML)
public Response deleteAgreement(@PathParam("agreementId") String agreementId){
logger.debug("DELETE /agreements/" + agreementId);
AgreementHelper agreementRestService = getAgreementHelper();
boolean deleted = agreementRestService.deleteByAgreementId(agreementId);
if (deleted)
return buildResponse(
204,
printMessage(204, "The agreement with id:" + agreementId
+ " was deleted successfully"));
else
return buildResponse(
404,
printError(404, "There is no agreement with id "
+ agreementId + " in the SLA Repository Database"));
}
示例7: getAgreementHelper
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
private AgreementHelper getAgreementHelper() {
return helper;
}
示例8: getStatusAgreementXML
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Gets the information of the status of the different Guarantee Terms of an
* agreement. *
*
* <pre>
* GET /agreements/{agreementId}/guaranteestatus
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 Ok
* Content-type: application/xml
*
* {@code
* <GuaranteeStatus agreementId="$agreementId" value="FULFILLED|VIOLATED|NON_DETERMINED">
* <GuaranteeTermStatus name="$gt_name1" value="FULFILLED|VIOLATED|NON_DETERMINED"/>
* ...
* <GuaranteeTermStatus name="$gt_nameN" value="FULFILLED|VIOLATED|NON_DETERMINED"/>
* </GuaranteeStatus>
* }
*
*
* </pre>
*
* Example: <li>curl -H "Content-type: application/xml" http://localhost:8080/sla-service/agreements/{agreementId}/guaranteestatus</li>
*
*
* @param id
* of the agreement
* @return XML information with Guarantee Status
*/
@GET
@Path("{id}/guaranteestatus")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response getStatusAgreementXML(@PathParam("id") String agreement_id) {
logger.debug("StartOf getStatusAgreementXML - REQUEST for /agreements/" + agreement_id
+ "/guaranteestatus");
Response result;
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getAgreementStatus(agreement_id,
MediaType.APPLICATION_XML);
if (serializedAgreement!=null){
result = buildResponse(200, serializedAgreement);
}else{
result = buildResponse(404, printError(404, "No agreement with "+agreement_id));
}
} catch (HelperException e) {
logger.info("getStatusAgreementXML exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getStatusAgreementXML");
return result;
}
示例9: getStatusAgreementJson
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Gets the information of the status of the different Guarantee Terms of an
* agreement. *
*
* <pre>
* GET /agreements/{agreementId}/guaranteestatus
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 Ok
* Content-type: application/xml
*
* {@code
* {"agreementId":"{agreementId}","value":"FULFILLED|VIOLATED|NON_DETERMINED",
* "GuaranteeTermStatus":
* [{"name":"{gt_name1}","value":"FULFILLED|VIOLATED|NON_DETERMINED"},
* {"name":"{gt_name2}","value":"FULFILLED|VIOLATED|NON_DETERMINED"}]}
* }
*
* </pre>
*
* Example:
* <li>curl -H "Content-type: application/xml" http://localhost:8080/sla-service/agreements/{agreementId}/guaranteestatus</li>
*
* @return Json information with Guarantee Status
*/
@GET
@Path("{id}/guaranteestatus")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response getStatusAgreementJson(@PathParam("id") String agreement_id) {
logger.debug("StartOf getStatusAgreementJson - REQUEST for /agreements/" + agreement_id
+ "/guaranteestatus");
Response result;
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getAgreementStatus(agreement_id,
MediaType.APPLICATION_JSON);
if (serializedAgreement!=null){
result = buildResponse(200, serializedAgreement);
}else{
result = buildResponse(404, printError(404, "No agreement with "+agreement_id));
}
} catch (HelperException e) {
logger.info("getStatusAgreementJson exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getStatusAgreementJson");
return result;
}
示例10: getAgreements
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Gets a the list of available agreements from where we can get metrics,
* host information, etc.
*
* <pre>
* GET /agreements{?providerId,consumerId,active}
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 OK
* Content-type: application/xml
* {@code
* <?xml version="1.0" encoding="UTF-8"?>
* <collection href="/agreements">
* <items offset="0" total="1">
* <wsag:Agreement xmlns:wsag="http://www.ggf.org/namespaces/ws-agreement"
* AgreementId="d25eea60-7cfe-11e3-baa7-0800200c9a66">
* ...
* </wsag:Agreement>
* </items>
* </collection>
* }
*
* </pre>
*
* Example:
* <li>curl http://localhost:8080/sla-service/agreements</li>
* <li>curl http://localhost:8080/sla-service/agreements?consumerId=user-10343</li>
*
* @throws JAXBException
*/
@GET
@Produces(MediaType.APPLICATION_XML)
public Response getAgreements(
@QueryParam("consumerId") String consumerId,
@QueryParam("providerId") String providerId,
@QueryParam("active") BooleanParam active) {
logger.debug("StartOf getAgreements - REQUEST for /agreements");
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getAgreements(consumerId, providerId, BooleanParam.getValue(active));
Response result = buildResponse(200, serializedAgreement);
logger.debug("EndOf getAgreements");
return result;
} catch (HelperException e) {
logger.info("getAgreements exception:"+e.getMessage());
return buildResponse(e);
}
}
示例11: getAgreementById
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Gets the information of an specific agreement. If the agreement it is not
* in the database, it returns 404 with empty payload
*
*
* <pre>
* GET /agreements/{id}
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 OK
* Content-type: application/xml
*
* <?xml version="1.0" encoding="UTF-8"?>
* <wsag:Agreement>...</wsag:Agreement>
*
*
*
* Example: <li>curl
* http://localhost:8080/sla-service/agreements/agreement04</li>
*
*
* @param id
* of the agreement
* @return XML information with the different details of the agreement
*/
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_XML)
public Response getAgreementById(@PathParam("id") String agreement_id) {
logger.debug("StartOf getAgreementById REQUEST for /agreements/" + agreement_id);
Response result;
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getAgreementByID(agreement_id);
if (serializedAgreement!=null){
result = buildResponse(200, serializedAgreement);
}else{
result = buildResponse(404, printError(404, "There are no getAgreements with agreementId " + agreement_id
+ " in the SLA Repository Database"));
}
} catch (HelperException e) {
logger.info("getAgreementById exception:"+e.getMessage());
result = buildResponse(e);
}
logger.debug("EndOf getAgreementById");
return result;
}
示例12: createAgreement
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Creates a new agreement
*
*
* <pre>
* POST /agreements
*
* Request:
* POST /agreements HTTP/1.1
* Accept: application/xml
*
* Response:
* HTTP/1.1 201 Created
* Content-type: application/xml
* Location: http://.../agreements/$uuid
*
* {@code
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
* <message code="201" message= "The agreement has been stored successfully in the SLA Repository Database"/>
* }
*
* </pre>
*
* Example:
* <li>curl -H "Content-type: application/xml" [email protected]
* localhost:8080/sla-service/agreements -X POST</li>
*
* @return XML information with the different details of the agreement
*/
@POST
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response createAgreement(@Context HttpHeaders hh,@Context UriInfo uriInfo, String payload){
logger.debug("StartOf createAgreement - Insert /agreements");
String location = null;
try{
AgreementHelper agreementRestService = getAgreementHelper();
location = agreementRestService.createAgreement(hh,uriInfo.getAbsolutePath().toString(), payload);
} catch (HelperException e) {
logger.info("createAgreement exception", e);
return buildResponse(e);
}
Response result = buildResponsePOST(HttpStatus.CREATED,
printMessage(
HttpStatus.CREATED,
"The agreement has been stored successfully in the SLA Repository Database with location:"+location),
location);
logger.debug("EndOf createAgreement");
return result;
}
示例13: deleteAgreement
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Deletes an agreement, passing the corresponding agreement_id as
* parameter.
*
*
* <pre>
* DELETE /agreements/{agreement_id}
*
* Request:
* DELETE /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 Ok
* Content-type: application/xml
*
* {@code
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
* <message code="201" message= "The agreement has been deleted successfully in the SLA Repository Database"/>
* }
*
* </pre>
*
* Example:
* <li>curl -X DELETE
* localhost:8080/sla-service/agreements/agreement04</li>
*
* @throws Exception
*/
@DELETE
@Path("{agreementId}")
@Produces(MediaType.APPLICATION_XML)
public Response deleteAgreement(@PathParam("agreementId") String agreementId){
logger.debug("DELETE /agreements/" + agreementId);
AgreementHelper agreementRestService = getAgreementHelper();
boolean deleted = agreementRestService.deleteByAgreementId(agreementId);
if (deleted)
return buildResponse(
204,
printMessage(204, "The agreement with id:" + agreementId
+ " was deleted successfully"));
else
return buildResponse(
404,
printError(404, "There is no agreement with id "
+ agreementId + " in the SLA Repository Database"));
}
示例14: getAgreementHelper
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
private AgreementHelper getAgreementHelper() {
return helper;
}
示例15: getStatusAgreementXML
import eu.atos.sla.service.rest.helpers.AgreementHelper; //导入依赖的package包/类
/**
* Gets the information of the status of the different Guarantee Terms of an
* agreement. *
*
* <pre>
* GET /agreements/{agreementId}/guaranteestatus
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 Ok
* Content-type: application/xml
*
* {@code
* <GuaranteeStatus agreementId="$agreementId" value="FULFILLED|VIOLATED|NON_DETERMINED">
* <GuaranteeTermStatus name="$gt_name1" value="FULFILLED|VIOLATED|NON_DETERMINED"/>
* ...
* <GuaranteeTermStatus name="$gt_nameN" value="FULFILLED|VIOLATED|NON_DETERMINED"/>
* </GuaranteeStatus>
* }
*
*
* </pre>
*
* Example: <li>curl -H "Content-type: application/xml" http://localhost:8080/sla-service/agreements/{agreementId}/guaranteestatus</li>
*
*
* @param id
* of the agreement
* @return XML information with Guarantee Status
*/
@GET
@Path("{id}/guaranteestatus")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response getStatusAgreementXML(@PathParam("id") String agreement_id) {
logger.debug("StartOf getStatusAgreementXML - REQUEST for /agreements/" + agreement_id
+ "/guaranteestatus");
Response result;
try{
AgreementHelper agreementRestService = getAgreementHelper();
String serializedAgreement = agreementRestService.getAgreementStatus(agreement_id,
MediaType.APPLICATION_XML);
if (serializedAgreement!=null){
result = buildResponse(200, serializedAgreement);
}else{
result = buildResponse(404, printError(404, "No agreement with "+agreement_id));
}
} catch (HelperException e) {
logger.info("getStatusAgreementXML exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getStatusAgreementXML");
return result;
}