Examples of UsageException


Examples of org.apache.stratos.usage.agent.exception.UsageException

        String hostName;

        try {
            hostName = NetworkUtils.getLocalHostname();
        } catch (SocketException e) {
            throw new UsageException("Error getting host name for the registry usage event payload",
                    e);
        }

        ConfigurationContextService configurationContextService = PublisherUtils.
                getConfigurationContextService();
        ConfigurationContext configurationContext;
        if (configurationContextService != null) {
            configurationContext = configurationContextService.getServerConfigContext();
        } else {
            throw new UsageException("ConfigurationContext is null");
        }
//        int port = CarbonUtils.getTransportPort(configurationContext, "https");

        String carbonHttpsPort = System.getProperty("carbon." + TRANSPORT + ".port");
        if (carbonHttpsPort == null) {
            carbonHttpsPort = Integer.toString(
                    CarbonUtils.getTransportPort(configurationContext, TRANSPORT));
        }
        String baseServerUrl = TRANSPORT + "://" + hostName + ":" + carbonHttpsPort;
        String context = configurationContext.getContextRoot();

        String tenantDomain = null;
        try {
            Tenant tenant = Util.getRealmService().getTenantManager().getTenant(tenantId);
            if(tenant!=null){
                tenantDomain = tenant.getDomain();
            }
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UsageException("Failed to get tenant domain", e);
        }

        if ((tenantDomain != null) &&
                !(tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME))) {
            serverName = baseServerUrl + context + "t/" + tenantDomain;
View Full Code Here

Examples of org.eclipse.jetty.start.UsageException

            }
                return;
        }

        // Anything else is unrecognized
        throw new UsageException(ERR_BAD_ARG,"Unrecognized argument: \"%s\" in %s",arg,source);
    }
View Full Code Here

Examples of org.wso2.carbon.usage.agent.exception.UsageException

            if (!(resource instanceof Collection)) {
                String msg =
                        "The records collection is not a registry collection. path: " +
                                measurementCollectionPath + ".";
                log.error(msg);
                throw new UsageException(msg);
            }
            durations = ((Collection) resource).getChildren();
        } catch (RegistryException e) {
            String msg =
                    "Error in checking the usage entry exists. measurement: " + measurement + ".";
            log.error(msg, e);
            throw new UsageException(msg, e);
        }
        return durations;
    }
View Full Code Here

Examples of org.wso2.carbon.usage.agent.exception.UsageException

            }
        } catch (RegistryException e) {
            String msg =
                    "Error in checking the usage entry exists. measurement: " + measurement + ".";
            log.error(msg, e);
            throw new UsageException(msg, e);
        }
        return false;
    }
View Full Code Here

Examples of org.wso2.carbon.usage.agent.exception.UsageException

        } catch (RegistryException e) {
            String msg =
                    "Error in persisting the usage. measurement: " +
                            measurement + ".";
            log.error(msg, e);
            throw new UsageException(msg, e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.usage.agent.exception.UsageException

        } catch (RegistryException e) {
            String msg =
                    "Error in retrieving the usage. measurement: " +
                            measurement + ".";
            log.error(msg, e);
            throw new UsageException(msg, e);
        }
        return usageValue;
    }
View Full Code Here

Examples of org.wso2.carbon.usage.agent.exception.UsageException

        } catch (RegistryException e) {
            String msg =
                    "Error in invoking the add usage. measurement: " +
                            measurement + ".";
            log.error(msg, e);
            throw new UsageException(msg, e);
        } finally {
            try {
                if (transactionSuccess) {
                    registry.commitTransaction();
                } else {
View Full Code Here

Examples of org.wso2.carbon.usage.agent.exception.UsageException

        String hostName;

        try {
            hostName = NetworkUtils.getLocalHostname();
        } catch (SocketException e) {
            throw new UsageException("Error getting host name for the registry usage event payload",
                    e);
        }

        ConfigurationContextService configurationContextService = PublisherUtils.
                getConfigurationContextService();
        ConfigurationContext configurationContext;
        if (configurationContextService != null) {
            configurationContext = configurationContextService.getServerConfigContext();
        } else {
            throw new UsageException("ConfigurationContext is null");
        }
//        int port = CarbonUtils.getTransportPort(configurationContext, "https");

        String carbonHttpsPort = System.getProperty("carbon." + TRANSPORT + ".port");
        if (carbonHttpsPort == null) {
            carbonHttpsPort = Integer.toString(
                    CarbonUtils.getTransportPort(configurationContext, TRANSPORT));
        }
        String baseServerUrl = TRANSPORT + "://" + hostName + ":" + carbonHttpsPort;
        String context = configurationContext.getContextRoot();

        String tenantDomain = null;
        try {
            tenantDomain = Util.getRealmService().getTenantManager().getTenant(tenantId).
                    getDomain();
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UsageException("Failed to get tenant domain", e);
        }

        if (tenantDomain != null) {

            serverName = baseServerUrl + context + "t/" + tenantDomain;
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.