in jspwiki-main/src/main/java/org/apache/wiki/plugin/AbstractReferralPlugin.java [153:234]
public void initialize( final Context context, final Map< String, String > params ) throws PluginException {
m_dateFormat = Preferences.getDateFormat( context, TimeFormat.DATETIME );
m_engine = context.getEngine();
m_maxwidth = TextUtil.parseIntParameter( params.get( PARAM_MAXWIDTH ), Integer.MAX_VALUE );
if( m_maxwidth < 0 ) {
m_maxwidth = 0;
}
String s = params.get( PARAM_SEPARATOR );
if( s != null ) {
m_separator = TextUtil.replaceEntities( s );
// pre-2.1.145 there was a separator at the end of the list
// if they set the parameters, we use the new format of
// before Item1 after separator before Item2 after separator before Item3 after
m_after = "";
}
s = params.get( PARAM_BEFORE );
if( s != null ) {
m_before = s;
}
s = params.get( PARAM_AFTER );
if( s != null ) {
m_after = s;
}
s = params.get( PARAM_COLUMNS );
if( s!= null ) {
items = TextUtil.parseIntParameter( s, 0 );
}
s = params.get( PARAM_EXCLUDE );
if ( s != null ) {
try {
final PatternCompiler pc = new GlobCompiler();
final String[] ptrns = StringUtils.split( s, "," );
m_exclude = new Pattern[ ptrns.length ];
for ( int i = 0; i < ptrns.length; i++ ) {
m_exclude[ i ] = pc.compile( ptrns[ i ] );
}
} catch ( final MalformedPatternException e ) {
throw new PluginException( "Exclude-parameter has a malformed pattern: " + e.getMessage() );
}
}
// TODO: Cut-n-paste, refactor
s = params.get( PARAM_INCLUDE );
if ( s != null ) {
try {
final PatternCompiler pc = new GlobCompiler();
final String[] ptrns = StringUtils.split( s, "," );
m_include = new Pattern[ ptrns.length ];
for ( int i = 0; i < ptrns.length; i++ ) {
m_include[ i ] = pc.compile( ptrns[ i ] );
}
} catch ( final MalformedPatternException e ) {
throw new PluginException( "Include-parameter has a malformed pattern: " + e.getMessage() );
}
}
// LOG.debug( "Requested maximum width is "+m_maxwidth );
s = params.get(PARAM_SHOW);
if ( s != null ) {
if ( s.equalsIgnoreCase( "count" ) ) {
m_show = "count";
}
}
s = params.get( PARAM_LASTMODIFIED );
if ( s != null ) {
if ( s.equalsIgnoreCase( "true" ) ) {
if ( m_show.equals( "count" ) ) {
m_lastModified = true;
} else {
throw new PluginException( "showLastModified=true is only valid if show=count is also specified" );
}
}
}
initSorter( context, params );
}