Package org.apache.stratos.manager.exception

Examples of org.apache.stratos.manager.exception.ADCException


        String clusterId = null;
    try {
      clusterId = AutoscalerServiceClient.getServiceClient().getDefaultLBClusterId(getDeploymentPolicyName());
    } catch (Exception e) {     
      log.error("Error occurred in retrieving default LB cluster id" + e.getMessage());
      throw new ADCException(e);
    }

        if (clusterId != null) {
            //set the cluster id to Cluster object
          cluster.setClusterDomain(clusterId);
            if (log.isDebugEnabled()) {
                log.debug("Set existing default LB cluster id " + clusterId);
            }
            defaultLBExists = true;

            //get the hostname for this cluster and set it
            ClusterContext clusterContext;
            try {
                clusterContext = CloudControllerServiceClient.getServiceClient().getClusterContext(clusterId);

            } catch (RemoteException e) {
                log.error("Error occurred in retrieving Cluster Context for default LB ", e);
                throw new ADCException(e);
            }

            if (clusterContext != null) {
                cluster.setHostName(clusterContext.getHostName());
                if (log.isDebugEnabled()) {
View Full Code Here


        try {
            clusterId = AutoscalerServiceClient.getServiceClient().getServiceLBClusterId(getLoadBalancedServiceType(), getDeploymentPolicyName());

        } catch (Exception e) {
            log.error("Error occurred in retrieving Service LB cluster id" + e.getMessage());
            throw new ADCException(e);
        }

        if (clusterId != null) {

            //set the cluster id to Cluster object
            cluster.setClusterDomain(clusterId);
            if (log.isDebugEnabled()) {
                log.debug("Set existing Service LB cluster id " + clusterId);
            }
            serviceLbExists = true;

            //get the hostname for this cluster and set it
            ClusterContext clusterContext;
            try {
                clusterContext = CloudControllerServiceClient.getServiceClient().getClusterContext(clusterId);

            } catch (RemoteException e) {
                log.error("Error occurred in retrieving Cluster Context for Service LB ", e);
                throw new ADCException(e);
            }

            if (clusterContext != null) {
                cluster.setHostName(clusterContext.getHostName());
                if (log.isDebugEnabled()) {
View Full Code Here

    try {
      repository = repoCreator.createInternalRepository();
    } catch (Exception e) {
      String msg = "Error occurred in creating internal repository. ";
      log.error( msg + e.getMessage());
      throw new ADCException(msg);
    }
    return repository;
       
  }
View Full Code Here

                cartridgeSubscription = new FrameworkCartridgeSubscription(cartridgeInfo, subscriptionTenancyBehaviour);
            }
        }

        if(cartridgeSubscription == null) {
            throw new ADCException("Unable to create a CartridgeSubscription subscription for " + cartridgeInfo);
        }

        return cartridgeSubscription;
    }
View Full Code Here

    public static CartridgeSubscription getLBCartridgeSubscriptionInstance (LBDataContext lbDataContext, LoadBalancerCategory loadBalancerCategory)
            throws ADCException {

        if (!lbDataContext.getLbCartridgeInfo().getProvider().equals("loadbalancer") && !lbDataContext.getLbCartridgeInfo().getProvider().equals("lb")) {
            throw new ADCException("LB cartridge provider should be either lb or loadbalancer");
        }

        return new LBCartridgeSubscription(lbDataContext.getLbCartridgeInfo(), null, loadBalancerCategory);
    }
View Full Code Here

            String msg = "Exception is occurred in register service operation. Reason :" + e.getMessage();
            log.error(msg, e);
            throw new UnregisteredCartridgeException("Not a registered cartridge " + cartridgeType, cartridgeType, e);
        } catch (RemoteException e) {
          log.error("Remote Error", e);
          throw new ADCException("An error occurred in subscribing process", e);
        }
    }
View Full Code Here

        try {
            isAliasTaken = isAliasTaken(tenantId, alias);
        } catch (Exception e) {
            String msg = "Exception : " + e.getMessage();
            log.error(msg, e);
            throw new ADCException("Error when checking alias is already taken", e);
        }

        if (isAliasTaken) {
            String msg = "The alias " + alias + " is already taken. Please try again with a different alias.";
            log.error(msg);
View Full Code Here

                        lbCartridgeInfo = CloudControllerServiceClient.getServiceClient().getCartridgeInfo(lbCartridgeType);

                    } catch (Exception e) {
                        String message = "Error getting info for " + lbCartridgeType;
                        log.error(message, e);
                        throw new ADCException(message, e);
                    }

                    if (lbCartridgeInfo == null) {
                        String msg = "Please specify a LB cartridge type for the cartridge: " + serviceType + " as category: " +
                            Constants.DEFAULT_LOAD_BALANCER;
                        log.error(msg);
                        throw new ADCException(msg);
                    }

                    lbDataCtxt.setLbCartridgeInfo(lbCartridgeInfo);

                    if (log.isDebugEnabled()) {
                        log.debug("This cartridge uses default load balancer. " + "[Type] " + serviceType);
                    }

                    try {
                        // get the valid policies for lb cartridge
                        DeploymentPolicy[] lbCartridgeDepPolicies =
                                getAutoscalerServiceClient().getDeploymentPolicies(lbCartridgeType);
                        // traverse deployment policies of lb cartridge
                        for (DeploymentPolicy policy : lbCartridgeDepPolicies) {

                            // check existence of the subscribed policy
                            if (deploymentPolicyName.equals(policy.getId())) {

                                if (!getAutoscalerServiceClient().checkDefaultLBExistenceAgainstPolicy(deploymentPolicyName)) {
                                  if(log.isDebugEnabled()){
                                    log.debug(" Default LB doesn't exist for deployment policy ["+deploymentPolicyName+"] ");
                                  }

                                    Properties lbProperties = new Properties();

                                    // if LB cartridge definition has properties as well, combine
                                    if (lbCartridgeInfo.getProperties() != null && lbCartridgeInfo.getProperties().length > 0) {
                                      if(log.isDebugEnabled()){
                                        log.debug(" Combining LB properties ");
                                      }
                                        lbProperties.setProperties(combine(lbCartridgeInfo.getProperties(), new Property[]{lbRefProperty}));
                                    } else {
                                        lbProperties.setProperties(new Property[]{lbRefProperty});
                                    }

                                    lbDataCtxt.addLBProperties(lbProperties);
                                }
                            }
                        }

                    } catch (Exception ex) {
                        // we don't need to throw the error here.
                        log.error(ex.getMessage(), ex);
                    }

                    // set deployment and autoscaling policies
                    lbDataCtxt.setDeploymentPolicy(deploymentPolicyName);
                    lbDataCtxt.setAutoscalePolicy(lbCartridgeInfo.getDefaultAutoscalingPolicy());

                    lbDataCtxt.addLoadBalancedServiceProperty(lbRefProperty);
                    break;
                }

            } else if (Constants.SERVICE_AWARE_LOAD_BALANCER.equals(name)) {

                if ("true".equals(value)) {

                    lbDataCtxt.setLbCategory(Constants.SERVICE_AWARE_LOAD_BALANCER);

                    lbRefProperty.setValue(name);

                    CartridgeInfo lbCartridgeInfo;

                    try {
                        lbCartridgeInfo = CloudControllerServiceClient.getServiceClient().getCartridgeInfo(lbCartridgeType);

                    } catch (Exception e) {
                        String message = "Error getting info for " + lbCartridgeType;
                        log.error(message, e);
                        throw new ADCException(message, e);
                    }

                    if (lbCartridgeInfo == null) {
                        String msg = "Please specify a LB cartridge type for the cartridge: " + serviceType + " as category: " +
                                Constants.SERVICE_AWARE_LOAD_BALANCER;
                        log.error(msg);
                        throw new ADCException(msg);
                    }

                    lbDataCtxt.setLbCartridgeInfo(lbCartridgeInfo);

                    // add a property for the service type
View Full Code Here

            return AutoscalerServiceClient.getServiceClient();

        } catch (AxisFault axisFault) {
            String errorMsg = "Error in getting AutoscalerServiceClient instance";
            log.error(errorMsg, axisFault);
            throw new ADCException (errorMsg, axisFault);
        }
    }
View Full Code Here

        } else {
            payloadData = new FramewrokCartridgePayloadData(basicPayloadData);
        }

        if(payloadData == null) {
            throw new ADCException("Unable to find matching payload for cartridge type " + cartridgeType +
                    ", provider " + cartridgeProvider);
        }

        return payloadData;
    }
View Full Code Here

TOP

Related Classes of org.apache.stratos.manager.exception.ADCException

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.