use of org.wso2.carbon.apimgt.core.api.LabelExtractor in project carbon-apimgt by wso2.
the class APIStoreImpl method getLabelInfo.
@Override
public List<Label> getLabelInfo(List<String> labels, String username) throws LabelException {
List<Label> filteredLabels;
String labelExtractorClassName = getConfig().getLabelExtractorImplClass();
try {
List<Label> availableLabels = getLabelDAO().getLabelsByName(labels);
LabelExtractor labelExtractor = (LabelExtractor) Class.forName(labelExtractorClassName).newInstance();
filteredLabels = labelExtractor.filterLabels(username, availableLabels);
} catch (APIMgtDAOException e) {
String errorMsg = "Error occurred while retrieving label information";
log.error(errorMsg, e);
throw new LabelException(errorMsg, e, ExceptionCodes.LABEL_EXCEPTION);
} catch (ClassNotFoundException e) {
String errorMsg = "Error occurred while loading the class [class name] " + labelExtractorClassName;
log.error(errorMsg, e);
throw new LabelException(errorMsg, e, ExceptionCodes.LABEL_EXCEPTION);
} catch (IllegalAccessException | InstantiationException e) {
String errorMsg = "Error occurred while creating an instance of the class [class name] " + labelExtractorClassName;
log.error(errorMsg, e);
throw new LabelException(errorMsg, e, ExceptionCodes.LABEL_EXCEPTION);
}
return filteredLabels;
}
Aggregations