Package org.wso2.carbon.registry.core.session

Examples of org.wso2.carbon.registry.core.session.UserRegistry.resourceExists()


        TenantManager tenantManager = Util.getRealmService().getTenantManager();
        SystemMeteringAgent meteringAgent = Util.getSystemMeteringAgent();

        //get super tenant governance registry
        UserRegistry superTenantGovernanceRegistry = Util.getSuperTenantGovernanceSystemRegistry();
        if (!superTenantGovernanceRegistry.resourceExists(OLD_BANDWIDTH_USE_STORE_PATH)) {
            return;
        }

        Tenant[] tenants = tenantManager.getAllTenants();
        // uses only the current year month 2010-july
View Full Code Here


            throws RegistryException {
        UserRegistry superTenantGovernanceRegistry = Util.getSuperTenantGovernanceSystemRegistry();

        String incomingBandwidthUserCollectionPath =
                OLD_BANDWIDTH_USE_STORE_PATH + RegistryConstants.PATH_SEPARATOR + tenantId;
        if (!superTenantGovernanceRegistry.resourceExists(incomingBandwidthUserCollectionPath)) {
            return 0;
        }

        Resource incomingBandwidthUserCollectionR =
                superTenantGovernanceRegistry.get(incomingBandwidthUserCollectionPath);
View Full Code Here

        for (String incomingBandwidthUserPath : incomingBandwidthUserPaths) {
            String incomingBandwidthResourcePath =
                    incomingBandwidthUserPath + RegistryConstants.PATH_SEPARATOR + yearMonth +
                            RegistryConstants.PATH_SEPARATOR + StratosConstants.INCOMING_PATH_DIR;

            if (!superTenantGovernanceRegistry.resourceExists(incomingBandwidthResourcePath)) {
                return 0;
            }
            Resource incomingBandwidthResource =
                    superTenantGovernanceRegistry.get(incomingBandwidthResourcePath);
            if (incomingBandwidthResource instanceof Collection) {
View Full Code Here

    public long getOldOutgoingRegistryBandwidth(String yearMonth, int tenantId)
            throws RegistryException {
        UserRegistry superTenantGovernanceRegistry = Util.getSuperTenantGovernanceSystemRegistry();
        String outgoingBandwidthUserCollectionPath =
                OLD_BANDWIDTH_USE_STORE_PATH + RegistryConstants.PATH_SEPARATOR + tenantId;
        if (!superTenantGovernanceRegistry.resourceExists(outgoingBandwidthUserCollectionPath)) {
            return 0;
        }

        Resource outgoingBandwidthUserCollectionR =
                superTenantGovernanceRegistry.get(outgoingBandwidthUserCollectionPath);
View Full Code Here

        for (String outgoingBandwidthUserPath : outgoingBandwidthUserPaths) {
            String outgoingBandwidthResourcePath =
                    outgoingBandwidthUserPath + RegistryConstants.PATH_SEPARATOR + yearMonth +
                            RegistryConstants.PATH_SEPARATOR + StratosConstants.OUTGOING_PATH_DIR;

            if (!superTenantGovernanceRegistry.resourceExists(outgoingBandwidthResourcePath)) {
                return 0;
            }
            Resource outgoingBandwidthResource =
                    superTenantGovernanceRegistry.get(outgoingBandwidthResourcePath);
            if (outgoingBandwidthResource instanceof Collection) {
View Full Code Here

    public void createdConfigurationContext(ConfigurationContext configurationContext) {
        try {
            UserRegistry userRegistry =
                    MessageBoxServiceValueHolder.getInstance().getRegistryService().getGovernanceSystemRegistry(
                            SuperTenantCarbonContext.getCurrentContext(configurationContext).getTenantId());
            if (!userRegistry.resourceExists(MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH)) {
                userRegistry.put(MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH,
                                 userRegistry.newCollection());
            }
            if (!userRegistry.resourceExists(MessageBoxConstants.MB_QUEUE_STORAGE_PATH)) {
                userRegistry.put(MessageBoxConstants.MB_QUEUE_STORAGE_PATH,
View Full Code Here

                            SuperTenantCarbonContext.getCurrentContext(configurationContext).getTenantId());
            if (!userRegistry.resourceExists(MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH)) {
                userRegistry.put(MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH,
                                 userRegistry.newCollection());
            }
            if (!userRegistry.resourceExists(MessageBoxConstants.MB_QUEUE_STORAGE_PATH)) {
                userRegistry.put(MessageBoxConstants.MB_QUEUE_STORAGE_PATH,
                                 userRegistry.newCollection());
            }
        } catch (RegistryException e) {
            log.error("Error in setting message box storage path in tenant", e);
View Full Code Here

        // when creating subscriptions we going to add entries to this this resource
        try {
            UserRegistry userRegistry = Utils.getUserRegistry();

            //create the topic storage path if it does not exists
            if (!userRegistry.resourceExists(MessageBoxConstants.MB_QUEUE_STORAGE_PATH)) {
                userRegistry.put(MessageBoxConstants.MB_QUEUE_STORAGE_PATH, userRegistry.newCollection());
            }

        } catch (RegistryException e) {
            throw new MessageBoxException("Can not access the registry", e);
View Full Code Here

            String resourcePath = MessageBoxConstants.MB_QUEUE_STORAGE_PATH + "/" + queueName;
            String ownerName = CarbonContext.getCurrentContext().getUsername();

            //we add the queue only if it does not exits. if the topic exists then
            //we don't do any thing.
            if (!userRegistry.resourceExists(resourcePath)) {
                Collection collection = userRegistry.newCollection();
                collection.setProperty(MessageBoxConstants.MB_QUEUE_PROPERTY_CREATED_TIME,
                                       ConverterUtil.convertToString(Calendar.getInstance()));
                collection.setProperty(MessageBoxConstants.MB_QUEUE_PROPERTY_UPDATED_TIME,
                                       ConverterUtil.convertToString(Calendar.getInstance()));
View Full Code Here

    public void setQueueUpdatedTime(String queueName) throws MessageBoxException {
        try {
            UserRegistry userRegistry = Utils.getUserRegistry();
            String resourcePath = MessageBoxConstants.MB_QUEUE_STORAGE_PATH + "/" + queueName;

            if (userRegistry.resourceExists(resourcePath)) {
                Collection collection = (Collection) userRegistry.get(resourcePath);
                collection.removeProperty(MessageBoxConstants.MB_QUEUE_PROPERTY_UPDATED_TIME);
                collection.setProperty(MessageBoxConstants.MB_QUEUE_PROPERTY_UPDATED_TIME,
                                       ConverterUtil.convertToString(Calendar.getInstance()));
                userRegistry.put(resourcePath, collection);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.