Search in sources :

Example 1 with ApiErrorCode

use of com.emc.apidocs.model.ApiErrorCode in project coprhd-controller by CoprHD.

the class ApiDoclet method start.

/**
 * MAIN Entry Point into the Doclet
 */
public static boolean start(RootDoc root) {
    KnownPaths.init(contentDirectory, outputDirectory);
    init();
    loadServiceBlackList();
    loadMethodBlackList();
    List<ApiService> apiServices = findApiServices(root.classes());
    List<ApiErrorCode> errorCodes = findErrorCodes(root.classes());
    cleanupMethods(apiServices);
    saveMetaData(apiServices);
    ApiDifferences apiDifferences = calculateDifferences(apiServices);
    generateFiles(apiDifferences, apiServices, errorCodes);
    return true;
}
Also used : ApiService(com.emc.apidocs.model.ApiService) ApiDifferences(com.emc.apidocs.model.ApiDifferences) ApiErrorCode(com.emc.apidocs.model.ApiErrorCode)

Example 2 with ApiErrorCode

use of com.emc.apidocs.model.ApiErrorCode in project coprhd-controller by CoprHD.

the class ApiDoclet method findErrorCodes.

private static synchronized List<ApiErrorCode> findErrorCodes(ClassDoc[] classes) {
    // Find ServiceCode Class
    ClassDoc serviceCodeClass = null;
    for (ClassDoc classDoc : classes) {
        if (classDoc.qualifiedName().equals(ServiceCode.class.getCanonicalName())) {
            serviceCodeClass = classDoc;
            break;
        }
    }
    if (serviceCodeClass == null) {
        throw new RuntimeException("Unable to find ServiceCode Class");
    }
    // Extract ServiceCode information
    List<ApiErrorCode> errorCodes = Lists.newArrayList();
    for (FieldDoc field : serviceCodeClass.enumConstants()) {
        ApiErrorCode errorCode = new ApiErrorCode(ServiceCode.valueOf(field.name()));
        if (AnnotationUtils.hasAnnotation(field, KnownAnnotations.Deprecated_Annotation)) {
            errorCode.setDeprecated(true);
        }
        errorCodes.add(errorCode);
    }
    Collections.sort(errorCodes, new Comparator<ApiErrorCode>() {

        @Override
        public int compare(ApiErrorCode o1, ApiErrorCode o2) {
            return Integer.valueOf(o1.getCode()).compareTo(o2.getCode());
        }
    });
    return errorCodes;
}
Also used : ServiceCode(com.emc.storageos.svcs.errorhandling.resources.ServiceCode) ApiErrorCode(com.emc.apidocs.model.ApiErrorCode)

Aggregations

ApiErrorCode (com.emc.apidocs.model.ApiErrorCode)2 ApiDifferences (com.emc.apidocs.model.ApiDifferences)1 ApiService (com.emc.apidocs.model.ApiService)1 ServiceCode (com.emc.storageos.svcs.errorhandling.resources.ServiceCode)1