@Nonnull public String getID () { return m_aRes.getPath (); }
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 CachingTransformStreamSource (@Nonnull final IReadableResource aResource) { this (aResource.getInputStream (), aResource.getResourceID ()); }
@Nullable public InputStream getResourceAsStream (@Nonnull final String sPath) { final IReadableResource aResource = m_aResourceProvider.getReadableResource (getResourceLocation (sPath)); if (!aResource.exists ()) return null; return aResource.getInputStream (); }
m_bResourceExists = m_aResource.exists (); final InputStream aIS = m_aResource.getInputStream (); if (aIS != null) LOGGER.error ("Failed to create message digest of " + m_aResource.getPath (), ex);
if (!aXSLTResource.exists ()) final String sResourceID = aXSLTResource.getResourceID ();
public boolean exists () { return m_aRes.exists (); }
@Nullable public String getAsURLString () { final URL aURL = m_aResource.getAsURL (); if (aURL == null) return null; return aURL.toExternalForm (); }
public ProxyAutoConfigHelper (@Nonnull final IReadableResource aPACRes) throws ScriptException { m_aPACRes = ValueEnforcer.notNull (aPACRes, "PACResource"); m_sPACCode = null; s_aScriptEngine.eval (m_aPACRes.getReader (ScriptHelper.DEFAULT_SCRIPT_CHARSET)); }
@Nullable public static InputSource create (@Nonnull final IReadableResource aResource) { if (aResource instanceof FileSystemResource) { final File aFile = aResource.getAsFile (); if (aFile != null) { // Potentially use memory mapped files final InputSource ret = create (FileHelper.getInputStream (aFile)); if (ret != null) { // Ensure system ID is present - may be helpful for resource // resolution final URL aURL = aResource.getAsURL (); if (aURL != null) ret.setSystemId (aURL.toExternalForm ()); } return ret; } } return new ReadableResourceSAXInputSource (aResource); }
@Nonnull @SuppressFBWarnings ("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") public String getRealPath (@Nonnull final String sPath) { final IReadableResource aResource = m_aResourceProvider.getReadableResource (getResourceLocation (sPath)); if (aResource == null) throw new IllegalStateException ("Failed to get real path of '" + sPath + "'"); final File aFile = aResource.getAsFile (); if (aFile == null) throw new IllegalStateException ("Failed to convert resource " + aResource + " to a file"); return aFile.getAbsolutePath (); }
if (!aXSLTResource.exists ()) final String sResourceID = aXSLTResource.getResourceID ();
public CryptoProperties (@Nonnull final IReadableResource aRes) { ValueEnforcer.notNull (aRes, "Resource"); if (aRes.exists ()) try { m_aProps = new NonBlockingProperties (); try (final InputStream aIS = aRes.getInputStream ()) { m_aProps.load (aIS); } } catch (final Throwable t) { throw new InitializationException ("Failed to init CryptoProperties from resource " + aRes + "!", t); } }
if (aRes != null && aRes.exists ()) return TransformSourceFactory.create (aRes);
@Nullable private static String _getBaseHref (@Nonnull final IReadableResource aResource) { final URL aURL = aResource.getAsURL (); return aURL == null ? null : aURL.toExternalForm (); }
@Nonnull public MarkdownProcessingResult process (@Nonnull final IReadableResource aRes) throws IOException { ValueEnforcer.notNull (aRes, "Resource"); return process (aRes.getReader (m_aConfig.getEncoding ())); }
public CachingSAXInputSource (@Nonnull final IReadableResource aRes) { this (aRes.getInputStream (), aRes.getResourceID ()); }
@Override @Nullable public LocalDateTime getLastModificationDateTime (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope) { // We have an existing resource final IReadableResource aRes = aRequestScope.attrs ().getCastedValue (REQUEST_ATTR_OBJECT_DELIVERY_RESOURCE); // Try to convert the resource to a file, because only files have a last // modification DateTime final File aFile = aRes.getAsFile (); if (aFile != null) { final long nLastModified = aFile.lastModified (); if (nLastModified > 0) { return CHttp.convertMillisToLocalDateTime (nLastModified); } } return null; }
/** * 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; }