當前位置: 首頁>>代碼示例>>Java>>正文


Java EnforcementJobHelper類代碼示例

本文整理匯總了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);
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:53,代碼來源:EnforcementJobRest.java

示例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);
	}
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:56,代碼來源:EnforcementJobRest.java

示例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"));

}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:48,代碼來源:EnforcementJobRest.java

示例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"));

}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:51,代碼來源:EnforcementJobRest.java

示例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);
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:50,代碼來源:EnforcementJobRest.java

示例6: getHelper

import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //導入依賴的package包/類
private EnforcementJobHelper getHelper() {
	return helper;
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:4,代碼來源:EnforcementJobRest.java

示例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);
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:53,代碼來源:EnforcementJobRest.java

示例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);
    }
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:56,代碼來源:EnforcementJobRest.java

示例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"));

}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:48,代碼來源:EnforcementJobRest.java

示例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"));

}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:51,代碼來源:EnforcementJobRest.java

示例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);
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:50,代碼來源:EnforcementJobRest.java

示例12: getHelper

import eu.atos.sla.service.rest.helpers.EnforcementJobHelper; //導入依賴的package包/類
private EnforcementJobHelper getHelper() {
    return helper;
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:4,代碼來源:EnforcementJobRest.java


注:本文中的eu.atos.sla.service.rest.helpers.EnforcementJobHelper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。