本文整理汇总了Java中eu.atos.sla.service.rest.helpers.EnforcementJobHelper类的典型用法代码示例。如果您正苦于以下问题:Java EnforcementJobHelper类的具体用法?Java EnforcementJobHelper怎么用?Java EnforcementJobHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnforcementJobHelper类属于eu.atos.sla.service.rest.helpers包,在下文中一共展示了EnforcementJobHelper类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEnforcements
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Get the list of available enforcements
*
* <pre>
* GET /enforcements
*
* Request:
* GET /enforcements HTTP/1.1
* Accept: application/xml
*
* Response:
*
* {@code
* <?xml version="1.0" encoding="UTF-8"?>
* <collection href="/enforcements">
* <items offset="0" total="1">
*
* <enforcement_job>
* <agreement_id>agreement04</agreement_id>
* <enabled>false</enabled>
* </enforcement_job>
*
* </items>
* </collection>
* }
*
* </pre>
*
* Example: <li>curl http://localhost:8080/sla-service/enforcements</li>
*
* @return XML information with the different details of the different
* enforcements
*
* @throws Exception
*/
@GET
@Produces(MediaType.APPLICATION_XML)
public Response getEnforcements() {
logger.debug("StartOf getEnforcements - REQUEST for /enforcements");
EnforcementJobHelper enforcementJobService = getHelper();
String serializedEnforcements = null;
try{
serializedEnforcements = enforcementJobService.getEnforcements();
} catch (HelperException e) {
logger.info("getEnforcements exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getEnforcements");
return buildResponse(200, serializedEnforcements);
}
示例2: getEnforcementJobByAgreementId
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Gets an specific enforcements given a agreementId If the enforcementJob
* it is not in the database, it returns 404 with empty payload
*
*
* <pre>
* GET /enforcements/{agreementId}
*
* Request:
* GET /enforcements HTTP/1.1
*
* Response:
*
* {@code
* <?xml version="1.0" encoding="UTF-8"?>
*
* <enforcement_job>
* <agreement_id>agreement04</agreement_id>
* <enabled>false</enabled>
* </enforcement_job>
*
* }
*
* </pre>
*
* Example: <li>curl
* http://localhost:8080/sla-service/enforcements/agreement04</li>
*
* @param agreementId
* of the enforcementJob
* @return XML information with the different details of the enforcementJob
*/
@GET
@Path("{agreementId}")
@Produces(MediaType.APPLICATION_XML)
public Response getEnforcementJobByAgreementId(@PathParam("agreementId") String agreementId){
logger.debug("StartOf getEnforcementJobByAgreementId - REQUEST for /enforcementJobs/" + agreementId);
try {
EnforcementJobHelper enforcementJobService = getHelper();
String serializedEnforcement = enforcementJobService.getEnforcementJobByUUID(agreementId);
if (serializedEnforcement!=null){
logger.debug("EndOf getEnforcementJobByAgreementId");
return buildResponse(200, serializedEnforcement);
}else{
logger.debug("EndOf getEnforcementJobByAgreementId");
return buildResponse(404, printError(404, "There is no enforcement with uuid " + agreementId
+ " in the SLA Repository Database"));
}
} catch (HelperException e) {
logger.info("getEnforcementJobByAgreementId exception:"+e.getMessage());
return buildResponse(e);
}
}
示例3: startEnforcementJob
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Enables an enforcement job
*
* *
*
* <pre>
* GET /enforcements/{agreementId}
*
* Request:
* GET /enforcements HTTP/1.1
*
* Response:
*
* {@code
*
* The enforcement job with agreement-uuid e3bc4f6a-5f58-453b-9f59-ac3eeaee45b2has started
*
* }
*
* </pre>
*
* Example: <li>curl -X PUT localhost:8080/sla-service/enforcements/e3bc4f6a-5f58-453b-9f59-ac3eeaee45b2/start</li>
*
* @param agreementId of the enforcementJob
* @return information that the enforcementJob has been started
*/
@PUT
@Path("{agreementId}/start")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response startEnforcementJob(@PathParam("agreementId") String agreementId) {
logger.debug("StartOf Start /enforcementJobs");
EnforcementJobHelper enforcementJobService = getHelper();
if (enforcementJobService.startEnforcementJob(agreementId))
return buildResponse(202,
"The enforcement job with agreement-uuid " + agreementId
+ "has started");
else
return buildResponse(
404,
printError(404,
"There has not been possible to start the enforcementJob with agreementId : "
+ agreementId
+ " in the SLA Repository Database"));
}
示例4: stopEnforcementJob
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Disables an enforcement job /** Enables an enforcement job
*
* *
*
* <pre>
* GET /enforcements/{agreementId}
*
* Request:
* GET /enforcements HTTP/1.1
*
* Response:
*
* {@code
*
* The enforcement job with agreement-uuid e3bc4f6a-5f58-453b-9f59-ac3eeaee45b2has started
*
* }
*
* </pre>
*
* Example: <li>curl -X PUT localhost:8080/sla-service/enforcements/e3bc4f6a-5f58-453b-9f59-ac3eeaee45b2/stop</li>
*
* @param agreementId
* of the enforcementJob
* @return information that the enforcementJob has been stopped
*/
@PUT
@Path("{agreementId}/stop")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response stopEnforcementJob(
@PathParam("agreementId") String agreementId) {
logger.debug("Stop /enforcementJobs");
EnforcementJobHelper enforcementJobService = getHelper();
if (enforcementJobService.stopEnforcementJob(agreementId))
return buildResponse(200,
"The enforcement job with agreement-uuid " + agreementId
+ "has stopped");
else
return buildResponse(
404,
printError(404,
"There has not been possible to start the enforcementJob with uuid : "
+ agreementId
+ " in the SLA Repository Database"));
}
示例5: createEnforcementJob
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Creates a new enforcement
*
*
* <pre>
* POST /enforcements
*
*
* Request:
* POST /agreements HTTP/1.1
* Accept: application/xml
*
* Response:
*
* {@code
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
* <message code="201" message= "The enforcementJob has been stored successfully in the SLA Repository Database"/>
* }
*
* </pre>
*
* Example: <li>curl -H "Content-type: application/xml" -X POST -d @enforcement.xml localhost:8080/sla-service/enforcements</li>
*
* @param id of the agreement
* @return XML information with the different details of the agreement
*/
@POST
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response createEnforcementJob(@Context HttpHeaders hh, String payload){
logger.debug("StartOf createEnforcementJob - REQUEST Insert /enforcement");
EnforcementJobHelper enforcementJobService = getHelper();
String location;
try {
location = enforcementJobService.createEnforcementJob(
hh, _uriInfo.getAbsolutePath().toString(), payload);
} catch (HelperException e) {
logger.info("createEnforcementJob exception", e);
return buildResponse(e);
}
logger.debug("EndOf createEnforcementJob");
return buildResponsePOST(
HttpStatus.CREATED,
printMessage(
HttpStatus.CREATED,
"The enforcementJob has been stored successfully in the SLA Repository Database"),
location);
}
示例6: getHelper
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
private EnforcementJobHelper getHelper() {
return helper;
}
示例7: getEnforcements
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Get the list of available enforcements
*
* <pre>
* GET /enforcements
*
* Request:
* GET /enforcements HTTP/1.1
* Accept: application/xml
*
* Response:
*
* {@code
* <?xml version="1.0" encoding="UTF-8"?>
* <collection href="/enforcements">
* <items offset="0" total="1">
*
* <enforcement_job>
* <agreement_id>agreement04</agreement_id>
* <enabled>false</enabled>
* </enforcement_job>
*
* </items>
* </collection>
* }
*
* </pre>
*
* Example: <li>curl http://localhost:8080/sla-service/enforcements</li>
*
* @return XML information with the different details of the different
* enforcements
*
* @throws Exception
*/
@GET
@Produces(MediaType.APPLICATION_XML)
public Response getEnforcements() {
logger.debug("StartOf getEnforcements - REQUEST for /enforcements");
EnforcementJobHelper enforcementJobService = getHelper();
String serializedEnforcements = null;
try{
serializedEnforcements = enforcementJobService.getEnforcements();
} catch (HelperException e) {
logger.info("getEnforcements exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getEnforcements");
return buildResponse(200, serializedEnforcements);
}
示例8: getEnforcementJobByAgreementId
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Gets an specific enforcements given a agreementId If the enforcementJob
* it is not in the database, it returns 404 with empty payload
*
*
* <pre>
* GET /enforcements/{agreementId}
*
* Request:
* GET /enforcements HTTP/1.1
*
* Response:
*
* {@code
* <?xml version="1.0" encoding="UTF-8"?>
*
* <enforcement_job>
* <agreement_id>agreement04</agreement_id>
* <enabled>false</enabled>
* </enforcement_job>
*
* }
*
* </pre>
*
* Example: <li>curl
* http://localhost:8080/sla-service/enforcements/agreement04</li>
*
* @param agreementId
* of the enforcementJob
* @return XML information with the different details of the enforcementJob
*/
@GET
@Path("{agreementId}")
@Produces(MediaType.APPLICATION_XML)
public Response getEnforcementJobByAgreementId(@PathParam("agreementId") String agreementId){
logger.debug("StartOf getEnforcementJobByAgreementId - REQUEST for /enforcementJobs/" + agreementId);
try {
EnforcementJobHelper enforcementJobService = getHelper();
String serializedEnforcement = enforcementJobService.getEnforcementJobByUUID(agreementId);
if (serializedEnforcement!=null){
logger.debug("EndOf getEnforcementJobByAgreementId");
return buildResponse(200, serializedEnforcement);
}else{
logger.debug("EndOf getEnforcementJobByAgreementId");
return buildResponse(404, printError(404, "There is no enforcement with uuid " + agreementId
+ " in the SLA Repository Database"));
}
} catch (HelperException e) {
logger.info("getEnforcementJobByAgreementId exception:"+e.getMessage());
return buildResponse(e);
}
}
示例9: startEnforcementJob
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Enables an enforcement job
*
* *
*
* <pre>
* GET /enforcements/{agreementId}
*
* Request:
* GET /enforcements HTTP/1.1
*
* Response:
*
* {@code
*
* The enforcement job with agreement-uuid e3bc4f6a-5f58-453b-9f59-ac3eeaee45b2has started
*
* }
*
* </pre>
*
* Example: <li>curl -X PUT localhost:8080/sla-service/enforcements/e3bc4f6a-5f58-453b-9f59-ac3eeaee45b2/start</li>
*
* @param agreementId of the enforcementJob
* @return information that the enforcementJob has been started
*/
@PUT
@Path("{agreementId}/start")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response startEnforcementJob(@PathParam("agreementId") String agreementId) {
logger.debug("StartOf Start /enforcementJobs");
EnforcementJobHelper enforcementJobService = getHelper();
if (enforcementJobService.startEnforcementJob(agreementId))
return buildResponse(202,
"The enforcement job with agreement-uuid " + agreementId
+ "has started");
else
return buildResponse(
404,
printError(404,
"There has not been possible to start the enforcementJob with agreementId : "
+ agreementId
+ " in the SLA Repository Database"));
}
示例10: stopEnforcementJob
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Disables an enforcement job /** Enables an enforcement job
*
* *
*
* <pre>
* GET /enforcements/{agreementId}
*
* Request:
* GET /enforcements HTTP/1.1
*
* Response:
*
* {@code
*
* The enforcement job with agreement-uuid e3bc4f6a-5f58-453b-9f59-ac3eeaee45b2has started
*
* }
*
* </pre>
*
* Example: <li>curl -X PUT localhost:8080/sla-service/enforcements/e3bc4f6a-5f58-453b-9f59-ac3eeaee45b2/stop</li>
*
* @param agreementId
* of the enforcementJob
* @return information that the enforcementJob has been stopped
*/
@PUT
@Path("{agreementId}/stop")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response stopEnforcementJob(
@PathParam("agreementId") String agreementId) {
logger.debug("Stop /enforcementJobs");
EnforcementJobHelper enforcementJobService = getHelper();
if (enforcementJobService.stopEnforcementJob(agreementId))
return buildResponse(200,
"The enforcement job with agreement-uuid " + agreementId
+ "has stopped");
else
return buildResponse(
404,
printError(404,
"There has not been possible to start the enforcementJob with uuid : "
+ agreementId
+ " in the SLA Repository Database"));
}
示例11: createEnforcementJob
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
/**
* Creates a new enforcement
*
*
* <pre>
* POST /enforcements
*
*
* Request:
* POST /agreements HTTP/1.1
* Accept: application/xml
*
* Response:
*
* {@code
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
* <message code="201" message= "The enforcementJob has been stored successfully in the SLA Repository Database"/>
* }
*
* </pre>
*
* Example: <li>curl -H "Content-type: application/xml" -X POST -d @enforcement.xml localhost:8080/sla-service/enforcements</li>
*
* @param id of the agreement
* @return XML information with the different details of the agreement
*/
@POST
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response createEnforcementJob(@Context HttpHeaders hh, String payload){
logger.debug("StartOf createEnforcementJob - REQUEST Insert /enforcement");
EnforcementJobHelper enforcementJobService = getHelper();
String location;
try {
location = enforcementJobService.createEnforcementJob(
hh, _uriInfo.getAbsolutePath().toString(), payload);
} catch (HelperException e) {
logger.info("createEnforcementJob exception", e);
return buildResponse(e);
}
logger.debug("EndOf createEnforcementJob");
return buildResponsePOST(
HttpStatus.CREATED,
printMessage(
HttpStatus.CREATED,
"The enforcementJob has been stored successfully in the SLA Repository Database"),
location);
}
示例12: getHelper
import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //导入依赖的package包/类
private EnforcementJobHelper getHelper() {
return helper;
}