当前位置: 首页>>代码示例>>Java>>正文


Java Load类代码示例

本文整理汇总了Java中ch.icclab.cyclops.util.Load的典型用法代码示例。如果您正苦于以下问题:Java Load类的具体用法?Java Load怎么用?Java Load使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Load类属于ch.icclab.cyclops.util包,在下文中一共展示了Load类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRoutes

import ch.icclab.cyclops.util.Load; //导入依赖的package包/类
@Override
public void createRoutes() {
    router.attach("/api", TelemetryResource.class); //API used internally to trigger the data collection
    counter.registerEndpoint("/api");

    router.attach("/usage/users/{userId}", UserUsageResource.class); //API used for fetching the usage info for a user
    counter.registerEndpoint("/usage/users");

    router.attach("/usage/resources/{resourceid}", ResourceUsage.class);
    counter.registerEndpoint("/usage/resources");

    router.attach("/meters", MeterResource.class); //API used for saving and returning the information on selected meters for usage metrics collection
    counter.registerEndpoint("/meters");

    router.attach("/environment/meters", OpenstackMeterResource.class); //API used for saving and returning the information on selected meters for usage metrics collection
    counter.registerEndpoint("environment/meters");

    Load load = new Load();

    // but also start scheduler immediately
    startInternalScheduler();
}
 
开发者ID:icclab,项目名称:cyclops-udr,代码行数:23,代码来源:OpenstackUDRApplication.java

示例2: createRoutes

import ch.icclab.cyclops.util.Load; //导入依赖的package包/类
@Override
public void createRoutes() {
    router.attach("/ext/app", ExternalAppResource.class); // API used for data insertion from external PaaS/IaaS
    counter.registerEndpoint("/ext/app");

    router.attach("/usage/users/{userId}", UserUsageResource.class); //API used for fetching the usage info for a user

    counter.registerEndpoint("/usage/users");

    router.attach("/usage/resources/{resourceid}", ResourceUsage.class);
    counter.registerEndpoint("/usage/resources");

    router.attach("/mcn/usage", McnUsageDataRecordResource.class); //API to query time-based service usage per user (required by RC for T-Nova)
    counter.registerEndpoint("/mcn/usage");

    router.attach("/meters", MeterResource.class); //API used for saving and returning the information on selected meters for usage metrics collection
    counter.registerEndpoint("/meters");

    // internal scheduler with start/stop/restart/force/status commands
    router.attach("/scheduler/{command}", Endpoint.class);
    counter.registerEndpoint("/scheduler");

    // but also start scheduler immediately
    startInternalScheduler();

    // and start rabbitmq thread
    startRabbitMQThread();
    Load load = new Load();

}
 
开发者ID:icclab,项目名称:cyclops-udr,代码行数:31,代码来源:McnUDRApplication.java

示例3: buildStaticRateResponse

import ch.icclab.cyclops.util.Load; //导入依赖的package包/类
/**
 * Build the static rate of a resource
 *
 * Pseudo Code
 * 1. Get the latest static rates from a list
 * 2. Construct the response
 * 3. Return the json string
 *
 * @return Representation
 */
private Representation buildStaticRateResponse() {
    String jsonStr = null;
    RateStatusResponse response = new RateStatusResponse();
    ObjectMapper mapper = new ObjectMapper();
    response.setRate_policy("static");
    response.setRate(Load.getStaticRate());
    try {
        jsonStr = mapper.writeValueAsString(response);
    } catch (JsonProcessingException e) {
        e.printStackTrace();
    }
    JsonRepresentation jsonResp = new JsonRepresentation(jsonStr);
    return jsonResp;
}
 
开发者ID:icclab,项目名称:cyclops-rc,代码行数:25,代码来源:RateStatusResource.java

示例4: getData

import ch.icclab.cyclops.util.Load; //导入依赖的package包/类
/**
 * Get the usage data for the userID mentioned in the URL string
 * <p>
 * Pseudo Code<br/>
 * 1. Extract the QueryValues from the URL<br/>
 * 2. Add the meters name to the meter list<br/>
 * 3. Query the DB to get the usage data and add the response to an array list<br/>
 * 4. Add the array list with its source name into a HashMap<br/>
 * 5. Construct the response and return it in the JSON format
 *
 * @return userUsageResponse Response consisting of the usage data for the request userID
 */
@Get
public Representation getData() {
    counter.increment(endpoint);
    Representation userUsageResponse;
    TSDBData usageData = null;
    HashMap usageArr = new HashMap();
    ArrayList<TSDBData> meterDataArrList;
    TSDBResource dbResource = new TSDBResource();
    String fromDate = getQueryValue("from");
    String toDate = getQueryValue("to");
    logger.debug("Attempting to get Usage Data for user: " + userId + " from: " + fromDate + " to: " + toDate);
    Load load = new Load();
    load.meterList();
    if (Load.getOpenStackCumulativeMeterList().size() != 0 || Load.getOpenStackGaugeMeterList().size() != 0) {
        meterDataArrList = new ArrayList<TSDBData>();
        //Get the data for the OpenStack Cumulative Meters from the DB and create the arraylist consisting of hashmaps of meter name and usage value
        for (int i = 0; i < Load.getOpenStackCumulativeMeterList().size(); i++) {
            usageData = dbResource.getUsageData(fromDate, toDate, userId, Load.getOpenStackCumulativeMeterList().get(i), "openstack", "cumulative");
            if (usageData != null && usageData.getPoints().size() != 0) {
                usageData = formatTime(usageData, usageData.getColumns().indexOf("time"));
                meterDataArrList.add(usageData);
            }
        }
        //Get the data for the OpenStack Gauge Meters from the DB and create the arraylist consisting of hashmaps of meter name and usage value
        for (int i = 0; i < Load.getOpenStackGaugeMeterList().size(); i++) {
            usageData = dbResource.getUsageData(fromDate, toDate, userId, Load.getOpenStackGaugeMeterList().get(i), "openstack", "gauge");
            if (usageData != null && usageData.getPoints().size() != 0) {
                usageData = formatTime(usageData, usageData.getColumns().indexOf("time"));
                meterDataArrList.add(usageData);
            }
        }
        if (meterDataArrList.size() != 0) {
            usageArr.put("OpenStack", meterDataArrList);
        }

    }

    if (Load.getExternalMeterList().size() != 0) {
        meterDataArrList = new ArrayList<TSDBData>();
        for (int i = 0; i < Load.getExternalMeterList().size(); i++) {
            usageData = dbResource.getUsageData(fromDate, toDate, userId, Load.getExternalMeterList().get(i), "", "");
            if (usageData != null && usageData.getPoints().size() != 0) {
                usageData = formatTime(usageData, usageData.getColumns().indexOf("time"));
                meterDataArrList.add(usageData);
            }
        }
        if (meterDataArrList.size() != 0) {
            usageArr.put("External", meterDataArrList);
        }
    }

    //Construct the response in JSON string
    userUsageResponse = constructResponse(usageArr, userId, fromDate, toDate);
    logger.trace("END Representation getData()");
    return userUsageResponse;
}
 
开发者ID:icclab,项目名称:cyclops-udr,代码行数:69,代码来源:UserUsageResource.java

示例5: loadConfiguration

import ch.icclab.cyclops.util.Load; //导入依赖的package包/类
/**
 * Loads the configuration file at the beginning of the application startup
 *
 * Pseudo Code
 * 1. Create the LoadConfiguration class
 * 2. Load the file if the the existing instance of the class is empty
 *
 * @param context
 */
private void loadConfiguration(Context context){
    Load load = new Load();
    if(load.configuration == null){
        load.configFile(getContext());
    }
}
 
开发者ID:icclab,项目名称:cyclops-billing,代码行数:16,代码来源:BillingServiceApplication.java


注:本文中的ch.icclab.cyclops.util.Load类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。