From 9b15d83943bca537f6ce8ec0ce3a866d6a171f4f Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Wed, 13 Mar 2024 19:42:49 +0100 Subject: [PATCH] Some renamings --- .../load/DefaultVESLoaderSchematron.java | 6 +-- .../ves/engine/load/DefaultVESLoaderXSD.java | 2 +- .../ves/engine/load/IVESLoaderEdifact.java | 21 ++++++++- .../ves/engine/load/IVESLoaderSchematron.java | 21 ++++++++- .../phive/ves/engine/load/IVESLoaderXSD.java | 21 ++++++++- .../phive/ves/engine/load/LoadedVES.java | 10 ++--- .../phive/ves/engine/load/VESLoader.java | 44 +++++++++---------- 7 files changed, 91 insertions(+), 34 deletions(-) diff --git a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/DefaultVESLoaderSchematron.java b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/DefaultVESLoaderSchematron.java index afd21692..d55f5449 100644 --- a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/DefaultVESLoaderSchematron.java +++ b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/DefaultVESLoaderSchematron.java @@ -63,7 +63,7 @@ public class DefaultVESLoaderSchematron implements IVESLoaderSchematron @Nonnull public IValidationExecutor loadSchematron (@Nonnull final IRepoStorageBase aRepo, @Nonnull final VesSchematronType aSCH, - @Nullable final LoadedVES.Requirement aRequirement, + @Nullable final LoadedVES.RequiredVES aLoadingRequiredVES, @Nonnull final ErrorList aErrorList, @Nonnull final IVESAsyncLoader aAsyncLoader) { @@ -190,10 +190,10 @@ public IValidationExecutor loadSchematron (@Nonnull final } // Are we changing the output levels on a "required" resource? - if (aRequirement != null && aRequirement.getOutput ().customErrorLevels ().isNotEmpty ()) + if (aLoadingRequiredVES != null && aLoadingRequiredVES.getOutput ().customErrorLevels ().isNotEmpty ()) { // These ones overwrite the original ones - aCustomErrorLevels.putAll (aRequirement.getOutput ().customErrorLevels ()); + aCustomErrorLevels.putAll (aLoadingRequiredVES.getOutput ().customErrorLevels ()); } if (aCustomErrorLevels.isNotEmpty ()) diff --git a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/DefaultVESLoaderXSD.java b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/DefaultVESLoaderXSD.java index 740f648e..946f7855 100644 --- a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/DefaultVESLoaderXSD.java +++ b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/DefaultVESLoaderXSD.java @@ -97,7 +97,7 @@ private static final String _unifyPath (@Nullable final String x) @Nonnull public IValidationExecutor loadXSD (@Nonnull final IRepoStorageBase aRepo, @Nonnull final VesXsdType aXSD, - @Nullable final LoadedVES.Requirement aRequirement, + @Nullable final LoadedVES.RequiredVES aLoadingRequiredVES, @Nonnull final ErrorList aErrorList, @Nonnull final IVESAsyncLoader aAsyncLoader) { diff --git a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderEdifact.java b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderEdifact.java index 3c7aee3e..06fb77e1 100644 --- a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderEdifact.java +++ b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderEdifact.java @@ -33,10 +33,29 @@ */ public interface IVESLoaderEdifact { + /** + * Load an Edifact validation from a VES. + * + * @param aRepo + * The repository to load the data from. May not be null. + * @param aEDI + * The JAXB VES Edifact object with the details. May not be + * null. + * @param aLoadingRequiredVES + * In case the loading was recursively triggered via a "requires" + * (=include), this is the data of the requirements. May be + * null. + * @param aErrorList + * The error list to be filled. May not be null. + * @param aAsyncLoader + * The callback to be invoked, if loading this artefacts needs to + * trigger the loading of another artefact. + * @return The validation executor to be used. May not be null. + */ @Nonnull IValidationExecutor loadEdifact (@Nonnull IRepoStorageBase aRepo, @Nonnull VesEdifactType aEDI, - @Nullable LoadedVES.Requirement aRequirement, + @Nullable LoadedVES.RequiredVES aLoadingRequiredVES, @Nonnull ErrorList aErrorList, @Nonnull IVESAsyncLoader aAsyncLoader); } diff --git a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderSchematron.java b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderSchematron.java index a4b53f92..3ce60eff 100644 --- a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderSchematron.java +++ b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderSchematron.java @@ -33,10 +33,29 @@ */ public interface IVESLoaderSchematron { + /** + * Load a Schematron validation from a VES. + * + * @param aRepo + * The repository to load the data from. May not be null. + * @param aSCH + * The JAXB VES Schematron object with the details. May not be + * null. + * @param aLoadingRequiredVES + * In case the loading was recursively triggered via a "requires" + * (=include), this is the data of the requirements. May be + * null. + * @param aErrorList + * The error list to be filled. May not be null. + * @param aAsyncLoader + * The callback to be invoked, if loading this artefacts needs to + * trigger the loading of another artefact. + * @return The validation executor to be used. May not be null. + */ @Nonnull IValidationExecutor loadSchematron (@Nonnull IRepoStorageBase aRepo, @Nonnull VesSchematronType aSCH, - @Nullable LoadedVES.Requirement aRequirement, + @Nullable LoadedVES.RequiredVES aLoadingRequiredVES, @Nonnull ErrorList aErrorList, @Nonnull IVESAsyncLoader aAsyncLoader); } diff --git a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderXSD.java b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderXSD.java index ed8e4222..dea01316 100644 --- a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderXSD.java +++ b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderXSD.java @@ -33,10 +33,29 @@ */ public interface IVESLoaderXSD { + /** + * Load an XSD validation from a VES. + * + * @param aRepo + * The repository to load the data from. May not be null. + * @param aXSD + * The JAXB VES XSD object with the details. May not be + * null. + * @param aLoadingRequiredVES + * In case the loading was recursively triggered via a "requires" + * (=include), this is the data of the requirements. May be + * null. + * @param aErrorList + * The error list to be filled. May not be null. + * @param aAsyncLoader + * The callback to be invoked, if loading this artefacts needs to + * trigger the loading of another artefact. + * @return The validation executor to be used. May not be null. + */ @Nonnull IValidationExecutor loadXSD (@Nonnull IRepoStorageBase aRepo, @Nonnull VesXsdType aXSD, - @Nullable LoadedVES.Requirement aRequirement, + @Nullable LoadedVES.RequiredVES aLoadingRequiredVES, @Nonnull ErrorList aErrorList, @Nonnull IVESAsyncLoader aAsyncLoader); } diff --git a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/LoadedVES.java b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/LoadedVES.java index 811a2864..53f79865 100644 --- a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/LoadedVES.java +++ b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/LoadedVES.java @@ -223,14 +223,14 @@ public ICommonsMap customErrorLevels () * @author Philip Helger */ @NotThreadSafe - public static final class Requirement + public static final class RequiredVES { private final VESID m_aRequiredVESID; private final MapBasedNamespaceContext m_aNSCtx; private final OutputType m_aOutput; private final boolean m_bStopOnError; - Requirement (@Nonnull final VESID aRequiredVESID, + RequiredVES (@Nonnull final VESID aRequiredVESID, @Nonnull final MapBasedNamespaceContext aNSCtx, @Nonnull final OutputType aOutput, final boolean bStopOnError) @@ -270,7 +270,7 @@ public boolean isStopOnError () private final Header m_aHeader; private final Status m_aStatus; - private Requirement m_aRequires; + private RequiredVES m_aRequires; private IVESSpecificDeferredLoader m_aRequiresLoader; private LoadedVES m_aLoadedRequires; private IValidationExecutor m_aExecutor; @@ -301,7 +301,7 @@ public Status getStatus () return m_aStatus; } - void setLazyRequires (@Nonnull final Requirement aRequirement, + void setLazyRequires (@Nonnull final RequiredVES aRequirement, @Nonnull final IVESSpecificDeferredLoader aDeferredLoader) { ValueEnforcer.notNull (aRequirement, "Requirement"); @@ -313,7 +313,7 @@ void setLazyRequires (@Nonnull final Requirement aRequirement, m_aRequiresLoader = aDeferredLoader; } - void setEagerRequires (@Nonnull final Requirement aRequirement, @Nonnull final LoadedVES aLoadedVES) + void setEagerRequires (@Nonnull final RequiredVES aRequirement, @Nonnull final LoadedVES aLoadedVES) { ValueEnforcer.notNull (aRequirement, "Requirement"); ValueEnforcer.notNull (aLoadedVES, "LoadedVES"); diff --git a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/VESLoader.java b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/VESLoader.java index 3b2fa1b6..a73d9d75 100644 --- a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/VESLoader.java +++ b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/VESLoader.java @@ -293,7 +293,7 @@ public LoadedVES convertToLoadedVES (@Nonnull final LoadedVES.Status aStatus, @Nullable private LoadedVES _convertToLoadedVES (@Nonnull final LoadedVES.Status aStatus, - @Nullable final LoadedVES.Requirement aLoadingRequirement, + @Nullable final LoadedVES.RequiredVES aLoadingRequiredVES, @Nonnull final VesType aSrcVes, @Nonnull final VESLoaderStatus aLoaderStatus, @Nonnull final ErrorList aLoadingErrors) throws VESLoadingException @@ -318,47 +318,47 @@ private LoadedVES _convertToLoadedVES (@Nonnull final LoadedVES.Status aStatus, if (aSrcVes.getRequires () != null) { final VesRequiresType aSrcReq = aSrcVes.getRequires (); - final LoadedVES.Requirement aRequirement = new LoadedVES.Requirement (new VESID (aSrcReq.getGroupId (), - aSrcReq.getArtifactId (), - aSrcReq.getVersion ()), - _wrap (aSrcReq.getNamespaces ()), - _wrap (aSrcReq.getOutput ()), - aSrcReq.isStopOnError ()); + final LoadedVES.RequiredVES aSrcRequiredVES = new LoadedVES.RequiredVES (new VESID (aSrcReq.getGroupId (), + aSrcReq.getArtifactId (), + aSrcReq.getVersion ()), + _wrap (aSrcReq.getNamespaces ()), + _wrap (aSrcReq.getOutput ()), + aSrcReq.isStopOnError ()); if (isUseEagerRequirementLoading ()) { // Eager loading // Recursive load required artefact; required to have this in scope - final LoadedVES aLoadedRequirement = _loadVESFromRepo (aRequirement.getRequiredVESID (), - aRequirement, + final LoadedVES aLoadedRequirement = _loadVESFromRepo (aSrcRequiredVES.getRequiredVESID (), + aSrcRequiredVES, aLoaderStatus, aLoadingErrors); if (aLoadedRequirement == null) { aLoadingErrors.add (SingleError.builderError () .errorText ("Failed to load required VESID '" + - aRequirement.getRequiredVESID ().getAsSingleID () + + aSrcRequiredVES.getRequiredVESID ().getAsSingleID () + "' [eager]") .build ()); return null; } - ret.setEagerRequires (aRequirement, aLoadedRequirement); + ret.setEagerRequires (aSrcRequiredVES, aLoadedRequirement); } else { // Lazy loading - ret.setLazyRequires (aRequirement, aLocalErrorList -> { + ret.setLazyRequires (aSrcRequiredVES, aLocalErrorList -> { // Use this deferred loader, to ensure the same surrounding VESLoader // instance is used // Recursive load required artefact; required to have this in scope - final LoadedVES aLoadedRequirement = _loadVESFromRepo (aRequirement.getRequiredVESID (), - aRequirement, + final LoadedVES aLoadedRequirement = _loadVESFromRepo (aSrcRequiredVES.getRequiredVESID (), + aSrcRequiredVES, aLoaderStatus, aLocalErrorList); if (aLoadedRequirement == null) throw new VESLoadingException ("Failed to load required VESID '" + - aRequirement.getRequiredVESID ().getAsSingleID () + + aSrcRequiredVES.getRequiredVESID ().getAsSingleID () + "' [lazy]: " + StringHelper.getImplodedMapped ("\n ", aLocalErrorList, @@ -382,7 +382,7 @@ private LoadedVES _convertToLoadedVES (@Nonnull final LoadedVES.Status aStatus, if (aLoader != null) ret.setExecutor (aLoader.loadXSD (m_aRepo, aSrcVes.getXsd (), - aLoadingRequirement, + aLoadingRequiredVES, aLoadingErrors, aAsyncLoader)); else @@ -398,7 +398,7 @@ private LoadedVES _convertToLoadedVES (@Nonnull final LoadedVES.Status aStatus, if (aLoader != null) ret.setExecutor (aLoader.loadSchematron (m_aRepo, aSrcVes.getSchematron (), - aLoadingRequirement, + aLoadingRequiredVES, aLoadingErrors, aAsyncLoader)); else @@ -414,7 +414,7 @@ private LoadedVES _convertToLoadedVES (@Nonnull final LoadedVES.Status aStatus, if (aLoader != null) ret.setExecutor (aLoader.loadEdifact (m_aRepo, aSrcVes.getEdifact (), - aLoadingRequirement, + aLoadingRequiredVES, aLoadingErrors, aAsyncLoader)); else @@ -529,8 +529,8 @@ public LoadedVES loadVESFromRepo (@Nonnull final VESID aVESID, * * @param aVESID * The VESID to load. May not be null. - * @param aRequirement - * The requirement that is currently loaded. May be null. + * @param aLoadingRequiredVES + * The required VES that is currently loaded. May be null. * @param aLoaderStatus * The internal loader status to be used, to make sure no cycles etc. * are contained @@ -540,7 +540,7 @@ public LoadedVES loadVESFromRepo (@Nonnull final VESID aVESID, */ @Nullable private LoadedVES _loadVESFromRepo (@Nonnull final VESID aVESID, - @Nullable final LoadedVES.Requirement aRequirement, + @Nullable final LoadedVES.RequiredVES aLoadingRequiredVES, @Nonnull final VESLoaderStatus aLoaderStatus, @Nonnull final ErrorList aLoadingErrors) { @@ -635,7 +635,7 @@ private LoadedVES _loadVESFromRepo (@Nonnull final VESID aVESID, } // Now read into data model - ret = _convertToLoadedVES (aStatus, aRequirement, aVES, aLoaderStatus, aLoadingErrors); + ret = _convertToLoadedVES (aStatus, aLoadingRequiredVES, aVES, aLoaderStatus, aLoadingErrors); return ret; } finally