use of org.wso2.carbon.apimgt.common.analytics.exceptions.DataNotFoundException in project carbon-apimgt by wso2.
the class FaultyRequestDataCollector method getFaultyEvent.
private Event getFaultyEvent() throws DataNotFoundException {
long requestInTime = provider.getRequestTime();
String offsetDateTime = getTimeInISO(requestInTime);
Event event = new Event();
API api = provider.getApi();
Target target = new Target();
target.setTargetResponseCode(Constants.UNKNOWN_INT_VALUE);
MetaInfo metaInfo = provider.getMetaInfo();
event.setApi(api);
event.setTarget(target);
event.setProxyResponseCode(provider.getProxyResponseCode());
event.setRequestTimestamp(offsetDateTime);
event.setMetaInfo(metaInfo);
return event;
}
use of org.wso2.carbon.apimgt.common.analytics.exceptions.DataNotFoundException in project carbon-apimgt by wso2.
the class WebSocketAnalyticsDataProvider method getApplication.
@Override
public Application getApplication() throws DataNotFoundException {
AuthenticationContext authContext = getAuthenticationContext();
if (authContext == null) {
throw new DataNotFoundException("Error occurred when getting Application information");
}
Application application = new Application();
application.setApplicationId(authContext.getApplicationUUID());
application.setApplicationName(authContext.getApplicationName());
application.setApplicationOwner(authContext.getSubscriber());
application.setKeyType(authContext.getKeyType());
return application;
}
use of org.wso2.carbon.apimgt.common.analytics.exceptions.DataNotFoundException in project carbon-apimgt by wso2.
the class SynapseAnalyticsDataProvider method getOperation.
@Override
public Operation getOperation() throws DataNotFoundException {
String httpMethod = (String) messageContext.getProperty(APIMgtGatewayConstants.HTTP_METHOD);
String apiResourceTemplate = (String) messageContext.getProperty(APIConstants.API_ELECTED_RESOURCE);
Operation operation = new Operation();
operation.setApiMethod(httpMethod);
if (APIConstants.GRAPHQL_API.equalsIgnoreCase(getApi().getApiType())) {
String orderedOperations = sortGraphQLOperations(apiResourceTemplate);
operation.setApiResourceTemplate(orderedOperations);
} else {
operation.setApiResourceTemplate(apiResourceTemplate);
}
return operation;
}
use of org.wso2.carbon.apimgt.common.analytics.exceptions.DataNotFoundException in project carbon-apimgt by wso2.
the class SynapseAnalyticsDataProvider method getApi.
@Override
public API getApi() throws DataNotFoundException {
String apiContext = (String) messageContext.getProperty(RESTConstants.REST_API_CONTEXT);
String apiVersion = (String) messageContext.getProperty(RESTConstants.SYNAPSE_REST_API_VERSION);
String tenantDomain = MultitenantUtils.getTenantDomainFromRequestURL(apiContext);
if (tenantDomain == null) {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
SubscriptionDataStore store = SubscriptionDataHolder.getInstance().getTenantSubscriptionStore(tenantDomain);
org.wso2.carbon.apimgt.keymgt.model.entity.API apiObj = store.getApiByContextAndVersion(apiContext, apiVersion);
API api = new API();
if (apiObj == null) {
try {
apiObj = new SubscriptionDataLoaderImpl().getApi(apiContext, apiVersion);
} catch (DataLoadingException e) {
log.error("Error occurred when getting api.", e);
throw new DataNotFoundException("Error occurred when getting API information", e);
}
}
if (apiObj != null) {
api.setApiId(apiObj.getUuid());
api.setApiType(apiObj.getApiType());
api.setApiName(apiObj.getApiName());
api.setApiVersion(apiObj.getApiVersion());
api.setApiCreator(apiObj.getApiProvider());
api.setApiCreatorTenantDomain(MultitenantUtils.getTenantDomain(api.getApiCreator()));
}
return api;
}
use of org.wso2.carbon.apimgt.common.analytics.exceptions.DataNotFoundException in project carbon-apimgt by wso2.
the class AsyncAnalyticsDataProvider method getOperation.
@Override
public Operation getOperation() throws DataNotFoundException {
Operation operation = super.getOperation();
Object eventPrefix = messageContext.getProperty(ASYNC_MESSAGE_TYPE);
if (eventPrefix != null) {
operation.setApiResourceTemplate(eventPrefix.toString() + operation.getApiResourceTemplate());
}
return operation;
}
Aggregations