org.pentaho.reporting.engine.classic.core.filter
Class URLFilter

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.filter.URLFilter
All Implemented Interfaces:
Serializable, Cloneable, DataFilter, DataSource, DataTarget

public class URLFilter
extends Object
implements DataFilter

The URLFilter forms URLs from Strings ,Files and URLs. If an URL is relative, the missing contents can be obtained by a default url, called the baseURL.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
URLFilter()
          DefaultConstructor.
 
Method Summary
 Object clone()
          Creates a clone of the URL filter.
 URL getBaseURL()
          Gets the base url used to make relative URLs absolute.
 DataSource getDataSource()
          Returns the data source for the filter.
 Object getValue(ExpressionRuntime runtime, Element element)
          Tries to form a url from the object returned from the datasource.
 void setBaseURL(URL baseURL)
          Defines the base url used to complete relative urls.
 void setDataSource(DataSource ds)
          Sets the data source.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLFilter

public URLFilter()
DefaultConstructor.

Method Detail

getDataSource

public DataSource getDataSource()
Returns the data source for the filter.

Specified by:
getDataSource in interface DataTarget
Returns:
The data source.

setDataSource

public void setDataSource(DataSource ds)
Sets the data source.

Specified by:
setDataSource in interface DataTarget
Parameters:
ds - The data source.

getValue

public Object getValue(ExpressionRuntime runtime,
                       Element element)
Tries to form a url from the object returned from the datasource. This function will return null if the datasource is null or returned null when getValue was called.

Null is also returned if the datasources value is not an url, a String or a file. If the creation of the url failed with an MalformedURLException or the datasource returned a file which is not readable, also null is returned.

Specified by:
getValue in interface DataSource
Parameters:
runtime - the expression runtime that is used to evaluate formulas and expressions when computing the value of this filter.
element -
Returns:
created url or null if something went wrong on url creation.

getBaseURL

public URL getBaseURL()
Gets the base url used to make relative URLs absolute.

Returns:
the base url used to complete relative urls.

setBaseURL

public void setBaseURL(URL baseURL)
Defines the base url used to complete relative urls.

Parameters:
baseURL - the base URL.

clone

public Object clone()
             throws CloneNotSupportedException
Creates a clone of the URL filter.

Specified by:
clone in interface DataSource
Specified by:
clone in interface DataTarget
Overrides:
clone in class Object
Returns:
A clone.
Throws:
CloneNotSupportedException - should never happen.