@Nonnull public String getID () { return m_aRes.getPath (); }
/** * Constructor * * @param aRes * The resource in which the error occurred. May not be * <code>null</code>. * @param sMsg * error message * @param t * Nested exception */ public SchematronReadException (@Nonnull final IReadableResource aRes, @Nonnull final String sMsg, @Nullable final Throwable t) { super (aRes.getPath () + ": " + sMsg, t); m_aRes = aRes; }
/** * Constructor * * @param aRes * The resource in which the error occurred. May not be * <code>null</code>. * @param sMsg * error message * @param t * Nested exception */ public SchematronReadException (@Nonnull final IReadableResource aRes, @Nonnull final String sMsg, @Nullable final Throwable t) { super (aRes.getPath () + ": " + sMsg, t); m_aRes = aRes; }
/** * @return The path of the underlying resources. Neither <code>null</code> nor * empty. */ @Nonnull @Nonempty public String getPath () { return m_aRes.getPath (); }
/** * Assume the provided resource as an XML file, parse it and use the contained * DOM Node as the basis for validation. * * @param aResource * The original resource. May not be <code>null</code>. * @return The validation source to be used. Never <code>null</code>. */ @Nonnull public static ValidationSource createXMLSource (@Nonnull final IReadableResource aResource) { // Read on demand only return new ValidationSource (aResource.getPath (), () -> DOMReader.readXMLDOM (aResource), false) { @Override @Nonnull public Source getAsTransformSource () { // Use resource as TransformSource to get error line and column return TransformSourceFactory.create (aResource); } }; } }
private void _checkKeyStoreAttributes () { if (m_aKeyStoreRes == null) throw new IllegalStateException ("KeyStore resources is not configured."); if (!m_aKeyStoreRes.exists ()) throw new IllegalStateException ("KeyStore resources does not exist: " + m_aKeyStoreRes.getPath ()); if (m_aKeyStoreType == null) throw new IllegalStateException ("KeyStore type is not configured."); if (m_sKeyStorePassword == null) throw new IllegalStateException ("KeyStore password is not configured."); if (StringHelper.hasNoText (m_sKeyStoreAlias)) throw new IllegalStateException ("KeyStore alias is not configured."); if (m_sKeyStoreKeyPassword == null) throw new IllegalStateException ("Key password is not configured."); }
public void onDAOWriteException (@Nonnull final Throwable t, @Nonnull final IReadableResource aRes, @Nonnull final CharSequence aFileContent) { final String sErrorCode = "DAO write error for " + aRes.getPath () + " with " + aFileContent.length () + " chars"; onError (t, null, sErrorCode, new StringMap ().add ("action", "write").add ("path", aRes.getPath ()).add ("content", aFileContent)); }
public void onDAOReadException (@Nonnull final Throwable t, final boolean bInit, @Nullable final IReadableResource aRes) { final String sErrorCode = "DAO " + (bInit ? "init" : "read") + " error" + (aRes == null ? "" : " for " + aRes.getPath ()); onError (t, null, sErrorCode, new StringMap ().add ("action", bInit ? "init" : "read").add ("path", aRes == null ? null : aRes.getPath ())); }
@Nonnull public static String getLogMessage (@Nullable final IReadableResource aRes, @Nullable final IPSElement aSourceElement, @Nonnull final String sMessage) { return StringHelper.getImplodedNonEmpty (" - ", aRes == null ? null : aRes.getPath (), aSourceElement == null ? null : ClassHelper.getClassLocalName (aSourceElement), aSourceElement instanceof IPSHasID && ((IPSHasID) aSourceElement).hasID () ? "ID " + ((IPSHasID) aSourceElement).getID () : null, sMessage); }
@Nonnull public static String getLogMessage (@Nullable final IReadableResource aRes, @Nullable final IPSElement aSourceElement, @Nonnull final String sMessage) { return StringHelper.getImplodedNonEmpty (" - ", aRes == null ? null : aRes.getPath (), aSourceElement == null ? null : ClassHelper.getClassLocalName (aSourceElement), aSourceElement instanceof IPSHasID && ((IPSHasID) aSourceElement).hasID () ? "ID " + ((IPSHasID) aSourceElement).getID () : null, sMessage); }
public static void _readMetaElements (@Nonnull final IReadableResource aRes, @Nonnull final MetaElementList aTarget) { ValueEnforcer.notNull (aRes, "Res"); ValueEnforcer.notNull (aTarget, "Target"); if (aRes.exists ()) { final ICommonsOrderedMap <String, String> aMetaElements = new CommonsLinkedHashMap <> (); if (XMLMapHandler.readMap (aRes, aMetaElements).isFailure ()) LOGGER.error ("Failed to read meta element file " + aRes.getPath ()); for (final Map.Entry <String, String> aEntry : aMetaElements.entrySet ()) aTarget.addMetaElement (MetaElement.createMeta (aEntry.getKey (), aEntry.getValue ())); } }
/** * Reload the configuration file. It checks if the system property * {@link #SYSTEM_PROPERTY_PEPPOL_SMP_SERVER_PROPERTIES_PATH} or * {@link #SYSTEM_PROPERTY_SMP_SERVER_PROPERTIES_PATH} is present and if so, * tries it first, than {@link #PATH_PRIVATE_SMP_SERVER_PROPERTIES} is checked * and finally the {@link #PATH_SMP_SERVER_PROPERTIES} path is checked. * * @return {@link ESuccess} */ @Nonnull public static ESuccess reloadConfiguration () { final ConfigFileBuilder aCFB = new ConfigFileBuilder ().addPathFromSystemProperty (SYSTEM_PROPERTY_PEPPOL_SMP_SERVER_PROPERTIES_PATH) .addPathFromSystemProperty (SYSTEM_PROPERTY_SMP_SERVER_PROPERTIES_PATH) .addPath (PATH_PRIVATE_SMP_SERVER_PROPERTIES) .addPath (PATH_SMP_SERVER_PROPERTIES); return s_aRWLock.writeLocked ( () -> { s_aConfigFile = aCFB.build (); if (s_aConfigFile.isRead ()) { LOGGER.info ("Read PEPPOL SMP server properties from " + s_aConfigFile.getReadResource ().getPath ()); return ESuccess.SUCCESS; } LOGGER.warn ("Failed to read PEPPOL SMP server properties from " + aCFB.getAllPaths ()); return ESuccess.FAILURE; }); }
/** * Reload the configuration file. It checks if the system property * {@link #SYSTEM_PROPERTY_PEPPOL_SMP_SERVER_PROPERTIES_PATH} or * {@link #SYSTEM_PROPERTY_SMP_SERVER_PROPERTIES_PATH} is present and if so, * tries it first, than {@link #PATH_PRIVATE_SMP_SERVER_PROPERTIES} is checked * and finally the {@link #PATH_SMP_SERVER_PROPERTIES} path is checked. * * @return {@link ESuccess} */ @Nonnull public static ESuccess reloadConfiguration () { final ConfigFileBuilder aCFB = new ConfigFileBuilder ().addPathFromSystemProperty (SYSTEM_PROPERTY_PEPPOL_SMP_SERVER_PROPERTIES_PATH) .addPathFromSystemProperty (SYSTEM_PROPERTY_SMP_SERVER_PROPERTIES_PATH) .addPath (PATH_PRIVATE_SMP_SERVER_PROPERTIES) .addPath (PATH_SMP_SERVER_PROPERTIES); return s_aRWLock.writeLocked ( () -> { s_aConfigFile = aCFB.build (); if (s_aConfigFile.isRead ()) { LOGGER.info ("Read PEPPOL SMP server properties from " + s_aConfigFile.getReadResource ().getPath ()); return ESuccess.SUCCESS; } LOGGER.warn ("Failed to read PEPPOL SMP server properties from " + aCFB.getAllPaths ()); return ESuccess.FAILURE; }); }
LOGGER.error ("Failed to create message digest of " + m_aResource.getPath (), ex);
@Nonnull protected AS4CryptoFactory internalCreateCryptoFactory () { _checkKeyStoreAttributes (); final ICommonsMap <String, String> aCryptoProps = new CommonsLinkedHashMap <> (); aCryptoProps.put ("org.apache.wss4j.crypto.provider", org.apache.wss4j.common.crypto.Merlin.class.getName ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.file", getKeyStoreResource ().getPath ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.type", getKeyStoreType ().getID ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.password", getKeyStorePassword ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.alias", getKeyStoreAlias ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.private.password", getKeyStoreKeyPassword ()); return new AS4CryptoFactory (aCryptoProps); }
public static void _readJSIncludes (@Nonnull final IReadableResource aRes, @Nonnull final JSResourceSet aTarget) { ValueEnforcer.notNull (aRes, "Res"); ValueEnforcer.notNull (aTarget, "Target"); final IMicroDocument aDoc = aRes.exists () ? MicroReader.readMicroXML (aRes) : null; if (aDoc != null) for (final IMicroElement eChild : aDoc.getDocumentElement ().getAllChildElements ("js")) { final String sPath = eChild.getAttributeValue ("path"); if (StringHelper.hasNoText (sPath)) { LOGGER.error ("Found JS item without a path in " + aRes.getPath ()); continue; } // Just a consistency check to see if the resource is valid final IReadableResource aChildRes = PhotonHTMLSettings.getURIToURLConverter ().getAsResource (sPath); if (!aChildRes.exists ()) throw new IllegalStateException ("The provided global JS resource '" + sPath + "' resolved to '" + aChildRes + "' does NOT exist!"); final String sConditionalComment = eChild.getAttributeValue ("condcomment"); // Add to target aTarget.addItem (new ConstantJSPathProvider (sPath, JSFilenameHelper.getMinifiedJSFilename (sPath), sConditionalComment, IJSProvider.DEFAULT_IS_BUNDLABLE)); } }
public static void reinit (final boolean bForTest) { s_bTestMode = bForTest; final ConfigFileBuilder aBuilder = new ConfigFileBuilder (); if (bForTest) { aBuilder.addPathFromSystemProperty ("as4.server.test.configfile") .addPath ("private-test-as4.properties") .addPath ("test-as4.properties"); } else { aBuilder.addPathFromSystemProperty ("as4.server.configfile") .addPath ("private-as4.properties") .addPath ("as4.properties"); } final ConfigFile aCF = aBuilder.build (); if (!aCF.isRead ()) throw new InitializationException ("Failed to read AS4 server configuration file!"); LOGGER.info ("Successfully read AS4 configuration file from " + aCF.getReadResource ().getPath ()); SETTINGS.setAll (aCF.getSettings ()); }
.setErrorLocation (new SimpleLocation (aVA.getRuleResource ().getPath ())) .setErrorText ("The document to be validated is not an XML document") .setLinkedException (ex)
aTabBox.addTab (HCHelper.getAsHTMLID (aCF.getID ()), aCF.getResource ().getPath () + sTabLabelSuffix, aContent);
aTabBox.addTab (HCHelper.getAsHTMLID (aCF.getID ()), aCF.getResource ().getPath () + sTabLabelSuffix, aContent);