Package org.apache.stratos.throttling.manager.dataobjects

Examples of org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext


    private static final Log log = LogFactory.getLog(KnowledgeBaseManager.class);

    public static ThrottlingDataContext feedKnowledgeBase(int tenantId, Task task,
            List<Object> knowledgeBase) throws ThrottlingException {
        // initialize the throttling context
        ThrottlingDataContext throttlingDataContext = new ThrottlingDataContext(tenantId);

        // prepare data from data providers
        try {
            task.prepareData(throttlingDataContext);
        } catch (ThrottlingException e) {
            String msg = "Error in preparing throttling data for tenant: " + tenantId + ".";
            log.error(msg, e);
            throw new ThrottlingException(msg, e);
        }

        // add data entries with object types separately
        for (ThrottlingDataEntry dataEntry : throttlingDataContext.getData()) {
            if (dataEntry.getValueType() == 4) {
                Object object = dataEntry.getObjectValue();
                if (object != null) {
                    knowledgeBase.add(object);
                }
            }
        }
        // load the access validation data
        try {
            ValidationInfoManager.loadValidationDetails(throttlingDataContext);
        } catch (ThrottlingException e) {
            String msg = "Error in loading validation details. tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new ThrottlingException(msg, e);
        }

        // add metering data context
        knowledgeBase.add(throttlingDataContext);
        // add access validation information
        knowledgeBase.add(throttlingDataContext.getAccessValidation());

        return throttlingDataContext;
    }
View Full Code Here


            log.error(msg, e);
            throw new JobExecutionException(msg, e);
        }
        // now persist the access validation information
        for (int tenantId : contextMap.keySet()) {
            ThrottlingDataContext dataContext = contextMap.get(tenantId);
            try {
                ValidationInfoManager.persistValidationDetails(dataContext);
            } catch (ThrottlingException e) {
                String msg = "Error in persisting validation details. Tenant id: " + tenantId + ".";
                log.error(msg, e);
View Full Code Here

            if (!tenant.isActive()) {
                continue;
            }
            int tenantId = tenant.getId();

            ThrottlingDataContext throttlingDataContext =
                    KnowledgeBaseManager.feedKnowledgeBase(tenantId, task, knowledgeBase);

            // store the context in the map.
            contextMap.put(tenantId, throttlingDataContext);
        }
View Full Code Here

       
        List<Task> tasks = Util.getTasks();
        for (Task task: tasks) {
            // initialize the knowledge base
            List<Object> knowledgeBase = new ArrayList<Object>();
            ThrottlingDataContext throttlingDataContext =
                    KnowledgeBaseManager.feedKnowledgeBase(currentTenantId, task, knowledgeBase);

            RuleInvoker ruleInvoker = task.getRuleInvoker();
            ruleInvoker.invoke(knowledgeBase);
View Full Code Here

TOP

Related Classes of org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.