Example usage for org.apache.maven.plugin.logging Log warn

List of usage examples for org.apache.maven.plugin.logging Log warn

Introduction

In this page you can find the example usage for org.apache.maven.plugin.logging Log warn.

Prototype

void warn(Throwable error);

Source Link

Document

Send an exception to the user in the warn error level.
The stack trace for this exception will be output when this error level is enabled.

Usage

From source file:de.tarent.maven.plugins.pkg.packager.IzPackDescriptor.java

License:Open Source License

void fillInfo(Log l, String appName, String appVersion, String url) {
    Node infoNode = doc.getElementsByTagName("info").item(0);

    if (!childExists(infoNode, "appname")) {
        l.info("setting <appname> to: " + appName);
        Node n = doc.createElement("appname");
        n.setTextContent(appName);//  ww  w .  j  av a 2 s  .  c om
        infoNode.appendChild(n);
    }

    if (!childExists(infoNode, "appversion")) {
        l.info("setting <appversion> to: " + appVersion);
        Node n = doc.createElement("appversion");
        n.setTextContent(appVersion);
        infoNode.appendChild(n);
    }

    if (!childExists(infoNode, "appsubpath")) {
        l.info("setting <appsubpath> to: " + appName);
        Node n = doc.createElement("appsubpath");
        n.setTextContent(appName);
        infoNode.appendChild(n);
    }

    if (!childExists(infoNode, "url")) {
        if (url == null) {
            l.warn("Neither the IzPack descriptor nor the POM contain a project URL!");
            return;
        }
        l.info("setting <url> to: " + url);
        Node n = doc.createElement("url");
        n.setTextContent(url);
        infoNode.appendChild(n);
    }
}

From source file:de.thetaphi.forbiddenapis.AbstractCheckMojo.java

License:Apache License

public void execute() throws MojoExecutionException, MojoFailureException {
    final Log log = getLog();

    if (skip) {/* w  ww  .  j  a v  a 2s .co  m*/
        log.info("Skipping forbidden-apis checks.");
        return;
    }

    // In multi-module projects, one may want to configure the plugin in the parent/root POM.
    // However, it should not be executed for this type of POMs.
    if ("pom".equals(packaging)) {
        log.info("Skipping execution for packaging \"" + packaging + "\"");
        return;
    }

    // set default param:
    if (includes == null)
        includes = new String[] { "**/*.class" };

    final URL[] urls;
    try {
        final List<String> cp = getClassPathElements();
        urls = new URL[cp.size()];
        int i = 0;
        for (final String cpElement : cp) {
            urls[i++] = new File(cpElement).toURI().toURL();
        }
        assert i == urls.length;
        if (log.isDebugEnabled())
            log.debug("Compile Classpath: " + Arrays.toString(urls));
    } catch (MalformedURLException e) {
        throw new MojoExecutionException("Failed to build classpath: " + e);
    }

    URLClassLoader urlLoader = null;
    final ClassLoader loader = (urls.length > 0)
            ? (urlLoader = URLClassLoader.newInstance(urls, ClassLoader.getSystemClassLoader()))
            : ClassLoader.getSystemClassLoader();

    try {
        final EnumSet<Checker.Option> options = EnumSet.noneOf(Checker.Option.class);
        if (internalRuntimeForbidden)
            options.add(INTERNAL_RUNTIME_FORBIDDEN);
        if (failOnMissingClasses)
            options.add(FAIL_ON_MISSING_CLASSES);
        if (failOnViolation)
            options.add(FAIL_ON_VIOLATION);
        if (failOnUnresolvableSignatures)
            options.add(FAIL_ON_UNRESOLVABLE_SIGNATURES);
        final Checker checker = new Checker(loader, options) {
            @Override
            protected void logError(String msg) {
                log.error(msg);
            }

            @Override
            protected void logWarn(String msg) {
                log.warn(msg);
            }

            @Override
            protected void logInfo(String msg) {
                log.info(msg);
            }
        };

        if (!checker.isSupportedJDK) {
            final String msg = String.format(Locale.ENGLISH,
                    "Your Java runtime (%s %s) is not supported by the forbiddenapis MOJO. Please run the checks with a supported JDK!",
                    System.getProperty("java.runtime.name"), System.getProperty("java.runtime.version"));
            if (failOnUnsupportedJava) {
                throw new MojoExecutionException(msg);
            } else {
                log.warn(msg);
                return;
            }
        }

        if (suppressAnnotations != null) {
            for (String a : suppressAnnotations) {
                checker.addSuppressAnnotation(a);
            }
        }

        log.info("Scanning for classes to check...");
        final File classesDirectory = getClassesDirectory();
        if (!classesDirectory.exists()) {
            log.warn("Classes directory does not exist, forbiddenapis check skipped: " + classesDirectory);
            return;
        }
        final DirectoryScanner ds = new DirectoryScanner();
        ds.setBasedir(classesDirectory);
        ds.setCaseSensitive(true);
        ds.setIncludes(includes);
        ds.setExcludes(excludes);
        ds.addDefaultExcludes();
        ds.scan();
        final String[] files = ds.getIncludedFiles();
        if (files.length == 0) {
            log.warn(String.format(Locale.ENGLISH,
                    "No classes found in '%s' (includes=%s, excludes=%s), forbiddenapis check skipped.",
                    classesDirectory.toString(), Arrays.toString(includes), Arrays.toString(excludes)));
            return;
        }

        try {
            final String sig = (signatures != null) ? signatures.trim() : null;
            if (sig != null && sig.length() != 0) {
                log.info("Reading inline API signatures...");
                checker.parseSignaturesString(sig);
            }
            if (bundledSignatures != null) {
                String targetVersion = getTargetVersion();
                if ("".equals(targetVersion))
                    targetVersion = null;
                if (targetVersion == null) {
                    log.warn("The 'targetVersion' parameter or '${maven.compiler.target}' property is missing. "
                            + "Trying to read bundled JDK signatures without compiler target. "
                            + "You have to explicitely specify the version in the resource name.");
                }
                for (String bs : bundledSignatures) {
                    log.info("Reading bundled API signatures: " + bs);
                    checker.parseBundledSignatures(bs, targetVersion);
                }
            }
            if (signaturesFiles != null)
                for (final File f : signaturesFiles) {
                    log.info("Reading API signatures: " + f);
                    checker.parseSignaturesFile(new FileInputStream(f));
                }
        } catch (IOException ioe) {
            throw new MojoExecutionException("IO problem while reading files with API signatures: " + ioe);
        } catch (ParseException pe) {
            throw new MojoExecutionException("Parsing signatures failed: " + pe.getMessage());
        }

        if (checker.hasNoSignatures()) {
            if (failOnUnresolvableSignatures) {
                throw new MojoExecutionException(
                        "No API signatures found; use parameters 'signatures', 'bundledSignatures', and/or 'signaturesFiles' to define those!");
            } else {
                log.info("Skipping execution because no API signatures are available.");
                return;
            }
        }

        log.info("Loading classes to check...");
        try {
            for (String f : files) {
                checker.addClassToCheck(new FileInputStream(new File(classesDirectory, f)));
            }
        } catch (IOException ioe) {
            throw new MojoExecutionException("Failed to load one of the given class files: " + ioe);
        }

        log.info("Scanning for API signatures and dependencies...");
        try {
            checker.run();
        } catch (ForbiddenApiException fae) {
            throw new MojoFailureException(fae.getMessage());
        }
    } finally {
        // Java 7 supports closing URLClassLoader, so check for Closeable interface:
        if (urlLoader instanceof Closeable)
            try {
                ((Closeable) urlLoader).close();
            } catch (IOException ioe) {
                // ignore
            }
    }
}

From source file:esa.mo.tools.stubgen.StubGenerator.java

License:Open Source License

private static void loadGenerators(final org.apache.maven.plugin.logging.Log logger) {
    if (!generatorsLoaded) {
        generatorsLoaded = true;//from   w  w  w. j a v a  2  s .  c  o  m

        final Reflections reflections = new Reflections(new ConfigurationBuilder()
                .setUrls(ClasspathHelper.forClassLoader()).setScanners(new SubTypesScanner()));

        final Set<Class<? extends Generator>> classes = reflections.getSubTypesOf(Generator.class);

        for (Class<? extends Generator> cls : classes) {
            final int mods = cls.getModifiers();
            if (!Modifier.isAbstract(mods)) {
                try {
                    final Generator g = (Generator) cls
                            .getConstructor(new Class[] { org.apache.maven.plugin.logging.Log.class })
                            .newInstance(new Object[] { logger });

                    GENERATOR_MAP.put(g.getShortName().toLowerCase(), g);
                } catch (Exception ex) {
                    logger.warn("Could not construct generator : " + cls.getName());
                }
            }
        }
    }
}

From source file:fr.husta.maven.plugin.ReleaseProjectVersionMojo.java

License:Apache License

@Override
public void execute() throws MojoExecutionException {
    issueManagement = project.getIssueManagement();
    Log tempLog = getLog();
    if (issueManagement != null) {
        tempLog.debug("IssueManagement -> system = " + issueManagement.getSystem());
        tempLog.debug("IssueManagement -> url = " + issueManagement.getUrl());

        final String ISSUE_MNGT_MANTIS = "Mantis";
        if (issueManagement.getSystem() != null
                && ISSUE_MNGT_MANTIS.equals(issueManagement.getSystem()) == false) {
            tempLog.warn("IssueManagement -> system should be set to '" + ISSUE_MNGT_MANTIS + "'.");
        }/*from  www  . j  ava 2s. c  o m*/
    }

    try {
        // connection to Mantis SOAP API
        MantisConnectPortType portType = MantisUtils.createConnector(getMantisSoapApiUrl());
        MantisConnector mantisConnector = new MantisConnector(portType);

        tempLog.debug("projectName = '" + projectName + "'");

        // find ProjectId from Name
        BigInteger projectId = mantisConnector.getProjectIdByName(login, password, projectName);

        tempLog.info("Project " + projectName + " has ID=" + projectId);

        String tempCurrentSnapshot = currentSnapshot;
        if (versionPrefix != null) {
            tempCurrentSnapshot = versionPrefix + "-" + tempCurrentSnapshot;
        }
        String tempReleaseVersion = releaseVersion;
        if (versionPrefix != null) {
            tempReleaseVersion = versionPrefix + "-" + tempReleaseVersion;
        }
        tempLog.info("Rename Version '" + tempCurrentSnapshot + "' to " + tempReleaseVersion);
        mantisConnector.renameVersion(tempLog, login, password, projectId, tempCurrentSnapshot,
                tempReleaseVersion);
        tempLog.info("Renamed Version '" + tempCurrentSnapshot + "' to " + tempReleaseVersion);
        // call to web service method
        String tempDevelopmentVersion = developmentVersion;
        if (versionPrefix != null) {
            tempDevelopmentVersion = versionPrefix + "-" + tempDevelopmentVersion;
        }
        tempLog.info("Create Version '" + tempDevelopmentVersion + "' in Mantis, releaseFlag=" + false);
        mantisConnector.addProjectVersion(login, password, projectId, tempDevelopmentVersion, false);
        tempLog.info("Version '" + tempDevelopmentVersion + "' created in Mantis, releaseFlag=" + false);

    } catch (ServiceException e) {
        tempLog.error(e.getMessage());
        throw new MojoExecutionException(e.getMessage(), e);
    } catch (RuntimeException e) {
        tempLog.error(e.getMessage());
        throw new MojoExecutionException(e.getMessage(), e);
    } catch (RemoteException e) {
        tempLog.error(e.getMessage());
        throw new MojoExecutionException(e.getMessage(), e);
    }

}

From source file:io.fabric8.maven.AbstractProfileMojo.java

License:Apache License

public static void combineProfileFilesToFolder(MavenProject reactorProject, File buildDir, Log log,
        String reactorProjectOutputPath) throws IOException {
    File basedir = reactorProject.getBasedir();
    if (!basedir.exists()) {
        log.warn("No basedir " + basedir.getAbsolutePath() + " for project + " + reactorProject);
        return;//w  w w  . j av a  2s. c o  m
    }
    File outDir = new File(basedir, reactorProjectOutputPath);
    if (!outDir.exists()) {
        log.warn("No profile output dir at: " + outDir.getAbsolutePath() + " for project + " + reactorProject
                + " so ignoring this project.");
        return;
    }
    log.info("Copying profiles from " + outDir.getAbsolutePath() + " into the output directory: " + buildDir);
    appendProfileConfigFiles(outDir, buildDir);
}

From source file:io.fabric8.maven.ZipMojo.java

License:Apache License

protected static void combineAppFilesToFolder(MavenProject reactorProject, File buildDir, Log log,
        String reactorProjectOutputPath) throws IOException {
    File basedir = reactorProject.getBasedir();
    if (!basedir.exists()) {
        log.warn("No basedir " + basedir.getAbsolutePath() + " for project + " + reactorProject);
        return;/*from ww w. jav  a2s . c om*/
    }
    File outDir = new File(basedir, reactorProjectOutputPath);
    if (!outDir.exists()) {
        log.warn("No app output dir at: " + outDir.getAbsolutePath() + " for project + " + reactorProject
                + " so ignoring this project.");
        return;
    }
    log.info("Copying apps from " + outDir.getAbsolutePath() + " into the output directory: " + buildDir);

    File[] files = outDir.listFiles();
    if (files != null) {
        for (File file : files) {
            if (file.isDirectory()) {
                appendAppConfigFiles(file, buildDir);
            }
        }
    }
}

From source file:io.siddhi.doc.gen.core.utils.DocumentationUtils.java

License:Open Source License

/**
 * Remove the snapshot version documentation files from docs/api directory
 *
 * @param mkdocsConfigFile           The mkdocs configuration file
 * @param documentationBaseDirectory The path of the base directory in which the documentation will be generated
 * @param logger                     The maven plugin logger
 *//*from  w  w w. j a  v  a2  s . c o m*/
public static void removeSnapshotAPIDocs(File mkdocsConfigFile, String documentationBaseDirectory, Log logger) {
    // Retrieving the documentation file names
    File apiDocsDirectory = new File(documentationBaseDirectory + File.separator + Constants.API_SUB_DIRECTORY);
    String[] documentationFileNames = apiDocsDirectory
            .list((directory, fileName) -> fileName.endsWith(Constants.MARKDOWN_FILE_EXTENSION));

    if (documentationFileNames != null) {
        // Removing snapshot files and creating a list of the files that are left out
        for (String documentationFileName : documentationFileNames) {
            if (documentationFileName
                    .endsWith(Constants.SNAPSHOT_VERSION_POSTFIX + Constants.MARKDOWN_FILE_EXTENSION)) {
                // Removing the snapshot documentation file
                File documentationFile = new File(
                        apiDocsDirectory.getAbsolutePath() + File.separator + documentationFileName);
                if (!documentationFile.delete()) {
                    logger.warn("Failed to delete SNAPSHOT documentation file "
                            + documentationFile.getAbsolutePath());
                }
            }
        }

    }
}

From source file:io.siddhi.doc.gen.core.utils.DocumentationUtils.java

License:Open Source License

/**
 * Deploy the mkdocs website on GitHub pages
 *
 * @param version       The version of the documentation
 * @param baseDirectory The base directory of the project
 * @param url           The SCM URL/*from w  w  w .  j a v a  2s  . c  om*/
 * @param scmUsername   The SCM username
 * @param scmPassword   The SCM password
 * @param logger        The maven logger
 */
public static void deployMkdocsOnGitHubPages(String version, File baseDirectory, String url, String scmUsername,
        String scmPassword, Log logger) {
    try {
        // Find initial branch name
        List<String> gitStatusOutput = getCommandOutput(
                new String[] { Constants.GIT_COMMAND, Constants.GIT_BRANCH_COMMAND }, logger);
        String initialBranch = null;
        for (String gitStatusOutputLine : gitStatusOutput) {
            if (gitStatusOutputLine.startsWith(Constants.GIT_BRANCH_COMMAND_OUTPUT_CURRENT_BRANCH_PREFIX)) {
                initialBranch = gitStatusOutputLine
                        .substring(Constants.GIT_BRANCH_COMMAND_OUTPUT_CURRENT_BRANCH_PREFIX.length());
            }
        }

        if (initialBranch != null) {
            // Stash changes
            executeCommand(new String[] { Constants.GIT_COMMAND, Constants.GIT_STASH_COMMAND }, logger);

            // Change to gh-pages branch. This will not do anything if a new branch was created in the last command.
            executeCommand(new String[] { Constants.GIT_COMMAND, Constants.GIT_CHECKOUT_COMMAND,
                    Constants.GIT_GH_PAGES_BRANCH }, logger);

            // Create branch if it does not exist. This will fail if the branch exists and will not do anything.
            executeCommand(
                    new String[] { Constants.GIT_COMMAND, Constants.GIT_CHECKOUT_COMMAND,
                            Constants.GIT_CHECKOUT_COMMAND_ORPHAN_ARGUMENT, Constants.GIT_GH_PAGES_BRANCH },
                    logger);

            executeCommand(new String[] { Constants.GIT_COMMAND, Constants.GIT_PULL_COMMAND,
                    Constants.GIT_REMOTE, Constants.GIT_GH_PAGES_BRANCH }, logger);

            // Getting the site that was built by mkdocs
            File siteDirectory = new File(Constants.MKDOCS_SITE_DIRECTORY);
            FileUtils.copyDirectory(siteDirectory, baseDirectory);
            String[] siteDirectoryContent = siteDirectory.list();

            // Pushing the site to GitHub (Assumes that site/ directory is ignored by git)
            if (siteDirectoryContent != null && siteDirectoryContent.length > 0) {
                List<String> gitAddCommand = new ArrayList<>();
                Collections.addAll(gitAddCommand, Constants.GIT_COMMAND, Constants.GIT_ADD_COMMAND);
                Collections.addAll(gitAddCommand, siteDirectoryContent);
                executeCommand(gitAddCommand.toArray(new String[gitAddCommand.size()]), logger);

                List<String> gitCommitCommand = new ArrayList<>();
                Collections.addAll(gitCommitCommand, Constants.GIT_COMMAND, Constants.GIT_COMMIT_COMMAND,
                        Constants.GIT_COMMIT_COMMAND_MESSAGE_ARGUMENT,
                        String.format(Constants.GIT_COMMIT_COMMAND_MESSAGE_FORMAT, version, version),
                        Constants.GIT_COMMIT_COMMAND_FILES_ARGUMENT);
                Collections.addAll(gitCommitCommand, siteDirectoryContent);
                executeCommand(gitCommitCommand.toArray(new String[gitCommitCommand.size()]), logger);

                if (scmUsername != null && scmPassword != null && url != null) {
                    // Using scm username and password env var values
                    String urlWithUsernameAndPassword = url.replaceFirst(Constants.GITHUB_URL,
                            Constants.GITHUB_URL_WITH_USERNAME_PASSWORD);
                    executeCommand(new String[] { Constants.GIT_COMMAND, Constants.GIT_PUSH_COMMAND,
                            String.format(urlWithUsernameAndPassword, scmUsername, scmPassword),
                            Constants.GIT_GH_PAGES_BRANCH }, logger);

                } else {
                    // Using git credential store
                    executeCommand(new String[] { Constants.GIT_COMMAND, Constants.GIT_PUSH_COMMAND,
                            Constants.GIT_REMOTE, Constants.GIT_GH_PAGES_BRANCH }, logger);
                }
            }

            // Changing back to initial branch
            executeCommand(
                    new String[] { Constants.GIT_COMMAND, Constants.GIT_CHECKOUT_COMMAND, initialBranch },
                    logger);
            executeCommand(new String[] { Constants.GIT_COMMAND, Constants.GIT_STASH_COMMAND,
                    Constants.GIT_STASH_POP_COMMAND }, logger);
        } else {
            logger.warn("Unable to parse git-status command and retrieve current git branch. "
                    + "Skipping deployment.");
        }
    } catch (Throwable t) {
        logger.warn("Failed to deploy the documentation on github pages.", t);
    }
}

From source file:io.siddhi.doc.gen.core.utils.DocumentationUtils.java

License:Open Source License

/**
 * Add an extension annotation in a file
 * This first checks if this is a class file and loads the class and adds the annotation if present
 *
 * @param file                  The file from which the extension metadata will be loaded
 * @param classesDirectoryPath  The absolute path to the classes directory in the target folder in the module
 * @param urlClassLoader        The url class loader which should be used for loading the classes
 * @param namespaceMetaDataList List of namespace meta data
 * @param logger                The maven logger
 *//*from  ww  w. j  a  v  a 2  s  .com*/
private static void addExtensionInFile(File file, String classesDirectoryPath, ClassLoader urlClassLoader,
        List<NamespaceMetaData> namespaceMetaDataList, Log logger) {
    String filePath = file.getAbsolutePath();
    if (filePath.endsWith(Constants.CLASS_FILE_EXTENSION)
            && filePath.length() > classesDirectoryPath.length()) {
        String relativePathToClass = filePath.substring((classesDirectoryPath + File.separator).length());

        try {
            // Loading class
            Class<?> extensionClass = Class
                    .forName(
                            relativePathToClass
                                    .substring(0,
                                            relativePathToClass.length()
                                                    - Constants.CLASS_FILE_EXTENSION.length())
                                    .replace(File.separator, "."),
                            false, urlClassLoader);

            // Generating metadata and adding the it to the list of relevant extensions
            addExtensionMetaDataIntoNamespaceList(namespaceMetaDataList, extensionClass, logger);
        } catch (Throwable ignored) {
            logger.warn("Ignoring the failed class loading from " + file.getAbsolutePath());
        }
    }
}

From source file:io.siddhi.doc.gen.core.utils.DocumentationUtils.java

License:Open Source License

/**
 * Generate extension meta data from the annotated data in the class
 *
 * @param namespaceList  The list of namespaces to which the new extension will be added
 * @param extensionClass Class from which meta data should be extracted from
 * @param logger         The maven plugin logger
 *///from ww  w . j  a  v  a  2 s  .  c  o m
private static void addExtensionMetaDataIntoNamespaceList(List<NamespaceMetaData> namespaceList,
        Class<?> extensionClass, Log logger) {
    Extension extensionAnnotation = extensionClass.getAnnotation(Extension.class);

    if (extensionAnnotation != null) { // Discarding extension classes without annotation
        ExtensionMetaData extensionMetaData = new ExtensionMetaData();

        // Finding extension type
        String extensionType = null;
        for (Map.Entry<ExtensionType, Class<?>> entry : ExtensionType.getSuperClassMap().entrySet()) {
            Class<?> superClass = entry.getValue();
            if (superClass.isAssignableFrom(extensionClass) && superClass != extensionClass) {
                extensionType = entry.getKey().getValue();
                break;
            }
        }

        // Discarding the extension if it belongs to an unknown type
        if (extensionType == null) {
            logger.warn("Discarding extension (belonging to an unknown extension type): "
                    + extensionClass.getCanonicalName());
            return;
        }

        extensionMetaData.setName(extensionAnnotation.name());
        extensionMetaData.setDescription(extensionAnnotation.description());

        // Adding query parameters
        ParameterMetaData[] parameters = new ParameterMetaData[extensionAnnotation.parameters().length];
        for (int i = 0; i < extensionAnnotation.parameters().length; i++) {
            Parameter parameterAnnotation = extensionAnnotation.parameters()[i];

            ParameterMetaData parameter = new ParameterMetaData();
            parameter.setName(parameterAnnotation.name());
            parameter.setType(Arrays.asList(parameterAnnotation.type()));
            parameter.setDescription(parameterAnnotation.description());
            parameter.setOptional(parameterAnnotation.optional());
            parameter.setDynamic(parameterAnnotation.dynamic());
            parameter.setDefaultValue(parameterAnnotation.defaultValue());
            parameters[i] = parameter;
        }
        extensionMetaData.setParameters(Arrays.asList(parameters));

        // Adding system parameters
        SystemParameterMetaData[] systemParameters = new SystemParameterMetaData[extensionAnnotation
                .systemParameter().length];
        for (int i = 0; i < extensionAnnotation.systemParameter().length; i++) {
            SystemParameter systemParameterAnnotation = extensionAnnotation.systemParameter()[i];

            SystemParameterMetaData systemParameter = new SystemParameterMetaData();
            systemParameter.setName(systemParameterAnnotation.name());
            systemParameter.setDescription(systemParameterAnnotation.description());
            systemParameter.setDefaultValue(systemParameterAnnotation.defaultValue());
            systemParameter
                    .setPossibleParameters(Arrays.asList(systemParameterAnnotation.possibleParameters()));
            systemParameters[i] = systemParameter;
        }
        extensionMetaData.setSystemParameters(Arrays.asList(systemParameters));

        // Adding return attributes
        ReturnAttributeMetaData[] returnAttributes = new ReturnAttributeMetaData[extensionAnnotation
                .returnAttributes().length];
        for (int i = 0; i < extensionAnnotation.returnAttributes().length; i++) {
            ReturnAttribute parameterAnnotation = extensionAnnotation.returnAttributes()[i];

            ReturnAttributeMetaData returnAttribute = new ReturnAttributeMetaData();
            returnAttribute.setName(parameterAnnotation.name());
            returnAttribute.setType(Arrays.asList(parameterAnnotation.type()));
            returnAttribute.setDescription(parameterAnnotation.description());
            returnAttributes[i] = returnAttribute;
        }
        extensionMetaData.setReturnAttributes(Arrays.asList(returnAttributes));

        // Adding examples
        ExampleMetaData[] examples = new ExampleMetaData[extensionAnnotation.examples().length];
        for (int i = 0; i < extensionAnnotation.examples().length; i++) {
            Example exampleAnnotation = extensionAnnotation.examples()[i];

            ExampleMetaData exampleMetaData = new ExampleMetaData();
            exampleMetaData.setSyntax(exampleAnnotation.syntax());
            exampleMetaData.setDescription(exampleAnnotation.description());
            examples[i] = exampleMetaData;
        }
        extensionMetaData.setExamples(Arrays.asList(examples));

        // Finding the namespace
        String namespaceName = extensionAnnotation.namespace();
        if (Objects.equals(namespaceName, "")) {
            namespaceName = Constants.CORE_NAMESPACE;
        }

        // Finding the relevant namespace in the namespace list
        NamespaceMetaData namespace = null;
        for (NamespaceMetaData existingNamespace : namespaceList) {
            if (Objects.equals(existingNamespace.getName(), namespaceName)) {
                namespace = existingNamespace;
                break;
            }
        }
        // Creating namespace if it doesn't exist
        if (namespace == null) {
            namespace = new NamespaceMetaData();
            namespace.setName(namespaceName);
            namespace.setExtensionMap(new TreeMap<>());
            namespaceList.add(namespace);
        }

        // Adding to the relevant extension metadata list in the namespace
        List<ExtensionMetaData> extensionMetaDataList = namespace.getExtensionMap()
                .computeIfAbsent(extensionType, k -> new ArrayList<>());

        extensionMetaDataList.add(extensionMetaData);
    }
}