use of org.wso2.carbon.apimgt.impl.monetization.DefaultMonetizationImpl in project carbon-apimgt by wso2.
the class APIAdminImpl method getMonetizationImplClass.
/**
* These methods load the monetization implementation class
*
* @return monetization implementation class
* @throws APIManagementException if failed to load monetization implementation class
*/
public Monetization getMonetizationImplClass() throws APIManagementException {
APIManagerConfiguration configuration = org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration();
Monetization monetizationImpl = null;
if (configuration == null) {
log.error("API Manager configuration is not initialized.");
} else {
String monetizationImplClass = configuration.getFirstProperty(APIConstants.Monetization.MONETIZATION_IMPL);
if (monetizationImplClass == null) {
monetizationImpl = new DefaultMonetizationImpl();
} else {
try {
monetizationImpl = (Monetization) APIUtil.getClassInstance(monetizationImplClass);
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
APIUtil.handleException("Failed to load monetization implementation class.", e);
}
}
}
return monetizationImpl;
}
use of org.wso2.carbon.apimgt.impl.monetization.DefaultMonetizationImpl in project carbon-apimgt by wso2.
the class APIProviderImpl method getMonetizationImplClass.
/**
* This methods loads the monetization implementation class
*
* @return monetization implementation class
* @throws APIManagementException if failed to load monetization implementation class
*/
public Monetization getMonetizationImplClass() throws APIManagementException {
APIManagerConfiguration configuration = org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration();
Monetization monetizationImpl = null;
if (configuration == null) {
log.error("API Manager configuration is not initialized.");
} else {
String monetizationImplClass = configuration.getFirstProperty(APIConstants.Monetization.MONETIZATION_IMPL);
if (monetizationImplClass == null) {
monetizationImpl = new DefaultMonetizationImpl();
} else {
try {
monetizationImpl = (Monetization) APIUtil.getClassInstance(monetizationImplClass);
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
APIUtil.handleException("Failed to load monetization implementation class.", e);
}
}
}
return monetizationImpl;
}
use of org.wso2.carbon.apimgt.impl.monetization.DefaultMonetizationImpl in project carbon-apimgt by wso2.
the class APIConsumerImpl method getMonetizationImplClass.
/**
* This methods loads the monetization implementation class
*
* @return monetization implementation class
* @throws APIManagementException if failed to load monetization implementation class
*/
public Monetization getMonetizationImplClass() throws APIManagementException {
APIManagerConfiguration configuration = getAPIManagerConfiguration();
Monetization monetizationImpl = null;
if (configuration == null) {
log.error("API Manager configuration is not initialized.");
} else {
String monetizationImplClass = configuration.getFirstProperty(APIConstants.Monetization.MONETIZATION_IMPL);
if (monetizationImplClass == null) {
monetizationImpl = new DefaultMonetizationImpl();
} else {
try {
monetizationImpl = (Monetization) APIUtil.getClassInstance(monetizationImplClass);
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
APIUtil.handleException("Failed to load monetization implementation class.", e);
}
}
}
return monetizationImpl;
}
Aggregations