elharo commented on code in PR #97: URL: https://github.com/apache/maven-project-info-reports-plugin/pull/97#discussion_r1962473942
########## src/main/java/org/apache/maven/report/projectinfo/avatars/AvatarsProvider.java: ########## @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.report.projectinfo.avatars; + +import java.io.File; +import java.io.IOException; + +/** + * Avatar provider API. + */ +public interface AvatarsProvider { + + /** + * Set a base url for provider + * + * @param baseUrl for provider + */ + void setBaserUrl(String baseUrl); + + /** + * Set site output directory. Used to store avatar images in project. + * + * @param outputDirectory a site output directory + */ + void setOutputDirectory(File outputDirectory); + + /** + * Return an external url for gravatar image. Review Comment: URL ########## src/main/java/org/apache/maven/report/projectinfo/avatars/AvatarsProvider.java: ########## @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.report.projectinfo.avatars; + +import java.io.File; +import java.io.IOException; + +/** + * Avatar provider API. + */ +public interface AvatarsProvider { + + /** + * Set a base url for provider + * + * @param baseUrl for provider + */ + void setBaserUrl(String baseUrl); Review Comment: setBaseUrl, not setBaserUrl ########## src/main/java/org/apache/maven/report/projectinfo/TeamReport.java: ########## @@ -52,19 +53,50 @@ public class TeamReport extends AbstractProjectInfoReport { /** * Shows avatar images for team members that have a) properties/picUrl set b) An avatar at gravatar.com for their * email address - * <p/> - * Future versions of this plugin may implement different strategies for resolving avatar images, possibly - * using different providers. - *<p> - *<strong>Note</strong>: This property will be renamed to {@code tteam.showAvatarImages} in 3.0. + * * @since 2.6 */ @Parameter(property = "teamlist.showAvatarImages", defaultValue = "true") private boolean showAvatarImages; + /** + * Indicate if external url should be used for avatar images. + * <p> + * If set to <code>true</code> images will be downloaded and attached to report during build. + * + * @since 3.9.0 + */ + @Parameter(property = "teamlist.externalAvatarImages", defaultValue = "true") + private boolean externalAvatarImages; + + /** + * Base url for avatar provider. Review Comment: URL ########## src/main/java/org/apache/maven/report/projectinfo/TeamReport.java: ########## @@ -288,32 +334,13 @@ private void renderTeamMember(Contributor member, Map<String, Boolean> headersMa sink.tableRow_(); } - private static final String AVATAR_SIZE = "s=60"; - - private String getSpacerGravatarUrl() { - return protocol + "://www.gravatar.com/avatar/00000000000000000000000000000000?d=blank&f=y&" + AVATAR_SIZE; - } - - private String getGravatarUrl(String email) { - if (email == null) { - return null; - } - email = StringUtils.trim(email); - email = email.toLowerCase(); - MessageDigest md; + private String getExternalAvatarUrl(String email) { Review Comment: This should just throw IOException ########## src/main/java/org/apache/maven/report/projectinfo/TeamReport.java: ########## @@ -52,19 +53,50 @@ public class TeamReport extends AbstractProjectInfoReport { /** * Shows avatar images for team members that have a) properties/picUrl set b) An avatar at gravatar.com for their * email address - * <p/> - * Future versions of this plugin may implement different strategies for resolving avatar images, possibly - * using different providers. - *<p> - *<strong>Note</strong>: This property will be renamed to {@code tteam.showAvatarImages} in 3.0. + * * @since 2.6 */ @Parameter(property = "teamlist.showAvatarImages", defaultValue = "true") private boolean showAvatarImages; + /** + * Indicate if external url should be used for avatar images. + * <p> + * If set to <code>true</code> images will be downloaded and attached to report during build. + * + * @since 3.9.0 + */ + @Parameter(property = "teamlist.externalAvatarImages", defaultValue = "true") + private boolean externalAvatarImages; + + /** + * Base url for avatar provider. + * + * @since 3.9.0 + */ + @Parameter(property = "teamlist.avatarBaseUrl", defaultValue = "https://www.gravatar.com/avatar/") + private String avatarBaseUrl; + + /** + * Provider name for avatar images. + * <p> + * Report has one implementation for gravatar.com. Users can provide other by implementing {@link AvatarsProvider} Review Comment: Period at end ########## src/main/java/org/apache/maven/report/projectinfo/TeamReport.java: ########## @@ -52,19 +53,50 @@ public class TeamReport extends AbstractProjectInfoReport { /** * Shows avatar images for team members that have a) properties/picUrl set b) An avatar at gravatar.com for their * email address - * <p/> - * Future versions of this plugin may implement different strategies for resolving avatar images, possibly - * using different providers. - *<p> - *<strong>Note</strong>: This property will be renamed to {@code tteam.showAvatarImages} in 3.0. + * * @since 2.6 */ @Parameter(property = "teamlist.showAvatarImages", defaultValue = "true") private boolean showAvatarImages; + /** + * Indicate if external url should be used for avatar images. Review Comment: URL. Is there an internal URL? If not, delete "external" here or rewrite -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org