// FIXME: parsers should be pooled for better performance.
@SuppressWarnings("unchecked")
private void initialize()
{
PatternCompiler compiler = new GlobCompiler();
List<Pattern> compiledpatterns;
//
// We cache compiled patterns in the engine, since their creation is
// really expensive
//
compiledpatterns = (List<Pattern>)m_engine.getAttribute( INLINE_IMAGE_PATTERNS );
if( compiledpatterns == null )
{
compiledpatterns = new ArrayList<Pattern>(20);
Collection< String > ptrns = m_engine.getAllInlinedImagePatterns();
//
// Make them into Regexp Patterns. Unknown patterns
// are ignored.
//
for( Iterator< String > i = ptrns.iterator(); i.hasNext(); )
{
try
{
compiledpatterns.add( compiler.compile( i.next(),
GlobCompiler.DEFAULT_MASK|GlobCompiler.READ_ONLY_MASK ) );
}
catch( MalformedPatternException e )
{
log.error("Malformed pattern in properties: ", e );