use of org.wso2.carbon.apimgt.core.exception.APIMgtDAOException in project carbon-apimgt by wso2.
the class APIMgtAdminServiceImpl method updateApplicationPolicy.
@Override
public void updateApplicationPolicy(ApplicationPolicy policy) throws APIManagementException {
try {
policyDAO.updateApplicationPolicy(policy);
PolicyValidationData policyValidationData = new PolicyValidationData(policy.getUuid(), policy.getPolicyName(), false);
apiGateway.updatePolicy(policyValidationData);
} catch (APIMgtDAOException e) {
String errorMessage = "Couldn't update Application policy for uuid: " + policy.getUuid();
log.error(errorMessage, e);
throw new APIManagementException(errorMessage, e, e.getErrorHandler());
}
}
use of org.wso2.carbon.apimgt.core.exception.APIMgtDAOException in project carbon-apimgt by wso2.
the class APIMgtAdminServiceImpl method updateSubscriptionPolicy.
@Override
public void updateSubscriptionPolicy(SubscriptionPolicy policy) throws APIManagementException {
try {
policyDAO.updateSubscriptionPolicy(policy);
PolicyValidationData policyValidationData = new PolicyValidationData(policy.getUuid(), policy.getPolicyName(), policy.isStopOnQuotaReach());
apiGateway.updatePolicy(policyValidationData);
} catch (APIMgtDAOException e) {
String errorMessage = "Couldn't update Subscription policy for uuid: " + policy.getUuid();
log.error(errorMessage, e);
throw new APIManagementException(errorMessage, e, e.getErrorHandler());
}
}
use of org.wso2.carbon.apimgt.core.exception.APIMgtDAOException in project carbon-apimgt by wso2.
the class APIMgtAdminServiceImpl method deletePolicyByUuid.
@Override
public void deletePolicyByUuid(String uuid, PolicyLevel policyLevel) throws APIManagementException {
try {
policyDAO.deletePolicyByUuid(policyLevel, uuid);
PolicyValidationData policyValidationData = new PolicyValidationData(uuid, "", false);
apiGateway.deletePolicy(policyValidationData);
} catch (APIMgtDAOException e) {
String errorMessage = "Couldn't delete policy with id: " + uuid + ", level: " + policyLevel;
log.error(errorMessage, e);
throw new APIManagementException(errorMessage, e, e.getErrorHandler());
}
}
use of org.wso2.carbon.apimgt.core.exception.APIMgtDAOException in project carbon-apimgt by wso2.
the class APIMgtAdminServiceImpl method addSubscriptionPolicy.
@Override
public String addSubscriptionPolicy(SubscriptionPolicy policy) throws APIManagementException {
try {
String policyUuid = policy.getUuid();
if (policyUuid == null) {
if (log.isDebugEnabled()) {
log.debug("Policy id is null, hence generating a new UUID for the policy with name: " + policy.getPolicyName());
}
policyUuid = UUID.randomUUID().toString();
policy.setUuid(policyUuid);
}
policyDAO.addSubscriptionPolicy(policy);
PolicyValidationData policyValidationData = new PolicyValidationData(policyUuid, policy.getPolicyName(), policy.isStopOnQuotaReach());
apiGateway.addPolicy(policyValidationData);
return policyUuid;
} catch (APIMgtDAOException e) {
String errorMessage = "Couldn't add Subscription policy for uuid: " + policy.getUuid();
log.error(errorMessage, e);
throw new APIManagementException(errorMessage, e, e.getErrorHandler());
}
}
use of org.wso2.carbon.apimgt.core.exception.APIMgtDAOException in project carbon-apimgt by wso2.
the class ServiceDiscovererKubernetes method initImpl.
/**
* Initializes OpenShiftClient (extended KubernetesClient) and sets the necessary parameters
*
* @param implParameters implementation parameters added by the super class #initImpl(java.util.Map) method
* @throws ServiceDiscoveryException if an error occurs while initializing the client
*/
@Override
public void initImpl(Map<String, String> implParameters) throws ServiceDiscoveryException {
try {
setClient(new DefaultOpenShiftClient(buildConfig(implParameters)));
} catch (KubernetesClientException | APIMgtDAOException e) {
String msg = "Error occurred while creating Kubernetes client";
throw new ServiceDiscoveryException(msg, e, ExceptionCodes.ERROR_INITIALIZING_SERVICE_DISCOVERY);
} catch (ArrayIndexOutOfBoundsException e) {
String msg = "Error occurred while reading filtering criteria from the configuration";
throw new ServiceDiscoveryException(msg, e, ExceptionCodes.ERROR_INITIALIZING_SERVICE_DISCOVERY);
}
includeClusterIP = Boolean.parseBoolean(implParameters.get(INCLUDE_CLUSTER_IPS));
includeExternalNameTypeServices = Boolean.parseBoolean(implParameters.get(INCLUDE_EXTERNAL_NAME_SERVICES));
}
Aggregations