/** * Update an oAuth application owner * * @param appInfoDTO accept an appinfoDTO object * @return OAuthApplicationInfo this object will contain all the properties of updated oAuth application */ default OAuthApplicationInfo updateApplicationOwner(OAuthAppRequest appInfoDTO, String owner) throws APIManagementException { throw new APIManagementException("This is not supported"); }
private void handleException(String msg, Throwable t) throws APIManagementException { log.error(msg, t); throw new APIManagementException(msg, t); }
public APIIdentifier(String apiId) throws APIManagementException { //eg: apiId = "P1_API1_v1.0.0" String[] split = apiId.split("_"); if (split.length == 3) { this.providerName = split[0]; this.apiName = split[1]; this.version = split[2]; } else { throw new APIManagementException("Invalid API ID : " + apiId); } }
/** * logs the error message and throws an exception * * @param message Error message * @param throwable * @throws APIManagementException */ private static void handleException(String message, Throwable throwable) throws APIManagementException { log.error(message, throwable); throw new APIManagementException(throwable); }
/** * common method to throw exceptions. * * @param msg this parameter contain error message that we need to throw. * @param e Exception object. * @throws org.wso2.carbon.apimgt.api.APIManagementException */ private void handleException(String msg, Exception e) throws APIManagementException { log.error(msg, e); throw new APIManagementException(msg, e); }
private static void handleException(String msg, Throwable t) throws APIManagementException { log.error(msg, t); throw new APIManagementException(msg, t); }
/** * encrypt the plain text password * * @param cipher * init cipher * @param plainTextPass * plain text password * @return encrypted password * @throws APIManagementException */ public String doEncryption(String plainTextPass) throws APIManagementException { String encodedValue = null; try { encodedValue = mediationSecurityAdminServiceStub.doEncrypt(plainTextPass); // encodedValue = CryptoUtil.getDefaultCryptoUtil() // .encryptAndBase64Encode(plainTextPass.getBytes()); //why ESB can not use this? } catch (Exception e) { String msg = "Failed to encrypt the secured endpoint password, " + e.getMessage(); throw new APIManagementException(msg, e); } return encodedValue; }
String error = "Signature algorithm not found."; throw new APIManagementException(error, e); } catch (InvalidKeyException e) { String error = "Invalid private key provided for the signature"; throw new APIManagementException(error, e); } catch (SignatureException e) { String error = "Error in signature"; throw new APIManagementException(error, e); } catch (RegistryException e) { String error = "Error in loading tenant registry for " + tenantDomain; throw new APIManagementException(error, e);
} else { String error = "Error in obtaining tenant's keystore"; throw new APIManagementException(error); throw new APIManagementException(error, e); } catch (CertificateEncodingException e) { String error = "Error in generating public cert thumbprint"; throw new APIManagementException(error, e); } catch (NoSuchAlgorithmException e) { String error = "Error in generating public cert thumbprint"; throw new APIManagementException(error, e); } catch (Exception e) { String error = "Error in obtaining tenant's keystore"; throw new APIManagementException(error, e);
/** * This method will publish event for alert types configurations. * @param alertTypeDTO DTO object. * @throws APIManagementException */ @Override public void publishEvent(AlertTypeDTO alertTypeDTO) throws APIManagementException { DataBridgeAlertTypesPublisherDTO dataBridgeAlertTypesPublisherDTO = new DataBridgeAlertTypesPublisherDTO(alertTypeDTO); try { String streamID = DataPublisherUtil.getApiManagerAnalyticsConfiguration().getAlertTypeStreamName() + ":" + DataPublisherUtil.getApiManagerAnalyticsConfiguration().getAlertTypeStreamVersion(); dataPublisher.tryPublish(streamID,System.currentTimeMillis(), null, null, (Object[]) dataBridgeAlertTypesPublisherDTO.createPayload()); } catch (Exception e) { log.error("Error while publishing alert types events.", e); throw new APIManagementException("Error while publishing alert types events"); } }
baseUserNameWithTenant; log.error(errorMessage); throw new APIManagementException(errorMessage); appName + " owned by=" + appOwner + " in tenant domain=" + appOwnerTenantDomain; log.error(errorMessage); throw new APIManagementException(errorMessage); appOwner + " by logged in user=" + baseUserNameWithTenant; log.error(errorMessage); throw new APIManagementException(errorMessage, e); } catch (UserStoreException e) { String errorMessage = "Error while authenticating the logged in user=" + baseUserNameWithTenant + " while revoking token for user=" + userName + " app=" + appName + " owned by=" + appOwner; log.error(errorMessage, e); throw new APIManagementException(errorMessage, e);
/** * This returns API object for given APIIdentifier. Reads from registry entry for given APIIdentifier * creates API object * * @param identifier APIIdentifier object for the API * @return API object for given identifier * @throws APIManagementException on error in getting API artifact */ public static API getAPI(APIIdentifier identifier) throws APIManagementException { String apiPath = APIUtil.getAPIPath(identifier); try { Registry registry = APIKeyMgtDataHolder.getRegistryService().getGovernanceSystemRegistry(); GenericArtifactManager artifactManager = APIUtil.getArtifactManager(registry, APIConstants.API_KEY); if (artifactManager == null) { String errorMessage = "Artifact manager is null when retrieving API " + identifier.getApiName(); log.error(errorMessage); throw new APIManagementException(errorMessage); } Resource apiResource = registry.get(apiPath); String artifactId = apiResource.getUUID(); if (artifactId == null) { throw new APIManagementException("artifact id is null for : " + apiPath); } GenericArtifact apiArtifact = artifactManager.getGenericArtifact(artifactId); return APIUtil.getAPI(apiArtifact, registry); } catch (RegistryException e) { return null; } }
throw new APIManagementException("Data publisher is not enabled");
/** * Get the config system registry for tenants * * @param tenantDomain - The tenant domain * @return - A UserRegistry instance for the tenant * @throws APIManagementException */ public static UserRegistry getRegistry(String tenantDomain) throws APIManagementException { PrivilegedCarbonContext.startTenantFlow(); if (tenantDomain != null && StringUtils.isNotEmpty(tenantDomain)) { PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); } else { PrivilegedCarbonContext.getThreadLocalCarbonContext() .setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, true); } int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); UserRegistry registry; try { registry = RegistryServiceHolder.getInstance().getRegistryService().getConfigSystemRegistry(tenantId); } catch (RegistryException e) { String msg = "Failed to get registry instance for the tenant : " + tenantDomain + e.getMessage(); throw new APIManagementException(msg, e); } finally { PrivilegedCarbonContext.endTenantFlow(); } return registry; }
throw new APIManagementException("Data publisher is not enabled");
throw new APIManagementException("Data publisher is not enabled");
throw new APIManagementException("Error while reading registry resource " + path + " for tenant " + tenantDomain); } finally {
throw new APIManagementException("Data publisher is not enabled");
resource.discard(); } catch (RegistryException e) { throw new APIManagementException("Error while reading registry resource " + path + " for tenant " + tenantDomain); } finally {