Package org.apache.stratos.adc.mgt.exception

Examples of org.apache.stratos.adc.mgt.exception.PolicyException


        if (cartridgeType.equals(CartridgeConstants.MYSQL_CARTRIDGE_NAME)) {
         
          autoScalingPolicy = PolicyHolder.getInstance().getDefaultPolicy();
         
          if (autoScalingPolicy == null) {
            throw new PolicyException("Could not load default auto-scaling policy.");
          }
          if (log.isDebugEnabled()) {
          log.debug("Selected Policy: " + new Gson().toJson(autoScalingPolicy));
        }
         
            dataCartridge = new DataCartridge();
            mysqlPassword = generatePassword();
            dataCartridge.setPassword(mysqlPassword);
            dataCartridge.setDataCartridgeType(cartridgeType);
            dataCartridge.setUserName(CartridgeConstants.MYSQL_DEFAULT_USER);
            clusterDomain = getDynamicClusterDomain(cartridgeType, cartName, cartridgeInfo);

            registerService(cartridgeType,
                    clusterDomain,
                    clusterSubDomain,
                    createPayload(cartridgeInfo, cartName, autoScalingPolicy, repoURL, mysqlPassword, "localhost", payloadZipFileName, tenantId, tenantDomain),
                    "*",
                    cartName + "." + cartridgeInfo.getHostName(),
                    setRegisterServiceProperties(autoScalingPolicy, tenantId,cartName));
            deletePayloadFile(payloadZipFileName);
        } else {
         
      if (!new Boolean(System.getProperty(CartridgeConstants.FEATURE_INTERNAL_REPO_ENABLED))) {
        if (log.isDebugEnabled()) {
          log.debug("Internal repo feature is not enabled.");
        }

        if (repoURL == null || repoURL.trim().length() == 0) {
          throw new RepositoryRequiredException("External repository required for subscription");
        }
      }

      if (repoURL != null && repoURL.trim().length() > 0) {
        if (log.isDebugEnabled()) {
          log.debug("Repo URL entered: " + repoURL);
        }
        // Validate Remote Repository.
        validateRepository(repoURL, repoUsername, repoPassword, privateRepo,
            new Boolean(System.getProperty(CartridgeConstants.FEATURE_EXTERNAL_REPO_VAIDATION_ENABLED)));
      }

            try {
                repository = manageRepository(repoURL, repoUsername, repoPassword, cartName, cartridgeInfo, username,
                        tenantDomain);
            } catch (Exception e) {
                log.error(e.getMessage());
                throw new ADCException(e);
            }
         
            // TODO: Check logic here
            if (!cartridgeInfo.getMultiTenant()) {
             
            if (policy != null && policy.trim().length() > 0) {
              autoScalingPolicy = PolicyHolder.getInstance().getPolicy(policy);
            } else {
              autoScalingPolicy = PolicyHolder.getInstance().getDefaultPolicy();
            }
            if (autoScalingPolicy == null) {
              throw new PolicyException("Could not load auto-scaling policy.");
            }
            if (log.isDebugEnabled()) {
              log.debug("Selected Policy: " + new Gson().toJson(autoScalingPolicy));
            }

View Full Code Here

TOP

Related Classes of org.apache.stratos.adc.mgt.exception.PolicyException

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.