Skip to content

Commit

Permalink
Fixes for javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Aug 29, 2024
1 parent f46e952 commit 18e53ca
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 66 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ jobs:

- name: Deploy Snapshot with Maven, version ${{ steps.project.outputs.version }}
if: ${{endsWith(steps.project.outputs.version, '-SNAPSHOT')}}
# javadoc:aggregate -> Needs to be fixed: "Error: No source files for package de.cuioss.jsf.api.components.model"
# Actually we need to resolve it regarding https://maven.apache.org/plugins/maven-javadoc-plugin/examples/aggregate.html
run: |
mvn -B --no-transfer-progress -Prelease-snapshot install -Dmaven.javadoc.skip=true
mvn -B --no-transfer-progress -Prelease-snapshot deploy -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
mvn -B --no-transfer-progress -Prelease-snapshot,javadoc-mm-reporting install
mvn -B --no-transfer-progress -Prelease-snapshot,javadoc-mm-reporting deploy -Dmaven.test.skip=true
env:
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSS_SONATYPE_PASSWORD }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@

/**
* <p>
* Portal variant of {@link ResourceBundle}. It delegates to
* {@link ResourceBundleWrapper} that does the actual heavy lifting.
* Portal variant of {@link java.util.ResourceBundle}. It delegates to
* {@link de.cuioss.portal.common.bundle.ResourceBundleWrapper} that does the actual heavy lifting.
* </p>
* <p>
* It usage is for cases where there is technically a {@link ResourceBundle}
* It usage is for cases where there is technically a {@link java.util.ResourceBundle}
* needed. Sadly there is no corresponding interface, solely an Abstract-Class
* that can not be proxied by CDI. Currently it's sole use is the context of the
* PortalApplication, that it exposes it on
* {@link Application#getResourceBundle(jakarta.faces.context.FacesContext, String)}
* {@link jakarta.faces.application.Application#getResourceBundle(jakarta.faces.context.FacesContext, String)}
* with the name "msgs"
*
* It can be used directly in jsf views: {@code #{msgs['page.401.title']}}
Expand All @@ -66,24 +66,29 @@ public class PortalResourceBundleBean extends ResourceBundle implements Serializ

private String allBundleNames;

/** {@inheritDoc} */
@Override
protected Object handleGetObject(final String key) {
return resourceBundleWrapper.getString(key);
}

/** {@inheritDoc} */
@Override
public Enumeration<String> getKeys() {
return Collections.enumeration(keySet());
}

/** {@inheritDoc} */
@Override
public Set<String> keySet() {
return resourceBundleWrapper.keySet();
}

/**
* Factory Method creating a new instance with loading the contained
* {@link ResourceBundleWrapper}, {@link SessionScoped} from the CDR-COntext
* {@link de.cuioss.portal.common.bundle.ResourceBundleWrapper}, {@link jakarta.enterprise.context.SessionScoped} from the CDR-COntext
*
* @return a {@link de.cuioss.portal.common.bundle.PortalResourceBundleBean} object
*/
public static PortalResourceBundleBean resolveFromCDIContext() {
LOGGER.debug("Resolving PortalResourceBundleBean from CDI-Context");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

/**
* Used for configuring ResourceBundles. Implementations should provide a
* {@link Priority}. Because of the overwriting mechanics a higher
* {@link Priority} of one of the concrete bundles results in a higher priority
* {@link jakarta.annotation.Priority}. Because of the overwriting mechanics a higher
* {@link jakarta.annotation.Priority} of one of the concrete bundles results in a higher priority
* of said bundles, resulting in the key to be chosen of the ones with the
* higher ordering. Number higher than 100 should always be reserved for
* assemblies / applications
Expand All @@ -36,18 +36,24 @@
*/
public interface ResourceBundleLocator extends Serializable {

/** Constant <code>LOGGER</code> */
CuiLogger LOGGER = new CuiLogger(ResourceBundleLocator.class);

/**
* <p>getBundlePath.</p>
*
* @return paths of the resource bundles if it can be loaded. <em>Caution: </em>
* {@link ResourceBundleRegistry} assumes that only loadable paths are
* {@link de.cuioss.portal.common.bundle.ResourceBundleRegistry} assumes that only loadable paths are
* to be returned. Therefore, each implementation must take care.
*/
Optional<String> getBundlePath();

/**
* @return an {@link Optional} {@link ResourceBundle} derived by the path of
* <p>getBundle.</p>
*
* @return an {@link java.util.Optional} {@link java.util.ResourceBundle} derived by the path of
* {@link #getBundlePath()}
* @param locale a {@link java.util.Locale} object
*/
default Optional<ResourceBundle> getBundle(Locale locale) {
var bundlePath = getBundlePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

/**
* Registry for the ResourceBundleNames. The injected
* {@link ResourceBundleLocator}s must have unique paths and define an existing
* {@link ResourceBundle}. In addition they should be annotated with the
* corresponding {@link Priority}
* {@link de.cuioss.portal.common.bundle.ResourceBundleLocator}s must have unique paths and define an existing
* {@link java.util.ResourceBundle}. In addition they should be annotated with the
* corresponding {@link jakarta.annotation.Priority}
*
* @author Oliver Wolff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/**
* Defines the portal-contract dealing with UnifiedResourceBundle Technically it
* provides an interface similar to {@link ResourceBundle}
* provides an interface similar to {@link java.util.ResourceBundle}
*
* @author Oliver Wolff
*/
Expand All @@ -36,14 +36,12 @@ public interface ResourceBundleWrapper extends Serializable {
* @param key to be looked up
* @return the resolved message if key is defined, otherwise "??[key value]??"
* will be returned and warning will be written
* @throws MissingResourceException if key is unknown and application is in
* development mode
*/
String getString(String key);

/**
* Technical method for {@link ResourceBundle} caching the resolved keys and
* values @see {@link ResourceBundle#getKeys()}
* Technical method for {@link java.util.ResourceBundle} caching the resolved keys and
* values @see {@link java.util.ResourceBundle#getKeys()}
*
* @return an Enumeration of the keys contained in this ResourceBundle and its
* parent bundles.
Expand All @@ -53,11 +51,15 @@ default Enumeration<String> getKeys() {
}

/**
* <p>keySet.</p>
*
* @return set of all supported keys of this bundle
*/
Set<String> keySet();

/**
* <p>getBundleContent.</p>
*
* @return a list of all configured bundles to be used for debugging.
*/
String getBundleContent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
/**
* It can do the following tricks:
* <ul>
* <li>Define a working {@link Serializable} contract for
* {@link ResourceBundle}s</li>
* <li>Listens and acts on {@link LocaleChangeEvent}s</li>
* <li>Define a working {@link java.io.Serializable} contract for
* {@link java.util.ResourceBundle}s</li>
* <li>Listens and acts on {@link de.cuioss.portal.common.locale.LocaleChangeEvent}s</li>
* </ul>
*
* Handling of Missing Keys: On {@link ProjectStage#DEVELOPMENT} it will throw a
* {@link MissingResourceException}. Otherwise it will return the requested key,
* Handling of Missing Keys: On {@link de.cuioss.portal.common.stage.ProjectStage#DEVELOPMENT} it will throw a
* {@link java.util.MissingResourceException}. Otherwise it will return the requested key,
* surrounded with Question-Marks
*
* @author Oliver Wolff
Expand Down Expand Up @@ -83,6 +83,7 @@ public class ResourceBundleWrapperImpl implements ResourceBundleWrapper {

private final List<String> keyList = new CopyOnWriteArrayList<>();

/** {@inheritDoc} */
@Override
public String getString(final String key) {

Expand Down Expand Up @@ -127,11 +128,13 @@ private List<ResourceBundle> getResolvedBundles() {
return resolvedBundles;
}

/** {@inheritDoc} */
@Override
public Enumeration<String> getKeys() {
return Collections.enumeration(keySet());
}

/** {@inheritDoc} */
@Override
@Synchronized
public Set<String> keySet() {
Expand All @@ -145,6 +148,7 @@ public Set<String> keySet() {
return mutableSet(keyList);
}

/** {@inheritDoc} */
@Override
public String getBundleContent() {
return Joiner.on(", ").join(resourceBundleRegistry.getResolvedPaths());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
*
* <pre>
* String annotationClassName = ...;
* Class<? extends annotation> annotationClass =
* (Class<? extends Annotation>) ClassUtils.getClassLoader(null).loadClass(annotationClassName);
* Class&lt;? extends annotation&gt; annotationClass =
* (Class&lt;? extends Annotation&gt;) ClassUtils.getClassLoader(null).loadClass(annotationClassName);
* Annotation a = AnnotationInstanceProvider.of(annotationClass)
* </pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
* <h2>Design</h2>
* <p>
* Some items at the portal need an explicit ordering in order to check the
* priority. For e.g. instances of {@link ResourceBundleLocator} can have a
* priority. For e.g. instances of {@link de.cuioss.portal.common.bundle.ResourceBundleLocator} can have a
* higher priority for overwriting portal defined messages. The ordering relies
* on the {@link Priority} annotation on the corresponding elements. The higher
* the {@link Priority#value()} the higher is the priority. If the corresponding
* element has not annotated with {@link Priority} the order will be defaulted
* on the {@link jakarta.annotation.Priority} annotation on the corresponding elements. The higher
* the {@link jakarta.annotation.Priority#value()} the higher is the priority. If the corresponding
* element has not annotated with {@link jakarta.annotation.Priority} the order will be defaulted
* to {@link #DEFAULT_LEVEL}
* </p>
* <h2>Implementation</h2>
Expand Down Expand Up @@ -80,13 +80,14 @@ public final class PortalPriorities {

/**
* Helper method that sorts a number of given objects regarding their
* priority. The Priority is assumed to be defined by the {@link Priority}
* priority. The Priority is assumed to be defined by the {@link jakarta.annotation.Priority}
* annotation at class level. If it is not set, the priority is defaulted to
* {@value #DEFAULT_LEVEL}
*
* @param toBeSorted must not be null
* @return the sorted list. In case of {@link List#size()} is lower than 2 the
* @return the sorted list. In case of {@link java.util.List#size()} is lower than 2 the
* original list will be returned.
* @param <T> a T class
*/
@SuppressWarnings("unchecked")
public static <T> List<T> sortByPriority(final List<T> toBeSorted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import lombok.ToString;

/**
* Helper class for sorting elements regarding its {@link Priority}
* annotation. In case the given class does not have a {@link Priority}
* Helper class for sorting elements regarding its {@link jakarta.annotation.Priority}
* annotation. In case the given class does not have a {@link jakarta.annotation.Priority}
* annotation present an order of {@code 0} is assumed.
*
* @author Oliver Wolff
Expand All @@ -42,6 +42,8 @@ public class PriorityComparator implements Comparable<PriorityComparator> {
private final Object wrapped;

/**
* <p>Constructor for PriorityComparator.</p>
*
* @param wrappedObject must not be null
*/
public PriorityComparator(final Object wrappedObject) {
Expand Down Expand Up @@ -83,6 +85,7 @@ private Priority findPriorityAnnotation(final Class<?> annotatedClass) {
return null;
}

/** {@inheritDoc} */
@Override
public int compareTo(final PriorityComparator other) {
return other.getOrder().compareTo(order);
Expand Down
1 change: 1 addition & 0 deletions modules/core/portal-configuration/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Provides some portal-specific extensions to microprofile-config. In addition it
* link:src/main/java/de/cuioss/portal/configuration/types/[Additional configuration-types]
* link:src/main/java/de/cuioss/portal/configuration/util/ConfigurationHelper.java[Simplifies the programmatic lookup up configuration-properties]


Constant Key classes for:

* link:src/main/java/de/cuioss/portal/configuration/PortalConfigurationKeys.java[Portal-Configuration-Core]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Members of this package help to initialize
* {@link javax.enterprise.context.ApplicationScoped} beans eagerly in a
* {@link jakarta.enterprise.context.ApplicationScoped} beans eagerly in a
* specified order. The actual initialization will be done by a ServletContext
* initializer. This replaces the {@link javax.annotation.PostConstruct} based
* initializer. This replaces the {@link jakarta.annotation.PostConstruct} based
* approach, because with that the initialization order will be determined by
* the access order and will therefore not be deterministic.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* &#64;Inject
* &#64;RegistryType(type = MetricRegistry.Type.APPLICATION)
* private MetricRegistry appRegistry;
* final Cache<String, String> cache = Caffeine.newBuilder().maximumSize(cacheConfig.getSize())
* final Cache&lt;String, String&gt; cache = Caffeine.newBuilder().maximumSize(cacheConfig.getSize())
* .expireAfterAccess(cacheConfig.getExpiration(), cacheConfig.getTimeUnit()).recordStats().build();
* new CaffeineCacheMetrics("my-cache-name", cache, cacheConfig).bindTo(appRegistry);
* </pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,41 @@
*/
package de.cuioss.portal.restclient;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import de.cuioss.portal.configuration.types.ConfigAsConnectionMetadata;
import jakarta.enterprise.util.Nonbinding;
import jakarta.inject.Qualifier;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import jakarta.enterprise.util.Nonbinding;
import jakarta.inject.Qualifier;

import de.cuioss.portal.configuration.types.ConfigAsConnectionMetadata;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* <p>
* Marker identifying concrete instances of {@link RestClientHolder}. The
* connection-specific metadata is derived by a number of properties derived by
* {@link #baseName()}. Expected is a structure as defined within
* {@link ConfigAsConnectionMetadata}. </ p>
* Marker identifying concrete instances of {@link RestClientHolder}. The connection-specific metadata is derived by a number of properties derived by
* {@link PortalRestClient#baseName()}. Expected is a structure as defined within {@link ConfigAsConnectionMetadata}. </ p>
*/
@Qualifier
@Retention(RUNTIME)
@Target({ TYPE, METHOD, FIELD, PARAMETER })
@Target({TYPE, METHOD, FIELD, PARAMETER})
public @interface PortalRestClient {

/**
* @return the basename of the configuration, see
* {@link ConfigAsConnectionMetadata} for details
* {@link ConfigAsConnectionMetadata} for details
*/
@Nonbinding
String baseName();

/**
* @return boolean indicating whether the corresponding producer should throw an
* {@link IllegalArgumentException} in case the properties contain
* errors. Defaults to <code>true</code>. In case of <code>false</code>
* will return the created {@link RestClientHolder} without structural
* checks on the configuration
* {@link IllegalArgumentException} in case the properties contain
* errors.
* Defaults to <code>true</code>.
* In case of <code>false</code>
* will return the created {@link RestClientHolder} without structural
* checks on the configuration
*/
@Nonbinding
boolean failOnInvalidConfiguration() default true;
Expand Down
5 changes: 5 additions & 0 deletions modules/test/portal-core-unit-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
weld-junit testing
</description>
<properties>
<!-- Fix for
/home/oliver/git/cui-portal-core/modules/test/portal-core-unit-testing/src/main/java/de/cuioss/portal/core/test/junit5/mockwebserver/MockWebServerExtension.java:26: error: package org.junit.platform.commons.logging is not visible
import org.junit.platform.commons.logging.Logger;
-->
<maven.javadoc.plugin.failOnError>false</maven.javadoc.plugin.failOnError>
<maven.jar.plugin.automatic.module.name>
de.cuioss.portal.core.test
</maven.jar.plugin.automatic.module.name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package de.cuioss.portal.core.test.junit5.mockwebserver;

import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Optional;

Expand Down

This file was deleted.

Loading

0 comments on commit 18e53ca

Please sign in to comment.