log.error(msg);
throw new ADCException(msg);
}
// check if this subscription requires Persistence Mapping, and its supported by the cartridge definition
Properties persistenceMappingProperties = null;
if (subscriptionData.getPersistanceContext() != null) {
persistenceMappingProperties = getPersistenceMappingProperties(subscriptionData.getPersistanceContext(), cartridgeInfo);
}
Properties serviceCartridgeSubscriptionProperties = null;
LBDataContext lbDataCtxt = null;
CartridgeSubscription lbCartridgeSubscription = null;
Properties lbCartridgeSubscriptionProperties = null;
String lbClusterId = null;
// get lb config reference
LoadbalancerConfig lbConfig = cartridgeInfo.getLbConfig();
if (lbConfig == null || lbConfig.getProperties() == null) {
// no LB ref
if (log.isDebugEnabled()) {
log.debug("This Service does not require a load balancer. " + "[Service Name] " +
subscriptionData.getCartridgeType());
}
} else {
// LB ref found, get relevant LB Context data
lbDataCtxt = CartridgeSubscriptionUtils.getLoadBalancerDataContext(subscriptionData.getTenantId(), subscriptionData.getCartridgeType(),
subscriptionData.getDeploymentPolicyName(), lbConfig);
// subscribe to LB
lbCartridgeSubscription = subscribeToLB (subscriptionData, lbDataCtxt, cartridgeInfo);
// determine the LB cluster id, if available
if (lbCartridgeSubscription != null) {
lbClusterId = lbCartridgeSubscription.getClusterDomain();
}
lbCartridgeSubscriptionProperties = new Properties();
if (lbDataCtxt.getLbProperperties() != null && !lbDataCtxt.getLbProperperties().isEmpty()) {
lbCartridgeSubscriptionProperties.setProperties(lbDataCtxt.getLbProperperties().toArray(new Property[0]));
}
}
// subscribe to relevant service cartridge
CartridgeSubscription serviceCartridgeSubscription = subscribe (subscriptionData, cartridgeInfo, lbClusterId);
serviceCartridgeSubscriptionProperties = new Properties();
// lb related properties
if ((lbDataCtxt != null && lbDataCtxt.getLoadBalancedServiceProperties() != null) && !lbDataCtxt.getLoadBalancedServiceProperties().isEmpty()) {
serviceCartridgeSubscriptionProperties.setProperties(lbDataCtxt.getLoadBalancedServiceProperties().toArray(new Property[0]));
}