Package org.wso2.carbon.billing.mgt.dataobjects

Examples of org.wso2.carbon.billing.mgt.dataobjects.MultitenancyPackage


            handlerContext.setCustomer(subscription.getCustomer());
        }
    }

    private Item getItem(int itemId) {
        return new MultitenancyPackage(multitenancyPackagesMap.get(itemId));
    }
View Full Code Here


public class CustomDataProvider extends DataProvider {
    public void invoke(ThrottlingDataContext dataContext) throws ThrottlingException {
        long dataSize = dataContext.getDataLong(ThrottlingDataEntryConstants.TENANT_CAPACITY);

        if (dataSize % 2 == 0) {
            MultitenancyPackage multiPackage = new MultitenancyPackage();
            multiPackage.setName("test1");
            multiPackage.setBandwidthLimit(50);

            dataContext.addDataObject(ThrottlingDataEntryConstants.PACKAGE, multiPackage);
        } else {
            MultitenancyPackage multiPackage = new MultitenancyPackage();
            multiPackage.setName("test2");

            dataContext.addDataObject(ThrottlingDataEntryConstants.PACKAGE, multiPackage);
            multiPackage.setBandwidthLimit(50);
        }

    }
View Full Code Here

        if (subscription == null) {
            currentPackage = null;
        } else {
            currentPackage = subscription.getItem();
        }
        MultitenancyPackage currentMultitenancyPackage = null;
        for (MultitenancyPackage multitenancyPackage : multitenancyPackages) {
            if (multitenancyPackage.getName().toLowerCase().contains("free") &&
                currentPackage == null) {
                currentMultitenancyPackage = multitenancyPackage;
                break;
View Full Code Here

     * @param tenantId, tenant id
     * @throws RegistryException, if getting the maximum number of users failed.
     * @return, maximum number of users allowed.
     */
    public static int getMaximumUsersAllow(int tenantId) throws RegistryException {
        MultitenancyPackage multitenancyPackage = getCurrentBillingPackage(tenantId);
        if (multitenancyPackage == null) {
            String msg = "The multitenancy package is null.";
            log.error(msg);
            throw new RegistryException(msg);
        }
        return multitenancyPackage.getUsersLimit();
    }
View Full Code Here

     * @param tenantId, tenant id
     * @return Resource volume limit.
     * @throws RegistryException, if getting the maximum resource limit failed.
     */
    public static long getMaximumResourceVolume(int tenantId) throws RegistryException {
        MultitenancyPackage multitenancyPackage = getCurrentBillingPackage(tenantId);
        if (multitenancyPackage == null) {
            String msg = "The multitenancy package is null.";
            log.error(msg);
            throw new RegistryException(msg);
        }
        // converting the mb to bytes
        return ((long) multitenancyPackage.getResourceVolumeLimit()) * 1024 * 1024;
    }
View Full Code Here

        if (subscription == null) {
            currentPackage = null;
        } else {
            currentPackage = subscription.getItem();
        }
        MultitenancyPackage currentMultitenancyPackage = null;
        for (MultitenancyPackage multitenancyPackage : multitenancyPackages) {
            if (multitenancyPackage.getName().toLowerCase().contains("free") &&
                    currentPackage == null) {
                currentMultitenancyPackage = multitenancyPackage;
                break;
View Full Code Here

     * @param tenantId, tenant id
     * @throws RegistryException, if getting the maximum number of users failed.
     * @return, maximum number of users allowed.
     */
    public static int getMaximumUsersAllow(int tenantId) throws RegistryException {
        MultitenancyPackage multitenancyPackage = getCurrentBillingPackage(tenantId);
        if (multitenancyPackage == null) {
            String msg = "The multitenancy package is null.";
            log.error(msg);
            throw new RegistryException(msg);
        }
        return multitenancyPackage.getUsersLimit();
    }
View Full Code Here

     * @param tenantId, tenant id
     * @return Resource volume limit.
     * @throws RegistryException, if getting the maximum resource limit failed.
     */
    public static long getMaximumResourceVolume(int tenantId) throws RegistryException {
        MultitenancyPackage multitenancyPackage = getCurrentBillingPackage(tenantId);
        if (multitenancyPackage == null) {
            String msg = "The multitenancy package is null.";
            log.error(msg);
            throw new RegistryException(msg);
        }
        // converting the mb to bytes
        return ((long) multitenancyPackage.getResourceVolumeLimit()) * 1024 * 1024;
    }
View Full Code Here

            log.error(msg, e);
            throw new ThrottlingException(msg, e);
        }
        // getting the package
        try {
            MultitenancyPackage mtPackage = Util.getCurrentBillingPackage(tenantId);
            dataContext.addDataObject(ThrottlingDataEntryConstants.PACKAGE, mtPackage);
        } catch (RegistryException e) {
            String msg = "Error in getting the multi-tenancy package. tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new ThrottlingException(msg, e);
View Full Code Here

public class CustomDataProvider extends DataProvider {
    public void invoke(ThrottlingDataContext dataContext) throws ThrottlingException {
        long dataSize = dataContext.getDataLong(ThrottlingDataEntryConstants.TENANT_CAPACITY);

        if (dataSize % 2 == 0) {
            MultitenancyPackage multiPackage = new MultitenancyPackage();
            multiPackage.setName("test1");
            multiPackage.setBandwidthLimit(50);

            dataContext.addDataObject(ThrottlingDataEntryConstants.PACKAGE, multiPackage);
        } else {
            MultitenancyPackage multiPackage = new MultitenancyPackage();
            multiPackage.setName("test2");

            dataContext.addDataObject(ThrottlingDataEntryConstants.PACKAGE, multiPackage);
            multiPackage.setBandwidthLimit(50);
        }

    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.billing.mgt.dataobjects.MultitenancyPackage

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.