本文整理汇总了Java中com.helger.commons.io.resource.IReadableResource.getResourceID方法的典型用法代码示例。如果您正苦于以下问题:Java IReadableResource.getResourceID方法的具体用法?Java IReadableResource.getResourceID怎么用?Java IReadableResource.getResourceID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.io.resource.IReadableResource
的用法示例。
在下文中一共展示了IReadableResource.getResourceID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applySchematron
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
/**
* Apply the passed schematron on the passed XML resource using a custom error
* handler.
*
* @param aSchematron
* The Schematron resource. May not be <code>null</code>.
* @param aXML
* The XML resource. May not be <code>null</code>.
* @return <code>null</code> if either the Schematron or the XML could not be
* read.
* @throws IllegalStateException
* if the processing throws an unexpected exception.
*/
@Nullable
public static SchematronOutputType applySchematron (@Nonnull final ISchematronResource aSchematron,
@Nonnull final IReadableResource aXML)
{
ValueEnforcer.notNull (aSchematron, "SchematronResource");
ValueEnforcer.notNull (aXML, "XMLSource");
try
{
// Apply Schematron on XML
return aSchematron.applySchematronValidationToSVRL (aXML);
}
catch (final Exception ex)
{
throw new IllegalArgumentException ("Failed to apply Schematron " +
aSchematron.getID () +
" onto XML resource " +
aXML.getResourceID (),
ex);
}
}
示例2: createSchematronXSLTProvider
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
@Nullable
public static SchematronProviderXSLTPrebuild createSchematronXSLTProvider (@Nonnull final IReadableResource aXSLTResource,
@Nullable final ErrorListener aCustomErrorListener,
@Nullable final URIResolver aCustomURIResolver)
{
if (s_aLogger.isInfoEnabled ())
s_aLogger.info ("Compiling XSLT instance " + aXSLTResource.toString ());
final CollectingTransformErrorListener aCEH = new CollectingTransformErrorListener ();
final SchematronProviderXSLTPrebuild aXSLTPreprocessor = new SchematronProviderXSLTPrebuild (aXSLTResource,
aCEH.andThen (aCustomErrorListener != null ? aCustomErrorListener
: new LoggingTransformErrorListener (Locale.US)),
aCustomURIResolver);
if (!aXSLTPreprocessor.isValidSchematron ())
{
// Schematron is invalid -> parsing failed
s_aLogger.warn ("The XSLT resource '" + aXSLTResource.getResourceID () + "' is invalid!");
for (final IError aError : aCEH.getErrorList ())
s_aLogger.warn (" " + aError.getAsString (Locale.US));
return null;
}
// If it is a valid schematron, there must be a result XSLT present!
if (aXSLTPreprocessor.getXSLTDocument () == null)
{
// Note: this should never occur, as it is in the Prebuild implementation
// the same as "isValidSchematron" but to be implementation agnostic, we
// leave the check anyway.
throw new IllegalStateException ("No XSLT document retrieved from XSLT resource '" +
aXSLTResource.getResourceID () +
"'!");
}
// Create the main validator for the schematron
return aXSLTPreprocessor;
}
示例3: getSchematronXSLTProvider
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
/**
* Return an existing or create a new Schematron XSLT provider for the passed
* resource.
*
* @param aXSLTResource
* The resource of the Schematron rules. May not be <code>null</code>.
* @param aCustomErrorListener
* The custom error listener to be used. May be <code>null</code>.
* @param aCustomURIResolver
* The custom URI resolver to be used. May be <code>null</code>.
* @return <code>null</code> if the passed Schematron XSLT resource does not
* exist.
*/
@Nullable
public static SchematronProviderXSLTPrebuild getSchematronXSLTProvider (@Nonnull final IReadableResource aXSLTResource,
@Nullable final ErrorListener aCustomErrorListener,
@Nullable final URIResolver aCustomURIResolver)
{
ValueEnforcer.notNull (aXSLTResource, "resource");
if (!aXSLTResource.exists ())
{
s_aLogger.warn ("XSLT resource " + aXSLTResource + " does not exist!");
return null;
}
// Determine the unique resource ID for caching
final String sResourceID = aXSLTResource.getResourceID ();
// Validator already in the cache?
final SchematronProviderXSLTPrebuild aProvider = s_aRWLock.readLocked ( () -> s_aCache.get (sResourceID));
if (aProvider != null)
return aProvider;
return s_aRWLock.writeLocked ( () -> {
// Check again in write lock
SchematronProviderXSLTPrebuild aProvider2 = s_aCache.get (sResourceID);
if (aProvider2 == null)
{
// Create new object and put in cache
aProvider2 = createSchematronXSLTProvider (aXSLTResource, aCustomErrorListener, aCustomURIResolver);
if (aProvider2 != null)
s_aCache.put (sResourceID, aProvider2);
}
return aProvider2;
});
}
示例4: createSchematronXSLTProvider
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
/**
* Create a new Schematron validator for the passed resource.
*
* @param aSchematronResource
* The resource of the Schematron rules. May not be <code>null</code>.
* @param aTransformerCustomizer
* The XSLT transformer customizer to be used. May not be
* <code>null</code>.
* @return <code>null</code> if the passed Schematron resource does not exist
* or is invalid.
*/
@Nullable
public static SchematronProviderXSLTFromSCH createSchematronXSLTProvider (@Nonnull final IReadableResource aSchematronResource,
@Nonnull final SCHTransformerCustomizer aTransformerCustomizer)
{
if (s_aLogger.isDebugEnabled ())
s_aLogger.debug ("Compiling Schematron instance " + aSchematronResource.toString ());
final SchematronProviderXSLTFromSCH aXSLTPreprocessor = new SchematronProviderXSLTFromSCH (aSchematronResource,
aTransformerCustomizer);
if (!aXSLTPreprocessor.isValidSchematron ())
{
// Schematron is invalid -> parsing failed
s_aLogger.warn ("The Schematron resource '" + aSchematronResource.getResourceID () + "' is invalid!");
if (s_aLogger.isDebugEnabled () && aXSLTPreprocessor.getXSLTDocument () != null)
{
// Log the created XSLT document for better error tracking
s_aLogger.debug (" Created XSLT document:\n" +
XMLWriter.getNodeAsString (aXSLTPreprocessor.getXSLTDocument ()));
}
return null;
}
// If it is a valid schematron, there must be a result XSLT present!
if (aXSLTPreprocessor.getXSLTDocument () == null)
throw new IllegalStateException ("No XSLT document retrieved from Schematron resource '" +
aSchematronResource.getResourceID () +
"'!");
if (s_aLogger.isDebugEnabled ())
s_aLogger.debug ("Finished compiling Schematron instance " + aSchematronResource.toString ());
// Create the main validator for the schematron
return aXSLTPreprocessor;
}
示例5: AbstractSchematronResource
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
/**
* Constructor
*
* @param aResource
* The Schematron resource. May not be <code>null</code>.
*/
public AbstractSchematronResource (@Nonnull final IReadableResource aResource)
{
m_aResource = ValueEnforcer.notNull (aResource, "Resource");
m_sResourceID = aResource.getResourceID ();
// Set a default entity resolver
m_aEntityResolver = DefaultEntityResolver.createOnDemand (aResource);
}
示例6: ResourceStreamSource
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public ResourceStreamSource (@Nonnull final IReadableResource aResource)
{
this (aResource, aResource.getResourceID ());
}
示例7: CachingTransformStreamSource
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public CachingTransformStreamSource (@Nonnull final IReadableResource aResource)
{
this (aResource.getInputStream (), aResource.getResourceID ());
}
示例8: ResourceLSInput
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public ResourceLSInput (@Nonnull final IReadableResource aResource)
{
this (aResource, aResource.getResourceID ());
}
示例9: CachingSAXInputSource
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public CachingSAXInputSource (@Nonnull final IReadableResource aRes)
{
this (aRes.getInputStream (), aRes.getResourceID ());
}
示例10: ReadableResourceSAXInputSource
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public ReadableResourceSAXInputSource (@Nonnull final IReadableResource aResource)
{
this (aResource, aResource.getResourceID ());
}